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

Function rescale

external/.d3.js:14858–14870  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14856 delete scale.unknown;
14857
14858 function rescale() {
14859 var n = domain().length,
14860 reverse = r1 < r0,
14861 start = reverse ? r1 : r0,
14862 stop = reverse ? r0 : r1;
14863 step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
14864 if (round) step = Math.floor(step);
14865 start += (stop - start - step * (n - paddingInner)) * align;
14866 bandwidth = step * (1 - paddingInner);
14867 if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
14868 var values = range$2(n).map(function(i) { return start + step * i; });
14869 return ordinalRange(reverse ? values.reverse() : values);
14870 }
14871
14872 scale.domain = function(_) {
14873 return arguments.length ? (domain(_), rescale()) : domain();

Callers 6

bandFunction · 0.85
transformer$2Function · 0.85
loggishFunction · 0.85
powishFunction · 0.85
quantileFunction · 0.85
quantizeFunction · 0.85

Calls 12

range$2Function · 0.85
clamperFunction · 0.85
logpFunction · 0.85
powpFunction · 0.85
reflectFunction · 0.85
transformPowFunction · 0.85
quantileSortedFunction · 0.85
maxMethod · 0.80
mapMethod · 0.80
reverseMethod · 0.80
minMethod · 0.80
transformFunction · 0.70

Tested by

no test coverage detected