MCPcopy
hub / github.com/microsoft/SandDance / rescale

Function rescale

docs/app/js/sanddance-app.js:126693–126706  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126691 ], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5;
126692 delete scale3.unknown;
126693 function rescale() {
126694 const n = domain().length, reverse = range$1[1] < range$1[0], stop = range$1[1 - reverse], space = bandSpace(n, paddingInner, paddingOuter);
126695 let start = range$1[reverse - 0];
126696 step = (stop - start) / (space || 1);
126697 if (round) step = Math.floor(step);
126698 start += (stop - start - step * (n - paddingInner)) * align;
126699 bandwidth = step * (1 - paddingInner);
126700 if (round) {
126701 start = Math.round(start);
126702 bandwidth = Math.round(bandwidth);
126703 }
126704 const values = (0, _d3Array.range)(n).map((i)=>start + step * i);
126705 return ordinalRange(reverse ? values.reverse() : values);
126706 }
126707 scale3.domain = function(_) {
126708 if (arguments.length) {
126709 domain(_);

Callers 6

bandFunction · 0.70
transformerFunction · 0.70
loggishFunction · 0.70
powishFunction · 0.70
quantileFunction · 0.70
quantizeFunction · 0.70

Calls 10

domainFunction · 0.70
bandSpaceFunction · 0.70
clamperFunction · 0.70
logpFunction · 0.70
powpFunction · 0.70
reflectFunction · 0.70
transformFunction · 0.70
transformPowFunction · 0.70
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected