Sha256: 24ce0369dd98ba618398edb0e4469e294c5cd991543d13959539d55ec7d03922
Contents?: true
Size: 919 Bytes
Versions: 31
Compression:
Stored size: 919 Bytes
Contents
d3.scale.quantile = function() { return d3_scale_quantile([], []); }; function d3_scale_quantile(domain, range) { var thresholds; function rescale() { var k = 0, n = domain.length, q = range.length; thresholds = []; while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); return scale; } function scale(x) { if (isNaN(x = +x)) return NaN; return range[d3.bisect(thresholds, x)]; } scale.domain = function(x) { if (!arguments.length) return domain; domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); return rescale(); }; scale.range = function(x) { if (!arguments.length) return range; range = x; return rescale(); }; scale.quantiles = function() { return thresholds; }; scale.copy = function() { return d3_scale_quantile(domain, range); // copy on write! }; return rescale(); };
Version data entries
31 entries across 31 versions & 2 rubygems