MCPcopy Create free account
hub / github.com/microsoft/SandDance / tickCount

Function tickCount

docs/app/js/sanddance-app.js:127118–127133  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 2

maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected