Merge branch '3.2.7'
This commit is contained in:
Коммит
268af88a2a
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "d3",
|
"name": "d3",
|
||||||
"version": "3.2.6",
|
"version": "3.2.7",
|
||||||
"main": "d3.js",
|
"main": "d3.js",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"d3.js"
|
"d3.js"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"animation",
|
"animation",
|
||||||
"canvas"
|
"canvas"
|
||||||
],
|
],
|
||||||
"version": "3.2.6",
|
"version": "3.2.7",
|
||||||
"main": "index-browserify.js",
|
"main": "index-browserify.js",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"d3.js",
|
"d3.js",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
d3 = function() {
|
d3 = function() {
|
||||||
var d3 = {
|
var d3 = {
|
||||||
version: "3.2.6"
|
version: "3.2.7"
|
||||||
};
|
};
|
||||||
if (!Date.now) Date.now = function() {
|
if (!Date.now) Date.now = function() {
|
||||||
return +new Date();
|
return +new Date();
|
||||||
|
@ -1152,7 +1152,7 @@ d3 = function() {
|
||||||
return d3.rebind(drag, event, "on");
|
return d3.rebind(drag, event, "on");
|
||||||
};
|
};
|
||||||
d3.behavior.zoom = function() {
|
d3.behavior.zoom = function() {
|
||||||
var translate = [ 0, 0 ], translate0, scale = 1, distance0, scale0, scaleExtent = d3_behavior_zoomInfinity, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
|
var translate = [ 0, 0 ], translate0, scale = 1, scaleExtent = d3_behavior_zoomInfinity, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
|
||||||
function zoom() {
|
function zoom() {
|
||||||
this.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on(mousemove, mousewheelreset).on("dblclick.zoom", dblclicked).on("touchstart.zoom", touchstarted);
|
this.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on(mousemove, mousewheelreset).on("dblclick.zoom", dblclicked).on("touchstart.zoom", touchstarted);
|
||||||
}
|
}
|
||||||
|
@ -1232,12 +1232,9 @@ d3 = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function touchstarted() {
|
function touchstarted() {
|
||||||
var target = this, event_ = event.of(target, arguments), touches = d3.touches(target), now = Date.now(), name = "zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove." + name, touchend = "touchend." + name, w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended).on(mousedown, null).on(mousemove, null), dragRestore = d3_event_dragSuppress();
|
var target = this, event_ = event.of(target, arguments), touches = d3.touches(target), locations = {}, distance0 = 0, scale0 = scale, now = Date.now(), name = "zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove." + name, touchend = "touchend." + name, w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended), t = d3.select(target).on(mousedown, null), dragRestore = d3_event_dragSuppress();
|
||||||
scale0 = scale;
|
|
||||||
translate0 = {};
|
|
||||||
distance0 = 0;
|
|
||||||
touches.forEach(function(t) {
|
touches.forEach(function(t) {
|
||||||
translate0[t.identifier] = location(t);
|
locations[t.identifier] = location(t);
|
||||||
});
|
});
|
||||||
if (touches.length === 1) {
|
if (touches.length === 1) {
|
||||||
if (now - touchtime < 500) {
|
if (now - touchtime < 500) {
|
||||||
|
@ -1253,9 +1250,9 @@ d3 = function() {
|
||||||
distance0 = dx * dx + dy * dy;
|
distance0 = dx * dx + dy * dy;
|
||||||
}
|
}
|
||||||
function moved() {
|
function moved() {
|
||||||
var touches = d3.touches(target), p0 = touches[0], l0 = translate0[p0.identifier];
|
var touches = d3.touches(target), p0 = touches[0], l0 = locations[p0.identifier];
|
||||||
if (p1 = touches[1]) {
|
if (p1 = touches[1]) {
|
||||||
var p1, l1 = translate0[p1.identifier], scale1 = d3.event.scale;
|
var p1, l1 = locations[p1.identifier], scale1 = d3.event.scale;
|
||||||
if (scale1 == null) {
|
if (scale1 == null) {
|
||||||
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1;
|
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1;
|
||||||
scale1 = distance0 && Math.sqrt(distance1 / distance0);
|
scale1 = distance0 && Math.sqrt(distance1 / distance0);
|
||||||
|
@ -1270,6 +1267,7 @@ d3 = function() {
|
||||||
}
|
}
|
||||||
function ended() {
|
function ended() {
|
||||||
w.on(touchmove, null).on(touchend, null);
|
w.on(touchmove, null).on(touchend, null);
|
||||||
|
t.on(mousedown, mousedowned);
|
||||||
dragRestore();
|
dragRestore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1435,6 +1433,12 @@ d3 = function() {
|
||||||
d3.rgb = function(r, g, b) {
|
d3.rgb = function(r, g, b) {
|
||||||
return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
|
return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
|
||||||
};
|
};
|
||||||
|
function d3_rgbNumber(value) {
|
||||||
|
return d3_rgb(value >> 16, value >> 8 & 255, value & 255);
|
||||||
|
}
|
||||||
|
function d3_rgbString(value) {
|
||||||
|
return d3_rgbNumber(value) + "";
|
||||||
|
}
|
||||||
function d3_rgb(r, g, b) {
|
function d3_rgb(r, g, b) {
|
||||||
return new d3_Rgb(r, g, b);
|
return new d3_Rgb(r, g, b);
|
||||||
}
|
}
|
||||||
|
@ -1451,11 +1455,11 @@ d3 = function() {
|
||||||
if (r && r < i) r = i;
|
if (r && r < i) r = i;
|
||||||
if (g && g < i) g = i;
|
if (g && g < i) g = i;
|
||||||
if (b && b < i) b = i;
|
if (b && b < i) b = i;
|
||||||
return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
|
return d3_rgb(Math.min(255, ~~(r / k)), Math.min(255, ~~(g / k)), Math.min(255, ~~(b / k)));
|
||||||
};
|
};
|
||||||
d3_rgbPrototype.darker = function(k) {
|
d3_rgbPrototype.darker = function(k) {
|
||||||
k = Math.pow(.7, arguments.length ? k : 1);
|
k = Math.pow(.7, arguments.length ? k : 1);
|
||||||
return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
|
return d3_rgb(~~(k * this.r), ~~(k * this.g), ~~(k * this.b));
|
||||||
};
|
};
|
||||||
d3_rgbPrototype.hsl = function() {
|
d3_rgbPrototype.hsl = function() {
|
||||||
return d3_rgb_hsl(this.r, this.g, this.b);
|
return d3_rgb_hsl(this.r, this.g, this.b);
|
||||||
|
@ -1530,156 +1534,156 @@ d3 = function() {
|
||||||
return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
|
return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
|
||||||
}
|
}
|
||||||
var d3_rgb_names = d3.map({
|
var d3_rgb_names = d3.map({
|
||||||
aliceblue: "#f0f8ff",
|
aliceblue: 15792383,
|
||||||
antiquewhite: "#faebd7",
|
antiquewhite: 16444375,
|
||||||
aqua: "#00ffff",
|
aqua: 65535,
|
||||||
aquamarine: "#7fffd4",
|
aquamarine: 8388564,
|
||||||
azure: "#f0ffff",
|
azure: 15794175,
|
||||||
beige: "#f5f5dc",
|
beige: 16119260,
|
||||||
bisque: "#ffe4c4",
|
bisque: 16770244,
|
||||||
black: "#000000",
|
black: 0,
|
||||||
blanchedalmond: "#ffebcd",
|
blanchedalmond: 16772045,
|
||||||
blue: "#0000ff",
|
blue: 255,
|
||||||
blueviolet: "#8a2be2",
|
blueviolet: 9055202,
|
||||||
brown: "#a52a2a",
|
brown: 10824234,
|
||||||
burlywood: "#deb887",
|
burlywood: 14596231,
|
||||||
cadetblue: "#5f9ea0",
|
cadetblue: 6266528,
|
||||||
chartreuse: "#7fff00",
|
chartreuse: 8388352,
|
||||||
chocolate: "#d2691e",
|
chocolate: 13789470,
|
||||||
coral: "#ff7f50",
|
coral: 16744272,
|
||||||
cornflowerblue: "#6495ed",
|
cornflowerblue: 6591981,
|
||||||
cornsilk: "#fff8dc",
|
cornsilk: 16775388,
|
||||||
crimson: "#dc143c",
|
crimson: 14423100,
|
||||||
cyan: "#00ffff",
|
cyan: 65535,
|
||||||
darkblue: "#00008b",
|
darkblue: 139,
|
||||||
darkcyan: "#008b8b",
|
darkcyan: 35723,
|
||||||
darkgoldenrod: "#b8860b",
|
darkgoldenrod: 12092939,
|
||||||
darkgray: "#a9a9a9",
|
darkgray: 11119017,
|
||||||
darkgreen: "#006400",
|
darkgreen: 25600,
|
||||||
darkgrey: "#a9a9a9",
|
darkgrey: 11119017,
|
||||||
darkkhaki: "#bdb76b",
|
darkkhaki: 12433259,
|
||||||
darkmagenta: "#8b008b",
|
darkmagenta: 9109643,
|
||||||
darkolivegreen: "#556b2f",
|
darkolivegreen: 5597999,
|
||||||
darkorange: "#ff8c00",
|
darkorange: 16747520,
|
||||||
darkorchid: "#9932cc",
|
darkorchid: 10040012,
|
||||||
darkred: "#8b0000",
|
darkred: 9109504,
|
||||||
darksalmon: "#e9967a",
|
darksalmon: 15308410,
|
||||||
darkseagreen: "#8fbc8f",
|
darkseagreen: 9419919,
|
||||||
darkslateblue: "#483d8b",
|
darkslateblue: 4734347,
|
||||||
darkslategray: "#2f4f4f",
|
darkslategray: 3100495,
|
||||||
darkslategrey: "#2f4f4f",
|
darkslategrey: 3100495,
|
||||||
darkturquoise: "#00ced1",
|
darkturquoise: 52945,
|
||||||
darkviolet: "#9400d3",
|
darkviolet: 9699539,
|
||||||
deeppink: "#ff1493",
|
deeppink: 16716947,
|
||||||
deepskyblue: "#00bfff",
|
deepskyblue: 49151,
|
||||||
dimgray: "#696969",
|
dimgray: 6908265,
|
||||||
dimgrey: "#696969",
|
dimgrey: 6908265,
|
||||||
dodgerblue: "#1e90ff",
|
dodgerblue: 2003199,
|
||||||
firebrick: "#b22222",
|
firebrick: 11674146,
|
||||||
floralwhite: "#fffaf0",
|
floralwhite: 16775920,
|
||||||
forestgreen: "#228b22",
|
forestgreen: 2263842,
|
||||||
fuchsia: "#ff00ff",
|
fuchsia: 16711935,
|
||||||
gainsboro: "#dcdcdc",
|
gainsboro: 14474460,
|
||||||
ghostwhite: "#f8f8ff",
|
ghostwhite: 16316671,
|
||||||
gold: "#ffd700",
|
gold: 16766720,
|
||||||
goldenrod: "#daa520",
|
goldenrod: 14329120,
|
||||||
gray: "#808080",
|
gray: 8421504,
|
||||||
green: "#008000",
|
green: 32768,
|
||||||
greenyellow: "#adff2f",
|
greenyellow: 11403055,
|
||||||
grey: "#808080",
|
grey: 8421504,
|
||||||
honeydew: "#f0fff0",
|
honeydew: 15794160,
|
||||||
hotpink: "#ff69b4",
|
hotpink: 16738740,
|
||||||
indianred: "#cd5c5c",
|
indianred: 13458524,
|
||||||
indigo: "#4b0082",
|
indigo: 4915330,
|
||||||
ivory: "#fffff0",
|
ivory: 16777200,
|
||||||
khaki: "#f0e68c",
|
khaki: 15787660,
|
||||||
lavender: "#e6e6fa",
|
lavender: 15132410,
|
||||||
lavenderblush: "#fff0f5",
|
lavenderblush: 16773365,
|
||||||
lawngreen: "#7cfc00",
|
lawngreen: 8190976,
|
||||||
lemonchiffon: "#fffacd",
|
lemonchiffon: 16775885,
|
||||||
lightblue: "#add8e6",
|
lightblue: 11393254,
|
||||||
lightcoral: "#f08080",
|
lightcoral: 15761536,
|
||||||
lightcyan: "#e0ffff",
|
lightcyan: 14745599,
|
||||||
lightgoldenrodyellow: "#fafad2",
|
lightgoldenrodyellow: 16448210,
|
||||||
lightgray: "#d3d3d3",
|
lightgray: 13882323,
|
||||||
lightgreen: "#90ee90",
|
lightgreen: 9498256,
|
||||||
lightgrey: "#d3d3d3",
|
lightgrey: 13882323,
|
||||||
lightpink: "#ffb6c1",
|
lightpink: 16758465,
|
||||||
lightsalmon: "#ffa07a",
|
lightsalmon: 16752762,
|
||||||
lightseagreen: "#20b2aa",
|
lightseagreen: 2142890,
|
||||||
lightskyblue: "#87cefa",
|
lightskyblue: 8900346,
|
||||||
lightslategray: "#778899",
|
lightslategray: 7833753,
|
||||||
lightslategrey: "#778899",
|
lightslategrey: 7833753,
|
||||||
lightsteelblue: "#b0c4de",
|
lightsteelblue: 11584734,
|
||||||
lightyellow: "#ffffe0",
|
lightyellow: 16777184,
|
||||||
lime: "#00ff00",
|
lime: 65280,
|
||||||
limegreen: "#32cd32",
|
limegreen: 3329330,
|
||||||
linen: "#faf0e6",
|
linen: 16445670,
|
||||||
magenta: "#ff00ff",
|
magenta: 16711935,
|
||||||
maroon: "#800000",
|
maroon: 8388608,
|
||||||
mediumaquamarine: "#66cdaa",
|
mediumaquamarine: 6737322,
|
||||||
mediumblue: "#0000cd",
|
mediumblue: 205,
|
||||||
mediumorchid: "#ba55d3",
|
mediumorchid: 12211667,
|
||||||
mediumpurple: "#9370db",
|
mediumpurple: 9662683,
|
||||||
mediumseagreen: "#3cb371",
|
mediumseagreen: 3978097,
|
||||||
mediumslateblue: "#7b68ee",
|
mediumslateblue: 8087790,
|
||||||
mediumspringgreen: "#00fa9a",
|
mediumspringgreen: 64154,
|
||||||
mediumturquoise: "#48d1cc",
|
mediumturquoise: 4772300,
|
||||||
mediumvioletred: "#c71585",
|
mediumvioletred: 13047173,
|
||||||
midnightblue: "#191970",
|
midnightblue: 1644912,
|
||||||
mintcream: "#f5fffa",
|
mintcream: 16121850,
|
||||||
mistyrose: "#ffe4e1",
|
mistyrose: 16770273,
|
||||||
moccasin: "#ffe4b5",
|
moccasin: 16770229,
|
||||||
navajowhite: "#ffdead",
|
navajowhite: 16768685,
|
||||||
navy: "#000080",
|
navy: 128,
|
||||||
oldlace: "#fdf5e6",
|
oldlace: 16643558,
|
||||||
olive: "#808000",
|
olive: 8421376,
|
||||||
olivedrab: "#6b8e23",
|
olivedrab: 7048739,
|
||||||
orange: "#ffa500",
|
orange: 16753920,
|
||||||
orangered: "#ff4500",
|
orangered: 16729344,
|
||||||
orchid: "#da70d6",
|
orchid: 14315734,
|
||||||
palegoldenrod: "#eee8aa",
|
palegoldenrod: 15657130,
|
||||||
palegreen: "#98fb98",
|
palegreen: 10025880,
|
||||||
paleturquoise: "#afeeee",
|
paleturquoise: 11529966,
|
||||||
palevioletred: "#db7093",
|
palevioletred: 14381203,
|
||||||
papayawhip: "#ffefd5",
|
papayawhip: 16773077,
|
||||||
peachpuff: "#ffdab9",
|
peachpuff: 16767673,
|
||||||
peru: "#cd853f",
|
peru: 13468991,
|
||||||
pink: "#ffc0cb",
|
pink: 16761035,
|
||||||
plum: "#dda0dd",
|
plum: 14524637,
|
||||||
powderblue: "#b0e0e6",
|
powderblue: 11591910,
|
||||||
purple: "#800080",
|
purple: 8388736,
|
||||||
red: "#ff0000",
|
red: 16711680,
|
||||||
rosybrown: "#bc8f8f",
|
rosybrown: 12357519,
|
||||||
royalblue: "#4169e1",
|
royalblue: 4286945,
|
||||||
saddlebrown: "#8b4513",
|
saddlebrown: 9127187,
|
||||||
salmon: "#fa8072",
|
salmon: 16416882,
|
||||||
sandybrown: "#f4a460",
|
sandybrown: 16032864,
|
||||||
seagreen: "#2e8b57",
|
seagreen: 3050327,
|
||||||
seashell: "#fff5ee",
|
seashell: 16774638,
|
||||||
sienna: "#a0522d",
|
sienna: 10506797,
|
||||||
silver: "#c0c0c0",
|
silver: 12632256,
|
||||||
skyblue: "#87ceeb",
|
skyblue: 8900331,
|
||||||
slateblue: "#6a5acd",
|
slateblue: 6970061,
|
||||||
slategray: "#708090",
|
slategray: 7372944,
|
||||||
slategrey: "#708090",
|
slategrey: 7372944,
|
||||||
snow: "#fffafa",
|
snow: 16775930,
|
||||||
springgreen: "#00ff7f",
|
springgreen: 65407,
|
||||||
steelblue: "#4682b4",
|
steelblue: 4620980,
|
||||||
tan: "#d2b48c",
|
tan: 13808780,
|
||||||
teal: "#008080",
|
teal: 32896,
|
||||||
thistle: "#d8bfd8",
|
thistle: 14204888,
|
||||||
tomato: "#ff6347",
|
tomato: 16737095,
|
||||||
turquoise: "#40e0d0",
|
turquoise: 4251856,
|
||||||
violet: "#ee82ee",
|
violet: 15631086,
|
||||||
wheat: "#f5deb3",
|
wheat: 16113331,
|
||||||
white: "#ffffff",
|
white: 16777215,
|
||||||
whitesmoke: "#f5f5f5",
|
whitesmoke: 16119285,
|
||||||
yellow: "#ffff00",
|
yellow: 16776960,
|
||||||
yellowgreen: "#9acd32"
|
yellowgreen: 10145074
|
||||||
});
|
});
|
||||||
d3_rgb_names.forEach(function(key, value) {
|
d3_rgb_names.forEach(function(key, value) {
|
||||||
d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
|
d3_rgb_names.set(key, d3_rgbNumber(value));
|
||||||
});
|
});
|
||||||
function d3_functor(v) {
|
function d3_functor(v) {
|
||||||
return typeof v === "function" ? v : function() {
|
return typeof v === "function" ? v : function() {
|
||||||
|
@ -1881,14 +1885,14 @@ d3 = function() {
|
||||||
};
|
};
|
||||||
d3.csv = d3.dsv(",", "text/csv");
|
d3.csv = d3.dsv(",", "text/csv");
|
||||||
d3.tsv = d3.dsv(" ", "text/tab-separated-values");
|
d3.tsv = d3.dsv(" ", "text/tab-separated-values");
|
||||||
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout;
|
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_active, d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) {
|
||||||
|
setTimeout(callback, 17);
|
||||||
|
};
|
||||||
d3.timer = function(callback, delay, then) {
|
d3.timer = function(callback, delay, then) {
|
||||||
if (arguments.length < 3) {
|
var n = arguments.length;
|
||||||
if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
|
if (n < 2) delay = 0;
|
||||||
then = Date.now();
|
if (n < 3) then = Date.now();
|
||||||
}
|
var time = then + delay, timer = {
|
||||||
var time = then + delay;
|
|
||||||
var timer = {
|
|
||||||
callback: callback,
|
callback: callback,
|
||||||
time: time,
|
time: time,
|
||||||
next: null
|
next: null
|
||||||
|
@ -1918,11 +1922,19 @@ d3 = function() {
|
||||||
d3_timer_mark();
|
d3_timer_mark();
|
||||||
d3_timer_sweep();
|
d3_timer_sweep();
|
||||||
};
|
};
|
||||||
|
function d3_timer_replace(callback, delay, then) {
|
||||||
|
var n = arguments.length;
|
||||||
|
if (n < 2) delay = 0;
|
||||||
|
if (n < 3) then = Date.now();
|
||||||
|
d3_timer_active.callback = callback;
|
||||||
|
d3_timer_active.time = then + delay;
|
||||||
|
}
|
||||||
function d3_timer_mark() {
|
function d3_timer_mark() {
|
||||||
var now = Date.now(), timer = d3_timer_queueHead;
|
var now = Date.now();
|
||||||
while (timer) {
|
d3_timer_active = d3_timer_queueHead;
|
||||||
if (now >= timer.time) timer.flush = timer.callback(now - timer.time);
|
while (d3_timer_active) {
|
||||||
timer = timer.next;
|
if (now >= d3_timer_active.time) d3_timer_active.flush = d3_timer_active.callback(now - d3_timer_active.time);
|
||||||
|
d3_timer_active = d3_timer_active.next;
|
||||||
}
|
}
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
@ -1939,9 +1951,6 @@ d3 = function() {
|
||||||
d3_timer_queueTail = t0;
|
d3_timer_queueTail = t0;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
var d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) {
|
|
||||||
setTimeout(callback, 17);
|
|
||||||
};
|
|
||||||
var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ], d3_format_currencySymbol = "$";
|
var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ], d3_format_currencySymbol = "$";
|
||||||
var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
|
var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
|
||||||
d3.formatPrefix = function(value, precision) {
|
d3.formatPrefix = function(value, precision) {
|
||||||
|
@ -4921,10 +4930,7 @@ d3 = function() {
|
||||||
b = d3.rgb(b);
|
b = d3.rgb(b);
|
||||||
var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
|
var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.r = Math.round(ar + br * t);
|
return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
|
||||||
a.g = Math.round(ag + bg * t);
|
|
||||||
a.b = Math.round(ab + bb * t);
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
d3.interpolateObject = d3_interpolateObject;
|
d3.interpolateObject = d3_interpolateObject;
|
||||||
|
@ -5149,10 +5155,7 @@ d3 = function() {
|
||||||
if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;
|
if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;
|
||||||
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
|
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.h = ah + bh * t;
|
return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
|
||||||
a.c = ac + bc * t;
|
|
||||||
a.l = al + bl * t;
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
d3.interpolateHsl = d3_interpolateHsl;
|
d3.interpolateHsl = d3_interpolateHsl;
|
||||||
|
@ -5163,10 +5166,7 @@ d3 = function() {
|
||||||
if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;
|
if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;
|
||||||
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
|
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.h = ah + bh * t;
|
return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + "";
|
||||||
a.s = as + bs * t;
|
|
||||||
a.l = al + bl * t;
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
d3.interpolateLab = d3_interpolateLab;
|
d3.interpolateLab = d3_interpolateLab;
|
||||||
|
@ -5175,10 +5175,7 @@ d3 = function() {
|
||||||
b = d3.lab(b);
|
b = d3.lab(b);
|
||||||
var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
|
var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.l = al + bl * t;
|
return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
|
||||||
a.a = aa + ba * t;
|
|
||||||
a.b = ab + bb * t;
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
d3.interpolateRound = d3_interpolateRound;
|
d3.interpolateRound = d3_interpolateRound;
|
||||||
|
@ -7023,10 +7020,10 @@ d3 = function() {
|
||||||
d3.scale.category20c = function() {
|
d3.scale.category20c = function() {
|
||||||
return d3.scale.ordinal().range(d3_category20c);
|
return d3.scale.ordinal().range(d3_category20c);
|
||||||
};
|
};
|
||||||
var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
|
var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString);
|
||||||
var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
|
var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString);
|
||||||
var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
|
var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString);
|
||||||
var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
|
var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString);
|
||||||
d3.scale.quantile = function() {
|
d3.scale.quantile = function() {
|
||||||
return d3_scale_quantile([], []);
|
return d3_scale_quantile([], []);
|
||||||
};
|
};
|
||||||
|
@ -7513,7 +7510,7 @@ d3 = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return d3_transition(subgroups, this.id, this.time).ease(this.ease());
|
return d3_transition(subgroups, this.id);
|
||||||
};
|
};
|
||||||
d3_transitionPrototype.tween = function(name, tween) {
|
d3_transitionPrototype.tween = function(name, tween) {
|
||||||
var id = this.id;
|
var id = this.id;
|
||||||
|
@ -7701,7 +7698,7 @@ d3 = function() {
|
||||||
++lock.count;
|
++lock.count;
|
||||||
d3.timer(function(elapsed) {
|
d3.timer(function(elapsed) {
|
||||||
var d = node.__data__, ease = transition.ease, delay = transition.delay, duration = transition.duration, tweened = [];
|
var d = node.__data__, ease = transition.ease, delay = transition.delay, duration = transition.duration, tweened = [];
|
||||||
return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1;
|
if (delay <= elapsed) start(elapsed); else d3_timer_replace(start, delay, time);
|
||||||
function start(elapsed) {
|
function start(elapsed) {
|
||||||
if (lock.active > id) return stop();
|
if (lock.active > id) return stop();
|
||||||
lock.active = id;
|
lock.active = id;
|
||||||
|
@ -7711,8 +7708,8 @@ d3 = function() {
|
||||||
tweened.push(value);
|
tweened.push(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!tick(elapsed)) d3.timer(tick, 0, time);
|
if (tick(elapsed)) return 1;
|
||||||
return 1;
|
d3_timer_replace(tick, 0, time);
|
||||||
}
|
}
|
||||||
function tick(elapsed) {
|
function tick(elapsed) {
|
||||||
if (lock.active !== id) return stop();
|
if (lock.active !== id) return stop();
|
||||||
|
@ -7731,7 +7728,6 @@ d3 = function() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}, 0, time);
|
}, 0, time);
|
||||||
return transition;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d3.svg.axis = function() {
|
d3.svg.axis = function() {
|
||||||
|
@ -8682,7 +8678,7 @@ d3 = function() {
|
||||||
var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
|
var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
|
||||||
if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
|
if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
|
||||||
if (!i) return linear.ticks(m).map(d3_time_scaleDate);
|
if (!i) return linear.ticks(m).map(d3_time_scaleDate);
|
||||||
if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
|
if (target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target) --i;
|
||||||
m = methods[i];
|
m = methods[i];
|
||||||
k = m[1];
|
k = m[1];
|
||||||
m = m[0].range;
|
m = m[0].range;
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "d3",
|
"name": "d3",
|
||||||
"version": "3.2.6",
|
"version": "3.2.7",
|
||||||
"description": "A small, free JavaScript library for manipulating documents based on data.",
|
"description": "A small, free JavaScript library for manipulating documents based on data.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"dom",
|
"dom",
|
||||||
|
|
|
@ -11,8 +11,6 @@ d3.behavior.zoom = function() {
|
||||||
var translate = [0, 0],
|
var translate = [0, 0],
|
||||||
translate0, // translate when we started zooming (to avoid drift)
|
translate0, // translate when we started zooming (to avoid drift)
|
||||||
scale = 1,
|
scale = 1,
|
||||||
distance0, // distance² between initial touches
|
|
||||||
scale0, // scale when we started touching
|
|
||||||
scaleExtent = d3_behavior_zoomInfinity,
|
scaleExtent = d3_behavior_zoomInfinity,
|
||||||
mousedown = "mousedown.zoom",
|
mousedown = "mousedown.zoom",
|
||||||
mousemove = "mousemove.zoom",
|
mousemove = "mousemove.zoom",
|
||||||
|
@ -123,17 +121,18 @@ d3.behavior.zoom = function() {
|
||||||
var target = this,
|
var target = this,
|
||||||
event_ = event.of(target, arguments),
|
event_ = event.of(target, arguments),
|
||||||
touches = d3.touches(target),
|
touches = d3.touches(target),
|
||||||
|
locations = {},
|
||||||
|
distance0 = 0, // distance² between initial touches
|
||||||
|
scale0 = scale, // scale when we started touching
|
||||||
now = Date.now(),
|
now = Date.now(),
|
||||||
name = "zoom-" + d3.event.changedTouches[0].identifier,
|
name = "zoom-" + d3.event.changedTouches[0].identifier,
|
||||||
touchmove = "touchmove." + name,
|
touchmove = "touchmove." + name,
|
||||||
touchend = "touchend." + name,
|
touchend = "touchend." + name,
|
||||||
w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended).on(mousedown, null).on(mousemove, null), // prevent duplicate events
|
w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended),
|
||||||
|
t = d3.select(target).on(mousedown, null), // prevent duplicate events
|
||||||
dragRestore = d3_event_dragSuppress();
|
dragRestore = d3_event_dragSuppress();
|
||||||
|
|
||||||
scale0 = scale;
|
touches.forEach(function(t) { locations[t.identifier] = location(t); });
|
||||||
translate0 = {};
|
|
||||||
distance0 = 0;
|
|
||||||
touches.forEach(function(t) { translate0[t.identifier] = location(t); });
|
|
||||||
|
|
||||||
if (touches.length === 1) {
|
if (touches.length === 1) {
|
||||||
if (now - touchtime < 500) { // dbltap
|
if (now - touchtime < 500) { // dbltap
|
||||||
|
@ -153,10 +152,10 @@ d3.behavior.zoom = function() {
|
||||||
function moved() {
|
function moved() {
|
||||||
var touches = d3.touches(target),
|
var touches = d3.touches(target),
|
||||||
p0 = touches[0],
|
p0 = touches[0],
|
||||||
l0 = translate0[p0.identifier];
|
l0 = locations[p0.identifier];
|
||||||
|
|
||||||
if (p1 = touches[1]) {
|
if (p1 = touches[1]) {
|
||||||
var p1, l1 = translate0[p1.identifier],
|
var p1, l1 = locations[p1.identifier],
|
||||||
scale1 = d3.event.scale;
|
scale1 = d3.event.scale;
|
||||||
if (scale1 == null) {
|
if (scale1 == null) {
|
||||||
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1;
|
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1;
|
||||||
|
@ -174,6 +173,7 @@ d3.behavior.zoom = function() {
|
||||||
|
|
||||||
function ended() {
|
function ended() {
|
||||||
w.on(touchmove, null).on(touchend, null);
|
w.on(touchmove, null).on(touchend, null);
|
||||||
|
t.on(mousedown, mousedowned);
|
||||||
dragRestore();
|
dragRestore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
314
src/color/rgb.js
314
src/color/rgb.js
|
@ -11,6 +11,14 @@ d3.rgb = function(r, g, b) {
|
||||||
: d3_rgb(~~r, ~~g, ~~b);
|
: d3_rgb(~~r, ~~g, ~~b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function d3_rgbNumber(value) {
|
||||||
|
return d3_rgb(value >> 16, value >> 8 & 0xff, value & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
function d3_rgbString(value) {
|
||||||
|
return d3_rgbNumber(value) + "";
|
||||||
|
}
|
||||||
|
|
||||||
function d3_rgb(r, g, b) {
|
function d3_rgb(r, g, b) {
|
||||||
return new d3_Rgb(r, g, b);
|
return new d3_Rgb(r, g, b);
|
||||||
}
|
}
|
||||||
|
@ -33,18 +41,12 @@ d3_rgbPrototype.brighter = function(k) {
|
||||||
if (r && r < i) r = i;
|
if (r && r < i) r = i;
|
||||||
if (g && g < i) g = i;
|
if (g && g < i) g = i;
|
||||||
if (b && b < i) b = i;
|
if (b && b < i) b = i;
|
||||||
return d3_rgb(
|
return d3_rgb(Math.min(255, ~~(r / k)), Math.min(255, ~~(g / k)), Math.min(255, ~~(b / k)));
|
||||||
Math.min(255, Math.floor(r / k)),
|
|
||||||
Math.min(255, Math.floor(g / k)),
|
|
||||||
Math.min(255, Math.floor(b / k)));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
d3_rgbPrototype.darker = function(k) {
|
d3_rgbPrototype.darker = function(k) {
|
||||||
k = Math.pow(0.7, arguments.length ? k : 1);
|
k = Math.pow(0.7, arguments.length ? k : 1);
|
||||||
return d3_rgb(
|
return d3_rgb(~~(k * this.r), ~~(k * this.g), ~~(k * this.b));
|
||||||
Math.floor(k * this.r),
|
|
||||||
Math.floor(k * this.g),
|
|
||||||
Math.floor(k * this.b));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
d3_rgbPrototype.hsl = function() {
|
d3_rgbPrototype.hsl = function() {
|
||||||
|
@ -153,155 +155,155 @@ function d3_rgb_parseNumber(c) { // either integer or percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
var d3_rgb_names = d3.map({
|
var d3_rgb_names = d3.map({
|
||||||
aliceblue: "#f0f8ff",
|
aliceblue: 0xf0f8ff,
|
||||||
antiquewhite: "#faebd7",
|
antiquewhite: 0xfaebd7,
|
||||||
aqua: "#00ffff",
|
aqua: 0x00ffff,
|
||||||
aquamarine: "#7fffd4",
|
aquamarine: 0x7fffd4,
|
||||||
azure: "#f0ffff",
|
azure: 0xf0ffff,
|
||||||
beige: "#f5f5dc",
|
beige: 0xf5f5dc,
|
||||||
bisque: "#ffe4c4",
|
bisque: 0xffe4c4,
|
||||||
black: "#000000",
|
black: 0x000000,
|
||||||
blanchedalmond: "#ffebcd",
|
blanchedalmond: 0xffebcd,
|
||||||
blue: "#0000ff",
|
blue: 0x0000ff,
|
||||||
blueviolet: "#8a2be2",
|
blueviolet: 0x8a2be2,
|
||||||
brown: "#a52a2a",
|
brown: 0xa52a2a,
|
||||||
burlywood: "#deb887",
|
burlywood: 0xdeb887,
|
||||||
cadetblue: "#5f9ea0",
|
cadetblue: 0x5f9ea0,
|
||||||
chartreuse: "#7fff00",
|
chartreuse: 0x7fff00,
|
||||||
chocolate: "#d2691e",
|
chocolate: 0xd2691e,
|
||||||
coral: "#ff7f50",
|
coral: 0xff7f50,
|
||||||
cornflowerblue: "#6495ed",
|
cornflowerblue: 0x6495ed,
|
||||||
cornsilk: "#fff8dc",
|
cornsilk: 0xfff8dc,
|
||||||
crimson: "#dc143c",
|
crimson: 0xdc143c,
|
||||||
cyan: "#00ffff",
|
cyan: 0x00ffff,
|
||||||
darkblue: "#00008b",
|
darkblue: 0x00008b,
|
||||||
darkcyan: "#008b8b",
|
darkcyan: 0x008b8b,
|
||||||
darkgoldenrod: "#b8860b",
|
darkgoldenrod: 0xb8860b,
|
||||||
darkgray: "#a9a9a9",
|
darkgray: 0xa9a9a9,
|
||||||
darkgreen: "#006400",
|
darkgreen: 0x006400,
|
||||||
darkgrey: "#a9a9a9",
|
darkgrey: 0xa9a9a9,
|
||||||
darkkhaki: "#bdb76b",
|
darkkhaki: 0xbdb76b,
|
||||||
darkmagenta: "#8b008b",
|
darkmagenta: 0x8b008b,
|
||||||
darkolivegreen: "#556b2f",
|
darkolivegreen: 0x556b2f,
|
||||||
darkorange: "#ff8c00",
|
darkorange: 0xff8c00,
|
||||||
darkorchid: "#9932cc",
|
darkorchid: 0x9932cc,
|
||||||
darkred: "#8b0000",
|
darkred: 0x8b0000,
|
||||||
darksalmon: "#e9967a",
|
darksalmon: 0xe9967a,
|
||||||
darkseagreen: "#8fbc8f",
|
darkseagreen: 0x8fbc8f,
|
||||||
darkslateblue: "#483d8b",
|
darkslateblue: 0x483d8b,
|
||||||
darkslategray: "#2f4f4f",
|
darkslategray: 0x2f4f4f,
|
||||||
darkslategrey: "#2f4f4f",
|
darkslategrey: 0x2f4f4f,
|
||||||
darkturquoise: "#00ced1",
|
darkturquoise: 0x00ced1,
|
||||||
darkviolet: "#9400d3",
|
darkviolet: 0x9400d3,
|
||||||
deeppink: "#ff1493",
|
deeppink: 0xff1493,
|
||||||
deepskyblue: "#00bfff",
|
deepskyblue: 0x00bfff,
|
||||||
dimgray: "#696969",
|
dimgray: 0x696969,
|
||||||
dimgrey: "#696969",
|
dimgrey: 0x696969,
|
||||||
dodgerblue: "#1e90ff",
|
dodgerblue: 0x1e90ff,
|
||||||
firebrick: "#b22222",
|
firebrick: 0xb22222,
|
||||||
floralwhite: "#fffaf0",
|
floralwhite: 0xfffaf0,
|
||||||
forestgreen: "#228b22",
|
forestgreen: 0x228b22,
|
||||||
fuchsia: "#ff00ff",
|
fuchsia: 0xff00ff,
|
||||||
gainsboro: "#dcdcdc",
|
gainsboro: 0xdcdcdc,
|
||||||
ghostwhite: "#f8f8ff",
|
ghostwhite: 0xf8f8ff,
|
||||||
gold: "#ffd700",
|
gold: 0xffd700,
|
||||||
goldenrod: "#daa520",
|
goldenrod: 0xdaa520,
|
||||||
gray: "#808080",
|
gray: 0x808080,
|
||||||
green: "#008000",
|
green: 0x008000,
|
||||||
greenyellow: "#adff2f",
|
greenyellow: 0xadff2f,
|
||||||
grey: "#808080",
|
grey: 0x808080,
|
||||||
honeydew: "#f0fff0",
|
honeydew: 0xf0fff0,
|
||||||
hotpink: "#ff69b4",
|
hotpink: 0xff69b4,
|
||||||
indianred: "#cd5c5c",
|
indianred: 0xcd5c5c,
|
||||||
indigo: "#4b0082",
|
indigo: 0x4b0082,
|
||||||
ivory: "#fffff0",
|
ivory: 0xfffff0,
|
||||||
khaki: "#f0e68c",
|
khaki: 0xf0e68c,
|
||||||
lavender: "#e6e6fa",
|
lavender: 0xe6e6fa,
|
||||||
lavenderblush: "#fff0f5",
|
lavenderblush: 0xfff0f5,
|
||||||
lawngreen: "#7cfc00",
|
lawngreen: 0x7cfc00,
|
||||||
lemonchiffon: "#fffacd",
|
lemonchiffon: 0xfffacd,
|
||||||
lightblue: "#add8e6",
|
lightblue: 0xadd8e6,
|
||||||
lightcoral: "#f08080",
|
lightcoral: 0xf08080,
|
||||||
lightcyan: "#e0ffff",
|
lightcyan: 0xe0ffff,
|
||||||
lightgoldenrodyellow: "#fafad2",
|
lightgoldenrodyellow: 0xfafad2,
|
||||||
lightgray: "#d3d3d3",
|
lightgray: 0xd3d3d3,
|
||||||
lightgreen: "#90ee90",
|
lightgreen: 0x90ee90,
|
||||||
lightgrey: "#d3d3d3",
|
lightgrey: 0xd3d3d3,
|
||||||
lightpink: "#ffb6c1",
|
lightpink: 0xffb6c1,
|
||||||
lightsalmon: "#ffa07a",
|
lightsalmon: 0xffa07a,
|
||||||
lightseagreen: "#20b2aa",
|
lightseagreen: 0x20b2aa,
|
||||||
lightskyblue: "#87cefa",
|
lightskyblue: 0x87cefa,
|
||||||
lightslategray: "#778899",
|
lightslategray: 0x778899,
|
||||||
lightslategrey: "#778899",
|
lightslategrey: 0x778899,
|
||||||
lightsteelblue: "#b0c4de",
|
lightsteelblue: 0xb0c4de,
|
||||||
lightyellow: "#ffffe0",
|
lightyellow: 0xffffe0,
|
||||||
lime: "#00ff00",
|
lime: 0x00ff00,
|
||||||
limegreen: "#32cd32",
|
limegreen: 0x32cd32,
|
||||||
linen: "#faf0e6",
|
linen: 0xfaf0e6,
|
||||||
magenta: "#ff00ff",
|
magenta: 0xff00ff,
|
||||||
maroon: "#800000",
|
maroon: 0x800000,
|
||||||
mediumaquamarine: "#66cdaa",
|
mediumaquamarine: 0x66cdaa,
|
||||||
mediumblue: "#0000cd",
|
mediumblue: 0x0000cd,
|
||||||
mediumorchid: "#ba55d3",
|
mediumorchid: 0xba55d3,
|
||||||
mediumpurple: "#9370db",
|
mediumpurple: 0x9370db,
|
||||||
mediumseagreen: "#3cb371",
|
mediumseagreen: 0x3cb371,
|
||||||
mediumslateblue: "#7b68ee",
|
mediumslateblue: 0x7b68ee,
|
||||||
mediumspringgreen: "#00fa9a",
|
mediumspringgreen: 0x00fa9a,
|
||||||
mediumturquoise: "#48d1cc",
|
mediumturquoise: 0x48d1cc,
|
||||||
mediumvioletred: "#c71585",
|
mediumvioletred: 0xc71585,
|
||||||
midnightblue: "#191970",
|
midnightblue: 0x191970,
|
||||||
mintcream: "#f5fffa",
|
mintcream: 0xf5fffa,
|
||||||
mistyrose: "#ffe4e1",
|
mistyrose: 0xffe4e1,
|
||||||
moccasin: "#ffe4b5",
|
moccasin: 0xffe4b5,
|
||||||
navajowhite: "#ffdead",
|
navajowhite: 0xffdead,
|
||||||
navy: "#000080",
|
navy: 0x000080,
|
||||||
oldlace: "#fdf5e6",
|
oldlace: 0xfdf5e6,
|
||||||
olive: "#808000",
|
olive: 0x808000,
|
||||||
olivedrab: "#6b8e23",
|
olivedrab: 0x6b8e23,
|
||||||
orange: "#ffa500",
|
orange: 0xffa500,
|
||||||
orangered: "#ff4500",
|
orangered: 0xff4500,
|
||||||
orchid: "#da70d6",
|
orchid: 0xda70d6,
|
||||||
palegoldenrod: "#eee8aa",
|
palegoldenrod: 0xeee8aa,
|
||||||
palegreen: "#98fb98",
|
palegreen: 0x98fb98,
|
||||||
paleturquoise: "#afeeee",
|
paleturquoise: 0xafeeee,
|
||||||
palevioletred: "#db7093",
|
palevioletred: 0xdb7093,
|
||||||
papayawhip: "#ffefd5",
|
papayawhip: 0xffefd5,
|
||||||
peachpuff: "#ffdab9",
|
peachpuff: 0xffdab9,
|
||||||
peru: "#cd853f",
|
peru: 0xcd853f,
|
||||||
pink: "#ffc0cb",
|
pink: 0xffc0cb,
|
||||||
plum: "#dda0dd",
|
plum: 0xdda0dd,
|
||||||
powderblue: "#b0e0e6",
|
powderblue: 0xb0e0e6,
|
||||||
purple: "#800080",
|
purple: 0x800080,
|
||||||
red: "#ff0000",
|
red: 0xff0000,
|
||||||
rosybrown: "#bc8f8f",
|
rosybrown: 0xbc8f8f,
|
||||||
royalblue: "#4169e1",
|
royalblue: 0x4169e1,
|
||||||
saddlebrown: "#8b4513",
|
saddlebrown: 0x8b4513,
|
||||||
salmon: "#fa8072",
|
salmon: 0xfa8072,
|
||||||
sandybrown: "#f4a460",
|
sandybrown: 0xf4a460,
|
||||||
seagreen: "#2e8b57",
|
seagreen: 0x2e8b57,
|
||||||
seashell: "#fff5ee",
|
seashell: 0xfff5ee,
|
||||||
sienna: "#a0522d",
|
sienna: 0xa0522d,
|
||||||
silver: "#c0c0c0",
|
silver: 0xc0c0c0,
|
||||||
skyblue: "#87ceeb",
|
skyblue: 0x87ceeb,
|
||||||
slateblue: "#6a5acd",
|
slateblue: 0x6a5acd,
|
||||||
slategray: "#708090",
|
slategray: 0x708090,
|
||||||
slategrey: "#708090",
|
slategrey: 0x708090,
|
||||||
snow: "#fffafa",
|
snow: 0xfffafa,
|
||||||
springgreen: "#00ff7f",
|
springgreen: 0x00ff7f,
|
||||||
steelblue: "#4682b4",
|
steelblue: 0x4682b4,
|
||||||
tan: "#d2b48c",
|
tan: 0xd2b48c,
|
||||||
teal: "#008080",
|
teal: 0x008080,
|
||||||
thistle: "#d8bfd8",
|
thistle: 0xd8bfd8,
|
||||||
tomato: "#ff6347",
|
tomato: 0xff6347,
|
||||||
turquoise: "#40e0d0",
|
turquoise: 0x40e0d0,
|
||||||
violet: "#ee82ee",
|
violet: 0xee82ee,
|
||||||
wheat: "#f5deb3",
|
wheat: 0xf5deb3,
|
||||||
white: "#ffffff",
|
white: 0xffffff,
|
||||||
whitesmoke: "#f5f5f5",
|
whitesmoke: 0xf5f5f5,
|
||||||
yellow: "#ffff00",
|
yellow: 0xffff00,
|
||||||
yellowgreen: "#9acd32"
|
yellowgreen: 0x9acd32
|
||||||
});
|
});
|
||||||
|
|
||||||
d3_rgb_names.forEach(function(key, value) {
|
d3_rgb_names.forEach(function(key, value) {
|
||||||
d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
|
d3_rgb_names.set(key, d3_rgbNumber(value));
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,20 +4,18 @@ import "../core/vendor";
|
||||||
var d3_timer_queueHead,
|
var d3_timer_queueHead,
|
||||||
d3_timer_queueTail,
|
d3_timer_queueTail,
|
||||||
d3_timer_interval, // is an interval (or frame) active?
|
d3_timer_interval, // is an interval (or frame) active?
|
||||||
d3_timer_timeout; // is a timeout active?
|
d3_timer_timeout, // is a timeout active?
|
||||||
|
d3_timer_active, // active timer object
|
||||||
|
d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); };
|
||||||
|
|
||||||
// The timer will continue to fire until callback returns true.
|
// The timer will continue to fire until callback returns true.
|
||||||
d3.timer = function(callback, delay, then) {
|
d3.timer = function(callback, delay, then) {
|
||||||
if (arguments.length < 3) {
|
var n = arguments.length;
|
||||||
if (arguments.length < 2) delay = 0;
|
if (n < 2) delay = 0;
|
||||||
else if (!isFinite(delay)) return;
|
if (n < 3) then = Date.now();
|
||||||
then = Date.now();
|
|
||||||
}
|
|
||||||
|
|
||||||
var time = then + delay;
|
|
||||||
|
|
||||||
// Add the callback to the tail of the queue.
|
// Add the callback to the tail of the queue.
|
||||||
var timer = {callback: callback, time: time, next: null};
|
var time = then + delay, timer = {callback: callback, time: time, next: null};
|
||||||
if (d3_timer_queueTail) d3_timer_queueTail.next = timer;
|
if (d3_timer_queueTail) d3_timer_queueTail.next = timer;
|
||||||
else d3_timer_queueHead = timer;
|
else d3_timer_queueHead = timer;
|
||||||
d3_timer_queueTail = timer;
|
d3_timer_queueTail = timer;
|
||||||
|
@ -50,12 +48,20 @@ d3.timer.flush = function() {
|
||||||
d3_timer_sweep();
|
d3_timer_sweep();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function d3_timer_replace(callback, delay, then) {
|
||||||
|
var n = arguments.length;
|
||||||
|
if (n < 2) delay = 0;
|
||||||
|
if (n < 3) then = Date.now();
|
||||||
|
d3_timer_active.callback = callback;
|
||||||
|
d3_timer_active.time = then + delay;
|
||||||
|
}
|
||||||
|
|
||||||
function d3_timer_mark() {
|
function d3_timer_mark() {
|
||||||
var now = Date.now(),
|
var now = Date.now();
|
||||||
timer = d3_timer_queueHead;
|
d3_timer_active = d3_timer_queueHead;
|
||||||
while (timer) {
|
while (d3_timer_active) {
|
||||||
if (now >= timer.time) timer.flush = timer.callback(now - timer.time);
|
if (now >= d3_timer_active.time) d3_timer_active.flush = d3_timer_active.callback(now - d3_timer_active.time);
|
||||||
timer = timer.next;
|
d3_timer_active = d3_timer_active.next;
|
||||||
}
|
}
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +83,3 @@ function d3_timer_sweep() {
|
||||||
d3_timer_queueTail = t0;
|
d3_timer_queueTail = t0;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
var d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")]
|
|
||||||
|| function(callback) { setTimeout(callback, 17); };
|
|
||||||
|
|
|
@ -15,9 +15,6 @@ function d3_interpolateHcl(a, b) {
|
||||||
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;
|
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;
|
||||||
else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
|
else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.h = ah + bh * t;
|
return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
|
||||||
a.c = ac + bc * t;
|
|
||||||
a.l = al + bl * t;
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,6 @@ function d3_interpolateHsl(a, b) {
|
||||||
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;
|
if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah;
|
||||||
else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
|
else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.h = ah + bh * t;
|
return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + "";
|
||||||
a.s = as + bs * t;
|
|
||||||
a.l = al + bl * t;
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,6 @@ function d3_interpolateLab(a, b) {
|
||||||
ba = b.a - aa,
|
ba = b.a - aa,
|
||||||
bb = b.b - ab;
|
bb = b.b - ab;
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.l = al + bl * t;
|
return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
|
||||||
a.a = aa + ba * t;
|
|
||||||
a.b = ab + bb * t;
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ function d3_interpolateRgb(a, b) {
|
||||||
bg = b.g - ag,
|
bg = b.g - ag,
|
||||||
bb = b.b - ab;
|
bb = b.b - ab;
|
||||||
return function(t) {
|
return function(t) {
|
||||||
a.r = Math.round(ar + br * t);
|
return "#"
|
||||||
a.g = Math.round(ag + bg * t);
|
+ d3_rgb_hex(Math.round(ar + br * t))
|
||||||
a.b = Math.round(ab + bb * t);
|
+ d3_rgb_hex(Math.round(ag + bg * t))
|
||||||
return a;
|
+ d3_rgb_hex(Math.round(ab + bb * t));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import "../color/rgb";
|
||||||
import "ordinal";
|
import "ordinal";
|
||||||
import "scale";
|
import "scale";
|
||||||
|
|
||||||
|
@ -23,35 +24,35 @@ d3.scale.category20c = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var d3_category10 = [
|
var d3_category10 = [
|
||||||
"#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
|
0x1f77b4, 0xff7f0e, 0x2ca02c, 0xd62728, 0x9467bd,
|
||||||
"#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
|
0x8c564b, 0xe377c2, 0x7f7f7f, 0xbcbd22, 0x17becf
|
||||||
];
|
].map(d3_rgbString);
|
||||||
|
|
||||||
var d3_category20 = [
|
var d3_category20 = [
|
||||||
"#1f77b4", "#aec7e8",
|
0x1f77b4, 0xaec7e8,
|
||||||
"#ff7f0e", "#ffbb78",
|
0xff7f0e, 0xffbb78,
|
||||||
"#2ca02c", "#98df8a",
|
0x2ca02c, 0x98df8a,
|
||||||
"#d62728", "#ff9896",
|
0xd62728, 0xff9896,
|
||||||
"#9467bd", "#c5b0d5",
|
0x9467bd, 0xc5b0d5,
|
||||||
"#8c564b", "#c49c94",
|
0x8c564b, 0xc49c94,
|
||||||
"#e377c2", "#f7b6d2",
|
0xe377c2, 0xf7b6d2,
|
||||||
"#7f7f7f", "#c7c7c7",
|
0x7f7f7f, 0xc7c7c7,
|
||||||
"#bcbd22", "#dbdb8d",
|
0xbcbd22, 0xdbdb8d,
|
||||||
"#17becf", "#9edae5"
|
0x17becf, 0x9edae5
|
||||||
];
|
].map(d3_rgbString);
|
||||||
|
|
||||||
var d3_category20b = [
|
var d3_category20b = [
|
||||||
"#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
|
0x393b79, 0x5254a3, 0x6b6ecf, 0x9c9ede,
|
||||||
"#637939", "#8ca252", "#b5cf6b", "#cedb9c",
|
0x637939, 0x8ca252, 0xb5cf6b, 0xcedb9c,
|
||||||
"#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
|
0x8c6d31, 0xbd9e39, 0xe7ba52, 0xe7cb94,
|
||||||
"#843c39", "#ad494a", "#d6616b", "#e7969c",
|
0x843c39, 0xad494a, 0xd6616b, 0xe7969c,
|
||||||
"#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
|
0x7b4173, 0xa55194, 0xce6dbd, 0xde9ed6
|
||||||
];
|
].map(d3_rgbString);
|
||||||
|
|
||||||
var d3_category20c = [
|
var d3_category20c = [
|
||||||
"#3182bd", "#6baed6", "#9ecae1", "#c6dbef",
|
0x3182bd, 0x6baed6, 0x9ecae1, 0xc6dbef,
|
||||||
"#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2",
|
0xe6550d, 0xfd8d3c, 0xfdae6b, 0xfdd0a2,
|
||||||
"#31a354", "#74c476", "#a1d99b", "#c7e9c0",
|
0x31a354, 0x74c476, 0xa1d99b, 0xc7e9c0,
|
||||||
"#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb",
|
0x756bb1, 0x9e9ac8, 0xbcbddc, 0xdadaeb,
|
||||||
"#636363", "#969696", "#bdbdbd", "#d9d9d9"
|
0x636363, 0x969696, 0xbdbdbd, 0xd9d9d9
|
||||||
];
|
].map(d3_rgbString);
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
d3 = (function(){
|
d3 = (function(){
|
||||||
var d3 = {version: "3.2.6"}; // semver
|
var d3 = {version: "3.2.7"}; // semver
|
||||||
|
|
|
@ -41,7 +41,7 @@ function d3_time_scale(linear, methods, format) {
|
||||||
i = d3.bisect(d3_time_scaleSteps, target);
|
i = d3.bisect(d3_time_scaleSteps, target);
|
||||||
if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
|
if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
|
||||||
if (!i) return linear.ticks(m).map(d3_time_scaleDate);
|
if (!i) return linear.ticks(m).map(d3_time_scaleDate);
|
||||||
if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
|
if (target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target) --i;
|
||||||
m = methods[i];
|
m = methods[i];
|
||||||
k = m[1];
|
k = m[1];
|
||||||
m = m[0].range;
|
m = m[0].range;
|
||||||
|
|
|
@ -18,5 +18,5 @@ d3_transitionPrototype.filter = function(filter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return d3_transition(subgroups, this.id, this.time).ease(this.ease());
|
return d3_transition(subgroups, this.id);
|
||||||
};
|
};
|
||||||
|
|
|
@ -69,9 +69,8 @@ function d3_transitionNode(node, i, id, inherit) {
|
||||||
duration = transition.duration,
|
duration = transition.duration,
|
||||||
tweened = [];
|
tweened = [];
|
||||||
|
|
||||||
return delay <= elapsed
|
if (delay <= elapsed) start(elapsed);
|
||||||
? start(elapsed)
|
else d3_timer_replace(start, delay, time);
|
||||||
: d3.timer(start, delay, time), 1;
|
|
||||||
|
|
||||||
function start(elapsed) {
|
function start(elapsed) {
|
||||||
if (lock.active > id) return stop();
|
if (lock.active > id) return stop();
|
||||||
|
@ -84,8 +83,8 @@ function d3_transitionNode(node, i, id, inherit) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!tick(elapsed)) d3.timer(tick, 0, time);
|
if (tick(elapsed)) return 1;
|
||||||
return 1;
|
d3_timer_replace(tick, 0, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tick(elapsed) {
|
function tick(elapsed) {
|
||||||
|
@ -112,7 +111,5 @@ function d3_transitionNode(node, i, id, inherit) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}, 0, time);
|
}, 0, time);
|
||||||
|
|
||||||
return transition;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,38 +8,38 @@ suite.addBatch({
|
||||||
"interpolateHcl": {
|
"interpolateHcl": {
|
||||||
topic: load("interpolate/hcl"), // beware instanceof d3_Color
|
topic: load("interpolate/hcl"), // beware instanceof d3_Color
|
||||||
"parses string input": function(d3) {
|
"parses string input": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("steelblue", "#f00")(.2), -69.78, 46.87, 52.62);
|
assert.strictEqual(d3.interpolateHcl("steelblue", "#f00")(.2), "#6978c9");
|
||||||
assert.hclEqual(d3.interpolateHcl("steelblue", "#f00")(.6), -14.89, 75.71, 52.93);
|
assert.strictEqual(d3.interpolateHcl("steelblue", "#f00")(.6), "#e034a2");
|
||||||
},
|
},
|
||||||
"parses d3.hsl input": function(d3) {
|
"parses d3.hsl input": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl(d3.hsl("steelblue"), "#f00")(.2), -69.78, 46.87, 52.62);
|
assert.strictEqual(d3.interpolateHcl(d3.hsl("steelblue"), "#f00")(.2), "#6978c9");
|
||||||
assert.hclEqual(d3.interpolateHcl("steelblue", d3.hsl(0, 1, .5))(.6), -14.89, 75.71, 52.93);
|
assert.strictEqual(d3.interpolateHcl("steelblue", d3.hsl(0, 1, .5))(.6), "#e034a2");
|
||||||
},
|
},
|
||||||
"parses d3.rgb input": function(d3) {
|
"parses d3.rgb input": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl(d3.rgb("steelblue"), "#f00")(.2), -69.78, 46.87, 52.62);
|
assert.strictEqual(d3.interpolateHcl(d3.rgb("steelblue"), "#f00")(.2), "#6978c9");
|
||||||
assert.hclEqual(d3.interpolateHcl("steelblue", d3.rgb(255, 0, 0))(.6), -14.89, 75.71, 52.93);
|
assert.strictEqual(d3.interpolateHcl("steelblue", d3.rgb(255, 0, 0))(.6), "#e034a2");
|
||||||
},
|
},
|
||||||
"interpolates in HSL color space": function(d3) {
|
"interpolates in HSL color space": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("steelblue", "#f00")(.2), -69.78, 46.87, 52.62);
|
assert.strictEqual(d3.interpolateHcl("steelblue", "#f00")(.2), "#6978c9");
|
||||||
},
|
},
|
||||||
"uses source hue when destination hue is undefined": function(d3) {
|
"uses source hue when destination hue is undefined": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("#f60", "#000")(.5), 52.36, 90.07, 31.16);
|
assert.equal(d3.interpolateHcl("#f60", "#000")(.5), "#9b0000");
|
||||||
assert.hclEqual(d3.interpolateHcl("#6f0", "#000")(.5), 131.26, 112.84, 44.54);
|
assert.equal(d3.interpolateHcl("#6f0", "#000")(.5), "#008100");
|
||||||
},
|
},
|
||||||
"uses destination hue when source hue is undefined": function(d3) {
|
"uses destination hue when source hue is undefined": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("#000", "#f60")(.5), 52.36, 90.07, 31.16);
|
assert.equal(d3.interpolateHcl("#000", "#f60")(.5), "#9b0000");
|
||||||
assert.hclEqual(d3.interpolateHcl("#000", "#6f0")(.5), 131.26, 112.84, 44.54);
|
assert.equal(d3.interpolateHcl("#000", "#6f0")(.5), "#008100");
|
||||||
},
|
},
|
||||||
"uses source chroma when destination chroma is undefined": function(d3) {
|
"uses source chroma when destination chroma is undefined": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("#ccc", "#000")(.5), 158.20, 0.00, 41.02);
|
assert.equal(d3.interpolateHcl("#ccc", "#000")(.5), "#616161");
|
||||||
assert.hclEqual(d3.interpolateHcl("#f00", "#000")(.5), 40.00, 104.55, 26.62);
|
assert.equal(d3.interpolateHcl("#f00", "#000")(.5), "#a60000");
|
||||||
},
|
},
|
||||||
"uses destination chroma when source chroma is undefined": function(d3) {
|
"uses destination chroma when source chroma is undefined": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("#000", "#ccc")(.5), 158.20, 0.00, 41.02);
|
assert.equal(d3.interpolateHcl("#000", "#ccc")(.5), "#616161");
|
||||||
assert.hclEqual(d3.interpolateHcl("#000", "#f00")(.5), 40.00, 104.55, 26.62);
|
assert.equal(d3.interpolateHcl("#000", "#f00")(.5), "#a60000");
|
||||||
},
|
},
|
||||||
"returns an instanceof d3.hcl": function(d3) {
|
"outputs a hexadecimal string": function(d3) {
|
||||||
assert.hclEqual(d3.interpolateHcl("steelblue", "#f00")(.2), -69.78, 46.87, 52.62);
|
assert.strictEqual(d3.interpolateHcl("steelblue", "#f00")(.2), "#6978c9");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,38 +8,38 @@ suite.addBatch({
|
||||||
"interpolateHsl": {
|
"interpolateHsl": {
|
||||||
topic: load("interpolate/hsl"), // beware instanceof d3_Color
|
topic: load("interpolate/hsl"), // beware instanceof d3_Color
|
||||||
"parses string input": function(d3) {
|
"parses string input": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("steelblue", "#f00")(.2), 237.82, 0.5538, 0.4922);
|
assert.strictEqual(d3.interpolateHsl("steelblue", "#f00")(.2), "#383dc3");
|
||||||
assert.hslEqual(d3.interpolateHsl("steelblue", "#f00")(.6), 298.91, 0.7787, 0.4961);
|
assert.strictEqual(d3.interpolateHsl("steelblue", "#f00")(.6), "#dd1ce1");
|
||||||
},
|
},
|
||||||
"parses d3.hsl input": function(d3) {
|
"parses d3.hsl input": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl(d3.hsl("steelblue"), "#f00")(.2), 237.82, 0.5538, 0.4922);
|
assert.strictEqual(d3.interpolateHsl(d3.hsl("steelblue"), "#f00")(.2), "#383dc3");
|
||||||
assert.hslEqual(d3.interpolateHsl("steelblue", d3.hsl(0, 1, .5))(.6), 298.91, 0.7787, 0.4961);
|
assert.strictEqual(d3.interpolateHsl("steelblue", d3.hsl(0, 1, .5))(.6), "#dd1ce1");
|
||||||
},
|
},
|
||||||
"parses d3.rgb input": function(d3) {
|
"parses d3.rgb input": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl(d3.rgb("steelblue"), "#f00")(.2), 237.82, 0.5538, 0.4922);
|
assert.strictEqual(d3.interpolateHsl(d3.rgb("steelblue"), "#f00")(.2), "#383dc3");
|
||||||
assert.hslEqual(d3.interpolateHsl("steelblue", d3.rgb(255, 0, 0))(.6), 298.91, 0.7787, 0.4961);
|
assert.strictEqual(d3.interpolateHsl("steelblue", d3.rgb(255, 0, 0))(.6), "#dd1ce1");
|
||||||
},
|
},
|
||||||
"interpolates in HSL color space": function(d3) {
|
"interpolates in HSL color space": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("steelblue", "#f00")(.2), 237.82, 0.5538, 0.4922);
|
assert.strictEqual(d3.interpolateHsl("steelblue", "#f00")(.2), "#383dc3");
|
||||||
},
|
},
|
||||||
"uses source hue when destination hue is undefined": function(d3) {
|
"uses source hue when destination hue is undefined": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("#f60", "#000")(.5), 24, 1, 0.2510);
|
assert.equal(d3.interpolateHsl("#f60", "#000")(.5), "#803300");
|
||||||
assert.hslEqual(d3.interpolateHsl("#6f0", "#fff")(.5), 96, 1, 0.7510);
|
assert.equal(d3.interpolateHsl("#6f0", "#fff")(.5), "#b3ff80");
|
||||||
},
|
},
|
||||||
"uses destination hue when source hue is undefined": function(d3) {
|
"uses destination hue when source hue is undefined": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("#000", "#f60")(.5), 24, 1, 0.2510);
|
assert.equal(d3.interpolateHsl("#000", "#f60")(.5), "#803300");
|
||||||
assert.hslEqual(d3.interpolateHsl("#fff", "#6f0")(.5), 96, 1, 0.7510);
|
assert.equal(d3.interpolateHsl("#fff", "#6f0")(.5), "#b3ff80");
|
||||||
},
|
},
|
||||||
"uses source saturation when destination saturation is undefined": function(d3) {
|
"uses source saturation when destination saturation is undefined": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("#ccc", "#000")(.5), NaN, 0, 0.4);
|
assert.equal(d3.interpolateHsl("#ccc", "#000")(.5), "#666666");
|
||||||
assert.hslEqual(d3.interpolateHsl("#f00", "#000")(.5), 0, 1, 0.2510);
|
assert.equal(d3.interpolateHsl("#f00", "#000")(.5), "#800000");
|
||||||
},
|
},
|
||||||
"uses destination saturation when source saturation is undefined": function(d3) {
|
"uses destination saturation when source saturation is undefined": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("#000", "#ccc")(.5), NaN, 0, 0.4);
|
assert.equal(d3.interpolateHsl("#000", "#ccc")(.5), "#666666");
|
||||||
assert.hslEqual(d3.interpolateHsl("#000", "#f00")(.5), 0, 1, 0.2510);
|
assert.equal(d3.interpolateHsl("#000", "#f00")(.5), "#800000");
|
||||||
},
|
},
|
||||||
"returns an instanceof d3.hsl": function(d3) {
|
"outputs a hexadecimal string": function(d3) {
|
||||||
assert.hslEqual(d3.interpolateHsl("steelblue", "#f00")(.6), 298.91, 0.7787, 0.4961);
|
assert.strictEqual(d3.interpolateHsl("steelblue", "#f00")(.2), "#383dc3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,44 +20,38 @@ suite.addBatch({
|
||||||
},
|
},
|
||||||
|
|
||||||
"when b is a color string": {
|
"when b is a color string": {
|
||||||
"interpolates RGB values": function(d3) {
|
"interpolates RGB values and returns a hexadecimal string": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate("#ff0000", "#008000")(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate("#ff0000", "#008000")(.4), "#993300");
|
||||||
},
|
},
|
||||||
"interpolates named colors in RGB": function(d3) {
|
"interpolates named colors in RGB": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate("red", "green")(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate("red", "green")(.4), "#993300");
|
||||||
},
|
},
|
||||||
"interpolates decimal RGB colors in RGB": function(d3) {
|
"interpolates decimal RGB colors in RGB": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate("rgb(255,0,0)", "rgb(0,128,0)")(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate("rgb(255,0,0)", "rgb(0,128,0)")(.4), "#993300");
|
||||||
},
|
},
|
||||||
"interpolates decimal HSL colors in RGB": function(d3) {
|
"interpolates decimal HSL colors in RGB": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate("hsl(0,100%,50%)", "hsl(120,100%,25%)")(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate("hsl(0,100%,50%)", "hsl(120,100%,25%)")(.4), "#993300");
|
||||||
},
|
},
|
||||||
"coerces a to a color": function(d3) {
|
"coerces a to a color": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate({toString: function() { return "red"; }}, "green")(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate({toString: function() { return "red"; }}, "green")(.4), "#993300");
|
||||||
},
|
|
||||||
"returns an instanceof d3.rgb": function(d3) {
|
|
||||||
assert.rgbEqual(d3.interpolate("steelblue", "#f00")(.2), 107, 104, 144);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"when b is a color object": {
|
"when b is a color object": {
|
||||||
"interpolates RGB values and returns a hexadecimal string": function(d3) {
|
"interpolates RGB values and returns a hexadecimal string": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate(d3.rgb(255, 0, 0), d3.rgb(0, 128, 0))(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate(d3.rgb(255, 0, 0), d3.rgb(0, 128, 0))(.4), "#993300");
|
||||||
},
|
},
|
||||||
"interpolates d3.hsl in RGB": function(d3) {
|
"interpolates d3.hsl in RGB": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate(d3.hsl("red"), d3.hsl("green"))(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate(d3.hsl("red"), d3.hsl("green"))(.4), "#993300");
|
||||||
},
|
},
|
||||||
"interpolates d3.lab in RGB": function(d3) {
|
"interpolates d3.lab in RGB": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate(d3.lab("red"), d3.lab("green"))(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate(d3.lab("red"), d3.lab("green"))(.4), "#993300");
|
||||||
},
|
},
|
||||||
"interpolates d3.hcl in RGB": function(d3) {
|
"interpolates d3.hcl in RGB": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate(d3.hcl("red"), d3.hcl("green"))(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate(d3.hcl("red"), d3.hcl("green"))(.4), "#993300");
|
||||||
},
|
},
|
||||||
"coerces a to a color": function(d3) {
|
"coerces a to a color": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolate({toString: function() { return "red"; }}, "green")(.4), 153, 51, 0);
|
assert.strictEqual(d3.interpolate({toString: function() { return "red"; }}, "green")(.4), "#993300");
|
||||||
},
|
|
||||||
"returns an instanceof d3.rgb": function(d3) {
|
|
||||||
assert.rgbEqual(d3.interpolate(d3.rgb("steelblue"), d3.rgb("#f00"))(.2), 107, 104, 144);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -8,22 +8,22 @@ suite.addBatch({
|
||||||
"interpolateLab": {
|
"interpolateLab": {
|
||||||
topic: load("interpolate/lab"), // beware instanceof d3_Color
|
topic: load("interpolate/lab"), // beware instanceof d3_Color
|
||||||
"parses string input": function(d3) {
|
"parses string input": function(d3) {
|
||||||
assert.labEqual(d3.interpolateLab("steelblue", "#f00")(.2), 52.62, 12.76, -12.31);
|
assert.strictEqual(d3.interpolateLab("steelblue", "#f00")(.2), "#8a7793");
|
||||||
assert.labEqual(d3.interpolateLab("steelblue", "#f00")(.6), 52.93, 46.42, 27.45);
|
assert.strictEqual(d3.interpolateLab("steelblue", "#f00")(.6), "#cf5952");
|
||||||
},
|
},
|
||||||
"parses d3.hsl input": function(d3) {
|
"parses d3.hsl input": function(d3) {
|
||||||
assert.labEqual(d3.interpolateLab(d3.hsl("steelblue"), "#f00")(.2), 52.62, 12.76, -12.31);
|
assert.strictEqual(d3.interpolateLab(d3.hsl("steelblue"), "#f00")(.2), "#8a7793");
|
||||||
assert.labEqual(d3.interpolateLab("steelblue", d3.hsl(0, 1, .5))(.6), 52.93, 46.42, 27.45);
|
assert.strictEqual(d3.interpolateLab("steelblue", d3.hsl(0, 1, .5))(.6), "#cf5952");
|
||||||
},
|
},
|
||||||
"parses d3.rgb input": function(d3) {
|
"parses d3.rgb input": function(d3) {
|
||||||
assert.labEqual(d3.interpolateLab(d3.rgb("steelblue"), "#f00")(.2), 52.62, 12.76, -12.31);
|
assert.strictEqual(d3.interpolateLab(d3.rgb("steelblue"), "#f00")(.2), "#8a7793");
|
||||||
assert.labEqual(d3.interpolateLab("steelblue", d3.rgb(255, 0, 0))(.6), 52.93, 46.42, 27.45);
|
assert.strictEqual(d3.interpolateLab("steelblue", d3.rgb(255, 0, 0))(.6), "#cf5952");
|
||||||
},
|
},
|
||||||
"interpolates in HSL color space": function(d3) {
|
"interpolates in HSL color space": function(d3) {
|
||||||
assert.labEqual(d3.interpolateLab("steelblue", "#f00")(.2), 52.62, 12.76, -12.31);
|
assert.strictEqual(d3.interpolateLab("steelblue", "#f00")(.2), "#8a7793");
|
||||||
},
|
},
|
||||||
"returns an instanceof d3.lab": function(d3) {
|
"returns an instanceof d3.lab": function(d3) {
|
||||||
assert.labEqual(d3.interpolateLab("steelblue", "#f00")(.2), 52.62, 12.76, -12.31);
|
assert.strictEqual(d3.interpolateLab("steelblue", "#f00")(.2), "#8a7793");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,10 +16,10 @@ suite.addBatch({
|
||||||
assert.deepEqual(interpolate(new a(2), new a(4))(.5), {a: 3, b: 12});
|
assert.deepEqual(interpolate(new a(2), new a(4))(.5), {a: 3, b: 12});
|
||||||
},
|
},
|
||||||
"interpolates color properties as rgb": function(interpolate) {
|
"interpolates color properties as rgb": function(interpolate) {
|
||||||
assert.deepEqual(interpolate({background: "red"}, {background: "green"})(.5), {background: d3.rgb(128, 64, 0)});
|
assert.deepEqual(interpolate({background: "red"}, {background: "green"})(.5), {background: "#804000"});
|
||||||
assert.deepEqual(interpolate({fill: "red"}, {fill: "green"})(.5), {fill: d3.rgb(128, 64, 0)});
|
assert.deepEqual(interpolate({fill: "red"}, {fill: "green"})(.5), {fill: "#804000"});
|
||||||
assert.deepEqual(interpolate({stroke: "red"}, {stroke: "green"})(.5), {stroke: d3.rgb(128, 64, 0)});
|
assert.deepEqual(interpolate({stroke: "red"}, {stroke: "green"})(.5), {stroke: "#804000"});
|
||||||
assert.deepEqual(interpolate({color: "red"}, {color: "green"})(.5), {color: d3.rgb(128, 64, 0)});
|
assert.deepEqual(interpolate({color: "red"}, {color: "green"})(.5), {color: "#804000"});
|
||||||
},
|
},
|
||||||
"interpolates nested objects and arrays": function(interpolate) {
|
"interpolates nested objects and arrays": function(interpolate) {
|
||||||
assert.deepEqual(interpolate({foo: [2, 12]}, {foo: [4, 24]})(.5), {foo: [3, 18]});
|
assert.deepEqual(interpolate({foo: [2, 12]}, {foo: [4, 24]})(.5), {foo: [3, 18]});
|
||||||
|
|
|
@ -8,22 +8,22 @@ suite.addBatch({
|
||||||
"interpolateRgb": {
|
"interpolateRgb": {
|
||||||
topic: load("interpolate/rgb"), // beware instanceof d3_Color
|
topic: load("interpolate/rgb"), // beware instanceof d3_Color
|
||||||
"parses string input": function(d3) {
|
"parses string input": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolateRgb("steelblue", "#f00")(.2), 107, 104, 144);
|
assert.strictEqual(d3.interpolateRgb("steelblue", "#f00")(.2), "#6b6890");
|
||||||
assert.rgbEqual(d3.interpolateRgb("steelblue", "#f00")(.6), 181, 52, 72);
|
assert.strictEqual(d3.interpolateRgb("steelblue", "#f00")(.6), "#b53448");
|
||||||
},
|
},
|
||||||
"parses d3.rgb input": function(d3) {
|
"parses d3.rgb input": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolateRgb(d3.rgb("steelblue"), "#f00")(.2), 107, 104, 144);
|
assert.strictEqual(d3.interpolateRgb(d3.rgb("steelblue"), "#f00")(.2), "#6b6890");
|
||||||
assert.rgbEqual(d3.interpolateRgb("steelblue", d3.rgb(255, 0, 0))(.6), 181, 52, 72);
|
assert.strictEqual(d3.interpolateRgb("steelblue", d3.rgb(255, 0, 0))(.6), "#b53448");
|
||||||
},
|
},
|
||||||
"parses d3.hsl input": function(d3) {
|
"parses d3.hsl input": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolateRgb(d3.hsl("steelblue"), "#f00")(.2), 107, 104, 144);
|
assert.strictEqual(d3.interpolateRgb(d3.hsl("steelblue"), "#f00")(.2), "#6b6890");
|
||||||
assert.rgbEqual(d3.interpolateRgb("steelblue", d3.hsl(0, 1, .5))(.6), 181, 52, 72);
|
assert.strictEqual(d3.interpolateRgb("steelblue", d3.hsl(0, 1, .5))(.6), "#b53448");
|
||||||
},
|
},
|
||||||
"interpolates in RGB color space": function(d3) {
|
"interpolates in RGB color space": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolateRgb("steelblue", "#f00")(.2), 107, 104, 144);
|
assert.strictEqual(d3.interpolateRgb("steelblue", "#f00")(.2), "#6b6890");
|
||||||
},
|
},
|
||||||
"returns an instanceof d3.rgb": function(d3) {
|
"outputs an RGB string": function(d3) {
|
||||||
assert.rgbEqual(d3.interpolateRgb("steelblue", "#f00")(.2), 107, 104, 144);
|
assert.strictEqual(d3.interpolateRgb("steelblue", "#f00")(.2), "#6b6890");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,9 +80,9 @@ suite.addBatch({
|
||||||
},
|
},
|
||||||
"can specify range values as arrays or objects": function(d3) {
|
"can specify range values as arrays or objects": function(d3) {
|
||||||
var x = d3.scale.linear().range([{color: "red"}, {color: "blue"}]);
|
var x = d3.scale.linear().range([{color: "red"}, {color: "blue"}]);
|
||||||
assert.deepEqual(x(.5), {color: d3.rgb(128, 0, 128)});
|
assert.deepEqual(x(.5), {color: "#800080"});
|
||||||
var x = d3.scale.linear().range([["red"], ["blue"]]);
|
var x = d3.scale.linear().range([["red"], ["blue"]]);
|
||||||
assert.deepEqual(x(.5), [d3.rgb(128, 0, 128)]);
|
assert.deepEqual(x(.5), ["#800080"]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -90,11 +90,11 @@ suite.addBatch({
|
||||||
"defaults to d3.interpolate": function(d3) {
|
"defaults to d3.interpolate": function(d3) {
|
||||||
var x = d3.scale.linear().range(["red", "blue"]);
|
var x = d3.scale.linear().range(["red", "blue"]);
|
||||||
assert.equal(x.interpolate(), d3.interpolate);
|
assert.equal(x.interpolate(), d3.interpolate);
|
||||||
assert.rgbEqual(x(.5), 128, 0, 128);
|
assert.equal(x(.5), "#800080");
|
||||||
},
|
},
|
||||||
"can specify a custom interpolator": function(d3) {
|
"can specify a custom interpolator": function(d3) {
|
||||||
var x = d3.scale.linear().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
var x = d3.scale.linear().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
||||||
assert.hslEqual(x(.5), -60, 1, .5);
|
assert.equal(x(.5), "#ff00ff");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,9 @@ suite.addBatch({
|
||||||
},
|
},
|
||||||
"can specify range values as arrays or objects": function(d3) {
|
"can specify range values as arrays or objects": function(d3) {
|
||||||
var x = d3.scale.log().range([{color: "red"}, {color: "blue"}]);
|
var x = d3.scale.log().range([{color: "red"}, {color: "blue"}]);
|
||||||
assert.deepEqual(x(5), {color: d3.rgb(77, 0, 178)});
|
assert.deepEqual(x(5), {color: "#4d00b2"});
|
||||||
var x = d3.scale.log().range([["red"], ["blue"]]);
|
var x = d3.scale.log().range([["red"], ["blue"]]);
|
||||||
assert.deepEqual(x(5), [d3.rgb(77, 0, 178)]);
|
assert.deepEqual(x(5), ["#4d00b2"]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -89,11 +89,11 @@ suite.addBatch({
|
||||||
"defaults to d3.interpolate": function(d3) {
|
"defaults to d3.interpolate": function(d3) {
|
||||||
var x = d3.scale.log().range(["red", "blue"]);
|
var x = d3.scale.log().range(["red", "blue"]);
|
||||||
assert.equal(x.interpolate(), d3.interpolate);
|
assert.equal(x.interpolate(), d3.interpolate);
|
||||||
assert.rgbEqual(x(5), 77, 0, 178);
|
assert.equal(x(5), "#4d00b2");
|
||||||
},
|
},
|
||||||
"can specify a custom interpolator": function(d3) {
|
"can specify a custom interpolator": function(d3) {
|
||||||
var x = d3.scale.log().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
var x = d3.scale.log().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
||||||
assert.hslEqual(x(5), -83.88, 1, .5);
|
assert.equal(x(5), "#9a00ff");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,9 @@ suite.addBatch({
|
||||||
},
|
},
|
||||||
"can specify range values as arrays or objects": function(d3) {
|
"can specify range values as arrays or objects": function(d3) {
|
||||||
var x = d3.scale.pow().range([{color: "red"}, {color: "blue"}]);
|
var x = d3.scale.pow().range([{color: "red"}, {color: "blue"}]);
|
||||||
assert.deepEqual(x(.5), {color: d3.rgb(128, 0, 128)});
|
assert.deepEqual(x(.5), {color: "#800080"});
|
||||||
var x = d3.scale.pow().range([["red"], ["blue"]]);
|
var x = d3.scale.pow().range([["red"], ["blue"]]);
|
||||||
assert.deepEqual(x(.5), [d3.rgb(128, 0, 128)]);
|
assert.deepEqual(x(.5), ["#800080"]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -120,11 +120,11 @@ suite.addBatch({
|
||||||
"defaults to d3.interpolate": function(d3) {
|
"defaults to d3.interpolate": function(d3) {
|
||||||
var x = d3.scale.pow().range(["red", "blue"]);
|
var x = d3.scale.pow().range(["red", "blue"]);
|
||||||
assert.equal(x.interpolate(), d3.interpolate);
|
assert.equal(x.interpolate(), d3.interpolate);
|
||||||
assert.rgbEqual(x(.5), 128, 0, 128);
|
assert.equal(x(.5), "#800080");
|
||||||
},
|
},
|
||||||
"can specify a custom interpolator": function(d3) {
|
"can specify a custom interpolator": function(d3) {
|
||||||
var x = d3.scale.pow().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
var x = d3.scale.pow().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
||||||
assert.hslEqual(x(.5), -60, 1, .5);
|
assert.equal(x(.5), "#ff00ff");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,9 @@ suite.addBatch({
|
||||||
},
|
},
|
||||||
"can specify range values as arrays or objects": function(d3) {
|
"can specify range values as arrays or objects": function(d3) {
|
||||||
var x = d3.scale.sqrt().range([{color: "red"}, {color: "blue"}]);
|
var x = d3.scale.sqrt().range([{color: "red"}, {color: "blue"}]);
|
||||||
assert.deepEqual(x(.25), {color: d3.rgb(128, 0, 128)});
|
assert.deepEqual(x(.25), {color: "#800080"});
|
||||||
var x = d3.scale.sqrt().range([["red"], ["blue"]]);
|
var x = d3.scale.sqrt().range([["red"], ["blue"]]);
|
||||||
assert.deepEqual(x(.25), [d3.rgb(128, 0, 128)]);
|
assert.deepEqual(x(.25), ["#800080"]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -121,11 +121,11 @@ suite.addBatch({
|
||||||
"defaults to d3.interpolate": function(d3) {
|
"defaults to d3.interpolate": function(d3) {
|
||||||
var x = d3.scale.sqrt().range(["red", "blue"]);
|
var x = d3.scale.sqrt().range(["red", "blue"]);
|
||||||
assert.equal(x.interpolate(), d3.interpolate);
|
assert.equal(x.interpolate(), d3.interpolate);
|
||||||
assert.rgbEqual(x(.5), 75, 0, 180);
|
assert.equal(x(.5), "#4b00b4");
|
||||||
},
|
},
|
||||||
"can specify a custom interpolator": function(d3) {
|
"can specify a custom interpolator": function(d3) {
|
||||||
var x = d3.scale.sqrt().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
var x = d3.scale.sqrt().range(["red", "blue"]).interpolate(d3.interpolateHsl);
|
||||||
assert.hslEqual(x(.25), -60, 1, .5);
|
assert.equal(x(.25), "#ff00ff");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -77,14 +77,13 @@ suite.addBatch({
|
||||||
},
|
},
|
||||||
"sets a property as a number": function(div) {
|
"sets a property as a number": function(div) {
|
||||||
div.property("opacity", 0.4);
|
div.property("opacity", 0.4);
|
||||||
assert.strictEqual(div[0][0].opacity, 0.4);
|
assert.equal(div[0][0].opacity, "0.4");
|
||||||
assert.strictEqual(div[0][1].opacity, 0.4);
|
assert.equal(div[0][1].opacity, "0.4");
|
||||||
},
|
},
|
||||||
"sets a property as a function": function(div) {
|
"sets a property as a function": function(div) {
|
||||||
var i = _.interpolateRgb("brown", "steelblue");
|
div.property("bgcolor", _.interpolateRgb("brown", "steelblue"));
|
||||||
div.property("_color", function(d) { return d3.rgb(i(d)); }); // make a copy
|
assert.equal(div[0][0].bgcolor, "#a52a2a");
|
||||||
assert.rgbEqual(div[0][0]._color, 165, 42, 42);
|
assert.equal(div[0][1].bgcolor, "#4682b4");
|
||||||
assert.rgbEqual(div[0][1]._color, 70, 130, 180);
|
|
||||||
},
|
},
|
||||||
"gets a property value": function(div) {
|
"gets a property value": function(div) {
|
||||||
div[0][0].bgcolor = "purple";
|
div[0][0].bgcolor = "purple";
|
||||||
|
|
|
@ -66,19 +66,15 @@ module.exports = {
|
||||||
"returns a new selection": function(span) {
|
"returns a new selection": function(span) {
|
||||||
assert.isFalse(span.filter(function() { return 1; }) === span);
|
assert.isFalse(span.filter(function() { return 1; }) === span);
|
||||||
},
|
},
|
||||||
"inherits the delay": function(t1) {
|
"works on empty selections": function(span) {
|
||||||
var t2 = t1.filter(function() { return 1; });
|
var none = function() { return false; },
|
||||||
assert.equal(t2[0][0].__transition__[t2.id].delay, 100); // TODO should inherit the whole transition object
|
empty = span.filter(none);
|
||||||
|
assert.isTrue(empty.empty());
|
||||||
|
assert.isTrue(empty.filter(none).empty());
|
||||||
},
|
},
|
||||||
"inherits the duration": function(t1) {
|
"inherits the transition id and, by extension, all transition parameters": function(t1) {
|
||||||
var t2 = t1.filter(function() { return 1; });
|
|
||||||
assert.equal(t2[0][0].__transition__[t2.id].duration, 150);
|
|
||||||
},
|
|
||||||
"inherits easing": function(t1) {
|
|
||||||
// TODO how to test this?
|
|
||||||
},
|
|
||||||
"inherits the transition id": function(t1) {
|
|
||||||
var t2 = t1.filter(function() { return 1; });
|
var t2 = t1.filter(function() { return 1; });
|
||||||
assert.equal(t2.id, t1.id);
|
assert.equal(t2.id, t1.id);
|
||||||
|
assert.strictEqual(t2[0][0].__transition__[t2.id], t1[0][0].__transition__[t1.id]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче