1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4 | (factory((global.d3 = global.d3 || {})));
|
5 | }(this, (function (exports) { 'use strict';
|
6 |
|
7 | var ascending = function(a, b) {
|
8 | return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
9 | };
|
10 |
|
11 | var bisector = function(compare) {
|
12 | if (compare.length === 1) compare = ascendingComparator(compare);
|
13 | return {
|
14 | left: function(a, x, lo, hi) {
|
15 | if (lo == null) lo = 0;
|
16 | if (hi == null) hi = a.length;
|
17 | while (lo < hi) {
|
18 | var mid = lo + hi >>> 1;
|
19 | if (compare(a[mid], x) < 0) lo = mid + 1;
|
20 | else hi = mid;
|
21 | }
|
22 | return lo;
|
23 | },
|
24 | right: function(a, x, lo, hi) {
|
25 | if (lo == null) lo = 0;
|
26 | if (hi == null) hi = a.length;
|
27 | while (lo < hi) {
|
28 | var mid = lo + hi >>> 1;
|
29 | if (compare(a[mid], x) > 0) hi = mid;
|
30 | else lo = mid + 1;
|
31 | }
|
32 | return lo;
|
33 | }
|
34 | };
|
35 | };
|
36 |
|
37 | function ascendingComparator(f) {
|
38 | return function(d, x) {
|
39 | return ascending(f(d), x);
|
40 | };
|
41 | }
|
42 |
|
43 | var ascendingBisect = bisector(ascending);
|
44 | var bisectRight = ascendingBisect.right;
|
45 | var bisectLeft = ascendingBisect.left;
|
46 |
|
47 | var descending = function(a, b) {
|
48 | return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
49 | };
|
50 |
|
51 | var number = function(x) {
|
52 | return x === null ? NaN : +x;
|
53 | };
|
54 |
|
55 | var variance = function(array, f) {
|
56 | var n = array.length,
|
57 | m = 0,
|
58 | a,
|
59 | d,
|
60 | s = 0,
|
61 | i = -1,
|
62 | j = 0;
|
63 |
|
64 | if (f == null) {
|
65 | while (++i < n) {
|
66 | if (!isNaN(a = number(array[i]))) {
|
67 | d = a - m;
|
68 | m += d / ++j;
|
69 | s += d * (a - m);
|
70 | }
|
71 | }
|
72 | }
|
73 |
|
74 | else {
|
75 | while (++i < n) {
|
76 | if (!isNaN(a = number(f(array[i], i, array)))) {
|
77 | d = a - m;
|
78 | m += d / ++j;
|
79 | s += d * (a - m);
|
80 | }
|
81 | }
|
82 | }
|
83 |
|
84 | if (j > 1) return s / (j - 1);
|
85 | };
|
86 |
|
87 | var deviation = function(array, f) {
|
88 | var v = variance(array, f);
|
89 | return v ? Math.sqrt(v) : v;
|
90 | };
|
91 |
|
92 | var extent = function(array, f) {
|
93 | var i = -1,
|
94 | n = array.length,
|
95 | a,
|
96 | b,
|
97 | c;
|
98 |
|
99 | if (f == null) {
|
100 | while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
|
101 | while (++i < n) if ((b = array[i]) != null) {
|
102 | if (a > b) a = b;
|
103 | if (c < b) c = b;
|
104 | }
|
105 | }
|
106 |
|
107 | else {
|
108 | while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = c = b; break; }
|
109 | while (++i < n) if ((b = f(array[i], i, array)) != null) {
|
110 | if (a > b) a = b;
|
111 | if (c < b) c = b;
|
112 | }
|
113 | }
|
114 |
|
115 | return [a, c];
|
116 | };
|
117 |
|
118 | var array = Array.prototype;
|
119 |
|
120 | var slice = array.slice;
|
121 | var map = array.map;
|
122 |
|
123 | var constant = function(x) {
|
124 | return function() {
|
125 | return x;
|
126 | };
|
127 | };
|
128 |
|
129 | var identity = function(x) {
|
130 | return x;
|
131 | };
|
132 |
|
133 | var sequence = function(start, stop, step) {
|
134 | start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
135 |
|
136 | var i = -1,
|
137 | n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
|
138 | range = new Array(n);
|
139 |
|
140 | while (++i < n) {
|
141 | range[i] = start + i * step;
|
142 | }
|
143 |
|
144 | return range;
|
145 | };
|
146 |
|
147 | var e10 = Math.sqrt(50);
|
148 | var e5 = Math.sqrt(10);
|
149 | var e2 = Math.sqrt(2);
|
150 |
|
151 | var ticks = function(start, stop, count) {
|
152 | var step = tickStep(start, stop, count);
|
153 | return sequence(
|
154 | Math.ceil(start / step) * step,
|
155 | Math.floor(stop / step) * step + step / 2,
|
156 | step
|
157 | );
|
158 | };
|
159 |
|
160 | function tickStep(start, stop, count) {
|
161 | var step0 = Math.abs(stop - start) / Math.max(0, count),
|
162 | step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
|
163 | error = step0 / step1;
|
164 | if (error >= e10) step1 *= 10;
|
165 | else if (error >= e5) step1 *= 5;
|
166 | else if (error >= e2) step1 *= 2;
|
167 | return stop < start ? -step1 : step1;
|
168 | }
|
169 |
|
170 | var sturges = function(values) {
|
171 | return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
|
172 | };
|
173 |
|
174 | var histogram = function() {
|
175 | var value = identity,
|
176 | domain = extent,
|
177 | threshold = sturges;
|
178 |
|
179 | function histogram(data) {
|
180 | var i,
|
181 | n = data.length,
|
182 | x,
|
183 | values = new Array(n);
|
184 |
|
185 | for (i = 0; i < n; ++i) {
|
186 | values[i] = value(data[i], i, data);
|
187 | }
|
188 |
|
189 | var xz = domain(values),
|
190 | x0 = xz[0],
|
191 | x1 = xz[1],
|
192 | tz = threshold(values, x0, x1);
|
193 |
|
194 |
|
195 | if (!Array.isArray(tz)) tz = ticks(x0, x1, tz);
|
196 |
|
197 |
|
198 | var m = tz.length;
|
199 | while (tz[0] <= x0) tz.shift(), --m;
|
200 | while (tz[m - 1] >= x1) tz.pop(), --m;
|
201 |
|
202 | var bins = new Array(m + 1),
|
203 | bin;
|
204 |
|
205 |
|
206 | for (i = 0; i <= m; ++i) {
|
207 | bin = bins[i] = [];
|
208 | bin.x0 = i > 0 ? tz[i - 1] : x0;
|
209 | bin.x1 = i < m ? tz[i] : x1;
|
210 | }
|
211 |
|
212 |
|
213 | for (i = 0; i < n; ++i) {
|
214 | x = values[i];
|
215 | if (x0 <= x && x <= x1) {
|
216 | bins[bisectRight(tz, x, 0, m)].push(data[i]);
|
217 | }
|
218 | }
|
219 |
|
220 | return bins;
|
221 | }
|
222 |
|
223 | histogram.value = function(_) {
|
224 | return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value;
|
225 | };
|
226 |
|
227 | histogram.domain = function(_) {
|
228 | return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain;
|
229 | };
|
230 |
|
231 | histogram.thresholds = function(_) {
|
232 | return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;
|
233 | };
|
234 |
|
235 | return histogram;
|
236 | };
|
237 |
|
238 | var threshold = function(array, p, f) {
|
239 | if (f == null) f = number;
|
240 | if (!(n = array.length)) return;
|
241 | if ((p = +p) <= 0 || n < 2) return +f(array[0], 0, array);
|
242 | if (p >= 1) return +f(array[n - 1], n - 1, array);
|
243 | var n,
|
244 | h = (n - 1) * p,
|
245 | i = Math.floor(h),
|
246 | a = +f(array[i], i, array),
|
247 | b = +f(array[i + 1], i + 1, array);
|
248 | return a + (b - a) * (h - i);
|
249 | };
|
250 |
|
251 | var freedmanDiaconis = function(values, min, max) {
|
252 | values = map.call(values, number).sort(ascending);
|
253 | return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3)));
|
254 | };
|
255 |
|
256 | var scott = function(values, min, max) {
|
257 | return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
|
258 | };
|
259 |
|
260 | var max = function(array, f) {
|
261 | var i = -1,
|
262 | n = array.length,
|
263 | a,
|
264 | b;
|
265 |
|
266 | if (f == null) {
|
267 | while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
|
268 | while (++i < n) if ((b = array[i]) != null && b > a) a = b;
|
269 | }
|
270 |
|
271 | else {
|
272 | while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; }
|
273 | while (++i < n) if ((b = f(array[i], i, array)) != null && b > a) a = b;
|
274 | }
|
275 |
|
276 | return a;
|
277 | };
|
278 |
|
279 | var mean = function(array, f) {
|
280 | var s = 0,
|
281 | n = array.length,
|
282 | a,
|
283 | i = -1,
|
284 | j = n;
|
285 |
|
286 | if (f == null) {
|
287 | while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
|
288 | }
|
289 |
|
290 | else {
|
291 | while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) s += a; else --j;
|
292 | }
|
293 |
|
294 | if (j) return s / j;
|
295 | };
|
296 |
|
297 | var median = function(array, f) {
|
298 | var numbers = [],
|
299 | n = array.length,
|
300 | a,
|
301 | i = -1;
|
302 |
|
303 | if (f == null) {
|
304 | while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
|
305 | }
|
306 |
|
307 | else {
|
308 | while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) numbers.push(a);
|
309 | }
|
310 |
|
311 | return threshold(numbers.sort(ascending), 0.5);
|
312 | };
|
313 |
|
314 | var merge = function(arrays) {
|
315 | var n = arrays.length,
|
316 | m,
|
317 | i = -1,
|
318 | j = 0,
|
319 | merged,
|
320 | array;
|
321 |
|
322 | while (++i < n) j += arrays[i].length;
|
323 | merged = new Array(j);
|
324 |
|
325 | while (--n >= 0) {
|
326 | array = arrays[n];
|
327 | m = array.length;
|
328 | while (--m >= 0) {
|
329 | merged[--j] = array[m];
|
330 | }
|
331 | }
|
332 |
|
333 | return merged;
|
334 | };
|
335 |
|
336 | var min = function(array, f) {
|
337 | var i = -1,
|
338 | n = array.length,
|
339 | a,
|
340 | b;
|
341 |
|
342 | if (f == null) {
|
343 | while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
|
344 | while (++i < n) if ((b = array[i]) != null && a > b) a = b;
|
345 | }
|
346 |
|
347 | else {
|
348 | while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; }
|
349 | while (++i < n) if ((b = f(array[i], i, array)) != null && a > b) a = b;
|
350 | }
|
351 |
|
352 | return a;
|
353 | };
|
354 |
|
355 | var pairs = function(array) {
|
356 | var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);
|
357 | while (i < n) pairs[i] = [p, p = array[++i]];
|
358 | return pairs;
|
359 | };
|
360 |
|
361 | var permute = function(array, indexes) {
|
362 | var i = indexes.length, permutes = new Array(i);
|
363 | while (i--) permutes[i] = array[indexes[i]];
|
364 | return permutes;
|
365 | };
|
366 |
|
367 | var scan = function(array, compare) {
|
368 | if (!(n = array.length)) return;
|
369 | var i = 0,
|
370 | n,
|
371 | j = 0,
|
372 | xi,
|
373 | xj = array[j];
|
374 |
|
375 | if (!compare) compare = ascending;
|
376 |
|
377 | while (++i < n) if (compare(xi = array[i], xj) < 0 || compare(xj, xj) !== 0) xj = xi, j = i;
|
378 |
|
379 | if (compare(xj, xj) === 0) return j;
|
380 | };
|
381 |
|
382 | var shuffle = function(array, i0, i1) {
|
383 | var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
|
384 | t,
|
385 | i;
|
386 |
|
387 | while (m) {
|
388 | i = Math.random() * m-- | 0;
|
389 | t = array[m + i0];
|
390 | array[m + i0] = array[i + i0];
|
391 | array[i + i0] = t;
|
392 | }
|
393 |
|
394 | return array;
|
395 | };
|
396 |
|
397 | var sum = function(array, f) {
|
398 | var s = 0,
|
399 | n = array.length,
|
400 | a,
|
401 | i = -1;
|
402 |
|
403 | if (f == null) {
|
404 | while (++i < n) if (a = +array[i]) s += a;
|
405 | }
|
406 |
|
407 | else {
|
408 | while (++i < n) if (a = +f(array[i], i, array)) s += a;
|
409 | }
|
410 |
|
411 | return s;
|
412 | };
|
413 |
|
414 | var transpose = function(matrix) {
|
415 | if (!(n = matrix.length)) return [];
|
416 | for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
|
417 | for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
|
418 | row[j] = matrix[j][i];
|
419 | }
|
420 | }
|
421 | return transpose;
|
422 | };
|
423 |
|
424 | function length(d) {
|
425 | return d.length;
|
426 | }
|
427 |
|
428 | var zip = function() {
|
429 | return transpose(arguments);
|
430 | };
|
431 |
|
432 | var slice$1 = Array.prototype.slice;
|
433 |
|
434 | var identity$1 = function(x) {
|
435 | return x;
|
436 | };
|
437 |
|
438 | var top = 1;
|
439 | var right = 2;
|
440 | var bottom = 3;
|
441 | var left = 4;
|
442 | var epsilon = 1e-6;
|
443 |
|
444 | function translateX(scale0, scale1, d) {
|
445 | var x = scale0(d);
|
446 | return "translate(" + (isFinite(x) ? x : scale1(d)) + ",0)";
|
447 | }
|
448 |
|
449 | function translateY(scale0, scale1, d) {
|
450 | var y = scale0(d);
|
451 | return "translate(0," + (isFinite(y) ? y : scale1(d)) + ")";
|
452 | }
|
453 |
|
454 | function center(scale) {
|
455 | var offset = scale.bandwidth() / 2;
|
456 | if (scale.round()) offset = Math.round(offset);
|
457 | return function(d) {
|
458 | return scale(d) + offset;
|
459 | };
|
460 | }
|
461 |
|
462 | function entering() {
|
463 | return !this.__axis;
|
464 | }
|
465 |
|
466 | function axis(orient, scale) {
|
467 | var tickArguments = [],
|
468 | tickValues = null,
|
469 | tickFormat = null,
|
470 | tickSizeInner = 6,
|
471 | tickSizeOuter = 6,
|
472 | tickPadding = 3;
|
473 |
|
474 | function axis(context) {
|
475 | var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
476 | format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$1) : tickFormat,
|
477 | spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
478 | transform = orient === top || orient === bottom ? translateX : translateY,
|
479 | range = scale.range(),
|
480 | range0 = range[0] + 0.5,
|
481 | range1 = range[range.length - 1] + 0.5,
|
482 | position = (scale.bandwidth ? center : identity$1)(scale.copy()),
|
483 | selection = context.selection ? context.selection() : context,
|
484 | path = selection.selectAll(".domain").data([null]),
|
485 | tick = selection.selectAll(".tick").data(values, scale).order(),
|
486 | tickExit = tick.exit(),
|
487 | tickEnter = tick.enter().append("g").attr("class", "tick"),
|
488 | line = tick.select("line"),
|
489 | text = tick.select("text"),
|
490 | k = orient === top || orient === left ? -1 : 1,
|
491 | x, y = orient === left || orient === right ? (x = "x", "y") : (x = "y", "x");
|
492 |
|
493 | path = path.merge(path.enter().insert("path", ".tick")
|
494 | .attr("class", "domain")
|
495 | .attr("stroke", "#000"));
|
496 |
|
497 | tick = tick.merge(tickEnter);
|
498 |
|
499 | line = line.merge(tickEnter.append("line")
|
500 | .attr("stroke", "#000")
|
501 | .attr(x + "2", k * tickSizeInner)
|
502 | .attr(y + "1", 0.5)
|
503 | .attr(y + "2", 0.5));
|
504 |
|
505 | text = text.merge(tickEnter.append("text")
|
506 | .attr("fill", "#000")
|
507 | .attr(x, k * spacing)
|
508 | .attr(y, 0.5)
|
509 | .attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
510 |
|
511 | if (context !== selection) {
|
512 | path = path.transition(context);
|
513 | tick = tick.transition(context);
|
514 | line = line.transition(context);
|
515 | text = text.transition(context);
|
516 |
|
517 | tickExit = tickExit.transition(context)
|
518 | .attr("opacity", epsilon)
|
519 | .attr("transform", function(d) { return transform(position, this.parentNode.__axis || position, d); });
|
520 |
|
521 | tickEnter
|
522 | .attr("opacity", epsilon)
|
523 | .attr("transform", function(d) { return transform(this.parentNode.__axis || position, position, d); });
|
524 | }
|
525 |
|
526 | tickExit.remove();
|
527 |
|
528 | path
|
529 | .attr("d", orient === left || orient == right
|
530 | ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter
|
531 | : "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter);
|
532 |
|
533 | tick
|
534 | .attr("opacity", 1)
|
535 | .attr("transform", function(d) { return transform(position, position, d); });
|
536 |
|
537 | line
|
538 | .attr(x + "2", k * tickSizeInner);
|
539 |
|
540 | text
|
541 | .attr(x, k * spacing)
|
542 | .text(format);
|
543 |
|
544 | selection.filter(entering)
|
545 | .attr("fill", "none")
|
546 | .attr("font-size", 10)
|
547 | .attr("font-family", "sans-serif")
|
548 | .attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
|
549 |
|
550 | selection
|
551 | .each(function() { this.__axis = position; });
|
552 | }
|
553 |
|
554 | axis.scale = function(_) {
|
555 | return arguments.length ? (scale = _, axis) : scale;
|
556 | };
|
557 |
|
558 | axis.ticks = function() {
|
559 | return tickArguments = slice$1.call(arguments), axis;
|
560 | };
|
561 |
|
562 | axis.tickArguments = function(_) {
|
563 | return arguments.length ? (tickArguments = _ == null ? [] : slice$1.call(_), axis) : tickArguments.slice();
|
564 | };
|
565 |
|
566 | axis.tickValues = function(_) {
|
567 | return arguments.length ? (tickValues = _ == null ? null : slice$1.call(_), axis) : tickValues && tickValues.slice();
|
568 | };
|
569 |
|
570 | axis.tickFormat = function(_) {
|
571 | return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
572 | };
|
573 |
|
574 | axis.tickSize = function(_) {
|
575 | return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
576 | };
|
577 |
|
578 | axis.tickSizeInner = function(_) {
|
579 | return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
580 | };
|
581 |
|
582 | axis.tickSizeOuter = function(_) {
|
583 | return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
584 | };
|
585 |
|
586 | axis.tickPadding = function(_) {
|
587 | return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
588 | };
|
589 |
|
590 | return axis;
|
591 | }
|
592 |
|
593 | function axisTop(scale) {
|
594 | return axis(top, scale);
|
595 | }
|
596 |
|
597 | function axisRight(scale) {
|
598 | return axis(right, scale);
|
599 | }
|
600 |
|
601 | function axisBottom(scale) {
|
602 | return axis(bottom, scale);
|
603 | }
|
604 |
|
605 | function axisLeft(scale) {
|
606 | return axis(left, scale);
|
607 | }
|
608 |
|
609 | var xhtml = "http://www.w3.org/1999/xhtml";
|
610 |
|
611 | var namespaces = {
|
612 | svg: "http://www.w3.org/2000/svg",
|
613 | xhtml: xhtml,
|
614 | xlink: "http://www.w3.org/1999/xlink",
|
615 | xml: "http://www.w3.org/XML/1998/namespace",
|
616 | xmlns: "http://www.w3.org/2000/xmlns/"
|
617 | };
|
618 |
|
619 | var namespace = function(name) {
|
620 | var prefix = name += "", i = prefix.indexOf(":");
|
621 | if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
622 | return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;
|
623 | };
|
624 |
|
625 | function creatorInherit(name) {
|
626 | return function() {
|
627 | var document = this.ownerDocument,
|
628 | uri = this.namespaceURI;
|
629 | return uri === xhtml && document.documentElement.namespaceURI === xhtml
|
630 | ? document.createElement(name)
|
631 | : document.createElementNS(uri, name);
|
632 | };
|
633 | }
|
634 |
|
635 | function creatorFixed(fullname) {
|
636 | return function() {
|
637 | return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
638 | };
|
639 | }
|
640 |
|
641 | var creator = function(name) {
|
642 | var fullname = namespace(name);
|
643 | return (fullname.local
|
644 | ? creatorFixed
|
645 | : creatorInherit)(fullname);
|
646 | };
|
647 |
|
648 | var nextId = 0;
|
649 |
|
650 | function local() {
|
651 | return new Local;
|
652 | }
|
653 |
|
654 | function Local() {
|
655 | this._ = "@" + (++nextId).toString(36);
|
656 | }
|
657 |
|
658 | Local.prototype = local.prototype = {
|
659 | constructor: Local,
|
660 | get: function(node) {
|
661 | var id = this._;
|
662 | while (!(id in node)) if (!(node = node.parentNode)) return;
|
663 | return node[id];
|
664 | },
|
665 | set: function(node, value) {
|
666 | return node[this._] = value;
|
667 | },
|
668 | remove: function(node) {
|
669 | return this._ in node && delete node[this._];
|
670 | },
|
671 | toString: function() {
|
672 | return this._;
|
673 | }
|
674 | };
|
675 |
|
676 | var matcher = function(selector) {
|
677 | return function() {
|
678 | return this.matches(selector);
|
679 | };
|
680 | };
|
681 |
|
682 | if (typeof document !== "undefined") {
|
683 | var element = document.documentElement;
|
684 | if (!element.matches) {
|
685 | var vendorMatches = element.webkitMatchesSelector
|
686 | || element.msMatchesSelector
|
687 | || element.mozMatchesSelector
|
688 | || element.oMatchesSelector;
|
689 | matcher = function(selector) {
|
690 | return function() {
|
691 | return vendorMatches.call(this, selector);
|
692 | };
|
693 | };
|
694 | }
|
695 | }
|
696 |
|
697 | var matcher$1 = matcher;
|
698 |
|
699 | var filterEvents = {};
|
700 |
|
701 | exports.event = null;
|
702 |
|
703 | if (typeof document !== "undefined") {
|
704 | var element$1 = document.documentElement;
|
705 | if (!("onmouseenter" in element$1)) {
|
706 | filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};
|
707 | }
|
708 | }
|
709 |
|
710 | function filterContextListener(listener, index, group) {
|
711 | listener = contextListener(listener, index, group);
|
712 | return function(event) {
|
713 | var related = event.relatedTarget;
|
714 | if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
|
715 | listener.call(this, event);
|
716 | }
|
717 | };
|
718 | }
|
719 |
|
720 | function contextListener(listener, index, group) {
|
721 | return function(event1) {
|
722 | var event0 = exports.event;
|
723 | exports.event = event1;
|
724 | try {
|
725 | listener.call(this, this.__data__, index, group);
|
726 | } finally {
|
727 | exports.event = event0;
|
728 | }
|
729 | };
|
730 | }
|
731 |
|
732 | function parseTypenames(typenames) {
|
733 | return typenames.trim().split(/^|\s+/).map(function(t) {
|
734 | var name = "", i = t.indexOf(".");
|
735 | if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
736 | return {type: t, name: name};
|
737 | });
|
738 | }
|
739 |
|
740 | function onRemove(typename) {
|
741 | return function() {
|
742 | var on = this.__on;
|
743 | if (!on) return;
|
744 | for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
|
745 | if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
746 | this.removeEventListener(o.type, o.listener, o.capture);
|
747 | } else {
|
748 | on[++i] = o;
|
749 | }
|
750 | }
|
751 | if (++i) on.length = i;
|
752 | else delete this.__on;
|
753 | };
|
754 | }
|
755 |
|
756 | function onAdd(typename, value, capture) {
|
757 | var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
|
758 | return function(d, i, group) {
|
759 | var on = this.__on, o, listener = wrap(value, i, group);
|
760 | if (on) for (var j = 0, m = on.length; j < m; ++j) {
|
761 | if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
762 | this.removeEventListener(o.type, o.listener, o.capture);
|
763 | this.addEventListener(o.type, o.listener = listener, o.capture = capture);
|
764 | o.value = value;
|
765 | return;
|
766 | }
|
767 | }
|
768 | this.addEventListener(typename.type, listener, capture);
|
769 | o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
|
770 | if (!on) this.__on = [o];
|
771 | else on.push(o);
|
772 | };
|
773 | }
|
774 |
|
775 | var selection_on = function(typename, value, capture) {
|
776 | var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
|
777 |
|
778 | if (arguments.length < 2) {
|
779 | var on = this.node().__on;
|
780 | if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
|
781 | for (i = 0, o = on[j]; i < n; ++i) {
|
782 | if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
783 | return o.value;
|
784 | }
|
785 | }
|
786 | }
|
787 | return;
|
788 | }
|
789 |
|
790 | on = value ? onAdd : onRemove;
|
791 | if (capture == null) capture = false;
|
792 | for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
|
793 | return this;
|
794 | };
|
795 |
|
796 | function customEvent(event1, listener, that, args) {
|
797 | var event0 = exports.event;
|
798 | event1.sourceEvent = exports.event;
|
799 | exports.event = event1;
|
800 | try {
|
801 | return listener.apply(that, args);
|
802 | } finally {
|
803 | exports.event = event0;
|
804 | }
|
805 | }
|
806 |
|
807 | var sourceEvent = function() {
|
808 | var current = exports.event, source;
|
809 | while (source = current.sourceEvent) current = source;
|
810 | return current;
|
811 | };
|
812 |
|
813 | var point = function(node, event) {
|
814 | var svg = node.ownerSVGElement || node;
|
815 |
|
816 | if (svg.createSVGPoint) {
|
817 | var point = svg.createSVGPoint();
|
818 | point.x = event.clientX, point.y = event.clientY;
|
819 | point = point.matrixTransform(node.getScreenCTM().inverse());
|
820 | return [point.x, point.y];
|
821 | }
|
822 |
|
823 | var rect = node.getBoundingClientRect();
|
824 | return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
825 | };
|
826 |
|
827 | var mouse = function(node) {
|
828 | var event = sourceEvent();
|
829 | if (event.changedTouches) event = event.changedTouches[0];
|
830 | return point(node, event);
|
831 | };
|
832 |
|
833 | function none() {}
|
834 |
|
835 | var selector = function(selector) {
|
836 | return selector == null ? none : function() {
|
837 | return this.querySelector(selector);
|
838 | };
|
839 | };
|
840 |
|
841 | var selection_select = function(select) {
|
842 | if (typeof select !== "function") select = selector(select);
|
843 |
|
844 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
845 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
846 | if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
847 | if ("__data__" in node) subnode.__data__ = node.__data__;
|
848 | subgroup[i] = subnode;
|
849 | }
|
850 | }
|
851 | }
|
852 |
|
853 | return new Selection(subgroups, this._parents);
|
854 | };
|
855 |
|
856 | function empty() {
|
857 | return [];
|
858 | }
|
859 |
|
860 | var selectorAll = function(selector) {
|
861 | return selector == null ? empty : function() {
|
862 | return this.querySelectorAll(selector);
|
863 | };
|
864 | };
|
865 |
|
866 | var selection_selectAll = function(select) {
|
867 | if (typeof select !== "function") select = selectorAll(select);
|
868 |
|
869 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
870 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
871 | if (node = group[i]) {
|
872 | subgroups.push(select.call(node, node.__data__, i, group));
|
873 | parents.push(node);
|
874 | }
|
875 | }
|
876 | }
|
877 |
|
878 | return new Selection(subgroups, parents);
|
879 | };
|
880 |
|
881 | var selection_filter = function(match) {
|
882 | if (typeof match !== "function") match = matcher$1(match);
|
883 |
|
884 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
885 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
886 | if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
887 | subgroup.push(node);
|
888 | }
|
889 | }
|
890 | }
|
891 |
|
892 | return new Selection(subgroups, this._parents);
|
893 | };
|
894 |
|
895 | var sparse = function(update) {
|
896 | return new Array(update.length);
|
897 | };
|
898 |
|
899 | var selection_enter = function() {
|
900 | return new Selection(this._enter || this._groups.map(sparse), this._parents);
|
901 | };
|
902 |
|
903 | function EnterNode(parent, datum) {
|
904 | this.ownerDocument = parent.ownerDocument;
|
905 | this.namespaceURI = parent.namespaceURI;
|
906 | this._next = null;
|
907 | this._parent = parent;
|
908 | this.__data__ = datum;
|
909 | }
|
910 |
|
911 | EnterNode.prototype = {
|
912 | constructor: EnterNode,
|
913 | appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
|
914 | insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },
|
915 | querySelector: function(selector) { return this._parent.querySelector(selector); },
|
916 | querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
|
917 | };
|
918 |
|
919 | var constant$1 = function(x) {
|
920 | return function() {
|
921 | return x;
|
922 | };
|
923 | };
|
924 |
|
925 | var keyPrefix = "$";
|
926 |
|
927 | function bindIndex(parent, group, enter, update, exit, data) {
|
928 | var i = 0,
|
929 | node,
|
930 | groupLength = group.length,
|
931 | dataLength = data.length;
|
932 |
|
933 |
|
934 |
|
935 |
|
936 | for (; i < dataLength; ++i) {
|
937 | if (node = group[i]) {
|
938 | node.__data__ = data[i];
|
939 | update[i] = node;
|
940 | } else {
|
941 | enter[i] = new EnterNode(parent, data[i]);
|
942 | }
|
943 | }
|
944 |
|
945 |
|
946 | for (; i < groupLength; ++i) {
|
947 | if (node = group[i]) {
|
948 | exit[i] = node;
|
949 | }
|
950 | }
|
951 | }
|
952 |
|
953 | function bindKey(parent, group, enter, update, exit, data, key) {
|
954 | var i,
|
955 | node,
|
956 | nodeByKeyValue = {},
|
957 | groupLength = group.length,
|
958 | dataLength = data.length,
|
959 | keyValues = new Array(groupLength),
|
960 | keyValue;
|
961 |
|
962 |
|
963 |
|
964 | for (i = 0; i < groupLength; ++i) {
|
965 | if (node = group[i]) {
|
966 | keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);
|
967 | if (keyValue in nodeByKeyValue) {
|
968 | exit[i] = node;
|
969 | } else {
|
970 | nodeByKeyValue[keyValue] = node;
|
971 | }
|
972 | }
|
973 | }
|
974 |
|
975 |
|
976 |
|
977 |
|
978 | for (i = 0; i < dataLength; ++i) {
|
979 | keyValue = keyPrefix + key.call(parent, data[i], i, data);
|
980 | if (node = nodeByKeyValue[keyValue]) {
|
981 | update[i] = node;
|
982 | node.__data__ = data[i];
|
983 | nodeByKeyValue[keyValue] = null;
|
984 | } else {
|
985 | enter[i] = new EnterNode(parent, data[i]);
|
986 | }
|
987 | }
|
988 |
|
989 |
|
990 | for (i = 0; i < groupLength; ++i) {
|
991 | if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {
|
992 | exit[i] = node;
|
993 | }
|
994 | }
|
995 | }
|
996 |
|
997 | var selection_data = function(value, key) {
|
998 | if (!value) {
|
999 | data = new Array(this.size()), j = -1;
|
1000 | this.each(function(d) { data[++j] = d; });
|
1001 | return data;
|
1002 | }
|
1003 |
|
1004 | var bind = key ? bindKey : bindIndex,
|
1005 | parents = this._parents,
|
1006 | groups = this._groups;
|
1007 |
|
1008 | if (typeof value !== "function") value = constant$1(value);
|
1009 |
|
1010 | for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
1011 | var parent = parents[j],
|
1012 | group = groups[j],
|
1013 | groupLength = group.length,
|
1014 | data = value.call(parent, parent && parent.__data__, j, parents),
|
1015 | dataLength = data.length,
|
1016 | enterGroup = enter[j] = new Array(dataLength),
|
1017 | updateGroup = update[j] = new Array(dataLength),
|
1018 | exitGroup = exit[j] = new Array(groupLength);
|
1019 |
|
1020 | bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 | for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
1026 | if (previous = enterGroup[i0]) {
|
1027 | if (i0 >= i1) i1 = i0 + 1;
|
1028 | while (!(next = updateGroup[i1]) && ++i1 < dataLength);
|
1029 | previous._next = next || null;
|
1030 | }
|
1031 | }
|
1032 | }
|
1033 |
|
1034 | update = new Selection(update, parents);
|
1035 | update._enter = enter;
|
1036 | update._exit = exit;
|
1037 | return update;
|
1038 | };
|
1039 |
|
1040 | var selection_exit = function() {
|
1041 | return new Selection(this._exit || this._groups.map(sparse), this._parents);
|
1042 | };
|
1043 |
|
1044 | var selection_merge = function(selection) {
|
1045 |
|
1046 | for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
1047 | for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
1048 | if (node = group0[i] || group1[i]) {
|
1049 | merge[i] = node;
|
1050 | }
|
1051 | }
|
1052 | }
|
1053 |
|
1054 | for (; j < m0; ++j) {
|
1055 | merges[j] = groups0[j];
|
1056 | }
|
1057 |
|
1058 | return new Selection(merges, this._parents);
|
1059 | };
|
1060 |
|
1061 | var selection_order = function() {
|
1062 |
|
1063 | for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
|
1064 | for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
1065 | if (node = group[i]) {
|
1066 | if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
|
1067 | next = node;
|
1068 | }
|
1069 | }
|
1070 | }
|
1071 |
|
1072 | return this;
|
1073 | };
|
1074 |
|
1075 | var selection_sort = function(compare) {
|
1076 | if (!compare) compare = ascending$1;
|
1077 |
|
1078 | function compareNode(a, b) {
|
1079 | return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
1080 | }
|
1081 |
|
1082 | for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
1083 | for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
|
1084 | if (node = group[i]) {
|
1085 | sortgroup[i] = node;
|
1086 | }
|
1087 | }
|
1088 | sortgroup.sort(compareNode);
|
1089 | }
|
1090 |
|
1091 | return new Selection(sortgroups, this._parents).order();
|
1092 | };
|
1093 |
|
1094 | function ascending$1(a, b) {
|
1095 | return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
1096 | }
|
1097 |
|
1098 | var selection_call = function() {
|
1099 | var callback = arguments[0];
|
1100 | arguments[0] = this;
|
1101 | callback.apply(null, arguments);
|
1102 | return this;
|
1103 | };
|
1104 |
|
1105 | var selection_nodes = function() {
|
1106 | var nodes = new Array(this.size()), i = -1;
|
1107 | this.each(function() { nodes[++i] = this; });
|
1108 | return nodes;
|
1109 | };
|
1110 |
|
1111 | var selection_node = function() {
|
1112 |
|
1113 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
1114 | for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
|
1115 | var node = group[i];
|
1116 | if (node) return node;
|
1117 | }
|
1118 | }
|
1119 |
|
1120 | return null;
|
1121 | };
|
1122 |
|
1123 | var selection_size = function() {
|
1124 | var size = 0;
|
1125 | this.each(function() { ++size; });
|
1126 | return size;
|
1127 | };
|
1128 |
|
1129 | var selection_empty = function() {
|
1130 | return !this.node();
|
1131 | };
|
1132 |
|
1133 | var selection_each = function(callback) {
|
1134 |
|
1135 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
1136 | for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
1137 | if (node = group[i]) callback.call(node, node.__data__, i, group);
|
1138 | }
|
1139 | }
|
1140 |
|
1141 | return this;
|
1142 | };
|
1143 |
|
1144 | function attrRemove(name) {
|
1145 | return function() {
|
1146 | this.removeAttribute(name);
|
1147 | };
|
1148 | }
|
1149 |
|
1150 | function attrRemoveNS(fullname) {
|
1151 | return function() {
|
1152 | this.removeAttributeNS(fullname.space, fullname.local);
|
1153 | };
|
1154 | }
|
1155 |
|
1156 | function attrConstant(name, value) {
|
1157 | return function() {
|
1158 | this.setAttribute(name, value);
|
1159 | };
|
1160 | }
|
1161 |
|
1162 | function attrConstantNS(fullname, value) {
|
1163 | return function() {
|
1164 | this.setAttributeNS(fullname.space, fullname.local, value);
|
1165 | };
|
1166 | }
|
1167 |
|
1168 | function attrFunction(name, value) {
|
1169 | return function() {
|
1170 | var v = value.apply(this, arguments);
|
1171 | if (v == null) this.removeAttribute(name);
|
1172 | else this.setAttribute(name, v);
|
1173 | };
|
1174 | }
|
1175 |
|
1176 | function attrFunctionNS(fullname, value) {
|
1177 | return function() {
|
1178 | var v = value.apply(this, arguments);
|
1179 | if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
|
1180 | else this.setAttributeNS(fullname.space, fullname.local, v);
|
1181 | };
|
1182 | }
|
1183 |
|
1184 | var selection_attr = function(name, value) {
|
1185 | var fullname = namespace(name);
|
1186 |
|
1187 | if (arguments.length < 2) {
|
1188 | var node = this.node();
|
1189 | return fullname.local
|
1190 | ? node.getAttributeNS(fullname.space, fullname.local)
|
1191 | : node.getAttribute(fullname);
|
1192 | }
|
1193 |
|
1194 | return this.each((value == null
|
1195 | ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
|
1196 | ? (fullname.local ? attrFunctionNS : attrFunction)
|
1197 | : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
|
1198 | };
|
1199 |
|
1200 | var window = function(node) {
|
1201 | return (node.ownerDocument && node.ownerDocument.defaultView)
|
1202 | || (node.document && node)
|
1203 | || node.defaultView;
|
1204 | };
|
1205 |
|
1206 | function styleRemove(name) {
|
1207 | return function() {
|
1208 | this.style.removeProperty(name);
|
1209 | };
|
1210 | }
|
1211 |
|
1212 | function styleConstant(name, value, priority) {
|
1213 | return function() {
|
1214 | this.style.setProperty(name, value, priority);
|
1215 | };
|
1216 | }
|
1217 |
|
1218 | function styleFunction(name, value, priority) {
|
1219 | return function() {
|
1220 | var v = value.apply(this, arguments);
|
1221 | if (v == null) this.style.removeProperty(name);
|
1222 | else this.style.setProperty(name, v, priority);
|
1223 | };
|
1224 | }
|
1225 |
|
1226 | var selection_style = function(name, value, priority) {
|
1227 | var node;
|
1228 | return arguments.length > 1
|
1229 | ? this.each((value == null
|
1230 | ? styleRemove : typeof value === "function"
|
1231 | ? styleFunction
|
1232 | : styleConstant)(name, value, priority == null ? "" : priority))
|
1233 | : window(node = this.node())
|
1234 | .getComputedStyle(node, null)
|
1235 | .getPropertyValue(name);
|
1236 | };
|
1237 |
|
1238 | function propertyRemove(name) {
|
1239 | return function() {
|
1240 | delete this[name];
|
1241 | };
|
1242 | }
|
1243 |
|
1244 | function propertyConstant(name, value) {
|
1245 | return function() {
|
1246 | this[name] = value;
|
1247 | };
|
1248 | }
|
1249 |
|
1250 | function propertyFunction(name, value) {
|
1251 | return function() {
|
1252 | var v = value.apply(this, arguments);
|
1253 | if (v == null) delete this[name];
|
1254 | else this[name] = v;
|
1255 | };
|
1256 | }
|
1257 |
|
1258 | var selection_property = function(name, value) {
|
1259 | return arguments.length > 1
|
1260 | ? this.each((value == null
|
1261 | ? propertyRemove : typeof value === "function"
|
1262 | ? propertyFunction
|
1263 | : propertyConstant)(name, value))
|
1264 | : this.node()[name];
|
1265 | };
|
1266 |
|
1267 | function classArray(string) {
|
1268 | return string.trim().split(/^|\s+/);
|
1269 | }
|
1270 |
|
1271 | function classList(node) {
|
1272 | return node.classList || new ClassList(node);
|
1273 | }
|
1274 |
|
1275 | function ClassList(node) {
|
1276 | this._node = node;
|
1277 | this._names = classArray(node.getAttribute("class") || "");
|
1278 | }
|
1279 |
|
1280 | ClassList.prototype = {
|
1281 | add: function(name) {
|
1282 | var i = this._names.indexOf(name);
|
1283 | if (i < 0) {
|
1284 | this._names.push(name);
|
1285 | this._node.setAttribute("class", this._names.join(" "));
|
1286 | }
|
1287 | },
|
1288 | remove: function(name) {
|
1289 | var i = this._names.indexOf(name);
|
1290 | if (i >= 0) {
|
1291 | this._names.splice(i, 1);
|
1292 | this._node.setAttribute("class", this._names.join(" "));
|
1293 | }
|
1294 | },
|
1295 | contains: function(name) {
|
1296 | return this._names.indexOf(name) >= 0;
|
1297 | }
|
1298 | };
|
1299 |
|
1300 | function classedAdd(node, names) {
|
1301 | var list = classList(node), i = -1, n = names.length;
|
1302 | while (++i < n) list.add(names[i]);
|
1303 | }
|
1304 |
|
1305 | function classedRemove(node, names) {
|
1306 | var list = classList(node), i = -1, n = names.length;
|
1307 | while (++i < n) list.remove(names[i]);
|
1308 | }
|
1309 |
|
1310 | function classedTrue(names) {
|
1311 | return function() {
|
1312 | classedAdd(this, names);
|
1313 | };
|
1314 | }
|
1315 |
|
1316 | function classedFalse(names) {
|
1317 | return function() {
|
1318 | classedRemove(this, names);
|
1319 | };
|
1320 | }
|
1321 |
|
1322 | function classedFunction(names, value) {
|
1323 | return function() {
|
1324 | (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
1325 | };
|
1326 | }
|
1327 |
|
1328 | var selection_classed = function(name, value) {
|
1329 | var names = classArray(name + "");
|
1330 |
|
1331 | if (arguments.length < 2) {
|
1332 | var list = classList(this.node()), i = -1, n = names.length;
|
1333 | while (++i < n) if (!list.contains(names[i])) return false;
|
1334 | return true;
|
1335 | }
|
1336 |
|
1337 | return this.each((typeof value === "function"
|
1338 | ? classedFunction : value
|
1339 | ? classedTrue
|
1340 | : classedFalse)(names, value));
|
1341 | };
|
1342 |
|
1343 | function textRemove() {
|
1344 | this.textContent = "";
|
1345 | }
|
1346 |
|
1347 | function textConstant(value) {
|
1348 | return function() {
|
1349 | this.textContent = value;
|
1350 | };
|
1351 | }
|
1352 |
|
1353 | function textFunction(value) {
|
1354 | return function() {
|
1355 | var v = value.apply(this, arguments);
|
1356 | this.textContent = v == null ? "" : v;
|
1357 | };
|
1358 | }
|
1359 |
|
1360 | var selection_text = function(value) {
|
1361 | return arguments.length
|
1362 | ? this.each(value == null
|
1363 | ? textRemove : (typeof value === "function"
|
1364 | ? textFunction
|
1365 | : textConstant)(value))
|
1366 | : this.node().textContent;
|
1367 | };
|
1368 |
|
1369 | function htmlRemove() {
|
1370 | this.innerHTML = "";
|
1371 | }
|
1372 |
|
1373 | function htmlConstant(value) {
|
1374 | return function() {
|
1375 | this.innerHTML = value;
|
1376 | };
|
1377 | }
|
1378 |
|
1379 | function htmlFunction(value) {
|
1380 | return function() {
|
1381 | var v = value.apply(this, arguments);
|
1382 | this.innerHTML = v == null ? "" : v;
|
1383 | };
|
1384 | }
|
1385 |
|
1386 | var selection_html = function(value) {
|
1387 | return arguments.length
|
1388 | ? this.each(value == null
|
1389 | ? htmlRemove : (typeof value === "function"
|
1390 | ? htmlFunction
|
1391 | : htmlConstant)(value))
|
1392 | : this.node().innerHTML;
|
1393 | };
|
1394 |
|
1395 | function raise() {
|
1396 | if (this.nextSibling) this.parentNode.appendChild(this);
|
1397 | }
|
1398 |
|
1399 | var selection_raise = function() {
|
1400 | return this.each(raise);
|
1401 | };
|
1402 |
|
1403 | function lower() {
|
1404 | if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
1405 | }
|
1406 |
|
1407 | var selection_lower = function() {
|
1408 | return this.each(lower);
|
1409 | };
|
1410 |
|
1411 | var selection_append = function(name) {
|
1412 | var create = typeof name === "function" ? name : creator(name);
|
1413 | return this.select(function() {
|
1414 | return this.appendChild(create.apply(this, arguments));
|
1415 | });
|
1416 | };
|
1417 |
|
1418 | function constantNull() {
|
1419 | return null;
|
1420 | }
|
1421 |
|
1422 | var selection_insert = function(name, before) {
|
1423 | var create = typeof name === "function" ? name : creator(name),
|
1424 | select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
|
1425 | return this.select(function() {
|
1426 | return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
|
1427 | });
|
1428 | };
|
1429 |
|
1430 | function remove() {
|
1431 | var parent = this.parentNode;
|
1432 | if (parent) parent.removeChild(this);
|
1433 | }
|
1434 |
|
1435 | var selection_remove = function() {
|
1436 | return this.each(remove);
|
1437 | };
|
1438 |
|
1439 | var selection_datum = function(value) {
|
1440 | return arguments.length
|
1441 | ? this.property("__data__", value)
|
1442 | : this.node().__data__;
|
1443 | };
|
1444 |
|
1445 | function dispatchEvent(node, type, params) {
|
1446 | var window$$1 = window(node),
|
1447 | event = window$$1.CustomEvent;
|
1448 |
|
1449 | if (event) {
|
1450 | event = new event(type, params);
|
1451 | } else {
|
1452 | event = window$$1.document.createEvent("Event");
|
1453 | if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
|
1454 | else event.initEvent(type, false, false);
|
1455 | }
|
1456 |
|
1457 | node.dispatchEvent(event);
|
1458 | }
|
1459 |
|
1460 | function dispatchConstant(type, params) {
|
1461 | return function() {
|
1462 | return dispatchEvent(this, type, params);
|
1463 | };
|
1464 | }
|
1465 |
|
1466 | function dispatchFunction(type, params) {
|
1467 | return function() {
|
1468 | return dispatchEvent(this, type, params.apply(this, arguments));
|
1469 | };
|
1470 | }
|
1471 |
|
1472 | var selection_dispatch = function(type, params) {
|
1473 | return this.each((typeof params === "function"
|
1474 | ? dispatchFunction
|
1475 | : dispatchConstant)(type, params));
|
1476 | };
|
1477 |
|
1478 | var root = [null];
|
1479 |
|
1480 | function Selection(groups, parents) {
|
1481 | this._groups = groups;
|
1482 | this._parents = parents;
|
1483 | }
|
1484 |
|
1485 | function selection() {
|
1486 | return new Selection([[document.documentElement]], root);
|
1487 | }
|
1488 |
|
1489 | Selection.prototype = selection.prototype = {
|
1490 | constructor: Selection,
|
1491 | select: selection_select,
|
1492 | selectAll: selection_selectAll,
|
1493 | filter: selection_filter,
|
1494 | data: selection_data,
|
1495 | enter: selection_enter,
|
1496 | exit: selection_exit,
|
1497 | merge: selection_merge,
|
1498 | order: selection_order,
|
1499 | sort: selection_sort,
|
1500 | call: selection_call,
|
1501 | nodes: selection_nodes,
|
1502 | node: selection_node,
|
1503 | size: selection_size,
|
1504 | empty: selection_empty,
|
1505 | each: selection_each,
|
1506 | attr: selection_attr,
|
1507 | style: selection_style,
|
1508 | property: selection_property,
|
1509 | classed: selection_classed,
|
1510 | text: selection_text,
|
1511 | html: selection_html,
|
1512 | raise: selection_raise,
|
1513 | lower: selection_lower,
|
1514 | append: selection_append,
|
1515 | insert: selection_insert,
|
1516 | remove: selection_remove,
|
1517 | datum: selection_datum,
|
1518 | on: selection_on,
|
1519 | dispatch: selection_dispatch
|
1520 | };
|
1521 |
|
1522 | var select = function(selector) {
|
1523 | return typeof selector === "string"
|
1524 | ? new Selection([[document.querySelector(selector)]], [document.documentElement])
|
1525 | : new Selection([[selector]], root);
|
1526 | };
|
1527 |
|
1528 | var selectAll = function(selector) {
|
1529 | return typeof selector === "string"
|
1530 | ? new Selection([document.querySelectorAll(selector)], [document.documentElement])
|
1531 | : new Selection([selector == null ? [] : selector], root);
|
1532 | };
|
1533 |
|
1534 | var touch = function(node, touches, identifier) {
|
1535 | if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
|
1536 |
|
1537 | for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
|
1538 | if ((touch = touches[i]).identifier === identifier) {
|
1539 | return point(node, touch);
|
1540 | }
|
1541 | }
|
1542 |
|
1543 | return null;
|
1544 | };
|
1545 |
|
1546 | var touches = function(node, touches) {
|
1547 | if (touches == null) touches = sourceEvent().touches;
|
1548 |
|
1549 | for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {
|
1550 | points[i] = point(node, touches[i]);
|
1551 | }
|
1552 |
|
1553 | return points;
|
1554 | };
|
1555 |
|
1556 | var noop = {value: function() {}};
|
1557 |
|
1558 | function dispatch() {
|
1559 | for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
|
1560 | if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t);
|
1561 | _[t] = [];
|
1562 | }
|
1563 | return new Dispatch(_);
|
1564 | }
|
1565 |
|
1566 | function Dispatch(_) {
|
1567 | this._ = _;
|
1568 | }
|
1569 |
|
1570 | function parseTypenames$1(typenames, types) {
|
1571 | return typenames.trim().split(/^|\s+/).map(function(t) {
|
1572 | var name = "", i = t.indexOf(".");
|
1573 | if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
1574 | if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
1575 | return {type: t, name: name};
|
1576 | });
|
1577 | }
|
1578 |
|
1579 | Dispatch.prototype = dispatch.prototype = {
|
1580 | constructor: Dispatch,
|
1581 | on: function(typename, callback) {
|
1582 | var _ = this._,
|
1583 | T = parseTypenames$1(typename + "", _),
|
1584 | t,
|
1585 | i = -1,
|
1586 | n = T.length;
|
1587 |
|
1588 |
|
1589 | if (arguments.length < 2) {
|
1590 | while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
|
1591 | return;
|
1592 | }
|
1593 |
|
1594 | // If a type was specified, set the callback for the given type and name.
|
1595 | // Otherwise, if a null callback was specified, remove callbacks of the given name.
|
1596 | if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
1597 | while (++i < n) {
|
1598 | if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);
|
1599 | else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
|
1600 | }
|
1601 |
|
1602 | return this;
|
1603 | },
|
1604 | copy: function() {
|
1605 | var copy = {}, _ = this._;
|
1606 | for (var t in _) copy[t] = _[t].slice();
|
1607 | return new Dispatch(copy);
|
1608 | },
|
1609 | call: function(type, that) {
|
1610 | if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
|
1611 | if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
1612 | for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
1613 | },
|
1614 | apply: function(type, that, args) {
|
1615 | if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
1616 | for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
1617 | }
|
1618 | };
|
1619 |
|
1620 | function get$1(type, name) {
|
1621 | for (var i = 0, n = type.length, c; i < n; ++i) {
|
1622 | if ((c = type[i]).name === name) {
|
1623 | return c.value;
|
1624 | }
|
1625 | }
|
1626 | }
|
1627 |
|
1628 | function set$1(type, name, callback) {
|
1629 | for (var i = 0, n = type.length; i < n; ++i) {
|
1630 | if (type[i].name === name) {
|
1631 | type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
|
1632 | break;
|
1633 | }
|
1634 | }
|
1635 | if (callback != null) type.push({name: name, value: callback});
|
1636 | return type;
|
1637 | }
|
1638 |
|
1639 | var frame = 0;
|
1640 | var timeout = 0;
|
1641 | var interval = 0;
|
1642 | var pokeDelay = 1000;
|
1643 | var taskHead;
|
1644 | var taskTail;
|
1645 | var clockLast = 0;
|
1646 | var clockNow = 0;
|
1647 | var clockSkew = 0;
|
1648 | var clock = typeof performance === "object" && performance.now ? performance : Date;
|
1649 | var setFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : function(f) { setTimeout(f, 17); };
|
1650 |
|
1651 | function now() {
|
1652 | return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
1653 | }
|
1654 |
|
1655 | function clearNow() {
|
1656 | clockNow = 0;
|
1657 | }
|
1658 |
|
1659 | function Timer() {
|
1660 | this._call =
|
1661 | this._time =
|
1662 | this._next = null;
|
1663 | }
|
1664 |
|
1665 | Timer.prototype = timer.prototype = {
|
1666 | constructor: Timer,
|
1667 | restart: function(callback, delay, time) {
|
1668 | if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
1669 | time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
1670 | if (!this._next && taskTail !== this) {
|
1671 | if (taskTail) taskTail._next = this;
|
1672 | else taskHead = this;
|
1673 | taskTail = this;
|
1674 | }
|
1675 | this._call = callback;
|
1676 | this._time = time;
|
1677 | sleep();
|
1678 | },
|
1679 | stop: function() {
|
1680 | if (this._call) {
|
1681 | this._call = null;
|
1682 | this._time = Infinity;
|
1683 | sleep();
|
1684 | }
|
1685 | }
|
1686 | };
|
1687 |
|
1688 | function timer(callback, delay, time) {
|
1689 | var t = new Timer;
|
1690 | t.restart(callback, delay, time);
|
1691 | return t;
|
1692 | }
|
1693 |
|
1694 | function timerFlush() {
|
1695 | now();
|
1696 | ++frame;
|
1697 | var t = taskHead, e;
|
1698 | while (t) {
|
1699 | if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
|
1700 | t = t._next;
|
1701 | }
|
1702 | --frame;
|
1703 | }
|
1704 |
|
1705 | function wake() {
|
1706 | clockNow = (clockLast = clock.now()) + clockSkew;
|
1707 | frame = timeout = 0;
|
1708 | try {
|
1709 | timerFlush();
|
1710 | } finally {
|
1711 | frame = 0;
|
1712 | nap();
|
1713 | clockNow = 0;
|
1714 | }
|
1715 | }
|
1716 |
|
1717 | function poke() {
|
1718 | var now = clock.now(), delay = now - clockLast;
|
1719 | if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
|
1720 | }
|
1721 |
|
1722 | function nap() {
|
1723 | var t0, t1 = taskHead, t2, time = Infinity;
|
1724 | while (t1) {
|
1725 | if (t1._call) {
|
1726 | if (time > t1._time) time = t1._time;
|
1727 | t0 = t1, t1 = t1._next;
|
1728 | } else {
|
1729 | t2 = t1._next, t1._next = null;
|
1730 | t1 = t0 ? t0._next = t2 : taskHead = t2;
|
1731 | }
|
1732 | }
|
1733 | taskTail = t0;
|
1734 | sleep(time);
|
1735 | }
|
1736 |
|
1737 | function sleep(time) {
|
1738 | if (frame) return;
|
1739 | if (timeout) timeout = clearTimeout(timeout);
|
1740 | var delay = time - clockNow;
|
1741 | if (delay > 24) {
|
1742 | if (time < Infinity) timeout = setTimeout(wake, delay);
|
1743 | if (interval) interval = clearInterval(interval);
|
1744 | } else {
|
1745 | if (!interval) interval = setInterval(poke, pokeDelay);
|
1746 | frame = 1, setFrame(wake);
|
1747 | }
|
1748 | }
|
1749 |
|
1750 | var timeout$1 = function(callback, delay, time) {
|
1751 | var t = new Timer;
|
1752 | delay = delay == null ? 0 : +delay;
|
1753 | t.restart(function(elapsed) {
|
1754 | t.stop();
|
1755 | callback(elapsed + delay);
|
1756 | }, delay, time);
|
1757 | return t;
|
1758 | };
|
1759 |
|
1760 | var interval$1 = function(callback, delay, time) {
|
1761 | var t = new Timer, total = delay;
|
1762 | if (delay == null) return t.restart(callback, delay, time), t;
|
1763 | delay = +delay, time = time == null ? now() : +time;
|
1764 | t.restart(function tick(elapsed) {
|
1765 | elapsed += total;
|
1766 | t.restart(tick, total += delay, time);
|
1767 | callback(elapsed);
|
1768 | }, delay, time);
|
1769 | return t;
|
1770 | };
|
1771 |
|
1772 | var emptyOn = dispatch("start", "end", "interrupt");
|
1773 | var emptyTween = [];
|
1774 |
|
1775 | var CREATED = 0;
|
1776 | var SCHEDULED = 1;
|
1777 | var STARTING = 2;
|
1778 | var STARTED = 3;
|
1779 | var RUNNING = 4;
|
1780 | var ENDING = 5;
|
1781 | var ENDED = 6;
|
1782 |
|
1783 | var schedule = function(node, name, id, index, group, timing) {
|
1784 | var schedules = node.__transition;
|
1785 | if (!schedules) node.__transition = {};
|
1786 | else if (id in schedules) return;
|
1787 | create(node, id, {
|
1788 | name: name,
|
1789 | index: index,
|
1790 | group: group,
|
1791 | on: emptyOn,
|
1792 | tween: emptyTween,
|
1793 | time: timing.time,
|
1794 | delay: timing.delay,
|
1795 | duration: timing.duration,
|
1796 | ease: timing.ease,
|
1797 | timer: null,
|
1798 | state: CREATED
|
1799 | });
|
1800 | };
|
1801 |
|
1802 | function init(node, id) {
|
1803 | var schedule = node.__transition;
|
1804 | if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late");
|
1805 | return schedule;
|
1806 | }
|
1807 |
|
1808 | function set(node, id) {
|
1809 | var schedule = node.__transition;
|
1810 | if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error("too late");
|
1811 | return schedule;
|
1812 | }
|
1813 |
|
1814 | function get(node, id) {
|
1815 | var schedule = node.__transition;
|
1816 | if (!schedule || !(schedule = schedule[id])) throw new Error("too late");
|
1817 | return schedule;
|
1818 | }
|
1819 |
|
1820 | function create(node, id, self) {
|
1821 | var schedules = node.__transition,
|
1822 | tween;
|
1823 |
|
1824 |
|
1825 |
|
1826 | schedules[id] = self;
|
1827 | self.timer = timer(schedule, 0, self.time);
|
1828 |
|
1829 | function schedule(elapsed) {
|
1830 | self.state = SCHEDULED;
|
1831 | self.timer.restart(start, self.delay, self.time);
|
1832 |
|
1833 |
|
1834 | if (self.delay <= elapsed) start(elapsed - self.delay);
|
1835 | }
|
1836 |
|
1837 | function start(elapsed) {
|
1838 | var i, j, n, o;
|
1839 |
|
1840 |
|
1841 | if (self.state !== SCHEDULED) return stop();
|
1842 |
|
1843 | for (i in schedules) {
|
1844 | o = schedules[i];
|
1845 | if (o.name !== self.name) continue;
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 | if (o.state === STARTED) return timeout$1(start);
|
1851 |
|
1852 |
|
1853 |
|
1854 | if (o.state === RUNNING) {
|
1855 | o.state = ENDED;
|
1856 | o.timer.stop();
|
1857 | o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
1858 | delete schedules[i];
|
1859 | }
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 | else if (+i < id) {
|
1865 | o.state = ENDED;
|
1866 | o.timer.stop();
|
1867 | delete schedules[i];
|
1868 | }
|
1869 | }
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 | timeout$1(function() {
|
1876 | if (self.state === STARTED) {
|
1877 | self.state = RUNNING;
|
1878 | self.timer.restart(tick, self.delay, self.time);
|
1879 | tick(elapsed);
|
1880 | }
|
1881 | });
|
1882 |
|
1883 |
|
1884 |
|
1885 | self.state = STARTING;
|
1886 | self.on.call("start", node, node.__data__, self.index, self.group);
|
1887 | if (self.state !== STARTING) return;
|
1888 | self.state = STARTED;
|
1889 |
|
1890 |
|
1891 | tween = new Array(n = self.tween.length);
|
1892 | for (i = 0, j = -1; i < n; ++i) {
|
1893 | if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
1894 | tween[++j] = o;
|
1895 | }
|
1896 | }
|
1897 | tween.length = j + 1;
|
1898 | }
|
1899 |
|
1900 | function tick(elapsed) {
|
1901 | var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
|
1902 | i = -1,
|
1903 | n = tween.length;
|
1904 |
|
1905 | while (++i < n) {
|
1906 | tween[i].call(null, t);
|
1907 | }
|
1908 |
|
1909 |
|
1910 | if (self.state === ENDING) {
|
1911 | self.on.call("end", node, node.__data__, self.index, self.group);
|
1912 | stop();
|
1913 | }
|
1914 | }
|
1915 |
|
1916 | function stop() {
|
1917 | self.state = ENDED;
|
1918 | self.timer.stop();
|
1919 | delete schedules[id];
|
1920 | for (var i in schedules) return;
|
1921 | delete node.__transition;
|
1922 | }
|
1923 | }
|
1924 |
|
1925 | var interrupt = function(node, name) {
|
1926 | var schedules = node.__transition,
|
1927 | schedule,
|
1928 | active,
|
1929 | empty = true,
|
1930 | i;
|
1931 |
|
1932 | if (!schedules) return;
|
1933 |
|
1934 | name = name == null ? null : name + "";
|
1935 |
|
1936 | for (i in schedules) {
|
1937 | if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
1938 | active = schedule.state > STARTING && schedule.state < ENDING;
|
1939 | schedule.state = ENDED;
|
1940 | schedule.timer.stop();
|
1941 | if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group);
|
1942 | delete schedules[i];
|
1943 | }
|
1944 |
|
1945 | if (empty) delete node.__transition;
|
1946 | };
|
1947 |
|
1948 | var selection_interrupt = function(name) {
|
1949 | return this.each(function() {
|
1950 | interrupt(this, name);
|
1951 | });
|
1952 | };
|
1953 |
|
1954 | var define = function(constructor, factory, prototype) {
|
1955 | constructor.prototype = factory.prototype = prototype;
|
1956 | prototype.constructor = constructor;
|
1957 | };
|
1958 |
|
1959 | function extend(parent, definition) {
|
1960 | var prototype = Object.create(parent.prototype);
|
1961 | for (var key in definition) prototype[key] = definition[key];
|
1962 | return prototype;
|
1963 | }
|
1964 |
|
1965 | function Color() {}
|
1966 |
|
1967 | var darker = 0.7;
|
1968 | var brighter = 1 / darker;
|
1969 |
|
1970 | var reI = "\\s*([+-]?\\d+)\\s*";
|
1971 | var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
|
1972 | var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
|
1973 | var reHex3 = /^#([0-9a-f]{3})$/;
|
1974 | var reHex6 = /^#([0-9a-f]{6})$/;
|
1975 | var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
|
1976 | var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
|
1977 | var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
|
1978 | var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
|
1979 | var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
|
1980 | var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
|
1981 |
|
1982 | var named = {
|
1983 | aliceblue: 0xf0f8ff,
|
1984 | antiquewhite: 0xfaebd7,
|
1985 | aqua: 0x00ffff,
|
1986 | aquamarine: 0x7fffd4,
|
1987 | azure: 0xf0ffff,
|
1988 | beige: 0xf5f5dc,
|
1989 | bisque: 0xffe4c4,
|
1990 | black: 0x000000,
|
1991 | blanchedalmond: 0xffebcd,
|
1992 | blue: 0x0000ff,
|
1993 | blueviolet: 0x8a2be2,
|
1994 | brown: 0xa52a2a,
|
1995 | burlywood: 0xdeb887,
|
1996 | cadetblue: 0x5f9ea0,
|
1997 | chartreuse: 0x7fff00,
|
1998 | chocolate: 0xd2691e,
|
1999 | coral: 0xff7f50,
|
2000 | cornflowerblue: 0x6495ed,
|
2001 | cornsilk: 0xfff8dc,
|
2002 | crimson: 0xdc143c,
|
2003 | cyan: 0x00ffff,
|
2004 | darkblue: 0x00008b,
|
2005 | darkcyan: 0x008b8b,
|
2006 | darkgoldenrod: 0xb8860b,
|
2007 | darkgray: 0xa9a9a9,
|
2008 | darkgreen: 0x006400,
|
2009 | darkgrey: 0xa9a9a9,
|
2010 | darkkhaki: 0xbdb76b,
|
2011 | darkmagenta: 0x8b008b,
|
2012 | darkolivegreen: 0x556b2f,
|
2013 | darkorange: 0xff8c00,
|
2014 | darkorchid: 0x9932cc,
|
2015 | darkred: 0x8b0000,
|
2016 | darksalmon: 0xe9967a,
|
2017 | darkseagreen: 0x8fbc8f,
|
2018 | darkslateblue: 0x483d8b,
|
2019 | darkslategray: 0x2f4f4f,
|
2020 | darkslategrey: 0x2f4f4f,
|
2021 | darkturquoise: 0x00ced1,
|
2022 | darkviolet: 0x9400d3,
|
2023 | deeppink: 0xff1493,
|
2024 | deepskyblue: 0x00bfff,
|
2025 | dimgray: 0x696969,
|
2026 | dimgrey: 0x696969,
|
2027 | dodgerblue: 0x1e90ff,
|
2028 | firebrick: 0xb22222,
|
2029 | floralwhite: 0xfffaf0,
|
2030 | forestgreen: 0x228b22,
|
2031 | fuchsia: 0xff00ff,
|
2032 | gainsboro: 0xdcdcdc,
|
2033 | ghostwhite: 0xf8f8ff,
|
2034 | gold: 0xffd700,
|
2035 | goldenrod: 0xdaa520,
|
2036 | gray: 0x808080,
|
2037 | green: 0x008000,
|
2038 | greenyellow: 0xadff2f,
|
2039 | grey: 0x808080,
|
2040 | honeydew: 0xf0fff0,
|
2041 | hotpink: 0xff69b4,
|
2042 | indianred: 0xcd5c5c,
|
2043 | indigo: 0x4b0082,
|
2044 | ivory: 0xfffff0,
|
2045 | khaki: 0xf0e68c,
|
2046 | lavender: 0xe6e6fa,
|
2047 | lavenderblush: 0xfff0f5,
|
2048 | lawngreen: 0x7cfc00,
|
2049 | lemonchiffon: 0xfffacd,
|
2050 | lightblue: 0xadd8e6,
|
2051 | lightcoral: 0xf08080,
|
2052 | lightcyan: 0xe0ffff,
|
2053 | lightgoldenrodyellow: 0xfafad2,
|
2054 | lightgray: 0xd3d3d3,
|
2055 | lightgreen: 0x90ee90,
|
2056 | lightgrey: 0xd3d3d3,
|
2057 | lightpink: 0xffb6c1,
|
2058 | lightsalmon: 0xffa07a,
|
2059 | lightseagreen: 0x20b2aa,
|
2060 | lightskyblue: 0x87cefa,
|
2061 | lightslategray: 0x778899,
|
2062 | lightslategrey: 0x778899,
|
2063 | lightsteelblue: 0xb0c4de,
|
2064 | lightyellow: 0xffffe0,
|
2065 | lime: 0x00ff00,
|
2066 | limegreen: 0x32cd32,
|
2067 | linen: 0xfaf0e6,
|
2068 | magenta: 0xff00ff,
|
2069 | maroon: 0x800000,
|
2070 | mediumaquamarine: 0x66cdaa,
|
2071 | mediumblue: 0x0000cd,
|
2072 | mediumorchid: 0xba55d3,
|
2073 | mediumpurple: 0x9370db,
|
2074 | mediumseagreen: 0x3cb371,
|
2075 | mediumslateblue: 0x7b68ee,
|
2076 | mediumspringgreen: 0x00fa9a,
|
2077 | mediumturquoise: 0x48d1cc,
|
2078 | mediumvioletred: 0xc71585,
|
2079 | midnightblue: 0x191970,
|
2080 | mintcream: 0xf5fffa,
|
2081 | mistyrose: 0xffe4e1,
|
2082 | moccasin: 0xffe4b5,
|
2083 | navajowhite: 0xffdead,
|
2084 | navy: 0x000080,
|
2085 | oldlace: 0xfdf5e6,
|
2086 | olive: 0x808000,
|
2087 | olivedrab: 0x6b8e23,
|
2088 | orange: 0xffa500,
|
2089 | orangered: 0xff4500,
|
2090 | orchid: 0xda70d6,
|
2091 | palegoldenrod: 0xeee8aa,
|
2092 | palegreen: 0x98fb98,
|
2093 | paleturquoise: 0xafeeee,
|
2094 | palevioletred: 0xdb7093,
|
2095 | papayawhip: 0xffefd5,
|
2096 | peachpuff: 0xffdab9,
|
2097 | peru: 0xcd853f,
|
2098 | pink: 0xffc0cb,
|
2099 | plum: 0xdda0dd,
|
2100 | powderblue: 0xb0e0e6,
|
2101 | purple: 0x800080,
|
2102 | rebeccapurple: 0x663399,
|
2103 | red: 0xff0000,
|
2104 | rosybrown: 0xbc8f8f,
|
2105 | royalblue: 0x4169e1,
|
2106 | saddlebrown: 0x8b4513,
|
2107 | salmon: 0xfa8072,
|
2108 | sandybrown: 0xf4a460,
|
2109 | seagreen: 0x2e8b57,
|
2110 | seashell: 0xfff5ee,
|
2111 | sienna: 0xa0522d,
|
2112 | silver: 0xc0c0c0,
|
2113 | skyblue: 0x87ceeb,
|
2114 | slateblue: 0x6a5acd,
|
2115 | slategray: 0x708090,
|
2116 | slategrey: 0x708090,
|
2117 | snow: 0xfffafa,
|
2118 | springgreen: 0x00ff7f,
|
2119 | steelblue: 0x4682b4,
|
2120 | tan: 0xd2b48c,
|
2121 | teal: 0x008080,
|
2122 | thistle: 0xd8bfd8,
|
2123 | tomato: 0xff6347,
|
2124 | turquoise: 0x40e0d0,
|
2125 | violet: 0xee82ee,
|
2126 | wheat: 0xf5deb3,
|
2127 | white: 0xffffff,
|
2128 | whitesmoke: 0xf5f5f5,
|
2129 | yellow: 0xffff00,
|
2130 | yellowgreen: 0x9acd32
|
2131 | };
|
2132 |
|
2133 | define(Color, color, {
|
2134 | displayable: function() {
|
2135 | return this.rgb().displayable();
|
2136 | },
|
2137 | toString: function() {
|
2138 | return this.rgb() + "";
|
2139 | }
|
2140 | });
|
2141 |
|
2142 | function color(format) {
|
2143 | var m;
|
2144 | format = (format + "").trim().toLowerCase();
|
2145 | return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1))
|
2146 | : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16))
|
2147 | : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1)
|
2148 | : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1)
|
2149 | : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4])
|
2150 | : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4])
|
2151 | : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1)
|
2152 | : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4])
|
2153 | : named.hasOwnProperty(format) ? rgbn(named[format])
|
2154 | : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
|
2155 | : null;
|
2156 | }
|
2157 |
|
2158 | function rgbn(n) {
|
2159 | return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
2160 | }
|
2161 |
|
2162 | function rgba(r, g, b, a) {
|
2163 | if (a <= 0) r = g = b = NaN;
|
2164 | return new Rgb(r, g, b, a);
|
2165 | }
|
2166 |
|
2167 | function rgbConvert(o) {
|
2168 | if (!(o instanceof Color)) o = color(o);
|
2169 | if (!o) return new Rgb;
|
2170 | o = o.rgb();
|
2171 | return new Rgb(o.r, o.g, o.b, o.opacity);
|
2172 | }
|
2173 |
|
2174 | function rgb(r, g, b, opacity) {
|
2175 | return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
2176 | }
|
2177 |
|
2178 | function Rgb(r, g, b, opacity) {
|
2179 | this.r = +r;
|
2180 | this.g = +g;
|
2181 | this.b = +b;
|
2182 | this.opacity = +opacity;
|
2183 | }
|
2184 |
|
2185 | define(Rgb, rgb, extend(Color, {
|
2186 | brighter: function(k) {
|
2187 | k = k == null ? brighter : Math.pow(brighter, k);
|
2188 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
2189 | },
|
2190 | darker: function(k) {
|
2191 | k = k == null ? darker : Math.pow(darker, k);
|
2192 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
2193 | },
|
2194 | rgb: function() {
|
2195 | return this;
|
2196 | },
|
2197 | displayable: function() {
|
2198 | return (0 <= this.r && this.r <= 255)
|
2199 | && (0 <= this.g && this.g <= 255)
|
2200 | && (0 <= this.b && this.b <= 255)
|
2201 | && (0 <= this.opacity && this.opacity <= 1);
|
2202 | },
|
2203 | toString: function() {
|
2204 | var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
2205 | return (a === 1 ? "rgb(" : "rgba(")
|
2206 | + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
|
2207 | + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
|
2208 | + Math.max(0, Math.min(255, Math.round(this.b) || 0))
|
2209 | + (a === 1 ? ")" : ", " + a + ")");
|
2210 | }
|
2211 | }));
|
2212 |
|
2213 | function hsla(h, s, l, a) {
|
2214 | if (a <= 0) h = s = l = NaN;
|
2215 | else if (l <= 0 || l >= 1) h = s = NaN;
|
2216 | else if (s <= 0) h = NaN;
|
2217 | return new Hsl(h, s, l, a);
|
2218 | }
|
2219 |
|
2220 | function hslConvert(o) {
|
2221 | if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
2222 | if (!(o instanceof Color)) o = color(o);
|
2223 | if (!o) return new Hsl;
|
2224 | if (o instanceof Hsl) return o;
|
2225 | o = o.rgb();
|
2226 | var r = o.r / 255,
|
2227 | g = o.g / 255,
|
2228 | b = o.b / 255,
|
2229 | min = Math.min(r, g, b),
|
2230 | max = Math.max(r, g, b),
|
2231 | h = NaN,
|
2232 | s = max - min,
|
2233 | l = (max + min) / 2;
|
2234 | if (s) {
|
2235 | if (r === max) h = (g - b) / s + (g < b) * 6;
|
2236 | else if (g === max) h = (b - r) / s + 2;
|
2237 | else h = (r - g) / s + 4;
|
2238 | s /= l < 0.5 ? max + min : 2 - max - min;
|
2239 | h *= 60;
|
2240 | } else {
|
2241 | s = l > 0 && l < 1 ? 0 : h;
|
2242 | }
|
2243 | return new Hsl(h, s, l, o.opacity);
|
2244 | }
|
2245 |
|
2246 | function hsl(h, s, l, opacity) {
|
2247 | return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
2248 | }
|
2249 |
|
2250 | function Hsl(h, s, l, opacity) {
|
2251 | this.h = +h;
|
2252 | this.s = +s;
|
2253 | this.l = +l;
|
2254 | this.opacity = +opacity;
|
2255 | }
|
2256 |
|
2257 | define(Hsl, hsl, extend(Color, {
|
2258 | brighter: function(k) {
|
2259 | k = k == null ? brighter : Math.pow(brighter, k);
|
2260 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
2261 | },
|
2262 | darker: function(k) {
|
2263 | k = k == null ? darker : Math.pow(darker, k);
|
2264 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
2265 | },
|
2266 | rgb: function() {
|
2267 | var h = this.h % 360 + (this.h < 0) * 360,
|
2268 | s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
2269 | l = this.l,
|
2270 | m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
2271 | m1 = 2 * l - m2;
|
2272 | return new Rgb(
|
2273 | hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
2274 | hsl2rgb(h, m1, m2),
|
2275 | hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
2276 | this.opacity
|
2277 | );
|
2278 | },
|
2279 | displayable: function() {
|
2280 | return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
2281 | && (0 <= this.l && this.l <= 1)
|
2282 | && (0 <= this.opacity && this.opacity <= 1);
|
2283 | }
|
2284 | }));
|
2285 |
|
2286 |
|
2287 | function hsl2rgb(h, m1, m2) {
|
2288 | return (h < 60 ? m1 + (m2 - m1) * h / 60
|
2289 | : h < 180 ? m2
|
2290 | : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
2291 | : m1) * 255;
|
2292 | }
|
2293 |
|
2294 | var deg2rad = Math.PI / 180;
|
2295 | var rad2deg = 180 / Math.PI;
|
2296 |
|
2297 | var Kn = 18;
|
2298 | var Xn = 0.950470;
|
2299 | var Yn = 1;
|
2300 | var Zn = 1.088830;
|
2301 | var t0 = 4 / 29;
|
2302 | var t1 = 6 / 29;
|
2303 | var t2 = 3 * t1 * t1;
|
2304 | var t3 = t1 * t1 * t1;
|
2305 |
|
2306 | function labConvert(o) {
|
2307 | if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
|
2308 | if (o instanceof Hcl) {
|
2309 | var h = o.h * deg2rad;
|
2310 | return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
|
2311 | }
|
2312 | if (!(o instanceof Rgb)) o = rgbConvert(o);
|
2313 | var b = rgb2xyz(o.r),
|
2314 | a = rgb2xyz(o.g),
|
2315 | l = rgb2xyz(o.b),
|
2316 | x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
|
2317 | y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
|
2318 | z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
|
2319 | return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
|
2320 | }
|
2321 |
|
2322 | function lab(l, a, b, opacity) {
|
2323 | return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
|
2324 | }
|
2325 |
|
2326 | function Lab(l, a, b, opacity) {
|
2327 | this.l = +l;
|
2328 | this.a = +a;
|
2329 | this.b = +b;
|
2330 | this.opacity = +opacity;
|
2331 | }
|
2332 |
|
2333 | define(Lab, lab, extend(Color, {
|
2334 | brighter: function(k) {
|
2335 | return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
2336 | },
|
2337 | darker: function(k) {
|
2338 | return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
2339 | },
|
2340 | rgb: function() {
|
2341 | var y = (this.l + 16) / 116,
|
2342 | x = isNaN(this.a) ? y : y + this.a / 500,
|
2343 | z = isNaN(this.b) ? y : y - this.b / 200;
|
2344 | y = Yn * lab2xyz(y);
|
2345 | x = Xn * lab2xyz(x);
|
2346 | z = Zn * lab2xyz(z);
|
2347 | return new Rgb(
|
2348 | xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
|
2349 | xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
|
2350 | xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
|
2351 | this.opacity
|
2352 | );
|
2353 | }
|
2354 | }));
|
2355 |
|
2356 | function xyz2lab(t) {
|
2357 | return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
|
2358 | }
|
2359 |
|
2360 | function lab2xyz(t) {
|
2361 | return t > t1 ? t * t * t : t2 * (t - t0);
|
2362 | }
|
2363 |
|
2364 | function xyz2rgb(x) {
|
2365 | return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
2366 | }
|
2367 |
|
2368 | function rgb2xyz(x) {
|
2369 | return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
2370 | }
|
2371 |
|
2372 | function hclConvert(o) {
|
2373 | if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
|
2374 | if (!(o instanceof Lab)) o = labConvert(o);
|
2375 | var h = Math.atan2(o.b, o.a) * rad2deg;
|
2376 | return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
|
2377 | }
|
2378 |
|
2379 | function hcl(h, c, l, opacity) {
|
2380 | return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
|
2381 | }
|
2382 |
|
2383 | function Hcl(h, c, l, opacity) {
|
2384 | this.h = +h;
|
2385 | this.c = +c;
|
2386 | this.l = +l;
|
2387 | this.opacity = +opacity;
|
2388 | }
|
2389 |
|
2390 | define(Hcl, hcl, extend(Color, {
|
2391 | brighter: function(k) {
|
2392 | return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
|
2393 | },
|
2394 | darker: function(k) {
|
2395 | return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
|
2396 | },
|
2397 | rgb: function() {
|
2398 | return labConvert(this).rgb();
|
2399 | }
|
2400 | }));
|
2401 |
|
2402 | var A = -0.14861;
|
2403 | var B = +1.78277;
|
2404 | var C = -0.29227;
|
2405 | var D = -0.90649;
|
2406 | var E = +1.97294;
|
2407 | var ED = E * D;
|
2408 | var EB = E * B;
|
2409 | var BC_DA = B * C - D * A;
|
2410 |
|
2411 | function cubehelixConvert(o) {
|
2412 | if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
|
2413 | if (!(o instanceof Rgb)) o = rgbConvert(o);
|
2414 | var r = o.r / 255,
|
2415 | g = o.g / 255,
|
2416 | b = o.b / 255,
|
2417 | l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
|
2418 | bl = b - l,
|
2419 | k = (E * (g - l) - C * bl) / D,
|
2420 | s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)),
|
2421 | h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
|
2422 | return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
|
2423 | }
|
2424 |
|
2425 | function cubehelix(h, s, l, opacity) {
|
2426 | return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
|
2427 | }
|
2428 |
|
2429 | function Cubehelix(h, s, l, opacity) {
|
2430 | this.h = +h;
|
2431 | this.s = +s;
|
2432 | this.l = +l;
|
2433 | this.opacity = +opacity;
|
2434 | }
|
2435 |
|
2436 | define(Cubehelix, cubehelix, extend(Color, {
|
2437 | brighter: function(k) {
|
2438 | k = k == null ? brighter : Math.pow(brighter, k);
|
2439 | return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
2440 | },
|
2441 | darker: function(k) {
|
2442 | k = k == null ? darker : Math.pow(darker, k);
|
2443 | return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
2444 | },
|
2445 | rgb: function() {
|
2446 | var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
|
2447 | l = +this.l,
|
2448 | a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
|
2449 | cosh = Math.cos(h),
|
2450 | sinh = Math.sin(h);
|
2451 | return new Rgb(
|
2452 | 255 * (l + a * (A * cosh + B * sinh)),
|
2453 | 255 * (l + a * (C * cosh + D * sinh)),
|
2454 | 255 * (l + a * (E * cosh)),
|
2455 | this.opacity
|
2456 | );
|
2457 | }
|
2458 | }));
|
2459 |
|
2460 | function basis(t1, v0, v1, v2, v3) {
|
2461 | var t2 = t1 * t1, t3 = t2 * t1;
|
2462 | return ((1 - 3 * t1 + 3 * t2 - t3) * v0
|
2463 | + (4 - 6 * t2 + 3 * t3) * v1
|
2464 | + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
|
2465 | + t3 * v3) / 6;
|
2466 | }
|
2467 |
|
2468 | var constant$2 = function(x) {
|
2469 | return function() {
|
2470 | return x;
|
2471 | };
|
2472 | };
|
2473 |
|
2474 | function linear(a, d) {
|
2475 | return function(t) {
|
2476 | return a + t * d;
|
2477 | };
|
2478 | }
|
2479 |
|
2480 | function exponential(a, b, y) {
|
2481 | return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
2482 | return Math.pow(a + t * b, y);
|
2483 | };
|
2484 | }
|
2485 |
|
2486 | function hue(a, b) {
|
2487 | var d = b - a;
|
2488 | return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a) ? b : a);
|
2489 | }
|
2490 |
|
2491 | function gamma(y) {
|
2492 | return (y = +y) === 1 ? nogamma : function(a, b) {
|
2493 | return b - a ? exponential(a, b, y) : constant$2(isNaN(a) ? b : a);
|
2494 | };
|
2495 | }
|
2496 |
|
2497 | function nogamma(a, b) {
|
2498 | var d = b - a;
|
2499 | return d ? linear(a, d) : constant$2(isNaN(a) ? b : a);
|
2500 | }
|
2501 |
|
2502 | var interpolateRgb = ((function rgbGamma(y) {
|
2503 | var color$$1 = gamma(y);
|
2504 |
|
2505 | function rgb$$1(start, end) {
|
2506 | var r = color$$1((start = rgb(start)).r, (end = rgb(end)).r),
|
2507 | g = color$$1(start.g, end.g),
|
2508 | b = color$$1(start.b, end.b),
|
2509 | opacity = color$$1(start.opacity, end.opacity);
|
2510 | return function(t) {
|
2511 | start.r = r(t);
|
2512 | start.g = g(t);
|
2513 | start.b = b(t);
|
2514 | start.opacity = opacity(t);
|
2515 | return start + "";
|
2516 | };
|
2517 | }
|
2518 |
|
2519 | rgb$$1.gamma = rgbGamma;
|
2520 |
|
2521 | return rgb$$1;
|
2522 | }))(1);
|
2523 |
|
2524 | var array$1 = function(a, b) {
|
2525 | var nb = b ? b.length : 0,
|
2526 | na = a ? Math.min(nb, a.length) : 0,
|
2527 | x = new Array(nb),
|
2528 | c = new Array(nb),
|
2529 | i;
|
2530 |
|
2531 | for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]);
|
2532 | for (; i < nb; ++i) c[i] = b[i];
|
2533 |
|
2534 | return function(t) {
|
2535 | for (i = 0; i < na; ++i) c[i] = x[i](t);
|
2536 | return c;
|
2537 | };
|
2538 | };
|
2539 |
|
2540 | var date = function(a, b) {
|
2541 | var d = new Date;
|
2542 | return a = +a, b -= a, function(t) {
|
2543 | return d.setTime(a + b * t), d;
|
2544 | };
|
2545 | };
|
2546 |
|
2547 | var reinterpolate = function(a, b) {
|
2548 | return a = +a, b -= a, function(t) {
|
2549 | return a + b * t;
|
2550 | };
|
2551 | };
|
2552 |
|
2553 | var object = function(a, b) {
|
2554 | var i = {},
|
2555 | c = {},
|
2556 | k;
|
2557 |
|
2558 | if (a === null || typeof a !== "object") a = {};
|
2559 | if (b === null || typeof b !== "object") b = {};
|
2560 |
|
2561 | for (k in b) {
|
2562 | if (k in a) {
|
2563 | i[k] = interpolateValue(a[k], b[k]);
|
2564 | } else {
|
2565 | c[k] = b[k];
|
2566 | }
|
2567 | }
|
2568 |
|
2569 | return function(t) {
|
2570 | for (k in i) c[k] = i[k](t);
|
2571 | return c;
|
2572 | };
|
2573 | };
|
2574 |
|
2575 | var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
|
2576 | var reB = new RegExp(reA.source, "g");
|
2577 |
|
2578 | function zero(b) {
|
2579 | return function() {
|
2580 | return b;
|
2581 | };
|
2582 | }
|
2583 |
|
2584 | function one(b) {
|
2585 | return function(t) {
|
2586 | return b(t) + "";
|
2587 | };
|
2588 | }
|
2589 |
|
2590 | var interpolateString = function(a, b) {
|
2591 | var bi = reA.lastIndex = reB.lastIndex = 0,
|
2592 | am,
|
2593 | bm,
|
2594 | bs,
|
2595 | i = -1,
|
2596 | s = [],
|
2597 | q = [];
|
2598 |
|
2599 |
|
2600 | a = a + "", b = b + "";
|
2601 |
|
2602 |
|
2603 | while ((am = reA.exec(a))
|
2604 | && (bm = reB.exec(b))) {
|
2605 | if ((bs = bm.index) > bi) {
|
2606 | bs = b.slice(bi, bs);
|
2607 | if (s[i]) s[i] += bs;
|
2608 | else s[++i] = bs;
|
2609 | }
|
2610 | if ((am = am[0]) === (bm = bm[0])) {
|
2611 | if (s[i]) s[i] += bm;
|
2612 | else s[++i] = bm;
|
2613 | } else {
|
2614 | s[++i] = null;
|
2615 | q.push({i: i, x: reinterpolate(am, bm)});
|
2616 | }
|
2617 | bi = reB.lastIndex;
|
2618 | }
|
2619 |
|
2620 |
|
2621 | if (bi < b.length) {
|
2622 | bs = b.slice(bi);
|
2623 | if (s[i]) s[i] += bs;
|
2624 | else s[++i] = bs;
|
2625 | }
|
2626 |
|
2627 |
|
2628 |
|
2629 | return s.length < 2 ? (q[0]
|
2630 | ? one(q[0].x)
|
2631 | : zero(b))
|
2632 | : (b = q.length, function(t) {
|
2633 | for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
|
2634 | return s.join("");
|
2635 | });
|
2636 | };
|
2637 |
|
2638 | var interpolateValue = function(a, b) {
|
2639 | var t = typeof b, c;
|
2640 | return b == null || t === "boolean" ? constant$2(b)
|
2641 | : (t === "number" ? reinterpolate
|
2642 | : t === "string" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString)
|
2643 | : b instanceof color ? interpolateRgb
|
2644 | : b instanceof Date ? date
|
2645 | : Array.isArray(b) ? array$1
|
2646 | : isNaN(b) ? object
|
2647 | : reinterpolate)(a, b);
|
2648 | };
|
2649 |
|
2650 | var interpolateRound = function(a, b) {
|
2651 | return a = +a, b -= a, function(t) {
|
2652 | return Math.round(a + b * t);
|
2653 | };
|
2654 | };
|
2655 |
|
2656 | var degrees = 180 / Math.PI;
|
2657 |
|
2658 | var identity$2 = {
|
2659 | translateX: 0,
|
2660 | translateY: 0,
|
2661 | rotate: 0,
|
2662 | skewX: 0,
|
2663 | scaleX: 1,
|
2664 | scaleY: 1
|
2665 | };
|
2666 |
|
2667 | var decompose = function(a, b, c, d, e, f) {
|
2668 | var scaleX, scaleY, skewX;
|
2669 | if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
|
2670 | if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
|
2671 | if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
|
2672 | if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
|
2673 | return {
|
2674 | translateX: e,
|
2675 | translateY: f,
|
2676 | rotate: Math.atan2(b, a) * degrees,
|
2677 | skewX: Math.atan(skewX) * degrees,
|
2678 | scaleX: scaleX,
|
2679 | scaleY: scaleY
|
2680 | };
|
2681 | };
|
2682 |
|
2683 | var cssNode;
|
2684 | var cssRoot;
|
2685 | var cssView;
|
2686 | var svgNode;
|
2687 |
|
2688 | function parseCss(value) {
|
2689 | if (value === "none") return identity$2;
|
2690 | if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
|
2691 | cssNode.style.transform = value;
|
2692 | value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
|
2693 | cssRoot.removeChild(cssNode);
|
2694 | value = value.slice(7, -1).split(",");
|
2695 | return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
|
2696 | }
|
2697 |
|
2698 | function parseSvg(value) {
|
2699 | if (value == null) return identity$2;
|
2700 | if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
2701 | svgNode.setAttribute("transform", value);
|
2702 | if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2;
|
2703 | value = value.matrix;
|
2704 | return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
2705 | }
|
2706 |
|
2707 | function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
2708 |
|
2709 | function pop(s) {
|
2710 | return s.length ? s.pop() + " " : "";
|
2711 | }
|
2712 |
|
2713 | function translate(xa, ya, xb, yb, s, q) {
|
2714 | if (xa !== xb || ya !== yb) {
|
2715 | var i = s.push("translate(", null, pxComma, null, pxParen);
|
2716 | q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});
|
2717 | } else if (xb || yb) {
|
2718 | s.push("translate(" + xb + pxComma + yb + pxParen);
|
2719 | }
|
2720 | }
|
2721 |
|
2722 | function rotate(a, b, s, q) {
|
2723 | if (a !== b) {
|
2724 | if (a - b > 180) b += 360; else if (b - a > 180) a += 360;
|
2725 | q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: reinterpolate(a, b)});
|
2726 | } else if (b) {
|
2727 | s.push(pop(s) + "rotate(" + b + degParen);
|
2728 | }
|
2729 | }
|
2730 |
|
2731 | function skewX(a, b, s, q) {
|
2732 | if (a !== b) {
|
2733 | q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: reinterpolate(a, b)});
|
2734 | } else if (b) {
|
2735 | s.push(pop(s) + "skewX(" + b + degParen);
|
2736 | }
|
2737 | }
|
2738 |
|
2739 | function scale(xa, ya, xb, yb, s, q) {
|
2740 | if (xa !== xb || ya !== yb) {
|
2741 | var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
2742 | q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});
|
2743 | } else if (xb !== 1 || yb !== 1) {
|
2744 | s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
2745 | }
|
2746 | }
|
2747 |
|
2748 | return function(a, b) {
|
2749 | var s = [],
|
2750 | q = [];
|
2751 | a = parse(a), b = parse(b);
|
2752 | translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
2753 | rotate(a.rotate, b.rotate, s, q);
|
2754 | skewX(a.skewX, b.skewX, s, q);
|
2755 | scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
2756 | a = b = null;
|
2757 | return function(t) {
|
2758 | var i = -1, n = q.length, o;
|
2759 | while (++i < n) s[(o = q[i]).i] = o.x(t);
|
2760 | return s.join("");
|
2761 | };
|
2762 | };
|
2763 | }
|
2764 |
|
2765 | var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
2766 | var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 | function cubehelix$1(hue$$1) {
|
2772 | return (function cubehelixGamma(y) {
|
2773 | y = +y;
|
2774 |
|
2775 | function cubehelix$$1(start, end) {
|
2776 | var h = hue$$1((start = cubehelix(start)).h, (end = cubehelix(end)).h),
|
2777 | s = nogamma(start.s, end.s),
|
2778 | l = nogamma(start.l, end.l),
|
2779 | opacity = nogamma(start.opacity, end.opacity);
|
2780 | return function(t) {
|
2781 | start.h = h(t);
|
2782 | start.s = s(t);
|
2783 | start.l = l(Math.pow(t, y));
|
2784 | start.opacity = opacity(t);
|
2785 | return start + "";
|
2786 | };
|
2787 | }
|
2788 |
|
2789 | cubehelix$$1.gamma = cubehelixGamma;
|
2790 |
|
2791 | return cubehelix$$1;
|
2792 | })(1);
|
2793 | }
|
2794 |
|
2795 | cubehelix$1(hue);
|
2796 | var cubehelixLong = cubehelix$1(nogamma);
|
2797 |
|
2798 | function tweenRemove(id, name) {
|
2799 | var tween0, tween1;
|
2800 | return function() {
|
2801 | var schedule = set(this, id),
|
2802 | tween = schedule.tween;
|
2803 |
|
2804 | // If this node shared tween with the previous node,
|
2805 | // just assign the updated shared tween and we’re done!
|
2806 | // Otherwise, copy-on-write.
|
2807 | if (tween !== tween0) {
|
2808 | tween1 = tween0 = tween;
|
2809 | for (var i = 0, n = tween1.length; i < n; ++i) {
|
2810 | if (tween1[i].name === name) {
|
2811 | tween1 = tween1.slice();
|
2812 | tween1.splice(i, 1);
|
2813 | break;
|
2814 | }
|
2815 | }
|
2816 | }
|
2817 |
|
2818 | schedule.tween = tween1;
|
2819 | };
|
2820 | }
|
2821 |
|
2822 | function tweenFunction(id, name, value) {
|
2823 | var tween0, tween1;
|
2824 | if (typeof value !== "function") throw new Error;
|
2825 | return function() {
|
2826 | var schedule = set(this, id),
|
2827 | tween = schedule.tween;
|
2828 |
|
2829 | // If this node shared tween with the previous node,
|
2830 | // just assign the updated shared tween and we’re done!
|
2831 | // Otherwise, copy-on-write.
|
2832 | if (tween !== tween0) {
|
2833 | tween1 = (tween0 = tween).slice();
|
2834 | for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
|
2835 | if (tween1[i].name === name) {
|
2836 | tween1[i] = t;
|
2837 | break;
|
2838 | }
|
2839 | }
|
2840 | if (i === n) tween1.push(t);
|
2841 | }
|
2842 |
|
2843 | schedule.tween = tween1;
|
2844 | };
|
2845 | }
|
2846 |
|
2847 | var transition_tween = function(name, value) {
|
2848 | var id = this._id;
|
2849 |
|
2850 | name += "";
|
2851 |
|
2852 | if (arguments.length < 2) {
|
2853 | var tween = get(this.node(), id).tween;
|
2854 | for (var i = 0, n = tween.length, t; i < n; ++i) {
|
2855 | if ((t = tween[i]).name === name) {
|
2856 | return t.value;
|
2857 | }
|
2858 | }
|
2859 | return null;
|
2860 | }
|
2861 |
|
2862 | return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
2863 | };
|
2864 |
|
2865 | function tweenValue(transition, name, value) {
|
2866 | var id = transition._id;
|
2867 |
|
2868 | transition.each(function() {
|
2869 | var schedule = set(this, id);
|
2870 | (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
2871 | });
|
2872 |
|
2873 | return function(node) {
|
2874 | return get(node, id).value[name];
|
2875 | };
|
2876 | }
|
2877 |
|
2878 | var interpolate$$1 = function(a, b) {
|
2879 | var c;
|
2880 | return (typeof b === "number" ? reinterpolate
|
2881 | : b instanceof color ? interpolateRgb
|
2882 | : (c = color(b)) ? (b = c, interpolateRgb)
|
2883 | : interpolateString)(a, b);
|
2884 | };
|
2885 |
|
2886 | function attrRemove$1(name) {
|
2887 | return function() {
|
2888 | this.removeAttribute(name);
|
2889 | };
|
2890 | }
|
2891 |
|
2892 | function attrRemoveNS$1(fullname) {
|
2893 | return function() {
|
2894 | this.removeAttributeNS(fullname.space, fullname.local);
|
2895 | };
|
2896 | }
|
2897 |
|
2898 | function attrConstant$1(name, interpolate$$1, value1) {
|
2899 | var value00,
|
2900 | interpolate0;
|
2901 | return function() {
|
2902 | var value0 = this.getAttribute(name);
|
2903 | return value0 === value1 ? null
|
2904 | : value0 === value00 ? interpolate0
|
2905 | : interpolate0 = interpolate$$1(value00 = value0, value1);
|
2906 | };
|
2907 | }
|
2908 |
|
2909 | function attrConstantNS$1(fullname, interpolate$$1, value1) {
|
2910 | var value00,
|
2911 | interpolate0;
|
2912 | return function() {
|
2913 | var value0 = this.getAttributeNS(fullname.space, fullname.local);
|
2914 | return value0 === value1 ? null
|
2915 | : value0 === value00 ? interpolate0
|
2916 | : interpolate0 = interpolate$$1(value00 = value0, value1);
|
2917 | };
|
2918 | }
|
2919 |
|
2920 | function attrFunction$1(name, interpolate$$1, value) {
|
2921 | var value00,
|
2922 | value10,
|
2923 | interpolate0;
|
2924 | return function() {
|
2925 | var value0, value1 = value(this);
|
2926 | if (value1 == null) return void this.removeAttribute(name);
|
2927 | value0 = this.getAttribute(name);
|
2928 | return value0 === value1 ? null
|
2929 | : value0 === value00 && value1 === value10 ? interpolate0
|
2930 | : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
|
2931 | };
|
2932 | }
|
2933 |
|
2934 | function attrFunctionNS$1(fullname, interpolate$$1, value) {
|
2935 | var value00,
|
2936 | value10,
|
2937 | interpolate0;
|
2938 | return function() {
|
2939 | var value0, value1 = value(this);
|
2940 | if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
|
2941 | value0 = this.getAttributeNS(fullname.space, fullname.local);
|
2942 | return value0 === value1 ? null
|
2943 | : value0 === value00 && value1 === value10 ? interpolate0
|
2944 | : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
|
2945 | };
|
2946 | }
|
2947 |
|
2948 | var transition_attr = function(name, value) {
|
2949 | var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate$$1;
|
2950 | return this.attrTween(name, typeof value === "function"
|
2951 | ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value))
|
2952 | : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)
|
2953 | : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value));
|
2954 | };
|
2955 |
|
2956 | function attrTweenNS(fullname, value) {
|
2957 | function tween() {
|
2958 | var node = this, i = value.apply(node, arguments);
|
2959 | return i && function(t) {
|
2960 | node.setAttributeNS(fullname.space, fullname.local, i(t));
|
2961 | };
|
2962 | }
|
2963 | tween._value = value;
|
2964 | return tween;
|
2965 | }
|
2966 |
|
2967 | function attrTween(name, value) {
|
2968 | function tween() {
|
2969 | var node = this, i = value.apply(node, arguments);
|
2970 | return i && function(t) {
|
2971 | node.setAttribute(name, i(t));
|
2972 | };
|
2973 | }
|
2974 | tween._value = value;
|
2975 | return tween;
|
2976 | }
|
2977 |
|
2978 | var transition_attrTween = function(name, value) {
|
2979 | var key = "attr." + name;
|
2980 | if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
2981 | if (value == null) return this.tween(key, null);
|
2982 | if (typeof value !== "function") throw new Error;
|
2983 | var fullname = namespace(name);
|
2984 | return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
2985 | };
|
2986 |
|
2987 | function delayFunction(id, value) {
|
2988 | return function() {
|
2989 | init(this, id).delay = +value.apply(this, arguments);
|
2990 | };
|
2991 | }
|
2992 |
|
2993 | function delayConstant(id, value) {
|
2994 | return value = +value, function() {
|
2995 | init(this, id).delay = value;
|
2996 | };
|
2997 | }
|
2998 |
|
2999 | var transition_delay = function(value) {
|
3000 | var id = this._id;
|
3001 |
|
3002 | return arguments.length
|
3003 | ? this.each((typeof value === "function"
|
3004 | ? delayFunction
|
3005 | : delayConstant)(id, value))
|
3006 | : get(this.node(), id).delay;
|
3007 | };
|
3008 |
|
3009 | function durationFunction(id, value) {
|
3010 | return function() {
|
3011 | set(this, id).duration = +value.apply(this, arguments);
|
3012 | };
|
3013 | }
|
3014 |
|
3015 | function durationConstant(id, value) {
|
3016 | return value = +value, function() {
|
3017 | set(this, id).duration = value;
|
3018 | };
|
3019 | }
|
3020 |
|
3021 | var transition_duration = function(value) {
|
3022 | var id = this._id;
|
3023 |
|
3024 | return arguments.length
|
3025 | ? this.each((typeof value === "function"
|
3026 | ? durationFunction
|
3027 | : durationConstant)(id, value))
|
3028 | : get(this.node(), id).duration;
|
3029 | };
|
3030 |
|
3031 | function easeConstant(id, value) {
|
3032 | if (typeof value !== "function") throw new Error;
|
3033 | return function() {
|
3034 | set(this, id).ease = value;
|
3035 | };
|
3036 | }
|
3037 |
|
3038 | var transition_ease = function(value) {
|
3039 | var id = this._id;
|
3040 |
|
3041 | return arguments.length
|
3042 | ? this.each(easeConstant(id, value))
|
3043 | : get(this.node(), id).ease;
|
3044 | };
|
3045 |
|
3046 | var transition_filter = function(match) {
|
3047 | if (typeof match !== "function") match = matcher$1(match);
|
3048 |
|
3049 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
3050 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
3051 | if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
3052 | subgroup.push(node);
|
3053 | }
|
3054 | }
|
3055 | }
|
3056 |
|
3057 | return new Transition(subgroups, this._parents, this._name, this._id);
|
3058 | };
|
3059 |
|
3060 | var transition_merge = function(transition) {
|
3061 | if (transition._id !== this._id) throw new Error;
|
3062 |
|
3063 | for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
3064 | for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
3065 | if (node = group0[i] || group1[i]) {
|
3066 | merge[i] = node;
|
3067 | }
|
3068 | }
|
3069 | }
|
3070 |
|
3071 | for (; j < m0; ++j) {
|
3072 | merges[j] = groups0[j];
|
3073 | }
|
3074 |
|
3075 | return new Transition(merges, this._parents, this._name, this._id);
|
3076 | };
|
3077 |
|
3078 | function start(name) {
|
3079 | return (name + "").trim().split(/^|\s+/).every(function(t) {
|
3080 | var i = t.indexOf(".");
|
3081 | if (i >= 0) t = t.slice(0, i);
|
3082 | return !t || t === "start";
|
3083 | });
|
3084 | }
|
3085 |
|
3086 | function onFunction(id, name, listener) {
|
3087 | var on0, on1, sit = start(name) ? init : set;
|
3088 | return function() {
|
3089 | var schedule = sit(this, id),
|
3090 | on = schedule.on;
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 | if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
3096 |
|
3097 | schedule.on = on1;
|
3098 | };
|
3099 | }
|
3100 |
|
3101 | var transition_on = function(name, listener) {
|
3102 | var id = this._id;
|
3103 |
|
3104 | return arguments.length < 2
|
3105 | ? get(this.node(), id).on.on(name)
|
3106 | : this.each(onFunction(id, name, listener));
|
3107 | };
|
3108 |
|
3109 | function removeFunction(id) {
|
3110 | return function() {
|
3111 | var parent = this.parentNode;
|
3112 | for (var i in this.__transition) if (+i !== id) return;
|
3113 | if (parent) parent.removeChild(this);
|
3114 | };
|
3115 | }
|
3116 |
|
3117 | var transition_remove = function() {
|
3118 | return this.on("end.remove", removeFunction(this._id));
|
3119 | };
|
3120 |
|
3121 | var transition_select = function(select$$1) {
|
3122 | var name = this._name,
|
3123 | id = this._id;
|
3124 |
|
3125 | if (typeof select$$1 !== "function") select$$1 = selector(select$$1);
|
3126 |
|
3127 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
3128 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
3129 | if ((node = group[i]) && (subnode = select$$1.call(node, node.__data__, i, group))) {
|
3130 | if ("__data__" in node) subnode.__data__ = node.__data__;
|
3131 | subgroup[i] = subnode;
|
3132 | schedule(subgroup[i], name, id, i, subgroup, get(node, id));
|
3133 | }
|
3134 | }
|
3135 | }
|
3136 |
|
3137 | return new Transition(subgroups, this._parents, name, id);
|
3138 | };
|
3139 |
|
3140 | var transition_selectAll = function(select$$1) {
|
3141 | var name = this._name,
|
3142 | id = this._id;
|
3143 |
|
3144 | if (typeof select$$1 !== "function") select$$1 = selectorAll(select$$1);
|
3145 |
|
3146 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
3147 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
3148 | if (node = group[i]) {
|
3149 | for (var children = select$$1.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
|
3150 | if (child = children[k]) {
|
3151 | schedule(child, name, id, k, children, inherit);
|
3152 | }
|
3153 | }
|
3154 | subgroups.push(children);
|
3155 | parents.push(node);
|
3156 | }
|
3157 | }
|
3158 | }
|
3159 |
|
3160 | return new Transition(subgroups, parents, name, id);
|
3161 | };
|
3162 |
|
3163 | var Selection$1 = selection.prototype.constructor;
|
3164 |
|
3165 | var transition_selection = function() {
|
3166 | return new Selection$1(this._groups, this._parents);
|
3167 | };
|
3168 |
|
3169 | function styleRemove$1(name, interpolate$$2) {
|
3170 | var value00,
|
3171 | value10,
|
3172 | interpolate0;
|
3173 | return function() {
|
3174 | var style = window(this).getComputedStyle(this, null),
|
3175 | value0 = style.getPropertyValue(name),
|
3176 | value1 = (this.style.removeProperty(name), style.getPropertyValue(name));
|
3177 | return value0 === value1 ? null
|
3178 | : value0 === value00 && value1 === value10 ? interpolate0
|
3179 | : interpolate0 = interpolate$$2(value00 = value0, value10 = value1);
|
3180 | };
|
3181 | }
|
3182 |
|
3183 | function styleRemoveEnd(name) {
|
3184 | return function() {
|
3185 | this.style.removeProperty(name);
|
3186 | };
|
3187 | }
|
3188 |
|
3189 | function styleConstant$1(name, interpolate$$2, value1) {
|
3190 | var value00,
|
3191 | interpolate0;
|
3192 | return function() {
|
3193 | var value0 = window(this).getComputedStyle(this, null).getPropertyValue(name);
|
3194 | return value0 === value1 ? null
|
3195 | : value0 === value00 ? interpolate0
|
3196 | : interpolate0 = interpolate$$2(value00 = value0, value1);
|
3197 | };
|
3198 | }
|
3199 |
|
3200 | function styleFunction$1(name, interpolate$$2, value) {
|
3201 | var value00,
|
3202 | value10,
|
3203 | interpolate0;
|
3204 | return function() {
|
3205 | var style = window(this).getComputedStyle(this, null),
|
3206 | value0 = style.getPropertyValue(name),
|
3207 | value1 = value(this);
|
3208 | if (value1 == null) value1 = (this.style.removeProperty(name), style.getPropertyValue(name));
|
3209 | return value0 === value1 ? null
|
3210 | : value0 === value00 && value1 === value10 ? interpolate0
|
3211 | : interpolate0 = interpolate$$2(value00 = value0, value10 = value1);
|
3212 | };
|
3213 | }
|
3214 |
|
3215 | var transition_style = function(name, value, priority) {
|
3216 | var i = (name += "") === "transform" ? interpolateTransformCss : interpolate$$1;
|
3217 | return value == null ? this
|
3218 | .styleTween(name, styleRemove$1(name, i))
|
3219 | .on("end.style." + name, styleRemoveEnd(name))
|
3220 | : this.styleTween(name, typeof value === "function"
|
3221 | ? styleFunction$1(name, i, tweenValue(this, "style." + name, value))
|
3222 | : styleConstant$1(name, i, value), priority);
|
3223 | };
|
3224 |
|
3225 | function styleTween(name, value, priority) {
|
3226 | function tween() {
|
3227 | var node = this, i = value.apply(node, arguments);
|
3228 | return i && function(t) {
|
3229 | node.style.setProperty(name, i(t), priority);
|
3230 | };
|
3231 | }
|
3232 | tween._value = value;
|
3233 | return tween;
|
3234 | }
|
3235 |
|
3236 | var transition_styleTween = function(name, value, priority) {
|
3237 | var key = "style." + (name += "");
|
3238 | if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
3239 | if (value == null) return this.tween(key, null);
|
3240 | if (typeof value !== "function") throw new Error;
|
3241 | return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
3242 | };
|
3243 |
|
3244 | function textConstant$1(value) {
|
3245 | return function() {
|
3246 | this.textContent = value;
|
3247 | };
|
3248 | }
|
3249 |
|
3250 | function textFunction$1(value) {
|
3251 | return function() {
|
3252 | var value1 = value(this);
|
3253 | this.textContent = value1 == null ? "" : value1;
|
3254 | };
|
3255 | }
|
3256 |
|
3257 | var transition_text = function(value) {
|
3258 | return this.tween("text", typeof value === "function"
|
3259 | ? textFunction$1(tweenValue(this, "text", value))
|
3260 | : textConstant$1(value == null ? "" : value + ""));
|
3261 | };
|
3262 |
|
3263 | var transition_transition = function() {
|
3264 | var name = this._name,
|
3265 | id0 = this._id,
|
3266 | id1 = newId();
|
3267 |
|
3268 | for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
3269 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
3270 | if (node = group[i]) {
|
3271 | var inherit = get(node, id0);
|
3272 | schedule(node, name, id1, i, group, {
|
3273 | time: inherit.time + inherit.delay + inherit.duration,
|
3274 | delay: 0,
|
3275 | duration: inherit.duration,
|
3276 | ease: inherit.ease
|
3277 | });
|
3278 | }
|
3279 | }
|
3280 | }
|
3281 |
|
3282 | return new Transition(groups, this._parents, name, id1);
|
3283 | };
|
3284 |
|
3285 | var id = 0;
|
3286 |
|
3287 | function Transition(groups, parents, name, id) {
|
3288 | this._groups = groups;
|
3289 | this._parents = parents;
|
3290 | this._name = name;
|
3291 | this._id = id;
|
3292 | }
|
3293 |
|
3294 | function transition(name) {
|
3295 | return selection().transition(name);
|
3296 | }
|
3297 |
|
3298 | function newId() {
|
3299 | return ++id;
|
3300 | }
|
3301 |
|
3302 | var selection_prototype = selection.prototype;
|
3303 |
|
3304 | Transition.prototype = transition.prototype = {
|
3305 | constructor: Transition,
|
3306 | select: transition_select,
|
3307 | selectAll: transition_selectAll,
|
3308 | filter: transition_filter,
|
3309 | merge: transition_merge,
|
3310 | selection: transition_selection,
|
3311 | transition: transition_transition,
|
3312 | call: selection_prototype.call,
|
3313 | nodes: selection_prototype.nodes,
|
3314 | node: selection_prototype.node,
|
3315 | size: selection_prototype.size,
|
3316 | empty: selection_prototype.empty,
|
3317 | each: selection_prototype.each,
|
3318 | on: transition_on,
|
3319 | attr: transition_attr,
|
3320 | attrTween: transition_attrTween,
|
3321 | style: transition_style,
|
3322 | styleTween: transition_styleTween,
|
3323 | text: transition_text,
|
3324 | remove: transition_remove,
|
3325 | tween: transition_tween,
|
3326 | delay: transition_delay,
|
3327 | duration: transition_duration,
|
3328 | ease: transition_ease
|
3329 | };
|
3330 |
|
3331 | function cubicInOut(t) {
|
3332 | return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
3333 | }
|
3334 |
|
3335 | var exponent = 3;
|
3336 |
|
3337 | var polyIn = (function custom(e) {
|
3338 | e = +e;
|
3339 |
|
3340 | function polyIn(t) {
|
3341 | return Math.pow(t, e);
|
3342 | }
|
3343 |
|
3344 | polyIn.exponent = custom;
|
3345 |
|
3346 | return polyIn;
|
3347 | })(exponent);
|
3348 |
|
3349 | var polyOut = (function custom(e) {
|
3350 | e = +e;
|
3351 |
|
3352 | function polyOut(t) {
|
3353 | return 1 - Math.pow(1 - t, e);
|
3354 | }
|
3355 |
|
3356 | polyOut.exponent = custom;
|
3357 |
|
3358 | return polyOut;
|
3359 | })(exponent);
|
3360 |
|
3361 | var polyInOut = (function custom(e) {
|
3362 | e = +e;
|
3363 |
|
3364 | function polyInOut(t) {
|
3365 | return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
|
3366 | }
|
3367 |
|
3368 | polyInOut.exponent = custom;
|
3369 |
|
3370 | return polyInOut;
|
3371 | })(exponent);
|
3372 |
|
3373 | var overshoot = 1.70158;
|
3374 |
|
3375 | var backIn = (function custom(s) {
|
3376 | s = +s;
|
3377 |
|
3378 | function backIn(t) {
|
3379 | return t * t * ((s + 1) * t - s);
|
3380 | }
|
3381 |
|
3382 | backIn.overshoot = custom;
|
3383 |
|
3384 | return backIn;
|
3385 | })(overshoot);
|
3386 |
|
3387 | var backOut = (function custom(s) {
|
3388 | s = +s;
|
3389 |
|
3390 | function backOut(t) {
|
3391 | return --t * t * ((s + 1) * t + s) + 1;
|
3392 | }
|
3393 |
|
3394 | backOut.overshoot = custom;
|
3395 |
|
3396 | return backOut;
|
3397 | })(overshoot);
|
3398 |
|
3399 | var backInOut = (function custom(s) {
|
3400 | s = +s;
|
3401 |
|
3402 | function backInOut(t) {
|
3403 | return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
|
3404 | }
|
3405 |
|
3406 | backInOut.overshoot = custom;
|
3407 |
|
3408 | return backInOut;
|
3409 | })(overshoot);
|
3410 |
|
3411 | var tau = 2 * Math.PI;
|
3412 | var amplitude = 1;
|
3413 | var period = 0.3;
|
3414 |
|
3415 | var elasticIn = (function custom(a, p) {
|
3416 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
3417 |
|
3418 | function elasticIn(t) {
|
3419 | return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
|
3420 | }
|
3421 |
|
3422 | elasticIn.amplitude = function(a) { return custom(a, p * tau); };
|
3423 | elasticIn.period = function(p) { return custom(a, p); };
|
3424 |
|
3425 | return elasticIn;
|
3426 | })(amplitude, period);
|
3427 |
|
3428 | var elasticOut = (function custom(a, p) {
|
3429 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
3430 |
|
3431 | function elasticOut(t) {
|
3432 | return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
|
3433 | }
|
3434 |
|
3435 | elasticOut.amplitude = function(a) { return custom(a, p * tau); };
|
3436 | elasticOut.period = function(p) { return custom(a, p); };
|
3437 |
|
3438 | return elasticOut;
|
3439 | })(amplitude, period);
|
3440 |
|
3441 | var elasticInOut = (function custom(a, p) {
|
3442 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
3443 |
|
3444 | function elasticInOut(t) {
|
3445 | return ((t = t * 2 - 1) < 0
|
3446 | ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)
|
3447 | : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
|
3448 | }
|
3449 |
|
3450 | elasticInOut.amplitude = function(a) { return custom(a, p * tau); };
|
3451 | elasticInOut.period = function(p) { return custom(a, p); };
|
3452 |
|
3453 | return elasticInOut;
|
3454 | })(amplitude, period);
|
3455 |
|
3456 | var defaultTiming = {
|
3457 | time: null,
|
3458 | delay: 0,
|
3459 | duration: 250,
|
3460 | ease: cubicInOut
|
3461 | };
|
3462 |
|
3463 | function inherit(node, id) {
|
3464 | var timing;
|
3465 | while (!(timing = node.__transition) || !(timing = timing[id])) {
|
3466 | if (!(node = node.parentNode)) {
|
3467 | return defaultTiming.time = now(), defaultTiming;
|
3468 | }
|
3469 | }
|
3470 | return timing;
|
3471 | }
|
3472 |
|
3473 | var selection_transition = function(name) {
|
3474 | var id,
|
3475 | timing;
|
3476 |
|
3477 | if (name instanceof Transition) {
|
3478 | id = name._id, name = name._name;
|
3479 | } else {
|
3480 | id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
3481 | }
|
3482 |
|
3483 | for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
3484 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
3485 | if (node = group[i]) {
|
3486 | schedule(node, name, id, i, group, timing || inherit(node, id));
|
3487 | }
|
3488 | }
|
3489 | }
|
3490 |
|
3491 | return new Transition(groups, this._parents, name, id);
|
3492 | };
|
3493 |
|
3494 | selection.prototype.interrupt = selection_interrupt;
|
3495 | selection.prototype.transition = selection_transition;
|
3496 |
|
3497 | var root$1 = [null];
|
3498 |
|
3499 | var active = function(node, name) {
|
3500 | var schedules = node.__transition,
|
3501 | schedule,
|
3502 | i;
|
3503 |
|
3504 | if (schedules) {
|
3505 | name = name == null ? null : name + "";
|
3506 | for (i in schedules) {
|
3507 | if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
|
3508 | return new Transition([[node]], root$1, name, +i);
|
3509 | }
|
3510 | }
|
3511 | }
|
3512 |
|
3513 | return null;
|
3514 | };
|
3515 |
|
3516 | var prefix = "$";
|
3517 |
|
3518 | function Map() {}
|
3519 |
|
3520 | Map.prototype = map$1.prototype = {
|
3521 | constructor: Map,
|
3522 | has: function(key) {
|
3523 | return (prefix + key) in this;
|
3524 | },
|
3525 | get: function(key) {
|
3526 | return this[prefix + key];
|
3527 | },
|
3528 | set: function(key, value) {
|
3529 | this[prefix + key] = value;
|
3530 | return this;
|
3531 | },
|
3532 | remove: function(key) {
|
3533 | var property = prefix + key;
|
3534 | return property in this && delete this[property];
|
3535 | },
|
3536 | clear: function() {
|
3537 | for (var property in this) if (property[0] === prefix) delete this[property];
|
3538 | },
|
3539 | keys: function() {
|
3540 | var keys = [];
|
3541 | for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));
|
3542 | return keys;
|
3543 | },
|
3544 | values: function() {
|
3545 | var values = [];
|
3546 | for (var property in this) if (property[0] === prefix) values.push(this[property]);
|
3547 | return values;
|
3548 | },
|
3549 | entries: function() {
|
3550 | var entries = [];
|
3551 | for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});
|
3552 | return entries;
|
3553 | },
|
3554 | size: function() {
|
3555 | var size = 0;
|
3556 | for (var property in this) if (property[0] === prefix) ++size;
|
3557 | return size;
|
3558 | },
|
3559 | empty: function() {
|
3560 | for (var property in this) if (property[0] === prefix) return false;
|
3561 | return true;
|
3562 | },
|
3563 | each: function(f) {
|
3564 | for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);
|
3565 | }
|
3566 | };
|
3567 |
|
3568 | function map$1(object, f) {
|
3569 | var map = new Map;
|
3570 |
|
3571 |
|
3572 | if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });
|
3573 |
|
3574 |
|
3575 | else if (Array.isArray(object)) {
|
3576 | var i = -1,
|
3577 | n = object.length,
|
3578 | o;
|
3579 |
|
3580 | if (f == null) while (++i < n) map.set(i, object[i]);
|
3581 | else while (++i < n) map.set(f(o = object[i], i, object), o);
|
3582 | }
|
3583 |
|
3584 |
|
3585 | else if (object) for (var key in object) map.set(key, object[key]);
|
3586 |
|
3587 | return map;
|
3588 | }
|
3589 |
|
3590 | function Set() {}
|
3591 |
|
3592 | var proto = map$1.prototype;
|
3593 |
|
3594 | Set.prototype = set$2.prototype = {
|
3595 | constructor: Set,
|
3596 | has: proto.has,
|
3597 | add: function(value) {
|
3598 | value += "";
|
3599 | this[prefix + value] = value;
|
3600 | return this;
|
3601 | },
|
3602 | remove: proto.remove,
|
3603 | clear: proto.clear,
|
3604 | values: proto.keys,
|
3605 | size: proto.size,
|
3606 | empty: proto.empty,
|
3607 | each: proto.each
|
3608 | };
|
3609 |
|
3610 | function set$2(object, f) {
|
3611 | var set = new Set;
|
3612 |
|
3613 | // Copy constructor.
|
3614 | if (object instanceof Set) object.each(function(value) { set.add(value); });
|
3615 |
|
3616 | // Otherwise, assume it’s an array.
|
3617 | else if (object) {
|
3618 | var i = -1, n = object.length;
|
3619 | if (f == null) while (++i < n) set.add(object[i]);
|
3620 | else while (++i < n) set.add(f(object[i], i, object));
|
3621 | }
|
3622 |
|
3623 | return set;
|
3624 | }
|
3625 |
|
3626 | var array$2 = Array.prototype;
|
3627 |
|
3628 | var map$3 = array$2.map;
|
3629 | var slice$2 = array$2.slice;
|
3630 |
|
3631 | var implicit = {name: "implicit"};
|
3632 |
|
3633 | function ordinal(range) {
|
3634 | var index = map$1(),
|
3635 | domain = [],
|
3636 | unknown = implicit;
|
3637 |
|
3638 | range = range == null ? [] : slice$2.call(range);
|
3639 |
|
3640 | function scale(d) {
|
3641 | var key = d + "", i = index.get(key);
|
3642 | if (!i) {
|
3643 | if (unknown !== implicit) return unknown;
|
3644 | index.set(key, i = domain.push(d));
|
3645 | }
|
3646 | return range[(i - 1) % range.length];
|
3647 | }
|
3648 |
|
3649 | scale.domain = function(_) {
|
3650 | if (!arguments.length) return domain.slice();
|
3651 | domain = [], index = map$1();
|
3652 | var i = -1, n = _.length, d, key;
|
3653 | while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
|
3654 | return scale;
|
3655 | };
|
3656 |
|
3657 | scale.range = function(_) {
|
3658 | return arguments.length ? (range = slice$2.call(_), scale) : range.slice();
|
3659 | };
|
3660 |
|
3661 | scale.unknown = function(_) {
|
3662 | return arguments.length ? (unknown = _, scale) : unknown;
|
3663 | };
|
3664 |
|
3665 | scale.copy = function() {
|
3666 | return ordinal()
|
3667 | .domain(domain)
|
3668 | .range(range)
|
3669 | .unknown(unknown);
|
3670 | };
|
3671 |
|
3672 | return scale;
|
3673 | }
|
3674 |
|
3675 | function band() {
|
3676 | var scale = ordinal().unknown(undefined),
|
3677 | domain = scale.domain,
|
3678 | ordinalRange = scale.range,
|
3679 | range$$1 = [0, 1],
|
3680 | step,
|
3681 | bandwidth,
|
3682 | round = false,
|
3683 | paddingInner = 0,
|
3684 | paddingOuter = 0,
|
3685 | align = 0.5;
|
3686 |
|
3687 | delete scale.unknown;
|
3688 |
|
3689 | function rescale() {
|
3690 | var n = domain().length,
|
3691 | reverse = range$$1[1] < range$$1[0],
|
3692 | start = range$$1[reverse - 0],
|
3693 | stop = range$$1[1 - reverse];
|
3694 | step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
3695 | if (round) step = Math.floor(step);
|
3696 | start += (stop - start - step * (n - paddingInner)) * align;
|
3697 | bandwidth = step * (1 - paddingInner);
|
3698 | if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
|
3699 | var values = sequence(n).map(function(i) { return start + step * i; });
|
3700 | return ordinalRange(reverse ? values.reverse() : values);
|
3701 | }
|
3702 |
|
3703 | scale.domain = function(_) {
|
3704 | return arguments.length ? (domain(_), rescale()) : domain();
|
3705 | };
|
3706 |
|
3707 | scale.range = function(_) {
|
3708 | return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice();
|
3709 | };
|
3710 |
|
3711 | scale.rangeRound = function(_) {
|
3712 | return range$$1 = [+_[0], +_[1]], round = true, rescale();
|
3713 | };
|
3714 |
|
3715 | scale.bandwidth = function() {
|
3716 | return bandwidth;
|
3717 | };
|
3718 |
|
3719 | scale.step = function() {
|
3720 | return step;
|
3721 | };
|
3722 |
|
3723 | scale.round = function(_) {
|
3724 | return arguments.length ? (round = !!_, rescale()) : round;
|
3725 | };
|
3726 |
|
3727 | scale.padding = function(_) {
|
3728 | return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
|
3729 | };
|
3730 |
|
3731 | scale.paddingInner = function(_) {
|
3732 | return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
|
3733 | };
|
3734 |
|
3735 | scale.paddingOuter = function(_) {
|
3736 | return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;
|
3737 | };
|
3738 |
|
3739 | scale.align = function(_) {
|
3740 | return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
3741 | };
|
3742 |
|
3743 | scale.copy = function() {
|
3744 | return band()
|
3745 | .domain(domain())
|
3746 | .range(range$$1)
|
3747 | .round(round)
|
3748 | .paddingInner(paddingInner)
|
3749 | .paddingOuter(paddingOuter)
|
3750 | .align(align);
|
3751 | };
|
3752 |
|
3753 | return rescale();
|
3754 | }
|
3755 |
|
3756 | function pointish(scale) {
|
3757 | var copy = scale.copy;
|
3758 |
|
3759 | scale.padding = scale.paddingOuter;
|
3760 | delete scale.paddingInner;
|
3761 | delete scale.paddingOuter;
|
3762 |
|
3763 | scale.copy = function() {
|
3764 | return pointish(copy());
|
3765 | };
|
3766 |
|
3767 | return scale;
|
3768 | }
|
3769 |
|
3770 | function point$1() {
|
3771 | return pointish(band().paddingInner(1));
|
3772 | }
|
3773 |
|
3774 | var constant$3 = function(x) {
|
3775 | return function() {
|
3776 | return x;
|
3777 | };
|
3778 | };
|
3779 |
|
3780 | var number$1 = function(x) {
|
3781 | return +x;
|
3782 | };
|
3783 |
|
3784 | var unit = [0, 1];
|
3785 |
|
3786 | function deinterpolateLinear(a, b) {
|
3787 | return (b -= (a = +a))
|
3788 | ? function(x) { return (x - a) / b; }
|
3789 | : constant$3(b);
|
3790 | }
|
3791 |
|
3792 | function deinterpolateClamp(deinterpolate) {
|
3793 | return function(a, b) {
|
3794 | var d = deinterpolate(a = +a, b = +b);
|
3795 | return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };
|
3796 | };
|
3797 | }
|
3798 |
|
3799 | function reinterpolateClamp(reinterpolate) {
|
3800 | return function(a, b) {
|
3801 | var r = reinterpolate(a = +a, b = +b);
|
3802 | return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };
|
3803 | };
|
3804 | }
|
3805 |
|
3806 | function bimap(domain, range$$1, deinterpolate, reinterpolate) {
|
3807 | var d0 = domain[0], d1 = domain[1], r0 = range$$1[0], r1 = range$$1[1];
|
3808 | if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);
|
3809 | else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);
|
3810 | return function(x) { return r0(d0(x)); };
|
3811 | }
|
3812 |
|
3813 | function polymap(domain, range$$1, deinterpolate, reinterpolate) {
|
3814 | var j = Math.min(domain.length, range$$1.length) - 1,
|
3815 | d = new Array(j),
|
3816 | r = new Array(j),
|
3817 | i = -1;
|
3818 |
|
3819 |
|
3820 | if (domain[j] < domain[0]) {
|
3821 | domain = domain.slice().reverse();
|
3822 | range$$1 = range$$1.slice().reverse();
|
3823 | }
|
3824 |
|
3825 | while (++i < j) {
|
3826 | d[i] = deinterpolate(domain[i], domain[i + 1]);
|
3827 | r[i] = reinterpolate(range$$1[i], range$$1[i + 1]);
|
3828 | }
|
3829 |
|
3830 | return function(x) {
|
3831 | var i = bisectRight(domain, x, 1, j) - 1;
|
3832 | return r[i](d[i](x));
|
3833 | };
|
3834 | }
|
3835 |
|
3836 | function copy(source, target) {
|
3837 | return target
|
3838 | .domain(source.domain())
|
3839 | .range(source.range())
|
3840 | .interpolate(source.interpolate())
|
3841 | .clamp(source.clamp());
|
3842 | }
|
3843 |
|
3844 |
|
3845 |
|
3846 | function continuous(deinterpolate, reinterpolate) {
|
3847 | var domain = unit,
|
3848 | range$$1 = unit,
|
3849 | interpolate$$1 = interpolateValue,
|
3850 | clamp = false,
|
3851 | piecewise,
|
3852 | output,
|
3853 | input;
|
3854 |
|
3855 | function rescale() {
|
3856 | piecewise = Math.min(domain.length, range$$1.length) > 2 ? polymap : bimap;
|
3857 | output = input = null;
|
3858 | return scale;
|
3859 | }
|
3860 |
|
3861 | function scale(x) {
|
3862 | return (output || (output = piecewise(domain, range$$1, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);
|
3863 | }
|
3864 |
|
3865 | scale.invert = function(y) {
|
3866 | return (input || (input = piecewise(range$$1, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
|
3867 | };
|
3868 |
|
3869 | scale.domain = function(_) {
|
3870 | return arguments.length ? (domain = map$3.call(_, number$1), rescale()) : domain.slice();
|
3871 | };
|
3872 |
|
3873 | scale.range = function(_) {
|
3874 | return arguments.length ? (range$$1 = slice$2.call(_), rescale()) : range$$1.slice();
|
3875 | };
|
3876 |
|
3877 | scale.rangeRound = function(_) {
|
3878 | return range$$1 = slice$2.call(_), interpolate$$1 = interpolateRound, rescale();
|
3879 | };
|
3880 |
|
3881 | scale.clamp = function(_) {
|
3882 | return arguments.length ? (clamp = !!_, rescale()) : clamp;
|
3883 | };
|
3884 |
|
3885 | scale.interpolate = function(_) {
|
3886 | return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1;
|
3887 | };
|
3888 |
|
3889 | return rescale();
|
3890 | }
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 | var formatDecimal = function(x, p) {
|
3896 | if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null;
|
3897 | var i, coefficient = x.slice(0, i);
|
3898 |
|
3899 |
|
3900 |
|
3901 | return [
|
3902 | coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
3903 | +x.slice(i + 1)
|
3904 | ];
|
3905 | };
|
3906 |
|
3907 | var exponent$1 = function(x) {
|
3908 | return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
|
3909 | };
|
3910 |
|
3911 | var formatGroup = function(grouping, thousands) {
|
3912 | return function(value, width) {
|
3913 | var i = value.length,
|
3914 | t = [],
|
3915 | j = 0,
|
3916 | g = grouping[0],
|
3917 | length = 0;
|
3918 |
|
3919 | while (i > 0 && g > 0) {
|
3920 | if (length + g + 1 > width) g = Math.max(1, width - length);
|
3921 | t.push(value.substring(i -= g, i + g));
|
3922 | if ((length += g + 1) > width) break;
|
3923 | g = grouping[j = (j + 1) % grouping.length];
|
3924 | }
|
3925 |
|
3926 | return t.reverse().join(thousands);
|
3927 | };
|
3928 | };
|
3929 |
|
3930 | var formatDefault = function(x, p) {
|
3931 | x = x.toPrecision(p);
|
3932 |
|
3933 | out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
3934 | switch (x[i]) {
|
3935 | case ".": i0 = i1 = i; break;
|
3936 | case "0": if (i0 === 0) i0 = i; i1 = i; break;
|
3937 | case "e": break out;
|
3938 | default: if (i0 > 0) i0 = 0; break;
|
3939 | }
|
3940 | }
|
3941 |
|
3942 | return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
|
3943 | };
|
3944 |
|
3945 | var prefixExponent;
|
3946 |
|
3947 | var formatPrefixAuto = function(x, p) {
|
3948 | var d = formatDecimal(x, p);
|
3949 | if (!d) return x + "";
|
3950 | var coefficient = d[0],
|
3951 | exponent = d[1],
|
3952 | i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
|
3953 | n = coefficient.length;
|
3954 | return i === n ? coefficient
|
3955 | : i > n ? coefficient + new Array(i - n + 1).join("0")
|
3956 | : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
|
3957 | : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0];
|
3958 | };
|
3959 |
|
3960 | var formatRounded = function(x, p) {
|
3961 | var d = formatDecimal(x, p);
|
3962 | if (!d) return x + "";
|
3963 | var coefficient = d[0],
|
3964 | exponent = d[1];
|
3965 | return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
|
3966 | : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
|
3967 | : coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
3968 | };
|
3969 |
|
3970 | var formatTypes = {
|
3971 | "": formatDefault,
|
3972 | "%": function(x, p) { return (x * 100).toFixed(p); },
|
3973 | "b": function(x) { return Math.round(x).toString(2); },
|
3974 | "c": function(x) { return x + ""; },
|
3975 | "d": function(x) { return Math.round(x).toString(10); },
|
3976 | "e": function(x, p) { return x.toExponential(p); },
|
3977 | "f": function(x, p) { return x.toFixed(p); },
|
3978 | "g": function(x, p) { return x.toPrecision(p); },
|
3979 | "o": function(x) { return Math.round(x).toString(8); },
|
3980 | "p": function(x, p) { return formatRounded(x * 100, p); },
|
3981 | "r": formatRounded,
|
3982 | "s": formatPrefixAuto,
|
3983 | "X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
|
3984 | "x": function(x) { return Math.round(x).toString(16); }
|
3985 | };
|
3986 |
|
3987 |
|
3988 | var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;
|
3989 |
|
3990 | var formatSpecifier = function(specifier) {
|
3991 | return new FormatSpecifier(specifier);
|
3992 | };
|
3993 |
|
3994 | function FormatSpecifier(specifier) {
|
3995 | if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
3996 |
|
3997 | var match,
|
3998 | fill = match[1] || " ",
|
3999 | align = match[2] || ">",
|
4000 | sign = match[3] || "-",
|
4001 | symbol = match[4] || "",
|
4002 | zero = !!match[5],
|
4003 | width = match[6] && +match[6],
|
4004 | comma = !!match[7],
|
4005 | precision = match[8] && +match[8].slice(1),
|
4006 | type = match[9] || "";
|
4007 |
|
4008 |
|
4009 | if (type === "n") comma = true, type = "g";
|
4010 |
|
4011 |
|
4012 | else if (!formatTypes[type]) type = "";
|
4013 |
|
4014 |
|
4015 | if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
|
4016 |
|
4017 | this.fill = fill;
|
4018 | this.align = align;
|
4019 | this.sign = sign;
|
4020 | this.symbol = symbol;
|
4021 | this.zero = zero;
|
4022 | this.width = width;
|
4023 | this.comma = comma;
|
4024 | this.precision = precision;
|
4025 | this.type = type;
|
4026 | }
|
4027 |
|
4028 | FormatSpecifier.prototype.toString = function() {
|
4029 | return this.fill
|
4030 | + this.align
|
4031 | + this.sign
|
4032 | + this.symbol
|
4033 | + (this.zero ? "0" : "")
|
4034 | + (this.width == null ? "" : Math.max(1, this.width | 0))
|
4035 | + (this.comma ? "," : "")
|
4036 | + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
|
4037 | + this.type;
|
4038 | };
|
4039 |
|
4040 | var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
4041 |
|
4042 | function identity$4(x) {
|
4043 | return x;
|
4044 | }
|
4045 |
|
4046 | var formatLocale = function(locale) {
|
4047 | var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$4,
|
4048 | currency = locale.currency,
|
4049 | decimal = locale.decimal;
|
4050 |
|
4051 | function newFormat(specifier) {
|
4052 | specifier = formatSpecifier(specifier);
|
4053 |
|
4054 | var fill = specifier.fill,
|
4055 | align = specifier.align,
|
4056 | sign = specifier.sign,
|
4057 | symbol = specifier.symbol,
|
4058 | zero = specifier.zero,
|
4059 | width = specifier.width,
|
4060 | comma = specifier.comma,
|
4061 | precision = specifier.precision,
|
4062 | type = specifier.type;
|
4063 |
|
4064 |
|
4065 |
|
4066 | var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
|
4067 | suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? "%" : "";
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 | var formatType = formatTypes[type],
|
4073 | maybeSuffix = !type || /[defgprs%]/.test(type);
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 | precision = precision == null ? (type ? 6 : 12)
|
4080 | : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
|
4081 | : Math.max(0, Math.min(20, precision));
|
4082 |
|
4083 | function format(value) {
|
4084 | var valuePrefix = prefix,
|
4085 | valueSuffix = suffix,
|
4086 | i, n, c;
|
4087 |
|
4088 | if (type === "c") {
|
4089 | valueSuffix = formatType(value) + valueSuffix;
|
4090 | value = "";
|
4091 | } else {
|
4092 | value = +value;
|
4093 |
|
4094 |
|
4095 |
|
4096 | var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);
|
4097 |
|
4098 |
|
4099 | value = formatType(value, precision);
|
4100 |
|
4101 |
|
4102 |
|
4103 | if (valueNegative) {
|
4104 | i = -1, n = value.length;
|
4105 | valueNegative = false;
|
4106 | while (++i < n) {
|
4107 | if (c = value.charCodeAt(i), (48 < c && c < 58)
|
4108 | || (type === "x" && 96 < c && c < 103)
|
4109 | || (type === "X" && 64 < c && c < 71)) {
|
4110 | valueNegative = true;
|
4111 | break;
|
4112 | }
|
4113 | }
|
4114 | }
|
4115 |
|
4116 |
|
4117 | valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
4118 | valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : "");
|
4119 |
|
4120 |
|
4121 |
|
4122 | if (maybeSuffix) {
|
4123 | i = -1, n = value.length;
|
4124 | while (++i < n) {
|
4125 | if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
4126 | valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
4127 | value = value.slice(0, i);
|
4128 | break;
|
4129 | }
|
4130 | }
|
4131 | }
|
4132 | }
|
4133 |
|
4134 |
|
4135 | if (comma && !zero) value = group(value, Infinity);
|
4136 |
|
4137 |
|
4138 | var length = valuePrefix.length + value.length + valueSuffix.length,
|
4139 | padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
4140 |
|
4141 |
|
4142 | if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
4143 |
|
4144 |
|
4145 | switch (align) {
|
4146 | case "<": return valuePrefix + value + valueSuffix + padding;
|
4147 | case "=": return valuePrefix + padding + value + valueSuffix;
|
4148 | case "^": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
|
4149 | }
|
4150 | return padding + valuePrefix + value + valueSuffix;
|
4151 | }
|
4152 |
|
4153 | format.toString = function() {
|
4154 | return specifier + "";
|
4155 | };
|
4156 |
|
4157 | return format;
|
4158 | }
|
4159 |
|
4160 | function formatPrefix(specifier, value) {
|
4161 | var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
|
4162 | e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3,
|
4163 | k = Math.pow(10, -e),
|
4164 | prefix = prefixes[8 + e / 3];
|
4165 | return function(value) {
|
4166 | return f(k * value) + prefix;
|
4167 | };
|
4168 | }
|
4169 |
|
4170 | return {
|
4171 | format: newFormat,
|
4172 | formatPrefix: formatPrefix
|
4173 | };
|
4174 | };
|
4175 |
|
4176 | var locale$1;
|
4177 | var format;
|
4178 | var formatPrefix;
|
4179 |
|
4180 | defaultLocale({
|
4181 | decimal: ".",
|
4182 | thousands: ",",
|
4183 | grouping: [3],
|
4184 | currency: ["$", ""]
|
4185 | });
|
4186 |
|
4187 | function defaultLocale(definition) {
|
4188 | locale$1 = formatLocale(definition);
|
4189 | format = locale$1.format;
|
4190 | formatPrefix = locale$1.formatPrefix;
|
4191 | return locale$1;
|
4192 | }
|
4193 |
|
4194 | var precisionFixed = function(step) {
|
4195 | return Math.max(0, -exponent$1(Math.abs(step)));
|
4196 | };
|
4197 |
|
4198 | var precisionPrefix = function(step, value) {
|
4199 | return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step)));
|
4200 | };
|
4201 |
|
4202 | var precisionRound = function(step, max) {
|
4203 | step = Math.abs(step), max = Math.abs(max) - step;
|
4204 | return Math.max(0, exponent$1(max) - exponent$1(step)) + 1;
|
4205 | };
|
4206 |
|
4207 | var tickFormat = function(domain, count, specifier) {
|
4208 | var start = domain[0],
|
4209 | stop = domain[domain.length - 1],
|
4210 | step = tickStep(start, stop, count == null ? 10 : count),
|
4211 | precision;
|
4212 | specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
4213 | switch (specifier.type) {
|
4214 | case "s": {
|
4215 | var value = Math.max(Math.abs(start), Math.abs(stop));
|
4216 | if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
|
4217 | return formatPrefix(specifier, value);
|
4218 | }
|
4219 | case "":
|
4220 | case "e":
|
4221 | case "g":
|
4222 | case "p":
|
4223 | case "r": {
|
4224 | if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
4225 | break;
|
4226 | }
|
4227 | case "f":
|
4228 | case "%": {
|
4229 | if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
4230 | break;
|
4231 | }
|
4232 | }
|
4233 | return format(specifier);
|
4234 | };
|
4235 |
|
4236 | function linearish(scale) {
|
4237 | var domain = scale.domain;
|
4238 |
|
4239 | scale.ticks = function(count) {
|
4240 | var d = domain();
|
4241 | return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
4242 | };
|
4243 |
|
4244 | scale.tickFormat = function(count, specifier) {
|
4245 | return tickFormat(domain(), count, specifier);
|
4246 | };
|
4247 |
|
4248 | scale.nice = function(count) {
|
4249 | var d = domain(),
|
4250 | i = d.length - 1,
|
4251 | n = count == null ? 10 : count,
|
4252 | start = d[0],
|
4253 | stop = d[i],
|
4254 | step = tickStep(start, stop, n);
|
4255 |
|
4256 | if (step) {
|
4257 | step = tickStep(Math.floor(start / step) * step, Math.ceil(stop / step) * step, n);
|
4258 | d[0] = Math.floor(start / step) * step;
|
4259 | d[i] = Math.ceil(stop / step) * step;
|
4260 | domain(d);
|
4261 | }
|
4262 |
|
4263 | return scale;
|
4264 | };
|
4265 |
|
4266 | return scale;
|
4267 | }
|
4268 |
|
4269 | function linear$2() {
|
4270 | var scale = continuous(deinterpolateLinear, reinterpolate);
|
4271 |
|
4272 | scale.copy = function() {
|
4273 | return copy(scale, linear$2());
|
4274 | };
|
4275 |
|
4276 | return linearish(scale);
|
4277 | }
|
4278 |
|
4279 | function identity$3() {
|
4280 | var domain = [0, 1];
|
4281 |
|
4282 | function scale(x) {
|
4283 | return +x;
|
4284 | }
|
4285 |
|
4286 | scale.invert = scale;
|
4287 |
|
4288 | scale.domain = scale.range = function(_) {
|
4289 | return arguments.length ? (domain = map$3.call(_, number$1), scale) : domain.slice();
|
4290 | };
|
4291 |
|
4292 | scale.copy = function() {
|
4293 | return identity$3().domain(domain);
|
4294 | };
|
4295 |
|
4296 | return linearish(scale);
|
4297 | }
|
4298 |
|
4299 | var nice = function(domain, interval) {
|
4300 | domain = domain.slice();
|
4301 |
|
4302 | var i0 = 0,
|
4303 | i1 = domain.length - 1,
|
4304 | x0 = domain[i0],
|
4305 | x1 = domain[i1],
|
4306 | t;
|
4307 |
|
4308 | if (x1 < x0) {
|
4309 | t = i0, i0 = i1, i1 = t;
|
4310 | t = x0, x0 = x1, x1 = t;
|
4311 | }
|
4312 |
|
4313 | domain[i0] = interval.floor(x0);
|
4314 | domain[i1] = interval.ceil(x1);
|
4315 | return domain;
|
4316 | };
|
4317 |
|
4318 | function deinterpolate(a, b) {
|
4319 | return (b = Math.log(b / a))
|
4320 | ? function(x) { return Math.log(x / a) / b; }
|
4321 | : constant$3(b);
|
4322 | }
|
4323 |
|
4324 | function reinterpolate$1(a, b) {
|
4325 | return a < 0
|
4326 | ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }
|
4327 | : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };
|
4328 | }
|
4329 |
|
4330 | function pow10(x) {
|
4331 | return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
|
4332 | }
|
4333 |
|
4334 | function powp(base) {
|
4335 | return base === 10 ? pow10
|
4336 | : base === Math.E ? Math.exp
|
4337 | : function(x) { return Math.pow(base, x); };
|
4338 | }
|
4339 |
|
4340 | function logp(base) {
|
4341 | return base === Math.E ? Math.log
|
4342 | : base === 10 && Math.log10
|
4343 | || base === 2 && Math.log2
|
4344 | || (base = Math.log(base), function(x) { return Math.log(x) / base; });
|
4345 | }
|
4346 |
|
4347 | function reflect(f) {
|
4348 | return function(x) {
|
4349 | return -f(-x);
|
4350 | };
|
4351 | }
|
4352 |
|
4353 | function log() {
|
4354 | var scale = continuous(deinterpolate, reinterpolate$1).domain([1, 10]),
|
4355 | domain = scale.domain,
|
4356 | base = 10,
|
4357 | logs = logp(10),
|
4358 | pows = powp(10);
|
4359 |
|
4360 | function rescale() {
|
4361 | logs = logp(base), pows = powp(base);
|
4362 | if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);
|
4363 | return scale;
|
4364 | }
|
4365 |
|
4366 | scale.base = function(_) {
|
4367 | return arguments.length ? (base = +_, rescale()) : base;
|
4368 | };
|
4369 |
|
4370 | scale.domain = function(_) {
|
4371 | return arguments.length ? (domain(_), rescale()) : domain();
|
4372 | };
|
4373 |
|
4374 | scale.ticks = function(count) {
|
4375 | var d = domain(),
|
4376 | u = d[0],
|
4377 | v = d[d.length - 1],
|
4378 | r;
|
4379 |
|
4380 | if (r = v < u) i = u, u = v, v = i;
|
4381 |
|
4382 | var i = logs(u),
|
4383 | j = logs(v),
|
4384 | p,
|
4385 | k,
|
4386 | t,
|
4387 | n = count == null ? 10 : +count,
|
4388 | z = [];
|
4389 |
|
4390 | if (!(base % 1) && j - i < n) {
|
4391 | i = Math.round(i) - 1, j = Math.round(j) + 1;
|
4392 | if (u > 0) for (; i < j; ++i) {
|
4393 | for (k = 1, p = pows(i); k < base; ++k) {
|
4394 | t = p * k;
|
4395 | if (t < u) continue;
|
4396 | if (t > v) break;
|
4397 | z.push(t);
|
4398 | }
|
4399 | } else for (; i < j; ++i) {
|
4400 | for (k = base - 1, p = pows(i); k >= 1; --k) {
|
4401 | t = p * k;
|
4402 | if (t < u) continue;
|
4403 | if (t > v) break;
|
4404 | z.push(t);
|
4405 | }
|
4406 | }
|
4407 | } else {
|
4408 | z = ticks(i, j, Math.min(j - i, n)).map(pows);
|
4409 | }
|
4410 |
|
4411 | return r ? z.reverse() : z;
|
4412 | };
|
4413 |
|
4414 | scale.tickFormat = function(count, specifier) {
|
4415 | if (specifier == null) specifier = base === 10 ? ".0e" : ",";
|
4416 | if (typeof specifier !== "function") specifier = format(specifier);
|
4417 | if (count === Infinity) return specifier;
|
4418 | if (count == null) count = 10;
|
4419 | var k = Math.max(1, base * count / scale.ticks().length);
|
4420 | return function(d) {
|
4421 | var i = d / pows(Math.round(logs(d)));
|
4422 | if (i * base < base - 0.5) i *= base;
|
4423 | return i <= k ? specifier(d) : "";
|
4424 | };
|
4425 | };
|
4426 |
|
4427 | scale.nice = function() {
|
4428 | return domain(nice(domain(), {
|
4429 | floor: function(x) { return pows(Math.floor(logs(x))); },
|
4430 | ceil: function(x) { return pows(Math.ceil(logs(x))); }
|
4431 | }));
|
4432 | };
|
4433 |
|
4434 | scale.copy = function() {
|
4435 | return copy(scale, log().base(base));
|
4436 | };
|
4437 |
|
4438 | return scale;
|
4439 | }
|
4440 |
|
4441 | function raise$1(x, exponent) {
|
4442 | return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
|
4443 | }
|
4444 |
|
4445 | function pow() {
|
4446 | var exponent = 1,
|
4447 | scale = continuous(deinterpolate, reinterpolate),
|
4448 | domain = scale.domain;
|
4449 |
|
4450 | function deinterpolate(a, b) {
|
4451 | return (b = raise$1(b, exponent) - (a = raise$1(a, exponent)))
|
4452 | ? function(x) { return (raise$1(x, exponent) - a) / b; }
|
4453 | : constant$3(b);
|
4454 | }
|
4455 |
|
4456 | function reinterpolate(a, b) {
|
4457 | b = raise$1(b, exponent) - (a = raise$1(a, exponent));
|
4458 | return function(t) { return raise$1(a + b * t, 1 / exponent); };
|
4459 | }
|
4460 |
|
4461 | scale.exponent = function(_) {
|
4462 | return arguments.length ? (exponent = +_, domain(domain())) : exponent;
|
4463 | };
|
4464 |
|
4465 | scale.copy = function() {
|
4466 | return copy(scale, pow().exponent(exponent));
|
4467 | };
|
4468 |
|
4469 | return linearish(scale);
|
4470 | }
|
4471 |
|
4472 | function sqrt() {
|
4473 | return pow().exponent(0.5);
|
4474 | }
|
4475 |
|
4476 | function quantile$$1() {
|
4477 | var domain = [],
|
4478 | range$$1 = [],
|
4479 | thresholds = [];
|
4480 |
|
4481 | function rescale() {
|
4482 | var i = 0, n = Math.max(1, range$$1.length);
|
4483 | thresholds = new Array(n - 1);
|
4484 | while (++i < n) thresholds[i - 1] = threshold(domain, i / n);
|
4485 | return scale;
|
4486 | }
|
4487 |
|
4488 | function scale(x) {
|
4489 | if (!isNaN(x = +x)) return range$$1[bisectRight(thresholds, x)];
|
4490 | }
|
4491 |
|
4492 | scale.invertExtent = function(y) {
|
4493 | var i = range$$1.indexOf(y);
|
4494 | return i < 0 ? [NaN, NaN] : [
|
4495 | i > 0 ? thresholds[i - 1] : domain[0],
|
4496 | i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
|
4497 | ];
|
4498 | };
|
4499 |
|
4500 | scale.domain = function(_) {
|
4501 | if (!arguments.length) return domain.slice();
|
4502 | domain = [];
|
4503 | for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
|
4504 | domain.sort(ascending);
|
4505 | return rescale();
|
4506 | };
|
4507 |
|
4508 | scale.range = function(_) {
|
4509 | return arguments.length ? (range$$1 = slice$2.call(_), rescale()) : range$$1.slice();
|
4510 | };
|
4511 |
|
4512 | scale.quantiles = function() {
|
4513 | return thresholds.slice();
|
4514 | };
|
4515 |
|
4516 | scale.copy = function() {
|
4517 | return quantile$$1()
|
4518 | .domain(domain)
|
4519 | .range(range$$1);
|
4520 | };
|
4521 |
|
4522 | return scale;
|
4523 | }
|
4524 |
|
4525 | function quantize$1() {
|
4526 | var x0 = 0,
|
4527 | x1 = 1,
|
4528 | n = 1,
|
4529 | domain = [0.5],
|
4530 | range$$1 = [0, 1];
|
4531 |
|
4532 | function scale(x) {
|
4533 | if (x <= x) return range$$1[bisectRight(domain, x, 0, n)];
|
4534 | }
|
4535 |
|
4536 | function rescale() {
|
4537 | var i = -1;
|
4538 | domain = new Array(n);
|
4539 | while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
4540 | return scale;
|
4541 | }
|
4542 |
|
4543 | scale.domain = function(_) {
|
4544 | return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
|
4545 | };
|
4546 |
|
4547 | scale.range = function(_) {
|
4548 | return arguments.length ? (n = (range$$1 = slice$2.call(_)).length - 1, rescale()) : range$$1.slice();
|
4549 | };
|
4550 |
|
4551 | scale.invertExtent = function(y) {
|
4552 | var i = range$$1.indexOf(y);
|
4553 | return i < 0 ? [NaN, NaN]
|
4554 | : i < 1 ? [x0, domain[0]]
|
4555 | : i >= n ? [domain[n - 1], x1]
|
4556 | : [domain[i - 1], domain[i]];
|
4557 | };
|
4558 |
|
4559 | scale.copy = function() {
|
4560 | return quantize$1()
|
4561 | .domain([x0, x1])
|
4562 | .range(range$$1);
|
4563 | };
|
4564 |
|
4565 | return linearish(scale);
|
4566 | }
|
4567 |
|
4568 | function threshold$1() {
|
4569 | var domain = [0.5],
|
4570 | range$$1 = [0, 1],
|
4571 | n = 1;
|
4572 |
|
4573 | function scale(x) {
|
4574 | if (x <= x) return range$$1[bisectRight(domain, x, 0, n)];
|
4575 | }
|
4576 |
|
4577 | scale.domain = function(_) {
|
4578 | return arguments.length ? (domain = slice$2.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : domain.slice();
|
4579 | };
|
4580 |
|
4581 | scale.range = function(_) {
|
4582 | return arguments.length ? (range$$1 = slice$2.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : range$$1.slice();
|
4583 | };
|
4584 |
|
4585 | scale.invertExtent = function(y) {
|
4586 | var i = range$$1.indexOf(y);
|
4587 | return [domain[i - 1], domain[i]];
|
4588 | };
|
4589 |
|
4590 | scale.copy = function() {
|
4591 | return threshold$1()
|
4592 | .domain(domain)
|
4593 | .range(range$$1);
|
4594 | };
|
4595 |
|
4596 | return scale;
|
4597 | }
|
4598 |
|
4599 | var t0$1 = new Date;
|
4600 | var t1$1 = new Date;
|
4601 |
|
4602 | function newInterval(floori, offseti, count, field) {
|
4603 |
|
4604 | function interval(date) {
|
4605 | return floori(date = new Date(+date)), date;
|
4606 | }
|
4607 |
|
4608 | interval.floor = interval;
|
4609 |
|
4610 | interval.ceil = function(date) {
|
4611 | return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
|
4612 | };
|
4613 |
|
4614 | interval.round = function(date) {
|
4615 | var d0 = interval(date),
|
4616 | d1 = interval.ceil(date);
|
4617 | return date - d0 < d1 - date ? d0 : d1;
|
4618 | };
|
4619 |
|
4620 | interval.offset = function(date, step) {
|
4621 | return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
|
4622 | };
|
4623 |
|
4624 | interval.range = function(start, stop, step) {
|
4625 | var range = [];
|
4626 | start = interval.ceil(start);
|
4627 | step = step == null ? 1 : Math.floor(step);
|
4628 | if (!(start < stop) || !(step > 0)) return range;
|
4629 | do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop)
|
4630 | return range;
|
4631 | };
|
4632 |
|
4633 | interval.filter = function(test) {
|
4634 | return newInterval(function(date) {
|
4635 | if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
|
4636 | }, function(date, step) {
|
4637 | if (date >= date) while (--step >= 0) while (offseti(date, 1), !test(date)) {}
|
4638 | });
|
4639 | };
|
4640 |
|
4641 | if (count) {
|
4642 | interval.count = function(start, end) {
|
4643 | t0$1.setTime(+start), t1$1.setTime(+end);
|
4644 | floori(t0$1), floori(t1$1);
|
4645 | return Math.floor(count(t0$1, t1$1));
|
4646 | };
|
4647 |
|
4648 | interval.every = function(step) {
|
4649 | step = Math.floor(step);
|
4650 | return !isFinite(step) || !(step > 0) ? null
|
4651 | : !(step > 1) ? interval
|
4652 | : interval.filter(field
|
4653 | ? function(d) { return field(d) % step === 0; }
|
4654 | : function(d) { return interval.count(0, d) % step === 0; });
|
4655 | };
|
4656 | }
|
4657 |
|
4658 | return interval;
|
4659 | }
|
4660 |
|
4661 | var millisecond = newInterval(function() {
|
4662 |
|
4663 | }, function(date, step) {
|
4664 | date.setTime(+date + step);
|
4665 | }, function(start, end) {
|
4666 | return end - start;
|
4667 | });
|
4668 |
|
4669 |
|
4670 | millisecond.every = function(k) {
|
4671 | k = Math.floor(k);
|
4672 | if (!isFinite(k) || !(k > 0)) return null;
|
4673 | if (!(k > 1)) return millisecond;
|
4674 | return newInterval(function(date) {
|
4675 | date.setTime(Math.floor(date / k) * k);
|
4676 | }, function(date, step) {
|
4677 | date.setTime(+date + step * k);
|
4678 | }, function(start, end) {
|
4679 | return (end - start) / k;
|
4680 | });
|
4681 | };
|
4682 |
|
4683 | var durationSecond$1 = 1e3;
|
4684 | var durationMinute$1 = 6e4;
|
4685 | var durationHour$1 = 36e5;
|
4686 | var durationDay$1 = 864e5;
|
4687 | var durationWeek$1 = 6048e5;
|
4688 |
|
4689 | var second = newInterval(function(date) {
|
4690 | date.setTime(Math.floor(date / durationSecond$1) * durationSecond$1);
|
4691 | }, function(date, step) {
|
4692 | date.setTime(+date + step * durationSecond$1);
|
4693 | }, function(start, end) {
|
4694 | return (end - start) / durationSecond$1;
|
4695 | }, function(date) {
|
4696 | return date.getUTCSeconds();
|
4697 | });
|
4698 |
|
4699 | var minute = newInterval(function(date) {
|
4700 | date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1);
|
4701 | }, function(date, step) {
|
4702 | date.setTime(+date + step * durationMinute$1);
|
4703 | }, function(start, end) {
|
4704 | return (end - start) / durationMinute$1;
|
4705 | }, function(date) {
|
4706 | return date.getMinutes();
|
4707 | });
|
4708 |
|
4709 | var hour = newInterval(function(date) {
|
4710 | var offset = date.getTimezoneOffset() * durationMinute$1 % durationHour$1;
|
4711 | if (offset < 0) offset += durationHour$1;
|
4712 | date.setTime(Math.floor((+date - offset) / durationHour$1) * durationHour$1 + offset);
|
4713 | }, function(date, step) {
|
4714 | date.setTime(+date + step * durationHour$1);
|
4715 | }, function(start, end) {
|
4716 | return (end - start) / durationHour$1;
|
4717 | }, function(date) {
|
4718 | return date.getHours();
|
4719 | });
|
4720 |
|
4721 | var day = newInterval(function(date) {
|
4722 | date.setHours(0, 0, 0, 0);
|
4723 | }, function(date, step) {
|
4724 | date.setDate(date.getDate() + step);
|
4725 | }, function(start, end) {
|
4726 | return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1;
|
4727 | }, function(date) {
|
4728 | return date.getDate() - 1;
|
4729 | });
|
4730 |
|
4731 | function weekday(i) {
|
4732 | return newInterval(function(date) {
|
4733 | date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
|
4734 | date.setHours(0, 0, 0, 0);
|
4735 | }, function(date, step) {
|
4736 | date.setDate(date.getDate() + step * 7);
|
4737 | }, function(start, end) {
|
4738 | return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;
|
4739 | });
|
4740 | }
|
4741 |
|
4742 | var sunday = weekday(0);
|
4743 | var monday = weekday(1);
|
4744 | var tuesday = weekday(2);
|
4745 | var wednesday = weekday(3);
|
4746 | var thursday = weekday(4);
|
4747 | var friday = weekday(5);
|
4748 | var saturday = weekday(6);
|
4749 |
|
4750 | var month = newInterval(function(date) {
|
4751 | date.setDate(1);
|
4752 | date.setHours(0, 0, 0, 0);
|
4753 | }, function(date, step) {
|
4754 | date.setMonth(date.getMonth() + step);
|
4755 | }, function(start, end) {
|
4756 | return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
|
4757 | }, function(date) {
|
4758 | return date.getMonth();
|
4759 | });
|
4760 |
|
4761 | var year = newInterval(function(date) {
|
4762 | date.setMonth(0, 1);
|
4763 | date.setHours(0, 0, 0, 0);
|
4764 | }, function(date, step) {
|
4765 | date.setFullYear(date.getFullYear() + step);
|
4766 | }, function(start, end) {
|
4767 | return end.getFullYear() - start.getFullYear();
|
4768 | }, function(date) {
|
4769 | return date.getFullYear();
|
4770 | });
|
4771 |
|
4772 |
|
4773 | year.every = function(k) {
|
4774 | return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
|
4775 | date.setFullYear(Math.floor(date.getFullYear() / k) * k);
|
4776 | date.setMonth(0, 1);
|
4777 | date.setHours(0, 0, 0, 0);
|
4778 | }, function(date, step) {
|
4779 | date.setFullYear(date.getFullYear() + step * k);
|
4780 | });
|
4781 | };
|
4782 |
|
4783 | var utcMinute = newInterval(function(date) {
|
4784 | date.setUTCSeconds(0, 0);
|
4785 | }, function(date, step) {
|
4786 | date.setTime(+date + step * durationMinute$1);
|
4787 | }, function(start, end) {
|
4788 | return (end - start) / durationMinute$1;
|
4789 | }, function(date) {
|
4790 | return date.getUTCMinutes();
|
4791 | });
|
4792 |
|
4793 | var utcHour = newInterval(function(date) {
|
4794 | date.setUTCMinutes(0, 0, 0);
|
4795 | }, function(date, step) {
|
4796 | date.setTime(+date + step * durationHour$1);
|
4797 | }, function(start, end) {
|
4798 | return (end - start) / durationHour$1;
|
4799 | }, function(date) {
|
4800 | return date.getUTCHours();
|
4801 | });
|
4802 |
|
4803 | var utcDay = newInterval(function(date) {
|
4804 | date.setUTCHours(0, 0, 0, 0);
|
4805 | }, function(date, step) {
|
4806 | date.setUTCDate(date.getUTCDate() + step);
|
4807 | }, function(start, end) {
|
4808 | return (end - start) / durationDay$1;
|
4809 | }, function(date) {
|
4810 | return date.getUTCDate() - 1;
|
4811 | });
|
4812 |
|
4813 | function utcWeekday(i) {
|
4814 | return newInterval(function(date) {
|
4815 | date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
|
4816 | date.setUTCHours(0, 0, 0, 0);
|
4817 | }, function(date, step) {
|
4818 | date.setUTCDate(date.getUTCDate() + step * 7);
|
4819 | }, function(start, end) {
|
4820 | return (end - start) / durationWeek$1;
|
4821 | });
|
4822 | }
|
4823 |
|
4824 | var utcSunday = utcWeekday(0);
|
4825 | var utcMonday = utcWeekday(1);
|
4826 | var utcTuesday = utcWeekday(2);
|
4827 | var utcWednesday = utcWeekday(3);
|
4828 | var utcThursday = utcWeekday(4);
|
4829 | var utcFriday = utcWeekday(5);
|
4830 | var utcSaturday = utcWeekday(6);
|
4831 |
|
4832 | var utcMonth = newInterval(function(date) {
|
4833 | date.setUTCDate(1);
|
4834 | date.setUTCHours(0, 0, 0, 0);
|
4835 | }, function(date, step) {
|
4836 | date.setUTCMonth(date.getUTCMonth() + step);
|
4837 | }, function(start, end) {
|
4838 | return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
|
4839 | }, function(date) {
|
4840 | return date.getUTCMonth();
|
4841 | });
|
4842 |
|
4843 | var utcYear = newInterval(function(date) {
|
4844 | date.setUTCMonth(0, 1);
|
4845 | date.setUTCHours(0, 0, 0, 0);
|
4846 | }, function(date, step) {
|
4847 | date.setUTCFullYear(date.getUTCFullYear() + step);
|
4848 | }, function(start, end) {
|
4849 | return end.getUTCFullYear() - start.getUTCFullYear();
|
4850 | }, function(date) {
|
4851 | return date.getUTCFullYear();
|
4852 | });
|
4853 |
|
4854 |
|
4855 | utcYear.every = function(k) {
|
4856 | return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
|
4857 | date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
|
4858 | date.setUTCMonth(0, 1);
|
4859 | date.setUTCHours(0, 0, 0, 0);
|
4860 | }, function(date, step) {
|
4861 | date.setUTCFullYear(date.getUTCFullYear() + step * k);
|
4862 | });
|
4863 | };
|
4864 |
|
4865 | function localDate(d) {
|
4866 | if (0 <= d.y && d.y < 100) {
|
4867 | var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
|
4868 | date.setFullYear(d.y);
|
4869 | return date;
|
4870 | }
|
4871 | return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
|
4872 | }
|
4873 |
|
4874 | function utcDate(d) {
|
4875 | if (0 <= d.y && d.y < 100) {
|
4876 | var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
|
4877 | date.setUTCFullYear(d.y);
|
4878 | return date;
|
4879 | }
|
4880 | return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
|
4881 | }
|
4882 |
|
4883 | function newYear(y) {
|
4884 | return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};
|
4885 | }
|
4886 |
|
4887 | function formatLocale$1(locale) {
|
4888 | var locale_dateTime = locale.dateTime,
|
4889 | locale_date = locale.date,
|
4890 | locale_time = locale.time,
|
4891 | locale_periods = locale.periods,
|
4892 | locale_weekdays = locale.days,
|
4893 | locale_shortWeekdays = locale.shortDays,
|
4894 | locale_months = locale.months,
|
4895 | locale_shortMonths = locale.shortMonths;
|
4896 |
|
4897 | var periodRe = formatRe(locale_periods),
|
4898 | periodLookup = formatLookup(locale_periods),
|
4899 | weekdayRe = formatRe(locale_weekdays),
|
4900 | weekdayLookup = formatLookup(locale_weekdays),
|
4901 | shortWeekdayRe = formatRe(locale_shortWeekdays),
|
4902 | shortWeekdayLookup = formatLookup(locale_shortWeekdays),
|
4903 | monthRe = formatRe(locale_months),
|
4904 | monthLookup = formatLookup(locale_months),
|
4905 | shortMonthRe = formatRe(locale_shortMonths),
|
4906 | shortMonthLookup = formatLookup(locale_shortMonths);
|
4907 |
|
4908 | var formats = {
|
4909 | "a": formatShortWeekday,
|
4910 | "A": formatWeekday,
|
4911 | "b": formatShortMonth,
|
4912 | "B": formatMonth,
|
4913 | "c": null,
|
4914 | "d": formatDayOfMonth,
|
4915 | "e": formatDayOfMonth,
|
4916 | "H": formatHour24,
|
4917 | "I": formatHour12,
|
4918 | "j": formatDayOfYear,
|
4919 | "L": formatMilliseconds,
|
4920 | "m": formatMonthNumber,
|
4921 | "M": formatMinutes,
|
4922 | "p": formatPeriod,
|
4923 | "S": formatSeconds,
|
4924 | "U": formatWeekNumberSunday,
|
4925 | "w": formatWeekdayNumber,
|
4926 | "W": formatWeekNumberMonday,
|
4927 | "x": null,
|
4928 | "X": null,
|
4929 | "y": formatYear,
|
4930 | "Y": formatFullYear,
|
4931 | "Z": formatZone,
|
4932 | "%": formatLiteralPercent
|
4933 | };
|
4934 |
|
4935 | var utcFormats = {
|
4936 | "a": formatUTCShortWeekday,
|
4937 | "A": formatUTCWeekday,
|
4938 | "b": formatUTCShortMonth,
|
4939 | "B": formatUTCMonth,
|
4940 | "c": null,
|
4941 | "d": formatUTCDayOfMonth,
|
4942 | "e": formatUTCDayOfMonth,
|
4943 | "H": formatUTCHour24,
|
4944 | "I": formatUTCHour12,
|
4945 | "j": formatUTCDayOfYear,
|
4946 | "L": formatUTCMilliseconds,
|
4947 | "m": formatUTCMonthNumber,
|
4948 | "M": formatUTCMinutes,
|
4949 | "p": formatUTCPeriod,
|
4950 | "S": formatUTCSeconds,
|
4951 | "U": formatUTCWeekNumberSunday,
|
4952 | "w": formatUTCWeekdayNumber,
|
4953 | "W": formatUTCWeekNumberMonday,
|
4954 | "x": null,
|
4955 | "X": null,
|
4956 | "y": formatUTCYear,
|
4957 | "Y": formatUTCFullYear,
|
4958 | "Z": formatUTCZone,
|
4959 | "%": formatLiteralPercent
|
4960 | };
|
4961 |
|
4962 | var parses = {
|
4963 | "a": parseShortWeekday,
|
4964 | "A": parseWeekday,
|
4965 | "b": parseShortMonth,
|
4966 | "B": parseMonth,
|
4967 | "c": parseLocaleDateTime,
|
4968 | "d": parseDayOfMonth,
|
4969 | "e": parseDayOfMonth,
|
4970 | "H": parseHour24,
|
4971 | "I": parseHour24,
|
4972 | "j": parseDayOfYear,
|
4973 | "L": parseMilliseconds,
|
4974 | "m": parseMonthNumber,
|
4975 | "M": parseMinutes,
|
4976 | "p": parsePeriod,
|
4977 | "S": parseSeconds,
|
4978 | "U": parseWeekNumberSunday,
|
4979 | "w": parseWeekdayNumber,
|
4980 | "W": parseWeekNumberMonday,
|
4981 | "x": parseLocaleDate,
|
4982 | "X": parseLocaleTime,
|
4983 | "y": parseYear,
|
4984 | "Y": parseFullYear,
|
4985 | "Z": parseZone,
|
4986 | "%": parseLiteralPercent
|
4987 | };
|
4988 |
|
4989 |
|
4990 | formats.x = newFormat(locale_date, formats);
|
4991 | formats.X = newFormat(locale_time, formats);
|
4992 | formats.c = newFormat(locale_dateTime, formats);
|
4993 | utcFormats.x = newFormat(locale_date, utcFormats);
|
4994 | utcFormats.X = newFormat(locale_time, utcFormats);
|
4995 | utcFormats.c = newFormat(locale_dateTime, utcFormats);
|
4996 |
|
4997 | function newFormat(specifier, formats) {
|
4998 | return function(date) {
|
4999 | var string = [],
|
5000 | i = -1,
|
5001 | j = 0,
|
5002 | n = specifier.length,
|
5003 | c,
|
5004 | pad,
|
5005 | format;
|
5006 |
|
5007 | if (!(date instanceof Date)) date = new Date(+date);
|
5008 |
|
5009 | while (++i < n) {
|
5010 | if (specifier.charCodeAt(i) === 37) {
|
5011 | string.push(specifier.slice(j, i));
|
5012 | if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
|
5013 | else pad = c === "e" ? " " : "0";
|
5014 | if (format = formats[c]) c = format(date, pad);
|
5015 | string.push(c);
|
5016 | j = i + 1;
|
5017 | }
|
5018 | }
|
5019 |
|
5020 | string.push(specifier.slice(j, i));
|
5021 | return string.join("");
|
5022 | };
|
5023 | }
|
5024 |
|
5025 | function newParse(specifier, newDate) {
|
5026 | return function(string) {
|
5027 | var d = newYear(1900),
|
5028 | i = parseSpecifier(d, specifier, string += "", 0);
|
5029 | if (i != string.length) return null;
|
5030 |
|
5031 |
|
5032 | if ("p" in d) d.H = d.H % 12 + d.p * 12;
|
5033 |
|
5034 |
|
5035 | if ("W" in d || "U" in d) {
|
5036 | if (!("w" in d)) d.w = "W" in d ? 1 : 0;
|
5037 | var day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
|
5038 | d.m = 0;
|
5039 | d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7;
|
5040 | }
|
5041 |
|
5042 |
|
5043 |
|
5044 | if ("Z" in d) {
|
5045 | d.H += d.Z / 100 | 0;
|
5046 | d.M += d.Z % 100;
|
5047 | return utcDate(d);
|
5048 | }
|
5049 |
|
5050 |
|
5051 | return newDate(d);
|
5052 | };
|
5053 | }
|
5054 |
|
5055 | function parseSpecifier(d, specifier, string, j) {
|
5056 | var i = 0,
|
5057 | n = specifier.length,
|
5058 | m = string.length,
|
5059 | c,
|
5060 | parse;
|
5061 |
|
5062 | while (i < n) {
|
5063 | if (j >= m) return -1;
|
5064 | c = specifier.charCodeAt(i++);
|
5065 | if (c === 37) {
|
5066 | c = specifier.charAt(i++);
|
5067 | parse = parses[c in pads ? specifier.charAt(i++) : c];
|
5068 | if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
|
5069 | } else if (c != string.charCodeAt(j++)) {
|
5070 | return -1;
|
5071 | }
|
5072 | }
|
5073 |
|
5074 | return j;
|
5075 | }
|
5076 |
|
5077 | function parsePeriod(d, string, i) {
|
5078 | var n = periodRe.exec(string.slice(i));
|
5079 | return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
5080 | }
|
5081 |
|
5082 | function parseShortWeekday(d, string, i) {
|
5083 | var n = shortWeekdayRe.exec(string.slice(i));
|
5084 | return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
5085 | }
|
5086 |
|
5087 | function parseWeekday(d, string, i) {
|
5088 | var n = weekdayRe.exec(string.slice(i));
|
5089 | return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
5090 | }
|
5091 |
|
5092 | function parseShortMonth(d, string, i) {
|
5093 | var n = shortMonthRe.exec(string.slice(i));
|
5094 | return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
5095 | }
|
5096 |
|
5097 | function parseMonth(d, string, i) {
|
5098 | var n = monthRe.exec(string.slice(i));
|
5099 | return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
5100 | }
|
5101 |
|
5102 | function parseLocaleDateTime(d, string, i) {
|
5103 | return parseSpecifier(d, locale_dateTime, string, i);
|
5104 | }
|
5105 |
|
5106 | function parseLocaleDate(d, string, i) {
|
5107 | return parseSpecifier(d, locale_date, string, i);
|
5108 | }
|
5109 |
|
5110 | function parseLocaleTime(d, string, i) {
|
5111 | return parseSpecifier(d, locale_time, string, i);
|
5112 | }
|
5113 |
|
5114 | function formatShortWeekday(d) {
|
5115 | return locale_shortWeekdays[d.getDay()];
|
5116 | }
|
5117 |
|
5118 | function formatWeekday(d) {
|
5119 | return locale_weekdays[d.getDay()];
|
5120 | }
|
5121 |
|
5122 | function formatShortMonth(d) {
|
5123 | return locale_shortMonths[d.getMonth()];
|
5124 | }
|
5125 |
|
5126 | function formatMonth(d) {
|
5127 | return locale_months[d.getMonth()];
|
5128 | }
|
5129 |
|
5130 | function formatPeriod(d) {
|
5131 | return locale_periods[+(d.getHours() >= 12)];
|
5132 | }
|
5133 |
|
5134 | function formatUTCShortWeekday(d) {
|
5135 | return locale_shortWeekdays[d.getUTCDay()];
|
5136 | }
|
5137 |
|
5138 | function formatUTCWeekday(d) {
|
5139 | return locale_weekdays[d.getUTCDay()];
|
5140 | }
|
5141 |
|
5142 | function formatUTCShortMonth(d) {
|
5143 | return locale_shortMonths[d.getUTCMonth()];
|
5144 | }
|
5145 |
|
5146 | function formatUTCMonth(d) {
|
5147 | return locale_months[d.getUTCMonth()];
|
5148 | }
|
5149 |
|
5150 | function formatUTCPeriod(d) {
|
5151 | return locale_periods[+(d.getUTCHours() >= 12)];
|
5152 | }
|
5153 |
|
5154 | return {
|
5155 | format: function(specifier) {
|
5156 | var f = newFormat(specifier += "", formats);
|
5157 | f.toString = function() { return specifier; };
|
5158 | return f;
|
5159 | },
|
5160 | parse: function(specifier) {
|
5161 | var p = newParse(specifier += "", localDate);
|
5162 | p.toString = function() { return specifier; };
|
5163 | return p;
|
5164 | },
|
5165 | utcFormat: function(specifier) {
|
5166 | var f = newFormat(specifier += "", utcFormats);
|
5167 | f.toString = function() { return specifier; };
|
5168 | return f;
|
5169 | },
|
5170 | utcParse: function(specifier) {
|
5171 | var p = newParse(specifier, utcDate);
|
5172 | p.toString = function() { return specifier; };
|
5173 | return p;
|
5174 | }
|
5175 | };
|
5176 | }
|
5177 |
|
5178 | var pads = {"-": "", "_": " ", "0": "0"};
|
5179 | var numberRe = /^\s*\d+/;
|
5180 | var percentRe = /^%/;
|
5181 | var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
|
5182 |
|
5183 | function pad(value, fill, width) {
|
5184 | var sign = value < 0 ? "-" : "",
|
5185 | string = (sign ? -value : value) + "",
|
5186 | length = string.length;
|
5187 | return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
|
5188 | }
|
5189 |
|
5190 | function requote(s) {
|
5191 | return s.replace(requoteRe, "\\$&");
|
5192 | }
|
5193 |
|
5194 | function formatRe(names) {
|
5195 | return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
|
5196 | }
|
5197 |
|
5198 | function formatLookup(names) {
|
5199 | var map = {}, i = -1, n = names.length;
|
5200 | while (++i < n) map[names[i].toLowerCase()] = i;
|
5201 | return map;
|
5202 | }
|
5203 |
|
5204 | function parseWeekdayNumber(d, string, i) {
|
5205 | var n = numberRe.exec(string.slice(i, i + 1));
|
5206 | return n ? (d.w = +n[0], i + n[0].length) : -1;
|
5207 | }
|
5208 |
|
5209 | function parseWeekNumberSunday(d, string, i) {
|
5210 | var n = numberRe.exec(string.slice(i));
|
5211 | return n ? (d.U = +n[0], i + n[0].length) : -1;
|
5212 | }
|
5213 |
|
5214 | function parseWeekNumberMonday(d, string, i) {
|
5215 | var n = numberRe.exec(string.slice(i));
|
5216 | return n ? (d.W = +n[0], i + n[0].length) : -1;
|
5217 | }
|
5218 |
|
5219 | function parseFullYear(d, string, i) {
|
5220 | var n = numberRe.exec(string.slice(i, i + 4));
|
5221 | return n ? (d.y = +n[0], i + n[0].length) : -1;
|
5222 | }
|
5223 |
|
5224 | function parseYear(d, string, i) {
|
5225 | var n = numberRe.exec(string.slice(i, i + 2));
|
5226 | return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
|
5227 | }
|
5228 |
|
5229 | function parseZone(d, string, i) {
|
5230 | var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6));
|
5231 | return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
|
5232 | }
|
5233 |
|
5234 | function parseMonthNumber(d, string, i) {
|
5235 | var n = numberRe.exec(string.slice(i, i + 2));
|
5236 | return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
|
5237 | }
|
5238 |
|
5239 | function parseDayOfMonth(d, string, i) {
|
5240 | var n = numberRe.exec(string.slice(i, i + 2));
|
5241 | return n ? (d.d = +n[0], i + n[0].length) : -1;
|
5242 | }
|
5243 |
|
5244 | function parseDayOfYear(d, string, i) {
|
5245 | var n = numberRe.exec(string.slice(i, i + 3));
|
5246 | return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
|
5247 | }
|
5248 |
|
5249 | function parseHour24(d, string, i) {
|
5250 | var n = numberRe.exec(string.slice(i, i + 2));
|
5251 | return n ? (d.H = +n[0], i + n[0].length) : -1;
|
5252 | }
|
5253 |
|
5254 | function parseMinutes(d, string, i) {
|
5255 | var n = numberRe.exec(string.slice(i, i + 2));
|
5256 | return n ? (d.M = +n[0], i + n[0].length) : -1;
|
5257 | }
|
5258 |
|
5259 | function parseSeconds(d, string, i) {
|
5260 | var n = numberRe.exec(string.slice(i, i + 2));
|
5261 | return n ? (d.S = +n[0], i + n[0].length) : -1;
|
5262 | }
|
5263 |
|
5264 | function parseMilliseconds(d, string, i) {
|
5265 | var n = numberRe.exec(string.slice(i, i + 3));
|
5266 | return n ? (d.L = +n[0], i + n[0].length) : -1;
|
5267 | }
|
5268 |
|
5269 | function parseLiteralPercent(d, string, i) {
|
5270 | var n = percentRe.exec(string.slice(i, i + 1));
|
5271 | return n ? i + n[0].length : -1;
|
5272 | }
|
5273 |
|
5274 | function formatDayOfMonth(d, p) {
|
5275 | return pad(d.getDate(), p, 2);
|
5276 | }
|
5277 |
|
5278 | function formatHour24(d, p) {
|
5279 | return pad(d.getHours(), p, 2);
|
5280 | }
|
5281 |
|
5282 | function formatHour12(d, p) {
|
5283 | return pad(d.getHours() % 12 || 12, p, 2);
|
5284 | }
|
5285 |
|
5286 | function formatDayOfYear(d, p) {
|
5287 | return pad(1 + day.count(year(d), d), p, 3);
|
5288 | }
|
5289 |
|
5290 | function formatMilliseconds(d, p) {
|
5291 | return pad(d.getMilliseconds(), p, 3);
|
5292 | }
|
5293 |
|
5294 | function formatMonthNumber(d, p) {
|
5295 | return pad(d.getMonth() + 1, p, 2);
|
5296 | }
|
5297 |
|
5298 | function formatMinutes(d, p) {
|
5299 | return pad(d.getMinutes(), p, 2);
|
5300 | }
|
5301 |
|
5302 | function formatSeconds(d, p) {
|
5303 | return pad(d.getSeconds(), p, 2);
|
5304 | }
|
5305 |
|
5306 | function formatWeekNumberSunday(d, p) {
|
5307 | return pad(sunday.count(year(d), d), p, 2);
|
5308 | }
|
5309 |
|
5310 | function formatWeekdayNumber(d) {
|
5311 | return d.getDay();
|
5312 | }
|
5313 |
|
5314 | function formatWeekNumberMonday(d, p) {
|
5315 | return pad(monday.count(year(d), d), p, 2);
|
5316 | }
|
5317 |
|
5318 | function formatYear(d, p) {
|
5319 | return pad(d.getFullYear() % 100, p, 2);
|
5320 | }
|
5321 |
|
5322 | function formatFullYear(d, p) {
|
5323 | return pad(d.getFullYear() % 10000, p, 4);
|
5324 | }
|
5325 |
|
5326 | function formatZone(d) {
|
5327 | var z = d.getTimezoneOffset();
|
5328 | return (z > 0 ? "-" : (z *= -1, "+"))
|
5329 | + pad(z / 60 | 0, "0", 2)
|
5330 | + pad(z % 60, "0", 2);
|
5331 | }
|
5332 |
|
5333 | function formatUTCDayOfMonth(d, p) {
|
5334 | return pad(d.getUTCDate(), p, 2);
|
5335 | }
|
5336 |
|
5337 | function formatUTCHour24(d, p) {
|
5338 | return pad(d.getUTCHours(), p, 2);
|
5339 | }
|
5340 |
|
5341 | function formatUTCHour12(d, p) {
|
5342 | return pad(d.getUTCHours() % 12 || 12, p, 2);
|
5343 | }
|
5344 |
|
5345 | function formatUTCDayOfYear(d, p) {
|
5346 | return pad(1 + utcDay.count(utcYear(d), d), p, 3);
|
5347 | }
|
5348 |
|
5349 | function formatUTCMilliseconds(d, p) {
|
5350 | return pad(d.getUTCMilliseconds(), p, 3);
|
5351 | }
|
5352 |
|
5353 | function formatUTCMonthNumber(d, p) {
|
5354 | return pad(d.getUTCMonth() + 1, p, 2);
|
5355 | }
|
5356 |
|
5357 | function formatUTCMinutes(d, p) {
|
5358 | return pad(d.getUTCMinutes(), p, 2);
|
5359 | }
|
5360 |
|
5361 | function formatUTCSeconds(d, p) {
|
5362 | return pad(d.getUTCSeconds(), p, 2);
|
5363 | }
|
5364 |
|
5365 | function formatUTCWeekNumberSunday(d, p) {
|
5366 | return pad(utcSunday.count(utcYear(d), d), p, 2);
|
5367 | }
|
5368 |
|
5369 | function formatUTCWeekdayNumber(d) {
|
5370 | return d.getUTCDay();
|
5371 | }
|
5372 |
|
5373 | function formatUTCWeekNumberMonday(d, p) {
|
5374 | return pad(utcMonday.count(utcYear(d), d), p, 2);
|
5375 | }
|
5376 |
|
5377 | function formatUTCYear(d, p) {
|
5378 | return pad(d.getUTCFullYear() % 100, p, 2);
|
5379 | }
|
5380 |
|
5381 | function formatUTCFullYear(d, p) {
|
5382 | return pad(d.getUTCFullYear() % 10000, p, 4);
|
5383 | }
|
5384 |
|
5385 | function formatUTCZone() {
|
5386 | return "+0000";
|
5387 | }
|
5388 |
|
5389 | function formatLiteralPercent() {
|
5390 | return "%";
|
5391 | }
|
5392 |
|
5393 | var locale$2;
|
5394 | var timeFormat;
|
5395 | var timeParse;
|
5396 | var utcFormat;
|
5397 | var utcParse;
|
5398 |
|
5399 | defaultLocale$1({
|
5400 | dateTime: "%x, %X",
|
5401 | date: "%-m/%-d/%Y",
|
5402 | time: "%-I:%M:%S %p",
|
5403 | periods: ["AM", "PM"],
|
5404 | days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
5405 | shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
5406 | months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
5407 | shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
5408 | });
|
5409 |
|
5410 | function defaultLocale$1(definition) {
|
5411 | locale$2 = formatLocale$1(definition);
|
5412 | timeFormat = locale$2.format;
|
5413 | timeParse = locale$2.parse;
|
5414 | utcFormat = locale$2.utcFormat;
|
5415 | utcParse = locale$2.utcParse;
|
5416 | return locale$2;
|
5417 | }
|
5418 |
|
5419 | var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
|
5420 |
|
5421 | function formatIsoNative(date) {
|
5422 | return date.toISOString();
|
5423 | }
|
5424 |
|
5425 | var formatIso = Date.prototype.toISOString
|
5426 | ? formatIsoNative
|
5427 | : utcFormat(isoSpecifier);
|
5428 |
|
5429 | function parseIsoNative(string) {
|
5430 | var date = new Date(string);
|
5431 | return isNaN(date) ? null : date;
|
5432 | }
|
5433 |
|
5434 | var parseIso = +new Date("2000-01-01T00:00:00.000Z")
|
5435 | ? parseIsoNative
|
5436 | : utcParse(isoSpecifier);
|
5437 |
|
5438 | var durationSecond = 1000;
|
5439 | var durationMinute = durationSecond * 60;
|
5440 | var durationHour = durationMinute * 60;
|
5441 | var durationDay = durationHour * 24;
|
5442 | var durationWeek = durationDay * 7;
|
5443 | var durationMonth = durationDay * 30;
|
5444 | var durationYear = durationDay * 365;
|
5445 |
|
5446 | function date$1(t) {
|
5447 | return new Date(t);
|
5448 | }
|
5449 |
|
5450 | function number$2(t) {
|
5451 | return t instanceof Date ? +t : +new Date(+t);
|
5452 | }
|
5453 |
|
5454 | function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) {
|
5455 | var scale = continuous(deinterpolateLinear, reinterpolate),
|
5456 | invert = scale.invert,
|
5457 | domain = scale.domain;
|
5458 |
|
5459 | var formatMillisecond = format(".%L"),
|
5460 | formatSecond = format(":%S"),
|
5461 | formatMinute = format("%I:%M"),
|
5462 | formatHour = format("%I %p"),
|
5463 | formatDay = format("%a %d"),
|
5464 | formatWeek = format("%b %d"),
|
5465 | formatMonth = format("%B"),
|
5466 | formatYear = format("%Y");
|
5467 |
|
5468 | var tickIntervals = [
|
5469 | [second$$1, 1, durationSecond],
|
5470 | [second$$1, 5, 5 * durationSecond],
|
5471 | [second$$1, 15, 15 * durationSecond],
|
5472 | [second$$1, 30, 30 * durationSecond],
|
5473 | [minute$$1, 1, durationMinute],
|
5474 | [minute$$1, 5, 5 * durationMinute],
|
5475 | [minute$$1, 15, 15 * durationMinute],
|
5476 | [minute$$1, 30, 30 * durationMinute],
|
5477 | [ hour$$1, 1, durationHour ],
|
5478 | [ hour$$1, 3, 3 * durationHour ],
|
5479 | [ hour$$1, 6, 6 * durationHour ],
|
5480 | [ hour$$1, 12, 12 * durationHour ],
|
5481 | [ day$$1, 1, durationDay ],
|
5482 | [ day$$1, 2, 2 * durationDay ],
|
5483 | [ week, 1, durationWeek ],
|
5484 | [ month$$1, 1, durationMonth ],
|
5485 | [ month$$1, 3, 3 * durationMonth ],
|
5486 | [ year$$1, 1, durationYear ]
|
5487 | ];
|
5488 |
|
5489 | function tickFormat(date) {
|
5490 | return (second$$1(date) < date ? formatMillisecond
|
5491 | : minute$$1(date) < date ? formatSecond
|
5492 | : hour$$1(date) < date ? formatMinute
|
5493 | : day$$1(date) < date ? formatHour
|
5494 | : month$$1(date) < date ? (week(date) < date ? formatDay : formatWeek)
|
5495 | : year$$1(date) < date ? formatMonth
|
5496 | : formatYear)(date);
|
5497 | }
|
5498 |
|
5499 | function tickInterval(interval, start, stop, step) {
|
5500 | if (interval == null) interval = 10;
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 | if (typeof interval === "number") {
|
5506 | var target = Math.abs(stop - start) / interval,
|
5507 | i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);
|
5508 | if (i === tickIntervals.length) {
|
5509 | step = tickStep(start / durationYear, stop / durationYear, interval);
|
5510 | interval = year$$1;
|
5511 | } else if (i) {
|
5512 | i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
|
5513 | step = i[1];
|
5514 | interval = i[0];
|
5515 | } else {
|
5516 | step = tickStep(start, stop, interval);
|
5517 | interval = millisecond$$1;
|
5518 | }
|
5519 | }
|
5520 |
|
5521 | return step == null ? interval : interval.every(step);
|
5522 | }
|
5523 |
|
5524 | scale.invert = function(y) {
|
5525 | return new Date(invert(y));
|
5526 | };
|
5527 |
|
5528 | scale.domain = function(_) {
|
5529 | return arguments.length ? domain(map$3.call(_, number$2)) : domain().map(date$1);
|
5530 | };
|
5531 |
|
5532 | scale.ticks = function(interval, step) {
|
5533 | var d = domain(),
|
5534 | t0 = d[0],
|
5535 | t1 = d[d.length - 1],
|
5536 | r = t1 < t0,
|
5537 | t;
|
5538 | if (r) t = t0, t0 = t1, t1 = t;
|
5539 | t = tickInterval(interval, t0, t1, step);
|
5540 | t = t ? t.range(t0, t1 + 1) : [];
|
5541 | return r ? t.reverse() : t;
|
5542 | };
|
5543 |
|
5544 | scale.tickFormat = function(count, specifier) {
|
5545 | return specifier == null ? tickFormat : format(specifier);
|
5546 | };
|
5547 |
|
5548 | scale.nice = function(interval, step) {
|
5549 | var d = domain();
|
5550 | return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
|
5551 | ? domain(nice(d, interval))
|
5552 | : scale;
|
5553 | };
|
5554 |
|
5555 | scale.copy = function() {
|
5556 | return copy(scale, calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format));
|
5557 | };
|
5558 |
|
5559 | return scale;
|
5560 | }
|
5561 |
|
5562 | var time = function() {
|
5563 | return calendar(year, month, sunday, day, hour, minute, second, millisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
|
5564 | };
|
5565 |
|
5566 | var utcTime = function() {
|
5567 | return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
|
5568 | };
|
5569 |
|
5570 | var colors = function(s) {
|
5571 | return s.match(/.{6}/g).map(function(x) {
|
5572 | return "#" + x;
|
5573 | });
|
5574 | };
|
5575 |
|
5576 | var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
|
5577 |
|
5578 | var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6");
|
5579 |
|
5580 | var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9");
|
5581 |
|
5582 | var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5");
|
5583 |
|
5584 | var cubehelix$3 = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));
|
5585 |
|
5586 | var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
|
5587 |
|
5588 | var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
|
5589 |
|
5590 | var rainbow = cubehelix();
|
5591 |
|
5592 | var rainbow$1 = function(t) {
|
5593 | if (t < 0 || t > 1) t -= Math.floor(t);
|
5594 | var ts = Math.abs(t - 0.5);
|
5595 | rainbow.h = 360 * t - 100;
|
5596 | rainbow.s = 1.5 - 1.5 * ts;
|
5597 | rainbow.l = 0.8 - 0.9 * ts;
|
5598 | return rainbow + "";
|
5599 | };
|
5600 |
|
5601 | function ramp(range) {
|
5602 | var n = range.length;
|
5603 | return function(t) {
|
5604 | return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
|
5605 | };
|
5606 | }
|
5607 |
|
5608 | var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
|
5609 |
|
5610 | var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
|
5611 |
|
5612 | var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
|
5613 |
|
5614 | var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
|
5615 |
|
5616 | function sequential(interpolator) {
|
5617 | var x0 = 0,
|
5618 | x1 = 1,
|
5619 | clamp = false;
|
5620 |
|
5621 | function scale(x) {
|
5622 | var t = (x - x0) / (x1 - x0);
|
5623 | return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
|
5624 | }
|
5625 |
|
5626 | scale.domain = function(_) {
|
5627 | return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];
|
5628 | };
|
5629 |
|
5630 | scale.clamp = function(_) {
|
5631 | return arguments.length ? (clamp = !!_, scale) : clamp;
|
5632 | };
|
5633 |
|
5634 | scale.interpolator = function(_) {
|
5635 | return arguments.length ? (interpolator = _, scale) : interpolator;
|
5636 | };
|
5637 |
|
5638 | scale.copy = function() {
|
5639 | return sequential(interpolator).domain([x0, x1]).clamp(clamp);
|
5640 | };
|
5641 |
|
5642 | return linearish(scale);
|
5643 | }
|
5644 |
|
5645 | function bullet() {
|
5646 |
|
5647 | var orient = 'left',
|
5648 | reverse = false,
|
5649 | duration = 0,
|
5650 | ranges = function (d) {
|
5651 | return d.ranges;
|
5652 | },
|
5653 | markers = function (d) {
|
5654 | return d.markers;
|
5655 | },
|
5656 | measures = function (d) {
|
5657 | return d.measures;
|
5658 | },
|
5659 | width = 380,
|
5660 | height = 30,
|
5661 | tickFormat = null;
|
5662 |
|
5663 | function bulletTranslate(x) {
|
5664 | return function (d) {
|
5665 | return 'translate(' + x(d) + ',0)';
|
5666 | };
|
5667 | }
|
5668 |
|
5669 | function bulletWidth(x) {
|
5670 | var x0 = x(0);
|
5671 | return function (d) {
|
5672 | return Math.abs(x(d) - x0);
|
5673 | };
|
5674 | }
|
5675 |
|
5676 | function bullet(g) {
|
5677 |
|
5678 | g.each(function (d, i) {
|
5679 |
|
5680 | var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
|
5681 | markerz = markers.call(this, d, i).slice().sort(d3.descending),
|
5682 | measurez = measures.call(this, d, i).slice().sort(d3.descending),
|
5683 | g = d3.select(this),
|
5684 |
|
5685 | x1 = d3.scaleLinear()
|
5686 | .domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
|
5687 | .range(reverse ? [width, 0] : [0, width]),
|
5688 |
|
5689 | x0 = this.__chart__ || d3.scaleLinear()
|
5690 | .domain([0, Infinity])
|
5691 | .range(x1.range());
|
5692 |
|
5693 | this.__chart__ = x1;
|
5694 |
|
5695 | var w0 = bulletWidth(x0),
|
5696 | w1 = bulletWidth(x1),
|
5697 | range = g.selectAll('rect.range').data(rangez);
|
5698 |
|
5699 | range.enter().append('rect')
|
5700 | .attr('class', function (d, i) {
|
5701 | return 'range s' + i;
|
5702 | })
|
5703 | .attr('width', w0)
|
5704 | .attr('height', height)
|
5705 | .attr('x', reverse ? x0 : 0)
|
5706 | .transition()
|
5707 | .duration(duration)
|
5708 | .attr('width', w1)
|
5709 | .attr('x', reverse ? x1 : 0);
|
5710 |
|
5711 | range.transition()
|
5712 | .duration(duration)
|
5713 | .attr('x', reverse ? x1 : 0)
|
5714 | .attr('width', w1)
|
5715 | .attr('height', height);
|
5716 |
|
5717 |
|
5718 | var measure = g.selectAll('rect.measure')
|
5719 | .data(measurez);
|
5720 |
|
5721 | measure.enter().append('rect')
|
5722 | .attr('class', function (d, i) {
|
5723 | return 'measure s' + i;
|
5724 | })
|
5725 | .attr('width', w0)
|
5726 | .attr('height', height / 3)
|
5727 | .attr('x', reverse ? x0 : 0)
|
5728 | .attr('y', height / 3)
|
5729 | .transition()
|
5730 | .duration(duration)
|
5731 | .attr('width', w1)
|
5732 | .attr('x', reverse ? x1 : 0);
|
5733 |
|
5734 | measure.transition()
|
5735 | .duration(duration)
|
5736 | .attr('width', w1)
|
5737 | .attr('height', height / 3)
|
5738 | .attr('x', reverse ? x1 : 0)
|
5739 | .attr('y', height / 3);
|
5740 |
|
5741 |
|
5742 | var marker = g.selectAll('line.marker')
|
5743 | .data(markerz);
|
5744 |
|
5745 | marker.enter().append('line')
|
5746 | .attr('class', 'marker')
|
5747 | .attr('x1', x0)
|
5748 | .attr('x2', x0)
|
5749 | .attr('y1', height / 6)
|
5750 | .attr('y2', height * 5 / 6)
|
5751 | .transition()
|
5752 | .duration(duration)
|
5753 | .attr('x1', x1)
|
5754 | .attr('x2', x1);
|
5755 |
|
5756 | marker.transition()
|
5757 | .duration(duration)
|
5758 | .attr('x1', x1)
|
5759 | .attr('x2', x1)
|
5760 | .attr('y1', height / 6)
|
5761 | .attr('y2', height * 5 / 6);
|
5762 |
|
5763 |
|
5764 | var format = tickFormat || x1.tickFormat(8);
|
5765 |
|
5766 |
|
5767 | var tick = g.selectAll('g.tick')
|
5768 | .data(x1.ticks(8), function (d) {
|
5769 | return this.textContent || format(d);
|
5770 | });
|
5771 |
|
5772 |
|
5773 | var tickEnter = tick.enter().append('g')
|
5774 | .attr('class', 'tick')
|
5775 | .attr('transform', bulletTranslate(x0))
|
5776 | .style('opacity', 1e-6);
|
5777 |
|
5778 | tickEnter.append('line')
|
5779 | .attr('y1', height)
|
5780 | .attr('y2', height * 7 / 6);
|
5781 |
|
5782 | tickEnter.append('text')
|
5783 | .attr('text-anchor', 'middle')
|
5784 | .attr('dy', '1em')
|
5785 | .attr('y', height * 7 / 6)
|
5786 | .text(format);
|
5787 |
|
5788 |
|
5789 | tickEnter.transition()
|
5790 | .duration(duration)
|
5791 | .attr('transform', bulletTranslate(x1))
|
5792 | .style('opacity', 1);
|
5793 |
|
5794 |
|
5795 | var tickUpdate = tick.transition()
|
5796 | .duration(duration)
|
5797 | .attr('transform', bulletTranslate(x1))
|
5798 | .style('opacity', 1);
|
5799 |
|
5800 | tickUpdate.select('line')
|
5801 | .attr('y1', height)
|
5802 | .attr('y2', height * 7 / 6);
|
5803 |
|
5804 | tickUpdate.select('text')
|
5805 | .attr('y', height * 7 / 6);
|
5806 |
|
5807 |
|
5808 | tick.exit().transition()
|
5809 | .duration(duration)
|
5810 | .attr('transform', bulletTranslate(x1))
|
5811 | .style('opacity', 1e-6)
|
5812 | .remove();
|
5813 | });
|
5814 |
|
5815 | d3.timerFlush();
|
5816 | }
|
5817 |
|
5818 | bullet.orient = function (x) {
|
5819 | if (!arguments.length) return orient;
|
5820 | orient = x;
|
5821 | reverse = orient === 'right' || orient === 'bottom';
|
5822 | return bullet;
|
5823 | };
|
5824 |
|
5825 | bullet.ranges = function (x) {
|
5826 | if (!arguments.length) return ranges;
|
5827 | ranges = x;
|
5828 | return bullet;
|
5829 | };
|
5830 |
|
5831 | bullet.markers = function (x) {
|
5832 | if (!arguments.length) return markers;
|
5833 | markers = x;
|
5834 | return bullet;
|
5835 | };
|
5836 |
|
5837 |
|
5838 | bullet.measures = function (x) {
|
5839 | if (!arguments.length) return measures;
|
5840 | measures = x;
|
5841 | return bullet;
|
5842 | };
|
5843 |
|
5844 | bullet.width = function (x) {
|
5845 | if (!arguments.length) return width;
|
5846 | width = x;
|
5847 | return bullet;
|
5848 | };
|
5849 |
|
5850 | bullet.height = function (x) {
|
5851 | if (!arguments.length) return height;
|
5852 | height = x;
|
5853 | return bullet;
|
5854 | };
|
5855 |
|
5856 | bullet.tickFormat = function (x) {
|
5857 | if (!arguments.length) return tickFormat;
|
5858 | tickFormat = x;
|
5859 | return bullet;
|
5860 | };
|
5861 |
|
5862 | bullet.duration = function (x) {
|
5863 | if (!arguments.length) return duration;
|
5864 | duration = x;
|
5865 | return bullet;
|
5866 | };
|
5867 |
|
5868 | return bullet;
|
5869 | }
|
5870 |
|
5871 | var version = '1.0.0';
|
5872 |
|
5873 | exports.bullet = bullet;
|
5874 | exports.version = version;
|
5875 | exports.bisect = bisectRight;
|
5876 | exports.bisectRight = bisectRight;
|
5877 | exports.bisectLeft = bisectLeft;
|
5878 | exports.ascending = ascending;
|
5879 | exports.bisector = bisector;
|
5880 | exports.descending = descending;
|
5881 | exports.deviation = deviation;
|
5882 | exports.extent = extent;
|
5883 | exports.histogram = histogram;
|
5884 | exports.thresholdFreedmanDiaconis = freedmanDiaconis;
|
5885 | exports.thresholdScott = scott;
|
5886 | exports.thresholdSturges = sturges;
|
5887 | exports.max = max;
|
5888 | exports.mean = mean;
|
5889 | exports.median = median;
|
5890 | exports.merge = merge;
|
5891 | exports.min = min;
|
5892 | exports.pairs = pairs;
|
5893 | exports.permute = permute;
|
5894 | exports.quantile = threshold;
|
5895 | exports.range = sequence;
|
5896 | exports.scan = scan;
|
5897 | exports.shuffle = shuffle;
|
5898 | exports.sum = sum;
|
5899 | exports.ticks = ticks;
|
5900 | exports.tickStep = tickStep;
|
5901 | exports.transpose = transpose;
|
5902 | exports.variance = variance;
|
5903 | exports.zip = zip;
|
5904 | exports.axisTop = axisTop;
|
5905 | exports.axisRight = axisRight;
|
5906 | exports.axisBottom = axisBottom;
|
5907 | exports.axisLeft = axisLeft;
|
5908 | exports.creator = creator;
|
5909 | exports.local = local;
|
5910 | exports.matcher = matcher$1;
|
5911 | exports.mouse = mouse;
|
5912 | exports.namespace = namespace;
|
5913 | exports.namespaces = namespaces;
|
5914 | exports.select = select;
|
5915 | exports.selectAll = selectAll;
|
5916 | exports.selection = selection;
|
5917 | exports.selector = selector;
|
5918 | exports.selectorAll = selectorAll;
|
5919 | exports.touch = touch;
|
5920 | exports.touches = touches;
|
5921 | exports.window = window;
|
5922 | exports.customEvent = customEvent;
|
5923 | exports.transition = transition;
|
5924 | exports.active = active;
|
5925 | exports.interrupt = interrupt;
|
5926 | exports.now = now;
|
5927 | exports.timer = timer;
|
5928 | exports.timerFlush = timerFlush;
|
5929 | exports.timeout = timeout$1;
|
5930 | exports.interval = interval$1;
|
5931 | exports.scaleBand = band;
|
5932 | exports.scalePoint = point$1;
|
5933 | exports.scaleIdentity = identity$3;
|
5934 | exports.scaleLinear = linear$2;
|
5935 | exports.scaleLog = log;
|
5936 | exports.scaleOrdinal = ordinal;
|
5937 | exports.scaleImplicit = implicit;
|
5938 | exports.scalePow = pow;
|
5939 | exports.scaleSqrt = sqrt;
|
5940 | exports.scaleQuantile = quantile$$1;
|
5941 | exports.scaleQuantize = quantize$1;
|
5942 | exports.scaleThreshold = threshold$1;
|
5943 | exports.scaleTime = time;
|
5944 | exports.scaleUtc = utcTime;
|
5945 | exports.schemeCategory10 = category10;
|
5946 | exports.schemeCategory20b = category20b;
|
5947 | exports.schemeCategory20c = category20c;
|
5948 | exports.schemeCategory20 = category20;
|
5949 | exports.interpolateCubehelixDefault = cubehelix$3;
|
5950 | exports.interpolateRainbow = rainbow$1;
|
5951 | exports.interpolateWarm = warm;
|
5952 | exports.interpolateCool = cool;
|
5953 | exports.interpolateViridis = viridis;
|
5954 | exports.interpolateMagma = magma;
|
5955 | exports.interpolateInferno = inferno;
|
5956 | exports.interpolatePlasma = plasma;
|
5957 | exports.scaleSequential = sequential;
|
5958 |
|
5959 | Object.defineProperty(exports, '__esModule', { value: true });
|
5960 |
|
5961 | })));
|