* Determine the tick count or interval function. * @param {Scale} scale - The scale for which to generate tick values. * @param {*} count - The desired tick count or interval specifier. * @param {number} minStep - The desired minimum step between tick values. * @return {*} - The tick count or in
(scale8, count, minStep)
| 127116 | * @param {number} minStep - The desired minimum step between tick values. |
| 127117 | * @return {*} - The tick count or interval function. |
| 127118 | */ function tickCount(scale8, count, minStep) { |
| 127119 | let step; |
| 127120 | if ((0, _vegaUtil.isNumber)(count)) { |
| 127121 | if (scale8.bins) count = Math.max(count, scale8.bins.length); |
| 127122 | if (minStep != null) count = Math.min(count, Math.floor((0, _vegaUtil.span)(scale8.domain()) / minStep || 1)); |
| 127123 | } |
| 127124 | if ((0, _vegaUtil.isObject)(count)) { |
| 127125 | step = count.step; |
| 127126 | count = count.interval; |
| 127127 | } |
| 127128 | if ((0, _vegaUtil.isString)(count)) { |
| 127129 | count = scale8.type === Time ? (0, _vegaTime.timeInterval)(count) : scale8.type == UTC ? (0, _vegaTime.utcInterval)(count) : (0, _vegaUtil.error)("Only time and utc scales accept interval strings."); |
| 127130 | if (step) count = count.every(step); |
| 127131 | } |
| 127132 | return count; |
| 127133 | } |
| 127134 | /** |
| 127135 | * Filter a set of candidate tick values, ensuring that only tick values |
| 127136 | * that lie within the scale range are included. |