tahamajs's picture
download
raw
869 Bytes
import "scale";
d3.scale.quantize = function() {
return d3_scale_quantize(0, 1, [0, 1]);
};
function d3_scale_quantize(x0, x1, range) {
var kx, i;
function scale(x) {
return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
}
function rescale() {
kx = range.length / (x1 - x0);
i = range.length - 1;
return scale;
}
scale.domain = function(x) {
if (!arguments.length) return [x0, x1];
x0 = +x[0];
x1 = +x[x.length - 1];
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.invertExtent = function(y) {
y = range.indexOf(y);
y = y < 0 ? NaN : y / kx + x0;
return [y, y + 1 / kx];
};
scale.copy = function() {
return d3_scale_quantize(x0, x1, range); // copy on write
};
return rescale();
}

Xet Storage Details

Size:
869 Bytes
·
Xet hash:
3d0aabffa9cb4cda9677549cdd930c88cfc8f3a1d483a714cf203e5a0fd6749b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.