mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 05:58:46 +02:00
N°5621 Move C3 0.4.11 to NPM
This commit is contained in:
7
node_modules/d3/src/scale/bilinear.js
generated
vendored
Normal file
7
node_modules/d3/src/scale/bilinear.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
|
||||
var u = uninterpolate(domain[0], domain[1]),
|
||||
i = interpolate(range[0], range[1]);
|
||||
return function(x) {
|
||||
return i(u(x));
|
||||
};
|
||||
}
|
||||
58
node_modules/d3/src/scale/category.js
generated
vendored
Normal file
58
node_modules/d3/src/scale/category.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import "../color/rgb";
|
||||
import "ordinal";
|
||||
import "scale";
|
||||
|
||||
/*
|
||||
* This product includes color specifications and designs developed by Cynthia
|
||||
* Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
|
||||
*/
|
||||
|
||||
d3.scale.category10 = function() {
|
||||
return d3.scale.ordinal().range(d3_category10);
|
||||
};
|
||||
|
||||
d3.scale.category20 = function() {
|
||||
return d3.scale.ordinal().range(d3_category20);
|
||||
};
|
||||
|
||||
d3.scale.category20b = function() {
|
||||
return d3.scale.ordinal().range(d3_category20b);
|
||||
};
|
||||
|
||||
d3.scale.category20c = function() {
|
||||
return d3.scale.ordinal().range(d3_category20c);
|
||||
};
|
||||
|
||||
var d3_category10 = [
|
||||
0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd,
|
||||
0x8c564b, 0xe377c2, 0x7f7f7f, 0xbcbd22, 0x17becf
|
||||
].map(d3_rgbString);
|
||||
|
||||
var d3_category20 = [
|
||||
0x1f77b4, 0xaec7e8,
|
||||
0xff7f0e, 0xffbb78,
|
||||
0x2ca02c, 0x98df8a,
|
||||
0xd62728, 0xff9896,
|
||||
0x9467bd, 0xc5b0d5,
|
||||
0x8c564b, 0xc49c94,
|
||||
0xe377c2, 0xf7b6d2,
|
||||
0x7f7f7f, 0xc7c7c7,
|
||||
0xbcbd22, 0xdbdb8d,
|
||||
0x17becf, 0x9edae5
|
||||
].map(d3_rgbString);
|
||||
|
||||
var d3_category20b = [
|
||||
0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede,
|
||||
0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c,
|
||||
0x8c6d31, 0xbd9e39, 0xe7ba52, 0xe7cb94,
|
||||
0x843c39, 0xad494a, 0xd6616b, 0xe7969c,
|
||||
0x7b4173, 0xa55194, 0xce6dbd, 0xde9ed6
|
||||
].map(d3_rgbString);
|
||||
|
||||
var d3_category20c = [
|
||||
0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef,
|
||||
0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2,
|
||||
0x31a354, 0x74c476, 0xa1d99b, 0xc7e9c0,
|
||||
0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb,
|
||||
0x636363, 0x969696, 0xbdbdbd, 0xd9d9d9
|
||||
].map(d3_rgbString);
|
||||
33
node_modules/d3/src/scale/identity.js
generated
vendored
Normal file
33
node_modules/d3/src/scale/identity.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import "linear";
|
||||
import "scale";
|
||||
|
||||
d3.scale.identity = function() {
|
||||
return d3_scale_identity([0, 1]);
|
||||
};
|
||||
|
||||
function d3_scale_identity(domain) {
|
||||
|
||||
function identity(x) { return +x; }
|
||||
|
||||
identity.invert = identity;
|
||||
|
||||
identity.domain = identity.range = function(x) {
|
||||
if (!arguments.length) return domain;
|
||||
domain = x.map(identity);
|
||||
return identity;
|
||||
};
|
||||
|
||||
identity.ticks = function(m) {
|
||||
return d3_scale_linearTicks(domain, m);
|
||||
};
|
||||
|
||||
identity.tickFormat = function(m, format) {
|
||||
return d3_scale_linearTickFormat(domain, m, format);
|
||||
};
|
||||
|
||||
identity.copy = function() {
|
||||
return d3_scale_identity(domain);
|
||||
};
|
||||
|
||||
return identity;
|
||||
}
|
||||
11
node_modules/d3/src/scale/index.js
generated
vendored
Normal file
11
node_modules/d3/src/scale/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import "scale";
|
||||
import "linear";
|
||||
import "log";
|
||||
import "pow";
|
||||
import "sqrt";
|
||||
import "ordinal";
|
||||
import "category";
|
||||
import "quantile";
|
||||
import "quantize";
|
||||
import "threshold";
|
||||
import "identity";
|
||||
160
node_modules/d3/src/scale/linear.js
generated
vendored
Normal file
160
node_modules/d3/src/scale/linear.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
import "../arrays/range";
|
||||
import "../core/rebind";
|
||||
import "../interpolate/interpolate";
|
||||
import "../interpolate/round";
|
||||
import "../interpolate/uninterpolate";
|
||||
import "../format/format";
|
||||
import "../math/abs";
|
||||
import "bilinear";
|
||||
import "nice";
|
||||
import "polylinear";
|
||||
import "scale";
|
||||
|
||||
d3.scale.linear = function() {
|
||||
return d3_scale_linear([0, 1], [0, 1], d3_interpolate, false);
|
||||
};
|
||||
|
||||
function d3_scale_linear(domain, range, interpolate, clamp) {
|
||||
var output,
|
||||
input;
|
||||
|
||||
function rescale() {
|
||||
var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear,
|
||||
uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
|
||||
output = linear(domain, range, uninterpolate, interpolate);
|
||||
input = linear(range, domain, uninterpolate, d3_interpolate);
|
||||
return scale;
|
||||
}
|
||||
|
||||
function scale(x) {
|
||||
return output(x);
|
||||
}
|
||||
|
||||
// Note: requires range is coercible to number!
|
||||
scale.invert = function(y) {
|
||||
return input(y);
|
||||
};
|
||||
|
||||
scale.domain = function(x) {
|
||||
if (!arguments.length) return domain;
|
||||
domain = x.map(Number);
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.range = function(x) {
|
||||
if (!arguments.length) return range;
|
||||
range = x;
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.rangeRound = function(x) {
|
||||
return scale.range(x).interpolate(d3_interpolateRound);
|
||||
};
|
||||
|
||||
scale.clamp = function(x) {
|
||||
if (!arguments.length) return clamp;
|
||||
clamp = x;
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.interpolate = function(x) {
|
||||
if (!arguments.length) return interpolate;
|
||||
interpolate = x;
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.ticks = function(m) {
|
||||
return d3_scale_linearTicks(domain, m);
|
||||
};
|
||||
|
||||
scale.tickFormat = function(m, format) {
|
||||
return d3_scale_linearTickFormat(domain, m, format);
|
||||
};
|
||||
|
||||
scale.nice = function(m) {
|
||||
d3_scale_linearNice(domain, m);
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return d3_scale_linear(domain, range, interpolate, clamp);
|
||||
};
|
||||
|
||||
return rescale();
|
||||
}
|
||||
|
||||
function d3_scale_linearRebind(scale, linear) {
|
||||
return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
|
||||
}
|
||||
|
||||
function d3_scale_linearNice(domain, m) {
|
||||
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
|
||||
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
|
||||
return domain;
|
||||
}
|
||||
|
||||
function d3_scale_linearTickRange(domain, m) {
|
||||
if (m == null) m = 10;
|
||||
|
||||
var extent = d3_scaleExtent(domain),
|
||||
span = extent[1] - extent[0],
|
||||
step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
|
||||
err = m / span * step;
|
||||
|
||||
// Filter ticks to get closer to the desired count.
|
||||
if (err <= 0.15) step *= 10;
|
||||
else if (err <= 0.35) step *= 5;
|
||||
else if (err <= 0.75) step *= 2;
|
||||
|
||||
// Round start and stop values to step interval.
|
||||
extent[0] = Math.ceil(extent[0] / step) * step;
|
||||
extent[1] = Math.floor(extent[1] / step) * step + step * 0.5; // inclusive
|
||||
extent[2] = step;
|
||||
return extent;
|
||||
}
|
||||
|
||||
function d3_scale_linearTicks(domain, m) {
|
||||
return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
|
||||
}
|
||||
|
||||
function d3_scale_linearTickFormat(domain, m, format) {
|
||||
var range = d3_scale_linearTickRange(domain, m);
|
||||
if (format) {
|
||||
var match = d3_format_re.exec(format);
|
||||
match.shift();
|
||||
if (match[8] === "s") {
|
||||
var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1])));
|
||||
if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2]));
|
||||
match[8] = "f";
|
||||
format = d3.format(match.join(""));
|
||||
return function(d) {
|
||||
return format(prefix.scale(d)) + prefix.symbol;
|
||||
};
|
||||
}
|
||||
if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range);
|
||||
format = match.join("");
|
||||
} else {
|
||||
format = ",." + d3_scale_linearPrecision(range[2]) + "f";
|
||||
}
|
||||
return d3.format(format);
|
||||
}
|
||||
|
||||
var d3_scale_linearFormatSignificant = {s: 1, g: 1, p: 1, r: 1, e: 1};
|
||||
|
||||
// Returns the number of significant digits after the decimal point.
|
||||
function d3_scale_linearPrecision(value) {
|
||||
return -Math.floor(Math.log(value) / Math.LN10 + 0.01);
|
||||
}
|
||||
|
||||
// For some format types, the precision specifies the number of significant
|
||||
// digits; for others, it specifies the number of digits after the decimal
|
||||
// point. For significant format types, the desired precision equals one plus
|
||||
// the difference between the decimal precision of the range’s maximum absolute
|
||||
// value and the tick step’s decimal precision. For format "e", the digit before
|
||||
// the decimal point counts as one.
|
||||
function d3_scale_linearFormatPrecision(type, range) {
|
||||
var p = d3_scale_linearPrecision(range[2]);
|
||||
return type in d3_scale_linearFormatSignificant
|
||||
? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e")
|
||||
: p - (type === "%") * 2;
|
||||
}
|
||||
92
node_modules/d3/src/scale/log.js
generated
vendored
Normal file
92
node_modules/d3/src/scale/log.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
import "../format/format";
|
||||
import "linear";
|
||||
import "nice";
|
||||
import "scale";
|
||||
|
||||
d3.scale.log = function() {
|
||||
return d3_scale_log(d3.scale.linear().domain([0, 1]), 10, true, [1, 10]);
|
||||
};
|
||||
|
||||
function d3_scale_log(linear, base, positive, domain) {
|
||||
|
||||
function log(x) {
|
||||
return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base);
|
||||
}
|
||||
|
||||
function pow(x) {
|
||||
return positive ? Math.pow(base, x) : -Math.pow(base, -x);
|
||||
}
|
||||
|
||||
function scale(x) {
|
||||
return linear(log(x));
|
||||
}
|
||||
|
||||
scale.invert = function(x) {
|
||||
return pow(linear.invert(x));
|
||||
};
|
||||
|
||||
scale.domain = function(x) {
|
||||
if (!arguments.length) return domain;
|
||||
positive = x[0] >= 0;
|
||||
linear.domain((domain = x.map(Number)).map(log));
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.base = function(_) {
|
||||
if (!arguments.length) return base;
|
||||
base = +_;
|
||||
linear.domain(domain.map(log));
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.nice = function() {
|
||||
var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative);
|
||||
linear.domain(niced); // do not modify the linear scale’s domain in-place!
|
||||
domain = niced.map(pow);
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.ticks = function() {
|
||||
var extent = d3_scaleExtent(domain),
|
||||
ticks = [],
|
||||
u = extent[0],
|
||||
v = extent[1],
|
||||
i = Math.floor(log(u)),
|
||||
j = Math.ceil(log(v)),
|
||||
n = base % 1 ? 2 : base;
|
||||
if (isFinite(j - i)) {
|
||||
if (positive) {
|
||||
for (; i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k);
|
||||
ticks.push(pow(i));
|
||||
} else {
|
||||
ticks.push(pow(i));
|
||||
for (; i++ < j;) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k);
|
||||
}
|
||||
for (i = 0; ticks[i] < u; i++) {} // strip small values
|
||||
for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
|
||||
ticks = ticks.slice(i, j);
|
||||
}
|
||||
return ticks;
|
||||
};
|
||||
|
||||
scale.tickFormat = function(n, format) {
|
||||
if (!arguments.length) return d3_scale_logFormat;
|
||||
if (arguments.length < 2) format = d3_scale_logFormat;
|
||||
else if (typeof format !== "function") format = d3.format(format);
|
||||
var k = Math.max(1, base * n / scale.ticks().length);
|
||||
return function(d) {
|
||||
var i = d / pow(Math.round(log(d)));
|
||||
if (i * base < base - 0.5) i *= base;
|
||||
return i <= k ? format(d) : "";
|
||||
};
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return d3_scale_log(linear.copy(), base, positive, domain);
|
||||
};
|
||||
|
||||
return d3_scale_linearRebind(scale, linear);
|
||||
}
|
||||
|
||||
var d3_scale_logFormat = d3.format(".0e"),
|
||||
d3_scale_logNiceNegative = {floor: function(x) { return -Math.ceil(-x); }, ceil: function(x) { return -Math.floor(-x); }};
|
||||
30
node_modules/d3/src/scale/nice.js
generated
vendored
Normal file
30
node_modules/d3/src/scale/nice.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import "../core/identity";
|
||||
|
||||
function d3_scale_nice(domain, nice) {
|
||||
var i0 = 0,
|
||||
i1 = domain.length - 1,
|
||||
x0 = domain[i0],
|
||||
x1 = domain[i1],
|
||||
dx;
|
||||
|
||||
if (x1 < x0) {
|
||||
dx = i0, i0 = i1, i1 = dx;
|
||||
dx = x0, x0 = x1, x1 = dx;
|
||||
}
|
||||
|
||||
domain[i0] = nice.floor(x0);
|
||||
domain[i1] = nice.ceil(x1);
|
||||
return domain;
|
||||
}
|
||||
|
||||
function d3_scale_niceStep(step) {
|
||||
return step ? {
|
||||
floor: function(x) { return Math.floor(x / step) * step; },
|
||||
ceil: function(x) { return Math.ceil(x / step) * step; }
|
||||
} : d3_scale_niceIdentity;
|
||||
}
|
||||
|
||||
var d3_scale_niceIdentity = {
|
||||
floor: d3_identity,
|
||||
ceil: d3_identity
|
||||
};
|
||||
102
node_modules/d3/src/scale/ordinal.js
generated
vendored
Normal file
102
node_modules/d3/src/scale/ordinal.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
import "../arrays/map";
|
||||
import "../arrays/range";
|
||||
import "scale";
|
||||
|
||||
d3.scale.ordinal = function() {
|
||||
return d3_scale_ordinal([], {t: "range", a: [[]]});
|
||||
};
|
||||
|
||||
function d3_scale_ordinal(domain, ranger) {
|
||||
var index,
|
||||
range,
|
||||
rangeBand;
|
||||
|
||||
function scale(x) {
|
||||
return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];
|
||||
}
|
||||
|
||||
function steps(start, step) {
|
||||
return d3.range(domain.length).map(function(i) { return start + step * i; });
|
||||
}
|
||||
|
||||
scale.domain = function(x) {
|
||||
if (!arguments.length) return domain;
|
||||
domain = [];
|
||||
index = new d3_Map;
|
||||
var i = -1, n = x.length, xi;
|
||||
while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
|
||||
return scale[ranger.t].apply(scale, ranger.a);
|
||||
};
|
||||
|
||||
scale.range = function(x) {
|
||||
if (!arguments.length) return range;
|
||||
range = x;
|
||||
rangeBand = 0;
|
||||
ranger = {t: "range", a: arguments};
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.rangePoints = function(x, padding) {
|
||||
if (arguments.length < 2) padding = 0;
|
||||
var start = x[0],
|
||||
stop = x[1],
|
||||
step = domain.length < 2 ? (start = (start + stop) / 2, 0) : (stop - start) / (domain.length - 1 + padding);
|
||||
range = steps(start + step * padding / 2, step);
|
||||
rangeBand = 0;
|
||||
ranger = {t: "rangePoints", a: arguments};
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.rangeRoundPoints = function(x, padding) {
|
||||
if (arguments.length < 2) padding = 0;
|
||||
var start = x[0],
|
||||
stop = x[1],
|
||||
step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), 0) : (stop - start) / (domain.length - 1 + padding) | 0; // bitwise floor for symmetry
|
||||
range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step);
|
||||
rangeBand = 0;
|
||||
ranger = {t: "rangeRoundPoints", a: arguments};
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.rangeBands = function(x, padding, outerPadding) {
|
||||
if (arguments.length < 2) padding = 0;
|
||||
if (arguments.length < 3) outerPadding = padding;
|
||||
var reverse = x[1] < x[0],
|
||||
start = x[reverse - 0],
|
||||
stop = x[1 - reverse],
|
||||
step = (stop - start) / (domain.length - padding + 2 * outerPadding);
|
||||
range = steps(start + step * outerPadding, step);
|
||||
if (reverse) range.reverse();
|
||||
rangeBand = step * (1 - padding);
|
||||
ranger = {t: "rangeBands", a: arguments};
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.rangeRoundBands = function(x, padding, outerPadding) {
|
||||
if (arguments.length < 2) padding = 0;
|
||||
if (arguments.length < 3) outerPadding = padding;
|
||||
var reverse = x[1] < x[0],
|
||||
start = x[reverse - 0],
|
||||
stop = x[1 - reverse],
|
||||
step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding));
|
||||
range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 2), step);
|
||||
if (reverse) range.reverse();
|
||||
rangeBand = Math.round(step * (1 - padding));
|
||||
ranger = {t: "rangeRoundBands", a: arguments};
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.rangeBand = function() {
|
||||
return rangeBand;
|
||||
};
|
||||
|
||||
scale.rangeExtent = function() {
|
||||
return d3_scaleExtent(ranger.a[0]);
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return d3_scale_ordinal(domain, ranger);
|
||||
};
|
||||
|
||||
return scale.domain(domain);
|
||||
}
|
||||
24
node_modules/d3/src/scale/polylinear.js
generated
vendored
Normal file
24
node_modules/d3/src/scale/polylinear.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import "../arrays/bisect";
|
||||
|
||||
function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
|
||||
var u = [],
|
||||
i = [],
|
||||
j = 0,
|
||||
k = Math.min(domain.length, range.length) - 1;
|
||||
|
||||
// Handle descending domains.
|
||||
if (domain[k] < domain[0]) {
|
||||
domain = domain.slice().reverse();
|
||||
range = range.slice().reverse();
|
||||
}
|
||||
|
||||
while (++j <= k) {
|
||||
u.push(uninterpolate(domain[j - 1], domain[j]));
|
||||
i.push(interpolate(range[j - 1], range[j]));
|
||||
}
|
||||
|
||||
return function(x) {
|
||||
var j = d3.bisect(domain, x, 1, k) - 1;
|
||||
return i[j](u[j](x));
|
||||
};
|
||||
}
|
||||
57
node_modules/d3/src/scale/pow.js
generated
vendored
Normal file
57
node_modules/d3/src/scale/pow.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import "linear";
|
||||
import "scale";
|
||||
|
||||
d3.scale.pow = function() {
|
||||
return d3_scale_pow(d3.scale.linear(), 1, [0, 1]);
|
||||
};
|
||||
|
||||
function d3_scale_pow(linear, exponent, domain) {
|
||||
var powp = d3_scale_powPow(exponent),
|
||||
powb = d3_scale_powPow(1 / exponent);
|
||||
|
||||
function scale(x) {
|
||||
return linear(powp(x));
|
||||
}
|
||||
|
||||
scale.invert = function(x) {
|
||||
return powb(linear.invert(x));
|
||||
};
|
||||
|
||||
scale.domain = function(x) {
|
||||
if (!arguments.length) return domain;
|
||||
linear.domain((domain = x.map(Number)).map(powp));
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.ticks = function(m) {
|
||||
return d3_scale_linearTicks(domain, m);
|
||||
};
|
||||
|
||||
scale.tickFormat = function(m, format) {
|
||||
return d3_scale_linearTickFormat(domain, m, format);
|
||||
};
|
||||
|
||||
scale.nice = function(m) {
|
||||
return scale.domain(d3_scale_linearNice(domain, m));
|
||||
};
|
||||
|
||||
scale.exponent = function(x) {
|
||||
if (!arguments.length) return exponent;
|
||||
powp = d3_scale_powPow(exponent = x);
|
||||
powb = d3_scale_powPow(1 / exponent);
|
||||
linear.domain(domain.map(powp));
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return d3_scale_pow(linear.copy(), exponent, domain);
|
||||
};
|
||||
|
||||
return d3_scale_linearRebind(scale, linear);
|
||||
}
|
||||
|
||||
function d3_scale_powPow(e) {
|
||||
return function(x) {
|
||||
return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
|
||||
};
|
||||
}
|
||||
55
node_modules/d3/src/scale/quantile.js
generated
vendored
Normal file
55
node_modules/d3/src/scale/quantile.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import "../arrays/ascending";
|
||||
import "../arrays/bisect";
|
||||
import "../arrays/quantile";
|
||||
import "../math/number";
|
||||
import "scale";
|
||||
|
||||
d3.scale.quantile = function() {
|
||||
return d3_scale_quantile([], []);
|
||||
};
|
||||
|
||||
function d3_scale_quantile(domain, range) {
|
||||
var thresholds;
|
||||
|
||||
function rescale() {
|
||||
var k = 0,
|
||||
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 range[d3.bisect(thresholds, x)];
|
||||
}
|
||||
|
||||
scale.domain = function(x) {
|
||||
if (!arguments.length) return domain;
|
||||
domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending);
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.range = function(x) {
|
||||
if (!arguments.length) return range;
|
||||
range = x;
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.quantiles = function() {
|
||||
return thresholds;
|
||||
};
|
||||
|
||||
scale.invertExtent = function(y) {
|
||||
y = range.indexOf(y);
|
||||
return y < 0 ? [NaN, NaN] : [
|
||||
y > 0 ? thresholds[y - 1] : domain[0],
|
||||
y < thresholds.length ? thresholds[y] : domain[domain.length - 1]
|
||||
];
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return d3_scale_quantile(domain, range); // copy on write!
|
||||
};
|
||||
|
||||
return rescale();
|
||||
}
|
||||
44
node_modules/d3/src/scale/quantize.js
generated
vendored
Normal file
44
node_modules/d3/src/scale/quantize.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
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();
|
||||
}
|
||||
10
node_modules/d3/src/scale/scale.js
generated
vendored
Normal file
10
node_modules/d3/src/scale/scale.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
d3.scale = {};
|
||||
|
||||
function d3_scaleExtent(domain) {
|
||||
var start = domain[0], stop = domain[domain.length - 1];
|
||||
return start < stop ? [start, stop] : [stop, start];
|
||||
}
|
||||
|
||||
function d3_scaleRange(scale) {
|
||||
return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
|
||||
}
|
||||
6
node_modules/d3/src/scale/sqrt.js
generated
vendored
Normal file
6
node_modules/d3/src/scale/sqrt.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import "pow";
|
||||
import "scale";
|
||||
|
||||
d3.scale.sqrt = function() {
|
||||
return d3.scale.pow().exponent(0.5);
|
||||
};
|
||||
36
node_modules/d3/src/scale/threshold.js
generated
vendored
Normal file
36
node_modules/d3/src/scale/threshold.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import "../arrays/bisect";
|
||||
import "scale";
|
||||
|
||||
d3.scale.threshold = function() {
|
||||
return d3_scale_threshold([0.5], [0, 1]);
|
||||
};
|
||||
|
||||
function d3_scale_threshold(domain, range) {
|
||||
|
||||
function scale(x) {
|
||||
if (x <= x) return range[d3.bisect(domain, x)];
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
if (!arguments.length) return domain;
|
||||
domain = _;
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
if (!arguments.length) return range;
|
||||
range = _;
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.invertExtent = function(y) {
|
||||
y = range.indexOf(y);
|
||||
return [domain[y - 1], domain[y]];
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return d3_scale_threshold(domain, range);
|
||||
};
|
||||
|
||||
return scale;
|
||||
};
|
||||
Reference in New Issue
Block a user