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

Function sequentialQuantile

external/.d3.js:16901–16934  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16899}
16900
16901function sequentialQuantile() {
16902 var domain = [],
16903 interpolator = identity$3;
16904
16905 function scale(x) {
16906 if (x != null && !isNaN(x = +x)) return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1));
16907 }
16908
16909 scale.domain = function(_) {
16910 if (!arguments.length) return domain.slice();
16911 domain = [];
16912 for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);
16913 domain.sort(ascending$3);
16914 return scale;
16915 };
16916
16917 scale.interpolator = function(_) {
16918 return arguments.length ? (interpolator = _, scale) : interpolator;
16919 };
16920
16921 scale.range = function() {
16922 return domain.map((d, i) => interpolator(i / (domain.length - 1)));
16923 };
16924
16925 scale.quantiles = function(n) {
16926 return Array.from({length: n + 1}, (_, i) => quantile$1(domain, i / n));
16927 };
16928
16929 scale.copy = function() {
16930 return sequentialQuantile(interpolator).domain(domain);
16931 };
16932
16933 return initInterpolator.apply(scale, arguments);
16934}
16935
16936function transformer() {
16937 var x0 = 0,

Callers

nothing calls this directly

Calls 5

quantile$1Function · 0.85
sliceMethod · 0.80
sortMethod · 0.80
mapMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected