MCPcopy Create free account
hub / github.com/breck7/scroll / ticks

Function ticks

external/.d3.js:623–638  ·  view source on GitHub ↗
(start, stop, count)

Source from the content-addressed store, hash-verified

621}
622
623function ticks(start, stop, count) {
624 stop = +stop, start = +start, count = +count;
625 if (!(count > 0)) return [];
626 if (start === stop) return [start];
627 const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
628 if (!(i2 >= i1)) return [];
629 const n = i2 - i1 + 1, ticks = new Array(n);
630 if (reverse) {
631 if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;
632 else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;
633 } else {
634 if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;
635 else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;
636 }
637 return ticks;
638}
639
640function tickIncrement(start, stop, count) {
641 stop = +stop, start = +start, count = +count;

Callers 6

histogramFunction · 0.85
contoursFunction · 0.85
densityFunction · 0.85
linearishFunction · 0.85
loggishFunction · 0.85
calendarFunction · 0.85

Calls 3

tickSpecFunction · 0.85
tickIntervalFunction · 0.85
reverseMethod · 0.80

Tested by

no test coverage detected