1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | (function webpackUniversalModuleDefinition(root, factory) {
|
14 | if(typeof exports === 'object' && typeof module === 'object')
|
15 | module.exports = factory();
|
16 | else if(typeof define === 'function' && define.amd)
|
17 | define([], factory);
|
18 | else {
|
19 | var a = factory();
|
20 | for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
21 | }
|
22 | })(this, function() {
|
23 | return (function(modules) {
|
24 |
|
25 | var installedModules = {};
|
26 |
|
27 |
|
28 | function __webpack_require__(moduleId) {
|
29 |
|
30 |
|
31 | if(installedModules[moduleId]) {
|
32 | return installedModules[moduleId].exports;
|
33 | }
|
34 |
|
35 | var module = installedModules[moduleId] = {
|
36 | i: moduleId,
|
37 | l: false,
|
38 | exports: {}
|
39 | };
|
40 |
|
41 |
|
42 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
43 |
|
44 |
|
45 | module.l = true;
|
46 |
|
47 |
|
48 | return module.exports;
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 | __webpack_require__.m = modules;
|
54 |
|
55 |
|
56 | __webpack_require__.c = installedModules;
|
57 |
|
58 |
|
59 | __webpack_require__.d = function(exports, name, getter) {
|
60 | if(!__webpack_require__.o(exports, name)) {
|
61 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
62 | }
|
63 | };
|
64 |
|
65 |
|
66 | __webpack_require__.r = function(exports) {
|
67 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
68 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
69 | }
|
70 | Object.defineProperty(exports, '__esModule', { value: true });
|
71 | };
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | __webpack_require__.t = function(value, mode) {
|
79 | if(mode & 1) value = __webpack_require__(value);
|
80 | if(mode & 8) return value;
|
81 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
82 | var ns = Object.create(null);
|
83 | __webpack_require__.r(ns);
|
84 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
85 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
86 | return ns;
|
87 | };
|
88 |
|
89 |
|
90 | __webpack_require__.n = function(module) {
|
91 | var getter = module && module.__esModule ?
|
92 | function getDefault() { return module['default']; } :
|
93 | function getModuleExports() { return module; };
|
94 | __webpack_require__.d(getter, 'a', getter);
|
95 | return getter;
|
96 | };
|
97 |
|
98 |
|
99 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
100 |
|
101 |
|
102 | __webpack_require__.p = "";
|
103 |
|
104 |
|
105 |
|
106 | return __webpack_require__(__webpack_require__.s = 13);
|
107 | })
|
108 |
|
109 | ([
|
110 |
|
111 | (function(module, exports) {
|
112 |
|
113 | function _classCallCheck(instance, Constructor) {
|
114 | if (!(instance instanceof Constructor)) {
|
115 | throw new TypeError("Cannot call a class as a function");
|
116 | }
|
117 | }
|
118 |
|
119 | module.exports = _classCallCheck;
|
120 |
|
121 | }),
|
122 |
|
123 | (function(module, exports, __webpack_require__) {
|
124 |
|
125 | var arrayWithHoles = __webpack_require__(2);
|
126 |
|
127 | var iterableToArrayLimit = __webpack_require__(3);
|
128 |
|
129 | var nonIterableRest = __webpack_require__(4);
|
130 |
|
131 | function _slicedToArray(arr, i) {
|
132 | return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();
|
133 | }
|
134 |
|
135 | module.exports = _slicedToArray;
|
136 |
|
137 | }),
|
138 |
|
139 | (function(module, exports) {
|
140 |
|
141 | function _arrayWithHoles(arr) {
|
142 | if (Array.isArray(arr)) return arr;
|
143 | }
|
144 |
|
145 | module.exports = _arrayWithHoles;
|
146 |
|
147 | }),
|
148 |
|
149 | (function(module, exports) {
|
150 |
|
151 | function _iterableToArrayLimit(arr, i) {
|
152 | var _arr = [];
|
153 | var _n = true;
|
154 | var _d = false;
|
155 | var _e = undefined;
|
156 |
|
157 | try {
|
158 | for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
159 | _arr.push(_s.value);
|
160 |
|
161 | if (i && _arr.length === i) break;
|
162 | }
|
163 | } catch (err) {
|
164 | _d = true;
|
165 | _e = err;
|
166 | } finally {
|
167 | try {
|
168 | if (!_n && _i["return"] != null) _i["return"]();
|
169 | } finally {
|
170 | if (_d) throw _e;
|
171 | }
|
172 | }
|
173 |
|
174 | return _arr;
|
175 | }
|
176 |
|
177 | module.exports = _iterableToArrayLimit;
|
178 |
|
179 | }),
|
180 |
|
181 | (function(module, exports) {
|
182 |
|
183 | function _nonIterableRest() {
|
184 | throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
185 | }
|
186 |
|
187 | module.exports = _nonIterableRest;
|
188 |
|
189 | }),
|
190 |
|
191 | (function(module, exports) {
|
192 |
|
193 | function _defineProperties(target, props) {
|
194 | for (var i = 0; i < props.length; i++) {
|
195 | var descriptor = props[i];
|
196 | descriptor.enumerable = descriptor.enumerable || false;
|
197 | descriptor.configurable = true;
|
198 | if ("value" in descriptor) descriptor.writable = true;
|
199 | Object.defineProperty(target, descriptor.key, descriptor);
|
200 | }
|
201 | }
|
202 |
|
203 | function _createClass(Constructor, protoProps, staticProps) {
|
204 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
205 | if (staticProps) _defineProperties(Constructor, staticProps);
|
206 | return Constructor;
|
207 | }
|
208 |
|
209 | module.exports = _createClass;
|
210 |
|
211 | }),
|
212 |
|
213 | (function(module, exports, __webpack_require__) {
|
214 |
|
215 | var arrayWithoutHoles = __webpack_require__(7);
|
216 |
|
217 | var iterableToArray = __webpack_require__(8);
|
218 |
|
219 | var nonIterableSpread = __webpack_require__(9);
|
220 |
|
221 | function _toConsumableArray(arr) {
|
222 | return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
|
223 | }
|
224 |
|
225 | module.exports = _toConsumableArray;
|
226 |
|
227 | }),
|
228 |
|
229 | (function(module, exports) {
|
230 |
|
231 | function _arrayWithoutHoles(arr) {
|
232 | if (Array.isArray(arr)) {
|
233 | for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
234 | arr2[i] = arr[i];
|
235 | }
|
236 |
|
237 | return arr2;
|
238 | }
|
239 | }
|
240 |
|
241 | module.exports = _arrayWithoutHoles;
|
242 |
|
243 | }),
|
244 |
|
245 | (function(module, exports) {
|
246 |
|
247 | function _iterableToArray(iter) {
|
248 | if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
249 | }
|
250 |
|
251 | module.exports = _iterableToArray;
|
252 |
|
253 | }),
|
254 |
|
255 | (function(module, exports) {
|
256 |
|
257 | function _nonIterableSpread() {
|
258 | throw new TypeError("Invalid attempt to spread non-iterable instance");
|
259 | }
|
260 |
|
261 | module.exports = _nonIterableSpread;
|
262 |
|
263 | }),
|
264 |
|
265 | (function(module, exports) {
|
266 |
|
267 | function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
|
268 |
|
269 | function _typeof(obj) {
|
270 | if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
|
271 | module.exports = _typeof = function _typeof(obj) {
|
272 | return _typeof2(obj);
|
273 | };
|
274 | } else {
|
275 | module.exports = _typeof = function _typeof(obj) {
|
276 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
|
277 | };
|
278 | }
|
279 |
|
280 | return _typeof(obj);
|
281 | }
|
282 |
|
283 | module.exports = _typeof;
|
284 |
|
285 | }),
|
286 |
|
287 | (function(module, __webpack_exports__, __webpack_require__) {
|
288 |
|
289 | "use strict";
|
290 | __webpack_require__.r(__webpack_exports__);
|
291 | (function(global) { __webpack_require__.d(__webpack_exports__, "window", function() { return win; });
|
292 | __webpack_require__.d(__webpack_exports__, "document", function() { return doc; });
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 | var win = function () {
|
306 | var def = function (o) {
|
307 | return typeof o !== "undefined" && o;
|
308 | };
|
309 |
|
310 | return def(self) || def(window) || def(global) || def(globalThis) || Function("return this")();
|
311 | }(),
|
312 | doc = win && win.document;
|
313 |
|
314 |
|
315 |
|
316 |
|
317 | }.call(this, __webpack_require__(12)))
|
318 |
|
319 | }),
|
320 |
|
321 | (function(module, exports) {
|
322 |
|
323 | var g;
|
324 |
|
325 |
|
326 | g = (function() {
|
327 | return this;
|
328 | })();
|
329 |
|
330 | try {
|
331 |
|
332 | g = g || new Function("return this")();
|
333 | } catch (e) {
|
334 |
|
335 | if (typeof window === "object") g = window;
|
336 | }
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 | module.exports = g;
|
343 |
|
344 |
|
345 | }),
|
346 |
|
347 | (function(module, __webpack_exports__, __webpack_require__) {
|
348 |
|
349 | "use strict";
|
350 | __webpack_require__.r(__webpack_exports__);
|
351 |
|
352 |
|
353 | var classCallCheck = __webpack_require__(0);
|
354 | var classCallCheck_default = __webpack_require__.n(classCallCheck);
|
355 |
|
356 |
|
357 | var slicedToArray = __webpack_require__(1);
|
358 | var slicedToArray_default = __webpack_require__.n(slicedToArray);
|
359 |
|
360 |
|
361 | var createClass = __webpack_require__(5);
|
362 | var createClass_default = __webpack_require__.n(createClass);
|
363 |
|
364 |
|
365 | var interval_t0 = new Date,
|
366 | interval_t1 = new Date;
|
367 |
|
368 | function newInterval(floori, offseti, count, field) {
|
369 |
|
370 | function interval(date) {
|
371 | return floori(date = new Date(+date)), date;
|
372 | }
|
373 |
|
374 | interval.floor = interval;
|
375 |
|
376 | interval.ceil = function(date) {
|
377 | return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
|
378 | };
|
379 |
|
380 | interval.round = function(date) {
|
381 | var d0 = interval(date),
|
382 | d1 = interval.ceil(date);
|
383 | return date - d0 < d1 - date ? d0 : d1;
|
384 | };
|
385 |
|
386 | interval.offset = function(date, step) {
|
387 | return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
|
388 | };
|
389 |
|
390 | interval.range = function(start, stop, step) {
|
391 | var range = [], previous;
|
392 | start = interval.ceil(start);
|
393 | step = step == null ? 1 : Math.floor(step);
|
394 | if (!(start < stop) || !(step > 0)) return range;
|
395 | do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
|
396 | while (previous < start && start < stop);
|
397 | return range;
|
398 | };
|
399 |
|
400 | interval.filter = function(test) {
|
401 | return newInterval(function(date) {
|
402 | if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
|
403 | }, function(date, step) {
|
404 | if (date >= date) {
|
405 | if (step < 0) while (++step <= 0) {
|
406 | while (offseti(date, -1), !test(date)) {}
|
407 | } else while (--step >= 0) {
|
408 | while (offseti(date, +1), !test(date)) {}
|
409 | }
|
410 | }
|
411 | });
|
412 | };
|
413 |
|
414 | if (count) {
|
415 | interval.count = function(start, end) {
|
416 | interval_t0.setTime(+start), interval_t1.setTime(+end);
|
417 | floori(interval_t0), floori(interval_t1);
|
418 | return Math.floor(count(interval_t0, interval_t1));
|
419 | };
|
420 |
|
421 | interval.every = function(step) {
|
422 | step = Math.floor(step);
|
423 | return !isFinite(step) || !(step > 0) ? null
|
424 | : !(step > 1) ? interval
|
425 | : interval.filter(field
|
426 | ? function(d) { return field(d) % step === 0; }
|
427 | : function(d) { return interval.count(0, d) % step === 0; });
|
428 | };
|
429 | }
|
430 |
|
431 | return interval;
|
432 | }
|
433 |
|
434 |
|
435 |
|
436 |
|
437 | var millisecond_millisecond = newInterval(function() {
|
438 |
|
439 | }, function(date, step) {
|
440 | date.setTime(+date + step);
|
441 | }, function(start, end) {
|
442 | return end - start;
|
443 | });
|
444 |
|
445 |
|
446 | millisecond_millisecond.every = function(k) {
|
447 | k = Math.floor(k);
|
448 | if (!isFinite(k) || !(k > 0)) return null;
|
449 | if (!(k > 1)) return millisecond_millisecond;
|
450 | return newInterval(function(date) {
|
451 | date.setTime(Math.floor(date / k) * k);
|
452 | }, function(date, step) {
|
453 | date.setTime(+date + step * k);
|
454 | }, function(start, end) {
|
455 | return (end - start) / k;
|
456 | });
|
457 | };
|
458 |
|
459 | var src_millisecond = (millisecond_millisecond);
|
460 | var milliseconds = millisecond_millisecond.range;
|
461 |
|
462 |
|
463 | var durationSecond = 1e3;
|
464 | var durationMinute = 6e4;
|
465 | var durationHour = 36e5;
|
466 | var durationDay = 864e5;
|
467 | var durationWeek = 6048e5;
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | var second_second = newInterval(function(date) {
|
474 | date.setTime(date - date.getMilliseconds());
|
475 | }, function(date, step) {
|
476 | date.setTime(+date + step * durationSecond);
|
477 | }, function(start, end) {
|
478 | return (end - start) / durationSecond;
|
479 | }, function(date) {
|
480 | return date.getUTCSeconds();
|
481 | });
|
482 |
|
483 | var src_second = (second_second);
|
484 | var seconds = second_second.range;
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | var minute_minute = newInterval(function(date) {
|
491 | date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
|
492 | }, function(date, step) {
|
493 | date.setTime(+date + step * durationMinute);
|
494 | }, function(start, end) {
|
495 | return (end - start) / durationMinute;
|
496 | }, function(date) {
|
497 | return date.getMinutes();
|
498 | });
|
499 |
|
500 | var src_minute = (minute_minute);
|
501 | var minutes = minute_minute.range;
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 | var hour_hour = newInterval(function(date) {
|
508 | date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
|
509 | }, function(date, step) {
|
510 | date.setTime(+date + step * durationHour);
|
511 | }, function(start, end) {
|
512 | return (end - start) / durationHour;
|
513 | }, function(date) {
|
514 | return date.getHours();
|
515 | });
|
516 |
|
517 | var src_hour = (hour_hour);
|
518 | var hours = hour_hour.range;
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 | var day_day = newInterval(function(date) {
|
525 | date.setHours(0, 0, 0, 0);
|
526 | }, function(date, step) {
|
527 | date.setDate(date.getDate() + step);
|
528 | }, function(start, end) {
|
529 | return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;
|
530 | }, function(date) {
|
531 | return date.getDate() - 1;
|
532 | });
|
533 |
|
534 | var src_day = (day_day);
|
535 | var days = day_day.range;
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 | function weekday(i) {
|
542 | return newInterval(function(date) {
|
543 | date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
|
544 | date.setHours(0, 0, 0, 0);
|
545 | }, function(date, step) {
|
546 | date.setDate(date.getDate() + step * 7);
|
547 | }, function(start, end) {
|
548 | return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
|
549 | });
|
550 | }
|
551 |
|
552 | var sunday = weekday(0);
|
553 | var monday = weekday(1);
|
554 | var tuesday = weekday(2);
|
555 | var wednesday = weekday(3);
|
556 | var thursday = weekday(4);
|
557 | var friday = weekday(5);
|
558 | var saturday = weekday(6);
|
559 |
|
560 | var sundays = sunday.range;
|
561 | var mondays = monday.range;
|
562 | var tuesdays = tuesday.range;
|
563 | var wednesdays = wednesday.range;
|
564 | var thursdays = thursday.range;
|
565 | var fridays = friday.range;
|
566 | var saturdays = saturday.range;
|
567 |
|
568 |
|
569 |
|
570 |
|
571 | var month_month = newInterval(function(date) {
|
572 | date.setDate(1);
|
573 | date.setHours(0, 0, 0, 0);
|
574 | }, function(date, step) {
|
575 | date.setMonth(date.getMonth() + step);
|
576 | }, function(start, end) {
|
577 | return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
|
578 | }, function(date) {
|
579 | return date.getMonth();
|
580 | });
|
581 |
|
582 | var src_month = (month_month);
|
583 | var months = month_month.range;
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | var year_year = newInterval(function(date) {
|
589 | date.setMonth(0, 1);
|
590 | date.setHours(0, 0, 0, 0);
|
591 | }, function(date, step) {
|
592 | date.setFullYear(date.getFullYear() + step);
|
593 | }, function(start, end) {
|
594 | return end.getFullYear() - start.getFullYear();
|
595 | }, function(date) {
|
596 | return date.getFullYear();
|
597 | });
|
598 |
|
599 |
|
600 | year_year.every = function(k) {
|
601 | return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
|
602 | date.setFullYear(Math.floor(date.getFullYear() / k) * k);
|
603 | date.setMonth(0, 1);
|
604 | date.setHours(0, 0, 0, 0);
|
605 | }, function(date, step) {
|
606 | date.setFullYear(date.getFullYear() + step * k);
|
607 | });
|
608 | };
|
609 |
|
610 | var src_year = (year_year);
|
611 | var years = year_year.range;
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 | var utcMinute = newInterval(function(date) {
|
618 | date.setUTCSeconds(0, 0);
|
619 | }, function(date, step) {
|
620 | date.setTime(+date + step * durationMinute);
|
621 | }, function(start, end) {
|
622 | return (end - start) / durationMinute;
|
623 | }, function(date) {
|
624 | return date.getUTCMinutes();
|
625 | });
|
626 |
|
627 | var src_utcMinute = (utcMinute);
|
628 | var utcMinutes = utcMinute.range;
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 | var utcHour = newInterval(function(date) {
|
635 | date.setUTCMinutes(0, 0, 0);
|
636 | }, function(date, step) {
|
637 | date.setTime(+date + step * durationHour);
|
638 | }, function(start, end) {
|
639 | return (end - start) / durationHour;
|
640 | }, function(date) {
|
641 | return date.getUTCHours();
|
642 | });
|
643 |
|
644 | var src_utcHour = (utcHour);
|
645 | var utcHours = utcHour.range;
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | var utcDay = newInterval(function(date) {
|
652 | date.setUTCHours(0, 0, 0, 0);
|
653 | }, function(date, step) {
|
654 | date.setUTCDate(date.getUTCDate() + step);
|
655 | }, function(start, end) {
|
656 | return (end - start) / durationDay;
|
657 | }, function(date) {
|
658 | return date.getUTCDate() - 1;
|
659 | });
|
660 |
|
661 | var src_utcDay = (utcDay);
|
662 | var utcDays = utcDay.range;
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 | function utcWeekday(i) {
|
669 | return newInterval(function(date) {
|
670 | date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
|
671 | date.setUTCHours(0, 0, 0, 0);
|
672 | }, function(date, step) {
|
673 | date.setUTCDate(date.getUTCDate() + step * 7);
|
674 | }, function(start, end) {
|
675 | return (end - start) / durationWeek;
|
676 | });
|
677 | }
|
678 |
|
679 | var utcSunday = utcWeekday(0);
|
680 | var utcMonday = utcWeekday(1);
|
681 | var utcTuesday = utcWeekday(2);
|
682 | var utcWednesday = utcWeekday(3);
|
683 | var utcThursday = utcWeekday(4);
|
684 | var utcFriday = utcWeekday(5);
|
685 | var utcSaturday = utcWeekday(6);
|
686 |
|
687 | var utcSundays = utcSunday.range;
|
688 | var utcMondays = utcMonday.range;
|
689 | var utcTuesdays = utcTuesday.range;
|
690 | var utcWednesdays = utcWednesday.range;
|
691 | var utcThursdays = utcThursday.range;
|
692 | var utcFridays = utcFriday.range;
|
693 | var utcSaturdays = utcSaturday.range;
|
694 |
|
695 |
|
696 |
|
697 |
|
698 | var utcMonth = newInterval(function(date) {
|
699 | date.setUTCDate(1);
|
700 | date.setUTCHours(0, 0, 0, 0);
|
701 | }, function(date, step) {
|
702 | date.setUTCMonth(date.getUTCMonth() + step);
|
703 | }, function(start, end) {
|
704 | return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
|
705 | }, function(date) {
|
706 | return date.getUTCMonth();
|
707 | });
|
708 |
|
709 | var src_utcMonth = (utcMonth);
|
710 | var utcMonths = utcMonth.range;
|
711 |
|
712 |
|
713 |
|
714 |
|
715 | var utcYear = newInterval(function(date) {
|
716 | date.setUTCMonth(0, 1);
|
717 | date.setUTCHours(0, 0, 0, 0);
|
718 | }, function(date, step) {
|
719 | date.setUTCFullYear(date.getUTCFullYear() + step);
|
720 | }, function(start, end) {
|
721 | return end.getUTCFullYear() - start.getUTCFullYear();
|
722 | }, function(date) {
|
723 | return date.getUTCFullYear();
|
724 | });
|
725 |
|
726 |
|
727 | utcYear.every = function(k) {
|
728 | return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
|
729 | date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
|
730 | date.setUTCMonth(0, 1);
|
731 | date.setUTCHours(0, 0, 0, 0);
|
732 | }, function(date, step) {
|
733 | date.setUTCFullYear(date.getUTCFullYear() + step * k);
|
734 | });
|
735 | };
|
736 |
|
737 | var src_utcYear = (utcYear);
|
738 | var utcYears = utcYear.range;
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 | function localDate(d) {
|
775 | if (0 <= d.y && d.y < 100) {
|
776 | var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
|
777 | date.setFullYear(d.y);
|
778 | return date;
|
779 | }
|
780 | return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
|
781 | }
|
782 |
|
783 | function utcDate(d) {
|
784 | if (0 <= d.y && d.y < 100) {
|
785 | var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
|
786 | date.setUTCFullYear(d.y);
|
787 | return date;
|
788 | }
|
789 | return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
|
790 | }
|
791 |
|
792 | function newYear(y) {
|
793 | return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};
|
794 | }
|
795 |
|
796 | function formatLocale(locale) {
|
797 | var locale_dateTime = locale.dateTime,
|
798 | locale_date = locale.date,
|
799 | locale_time = locale.time,
|
800 | locale_periods = locale.periods,
|
801 | locale_weekdays = locale.days,
|
802 | locale_shortWeekdays = locale.shortDays,
|
803 | locale_months = locale.months,
|
804 | locale_shortMonths = locale.shortMonths;
|
805 |
|
806 | var periodRe = formatRe(locale_periods),
|
807 | periodLookup = formatLookup(locale_periods),
|
808 | weekdayRe = formatRe(locale_weekdays),
|
809 | weekdayLookup = formatLookup(locale_weekdays),
|
810 | shortWeekdayRe = formatRe(locale_shortWeekdays),
|
811 | shortWeekdayLookup = formatLookup(locale_shortWeekdays),
|
812 | monthRe = formatRe(locale_months),
|
813 | monthLookup = formatLookup(locale_months),
|
814 | shortMonthRe = formatRe(locale_shortMonths),
|
815 | shortMonthLookup = formatLookup(locale_shortMonths);
|
816 |
|
817 | var formats = {
|
818 | "a": formatShortWeekday,
|
819 | "A": formatWeekday,
|
820 | "b": formatShortMonth,
|
821 | "B": formatMonth,
|
822 | "c": null,
|
823 | "d": formatDayOfMonth,
|
824 | "e": formatDayOfMonth,
|
825 | "f": formatMicroseconds,
|
826 | "H": formatHour24,
|
827 | "I": formatHour12,
|
828 | "j": formatDayOfYear,
|
829 | "L": formatMilliseconds,
|
830 | "m": formatMonthNumber,
|
831 | "M": formatMinutes,
|
832 | "p": formatPeriod,
|
833 | "Q": formatUnixTimestamp,
|
834 | "s": formatUnixTimestampSeconds,
|
835 | "S": formatSeconds,
|
836 | "u": formatWeekdayNumberMonday,
|
837 | "U": formatWeekNumberSunday,
|
838 | "V": formatWeekNumberISO,
|
839 | "w": formatWeekdayNumberSunday,
|
840 | "W": formatWeekNumberMonday,
|
841 | "x": null,
|
842 | "X": null,
|
843 | "y": locale_formatYear,
|
844 | "Y": formatFullYear,
|
845 | "Z": formatZone,
|
846 | "%": formatLiteralPercent
|
847 | };
|
848 |
|
849 | var utcFormats = {
|
850 | "a": formatUTCShortWeekday,
|
851 | "A": formatUTCWeekday,
|
852 | "b": formatUTCShortMonth,
|
853 | "B": formatUTCMonth,
|
854 | "c": null,
|
855 | "d": formatUTCDayOfMonth,
|
856 | "e": formatUTCDayOfMonth,
|
857 | "f": formatUTCMicroseconds,
|
858 | "H": formatUTCHour24,
|
859 | "I": formatUTCHour12,
|
860 | "j": formatUTCDayOfYear,
|
861 | "L": formatUTCMilliseconds,
|
862 | "m": formatUTCMonthNumber,
|
863 | "M": formatUTCMinutes,
|
864 | "p": formatUTCPeriod,
|
865 | "Q": formatUnixTimestamp,
|
866 | "s": formatUnixTimestampSeconds,
|
867 | "S": formatUTCSeconds,
|
868 | "u": formatUTCWeekdayNumberMonday,
|
869 | "U": formatUTCWeekNumberSunday,
|
870 | "V": formatUTCWeekNumberISO,
|
871 | "w": formatUTCWeekdayNumberSunday,
|
872 | "W": formatUTCWeekNumberMonday,
|
873 | "x": null,
|
874 | "X": null,
|
875 | "y": formatUTCYear,
|
876 | "Y": formatUTCFullYear,
|
877 | "Z": formatUTCZone,
|
878 | "%": formatLiteralPercent
|
879 | };
|
880 |
|
881 | var parses = {
|
882 | "a": parseShortWeekday,
|
883 | "A": parseWeekday,
|
884 | "b": parseShortMonth,
|
885 | "B": parseMonth,
|
886 | "c": parseLocaleDateTime,
|
887 | "d": parseDayOfMonth,
|
888 | "e": parseDayOfMonth,
|
889 | "f": parseMicroseconds,
|
890 | "H": parseHour24,
|
891 | "I": parseHour24,
|
892 | "j": parseDayOfYear,
|
893 | "L": parseMilliseconds,
|
894 | "m": parseMonthNumber,
|
895 | "M": parseMinutes,
|
896 | "p": parsePeriod,
|
897 | "Q": parseUnixTimestamp,
|
898 | "s": parseUnixTimestampSeconds,
|
899 | "S": parseSeconds,
|
900 | "u": parseWeekdayNumberMonday,
|
901 | "U": parseWeekNumberSunday,
|
902 | "V": parseWeekNumberISO,
|
903 | "w": parseWeekdayNumberSunday,
|
904 | "W": parseWeekNumberMonday,
|
905 | "x": parseLocaleDate,
|
906 | "X": parseLocaleTime,
|
907 | "y": parseYear,
|
908 | "Y": parseFullYear,
|
909 | "Z": parseZone,
|
910 | "%": parseLiteralPercent
|
911 | };
|
912 |
|
913 |
|
914 | formats.x = newFormat(locale_date, formats);
|
915 | formats.X = newFormat(locale_time, formats);
|
916 | formats.c = newFormat(locale_dateTime, formats);
|
917 | utcFormats.x = newFormat(locale_date, utcFormats);
|
918 | utcFormats.X = newFormat(locale_time, utcFormats);
|
919 | utcFormats.c = newFormat(locale_dateTime, utcFormats);
|
920 |
|
921 | function newFormat(specifier, formats) {
|
922 | return function(date) {
|
923 | var string = [],
|
924 | i = -1,
|
925 | j = 0,
|
926 | n = specifier.length,
|
927 | c,
|
928 | pad,
|
929 | format;
|
930 |
|
931 | if (!(date instanceof Date)) date = new Date(+date);
|
932 |
|
933 | while (++i < n) {
|
934 | if (specifier.charCodeAt(i) === 37) {
|
935 | string.push(specifier.slice(j, i));
|
936 | if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
|
937 | else pad = c === "e" ? " " : "0";
|
938 | if (format = formats[c]) c = format(date, pad);
|
939 | string.push(c);
|
940 | j = i + 1;
|
941 | }
|
942 | }
|
943 |
|
944 | string.push(specifier.slice(j, i));
|
945 | return string.join("");
|
946 | };
|
947 | }
|
948 |
|
949 | function newParse(specifier, newDate) {
|
950 | return function(string) {
|
951 | var d = newYear(1900),
|
952 | i = parseSpecifier(d, specifier, string += "", 0),
|
953 | week, day;
|
954 | if (i != string.length) return null;
|
955 |
|
956 |
|
957 | if ("Q" in d) return new Date(d.Q);
|
958 |
|
959 |
|
960 | if ("p" in d) d.H = d.H % 12 + d.p * 12;
|
961 |
|
962 |
|
963 | if ("V" in d) {
|
964 | if (d.V < 1 || d.V > 53) return null;
|
965 | if (!("w" in d)) d.w = 1;
|
966 | if ("Z" in d) {
|
967 | week = utcDate(newYear(d.y)), day = week.getUTCDay();
|
968 | week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
|
969 | week = src_utcDay.offset(week, (d.V - 1) * 7);
|
970 | d.y = week.getUTCFullYear();
|
971 | d.m = week.getUTCMonth();
|
972 | d.d = week.getUTCDate() + (d.w + 6) % 7;
|
973 | } else {
|
974 | week = newDate(newYear(d.y)), day = week.getDay();
|
975 | week = day > 4 || day === 0 ? monday.ceil(week) : monday(week);
|
976 | week = src_day.offset(week, (d.V - 1) * 7);
|
977 | d.y = week.getFullYear();
|
978 | d.m = week.getMonth();
|
979 | d.d = week.getDate() + (d.w + 6) % 7;
|
980 | }
|
981 | } else if ("W" in d || "U" in d) {
|
982 | if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
|
983 | day = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
|
984 | d.m = 0;
|
985 | d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
|
986 | }
|
987 |
|
988 |
|
989 |
|
990 | if ("Z" in d) {
|
991 | d.H += d.Z / 100 | 0;
|
992 | d.M += d.Z % 100;
|
993 | return utcDate(d);
|
994 | }
|
995 |
|
996 |
|
997 | return newDate(d);
|
998 | };
|
999 | }
|
1000 |
|
1001 | function parseSpecifier(d, specifier, string, j) {
|
1002 | var i = 0,
|
1003 | n = specifier.length,
|
1004 | m = string.length,
|
1005 | c,
|
1006 | parse;
|
1007 |
|
1008 | while (i < n) {
|
1009 | if (j >= m) return -1;
|
1010 | c = specifier.charCodeAt(i++);
|
1011 | if (c === 37) {
|
1012 | c = specifier.charAt(i++);
|
1013 | parse = parses[c in pads ? specifier.charAt(i++) : c];
|
1014 | if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
|
1015 | } else if (c != string.charCodeAt(j++)) {
|
1016 | return -1;
|
1017 | }
|
1018 | }
|
1019 |
|
1020 | return j;
|
1021 | }
|
1022 |
|
1023 | function parsePeriod(d, string, i) {
|
1024 | var n = periodRe.exec(string.slice(i));
|
1025 | return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
1026 | }
|
1027 |
|
1028 | function parseShortWeekday(d, string, i) {
|
1029 | var n = shortWeekdayRe.exec(string.slice(i));
|
1030 | return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
1031 | }
|
1032 |
|
1033 | function parseWeekday(d, string, i) {
|
1034 | var n = weekdayRe.exec(string.slice(i));
|
1035 | return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
1036 | }
|
1037 |
|
1038 | function parseShortMonth(d, string, i) {
|
1039 | var n = shortMonthRe.exec(string.slice(i));
|
1040 | return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
1041 | }
|
1042 |
|
1043 | function parseMonth(d, string, i) {
|
1044 | var n = monthRe.exec(string.slice(i));
|
1045 | return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
1046 | }
|
1047 |
|
1048 | function parseLocaleDateTime(d, string, i) {
|
1049 | return parseSpecifier(d, locale_dateTime, string, i);
|
1050 | }
|
1051 |
|
1052 | function parseLocaleDate(d, string, i) {
|
1053 | return parseSpecifier(d, locale_date, string, i);
|
1054 | }
|
1055 |
|
1056 | function parseLocaleTime(d, string, i) {
|
1057 | return parseSpecifier(d, locale_time, string, i);
|
1058 | }
|
1059 |
|
1060 | function formatShortWeekday(d) {
|
1061 | return locale_shortWeekdays[d.getDay()];
|
1062 | }
|
1063 |
|
1064 | function formatWeekday(d) {
|
1065 | return locale_weekdays[d.getDay()];
|
1066 | }
|
1067 |
|
1068 | function formatShortMonth(d) {
|
1069 | return locale_shortMonths[d.getMonth()];
|
1070 | }
|
1071 |
|
1072 | function formatMonth(d) {
|
1073 | return locale_months[d.getMonth()];
|
1074 | }
|
1075 |
|
1076 | function formatPeriod(d) {
|
1077 | return locale_periods[+(d.getHours() >= 12)];
|
1078 | }
|
1079 |
|
1080 | function formatUTCShortWeekday(d) {
|
1081 | return locale_shortWeekdays[d.getUTCDay()];
|
1082 | }
|
1083 |
|
1084 | function formatUTCWeekday(d) {
|
1085 | return locale_weekdays[d.getUTCDay()];
|
1086 | }
|
1087 |
|
1088 | function formatUTCShortMonth(d) {
|
1089 | return locale_shortMonths[d.getUTCMonth()];
|
1090 | }
|
1091 |
|
1092 | function formatUTCMonth(d) {
|
1093 | return locale_months[d.getUTCMonth()];
|
1094 | }
|
1095 |
|
1096 | function formatUTCPeriod(d) {
|
1097 | return locale_periods[+(d.getUTCHours() >= 12)];
|
1098 | }
|
1099 |
|
1100 | return {
|
1101 | format: function(specifier) {
|
1102 | var f = newFormat(specifier += "", formats);
|
1103 | f.toString = function() { return specifier; };
|
1104 | return f;
|
1105 | },
|
1106 | parse: function(specifier) {
|
1107 | var p = newParse(specifier += "", localDate);
|
1108 | p.toString = function() { return specifier; };
|
1109 | return p;
|
1110 | },
|
1111 | utcFormat: function(specifier) {
|
1112 | var f = newFormat(specifier += "", utcFormats);
|
1113 | f.toString = function() { return specifier; };
|
1114 | return f;
|
1115 | },
|
1116 | utcParse: function(specifier) {
|
1117 | var p = newParse(specifier, utcDate);
|
1118 | p.toString = function() { return specifier; };
|
1119 | return p;
|
1120 | }
|
1121 | };
|
1122 | }
|
1123 |
|
1124 | var pads = {"-": "", "_": " ", "0": "0"},
|
1125 | numberRe = /^\s*\d+/,
|
1126 | percentRe = /^%/,
|
1127 | requoteRe = /[\\^$*+?|[\]().{}]/g;
|
1128 |
|
1129 | function pad(value, fill, width) {
|
1130 | var sign = value < 0 ? "-" : "",
|
1131 | string = (sign ? -value : value) + "",
|
1132 | length = string.length;
|
1133 | return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
|
1134 | }
|
1135 |
|
1136 | function requote(s) {
|
1137 | return s.replace(requoteRe, "\\$&");
|
1138 | }
|
1139 |
|
1140 | function formatRe(names) {
|
1141 | return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
|
1142 | }
|
1143 |
|
1144 | function formatLookup(names) {
|
1145 | var map = {}, i = -1, n = names.length;
|
1146 | while (++i < n) map[names[i].toLowerCase()] = i;
|
1147 | return map;
|
1148 | }
|
1149 |
|
1150 | function parseWeekdayNumberSunday(d, string, i) {
|
1151 | var n = numberRe.exec(string.slice(i, i + 1));
|
1152 | return n ? (d.w = +n[0], i + n[0].length) : -1;
|
1153 | }
|
1154 |
|
1155 | function parseWeekdayNumberMonday(d, string, i) {
|
1156 | var n = numberRe.exec(string.slice(i, i + 1));
|
1157 | return n ? (d.u = +n[0], i + n[0].length) : -1;
|
1158 | }
|
1159 |
|
1160 | function parseWeekNumberSunday(d, string, i) {
|
1161 | var n = numberRe.exec(string.slice(i, i + 2));
|
1162 | return n ? (d.U = +n[0], i + n[0].length) : -1;
|
1163 | }
|
1164 |
|
1165 | function parseWeekNumberISO(d, string, i) {
|
1166 | var n = numberRe.exec(string.slice(i, i + 2));
|
1167 | return n ? (d.V = +n[0], i + n[0].length) : -1;
|
1168 | }
|
1169 |
|
1170 | function parseWeekNumberMonday(d, string, i) {
|
1171 | var n = numberRe.exec(string.slice(i, i + 2));
|
1172 | return n ? (d.W = +n[0], i + n[0].length) : -1;
|
1173 | }
|
1174 |
|
1175 | function parseFullYear(d, string, i) {
|
1176 | var n = numberRe.exec(string.slice(i, i + 4));
|
1177 | return n ? (d.y = +n[0], i + n[0].length) : -1;
|
1178 | }
|
1179 |
|
1180 | function parseYear(d, string, i) {
|
1181 | var n = numberRe.exec(string.slice(i, i + 2));
|
1182 | return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
|
1183 | }
|
1184 |
|
1185 | function parseZone(d, string, i) {
|
1186 | var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
|
1187 | return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
|
1188 | }
|
1189 |
|
1190 | function parseMonthNumber(d, string, i) {
|
1191 | var n = numberRe.exec(string.slice(i, i + 2));
|
1192 | return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
|
1193 | }
|
1194 |
|
1195 | function parseDayOfMonth(d, string, i) {
|
1196 | var n = numberRe.exec(string.slice(i, i + 2));
|
1197 | return n ? (d.d = +n[0], i + n[0].length) : -1;
|
1198 | }
|
1199 |
|
1200 | function parseDayOfYear(d, string, i) {
|
1201 | var n = numberRe.exec(string.slice(i, i + 3));
|
1202 | return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
|
1203 | }
|
1204 |
|
1205 | function parseHour24(d, string, i) {
|
1206 | var n = numberRe.exec(string.slice(i, i + 2));
|
1207 | return n ? (d.H = +n[0], i + n[0].length) : -1;
|
1208 | }
|
1209 |
|
1210 | function parseMinutes(d, string, i) {
|
1211 | var n = numberRe.exec(string.slice(i, i + 2));
|
1212 | return n ? (d.M = +n[0], i + n[0].length) : -1;
|
1213 | }
|
1214 |
|
1215 | function parseSeconds(d, string, i) {
|
1216 | var n = numberRe.exec(string.slice(i, i + 2));
|
1217 | return n ? (d.S = +n[0], i + n[0].length) : -1;
|
1218 | }
|
1219 |
|
1220 | function parseMilliseconds(d, string, i) {
|
1221 | var n = numberRe.exec(string.slice(i, i + 3));
|
1222 | return n ? (d.L = +n[0], i + n[0].length) : -1;
|
1223 | }
|
1224 |
|
1225 | function parseMicroseconds(d, string, i) {
|
1226 | var n = numberRe.exec(string.slice(i, i + 6));
|
1227 | return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
|
1228 | }
|
1229 |
|
1230 | function parseLiteralPercent(d, string, i) {
|
1231 | var n = percentRe.exec(string.slice(i, i + 1));
|
1232 | return n ? i + n[0].length : -1;
|
1233 | }
|
1234 |
|
1235 | function parseUnixTimestamp(d, string, i) {
|
1236 | var n = numberRe.exec(string.slice(i));
|
1237 | return n ? (d.Q = +n[0], i + n[0].length) : -1;
|
1238 | }
|
1239 |
|
1240 | function parseUnixTimestampSeconds(d, string, i) {
|
1241 | var n = numberRe.exec(string.slice(i));
|
1242 | return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1;
|
1243 | }
|
1244 |
|
1245 | function formatDayOfMonth(d, p) {
|
1246 | return pad(d.getDate(), p, 2);
|
1247 | }
|
1248 |
|
1249 | function formatHour24(d, p) {
|
1250 | return pad(d.getHours(), p, 2);
|
1251 | }
|
1252 |
|
1253 | function formatHour12(d, p) {
|
1254 | return pad(d.getHours() % 12 || 12, p, 2);
|
1255 | }
|
1256 |
|
1257 | function formatDayOfYear(d, p) {
|
1258 | return pad(1 + src_day.count(src_year(d), d), p, 3);
|
1259 | }
|
1260 |
|
1261 | function formatMilliseconds(d, p) {
|
1262 | return pad(d.getMilliseconds(), p, 3);
|
1263 | }
|
1264 |
|
1265 | function formatMicroseconds(d, p) {
|
1266 | return formatMilliseconds(d, p) + "000";
|
1267 | }
|
1268 |
|
1269 | function formatMonthNumber(d, p) {
|
1270 | return pad(d.getMonth() + 1, p, 2);
|
1271 | }
|
1272 |
|
1273 | function formatMinutes(d, p) {
|
1274 | return pad(d.getMinutes(), p, 2);
|
1275 | }
|
1276 |
|
1277 | function formatSeconds(d, p) {
|
1278 | return pad(d.getSeconds(), p, 2);
|
1279 | }
|
1280 |
|
1281 | function formatWeekdayNumberMonday(d) {
|
1282 | var day = d.getDay();
|
1283 | return day === 0 ? 7 : day;
|
1284 | }
|
1285 |
|
1286 | function formatWeekNumberSunday(d, p) {
|
1287 | return pad(sunday.count(src_year(d), d), p, 2);
|
1288 | }
|
1289 |
|
1290 | function formatWeekNumberISO(d, p) {
|
1291 | var day = d.getDay();
|
1292 | d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
|
1293 | return pad(thursday.count(src_year(d), d) + (src_year(d).getDay() === 4), p, 2);
|
1294 | }
|
1295 |
|
1296 | function formatWeekdayNumberSunday(d) {
|
1297 | return d.getDay();
|
1298 | }
|
1299 |
|
1300 | function formatWeekNumberMonday(d, p) {
|
1301 | return pad(monday.count(src_year(d), d), p, 2);
|
1302 | }
|
1303 |
|
1304 | function locale_formatYear(d, p) {
|
1305 | return pad(d.getFullYear() % 100, p, 2);
|
1306 | }
|
1307 |
|
1308 | function formatFullYear(d, p) {
|
1309 | return pad(d.getFullYear() % 10000, p, 4);
|
1310 | }
|
1311 |
|
1312 | function formatZone(d) {
|
1313 | var z = d.getTimezoneOffset();
|
1314 | return (z > 0 ? "-" : (z *= -1, "+"))
|
1315 | + pad(z / 60 | 0, "0", 2)
|
1316 | + pad(z % 60, "0", 2);
|
1317 | }
|
1318 |
|
1319 | function formatUTCDayOfMonth(d, p) {
|
1320 | return pad(d.getUTCDate(), p, 2);
|
1321 | }
|
1322 |
|
1323 | function formatUTCHour24(d, p) {
|
1324 | return pad(d.getUTCHours(), p, 2);
|
1325 | }
|
1326 |
|
1327 | function formatUTCHour12(d, p) {
|
1328 | return pad(d.getUTCHours() % 12 || 12, p, 2);
|
1329 | }
|
1330 |
|
1331 | function formatUTCDayOfYear(d, p) {
|
1332 | return pad(1 + src_utcDay.count(src_utcYear(d), d), p, 3);
|
1333 | }
|
1334 |
|
1335 | function formatUTCMilliseconds(d, p) {
|
1336 | return pad(d.getUTCMilliseconds(), p, 3);
|
1337 | }
|
1338 |
|
1339 | function formatUTCMicroseconds(d, p) {
|
1340 | return formatUTCMilliseconds(d, p) + "000";
|
1341 | }
|
1342 |
|
1343 | function formatUTCMonthNumber(d, p) {
|
1344 | return pad(d.getUTCMonth() + 1, p, 2);
|
1345 | }
|
1346 |
|
1347 | function formatUTCMinutes(d, p) {
|
1348 | return pad(d.getUTCMinutes(), p, 2);
|
1349 | }
|
1350 |
|
1351 | function formatUTCSeconds(d, p) {
|
1352 | return pad(d.getUTCSeconds(), p, 2);
|
1353 | }
|
1354 |
|
1355 | function formatUTCWeekdayNumberMonday(d) {
|
1356 | var dow = d.getUTCDay();
|
1357 | return dow === 0 ? 7 : dow;
|
1358 | }
|
1359 |
|
1360 | function formatUTCWeekNumberSunday(d, p) {
|
1361 | return pad(utcSunday.count(src_utcYear(d), d), p, 2);
|
1362 | }
|
1363 |
|
1364 | function formatUTCWeekNumberISO(d, p) {
|
1365 | var day = d.getUTCDay();
|
1366 | d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
|
1367 | return pad(utcThursday.count(src_utcYear(d), d) + (src_utcYear(d).getUTCDay() === 4), p, 2);
|
1368 | }
|
1369 |
|
1370 | function formatUTCWeekdayNumberSunday(d) {
|
1371 | return d.getUTCDay();
|
1372 | }
|
1373 |
|
1374 | function formatUTCWeekNumberMonday(d, p) {
|
1375 | return pad(utcMonday.count(src_utcYear(d), d), p, 2);
|
1376 | }
|
1377 |
|
1378 | function formatUTCYear(d, p) {
|
1379 | return pad(d.getUTCFullYear() % 100, p, 2);
|
1380 | }
|
1381 |
|
1382 | function formatUTCFullYear(d, p) {
|
1383 | return pad(d.getUTCFullYear() % 10000, p, 4);
|
1384 | }
|
1385 |
|
1386 | function formatUTCZone() {
|
1387 | return "+0000";
|
1388 | }
|
1389 |
|
1390 | function formatLiteralPercent() {
|
1391 | return "%";
|
1392 | }
|
1393 |
|
1394 | function formatUnixTimestamp(d) {
|
1395 | return +d;
|
1396 | }
|
1397 |
|
1398 | function formatUnixTimestampSeconds(d) {
|
1399 | return Math.floor(+d / 1000);
|
1400 | }
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 | var defaultLocale_locale;
|
1406 | var timeFormat;
|
1407 | var timeParse;
|
1408 | var utcFormat;
|
1409 | var utcParse;
|
1410 |
|
1411 | defaultLocale({
|
1412 | dateTime: "%x, %X",
|
1413 | date: "%-m/%-d/%Y",
|
1414 | time: "%-I:%M:%S %p",
|
1415 | periods: ["AM", "PM"],
|
1416 | days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
1417 | shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
1418 | months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
1419 | shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
1420 | });
|
1421 |
|
1422 | function defaultLocale(definition) {
|
1423 | defaultLocale_locale = formatLocale(definition);
|
1424 | timeFormat = defaultLocale_locale.format;
|
1425 | timeParse = defaultLocale_locale.parse;
|
1426 | utcFormat = defaultLocale_locale.utcFormat;
|
1427 | utcParse = defaultLocale_locale.utcParse;
|
1428 | return defaultLocale_locale;
|
1429 | }
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 | var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
|
1435 |
|
1436 | function formatIsoNative(date) {
|
1437 | return date.toISOString();
|
1438 | }
|
1439 |
|
1440 | var formatIso = Date.prototype.toISOString
|
1441 | ? formatIsoNative
|
1442 | : utcFormat(isoSpecifier);
|
1443 |
|
1444 | var isoFormat = (formatIso);
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 | function parseIsoNative(string) {
|
1451 | var date = new Date(string);
|
1452 | return isNaN(date) ? null : date;
|
1453 | }
|
1454 |
|
1455 | var parseIso = +new Date("2000-01-01T00:00:00.000Z")
|
1456 | ? parseIsoNative
|
1457 | : utcParse(isoSpecifier);
|
1458 |
|
1459 | var isoParse = (parseIso);
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 | var xhtml = "http://www.w3.org/1999/xhtml";
|
1469 |
|
1470 | var namespaces = ({
|
1471 | svg: "http://www.w3.org/2000/svg",
|
1472 | xhtml: xhtml,
|
1473 | xlink: "http://www.w3.org/1999/xlink",
|
1474 | xml: "http://www.w3.org/XML/1998/namespace",
|
1475 | xmlns: "http://www.w3.org/2000/xmlns/"
|
1476 | });
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 | var namespace = (function(name) {
|
1482 | var prefix = name += "", i = prefix.indexOf(":");
|
1483 | if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
1484 | return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;
|
1485 | });
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 | function creatorInherit(name) {
|
1492 | return function() {
|
1493 | var document = this.ownerDocument,
|
1494 | uri = this.namespaceURI;
|
1495 | return uri === xhtml && document.documentElement.namespaceURI === xhtml
|
1496 | ? document.createElement(name)
|
1497 | : document.createElementNS(uri, name);
|
1498 | };
|
1499 | }
|
1500 |
|
1501 | function creatorFixed(fullname) {
|
1502 | return function() {
|
1503 | return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
1504 | };
|
1505 | }
|
1506 |
|
1507 | var creator = (function(name) {
|
1508 | var fullname = namespace(name);
|
1509 | return (fullname.local
|
1510 | ? creatorFixed
|
1511 | : creatorInherit)(fullname);
|
1512 | });
|
1513 |
|
1514 |
|
1515 | function none() {}
|
1516 |
|
1517 | var src_selector = (function(selector) {
|
1518 | return selector == null ? none : function() {
|
1519 | return this.querySelector(selector);
|
1520 | };
|
1521 | });
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 | var selection_select = (function(select) {
|
1528 | if (typeof select !== "function") select = src_selector(select);
|
1529 |
|
1530 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
1531 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
1532 | if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
1533 | if ("__data__" in node) subnode.__data__ = node.__data__;
|
1534 | subgroup[i] = subnode;
|
1535 | }
|
1536 | }
|
1537 | }
|
1538 |
|
1539 | return new Selection(subgroups, this._parents);
|
1540 | });
|
1541 |
|
1542 |
|
1543 | function selectorAll_empty() {
|
1544 | return [];
|
1545 | }
|
1546 |
|
1547 | var selectorAll = (function(selector) {
|
1548 | return selector == null ? selectorAll_empty : function() {
|
1549 | return this.querySelectorAll(selector);
|
1550 | };
|
1551 | });
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 | var selectAll = (function(select) {
|
1558 | if (typeof select !== "function") select = selectorAll(select);
|
1559 |
|
1560 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
1561 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
1562 | if (node = group[i]) {
|
1563 | subgroups.push(select.call(node, node.__data__, i, group));
|
1564 | parents.push(node);
|
1565 | }
|
1566 | }
|
1567 | }
|
1568 |
|
1569 | return new Selection(subgroups, parents);
|
1570 | });
|
1571 |
|
1572 |
|
1573 | var matcher = (function(selector) {
|
1574 | return function() {
|
1575 | return this.matches(selector);
|
1576 | };
|
1577 | });
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 | var selection_filter = (function(match) {
|
1584 | if (typeof match !== "function") match = matcher(match);
|
1585 |
|
1586 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
1587 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
1588 | if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
1589 | subgroup.push(node);
|
1590 | }
|
1591 | }
|
1592 | }
|
1593 |
|
1594 | return new Selection(subgroups, this._parents);
|
1595 | });
|
1596 |
|
1597 |
|
1598 | var sparse = (function(update) {
|
1599 | return new Array(update.length);
|
1600 | });
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 | var selection_enter = (function() {
|
1607 | return new Selection(this._enter || this._groups.map(sparse), this._parents);
|
1608 | });
|
1609 |
|
1610 | function EnterNode(parent, datum) {
|
1611 | this.ownerDocument = parent.ownerDocument;
|
1612 | this.namespaceURI = parent.namespaceURI;
|
1613 | this._next = null;
|
1614 | this._parent = parent;
|
1615 | this.__data__ = datum;
|
1616 | }
|
1617 |
|
1618 | EnterNode.prototype = {
|
1619 | constructor: EnterNode,
|
1620 | appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
|
1621 | insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },
|
1622 | querySelector: function(selector) { return this._parent.querySelector(selector); },
|
1623 | querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
|
1624 | };
|
1625 |
|
1626 |
|
1627 | var constant = (function(x) {
|
1628 | return function() {
|
1629 | return x;
|
1630 | };
|
1631 | });
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 | var keyPrefix = "$";
|
1639 |
|
1640 | function bindIndex(parent, group, enter, update, exit, data) {
|
1641 | var i = 0,
|
1642 | node,
|
1643 | groupLength = group.length,
|
1644 | dataLength = data.length;
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 | for (; i < dataLength; ++i) {
|
1650 | if (node = group[i]) {
|
1651 | node.__data__ = data[i];
|
1652 | update[i] = node;
|
1653 | } else {
|
1654 | enter[i] = new EnterNode(parent, data[i]);
|
1655 | }
|
1656 | }
|
1657 |
|
1658 |
|
1659 | for (; i < groupLength; ++i) {
|
1660 | if (node = group[i]) {
|
1661 | exit[i] = node;
|
1662 | }
|
1663 | }
|
1664 | }
|
1665 |
|
1666 | function bindKey(parent, group, enter, update, exit, data, key) {
|
1667 | var i,
|
1668 | node,
|
1669 | nodeByKeyValue = {},
|
1670 | groupLength = group.length,
|
1671 | dataLength = data.length,
|
1672 | keyValues = new Array(groupLength),
|
1673 | keyValue;
|
1674 |
|
1675 |
|
1676 |
|
1677 | for (i = 0; i < groupLength; ++i) {
|
1678 | if (node = group[i]) {
|
1679 | keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);
|
1680 | if (keyValue in nodeByKeyValue) {
|
1681 | exit[i] = node;
|
1682 | } else {
|
1683 | nodeByKeyValue[keyValue] = node;
|
1684 | }
|
1685 | }
|
1686 | }
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 | for (i = 0; i < dataLength; ++i) {
|
1692 | keyValue = keyPrefix + key.call(parent, data[i], i, data);
|
1693 | if (node = nodeByKeyValue[keyValue]) {
|
1694 | update[i] = node;
|
1695 | node.__data__ = data[i];
|
1696 | nodeByKeyValue[keyValue] = null;
|
1697 | } else {
|
1698 | enter[i] = new EnterNode(parent, data[i]);
|
1699 | }
|
1700 | }
|
1701 |
|
1702 |
|
1703 | for (i = 0; i < groupLength; ++i) {
|
1704 | if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {
|
1705 | exit[i] = node;
|
1706 | }
|
1707 | }
|
1708 | }
|
1709 |
|
1710 | var selection_data = (function(value, key) {
|
1711 | if (!value) {
|
1712 | data = new Array(this.size()), j = -1;
|
1713 | this.each(function(d) { data[++j] = d; });
|
1714 | return data;
|
1715 | }
|
1716 |
|
1717 | var bind = key ? bindKey : bindIndex,
|
1718 | parents = this._parents,
|
1719 | groups = this._groups;
|
1720 |
|
1721 | if (typeof value !== "function") value = constant(value);
|
1722 |
|
1723 | for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
1724 | var parent = parents[j],
|
1725 | group = groups[j],
|
1726 | groupLength = group.length,
|
1727 | data = value.call(parent, parent && parent.__data__, j, parents),
|
1728 | dataLength = data.length,
|
1729 | enterGroup = enter[j] = new Array(dataLength),
|
1730 | updateGroup = update[j] = new Array(dataLength),
|
1731 | exitGroup = exit[j] = new Array(groupLength);
|
1732 |
|
1733 | bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 | for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
1739 | if (previous = enterGroup[i0]) {
|
1740 | if (i0 >= i1) i1 = i0 + 1;
|
1741 | while (!(next = updateGroup[i1]) && ++i1 < dataLength);
|
1742 | previous._next = next || null;
|
1743 | }
|
1744 | }
|
1745 | }
|
1746 |
|
1747 | update = new Selection(update, parents);
|
1748 | update._enter = enter;
|
1749 | update._exit = exit;
|
1750 | return update;
|
1751 | });
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 | var selection_exit = (function() {
|
1758 | return new Selection(this._exit || this._groups.map(sparse), this._parents);
|
1759 | });
|
1760 |
|
1761 |
|
1762 | var join = (function(onenter, onupdate, onexit) {
|
1763 | var enter = this.enter(), update = this, exit = this.exit();
|
1764 | enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + "");
|
1765 | if (onupdate != null) update = onupdate(update);
|
1766 | if (onexit == null) exit.remove(); else onexit(exit);
|
1767 | return enter && update ? enter.merge(update).order() : update;
|
1768 | });
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 | var selection_merge = (function(selection) {
|
1774 |
|
1775 | 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) {
|
1776 | for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
1777 | if (node = group0[i] || group1[i]) {
|
1778 | merge[i] = node;
|
1779 | }
|
1780 | }
|
1781 | }
|
1782 |
|
1783 | for (; j < m0; ++j) {
|
1784 | merges[j] = groups0[j];
|
1785 | }
|
1786 |
|
1787 | return new Selection(merges, this._parents);
|
1788 | });
|
1789 |
|
1790 |
|
1791 | var selection_order = (function() {
|
1792 |
|
1793 | for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
|
1794 | for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
1795 | if (node = group[i]) {
|
1796 | if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
|
1797 | next = node;
|
1798 | }
|
1799 | }
|
1800 | }
|
1801 |
|
1802 | return this;
|
1803 | });
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 | var selection_sort = (function(compare) {
|
1809 | if (!compare) compare = ascending;
|
1810 |
|
1811 | function compareNode(a, b) {
|
1812 | return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
1813 | }
|
1814 |
|
1815 | for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
1816 | for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
|
1817 | if (node = group[i]) {
|
1818 | sortgroup[i] = node;
|
1819 | }
|
1820 | }
|
1821 | sortgroup.sort(compareNode);
|
1822 | }
|
1823 |
|
1824 | return new Selection(sortgroups, this._parents).order();
|
1825 | });
|
1826 |
|
1827 | function ascending(a, b) {
|
1828 | return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
1829 | }
|
1830 |
|
1831 |
|
1832 | var call = (function() {
|
1833 | var callback = arguments[0];
|
1834 | arguments[0] = this;
|
1835 | callback.apply(null, arguments);
|
1836 | return this;
|
1837 | });
|
1838 |
|
1839 |
|
1840 | var nodes = (function() {
|
1841 | var nodes = new Array(this.size()), i = -1;
|
1842 | this.each(function() { nodes[++i] = this; });
|
1843 | return nodes;
|
1844 | });
|
1845 |
|
1846 |
|
1847 | var selection_node = (function() {
|
1848 |
|
1849 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
1850 | for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
|
1851 | var node = group[i];
|
1852 | if (node) return node;
|
1853 | }
|
1854 | }
|
1855 |
|
1856 | return null;
|
1857 | });
|
1858 |
|
1859 |
|
1860 | var selection_size = (function() {
|
1861 | var size = 0;
|
1862 | this.each(function() { ++size; });
|
1863 | return size;
|
1864 | });
|
1865 |
|
1866 |
|
1867 | var selection_empty = (function() {
|
1868 | return !this.node();
|
1869 | });
|
1870 |
|
1871 |
|
1872 | var each = (function(callback) {
|
1873 |
|
1874 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
1875 | for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
|
1876 | if (node = group[i]) callback.call(node, node.__data__, i, group);
|
1877 | }
|
1878 | }
|
1879 |
|
1880 | return this;
|
1881 | });
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 | function attrRemove(name) {
|
1887 | return function() {
|
1888 | this.removeAttribute(name);
|
1889 | };
|
1890 | }
|
1891 |
|
1892 | function attrRemoveNS(fullname) {
|
1893 | return function() {
|
1894 | this.removeAttributeNS(fullname.space, fullname.local);
|
1895 | };
|
1896 | }
|
1897 |
|
1898 | function attrConstant(name, value) {
|
1899 | return function() {
|
1900 | this.setAttribute(name, value);
|
1901 | };
|
1902 | }
|
1903 |
|
1904 | function attrConstantNS(fullname, value) {
|
1905 | return function() {
|
1906 | this.setAttributeNS(fullname.space, fullname.local, value);
|
1907 | };
|
1908 | }
|
1909 |
|
1910 | function attrFunction(name, value) {
|
1911 | return function() {
|
1912 | var v = value.apply(this, arguments);
|
1913 | if (v == null) this.removeAttribute(name);
|
1914 | else this.setAttribute(name, v);
|
1915 | };
|
1916 | }
|
1917 |
|
1918 | function attrFunctionNS(fullname, value) {
|
1919 | return function() {
|
1920 | var v = value.apply(this, arguments);
|
1921 | if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
|
1922 | else this.setAttributeNS(fullname.space, fullname.local, v);
|
1923 | };
|
1924 | }
|
1925 |
|
1926 | var attr = (function(name, value) {
|
1927 | var fullname = namespace(name);
|
1928 |
|
1929 | if (arguments.length < 2) {
|
1930 | var node = this.node();
|
1931 | return fullname.local
|
1932 | ? node.getAttributeNS(fullname.space, fullname.local)
|
1933 | : node.getAttribute(fullname);
|
1934 | }
|
1935 |
|
1936 | return this.each((value == null
|
1937 | ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
|
1938 | ? (fullname.local ? attrFunctionNS : attrFunction)
|
1939 | : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
|
1940 | });
|
1941 |
|
1942 |
|
1943 | var src_window = (function(node) {
|
1944 | return (node.ownerDocument && node.ownerDocument.defaultView)
|
1945 | || (node.document && node)
|
1946 | || node.defaultView;
|
1947 | });
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 | function styleRemove(name) {
|
1953 | return function() {
|
1954 | this.style.removeProperty(name);
|
1955 | };
|
1956 | }
|
1957 |
|
1958 | function styleConstant(name, value, priority) {
|
1959 | return function() {
|
1960 | this.style.setProperty(name, value, priority);
|
1961 | };
|
1962 | }
|
1963 |
|
1964 | function styleFunction(name, value, priority) {
|
1965 | return function() {
|
1966 | var v = value.apply(this, arguments);
|
1967 | if (v == null) this.style.removeProperty(name);
|
1968 | else this.style.setProperty(name, v, priority);
|
1969 | };
|
1970 | }
|
1971 |
|
1972 | var selection_style = (function(name, value, priority) {
|
1973 | return arguments.length > 1
|
1974 | ? this.each((value == null
|
1975 | ? styleRemove : typeof value === "function"
|
1976 | ? styleFunction
|
1977 | : styleConstant)(name, value, priority == null ? "" : priority))
|
1978 | : styleValue(this.node(), name);
|
1979 | });
|
1980 |
|
1981 | function styleValue(node, name) {
|
1982 | return node.style.getPropertyValue(name)
|
1983 | || src_window(node).getComputedStyle(node, null).getPropertyValue(name);
|
1984 | }
|
1985 |
|
1986 |
|
1987 | function propertyRemove(name) {
|
1988 | return function() {
|
1989 | delete this[name];
|
1990 | };
|
1991 | }
|
1992 |
|
1993 | function propertyConstant(name, value) {
|
1994 | return function() {
|
1995 | this[name] = value;
|
1996 | };
|
1997 | }
|
1998 |
|
1999 | function propertyFunction(name, value) {
|
2000 | return function() {
|
2001 | var v = value.apply(this, arguments);
|
2002 | if (v == null) delete this[name];
|
2003 | else this[name] = v;
|
2004 | };
|
2005 | }
|
2006 |
|
2007 | var property = (function(name, value) {
|
2008 | return arguments.length > 1
|
2009 | ? this.each((value == null
|
2010 | ? propertyRemove : typeof value === "function"
|
2011 | ? propertyFunction
|
2012 | : propertyConstant)(name, value))
|
2013 | : this.node()[name];
|
2014 | });
|
2015 |
|
2016 |
|
2017 | function classArray(string) {
|
2018 | return string.trim().split(/^|\s+/);
|
2019 | }
|
2020 |
|
2021 | function classList(node) {
|
2022 | return node.classList || new ClassList(node);
|
2023 | }
|
2024 |
|
2025 | function ClassList(node) {
|
2026 | this._node = node;
|
2027 | this._names = classArray(node.getAttribute("class") || "");
|
2028 | }
|
2029 |
|
2030 | ClassList.prototype = {
|
2031 | add: function(name) {
|
2032 | var i = this._names.indexOf(name);
|
2033 | if (i < 0) {
|
2034 | this._names.push(name);
|
2035 | this._node.setAttribute("class", this._names.join(" "));
|
2036 | }
|
2037 | },
|
2038 | remove: function(name) {
|
2039 | var i = this._names.indexOf(name);
|
2040 | if (i >= 0) {
|
2041 | this._names.splice(i, 1);
|
2042 | this._node.setAttribute("class", this._names.join(" "));
|
2043 | }
|
2044 | },
|
2045 | contains: function(name) {
|
2046 | return this._names.indexOf(name) >= 0;
|
2047 | }
|
2048 | };
|
2049 |
|
2050 | function classedAdd(node, names) {
|
2051 | var list = classList(node), i = -1, n = names.length;
|
2052 | while (++i < n) list.add(names[i]);
|
2053 | }
|
2054 |
|
2055 | function classedRemove(node, names) {
|
2056 | var list = classList(node), i = -1, n = names.length;
|
2057 | while (++i < n) list.remove(names[i]);
|
2058 | }
|
2059 |
|
2060 | function classedTrue(names) {
|
2061 | return function() {
|
2062 | classedAdd(this, names);
|
2063 | };
|
2064 | }
|
2065 |
|
2066 | function classedFalse(names) {
|
2067 | return function() {
|
2068 | classedRemove(this, names);
|
2069 | };
|
2070 | }
|
2071 |
|
2072 | function classedFunction(names, value) {
|
2073 | return function() {
|
2074 | (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
2075 | };
|
2076 | }
|
2077 |
|
2078 | var classed = (function(name, value) {
|
2079 | var names = classArray(name + "");
|
2080 |
|
2081 | if (arguments.length < 2) {
|
2082 | var list = classList(this.node()), i = -1, n = names.length;
|
2083 | while (++i < n) if (!list.contains(names[i])) return false;
|
2084 | return true;
|
2085 | }
|
2086 |
|
2087 | return this.each((typeof value === "function"
|
2088 | ? classedFunction : value
|
2089 | ? classedTrue
|
2090 | : classedFalse)(names, value));
|
2091 | });
|
2092 |
|
2093 |
|
2094 | function textRemove() {
|
2095 | this.textContent = "";
|
2096 | }
|
2097 |
|
2098 | function textConstant(value) {
|
2099 | return function() {
|
2100 | this.textContent = value;
|
2101 | };
|
2102 | }
|
2103 |
|
2104 | function textFunction(value) {
|
2105 | return function() {
|
2106 | var v = value.apply(this, arguments);
|
2107 | this.textContent = v == null ? "" : v;
|
2108 | };
|
2109 | }
|
2110 |
|
2111 | var selection_text = (function(value) {
|
2112 | return arguments.length
|
2113 | ? this.each(value == null
|
2114 | ? textRemove : (typeof value === "function"
|
2115 | ? textFunction
|
2116 | : textConstant)(value))
|
2117 | : this.node().textContent;
|
2118 | });
|
2119 |
|
2120 |
|
2121 | function htmlRemove() {
|
2122 | this.innerHTML = "";
|
2123 | }
|
2124 |
|
2125 | function htmlConstant(value) {
|
2126 | return function() {
|
2127 | this.innerHTML = value;
|
2128 | };
|
2129 | }
|
2130 |
|
2131 | function htmlFunction(value) {
|
2132 | return function() {
|
2133 | var v = value.apply(this, arguments);
|
2134 | this.innerHTML = v == null ? "" : v;
|
2135 | };
|
2136 | }
|
2137 |
|
2138 | var selection_html = (function(value) {
|
2139 | return arguments.length
|
2140 | ? this.each(value == null
|
2141 | ? htmlRemove : (typeof value === "function"
|
2142 | ? htmlFunction
|
2143 | : htmlConstant)(value))
|
2144 | : this.node().innerHTML;
|
2145 | });
|
2146 |
|
2147 |
|
2148 | function raise() {
|
2149 | if (this.nextSibling) this.parentNode.appendChild(this);
|
2150 | }
|
2151 |
|
2152 | var selection_raise = (function() {
|
2153 | return this.each(raise);
|
2154 | });
|
2155 |
|
2156 |
|
2157 | function lower() {
|
2158 | if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
2159 | }
|
2160 |
|
2161 | var selection_lower = (function() {
|
2162 | return this.each(lower);
|
2163 | });
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 | var append = (function(name) {
|
2169 | var create = typeof name === "function" ? name : creator(name);
|
2170 | return this.select(function() {
|
2171 | return this.appendChild(create.apply(this, arguments));
|
2172 | });
|
2173 | });
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 | function constantNull() {
|
2180 | return null;
|
2181 | }
|
2182 |
|
2183 | var insert = (function(name, before) {
|
2184 | var create = typeof name === "function" ? name : creator(name),
|
2185 | select = before == null ? constantNull : typeof before === "function" ? before : src_selector(before);
|
2186 | return this.select(function() {
|
2187 | return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
|
2188 | });
|
2189 | });
|
2190 |
|
2191 |
|
2192 | function remove_remove() {
|
2193 | var parent = this.parentNode;
|
2194 | if (parent) parent.removeChild(this);
|
2195 | }
|
2196 |
|
2197 | var selection_remove = (function() {
|
2198 | return this.each(remove_remove);
|
2199 | });
|
2200 |
|
2201 |
|
2202 | function selection_cloneShallow() {
|
2203 | return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibling);
|
2204 | }
|
2205 |
|
2206 | function selection_cloneDeep() {
|
2207 | return this.parentNode.insertBefore(this.cloneNode(true), this.nextSibling);
|
2208 | }
|
2209 |
|
2210 | var selection_clone = (function(deep) {
|
2211 | return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
|
2212 | });
|
2213 |
|
2214 |
|
2215 | var selection_datum = (function(value) {
|
2216 | return arguments.length
|
2217 | ? this.property("__data__", value)
|
2218 | : this.node().__data__;
|
2219 | });
|
2220 |
|
2221 |
|
2222 | var filterEvents = {};
|
2223 |
|
2224 | var on_event = null;
|
2225 |
|
2226 | if (typeof document !== "undefined") {
|
2227 | var on_element = document.documentElement;
|
2228 | if (!("onmouseenter" in on_element)) {
|
2229 | filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};
|
2230 | }
|
2231 | }
|
2232 |
|
2233 | function filterContextListener(listener, index, group) {
|
2234 | listener = contextListener(listener, index, group);
|
2235 | return function(event) {
|
2236 | var related = event.relatedTarget;
|
2237 | if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
|
2238 | listener.call(this, event);
|
2239 | }
|
2240 | };
|
2241 | }
|
2242 |
|
2243 | function contextListener(listener, index, group) {
|
2244 | return function(event1) {
|
2245 | var event0 = on_event;
|
2246 | on_event = event1;
|
2247 | try {
|
2248 | listener.call(this, this.__data__, index, group);
|
2249 | } finally {
|
2250 | on_event = event0;
|
2251 | }
|
2252 | };
|
2253 | }
|
2254 |
|
2255 | function parseTypenames(typenames) {
|
2256 | return typenames.trim().split(/^|\s+/).map(function(t) {
|
2257 | var name = "", i = t.indexOf(".");
|
2258 | if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
2259 | return {type: t, name: name};
|
2260 | });
|
2261 | }
|
2262 |
|
2263 | function onRemove(typename) {
|
2264 | return function() {
|
2265 | var on = this.__on;
|
2266 | if (!on) return;
|
2267 | for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
|
2268 | if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
2269 | this.removeEventListener(o.type, o.listener, o.capture);
|
2270 | } else {
|
2271 | on[++i] = o;
|
2272 | }
|
2273 | }
|
2274 | if (++i) on.length = i;
|
2275 | else delete this.__on;
|
2276 | };
|
2277 | }
|
2278 |
|
2279 | function onAdd(typename, value, capture) {
|
2280 | var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
|
2281 | return function(d, i, group) {
|
2282 | var on = this.__on, o, listener = wrap(value, i, group);
|
2283 | if (on) for (var j = 0, m = on.length; j < m; ++j) {
|
2284 | if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
2285 | this.removeEventListener(o.type, o.listener, o.capture);
|
2286 | this.addEventListener(o.type, o.listener = listener, o.capture = capture);
|
2287 | o.value = value;
|
2288 | return;
|
2289 | }
|
2290 | }
|
2291 | this.addEventListener(typename.type, listener, capture);
|
2292 | o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
|
2293 | if (!on) this.__on = [o];
|
2294 | else on.push(o);
|
2295 | };
|
2296 | }
|
2297 |
|
2298 | var selection_on = (function(typename, value, capture) {
|
2299 | var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
|
2300 |
|
2301 | if (arguments.length < 2) {
|
2302 | var on = this.node().__on;
|
2303 | if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
|
2304 | for (i = 0, o = on[j]; i < n; ++i) {
|
2305 | if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
2306 | return o.value;
|
2307 | }
|
2308 | }
|
2309 | }
|
2310 | return;
|
2311 | }
|
2312 |
|
2313 | on = value ? onAdd : onRemove;
|
2314 | if (capture == null) capture = false;
|
2315 | for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
|
2316 | return this;
|
2317 | });
|
2318 |
|
2319 | function customEvent(event1, listener, that, args) {
|
2320 | var event0 = on_event;
|
2321 | event1.sourceEvent = on_event;
|
2322 | on_event = event1;
|
2323 | try {
|
2324 | return listener.apply(that, args);
|
2325 | } finally {
|
2326 | on_event = event0;
|
2327 | }
|
2328 | }
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 | function dispatch_dispatchEvent(node, type, params) {
|
2334 | var window = src_window(node),
|
2335 | event = window.CustomEvent;
|
2336 |
|
2337 | if (typeof event === "function") {
|
2338 | event = new event(type, params);
|
2339 | } else {
|
2340 | event = window.document.createEvent("Event");
|
2341 | if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
|
2342 | else event.initEvent(type, false, false);
|
2343 | }
|
2344 |
|
2345 | node.dispatchEvent(event);
|
2346 | }
|
2347 |
|
2348 | function dispatchConstant(type, params) {
|
2349 | return function() {
|
2350 | return dispatch_dispatchEvent(this, type, params);
|
2351 | };
|
2352 | }
|
2353 |
|
2354 | function dispatchFunction(type, params) {
|
2355 | return function() {
|
2356 | return dispatch_dispatchEvent(this, type, params.apply(this, arguments));
|
2357 | };
|
2358 | }
|
2359 |
|
2360 | var dispatch = (function(type, params) {
|
2361 | return this.each((typeof params === "function"
|
2362 | ? dispatchFunction
|
2363 | : dispatchConstant)(type, params));
|
2364 | });
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 | var selection_root = [null];
|
2400 |
|
2401 | function Selection(groups, parents) {
|
2402 | this._groups = groups;
|
2403 | this._parents = parents;
|
2404 | }
|
2405 |
|
2406 | function selection_selection() {
|
2407 | return new Selection([[document.documentElement]], selection_root);
|
2408 | }
|
2409 |
|
2410 | Selection.prototype = selection_selection.prototype = {
|
2411 | constructor: Selection,
|
2412 | select: selection_select,
|
2413 | selectAll: selectAll,
|
2414 | filter: selection_filter,
|
2415 | data: selection_data,
|
2416 | enter: selection_enter,
|
2417 | exit: selection_exit,
|
2418 | join: join,
|
2419 | merge: selection_merge,
|
2420 | order: selection_order,
|
2421 | sort: selection_sort,
|
2422 | call: call,
|
2423 | nodes: nodes,
|
2424 | node: selection_node,
|
2425 | size: selection_size,
|
2426 | empty: selection_empty,
|
2427 | each: each,
|
2428 | attr: attr,
|
2429 | style: selection_style,
|
2430 | property: property,
|
2431 | classed: classed,
|
2432 | text: selection_text,
|
2433 | html: selection_html,
|
2434 | raise: selection_raise,
|
2435 | lower: selection_lower,
|
2436 | append: append,
|
2437 | insert: insert,
|
2438 | remove: selection_remove,
|
2439 | clone: selection_clone,
|
2440 | datum: selection_datum,
|
2441 | on: selection_on,
|
2442 | dispatch: dispatch
|
2443 | };
|
2444 |
|
2445 | /* harmony default export */ var src_selection = (selection_selection);
|
2446 |
|
2447 | // CONCATENATED MODULE: ./node_modules/d3-selection/src/select.js
|
2448 |
|
2449 |
|
2450 | /* harmony default export */ var src_select = (function(selector) {
|
2451 | return typeof selector === "string"
|
2452 | ? new Selection([[document.querySelector(selector)]], [document.documentElement])
|
2453 | : new Selection([[selector]], selection_root);
|
2454 | });
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 | var src_create = (function(name) {
|
2461 | return src_select(creator(name).call(document.documentElement));
|
2462 | });
|
2463 |
|
2464 |
|
2465 | var nextId = 0;
|
2466 |
|
2467 | function local() {
|
2468 | return new Local;
|
2469 | }
|
2470 |
|
2471 | function Local() {
|
2472 | this._ = "@" + (++nextId).toString(36);
|
2473 | }
|
2474 |
|
2475 | Local.prototype = local.prototype = {
|
2476 | constructor: Local,
|
2477 | get: function(node) {
|
2478 | var id = this._;
|
2479 | while (!(id in node)) if (!(node = node.parentNode)) return;
|
2480 | return node[id];
|
2481 | },
|
2482 | set: function(node, value) {
|
2483 | return node[this._] = value;
|
2484 | },
|
2485 | remove: function(node) {
|
2486 | return this._ in node && delete node[this._];
|
2487 | },
|
2488 | toString: function() {
|
2489 | return this._;
|
2490 | }
|
2491 | };
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 | var sourceEvent = (function() {
|
2497 | var current = on_event, source;
|
2498 | while (source = current.sourceEvent) current = source;
|
2499 | return current;
|
2500 | });
|
2501 |
|
2502 |
|
2503 | var src_point = (function(node, event) {
|
2504 | var svg = node.ownerSVGElement || node;
|
2505 |
|
2506 | if (svg.createSVGPoint) {
|
2507 | var point = svg.createSVGPoint();
|
2508 | point.x = event.clientX, point.y = event.clientY;
|
2509 | point = point.matrixTransform(node.getScreenCTM().inverse());
|
2510 | return [point.x, point.y];
|
2511 | }
|
2512 |
|
2513 | var rect = node.getBoundingClientRect();
|
2514 | return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
2515 | });
|
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 | var src_mouse = (function(node) {
|
2522 | var event = sourceEvent();
|
2523 | if (event.changedTouches) event = event.changedTouches[0];
|
2524 | return src_point(node, event);
|
2525 | });
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 | var src_selectAll = (function(selector) {
|
2531 | return typeof selector === "string"
|
2532 | ? new Selection([document.querySelectorAll(selector)], [document.documentElement])
|
2533 | : new Selection([selector == null ? [] : selector], selection_root);
|
2534 | });
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 | var src_touch = (function(node, touches, identifier) {
|
2541 | if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
|
2542 |
|
2543 | for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
|
2544 | if ((touch = touches[i]).identifier === identifier) {
|
2545 | return src_point(node, touch);
|
2546 | }
|
2547 | }
|
2548 |
|
2549 | return null;
|
2550 | });
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 | var src_touches = (function(node, touches) {
|
2557 | if (touches == null) touches = sourceEvent().touches;
|
2558 |
|
2559 | for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {
|
2560 | points[i] = src_point(node, touches[i]);
|
2561 | }
|
2562 |
|
2563 | return points;
|
2564 | });
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 | var noop = {value: function() {}};
|
2588 |
|
2589 | function dispatch_dispatch() {
|
2590 | for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
|
2591 | if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t);
|
2592 | _[t] = [];
|
2593 | }
|
2594 | return new Dispatch(_);
|
2595 | }
|
2596 |
|
2597 | function Dispatch(_) {
|
2598 | this._ = _;
|
2599 | }
|
2600 |
|
2601 | function dispatch_parseTypenames(typenames, types) {
|
2602 | return typenames.trim().split(/^|\s+/).map(function(t) {
|
2603 | var name = "", i = t.indexOf(".");
|
2604 | if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
|
2605 | if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
2606 | return {type: t, name: name};
|
2607 | });
|
2608 | }
|
2609 |
|
2610 | Dispatch.prototype = dispatch_dispatch.prototype = {
|
2611 | constructor: Dispatch,
|
2612 | on: function(typename, callback) {
|
2613 | var _ = this._,
|
2614 | T = dispatch_parseTypenames(typename + "", _),
|
2615 | t,
|
2616 | i = -1,
|
2617 | n = T.length;
|
2618 |
|
2619 |
|
2620 | if (arguments.length < 2) {
|
2621 | while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
|
2622 | return;
|
2623 | }
|
2624 |
|
2625 | // If a type was specified, set the callback for the given type and name.
|
2626 | // Otherwise, if a null callback was specified, remove callbacks of the given name.
|
2627 | if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
2628 | while (++i < n) {
|
2629 | if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
|
2630 | else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
|
2631 | }
|
2632 |
|
2633 | return this;
|
2634 | },
|
2635 | copy: function() {
|
2636 | var copy = {}, _ = this._;
|
2637 | for (var t in _) copy[t] = _[t].slice();
|
2638 | return new Dispatch(copy);
|
2639 | },
|
2640 | call: function(type, that) {
|
2641 | if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
|
2642 | if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
2643 | for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
2644 | },
|
2645 | apply: function(type, that, args) {
|
2646 | if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
2647 | for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
2648 | }
|
2649 | };
|
2650 |
|
2651 | function get(type, name) {
|
2652 | for (var i = 0, n = type.length, c; i < n; ++i) {
|
2653 | if ((c = type[i]).name === name) {
|
2654 | return c.value;
|
2655 | }
|
2656 | }
|
2657 | }
|
2658 |
|
2659 | function set(type, name, callback) {
|
2660 | for (var i = 0, n = type.length; i < n; ++i) {
|
2661 | if (type[i].name === name) {
|
2662 | type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
|
2663 | break;
|
2664 | }
|
2665 | }
|
2666 | if (callback != null) type.push({name: name, value: callback});
|
2667 | return type;
|
2668 | }
|
2669 |
|
2670 | var src_dispatch = (dispatch_dispatch);
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 | var timer_frame = 0,
|
2677 | timer_timeout = 0,
|
2678 | timer_interval = 0,
|
2679 | pokeDelay = 1000,
|
2680 | taskHead,
|
2681 | taskTail,
|
2682 | clockLast = 0,
|
2683 | clockNow = 0,
|
2684 | clockSkew = 0,
|
2685 | clock = typeof performance === "object" && performance.now ? performance : Date,
|
2686 | setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
|
2687 |
|
2688 | function now() {
|
2689 | return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
2690 | }
|
2691 |
|
2692 | function clearNow() {
|
2693 | clockNow = 0;
|
2694 | }
|
2695 |
|
2696 | function Timer() {
|
2697 | this._call =
|
2698 | this._time =
|
2699 | this._next = null;
|
2700 | }
|
2701 |
|
2702 | Timer.prototype = timer.prototype = {
|
2703 | constructor: Timer,
|
2704 | restart: function(callback, delay, time) {
|
2705 | if (typeof callback !== "function") throw new TypeError("callback is not a function");
|
2706 | time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
2707 | if (!this._next && taskTail !== this) {
|
2708 | if (taskTail) taskTail._next = this;
|
2709 | else taskHead = this;
|
2710 | taskTail = this;
|
2711 | }
|
2712 | this._call = callback;
|
2713 | this._time = time;
|
2714 | sleep();
|
2715 | },
|
2716 | stop: function() {
|
2717 | if (this._call) {
|
2718 | this._call = null;
|
2719 | this._time = Infinity;
|
2720 | sleep();
|
2721 | }
|
2722 | }
|
2723 | };
|
2724 |
|
2725 | function timer(callback, delay, time) {
|
2726 | var t = new Timer;
|
2727 | t.restart(callback, delay, time);
|
2728 | return t;
|
2729 | }
|
2730 |
|
2731 | function timerFlush() {
|
2732 | now();
|
2733 | ++timer_frame;
|
2734 | var t = taskHead, e;
|
2735 | while (t) {
|
2736 | if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
|
2737 | t = t._next;
|
2738 | }
|
2739 | --timer_frame;
|
2740 | }
|
2741 |
|
2742 | function wake() {
|
2743 | clockNow = (clockLast = clock.now()) + clockSkew;
|
2744 | timer_frame = timer_timeout = 0;
|
2745 | try {
|
2746 | timerFlush();
|
2747 | } finally {
|
2748 | timer_frame = 0;
|
2749 | nap();
|
2750 | clockNow = 0;
|
2751 | }
|
2752 | }
|
2753 |
|
2754 | function poke() {
|
2755 | var now = clock.now(), delay = now - clockLast;
|
2756 | if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
|
2757 | }
|
2758 |
|
2759 | function nap() {
|
2760 | var t0, t1 = taskHead, t2, time = Infinity;
|
2761 | while (t1) {
|
2762 | if (t1._call) {
|
2763 | if (time > t1._time) time = t1._time;
|
2764 | t0 = t1, t1 = t1._next;
|
2765 | } else {
|
2766 | t2 = t1._next, t1._next = null;
|
2767 | t1 = t0 ? t0._next = t2 : taskHead = t2;
|
2768 | }
|
2769 | }
|
2770 | taskTail = t0;
|
2771 | sleep(time);
|
2772 | }
|
2773 |
|
2774 | function sleep(time) {
|
2775 | if (timer_frame) return;
|
2776 | if (timer_timeout) timer_timeout = clearTimeout(timer_timeout);
|
2777 | var delay = time - clockNow;
|
2778 | if (delay > 24) {
|
2779 | if (time < Infinity) timer_timeout = setTimeout(wake, time - clock.now() - clockSkew);
|
2780 | if (timer_interval) timer_interval = clearInterval(timer_interval);
|
2781 | } else {
|
2782 | if (!timer_interval) clockLast = clock.now(), timer_interval = setInterval(poke, pokeDelay);
|
2783 | timer_frame = 1, setFrame(wake);
|
2784 | }
|
2785 | }
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 | var src_timeout = (function(callback, delay, time) {
|
2791 | var t = new Timer;
|
2792 | delay = delay == null ? 0 : +delay;
|
2793 | t.restart(function(elapsed) {
|
2794 | t.stop();
|
2795 | callback(elapsed + delay);
|
2796 | }, delay, time);
|
2797 | return t;
|
2798 | });
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 | var src_interval = (function(callback, delay, time) {
|
2804 | var t = new Timer, total = delay;
|
2805 | if (delay == null) return t.restart(callback, delay, time), t;
|
2806 | delay = +delay, time = time == null ? now() : +time;
|
2807 | t.restart(function tick(elapsed) {
|
2808 | elapsed += total;
|
2809 | t.restart(tick, total += delay, time);
|
2810 | callback(elapsed);
|
2811 | }, delay, time);
|
2812 | return t;
|
2813 | });
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 | var emptyOn = src_dispatch("start", "end", "cancel", "interrupt");
|
2827 | var emptyTween = [];
|
2828 |
|
2829 | var CREATED = 0;
|
2830 | var SCHEDULED = 1;
|
2831 | var STARTING = 2;
|
2832 | var STARTED = 3;
|
2833 | var RUNNING = 4;
|
2834 | var ENDING = 5;
|
2835 | var ENDED = 6;
|
2836 |
|
2837 | var transition_schedule = (function(node, name, id, index, group, timing) {
|
2838 | var schedules = node.__transition;
|
2839 | if (!schedules) node.__transition = {};
|
2840 | else if (id in schedules) return;
|
2841 | schedule_create(node, id, {
|
2842 | name: name,
|
2843 | index: index,
|
2844 | group: group,
|
2845 | on: emptyOn,
|
2846 | tween: emptyTween,
|
2847 | time: timing.time,
|
2848 | delay: timing.delay,
|
2849 | duration: timing.duration,
|
2850 | ease: timing.ease,
|
2851 | timer: null,
|
2852 | state: CREATED
|
2853 | });
|
2854 | });
|
2855 |
|
2856 | function schedule_init(node, id) {
|
2857 | var schedule = schedule_get(node, id);
|
2858 | if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
2859 | return schedule;
|
2860 | }
|
2861 |
|
2862 | function schedule_set(node, id) {
|
2863 | var schedule = schedule_get(node, id);
|
2864 | if (schedule.state > STARTED) throw new Error("too late; already running");
|
2865 | return schedule;
|
2866 | }
|
2867 |
|
2868 | function schedule_get(node, id) {
|
2869 | var schedule = node.__transition;
|
2870 | if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
2871 | return schedule;
|
2872 | }
|
2873 |
|
2874 | function schedule_create(node, id, self) {
|
2875 | var schedules = node.__transition,
|
2876 | tween;
|
2877 |
|
2878 |
|
2879 |
|
2880 | schedules[id] = self;
|
2881 | self.timer = timer(schedule, 0, self.time);
|
2882 |
|
2883 | function schedule(elapsed) {
|
2884 | self.state = SCHEDULED;
|
2885 | self.timer.restart(start, self.delay, self.time);
|
2886 |
|
2887 |
|
2888 | if (self.delay <= elapsed) start(elapsed - self.delay);
|
2889 | }
|
2890 |
|
2891 | function start(elapsed) {
|
2892 | var i, j, n, o;
|
2893 |
|
2894 |
|
2895 | if (self.state !== SCHEDULED) return stop();
|
2896 |
|
2897 | for (i in schedules) {
|
2898 | o = schedules[i];
|
2899 | if (o.name !== self.name) continue;
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 | if (o.state === STARTED) return src_timeout(start);
|
2905 |
|
2906 |
|
2907 | if (o.state === RUNNING) {
|
2908 | o.state = ENDED;
|
2909 | o.timer.stop();
|
2910 | o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
2911 | delete schedules[i];
|
2912 | }
|
2913 |
|
2914 |
|
2915 | else if (+i < id) {
|
2916 | o.state = ENDED;
|
2917 | o.timer.stop();
|
2918 | o.on.call("cancel", node, node.__data__, o.index, o.group);
|
2919 | delete schedules[i];
|
2920 | }
|
2921 | }
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 | src_timeout(function() {
|
2928 | if (self.state === STARTED) {
|
2929 | self.state = RUNNING;
|
2930 | self.timer.restart(tick, self.delay, self.time);
|
2931 | tick(elapsed);
|
2932 | }
|
2933 | });
|
2934 |
|
2935 |
|
2936 |
|
2937 | self.state = STARTING;
|
2938 | self.on.call("start", node, node.__data__, self.index, self.group);
|
2939 | if (self.state !== STARTING) return;
|
2940 | self.state = STARTED;
|
2941 |
|
2942 |
|
2943 | tween = new Array(n = self.tween.length);
|
2944 | for (i = 0, j = -1; i < n; ++i) {
|
2945 | if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
|
2946 | tween[++j] = o;
|
2947 | }
|
2948 | }
|
2949 | tween.length = j + 1;
|
2950 | }
|
2951 |
|
2952 | function tick(elapsed) {
|
2953 | var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
|
2954 | i = -1,
|
2955 | n = tween.length;
|
2956 |
|
2957 | while (++i < n) {
|
2958 | tween[i].call(node, t);
|
2959 | }
|
2960 |
|
2961 |
|
2962 | if (self.state === ENDING) {
|
2963 | self.on.call("end", node, node.__data__, self.index, self.group);
|
2964 | stop();
|
2965 | }
|
2966 | }
|
2967 |
|
2968 | function stop() {
|
2969 | self.state = ENDED;
|
2970 | self.timer.stop();
|
2971 | delete schedules[id];
|
2972 | for (var i in schedules) return;
|
2973 | delete node.__transition;
|
2974 | }
|
2975 | }
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 | var interrupt = (function(node, name) {
|
2981 | var schedules = node.__transition,
|
2982 | schedule,
|
2983 | active,
|
2984 | empty = true,
|
2985 | i;
|
2986 |
|
2987 | if (!schedules) return;
|
2988 |
|
2989 | name = name == null ? null : name + "";
|
2990 |
|
2991 | for (i in schedules) {
|
2992 | if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
2993 | active = schedule.state > STARTING && schedule.state < ENDING;
|
2994 | schedule.state = ENDED;
|
2995 | schedule.timer.stop();
|
2996 | schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
|
2997 | delete schedules[i];
|
2998 | }
|
2999 |
|
3000 | if (empty) delete node.__transition;
|
3001 | });
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 | var selection_interrupt = (function(name) {
|
3007 | return this.each(function() {
|
3008 | interrupt(this, name);
|
3009 | });
|
3010 | });
|
3011 |
|
3012 |
|
3013 | var define = (function(constructor, factory, prototype) {
|
3014 | constructor.prototype = factory.prototype = prototype;
|
3015 | prototype.constructor = constructor;
|
3016 | });
|
3017 |
|
3018 | function extend(parent, definition) {
|
3019 | var prototype = Object.create(parent.prototype);
|
3020 | for (var key in definition) prototype[key] = definition[key];
|
3021 | return prototype;
|
3022 | }
|
3023 |
|
3024 |
|
3025 |
|
3026 |
|
3027 | function Color() {}
|
3028 |
|
3029 | var darker = 0.7;
|
3030 | var brighter = 1 / darker;
|
3031 |
|
3032 | var reI = "\\s*([+-]?\\d+)\\s*",
|
3033 | reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
3034 | reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
3035 | reHex3 = /^#([0-9a-f]{3})$/,
|
3036 | reHex6 = /^#([0-9a-f]{6})$/,
|
3037 | reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
|
3038 | reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
|
3039 | reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
|
3040 | reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
|
3041 | reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
|
3042 | reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
|
3043 |
|
3044 | var named = {
|
3045 | aliceblue: 0xf0f8ff,
|
3046 | antiquewhite: 0xfaebd7,
|
3047 | aqua: 0x00ffff,
|
3048 | aquamarine: 0x7fffd4,
|
3049 | azure: 0xf0ffff,
|
3050 | beige: 0xf5f5dc,
|
3051 | bisque: 0xffe4c4,
|
3052 | black: 0x000000,
|
3053 | blanchedalmond: 0xffebcd,
|
3054 | blue: 0x0000ff,
|
3055 | blueviolet: 0x8a2be2,
|
3056 | brown: 0xa52a2a,
|
3057 | burlywood: 0xdeb887,
|
3058 | cadetblue: 0x5f9ea0,
|
3059 | chartreuse: 0x7fff00,
|
3060 | chocolate: 0xd2691e,
|
3061 | coral: 0xff7f50,
|
3062 | cornflowerblue: 0x6495ed,
|
3063 | cornsilk: 0xfff8dc,
|
3064 | crimson: 0xdc143c,
|
3065 | cyan: 0x00ffff,
|
3066 | darkblue: 0x00008b,
|
3067 | darkcyan: 0x008b8b,
|
3068 | darkgoldenrod: 0xb8860b,
|
3069 | darkgray: 0xa9a9a9,
|
3070 | darkgreen: 0x006400,
|
3071 | darkgrey: 0xa9a9a9,
|
3072 | darkkhaki: 0xbdb76b,
|
3073 | darkmagenta: 0x8b008b,
|
3074 | darkolivegreen: 0x556b2f,
|
3075 | darkorange: 0xff8c00,
|
3076 | darkorchid: 0x9932cc,
|
3077 | darkred: 0x8b0000,
|
3078 | darksalmon: 0xe9967a,
|
3079 | darkseagreen: 0x8fbc8f,
|
3080 | darkslateblue: 0x483d8b,
|
3081 | darkslategray: 0x2f4f4f,
|
3082 | darkslategrey: 0x2f4f4f,
|
3083 | darkturquoise: 0x00ced1,
|
3084 | darkviolet: 0x9400d3,
|
3085 | deeppink: 0xff1493,
|
3086 | deepskyblue: 0x00bfff,
|
3087 | dimgray: 0x696969,
|
3088 | dimgrey: 0x696969,
|
3089 | dodgerblue: 0x1e90ff,
|
3090 | firebrick: 0xb22222,
|
3091 | floralwhite: 0xfffaf0,
|
3092 | forestgreen: 0x228b22,
|
3093 | fuchsia: 0xff00ff,
|
3094 | gainsboro: 0xdcdcdc,
|
3095 | ghostwhite: 0xf8f8ff,
|
3096 | gold: 0xffd700,
|
3097 | goldenrod: 0xdaa520,
|
3098 | gray: 0x808080,
|
3099 | green: 0x008000,
|
3100 | greenyellow: 0xadff2f,
|
3101 | grey: 0x808080,
|
3102 | honeydew: 0xf0fff0,
|
3103 | hotpink: 0xff69b4,
|
3104 | indianred: 0xcd5c5c,
|
3105 | indigo: 0x4b0082,
|
3106 | ivory: 0xfffff0,
|
3107 | khaki: 0xf0e68c,
|
3108 | lavender: 0xe6e6fa,
|
3109 | lavenderblush: 0xfff0f5,
|
3110 | lawngreen: 0x7cfc00,
|
3111 | lemonchiffon: 0xfffacd,
|
3112 | lightblue: 0xadd8e6,
|
3113 | lightcoral: 0xf08080,
|
3114 | lightcyan: 0xe0ffff,
|
3115 | lightgoldenrodyellow: 0xfafad2,
|
3116 | lightgray: 0xd3d3d3,
|
3117 | lightgreen: 0x90ee90,
|
3118 | lightgrey: 0xd3d3d3,
|
3119 | lightpink: 0xffb6c1,
|
3120 | lightsalmon: 0xffa07a,
|
3121 | lightseagreen: 0x20b2aa,
|
3122 | lightskyblue: 0x87cefa,
|
3123 | lightslategray: 0x778899,
|
3124 | lightslategrey: 0x778899,
|
3125 | lightsteelblue: 0xb0c4de,
|
3126 | lightyellow: 0xffffe0,
|
3127 | lime: 0x00ff00,
|
3128 | limegreen: 0x32cd32,
|
3129 | linen: 0xfaf0e6,
|
3130 | magenta: 0xff00ff,
|
3131 | maroon: 0x800000,
|
3132 | mediumaquamarine: 0x66cdaa,
|
3133 | mediumblue: 0x0000cd,
|
3134 | mediumorchid: 0xba55d3,
|
3135 | mediumpurple: 0x9370db,
|
3136 | mediumseagreen: 0x3cb371,
|
3137 | mediumslateblue: 0x7b68ee,
|
3138 | mediumspringgreen: 0x00fa9a,
|
3139 | mediumturquoise: 0x48d1cc,
|
3140 | mediumvioletred: 0xc71585,
|
3141 | midnightblue: 0x191970,
|
3142 | mintcream: 0xf5fffa,
|
3143 | mistyrose: 0xffe4e1,
|
3144 | moccasin: 0xffe4b5,
|
3145 | navajowhite: 0xffdead,
|
3146 | navy: 0x000080,
|
3147 | oldlace: 0xfdf5e6,
|
3148 | olive: 0x808000,
|
3149 | olivedrab: 0x6b8e23,
|
3150 | orange: 0xffa500,
|
3151 | orangered: 0xff4500,
|
3152 | orchid: 0xda70d6,
|
3153 | palegoldenrod: 0xeee8aa,
|
3154 | palegreen: 0x98fb98,
|
3155 | paleturquoise: 0xafeeee,
|
3156 | palevioletred: 0xdb7093,
|
3157 | papayawhip: 0xffefd5,
|
3158 | peachpuff: 0xffdab9,
|
3159 | peru: 0xcd853f,
|
3160 | pink: 0xffc0cb,
|
3161 | plum: 0xdda0dd,
|
3162 | powderblue: 0xb0e0e6,
|
3163 | purple: 0x800080,
|
3164 | rebeccapurple: 0x663399,
|
3165 | red: 0xff0000,
|
3166 | rosybrown: 0xbc8f8f,
|
3167 | royalblue: 0x4169e1,
|
3168 | saddlebrown: 0x8b4513,
|
3169 | salmon: 0xfa8072,
|
3170 | sandybrown: 0xf4a460,
|
3171 | seagreen: 0x2e8b57,
|
3172 | seashell: 0xfff5ee,
|
3173 | sienna: 0xa0522d,
|
3174 | silver: 0xc0c0c0,
|
3175 | skyblue: 0x87ceeb,
|
3176 | slateblue: 0x6a5acd,
|
3177 | slategray: 0x708090,
|
3178 | slategrey: 0x708090,
|
3179 | snow: 0xfffafa,
|
3180 | springgreen: 0x00ff7f,
|
3181 | steelblue: 0x4682b4,
|
3182 | tan: 0xd2b48c,
|
3183 | teal: 0x008080,
|
3184 | thistle: 0xd8bfd8,
|
3185 | tomato: 0xff6347,
|
3186 | turquoise: 0x40e0d0,
|
3187 | violet: 0xee82ee,
|
3188 | wheat: 0xf5deb3,
|
3189 | white: 0xffffff,
|
3190 | whitesmoke: 0xf5f5f5,
|
3191 | yellow: 0xffff00,
|
3192 | yellowgreen: 0x9acd32
|
3193 | };
|
3194 |
|
3195 | define(Color, color_color, {
|
3196 | displayable: function() {
|
3197 | return this.rgb().displayable();
|
3198 | },
|
3199 | hex: function() {
|
3200 | return this.rgb().hex();
|
3201 | },
|
3202 | toString: function() {
|
3203 | return this.rgb() + "";
|
3204 | }
|
3205 | });
|
3206 |
|
3207 | function color_color(format) {
|
3208 | var m;
|
3209 | format = (format + "").trim().toLowerCase();
|
3210 | 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))
|
3211 | : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16))
|
3212 | : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1)
|
3213 | : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1)
|
3214 | : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4])
|
3215 | : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4])
|
3216 | : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1)
|
3217 | : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4])
|
3218 | : named.hasOwnProperty(format) ? rgbn(named[format])
|
3219 | : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
|
3220 | : null;
|
3221 | }
|
3222 |
|
3223 | function rgbn(n) {
|
3224 | return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
3225 | }
|
3226 |
|
3227 | function rgba(r, g, b, a) {
|
3228 | if (a <= 0) r = g = b = NaN;
|
3229 | return new Rgb(r, g, b, a);
|
3230 | }
|
3231 |
|
3232 | function rgbConvert(o) {
|
3233 | if (!(o instanceof Color)) o = color_color(o);
|
3234 | if (!o) return new Rgb;
|
3235 | o = o.rgb();
|
3236 | return new Rgb(o.r, o.g, o.b, o.opacity);
|
3237 | }
|
3238 |
|
3239 | function color_rgb(r, g, b, opacity) {
|
3240 | return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
3241 | }
|
3242 |
|
3243 | function Rgb(r, g, b, opacity) {
|
3244 | this.r = +r;
|
3245 | this.g = +g;
|
3246 | this.b = +b;
|
3247 | this.opacity = +opacity;
|
3248 | }
|
3249 |
|
3250 | define(Rgb, color_rgb, extend(Color, {
|
3251 | brighter: function(k) {
|
3252 | k = k == null ? brighter : Math.pow(brighter, k);
|
3253 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
3254 | },
|
3255 | darker: function(k) {
|
3256 | k = k == null ? darker : Math.pow(darker, k);
|
3257 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
3258 | },
|
3259 | rgb: function() {
|
3260 | return this;
|
3261 | },
|
3262 | displayable: function() {
|
3263 | return (0 <= this.r && this.r <= 255)
|
3264 | && (0 <= this.g && this.g <= 255)
|
3265 | && (0 <= this.b && this.b <= 255)
|
3266 | && (0 <= this.opacity && this.opacity <= 1);
|
3267 | },
|
3268 | hex: function() {
|
3269 | return "#" + hex(this.r) + hex(this.g) + hex(this.b);
|
3270 | },
|
3271 | toString: function() {
|
3272 | var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
3273 | return (a === 1 ? "rgb(" : "rgba(")
|
3274 | + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
|
3275 | + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
|
3276 | + Math.max(0, Math.min(255, Math.round(this.b) || 0))
|
3277 | + (a === 1 ? ")" : ", " + a + ")");
|
3278 | }
|
3279 | }));
|
3280 |
|
3281 | function hex(value) {
|
3282 | value = Math.max(0, Math.min(255, Math.round(value) || 0));
|
3283 | return (value < 16 ? "0" : "") + value.toString(16);
|
3284 | }
|
3285 |
|
3286 | function hsla(h, s, l, a) {
|
3287 | if (a <= 0) h = s = l = NaN;
|
3288 | else if (l <= 0 || l >= 1) h = s = NaN;
|
3289 | else if (s <= 0) h = NaN;
|
3290 | return new Hsl(h, s, l, a);
|
3291 | }
|
3292 |
|
3293 | function hslConvert(o) {
|
3294 | if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
3295 | if (!(o instanceof Color)) o = color_color(o);
|
3296 | if (!o) return new Hsl;
|
3297 | if (o instanceof Hsl) return o;
|
3298 | o = o.rgb();
|
3299 | var r = o.r / 255,
|
3300 | g = o.g / 255,
|
3301 | b = o.b / 255,
|
3302 | min = Math.min(r, g, b),
|
3303 | max = Math.max(r, g, b),
|
3304 | h = NaN,
|
3305 | s = max - min,
|
3306 | l = (max + min) / 2;
|
3307 | if (s) {
|
3308 | if (r === max) h = (g - b) / s + (g < b) * 6;
|
3309 | else if (g === max) h = (b - r) / s + 2;
|
3310 | else h = (r - g) / s + 4;
|
3311 | s /= l < 0.5 ? max + min : 2 - max - min;
|
3312 | h *= 60;
|
3313 | } else {
|
3314 | s = l > 0 && l < 1 ? 0 : h;
|
3315 | }
|
3316 | return new Hsl(h, s, l, o.opacity);
|
3317 | }
|
3318 |
|
3319 | function hsl(h, s, l, opacity) {
|
3320 | return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
3321 | }
|
3322 |
|
3323 | function Hsl(h, s, l, opacity) {
|
3324 | this.h = +h;
|
3325 | this.s = +s;
|
3326 | this.l = +l;
|
3327 | this.opacity = +opacity;
|
3328 | }
|
3329 |
|
3330 | define(Hsl, hsl, extend(Color, {
|
3331 | brighter: function(k) {
|
3332 | k = k == null ? brighter : Math.pow(brighter, k);
|
3333 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
3334 | },
|
3335 | darker: function(k) {
|
3336 | k = k == null ? darker : Math.pow(darker, k);
|
3337 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
3338 | },
|
3339 | rgb: function() {
|
3340 | var h = this.h % 360 + (this.h < 0) * 360,
|
3341 | s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
3342 | l = this.l,
|
3343 | m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
3344 | m1 = 2 * l - m2;
|
3345 | return new Rgb(
|
3346 | hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
3347 | hsl2rgb(h, m1, m2),
|
3348 | hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
3349 | this.opacity
|
3350 | );
|
3351 | },
|
3352 | displayable: function() {
|
3353 | return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
3354 | && (0 <= this.l && this.l <= 1)
|
3355 | && (0 <= this.opacity && this.opacity <= 1);
|
3356 | }
|
3357 | }));
|
3358 |
|
3359 |
|
3360 | function hsl2rgb(h, m1, m2) {
|
3361 | return (h < 60 ? m1 + (m2 - m1) * h / 60
|
3362 | : h < 180 ? m2
|
3363 | : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
3364 | : m1) * 255;
|
3365 | }
|
3366 |
|
3367 |
|
3368 | var deg2rad = Math.PI / 180;
|
3369 | var rad2deg = 180 / Math.PI;
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 | var K = 18,
|
3378 | Xn = 0.96422,
|
3379 | Yn = 1,
|
3380 | Zn = 0.82521,
|
3381 | lab_t0 = 4 / 29,
|
3382 | lab_t1 = 6 / 29,
|
3383 | lab_t2 = 3 * lab_t1 * lab_t1,
|
3384 | t3 = lab_t1 * lab_t1 * lab_t1;
|
3385 |
|
3386 | function labConvert(o) {
|
3387 | if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
|
3388 | if (o instanceof Hcl) {
|
3389 | if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
|
3390 | var h = o.h * deg2rad;
|
3391 | return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
|
3392 | }
|
3393 | if (!(o instanceof Rgb)) o = rgbConvert(o);
|
3394 | var r = rgb2lrgb(o.r),
|
3395 | g = rgb2lrgb(o.g),
|
3396 | b = rgb2lrgb(o.b),
|
3397 | y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
|
3398 | if (r === g && g === b) x = z = y; else {
|
3399 | x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
|
3400 | z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
|
3401 | }
|
3402 | return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
|
3403 | }
|
3404 |
|
3405 | function gray(l, opacity) {
|
3406 | return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
|
3407 | }
|
3408 |
|
3409 | function lab(l, a, b, opacity) {
|
3410 | return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
|
3411 | }
|
3412 |
|
3413 | function Lab(l, a, b, opacity) {
|
3414 | this.l = +l;
|
3415 | this.a = +a;
|
3416 | this.b = +b;
|
3417 | this.opacity = +opacity;
|
3418 | }
|
3419 |
|
3420 | define(Lab, lab, extend(Color, {
|
3421 | brighter: function(k) {
|
3422 | return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
3423 | },
|
3424 | darker: function(k) {
|
3425 | return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
3426 | },
|
3427 | rgb: function() {
|
3428 | var y = (this.l + 16) / 116,
|
3429 | x = isNaN(this.a) ? y : y + this.a / 500,
|
3430 | z = isNaN(this.b) ? y : y - this.b / 200;
|
3431 | x = Xn * lab2xyz(x);
|
3432 | y = Yn * lab2xyz(y);
|
3433 | z = Zn * lab2xyz(z);
|
3434 | return new Rgb(
|
3435 | lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
|
3436 | lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
|
3437 | lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
|
3438 | this.opacity
|
3439 | );
|
3440 | }
|
3441 | }));
|
3442 |
|
3443 | function xyz2lab(t) {
|
3444 | return t > t3 ? Math.pow(t, 1 / 3) : t / lab_t2 + lab_t0;
|
3445 | }
|
3446 |
|
3447 | function lab2xyz(t) {
|
3448 | return t > lab_t1 ? t * t * t : lab_t2 * (t - lab_t0);
|
3449 | }
|
3450 |
|
3451 | function lrgb2rgb(x) {
|
3452 | return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
3453 | }
|
3454 |
|
3455 | function rgb2lrgb(x) {
|
3456 | return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
3457 | }
|
3458 |
|
3459 | function hclConvert(o) {
|
3460 | if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
|
3461 | if (!(o instanceof Lab)) o = labConvert(o);
|
3462 | if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity);
|
3463 | var h = Math.atan2(o.b, o.a) * rad2deg;
|
3464 | return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
|
3465 | }
|
3466 |
|
3467 | function lch(l, c, h, opacity) {
|
3468 | return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
|
3469 | }
|
3470 |
|
3471 | function hcl(h, c, l, opacity) {
|
3472 | return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
|
3473 | }
|
3474 |
|
3475 | function Hcl(h, c, l, opacity) {
|
3476 | this.h = +h;
|
3477 | this.c = +c;
|
3478 | this.l = +l;
|
3479 | this.opacity = +opacity;
|
3480 | }
|
3481 |
|
3482 | define(Hcl, hcl, extend(Color, {
|
3483 | brighter: function(k) {
|
3484 | return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
|
3485 | },
|
3486 | darker: function(k) {
|
3487 | return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
|
3488 | },
|
3489 | rgb: function() {
|
3490 | return labConvert(this).rgb();
|
3491 | }
|
3492 | }));
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 | var A = -0.14861,
|
3500 | B = +1.78277,
|
3501 | C = -0.29227,
|
3502 | cubehelix_D = -0.90649,
|
3503 | cubehelix_E = +1.97294,
|
3504 | ED = cubehelix_E * cubehelix_D,
|
3505 | EB = cubehelix_E * B,
|
3506 | BC_DA = B * C - cubehelix_D * A;
|
3507 |
|
3508 | function cubehelixConvert(o) {
|
3509 | if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
|
3510 | if (!(o instanceof Rgb)) o = rgbConvert(o);
|
3511 | var r = o.r / 255,
|
3512 | g = o.g / 255,
|
3513 | b = o.b / 255,
|
3514 | l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
|
3515 | bl = b - l,
|
3516 | k = (cubehelix_E * (g - l) - C * bl) / cubehelix_D,
|
3517 | s = Math.sqrt(k * k + bl * bl) / (cubehelix_E * l * (1 - l)),
|
3518 | h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
|
3519 | return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
|
3520 | }
|
3521 |
|
3522 | function cubehelix_cubehelix(h, s, l, opacity) {
|
3523 | return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
|
3524 | }
|
3525 |
|
3526 | function Cubehelix(h, s, l, opacity) {
|
3527 | this.h = +h;
|
3528 | this.s = +s;
|
3529 | this.l = +l;
|
3530 | this.opacity = +opacity;
|
3531 | }
|
3532 |
|
3533 | define(Cubehelix, cubehelix_cubehelix, extend(Color, {
|
3534 | brighter: function(k) {
|
3535 | k = k == null ? brighter : Math.pow(brighter, k);
|
3536 | return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
3537 | },
|
3538 | darker: function(k) {
|
3539 | k = k == null ? darker : Math.pow(darker, k);
|
3540 | return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
3541 | },
|
3542 | rgb: function() {
|
3543 | var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
|
3544 | l = +this.l,
|
3545 | a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
|
3546 | cosh = Math.cos(h),
|
3547 | sinh = Math.sin(h);
|
3548 | return new Rgb(
|
3549 | 255 * (l + a * (A * cosh + B * sinh)),
|
3550 | 255 * (l + a * (C * cosh + cubehelix_D * sinh)),
|
3551 | 255 * (l + a * (cubehelix_E * cosh)),
|
3552 | this.opacity
|
3553 | );
|
3554 | }
|
3555 | }));
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 | function basis(t1, v0, v1, v2, v3) {
|
3564 | var t2 = t1 * t1, t3 = t2 * t1;
|
3565 | return ((1 - 3 * t1 + 3 * t2 - t3) * v0
|
3566 | + (4 - 6 * t2 + 3 * t3) * v1
|
3567 | + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
|
3568 | + t3 * v3) / 6;
|
3569 | }
|
3570 |
|
3571 | var src_basis = (function(values) {
|
3572 | var n = values.length - 1;
|
3573 | return function(t) {
|
3574 | var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
|
3575 | v1 = values[i],
|
3576 | v2 = values[i + 1],
|
3577 | v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
|
3578 | v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
3579 | return basis((t - i / n) * n, v0, v1, v2, v3);
|
3580 | };
|
3581 | });
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 | var basisClosed = (function(values) {
|
3587 | var n = values.length;
|
3588 | return function(t) {
|
3589 | var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
|
3590 | v0 = values[(i + n - 1) % n],
|
3591 | v1 = values[i % n],
|
3592 | v2 = values[(i + 1) % n],
|
3593 | v3 = values[(i + 2) % n];
|
3594 | return basis((t - i / n) * n, v0, v1, v2, v3);
|
3595 | };
|
3596 | });
|
3597 |
|
3598 |
|
3599 | var src_constant = (function(x) {
|
3600 | return function() {
|
3601 | return x;
|
3602 | };
|
3603 | });
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 | function linear(a, d) {
|
3609 | return function(t) {
|
3610 | return a + t * d;
|
3611 | };
|
3612 | }
|
3613 |
|
3614 | function exponential(a, b, y) {
|
3615 | return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
3616 | return Math.pow(a + t * b, y);
|
3617 | };
|
3618 | }
|
3619 |
|
3620 | function color_hue(a, b) {
|
3621 | var d = b - a;
|
3622 | return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : src_constant(isNaN(a) ? b : a);
|
3623 | }
|
3624 |
|
3625 | function gamma(y) {
|
3626 | return (y = +y) === 1 ? nogamma : function(a, b) {
|
3627 | return b - a ? exponential(a, b, y) : src_constant(isNaN(a) ? b : a);
|
3628 | };
|
3629 | }
|
3630 |
|
3631 | function nogamma(a, b) {
|
3632 | var d = b - a;
|
3633 | return d ? linear(a, d) : src_constant(isNaN(a) ? b : a);
|
3634 | }
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 | var src_rgb = ((function rgbGamma(y) {
|
3643 | var color = gamma(y);
|
3644 |
|
3645 | function rgb(start, end) {
|
3646 | var r = color((start = color_rgb(start)).r, (end = color_rgb(end)).r),
|
3647 | g = color(start.g, end.g),
|
3648 | b = color(start.b, end.b),
|
3649 | opacity = nogamma(start.opacity, end.opacity);
|
3650 | return function(t) {
|
3651 | start.r = r(t);
|
3652 | start.g = g(t);
|
3653 | start.b = b(t);
|
3654 | start.opacity = opacity(t);
|
3655 | return start + "";
|
3656 | };
|
3657 | }
|
3658 |
|
3659 | rgb.gamma = rgbGamma;
|
3660 |
|
3661 | return rgb;
|
3662 | })(1));
|
3663 |
|
3664 | function rgbSpline(spline) {
|
3665 | return function(colors) {
|
3666 | var n = colors.length,
|
3667 | r = new Array(n),
|
3668 | g = new Array(n),
|
3669 | b = new Array(n),
|
3670 | i, color;
|
3671 | for (i = 0; i < n; ++i) {
|
3672 | color = color_rgb(colors[i]);
|
3673 | r[i] = color.r || 0;
|
3674 | g[i] = color.g || 0;
|
3675 | b[i] = color.b || 0;
|
3676 | }
|
3677 | r = spline(r);
|
3678 | g = spline(g);
|
3679 | b = spline(b);
|
3680 | color.opacity = 1;
|
3681 | return function(t) {
|
3682 | color.r = r(t);
|
3683 | color.g = g(t);
|
3684 | color.b = b(t);
|
3685 | return color + "";
|
3686 | };
|
3687 | };
|
3688 | }
|
3689 |
|
3690 | var rgbBasis = rgbSpline(src_basis);
|
3691 | var rgbBasisClosed = rgbSpline(basisClosed);
|
3692 |
|
3693 |
|
3694 |
|
3695 |
|
3696 | var src_array = (function(a, b) {
|
3697 | var nb = b ? b.length : 0,
|
3698 | na = a ? Math.min(nb, a.length) : 0,
|
3699 | x = new Array(na),
|
3700 | c = new Array(nb),
|
3701 | i;
|
3702 |
|
3703 | for (i = 0; i < na; ++i) x[i] = src_value(a[i], b[i]);
|
3704 | for (; i < nb; ++i) c[i] = b[i];
|
3705 |
|
3706 | return function(t) {
|
3707 | for (i = 0; i < na; ++i) c[i] = x[i](t);
|
3708 | return c;
|
3709 | };
|
3710 | });
|
3711 |
|
3712 |
|
3713 | var src_date = (function(a, b) {
|
3714 | var d = new Date;
|
3715 | return a = +a, b -= a, function(t) {
|
3716 | return d.setTime(a + b * t), d;
|
3717 | };
|
3718 | });
|
3719 |
|
3720 |
|
3721 | var number = (function(a, b) {
|
3722 | return a = +a, b -= a, function(t) {
|
3723 | return a + b * t;
|
3724 | };
|
3725 | });
|
3726 |
|
3727 |
|
3728 |
|
3729 |
|
3730 | var object = (function(a, b) {
|
3731 | var i = {},
|
3732 | c = {},
|
3733 | k;
|
3734 |
|
3735 | if (a === null || typeof a !== "object") a = {};
|
3736 | if (b === null || typeof b !== "object") b = {};
|
3737 |
|
3738 | for (k in b) {
|
3739 | if (k in a) {
|
3740 | i[k] = src_value(a[k], b[k]);
|
3741 | } else {
|
3742 | c[k] = b[k];
|
3743 | }
|
3744 | }
|
3745 |
|
3746 | return function(t) {
|
3747 | for (k in i) c[k] = i[k](t);
|
3748 | return c;
|
3749 | };
|
3750 | });
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 | var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
|
3756 | reB = new RegExp(reA.source, "g");
|
3757 |
|
3758 | function string_zero(b) {
|
3759 | return function() {
|
3760 | return b;
|
3761 | };
|
3762 | }
|
3763 |
|
3764 | function one(b) {
|
3765 | return function(t) {
|
3766 | return b(t) + "";
|
3767 | };
|
3768 | }
|
3769 |
|
3770 | var src_string = (function(a, b) {
|
3771 | var bi = reA.lastIndex = reB.lastIndex = 0,
|
3772 | am,
|
3773 | bm,
|
3774 | bs,
|
3775 | i = -1,
|
3776 | s = [],
|
3777 | q = [];
|
3778 |
|
3779 |
|
3780 | a = a + "", b = b + "";
|
3781 |
|
3782 |
|
3783 | while ((am = reA.exec(a))
|
3784 | && (bm = reB.exec(b))) {
|
3785 | if ((bs = bm.index) > bi) {
|
3786 | bs = b.slice(bi, bs);
|
3787 | if (s[i]) s[i] += bs;
|
3788 | else s[++i] = bs;
|
3789 | }
|
3790 | if ((am = am[0]) === (bm = bm[0])) {
|
3791 | if (s[i]) s[i] += bm;
|
3792 | else s[++i] = bm;
|
3793 | } else {
|
3794 | s[++i] = null;
|
3795 | q.push({i: i, x: number(am, bm)});
|
3796 | }
|
3797 | bi = reB.lastIndex;
|
3798 | }
|
3799 |
|
3800 |
|
3801 | if (bi < b.length) {
|
3802 | bs = b.slice(bi);
|
3803 | if (s[i]) s[i] += bs;
|
3804 | else s[++i] = bs;
|
3805 | }
|
3806 |
|
3807 |
|
3808 |
|
3809 | return s.length < 2 ? (q[0]
|
3810 | ? one(q[0].x)
|
3811 | : string_zero(b))
|
3812 | : (b = q.length, function(t) {
|
3813 | for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
|
3814 | return s.join("");
|
3815 | });
|
3816 | });
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 | var src_value = (function(a, b) {
|
3829 | var t = typeof b, c;
|
3830 | return b == null || t === "boolean" ? src_constant(b)
|
3831 | : (t === "number" ? number
|
3832 | : t === "string" ? ((c = color_color(b)) ? (b = c, src_rgb) : src_string)
|
3833 | : b instanceof color_color ? src_rgb
|
3834 | : b instanceof Date ? src_date
|
3835 | : Array.isArray(b) ? src_array
|
3836 | : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
|
3837 | : number)(a, b);
|
3838 | });
|
3839 |
|
3840 |
|
3841 | var discrete = (function(range) {
|
3842 | var n = range.length;
|
3843 | return function(t) {
|
3844 | return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
|
3845 | };
|
3846 | });
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 | var src_hue = (function(a, b) {
|
3852 | var i = color_hue(+a, +b);
|
3853 | return function(t) {
|
3854 | var x = i(t);
|
3855 | return x - 360 * Math.floor(x / 360);
|
3856 | };
|
3857 | });
|
3858 |
|
3859 |
|
3860 | var src_round = (function(a, b) {
|
3861 | return a = +a, b -= a, function(t) {
|
3862 | return Math.round(a + b * t);
|
3863 | };
|
3864 | });
|
3865 |
|
3866 |
|
3867 | var degrees = 180 / Math.PI;
|
3868 |
|
3869 | var identity = {
|
3870 | translateX: 0,
|
3871 | translateY: 0,
|
3872 | rotate: 0,
|
3873 | skewX: 0,
|
3874 | scaleX: 1,
|
3875 | scaleY: 1
|
3876 | };
|
3877 |
|
3878 | var decompose = (function(a, b, c, d, e, f) {
|
3879 | var scaleX, scaleY, skewX;
|
3880 | if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
|
3881 | if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
|
3882 | if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
|
3883 | if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
|
3884 | return {
|
3885 | translateX: e,
|
3886 | translateY: f,
|
3887 | rotate: Math.atan2(b, a) * degrees,
|
3888 | skewX: Math.atan(skewX) * degrees,
|
3889 | scaleX: scaleX,
|
3890 | scaleY: scaleY
|
3891 | };
|
3892 | });
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 | var cssNode,
|
3898 | cssRoot,
|
3899 | cssView,
|
3900 | svgNode;
|
3901 |
|
3902 | function parseCss(value) {
|
3903 | if (value === "none") return identity;
|
3904 | if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
|
3905 | cssNode.style.transform = value;
|
3906 | value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
|
3907 | cssRoot.removeChild(cssNode);
|
3908 | value = value.slice(7, -1).split(",");
|
3909 | return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
|
3910 | }
|
3911 |
|
3912 | function parseSvg(value) {
|
3913 | if (value == null) return identity;
|
3914 | if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
3915 | svgNode.setAttribute("transform", value);
|
3916 | if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
|
3917 | value = value.matrix;
|
3918 | return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
3919 | }
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 | function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
3926 |
|
3927 | function pop(s) {
|
3928 | return s.length ? s.pop() + " " : "";
|
3929 | }
|
3930 |
|
3931 | function translate(xa, ya, xb, yb, s, q) {
|
3932 | if (xa !== xb || ya !== yb) {
|
3933 | var i = s.push("translate(", null, pxComma, null, pxParen);
|
3934 | q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
|
3935 | } else if (xb || yb) {
|
3936 | s.push("translate(" + xb + pxComma + yb + pxParen);
|
3937 | }
|
3938 | }
|
3939 |
|
3940 | function rotate(a, b, s, q) {
|
3941 | if (a !== b) {
|
3942 | if (a - b > 180) b += 360; else if (b - a > 180) a += 360;
|
3943 | q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)});
|
3944 | } else if (b) {
|
3945 | s.push(pop(s) + "rotate(" + b + degParen);
|
3946 | }
|
3947 | }
|
3948 |
|
3949 | function skewX(a, b, s, q) {
|
3950 | if (a !== b) {
|
3951 | q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)});
|
3952 | } else if (b) {
|
3953 | s.push(pop(s) + "skewX(" + b + degParen);
|
3954 | }
|
3955 | }
|
3956 |
|
3957 | function scale(xa, ya, xb, yb, s, q) {
|
3958 | if (xa !== xb || ya !== yb) {
|
3959 | var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
3960 | q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
|
3961 | } else if (xb !== 1 || yb !== 1) {
|
3962 | s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
3963 | }
|
3964 | }
|
3965 |
|
3966 | return function(a, b) {
|
3967 | var s = [],
|
3968 | q = [];
|
3969 | a = parse(a), b = parse(b);
|
3970 | translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
3971 | rotate(a.rotate, b.rotate, s, q);
|
3972 | skewX(a.skewX, b.skewX, s, q);
|
3973 | scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
3974 | a = b = null;
|
3975 | return function(t) {
|
3976 | var i = -1, n = q.length, o;
|
3977 | while (++i < n) s[(o = q[i]).i] = o.x(t);
|
3978 | return s.join("");
|
3979 | };
|
3980 | };
|
3981 | }
|
3982 |
|
3983 | var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
3984 | var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
3985 |
|
3986 |
|
3987 | var rho = Math.SQRT2,
|
3988 | rho2 = 2,
|
3989 | rho4 = 4,
|
3990 | epsilon2 = 1e-12;
|
3991 |
|
3992 | function zoom_cosh(x) {
|
3993 | return ((x = Math.exp(x)) + 1 / x) / 2;
|
3994 | }
|
3995 |
|
3996 | function zoom_sinh(x) {
|
3997 | return ((x = Math.exp(x)) - 1 / x) / 2;
|
3998 | }
|
3999 |
|
4000 | function tanh(x) {
|
4001 | return ((x = Math.exp(2 * x)) - 1) / (x + 1);
|
4002 | }
|
4003 |
|
4004 |
|
4005 |
|
4006 | var src_zoom = (function(p0, p1) {
|
4007 | var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
|
4008 | ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
|
4009 | dx = ux1 - ux0,
|
4010 | dy = uy1 - uy0,
|
4011 | d2 = dx * dx + dy * dy,
|
4012 | i,
|
4013 | S;
|
4014 |
|
4015 |
|
4016 | if (d2 < epsilon2) {
|
4017 | S = Math.log(w1 / w0) / rho;
|
4018 | i = function(t) {
|
4019 | return [
|
4020 | ux0 + t * dx,
|
4021 | uy0 + t * dy,
|
4022 | w0 * Math.exp(rho * t * S)
|
4023 | ];
|
4024 | }
|
4025 | }
|
4026 |
|
4027 |
|
4028 | else {
|
4029 | var d1 = Math.sqrt(d2),
|
4030 | b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
|
4031 | b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
|
4032 | r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
|
4033 | r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
4034 | S = (r1 - r0) / rho;
|
4035 | i = function(t) {
|
4036 | var s = t * S,
|
4037 | coshr0 = zoom_cosh(r0),
|
4038 | u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - zoom_sinh(r0));
|
4039 | return [
|
4040 | ux0 + u * dx,
|
4041 | uy0 + u * dy,
|
4042 | w0 * coshr0 / zoom_cosh(rho * s + r0)
|
4043 | ];
|
4044 | }
|
4045 | }
|
4046 |
|
4047 | i.duration = S * 1000;
|
4048 |
|
4049 | return i;
|
4050 | });
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 | function hsl_hsl(hue) {
|
4057 | return function(start, end) {
|
4058 | var h = hue((start = hsl(start)).h, (end = hsl(end)).h),
|
4059 | s = nogamma(start.s, end.s),
|
4060 | l = nogamma(start.l, end.l),
|
4061 | opacity = nogamma(start.opacity, end.opacity);
|
4062 | return function(t) {
|
4063 | start.h = h(t);
|
4064 | start.s = s(t);
|
4065 | start.l = l(t);
|
4066 | start.opacity = opacity(t);
|
4067 | return start + "";
|
4068 | };
|
4069 | }
|
4070 | }
|
4071 |
|
4072 | var src_hsl = (hsl_hsl(color_hue));
|
4073 | var hslLong = hsl_hsl(nogamma);
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 | function lab_lab(start, end) {
|
4080 | var l = nogamma((start = lab(start)).l, (end = lab(end)).l),
|
4081 | a = nogamma(start.a, end.a),
|
4082 | b = nogamma(start.b, end.b),
|
4083 | opacity = nogamma(start.opacity, end.opacity);
|
4084 | return function(t) {
|
4085 | start.l = l(t);
|
4086 | start.a = a(t);
|
4087 | start.b = b(t);
|
4088 | start.opacity = opacity(t);
|
4089 | return start + "";
|
4090 | };
|
4091 | }
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 | function hcl_hcl(hue) {
|
4098 | return function(start, end) {
|
4099 | var h = hue((start = hcl(start)).h, (end = hcl(end)).h),
|
4100 | c = nogamma(start.c, end.c),
|
4101 | l = nogamma(start.l, end.l),
|
4102 | opacity = nogamma(start.opacity, end.opacity);
|
4103 | return function(t) {
|
4104 | start.h = h(t);
|
4105 | start.c = c(t);
|
4106 | start.l = l(t);
|
4107 | start.opacity = opacity(t);
|
4108 | return start + "";
|
4109 | };
|
4110 | }
|
4111 | }
|
4112 |
|
4113 | var src_hcl = (hcl_hcl(color_hue));
|
4114 | var hclLong = hcl_hcl(nogamma);
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 | function src_cubehelix_cubehelix(hue) {
|
4121 | return (function cubehelixGamma(y) {
|
4122 | y = +y;
|
4123 |
|
4124 | function cubehelix(start, end) {
|
4125 | var h = hue((start = cubehelix_cubehelix(start)).h, (end = cubehelix_cubehelix(end)).h),
|
4126 | s = nogamma(start.s, end.s),
|
4127 | l = nogamma(start.l, end.l),
|
4128 | opacity = nogamma(start.opacity, end.opacity);
|
4129 | return function(t) {
|
4130 | start.h = h(t);
|
4131 | start.s = s(t);
|
4132 | start.l = l(Math.pow(t, y));
|
4133 | start.opacity = opacity(t);
|
4134 | return start + "";
|
4135 | };
|
4136 | }
|
4137 |
|
4138 | cubehelix.gamma = cubehelixGamma;
|
4139 |
|
4140 | return cubehelix;
|
4141 | })(1);
|
4142 | }
|
4143 |
|
4144 | var src_cubehelix = (src_cubehelix_cubehelix(color_hue));
|
4145 | var cubehelixLong = src_cubehelix_cubehelix(nogamma);
|
4146 |
|
4147 |
|
4148 | function piecewise_piecewise(interpolate, values) {
|
4149 | var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
|
4150 | while (i < n) I[i] = interpolate(v, v = values[++i]);
|
4151 | return function(t) {
|
4152 | var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
|
4153 | return I[i](t - i);
|
4154 | };
|
4155 | }
|
4156 |
|
4157 |
|
4158 | var quantize = (function(interpolator, n) {
|
4159 | var samples = new Array(n);
|
4160 | for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
|
4161 | return samples;
|
4162 | });
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 |
|
4178 |
|
4179 |
|
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 | function tweenRemove(id, name) {
|
4190 | var tween0, tween1;
|
4191 | return function() {
|
4192 | var schedule = schedule_set(this, id),
|
4193 | tween = schedule.tween;
|
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 | if (tween !== tween0) {
|
4199 | tween1 = tween0 = tween;
|
4200 | for (var i = 0, n = tween1.length; i < n; ++i) {
|
4201 | if (tween1[i].name === name) {
|
4202 | tween1 = tween1.slice();
|
4203 | tween1.splice(i, 1);
|
4204 | break;
|
4205 | }
|
4206 | }
|
4207 | }
|
4208 |
|
4209 | schedule.tween = tween1;
|
4210 | };
|
4211 | }
|
4212 |
|
4213 | function tweenFunction(id, name, value) {
|
4214 | var tween0, tween1;
|
4215 | if (typeof value !== "function") throw new Error;
|
4216 | return function() {
|
4217 | var schedule = schedule_set(this, id),
|
4218 | tween = schedule.tween;
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 | if (tween !== tween0) {
|
4224 | tween1 = (tween0 = tween).slice();
|
4225 | for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
|
4226 | if (tween1[i].name === name) {
|
4227 | tween1[i] = t;
|
4228 | break;
|
4229 | }
|
4230 | }
|
4231 | if (i === n) tween1.push(t);
|
4232 | }
|
4233 |
|
4234 | schedule.tween = tween1;
|
4235 | };
|
4236 | }
|
4237 |
|
4238 | var transition_tween = (function(name, value) {
|
4239 | var id = this._id;
|
4240 |
|
4241 | name += "";
|
4242 |
|
4243 | if (arguments.length < 2) {
|
4244 | var tween = schedule_get(this.node(), id).tween;
|
4245 | for (var i = 0, n = tween.length, t; i < n; ++i) {
|
4246 | if ((t = tween[i]).name === name) {
|
4247 | return t.value;
|
4248 | }
|
4249 | }
|
4250 | return null;
|
4251 | }
|
4252 |
|
4253 | return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
4254 | });
|
4255 |
|
4256 | function tweenValue(transition, name, value) {
|
4257 | var id = transition._id;
|
4258 |
|
4259 | transition.each(function() {
|
4260 | var schedule = schedule_set(this, id);
|
4261 | (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
4262 | });
|
4263 |
|
4264 | return function(node) {
|
4265 | return schedule_get(node, id).value[name];
|
4266 | };
|
4267 | }
|
4268 |
|
4269 |
|
4270 |
|
4271 |
|
4272 |
|
4273 | var transition_interpolate = (function(a, b) {
|
4274 | var c;
|
4275 | return (typeof b === "number" ? number
|
4276 | : b instanceof color_color ? src_rgb
|
4277 | : (c = color_color(b)) ? (b = c, src_rgb)
|
4278 | : src_string)(a, b);
|
4279 | });
|
4280 |
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 | function attr_attrRemove(name) {
|
4288 | return function() {
|
4289 | this.removeAttribute(name);
|
4290 | };
|
4291 | }
|
4292 |
|
4293 | function attr_attrRemoveNS(fullname) {
|
4294 | return function() {
|
4295 | this.removeAttributeNS(fullname.space, fullname.local);
|
4296 | };
|
4297 | }
|
4298 |
|
4299 | function attr_attrConstant(name, interpolate, value1) {
|
4300 | var string00,
|
4301 | string1 = value1 + "",
|
4302 | interpolate0;
|
4303 | return function() {
|
4304 | var string0 = this.getAttribute(name);
|
4305 | return string0 === string1 ? null
|
4306 | : string0 === string00 ? interpolate0
|
4307 | : interpolate0 = interpolate(string00 = string0, value1);
|
4308 | };
|
4309 | }
|
4310 |
|
4311 | function attr_attrConstantNS(fullname, interpolate, value1) {
|
4312 | var string00,
|
4313 | string1 = value1 + "",
|
4314 | interpolate0;
|
4315 | return function() {
|
4316 | var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
4317 | return string0 === string1 ? null
|
4318 | : string0 === string00 ? interpolate0
|
4319 | : interpolate0 = interpolate(string00 = string0, value1);
|
4320 | };
|
4321 | }
|
4322 |
|
4323 | function attr_attrFunction(name, interpolate, value) {
|
4324 | var string00,
|
4325 | string10,
|
4326 | interpolate0;
|
4327 | return function() {
|
4328 | var string0, value1 = value(this), string1;
|
4329 | if (value1 == null) return void this.removeAttribute(name);
|
4330 | string0 = this.getAttribute(name);
|
4331 | string1 = value1 + "";
|
4332 | return string0 === string1 ? null
|
4333 | : string0 === string00 && string1 === string10 ? interpolate0
|
4334 | : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
4335 | };
|
4336 | }
|
4337 |
|
4338 | function attr_attrFunctionNS(fullname, interpolate, value) {
|
4339 | var string00,
|
4340 | string10,
|
4341 | interpolate0;
|
4342 | return function() {
|
4343 | var string0, value1 = value(this), string1;
|
4344 | if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
|
4345 | string0 = this.getAttributeNS(fullname.space, fullname.local);
|
4346 | string1 = value1 + "";
|
4347 | return string0 === string1 ? null
|
4348 | : string0 === string00 && string1 === string10 ? interpolate0
|
4349 | : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
4350 | };
|
4351 | }
|
4352 |
|
4353 | var transition_attr = (function(name, value) {
|
4354 | var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : transition_interpolate;
|
4355 | return this.attrTween(name, typeof value === "function"
|
4356 | ? (fullname.local ? attr_attrFunctionNS : attr_attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
|
4357 | : value == null ? (fullname.local ? attr_attrRemoveNS : attr_attrRemove)(fullname)
|
4358 | : (fullname.local ? attr_attrConstantNS : attr_attrConstant)(fullname, i, value));
|
4359 | });
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 | function attrInterpolate(name, i) {
|
4365 | return function(t) {
|
4366 | this.setAttribute(name, i(t));
|
4367 | };
|
4368 | }
|
4369 |
|
4370 | function attrInterpolateNS(fullname, i) {
|
4371 | return function(t) {
|
4372 | this.setAttributeNS(fullname.space, fullname.local, i(t));
|
4373 | };
|
4374 | }
|
4375 |
|
4376 | function attrTweenNS(fullname, value) {
|
4377 | var t0, i0;
|
4378 | function tween() {
|
4379 | var i = value.apply(this, arguments);
|
4380 | if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
4381 | return t0;
|
4382 | }
|
4383 | tween._value = value;
|
4384 | return tween;
|
4385 | }
|
4386 |
|
4387 | function attrTween(name, value) {
|
4388 | var t0, i0;
|
4389 | function tween() {
|
4390 | var i = value.apply(this, arguments);
|
4391 | if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
|
4392 | return t0;
|
4393 | }
|
4394 | tween._value = value;
|
4395 | return tween;
|
4396 | }
|
4397 |
|
4398 | var transition_attrTween = (function(name, value) {
|
4399 | var key = "attr." + name;
|
4400 | if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
4401 | if (value == null) return this.tween(key, null);
|
4402 | if (typeof value !== "function") throw new Error;
|
4403 | var fullname = namespace(name);
|
4404 | return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
4405 | });
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 | function delayFunction(id, value) {
|
4411 | return function() {
|
4412 | schedule_init(this, id).delay = +value.apply(this, arguments);
|
4413 | };
|
4414 | }
|
4415 |
|
4416 | function delayConstant(id, value) {
|
4417 | return value = +value, function() {
|
4418 | schedule_init(this, id).delay = value;
|
4419 | };
|
4420 | }
|
4421 |
|
4422 | var transition_delay = (function(value) {
|
4423 | var id = this._id;
|
4424 |
|
4425 | return arguments.length
|
4426 | ? this.each((typeof value === "function"
|
4427 | ? delayFunction
|
4428 | : delayConstant)(id, value))
|
4429 | : schedule_get(this.node(), id).delay;
|
4430 | });
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 | function durationFunction(id, value) {
|
4436 | return function() {
|
4437 | schedule_set(this, id).duration = +value.apply(this, arguments);
|
4438 | };
|
4439 | }
|
4440 |
|
4441 | function durationConstant(id, value) {
|
4442 | return value = +value, function() {
|
4443 | schedule_set(this, id).duration = value;
|
4444 | };
|
4445 | }
|
4446 |
|
4447 | var transition_duration = (function(value) {
|
4448 | var id = this._id;
|
4449 |
|
4450 | return arguments.length
|
4451 | ? this.each((typeof value === "function"
|
4452 | ? durationFunction
|
4453 | : durationConstant)(id, value))
|
4454 | : schedule_get(this.node(), id).duration;
|
4455 | });
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 | function easeConstant(id, value) {
|
4461 | if (typeof value !== "function") throw new Error;
|
4462 | return function() {
|
4463 | schedule_set(this, id).ease = value;
|
4464 | };
|
4465 | }
|
4466 |
|
4467 | var ease = (function(value) {
|
4468 | var id = this._id;
|
4469 |
|
4470 | return arguments.length
|
4471 | ? this.each(easeConstant(id, value))
|
4472 | : schedule_get(this.node(), id).ease;
|
4473 | });
|
4474 |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 | var transition_filter = (function(match) {
|
4480 | if (typeof match !== "function") match = matcher(match);
|
4481 |
|
4482 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
4483 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
|
4484 | if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
|
4485 | subgroup.push(node);
|
4486 | }
|
4487 | }
|
4488 | }
|
4489 |
|
4490 | return new Transition(subgroups, this._parents, this._name, this._id);
|
4491 | });
|
4492 |
|
4493 |
|
4494 |
|
4495 |
|
4496 | var transition_merge = (function(transition) {
|
4497 | if (transition._id !== this._id) throw new Error;
|
4498 |
|
4499 | 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) {
|
4500 | for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
|
4501 | if (node = group0[i] || group1[i]) {
|
4502 | merge[i] = node;
|
4503 | }
|
4504 | }
|
4505 | }
|
4506 |
|
4507 | for (; j < m0; ++j) {
|
4508 | merges[j] = groups0[j];
|
4509 | }
|
4510 |
|
4511 | return new Transition(merges, this._parents, this._name, this._id);
|
4512 | });
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 | function on_start(name) {
|
4518 | return (name + "").trim().split(/^|\s+/).every(function(t) {
|
4519 | var i = t.indexOf(".");
|
4520 | if (i >= 0) t = t.slice(0, i);
|
4521 | return !t || t === "start";
|
4522 | });
|
4523 | }
|
4524 |
|
4525 | function onFunction(id, name, listener) {
|
4526 | var on0, on1, sit = on_start(name) ? schedule_init : schedule_set;
|
4527 | return function() {
|
4528 | var schedule = sit(this, id),
|
4529 | on = schedule.on;
|
4530 |
|
4531 |
|
4532 |
|
4533 |
|
4534 | if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
|
4535 |
|
4536 | schedule.on = on1;
|
4537 | };
|
4538 | }
|
4539 |
|
4540 | var transition_on = (function(name, listener) {
|
4541 | var id = this._id;
|
4542 |
|
4543 | return arguments.length < 2
|
4544 | ? schedule_get(this.node(), id).on.on(name)
|
4545 | : this.each(onFunction(id, name, listener));
|
4546 | });
|
4547 |
|
4548 |
|
4549 | function removeFunction(id) {
|
4550 | return function() {
|
4551 | var parent = this.parentNode;
|
4552 | for (var i in this.__transition) if (+i !== id) return;
|
4553 | if (parent) parent.removeChild(this);
|
4554 | };
|
4555 | }
|
4556 |
|
4557 | var transition_remove = (function() {
|
4558 | return this.on("end.remove", removeFunction(this._id));
|
4559 | });
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 | var transition_select = (function(select) {
|
4567 | var name = this._name,
|
4568 | id = this._id;
|
4569 |
|
4570 | if (typeof select !== "function") select = src_selector(select);
|
4571 |
|
4572 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
4573 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
|
4574 | if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
|
4575 | if ("__data__" in node) subnode.__data__ = node.__data__;
|
4576 | subgroup[i] = subnode;
|
4577 | transition_schedule(subgroup[i], name, id, i, subgroup, schedule_get(node, id));
|
4578 | }
|
4579 | }
|
4580 | }
|
4581 |
|
4582 | return new Transition(subgroups, this._parents, name, id);
|
4583 | });
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 | var transition_selectAll = (function(select) {
|
4591 | var name = this._name,
|
4592 | id = this._id;
|
4593 |
|
4594 | if (typeof select !== "function") select = selectorAll(select);
|
4595 |
|
4596 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
4597 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
4598 | if (node = group[i]) {
|
4599 | for (var children = select.call(node, node.__data__, i, group), child, inherit = schedule_get(node, id), k = 0, l = children.length; k < l; ++k) {
|
4600 | if (child = children[k]) {
|
4601 | transition_schedule(child, name, id, k, children, inherit);
|
4602 | }
|
4603 | }
|
4604 | subgroups.push(children);
|
4605 | parents.push(node);
|
4606 | }
|
4607 | }
|
4608 | }
|
4609 |
|
4610 | return new Transition(subgroups, parents, name, id);
|
4611 | });
|
4612 |
|
4613 |
|
4614 |
|
4615 |
|
4616 | var selection_Selection = src_selection.prototype.constructor;
|
4617 |
|
4618 | var transition_selection = (function() {
|
4619 | return new selection_Selection(this._groups, this._parents);
|
4620 | });
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 | function styleNull(name, interpolate) {
|
4630 | var string00,
|
4631 | string10,
|
4632 | interpolate0;
|
4633 | return function() {
|
4634 | var string0 = styleValue(this, name),
|
4635 | string1 = (this.style.removeProperty(name), styleValue(this, name));
|
4636 | return string0 === string1 ? null
|
4637 | : string0 === string00 && string1 === string10 ? interpolate0
|
4638 | : interpolate0 = interpolate(string00 = string0, string10 = string1);
|
4639 | };
|
4640 | }
|
4641 |
|
4642 | function style_styleRemove(name) {
|
4643 | return function() {
|
4644 | this.style.removeProperty(name);
|
4645 | };
|
4646 | }
|
4647 |
|
4648 | function style_styleConstant(name, interpolate, value1) {
|
4649 | var string00,
|
4650 | string1 = value1 + "",
|
4651 | interpolate0;
|
4652 | return function() {
|
4653 | var string0 = styleValue(this, name);
|
4654 | return string0 === string1 ? null
|
4655 | : string0 === string00 ? interpolate0
|
4656 | : interpolate0 = interpolate(string00 = string0, value1);
|
4657 | };
|
4658 | }
|
4659 |
|
4660 | function style_styleFunction(name, interpolate, value) {
|
4661 | var string00,
|
4662 | string10,
|
4663 | interpolate0;
|
4664 | return function() {
|
4665 | var string0 = styleValue(this, name),
|
4666 | value1 = value(this),
|
4667 | string1 = value1 + "";
|
4668 | if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
|
4669 | return string0 === string1 ? null
|
4670 | : string0 === string00 && string1 === string10 ? interpolate0
|
4671 | : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
|
4672 | };
|
4673 | }
|
4674 |
|
4675 | function styleMaybeRemove(id, name) {
|
4676 | var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
|
4677 | return function() {
|
4678 | var schedule = schedule_set(this, id),
|
4679 | on = schedule.on,
|
4680 | listener = schedule.value[key] == null ? remove || (remove = style_styleRemove(name)) : undefined;
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 | if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
4686 |
|
4687 | schedule.on = on1;
|
4688 | };
|
4689 | }
|
4690 |
|
4691 | var transition_style = (function(name, value, priority) {
|
4692 | var i = (name += "") === "transform" ? interpolateTransformCss : transition_interpolate;
|
4693 | return value == null ? this
|
4694 | .styleTween(name, styleNull(name, i))
|
4695 | .on("end.style." + name, style_styleRemove(name))
|
4696 | : typeof value === "function" ? this
|
4697 | .styleTween(name, style_styleFunction(name, i, tweenValue(this, "style." + name, value)))
|
4698 | .each(styleMaybeRemove(this._id, name))
|
4699 | : this
|
4700 | .styleTween(name, style_styleConstant(name, i, value), priority)
|
4701 | .on("end.style." + name, null);
|
4702 | });
|
4703 |
|
4704 |
|
4705 | function styleInterpolate(name, i, priority) {
|
4706 | return function(t) {
|
4707 | this.style.setProperty(name, i(t), priority);
|
4708 | };
|
4709 | }
|
4710 |
|
4711 | function styleTween(name, value, priority) {
|
4712 | var t, i0;
|
4713 | function tween() {
|
4714 | var i = value.apply(this, arguments);
|
4715 | if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
|
4716 | return t;
|
4717 | }
|
4718 | tween._value = value;
|
4719 | return tween;
|
4720 | }
|
4721 |
|
4722 | var transition_styleTween = (function(name, value, priority) {
|
4723 | var key = "style." + (name += "");
|
4724 | if (arguments.length < 2) return (key = this.tween(key)) && key._value;
|
4725 | if (value == null) return this.tween(key, null);
|
4726 | if (typeof value !== "function") throw new Error;
|
4727 | return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
4728 | });
|
4729 |
|
4730 |
|
4731 |
|
4732 |
|
4733 | function text_textConstant(value) {
|
4734 | return function() {
|
4735 | this.textContent = value;
|
4736 | };
|
4737 | }
|
4738 |
|
4739 | function text_textFunction(value) {
|
4740 | return function() {
|
4741 | var value1 = value(this);
|
4742 | this.textContent = value1 == null ? "" : value1;
|
4743 | };
|
4744 | }
|
4745 |
|
4746 | var transition_text = (function(value) {
|
4747 | return this.tween("text", typeof value === "function"
|
4748 | ? text_textFunction(tweenValue(this, "text", value))
|
4749 | : text_textConstant(value == null ? "" : value + ""));
|
4750 | });
|
4751 |
|
4752 |
|
4753 |
|
4754 |
|
4755 |
|
4756 | var transition_transition = (function() {
|
4757 | var name = this._name,
|
4758 | id0 = this._id,
|
4759 | id1 = newId();
|
4760 |
|
4761 | for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
4762 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
4763 | if (node = group[i]) {
|
4764 | var inherit = schedule_get(node, id0);
|
4765 | transition_schedule(node, name, id1, i, group, {
|
4766 | time: inherit.time + inherit.delay + inherit.duration,
|
4767 | delay: 0,
|
4768 | duration: inherit.duration,
|
4769 | ease: inherit.ease
|
4770 | });
|
4771 | }
|
4772 | }
|
4773 | }
|
4774 |
|
4775 | return new Transition(groups, this._parents, name, id1);
|
4776 | });
|
4777 |
|
4778 |
|
4779 |
|
4780 |
|
4781 | var transition_end = (function() {
|
4782 | var on0, on1, that = this, id = that._id, size = that.size();
|
4783 | return new Promise(function(resolve, reject) {
|
4784 | var cancel = {value: reject},
|
4785 | end = {value: function() { if (--size === 0) resolve(); }};
|
4786 |
|
4787 | that.each(function() {
|
4788 | var schedule = schedule_set(this, id),
|
4789 | on = schedule.on;
|
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 | if (on !== on0) {
|
4795 | on1 = (on0 = on).copy();
|
4796 | on1._.cancel.push(cancel);
|
4797 | on1._.interrupt.push(cancel);
|
4798 | on1._.end.push(end);
|
4799 | }
|
4800 |
|
4801 | schedule.on = on1;
|
4802 | });
|
4803 | });
|
4804 | });
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 | var transition_id = 0;
|
4828 |
|
4829 | function Transition(groups, parents, name, id) {
|
4830 | this._groups = groups;
|
4831 | this._parents = parents;
|
4832 | this._name = name;
|
4833 | this._id = id;
|
4834 | }
|
4835 |
|
4836 | function src_transition_transition(name) {
|
4837 | return src_selection().transition(name);
|
4838 | }
|
4839 |
|
4840 | function newId() {
|
4841 | return ++transition_id;
|
4842 | }
|
4843 |
|
4844 | var selection_prototype = src_selection.prototype;
|
4845 |
|
4846 | Transition.prototype = src_transition_transition.prototype = {
|
4847 | constructor: Transition,
|
4848 | select: transition_select,
|
4849 | selectAll: transition_selectAll,
|
4850 | filter: transition_filter,
|
4851 | merge: transition_merge,
|
4852 | selection: transition_selection,
|
4853 | transition: transition_transition,
|
4854 | call: selection_prototype.call,
|
4855 | nodes: selection_prototype.nodes,
|
4856 | node: selection_prototype.node,
|
4857 | size: selection_prototype.size,
|
4858 | empty: selection_prototype.empty,
|
4859 | each: selection_prototype.each,
|
4860 | on: transition_on,
|
4861 | attr: transition_attr,
|
4862 | attrTween: transition_attrTween,
|
4863 | style: transition_style,
|
4864 | styleTween: transition_styleTween,
|
4865 | text: transition_text,
|
4866 | remove: transition_remove,
|
4867 | tween: transition_tween,
|
4868 | delay: transition_delay,
|
4869 | duration: transition_duration,
|
4870 | ease: ease,
|
4871 | end: transition_end
|
4872 | };
|
4873 |
|
4874 | // CONCATENATED MODULE: ./node_modules/d3-ease/src/linear.js
|
4875 | function linear_linear(t) {
|
4876 | return +t;
|
4877 | }
|
4878 |
|
4879 |
|
4880 | function quadIn(t) {
|
4881 | return t * t;
|
4882 | }
|
4883 |
|
4884 | function quadOut(t) {
|
4885 | return t * (2 - t);
|
4886 | }
|
4887 |
|
4888 | function quadInOut(t) {
|
4889 | return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
|
4890 | }
|
4891 |
|
4892 |
|
4893 | function cubicIn(t) {
|
4894 | return t * t * t;
|
4895 | }
|
4896 |
|
4897 | function cubicOut(t) {
|
4898 | return --t * t * t + 1;
|
4899 | }
|
4900 |
|
4901 | function cubicInOut(t) {
|
4902 | return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
4903 | }
|
4904 |
|
4905 |
|
4906 | var poly_exponent = 3;
|
4907 |
|
4908 | var polyIn = (function custom(e) {
|
4909 | e = +e;
|
4910 |
|
4911 | function polyIn(t) {
|
4912 | return Math.pow(t, e);
|
4913 | }
|
4914 |
|
4915 | polyIn.exponent = custom;
|
4916 |
|
4917 | return polyIn;
|
4918 | })(poly_exponent);
|
4919 |
|
4920 | var polyOut = (function custom(e) {
|
4921 | e = +e;
|
4922 |
|
4923 | function polyOut(t) {
|
4924 | return 1 - Math.pow(1 - t, e);
|
4925 | }
|
4926 |
|
4927 | polyOut.exponent = custom;
|
4928 |
|
4929 | return polyOut;
|
4930 | })(poly_exponent);
|
4931 |
|
4932 | var polyInOut = (function custom(e) {
|
4933 | e = +e;
|
4934 |
|
4935 | function polyInOut(t) {
|
4936 | return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
|
4937 | }
|
4938 |
|
4939 | polyInOut.exponent = custom;
|
4940 |
|
4941 | return polyInOut;
|
4942 | })(poly_exponent);
|
4943 |
|
4944 |
|
4945 | var pi = Math.PI,
|
4946 | halfPi = pi / 2;
|
4947 |
|
4948 | function sinIn(t) {
|
4949 | return 1 - Math.cos(t * halfPi);
|
4950 | }
|
4951 |
|
4952 | function sinOut(t) {
|
4953 | return Math.sin(t * halfPi);
|
4954 | }
|
4955 |
|
4956 | function sinInOut(t) {
|
4957 | return (1 - Math.cos(pi * t)) / 2;
|
4958 | }
|
4959 |
|
4960 |
|
4961 | function expIn(t) {
|
4962 | return Math.pow(2, 10 * t - 10);
|
4963 | }
|
4964 |
|
4965 | function expOut(t) {
|
4966 | return 1 - Math.pow(2, -10 * t);
|
4967 | }
|
4968 |
|
4969 | function expInOut(t) {
|
4970 | return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
|
4971 | }
|
4972 |
|
4973 |
|
4974 | function circleIn(t) {
|
4975 | return 1 - Math.sqrt(1 - t * t);
|
4976 | }
|
4977 |
|
4978 | function circleOut(t) {
|
4979 | return Math.sqrt(1 - --t * t);
|
4980 | }
|
4981 |
|
4982 | function circleInOut(t) {
|
4983 | return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
|
4984 | }
|
4985 |
|
4986 |
|
4987 | var b1 = 4 / 11,
|
4988 | b2 = 6 / 11,
|
4989 | b3 = 8 / 11,
|
4990 | b4 = 3 / 4,
|
4991 | b5 = 9 / 11,
|
4992 | b6 = 10 / 11,
|
4993 | b7 = 15 / 16,
|
4994 | b8 = 21 / 22,
|
4995 | b9 = 63 / 64,
|
4996 | b0 = 1 / b1 / b1;
|
4997 |
|
4998 | function bounceIn(t) {
|
4999 | return 1 - bounceOut(1 - t);
|
5000 | }
|
5001 |
|
5002 | function bounceOut(t) {
|
5003 | return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
|
5004 | }
|
5005 |
|
5006 | function bounceInOut(t) {
|
5007 | return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
|
5008 | }
|
5009 |
|
5010 |
|
5011 | var overshoot = 1.70158;
|
5012 |
|
5013 | var backIn = (function custom(s) {
|
5014 | s = +s;
|
5015 |
|
5016 | function backIn(t) {
|
5017 | return t * t * ((s + 1) * t - s);
|
5018 | }
|
5019 |
|
5020 | backIn.overshoot = custom;
|
5021 |
|
5022 | return backIn;
|
5023 | })(overshoot);
|
5024 |
|
5025 | var backOut = (function custom(s) {
|
5026 | s = +s;
|
5027 |
|
5028 | function backOut(t) {
|
5029 | return --t * t * ((s + 1) * t + s) + 1;
|
5030 | }
|
5031 |
|
5032 | backOut.overshoot = custom;
|
5033 |
|
5034 | return backOut;
|
5035 | })(overshoot);
|
5036 |
|
5037 | var backInOut = (function custom(s) {
|
5038 | s = +s;
|
5039 |
|
5040 | function backInOut(t) {
|
5041 | return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
|
5042 | }
|
5043 |
|
5044 | backInOut.overshoot = custom;
|
5045 |
|
5046 | return backInOut;
|
5047 | })(overshoot);
|
5048 |
|
5049 |
|
5050 | var tau = 2 * Math.PI,
|
5051 | amplitude = 1,
|
5052 | period = 0.3;
|
5053 |
|
5054 | var elasticIn = (function custom(a, p) {
|
5055 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
5056 |
|
5057 | function elasticIn(t) {
|
5058 | return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
|
5059 | }
|
5060 |
|
5061 | elasticIn.amplitude = function(a) { return custom(a, p * tau); };
|
5062 | elasticIn.period = function(p) { return custom(a, p); };
|
5063 |
|
5064 | return elasticIn;
|
5065 | })(amplitude, period);
|
5066 |
|
5067 | var elasticOut = (function custom(a, p) {
|
5068 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
5069 |
|
5070 | function elasticOut(t) {
|
5071 | return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
|
5072 | }
|
5073 |
|
5074 | elasticOut.amplitude = function(a) { return custom(a, p * tau); };
|
5075 | elasticOut.period = function(p) { return custom(a, p); };
|
5076 |
|
5077 | return elasticOut;
|
5078 | })(amplitude, period);
|
5079 |
|
5080 | var elasticInOut = (function custom(a, p) {
|
5081 | var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
|
5082 |
|
5083 | function elasticInOut(t) {
|
5084 | return ((t = t * 2 - 1) < 0
|
5085 | ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)
|
5086 | : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
|
5087 | }
|
5088 |
|
5089 | elasticInOut.amplitude = function(a) { return custom(a, p * tau); };
|
5090 | elasticInOut.period = function(p) { return custom(a, p); };
|
5091 |
|
5092 | return elasticInOut;
|
5093 | })(amplitude, period);
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 |
|
5102 |
|
5103 |
|
5104 |
|
5105 |
|
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 |
|
5111 |
|
5112 |
|
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 |
|
5118 |
|
5119 |
|
5120 |
|
5121 |
|
5122 | var defaultTiming = {
|
5123 | time: null,
|
5124 | delay: 0,
|
5125 | duration: 250,
|
5126 | ease: cubicInOut
|
5127 | };
|
5128 |
|
5129 | function transition_inherit(node, id) {
|
5130 | var timing;
|
5131 | while (!(timing = node.__transition) || !(timing = timing[id])) {
|
5132 | if (!(node = node.parentNode)) {
|
5133 | return defaultTiming.time = now(), defaultTiming;
|
5134 | }
|
5135 | }
|
5136 | return timing;
|
5137 | }
|
5138 |
|
5139 | var selection_transition = (function(name) {
|
5140 | var id,
|
5141 | timing;
|
5142 |
|
5143 | if (name instanceof Transition) {
|
5144 | id = name._id, name = name._name;
|
5145 | } else {
|
5146 | id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
5147 | }
|
5148 |
|
5149 | for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
5150 | for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
|
5151 | if (node = group[i]) {
|
5152 | transition_schedule(node, name, id, i, group, timing || transition_inherit(node, id));
|
5153 | }
|
5154 | }
|
5155 | }
|
5156 |
|
5157 | return new Transition(groups, this._parents, name, id);
|
5158 | });
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 | src_selection.prototype.interrupt = selection_interrupt;
|
5166 | src_selection.prototype.transition = selection_transition;
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 | var active_root = [null];
|
5173 |
|
5174 | var src_active = (function(node, name) {
|
5175 | var schedules = node.__transition,
|
5176 | schedule,
|
5177 | i;
|
5178 |
|
5179 | if (schedules) {
|
5180 | name = name == null ? null : name + "";
|
5181 | for (i in schedules) {
|
5182 | if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
|
5183 | return new Transition([[node]], active_root, name, +i);
|
5184 | }
|
5185 | }
|
5186 | }
|
5187 |
|
5188 | return null;
|
5189 | });
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 | var slice = Array.prototype.slice;
|
5199 |
|
5200 |
|
5201 | var src_identity = (function(x) {
|
5202 | return x;
|
5203 | });
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 | var axis_top = 1,
|
5210 | axis_right = 2,
|
5211 | axis_bottom = 3,
|
5212 | axis_left = 4,
|
5213 | epsilon = 1e-6;
|
5214 |
|
5215 | function axis_translateX(x) {
|
5216 | return "translate(" + (x + 0.5) + ",0)";
|
5217 | }
|
5218 |
|
5219 | function translateY(y) {
|
5220 | return "translate(0," + (y + 0.5) + ")";
|
5221 | }
|
5222 |
|
5223 | function axis_number(scale) {
|
5224 | return function(d) {
|
5225 | return +scale(d);
|
5226 | };
|
5227 | }
|
5228 |
|
5229 | function axis_center(scale) {
|
5230 | var offset = Math.max(0, scale.bandwidth() - 1) / 2;
|
5231 | if (scale.round()) offset = Math.round(offset);
|
5232 | return function(d) {
|
5233 | return +scale(d) + offset;
|
5234 | };
|
5235 | }
|
5236 |
|
5237 | function entering() {
|
5238 | return !this.__axis;
|
5239 | }
|
5240 |
|
5241 | function axis_axis(orient, scale) {
|
5242 | var tickArguments = [],
|
5243 | tickValues = null,
|
5244 | tickFormat = null,
|
5245 | tickSizeInner = 6,
|
5246 | tickSizeOuter = 6,
|
5247 | tickPadding = 3,
|
5248 | k = orient === axis_top || orient === axis_left ? -1 : 1,
|
5249 | x = orient === axis_left || orient === axis_right ? "x" : "y",
|
5250 | transform = orient === axis_top || orient === axis_bottom ? axis_translateX : translateY;
|
5251 |
|
5252 | function axis(context) {
|
5253 | var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
5254 | format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : src_identity) : tickFormat,
|
5255 | spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
5256 | range = scale.range(),
|
5257 | range0 = +range[0] + 0.5,
|
5258 | range1 = +range[range.length - 1] + 0.5,
|
5259 | position = (scale.bandwidth ? axis_center : axis_number)(scale.copy()),
|
5260 | selection = context.selection ? context.selection() : context,
|
5261 | path = selection.selectAll(".domain").data([null]),
|
5262 | tick = selection.selectAll(".tick").data(values, scale).order(),
|
5263 | tickExit = tick.exit(),
|
5264 | tickEnter = tick.enter().append("g").attr("class", "tick"),
|
5265 | line = tick.select("line"),
|
5266 | text = tick.select("text");
|
5267 |
|
5268 | path = path.merge(path.enter().insert("path", ".tick")
|
5269 | .attr("class", "domain")
|
5270 | .attr("stroke", "currentColor"));
|
5271 |
|
5272 | tick = tick.merge(tickEnter);
|
5273 |
|
5274 | line = line.merge(tickEnter.append("line")
|
5275 | .attr("stroke", "currentColor")
|
5276 | .attr(x + "2", k * tickSizeInner));
|
5277 |
|
5278 | text = text.merge(tickEnter.append("text")
|
5279 | .attr("fill", "currentColor")
|
5280 | .attr(x, k * spacing)
|
5281 | .attr("dy", orient === axis_top ? "0em" : orient === axis_bottom ? "0.71em" : "0.32em"));
|
5282 |
|
5283 | if (context !== selection) {
|
5284 | path = path.transition(context);
|
5285 | tick = tick.transition(context);
|
5286 | line = line.transition(context);
|
5287 | text = text.transition(context);
|
5288 |
|
5289 | tickExit = tickExit.transition(context)
|
5290 | .attr("opacity", epsilon)
|
5291 | .attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d) : this.getAttribute("transform"); });
|
5292 |
|
5293 | tickEnter
|
5294 | .attr("opacity", epsilon)
|
5295 | .attr("transform", function(d) { var p = this.parentNode.__axis; return transform(p && isFinite(p = p(d)) ? p : position(d)); });
|
5296 | }
|
5297 |
|
5298 | tickExit.remove();
|
5299 |
|
5300 | path
|
5301 | .attr("d", orient === axis_left || orient == axis_right
|
5302 | ? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter : "M0.5," + range0 + "V" + range1)
|
5303 | : (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + ",0.5H" + range1));
|
5304 |
|
5305 | tick
|
5306 | .attr("opacity", 1)
|
5307 | .attr("transform", function(d) { return transform(position(d)); });
|
5308 |
|
5309 | line
|
5310 | .attr(x + "2", k * tickSizeInner);
|
5311 |
|
5312 | text
|
5313 | .attr(x, k * spacing)
|
5314 | .text(format);
|
5315 |
|
5316 | selection.filter(entering)
|
5317 | .attr("fill", "none")
|
5318 | .attr("font-size", 10)
|
5319 | .attr("font-family", "sans-serif")
|
5320 | .attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
5321 |
|
5322 | selection
|
5323 | .each(function() { this.__axis = position; });
|
5324 | }
|
5325 |
|
5326 | axis.scale = function(_) {
|
5327 | return arguments.length ? (scale = _, axis) : scale;
|
5328 | };
|
5329 |
|
5330 | axis.ticks = function() {
|
5331 | return tickArguments = slice.call(arguments), axis;
|
5332 | };
|
5333 |
|
5334 | axis.tickArguments = function(_) {
|
5335 | return arguments.length ? (tickArguments = _ == null ? [] : slice.call(_), axis) : tickArguments.slice();
|
5336 | };
|
5337 |
|
5338 | axis.tickValues = function(_) {
|
5339 | return arguments.length ? (tickValues = _ == null ? null : slice.call(_), axis) : tickValues && tickValues.slice();
|
5340 | };
|
5341 |
|
5342 | axis.tickFormat = function(_) {
|
5343 | return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
5344 | };
|
5345 |
|
5346 | axis.tickSize = function(_) {
|
5347 | return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
5348 | };
|
5349 |
|
5350 | axis.tickSizeInner = function(_) {
|
5351 | return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
5352 | };
|
5353 |
|
5354 | axis.tickSizeOuter = function(_) {
|
5355 | return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
5356 | };
|
5357 |
|
5358 | axis.tickPadding = function(_) {
|
5359 | return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
5360 | };
|
5361 |
|
5362 | return axis;
|
5363 | }
|
5364 |
|
5365 | function axisTop(scale) {
|
5366 | return axis_axis(axis_top, scale);
|
5367 | }
|
5368 |
|
5369 | function axisRight(scale) {
|
5370 | return axis_axis(axis_right, scale);
|
5371 | }
|
5372 |
|
5373 | function axisBottom(scale) {
|
5374 | return axis_axis(axis_bottom, scale);
|
5375 | }
|
5376 |
|
5377 | function axisLeft(scale) {
|
5378 | return axis_axis(axis_left, scale);
|
5379 | }
|
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 |
|
5386 |
|
5387 |
|
5388 |
|
5389 |
|
5390 |
|
5391 |
|
5392 |
|
5393 |
|
5394 | var config_classes = ({
|
5395 | arc: "bb-arc",
|
5396 | arcs: "bb-arcs",
|
5397 | area: "bb-area",
|
5398 | areas: "bb-areas",
|
5399 | axis: "bb-axis",
|
5400 | axisX: "bb-axis-x",
|
5401 | axisXLabel: "bb-axis-x-label",
|
5402 | axisY: "bb-axis-y",
|
5403 | axisY2: "bb-axis-y2",
|
5404 | axisY2Label: "bb-axis-y2-label",
|
5405 | axisYLabel: "bb-axis-y-label",
|
5406 | bar: "bb-bar",
|
5407 | bars: "bb-bars",
|
5408 | brush: "bb-brush",
|
5409 | button: "bb-button",
|
5410 | buttonZoomReset: "bb-zoom-reset",
|
5411 | chart: "bb-chart",
|
5412 | chartArc: "bb-chart-arc",
|
5413 | chartArcs: "bb-chart-arcs",
|
5414 | chartArcsBackground: "bb-chart-arcs-background",
|
5415 | chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
5416 | chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
5417 | chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
5418 | chartArcsTitle: "bb-chart-arcs-title",
|
5419 | chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
5420 | chartBar: "bb-chart-bar",
|
5421 | chartBars: "bb-chart-bars",
|
5422 | chartLine: "bb-chart-line",
|
5423 | chartLines: "bb-chart-lines",
|
5424 | chartRadar: "bb-chart-radar",
|
5425 | chartRadars: "bb-chart-radars",
|
5426 | chartText: "bb-chart-text",
|
5427 | chartTexts: "bb-chart-texts",
|
5428 | circle: "bb-circle",
|
5429 | circles: "bb-circles",
|
5430 | colorPattern: "bb-color-pattern",
|
5431 | colorScale: "bb-colorscale",
|
5432 | defocused: "bb-defocused",
|
5433 | dragarea: "bb-dragarea",
|
5434 | empty: "bb-empty",
|
5435 | eventRect: "bb-event-rect",
|
5436 | eventRects: "bb-event-rects",
|
5437 | eventRectsMultiple: "bb-event-rects-multiple",
|
5438 | eventRectsSingle: "bb-event-rects-single",
|
5439 | focused: "bb-focused",
|
5440 | gaugeValue: "bb-gauge-value",
|
5441 | grid: "bb-grid",
|
5442 | gridLines: "bb-grid-lines",
|
5443 | legendBackground: "bb-legend-background",
|
5444 | legendItem: "bb-legend-item",
|
5445 | legendItemEvent: "bb-legend-item-event",
|
5446 | legendItemFocused: "bb-legend-item-focused",
|
5447 | legendItemHidden: "bb-legend-item-hidden",
|
5448 | legendItemPoint: "bb-legend-item-point",
|
5449 | legendItemTile: "bb-legend-item-tile",
|
5450 | level: "bb-level",
|
5451 | levels: "bb-levels",
|
5452 | line: "bb-line",
|
5453 | lines: "bb-lines",
|
5454 | region: "bb-region",
|
5455 | regions: "bb-regions",
|
5456 | selectedCircle: "bb-selected-circle",
|
5457 | selectedCircles: "bb-selected-circles",
|
5458 | shape: "bb-shape",
|
5459 | shapes: "bb-shapes",
|
5460 | stanfordElements: "bb-stanford-elements",
|
5461 | stanfordLine: "bb-stanford-line",
|
5462 | stanfordLines: "bb-stanford-lines",
|
5463 | stanfordRegion: "bb-stanford-region",
|
5464 | stanfordRegions: "bb-stanford-regions",
|
5465 | target: "bb-target",
|
5466 | text: "bb-text",
|
5467 | texts: "bb-texts",
|
5468 | title: "bb-title",
|
5469 | tooltip: "bb-tooltip",
|
5470 | tooltipContainer: "bb-tooltip-container",
|
5471 | tooltipName: "bb-tooltip-name",
|
5472 | xgrid: "bb-xgrid",
|
5473 | xgridFocus: "bb-xgrid-focus",
|
5474 | xgridLine: "bb-xgrid-line",
|
5475 | xgridLines: "bb-xgrid-lines",
|
5476 | xgrids: "bb-xgrids",
|
5477 | ygrid: "bb-ygrid",
|
5478 | ygridLine: "bb-ygrid-line",
|
5479 | ygridLines: "bb-ygrid-lines",
|
5480 | ygrids: "bb-ygrids",
|
5481 | zoomBrush: "bb-zoom-brush",
|
5482 | zoomRect: "bb-zoom-rect",
|
5483 | EXPANDED: "_expanded_",
|
5484 | SELECTED: "_selected_",
|
5485 | INCLUDED: "_included_"
|
5486 | });
|
5487 |
|
5488 | var toConsumableArray = __webpack_require__(6);
|
5489 | var toConsumableArray_default = __webpack_require__.n(toConsumableArray);
|
5490 |
|
5491 |
|
5492 | var helpers_typeof = __webpack_require__(10);
|
5493 | var typeof_default = __webpack_require__.n(helpers_typeof);
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 | function nopropagation() {
|
5499 | on_event.stopImmediatePropagation();
|
5500 | }
|
5501 |
|
5502 | var noevent = (function() {
|
5503 | on_event.preventDefault();
|
5504 | on_event.stopImmediatePropagation();
|
5505 | });
|
5506 |
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 | var nodrag = (function(view) {
|
5512 | var root = view.document.documentElement,
|
5513 | selection = src_select(view).on("dragstart.drag", noevent, true);
|
5514 | if ("onselectstart" in root) {
|
5515 | selection.on("selectstart.drag", noevent, true);
|
5516 | } else {
|
5517 | root.__noselect = root.style.MozUserSelect;
|
5518 | root.style.MozUserSelect = "none";
|
5519 | }
|
5520 | });
|
5521 |
|
5522 | function yesdrag(view, noclick) {
|
5523 | var root = view.document.documentElement,
|
5524 | selection = src_select(view).on("dragstart.drag", null);
|
5525 | if (noclick) {
|
5526 | selection.on("click.drag", noevent, true);
|
5527 | setTimeout(function() { selection.on("click.drag", null); }, 0);
|
5528 | }
|
5529 | if ("onselectstart" in root) {
|
5530 | selection.on("selectstart.drag", null);
|
5531 | } else {
|
5532 | root.style.MozUserSelect = root.__noselect;
|
5533 | delete root.__noselect;
|
5534 | }
|
5535 | }
|
5536 |
|
5537 |
|
5538 | var d3_drag_src_constant = (function(x) {
|
5539 | return function() {
|
5540 | return x;
|
5541 | };
|
5542 | });
|
5543 |
|
5544 |
|
5545 | function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
|
5546 | this.target = target;
|
5547 | this.type = type;
|
5548 | this.subject = subject;
|
5549 | this.identifier = id;
|
5550 | this.active = active;
|
5551 | this.x = x;
|
5552 | this.y = y;
|
5553 | this.dx = dx;
|
5554 | this.dy = dy;
|
5555 | this._ = dispatch;
|
5556 | }
|
5557 |
|
5558 | DragEvent.prototype.on = function() {
|
5559 | var value = this._.on.apply(this._, arguments);
|
5560 | return value === this._ ? this : value;
|
5561 | };
|
5562 |
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 | function defaultFilter() {
|
5573 | return !on_event.button;
|
5574 | }
|
5575 |
|
5576 | function defaultContainer() {
|
5577 | return this.parentNode;
|
5578 | }
|
5579 |
|
5580 | function defaultSubject(d) {
|
5581 | return d == null ? {x: on_event.x, y: on_event.y} : d;
|
5582 | }
|
5583 |
|
5584 | function defaultTouchable() {
|
5585 | return "ontouchstart" in this;
|
5586 | }
|
5587 |
|
5588 | var src_drag = (function() {
|
5589 | var filter = defaultFilter,
|
5590 | container = defaultContainer,
|
5591 | subject = defaultSubject,
|
5592 | touchable = defaultTouchable,
|
5593 | gestures = {},
|
5594 | listeners = src_dispatch("start", "drag", "end"),
|
5595 | active = 0,
|
5596 | mousedownx,
|
5597 | mousedowny,
|
5598 | mousemoving,
|
5599 | touchending,
|
5600 | clickDistance2 = 0;
|
5601 |
|
5602 | function drag(selection) {
|
5603 | selection
|
5604 | .on("mousedown.drag", mousedowned)
|
5605 | .filter(touchable)
|
5606 | .on("touchstart.drag", touchstarted)
|
5607 | .on("touchmove.drag", touchmoved)
|
5608 | .on("touchend.drag touchcancel.drag", touchended)
|
5609 | .style("touch-action", "none")
|
5610 | .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
5611 | }
|
5612 |
|
5613 | function mousedowned() {
|
5614 | if (touchending || !filter.apply(this, arguments)) return;
|
5615 | var gesture = beforestart("mouse", container.apply(this, arguments), src_mouse, this, arguments);
|
5616 | if (!gesture) return;
|
5617 | src_select(on_event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
|
5618 | nodrag(on_event.view);
|
5619 | nopropagation();
|
5620 | mousemoving = false;
|
5621 | mousedownx = on_event.clientX;
|
5622 | mousedowny = on_event.clientY;
|
5623 | gesture("start");
|
5624 | }
|
5625 |
|
5626 | function mousemoved() {
|
5627 | noevent();
|
5628 | if (!mousemoving) {
|
5629 | var dx = on_event.clientX - mousedownx, dy = on_event.clientY - mousedowny;
|
5630 | mousemoving = dx * dx + dy * dy > clickDistance2;
|
5631 | }
|
5632 | gestures.mouse("drag");
|
5633 | }
|
5634 |
|
5635 | function mouseupped() {
|
5636 | src_select(on_event.view).on("mousemove.drag mouseup.drag", null);
|
5637 | yesdrag(on_event.view, mousemoving);
|
5638 | noevent();
|
5639 | gestures.mouse("end");
|
5640 | }
|
5641 |
|
5642 | function touchstarted() {
|
5643 | if (!filter.apply(this, arguments)) return;
|
5644 | var touches = on_event.changedTouches,
|
5645 | c = container.apply(this, arguments),
|
5646 | n = touches.length, i, gesture;
|
5647 |
|
5648 | for (i = 0; i < n; ++i) {
|
5649 | if (gesture = beforestart(touches[i].identifier, c, src_touch, this, arguments)) {
|
5650 | nopropagation();
|
5651 | gesture("start");
|
5652 | }
|
5653 | }
|
5654 | }
|
5655 |
|
5656 | function touchmoved() {
|
5657 | var touches = on_event.changedTouches,
|
5658 | n = touches.length, i, gesture;
|
5659 |
|
5660 | for (i = 0; i < n; ++i) {
|
5661 | if (gesture = gestures[touches[i].identifier]) {
|
5662 | noevent();
|
5663 | gesture("drag");
|
5664 | }
|
5665 | }
|
5666 | }
|
5667 |
|
5668 | function touchended() {
|
5669 | var touches = on_event.changedTouches,
|
5670 | n = touches.length, i, gesture;
|
5671 |
|
5672 | if (touchending) clearTimeout(touchending);
|
5673 | touchending = setTimeout(function() { touchending = null; }, 500);
|
5674 | for (i = 0; i < n; ++i) {
|
5675 | if (gesture = gestures[touches[i].identifier]) {
|
5676 | nopropagation();
|
5677 | gesture("end");
|
5678 | }
|
5679 | }
|
5680 | }
|
5681 |
|
5682 | function beforestart(id, container, point, that, args) {
|
5683 | var p = point(container, id), s, dx, dy,
|
5684 | sublisteners = listeners.copy();
|
5685 |
|
5686 | if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
|
5687 | if ((on_event.subject = s = subject.apply(that, args)) == null) return false;
|
5688 | dx = s.x - p[0] || 0;
|
5689 | dy = s.y - p[1] || 0;
|
5690 | return true;
|
5691 | })) return;
|
5692 |
|
5693 | return function gesture(type) {
|
5694 | var p0 = p, n;
|
5695 | switch (type) {
|
5696 | case "start": gestures[id] = gesture, n = active++; break;
|
5697 | case "end": delete gestures[id], --active;
|
5698 | case "drag": p = point(container, id), n = active; break;
|
5699 | }
|
5700 | customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
|
5701 | };
|
5702 | }
|
5703 |
|
5704 | drag.filter = function(_) {
|
5705 | return arguments.length ? (filter = typeof _ === "function" ? _ : d3_drag_src_constant(!!_), drag) : filter;
|
5706 | };
|
5707 |
|
5708 | drag.container = function(_) {
|
5709 | return arguments.length ? (container = typeof _ === "function" ? _ : d3_drag_src_constant(_), drag) : container;
|
5710 | };
|
5711 |
|
5712 | drag.subject = function(_) {
|
5713 | return arguments.length ? (subject = typeof _ === "function" ? _ : d3_drag_src_constant(_), drag) : subject;
|
5714 | };
|
5715 |
|
5716 | drag.touchable = function(_) {
|
5717 | return arguments.length ? (touchable = typeof _ === "function" ? _ : d3_drag_src_constant(!!_), drag) : touchable;
|
5718 | };
|
5719 |
|
5720 | drag.on = function() {
|
5721 | var value = listeners.on.apply(listeners, arguments);
|
5722 | return value === listeners ? drag : value;
|
5723 | };
|
5724 |
|
5725 | drag.clickDistance = function(_) {
|
5726 | return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
|
5727 | };
|
5728 |
|
5729 | return drag;
|
5730 | });
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 | var d3_brush_src_constant = (function(x) {
|
5738 | return function() {
|
5739 | return x;
|
5740 | };
|
5741 | });
|
5742 |
|
5743 |
|
5744 | var src_event = (function(target, type, selection) {
|
5745 | this.target = target;
|
5746 | this.type = type;
|
5747 | this.selection = selection;
|
5748 | });
|
5749 |
|
5750 |
|
5751 |
|
5752 |
|
5753 | function noevent_nopropagation() {
|
5754 | on_event.stopImmediatePropagation();
|
5755 | }
|
5756 |
|
5757 | var src_noevent = (function() {
|
5758 | on_event.preventDefault();
|
5759 | on_event.stopImmediatePropagation();
|
5760 | });
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 | var MODE_DRAG = {name: "drag"},
|
5773 | MODE_SPACE = {name: "space"},
|
5774 | MODE_HANDLE = {name: "handle"},
|
5775 | MODE_CENTER = {name: "center"};
|
5776 |
|
5777 | var X = {
|
5778 | name: "x",
|
5779 | handles: ["e", "w"].map(brush_type),
|
5780 | input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; },
|
5781 | output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }
|
5782 | };
|
5783 |
|
5784 | var Y = {
|
5785 | name: "y",
|
5786 | handles: ["n", "s"].map(brush_type),
|
5787 | input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; },
|
5788 | output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }
|
5789 | };
|
5790 |
|
5791 | var XY = {
|
5792 | name: "xy",
|
5793 | handles: ["n", "e", "s", "w", "nw", "ne", "se", "sw"].map(brush_type),
|
5794 | input: function(xy) { return xy; },
|
5795 | output: function(xy) { return xy; }
|
5796 | };
|
5797 |
|
5798 | var cursors = {
|
5799 | overlay: "crosshair",
|
5800 | selection: "move",
|
5801 | n: "ns-resize",
|
5802 | e: "ew-resize",
|
5803 | s: "ns-resize",
|
5804 | w: "ew-resize",
|
5805 | nw: "nwse-resize",
|
5806 | ne: "nesw-resize",
|
5807 | se: "nwse-resize",
|
5808 | sw: "nesw-resize"
|
5809 | };
|
5810 |
|
5811 | var flipX = {
|
5812 | e: "w",
|
5813 | w: "e",
|
5814 | nw: "ne",
|
5815 | ne: "nw",
|
5816 | se: "sw",
|
5817 | sw: "se"
|
5818 | };
|
5819 |
|
5820 | var flipY = {
|
5821 | n: "s",
|
5822 | s: "n",
|
5823 | nw: "sw",
|
5824 | ne: "se",
|
5825 | se: "ne",
|
5826 | sw: "nw"
|
5827 | };
|
5828 |
|
5829 | var signsX = {
|
5830 | overlay: +1,
|
5831 | selection: +1,
|
5832 | n: null,
|
5833 | e: +1,
|
5834 | s: null,
|
5835 | w: -1,
|
5836 | nw: -1,
|
5837 | ne: +1,
|
5838 | se: +1,
|
5839 | sw: -1
|
5840 | };
|
5841 |
|
5842 | var signsY = {
|
5843 | overlay: +1,
|
5844 | selection: +1,
|
5845 | n: -1,
|
5846 | e: null,
|
5847 | s: +1,
|
5848 | w: null,
|
5849 | nw: -1,
|
5850 | ne: -1,
|
5851 | se: +1,
|
5852 | sw: +1
|
5853 | };
|
5854 |
|
5855 | function brush_type(t) {
|
5856 | return {type: t};
|
5857 | }
|
5858 |
|
5859 |
|
5860 | function brush_defaultFilter() {
|
5861 | return !on_event.button;
|
5862 | }
|
5863 |
|
5864 | function defaultExtent() {
|
5865 | var svg = this.ownerSVGElement || this;
|
5866 | return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];
|
5867 | }
|
5868 |
|
5869 |
|
5870 | function brush_local(node) {
|
5871 | while (!node.__brush) if (!(node = node.parentNode)) return;
|
5872 | return node.__brush;
|
5873 | }
|
5874 |
|
5875 | function brush_empty(extent) {
|
5876 | return extent[0][0] === extent[1][0]
|
5877 | || extent[0][1] === extent[1][1];
|
5878 | }
|
5879 |
|
5880 | function brushSelection(node) {
|
5881 | var state = node.__brush;
|
5882 | return state ? state.dim.output(state.selection) : null;
|
5883 | }
|
5884 |
|
5885 | function brushX() {
|
5886 | return brush_brush(X);
|
5887 | }
|
5888 |
|
5889 | function brushY() {
|
5890 | return brush_brush(Y);
|
5891 | }
|
5892 |
|
5893 | var src_brush = (function() {
|
5894 | return brush_brush(XY);
|
5895 | });
|
5896 |
|
5897 | function brush_brush(dim) {
|
5898 | var extent = defaultExtent,
|
5899 | filter = brush_defaultFilter,
|
5900 | listeners = src_dispatch(brush, "start", "brush", "end"),
|
5901 | handleSize = 6,
|
5902 | touchending;
|
5903 |
|
5904 | function brush(group) {
|
5905 | var overlay = group
|
5906 | .property("__brush", initialize)
|
5907 | .selectAll(".overlay")
|
5908 | .data([brush_type("overlay")]);
|
5909 |
|
5910 | overlay.enter().append("rect")
|
5911 | .attr("class", "overlay")
|
5912 | .attr("pointer-events", "all")
|
5913 | .attr("cursor", cursors.overlay)
|
5914 | .merge(overlay)
|
5915 | .each(function() {
|
5916 | var extent = brush_local(this).extent;
|
5917 | src_select(this)
|
5918 | .attr("x", extent[0][0])
|
5919 | .attr("y", extent[0][1])
|
5920 | .attr("width", extent[1][0] - extent[0][0])
|
5921 | .attr("height", extent[1][1] - extent[0][1]);
|
5922 | });
|
5923 |
|
5924 | group.selectAll(".selection")
|
5925 | .data([brush_type("selection")])
|
5926 | .enter().append("rect")
|
5927 | .attr("class", "selection")
|
5928 | .attr("cursor", cursors.selection)
|
5929 | .attr("fill", "#777")
|
5930 | .attr("fill-opacity", 0.3)
|
5931 | .attr("stroke", "#fff")
|
5932 | .attr("shape-rendering", "crispEdges");
|
5933 |
|
5934 | var handle = group.selectAll(".handle")
|
5935 | .data(dim.handles, function(d) { return d.type; });
|
5936 |
|
5937 | handle.exit().remove();
|
5938 |
|
5939 | handle.enter().append("rect")
|
5940 | .attr("class", function(d) { return "handle handle--" + d.type; })
|
5941 | .attr("cursor", function(d) { return cursors[d.type]; });
|
5942 |
|
5943 | group
|
5944 | .each(redraw)
|
5945 | .attr("fill", "none")
|
5946 | .attr("pointer-events", "all")
|
5947 | .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)")
|
5948 | .on("mousedown.brush touchstart.brush", started);
|
5949 | }
|
5950 |
|
5951 | brush.move = function(group, selection) {
|
5952 | if (group.selection) {
|
5953 | group
|
5954 | .on("start.brush", function() { emitter(this, arguments).beforestart().start(); })
|
5955 | .on("interrupt.brush end.brush", function() { emitter(this, arguments).end(); })
|
5956 | .tween("brush", function() {
|
5957 | var that = this,
|
5958 | state = that.__brush,
|
5959 | emit = emitter(that, arguments),
|
5960 | selection0 = state.selection,
|
5961 | selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent),
|
5962 | i = src_value(selection0, selection1);
|
5963 |
|
5964 | function tween(t) {
|
5965 | state.selection = t === 1 && brush_empty(selection1) ? null : i(t);
|
5966 | redraw.call(that);
|
5967 | emit.brush();
|
5968 | }
|
5969 |
|
5970 | return selection0 && selection1 ? tween : tween(1);
|
5971 | });
|
5972 | } else {
|
5973 | group
|
5974 | .each(function() {
|
5975 | var that = this,
|
5976 | args = arguments,
|
5977 | state = that.__brush,
|
5978 | selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent),
|
5979 | emit = emitter(that, args).beforestart();
|
5980 |
|
5981 | interrupt(that);
|
5982 | state.selection = selection1 == null || brush_empty(selection1) ? null : selection1;
|
5983 | redraw.call(that);
|
5984 | emit.start().brush().end();
|
5985 | });
|
5986 | }
|
5987 | };
|
5988 |
|
5989 | function redraw() {
|
5990 | var group = src_select(this),
|
5991 | selection = brush_local(this).selection;
|
5992 |
|
5993 | if (selection) {
|
5994 | group.selectAll(".selection")
|
5995 | .style("display", null)
|
5996 | .attr("x", selection[0][0])
|
5997 | .attr("y", selection[0][1])
|
5998 | .attr("width", selection[1][0] - selection[0][0])
|
5999 | .attr("height", selection[1][1] - selection[0][1]);
|
6000 |
|
6001 | group.selectAll(".handle")
|
6002 | .style("display", null)
|
6003 | .attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })
|
6004 | .attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })
|
6005 | .attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })
|
6006 | .attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });
|
6007 | }
|
6008 |
|
6009 | else {
|
6010 | group.selectAll(".selection,.handle")
|
6011 | .style("display", "none")
|
6012 | .attr("x", null)
|
6013 | .attr("y", null)
|
6014 | .attr("width", null)
|
6015 | .attr("height", null);
|
6016 | }
|
6017 | }
|
6018 |
|
6019 | function emitter(that, args) {
|
6020 | return that.__brush.emitter || new Emitter(that, args);
|
6021 | }
|
6022 |
|
6023 | function Emitter(that, args) {
|
6024 | this.that = that;
|
6025 | this.args = args;
|
6026 | this.state = that.__brush;
|
6027 | this.active = 0;
|
6028 | }
|
6029 |
|
6030 | Emitter.prototype = {
|
6031 | beforestart: function() {
|
6032 | if (++this.active === 1) this.state.emitter = this, this.starting = true;
|
6033 | return this;
|
6034 | },
|
6035 | start: function() {
|
6036 | if (this.starting) this.starting = false, this.emit("start");
|
6037 | return this;
|
6038 | },
|
6039 | brush: function() {
|
6040 | this.emit("brush");
|
6041 | return this;
|
6042 | },
|
6043 | end: function() {
|
6044 | if (--this.active === 0) delete this.state.emitter, this.emit("end");
|
6045 | return this;
|
6046 | },
|
6047 | emit: function(type) {
|
6048 | customEvent(new src_event(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]);
|
6049 | }
|
6050 | };
|
6051 |
|
6052 | function started() {
|
6053 | if (on_event.touches) { if (on_event.changedTouches.length < on_event.touches.length) return src_noevent(); }
|
6054 | else if (touchending) return;
|
6055 | if (!filter.apply(this, arguments)) return;
|
6056 |
|
6057 | var that = this,
|
6058 | type = on_event.target.__data__.type,
|
6059 | mode = (on_event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (on_event.altKey ? MODE_CENTER : MODE_HANDLE),
|
6060 | signX = dim === Y ? null : signsX[type],
|
6061 | signY = dim === X ? null : signsY[type],
|
6062 | state = brush_local(that),
|
6063 | extent = state.extent,
|
6064 | selection = state.selection,
|
6065 | W = extent[0][0], w0, w1,
|
6066 | N = extent[0][1], n0, n1,
|
6067 | E = extent[1][0], e0, e1,
|
6068 | S = extent[1][1], s0, s1,
|
6069 | dx,
|
6070 | dy,
|
6071 | moving,
|
6072 | shifting = signX && signY && on_event.shiftKey,
|
6073 | lockX,
|
6074 | lockY,
|
6075 | point0 = src_mouse(that),
|
6076 | point = point0,
|
6077 | emit = emitter(that, arguments).beforestart();
|
6078 |
|
6079 | if (type === "overlay") {
|
6080 | state.selection = selection = [
|
6081 | [w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]],
|
6082 | [e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0]
|
6083 | ];
|
6084 | } else {
|
6085 | w0 = selection[0][0];
|
6086 | n0 = selection[0][1];
|
6087 | e0 = selection[1][0];
|
6088 | s0 = selection[1][1];
|
6089 | }
|
6090 |
|
6091 | w1 = w0;
|
6092 | n1 = n0;
|
6093 | e1 = e0;
|
6094 | s1 = s0;
|
6095 |
|
6096 | var group = src_select(that)
|
6097 | .attr("pointer-events", "none");
|
6098 |
|
6099 | var overlay = group.selectAll(".overlay")
|
6100 | .attr("cursor", cursors[type]);
|
6101 |
|
6102 | if (on_event.touches) {
|
6103 | group
|
6104 | .on("touchmove.brush", moved, true)
|
6105 | .on("touchend.brush touchcancel.brush", ended, true);
|
6106 | } else {
|
6107 | var view = src_select(on_event.view)
|
6108 | .on("keydown.brush", keydowned, true)
|
6109 | .on("keyup.brush", keyupped, true)
|
6110 | .on("mousemove.brush", moved, true)
|
6111 | .on("mouseup.brush", ended, true);
|
6112 |
|
6113 | nodrag(on_event.view);
|
6114 | }
|
6115 |
|
6116 | noevent_nopropagation();
|
6117 | interrupt(that);
|
6118 | redraw.call(that);
|
6119 | emit.start();
|
6120 |
|
6121 | function moved() {
|
6122 | var point1 = src_mouse(that);
|
6123 | if (shifting && !lockX && !lockY) {
|
6124 | if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true;
|
6125 | else lockX = true;
|
6126 | }
|
6127 | point = point1;
|
6128 | moving = true;
|
6129 | src_noevent();
|
6130 | move();
|
6131 | }
|
6132 |
|
6133 | function move() {
|
6134 | var t;
|
6135 |
|
6136 | dx = point[0] - point0[0];
|
6137 | dy = point[1] - point0[1];
|
6138 |
|
6139 | switch (mode) {
|
6140 | case MODE_SPACE:
|
6141 | case MODE_DRAG: {
|
6142 | if (signX) dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;
|
6143 | if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;
|
6144 | break;
|
6145 | }
|
6146 | case MODE_HANDLE: {
|
6147 | if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0;
|
6148 | else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx;
|
6149 | if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0;
|
6150 | else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy;
|
6151 | break;
|
6152 | }
|
6153 | case MODE_CENTER: {
|
6154 | if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX));
|
6155 | if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY));
|
6156 | break;
|
6157 | }
|
6158 | }
|
6159 |
|
6160 | if (e1 < w1) {
|
6161 | signX *= -1;
|
6162 | t = w0, w0 = e0, e0 = t;
|
6163 | t = w1, w1 = e1, e1 = t;
|
6164 | if (type in flipX) overlay.attr("cursor", cursors[type = flipX[type]]);
|
6165 | }
|
6166 |
|
6167 | if (s1 < n1) {
|
6168 | signY *= -1;
|
6169 | t = n0, n0 = s0, s0 = t;
|
6170 | t = n1, n1 = s1, s1 = t;
|
6171 | if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]);
|
6172 | }
|
6173 |
|
6174 | if (state.selection) selection = state.selection;
|
6175 | if (lockX) w1 = selection[0][0], e1 = selection[1][0];
|
6176 | if (lockY) n1 = selection[0][1], s1 = selection[1][1];
|
6177 |
|
6178 | if (selection[0][0] !== w1
|
6179 | || selection[0][1] !== n1
|
6180 | || selection[1][0] !== e1
|
6181 | || selection[1][1] !== s1) {
|
6182 | state.selection = [[w1, n1], [e1, s1]];
|
6183 | redraw.call(that);
|
6184 | emit.brush();
|
6185 | }
|
6186 | }
|
6187 |
|
6188 | function ended() {
|
6189 | noevent_nopropagation();
|
6190 | if (on_event.touches) {
|
6191 | if (on_event.touches.length) return;
|
6192 | if (touchending) clearTimeout(touchending);
|
6193 | touchending = setTimeout(function() { touchending = null; }, 500);
|
6194 | group.on("touchmove.brush touchend.brush touchcancel.brush", null);
|
6195 | } else {
|
6196 | yesdrag(on_event.view, moving);
|
6197 | view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
|
6198 | }
|
6199 | group.attr("pointer-events", "all");
|
6200 | overlay.attr("cursor", cursors.overlay);
|
6201 | if (state.selection) selection = state.selection;
|
6202 | if (brush_empty(selection)) state.selection = null, redraw.call(that);
|
6203 | emit.end();
|
6204 | }
|
6205 |
|
6206 | function keydowned() {
|
6207 | switch (on_event.keyCode) {
|
6208 | case 16: {
|
6209 | shifting = signX && signY;
|
6210 | break;
|
6211 | }
|
6212 | case 18: {
|
6213 | if (mode === MODE_HANDLE) {
|
6214 | if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
|
6215 | if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
|
6216 | mode = MODE_CENTER;
|
6217 | move();
|
6218 | }
|
6219 | break;
|
6220 | }
|
6221 | case 32: {
|
6222 | if (mode === MODE_HANDLE || mode === MODE_CENTER) {
|
6223 | if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;
|
6224 | if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;
|
6225 | mode = MODE_SPACE;
|
6226 | overlay.attr("cursor", cursors.selection);
|
6227 | move();
|
6228 | }
|
6229 | break;
|
6230 | }
|
6231 | default: return;
|
6232 | }
|
6233 | src_noevent();
|
6234 | }
|
6235 |
|
6236 | function keyupped() {
|
6237 | switch (on_event.keyCode) {
|
6238 | case 16: {
|
6239 | if (shifting) {
|
6240 | lockX = lockY = shifting = false;
|
6241 | move();
|
6242 | }
|
6243 | break;
|
6244 | }
|
6245 | case 18: {
|
6246 | if (mode === MODE_CENTER) {
|
6247 | if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
|
6248 | if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
|
6249 | mode = MODE_HANDLE;
|
6250 | move();
|
6251 | }
|
6252 | break;
|
6253 | }
|
6254 | case 32: {
|
6255 | if (mode === MODE_SPACE) {
|
6256 | if (on_event.altKey) {
|
6257 | if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
|
6258 | if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
|
6259 | mode = MODE_CENTER;
|
6260 | } else {
|
6261 | if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
|
6262 | if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
|
6263 | mode = MODE_HANDLE;
|
6264 | }
|
6265 | overlay.attr("cursor", cursors[type]);
|
6266 | move();
|
6267 | }
|
6268 | break;
|
6269 | }
|
6270 | default: return;
|
6271 | }
|
6272 | src_noevent();
|
6273 | }
|
6274 | }
|
6275 |
|
6276 | function initialize() {
|
6277 | var state = this.__brush || {selection: null};
|
6278 | state.extent = extent.apply(this, arguments);
|
6279 | state.dim = dim;
|
6280 | return state;
|
6281 | }
|
6282 |
|
6283 | brush.extent = function(_) {
|
6284 | return arguments.length ? (extent = typeof _ === "function" ? _ : d3_brush_src_constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent;
|
6285 | };
|
6286 |
|
6287 | brush.filter = function(_) {
|
6288 | return arguments.length ? (filter = typeof _ === "function" ? _ : d3_brush_src_constant(!!_), brush) : filter;
|
6289 | };
|
6290 |
|
6291 | brush.handleSize = function(_) {
|
6292 | return arguments.length ? (handleSize = +_, brush) : handleSize;
|
6293 | };
|
6294 |
|
6295 | brush.on = function() {
|
6296 | var value = listeners.on.apply(listeners, arguments);
|
6297 | return value === listeners ? brush : value;
|
6298 | };
|
6299 |
|
6300 | return brush;
|
6301 | }
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 | var browser = __webpack_require__(11);
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 |
|
6322 |
|
6323 | var isValue = function (v) {
|
6324 | return v || v === 0;
|
6325 | },
|
6326 | isFunction = function (v) {
|
6327 | return typeof v === "function";
|
6328 | },
|
6329 | isString = function (v) {
|
6330 | return typeof v === "string";
|
6331 | },
|
6332 | isNumber = function (v) {
|
6333 | return typeof v === "number";
|
6334 | },
|
6335 | isUndefined = function (v) {
|
6336 | return typeof v === "undefined";
|
6337 | },
|
6338 | isDefined = function (v) {
|
6339 | return typeof v !== "undefined";
|
6340 | },
|
6341 | isBoolean = function (v) {
|
6342 | return typeof v === "boolean";
|
6343 | },
|
6344 | ceil10 = function (v) {
|
6345 | return Math.ceil(v / 10) * 10;
|
6346 | },
|
6347 | asHalfPixel = function (n) {
|
6348 | return Math.ceil(n) + .5;
|
6349 | },
|
6350 | diffDomain = function (d) {
|
6351 | return d[1] - d[0];
|
6352 | },
|
6353 | isObjectType = function (v) {
|
6354 | return typeof_default()(v) === "object";
|
6355 | },
|
6356 | isEmpty = function (o) {
|
6357 | return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
6358 | },
|
6359 | notEmpty = function (o) {
|
6360 | return !isEmpty(o);
|
6361 | },
|
6362 | isArray = function (arr) {
|
6363 | return arr && arr.constructor === Array;
|
6364 | },
|
6365 | isObject = function (obj) {
|
6366 | return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj);
|
6367 | },
|
6368 | getOption = function (options, key, defaultValue) {
|
6369 | return isDefined(options[key]) ? options[key] : defaultValue;
|
6370 | },
|
6371 | util_hasValue = function (dict, value) {
|
6372 | var found = !1;
|
6373 | return Object.keys(dict).forEach(function (key) {
|
6374 | return dict[key] === value && (found = !0);
|
6375 | }), found;
|
6376 | },
|
6377 | callFn = function (fn) {
|
6378 | for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
6379 |
|
6380 | return isFn && fn.call.apply(fn, args), isFn;
|
6381 | },
|
6382 | sanitise = function (str) {
|
6383 | return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
6384 | },
|
6385 | setTextValue = function (node, text) {
|
6386 | var dy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [-1, 1];
|
6387 | if (node && isString(text)) if (text.indexOf("\n") === -1) node.text(text);else {
|
6388 | var diff = [node.text(), text].map(function (v) {
|
6389 | return v.replace(/[\s\n]/g, "");
|
6390 | });
|
6391 |
|
6392 | if (diff[0] !== diff[1]) {
|
6393 | var multiline = text.split("\n");
|
6394 |
|
6395 | node.html(""), multiline.forEach(function (v, i) {
|
6396 | node.append("tspan").attr("x", 0).attr("dy", "".concat(i === 0 ? dy[0] : dy[1], "em")).text(v);
|
6397 | });
|
6398 | }
|
6399 | }
|
6400 | },
|
6401 | getRectSegList = function (path) {
|
6402 | |
6403 |
|
6404 |
|
6405 |
|
6406 |
|
6407 |
|
6408 |
|
6409 | var _path$getBBox = path.getBBox(),
|
6410 | x = _path$getBBox.x,
|
6411 | y = _path$getBBox.y,
|
6412 | width = _path$getBBox.width,
|
6413 | height = _path$getBBox.height;
|
6414 |
|
6415 | return [{
|
6416 | x: x,
|
6417 | y: y + height
|
6418 | },
|
6419 | {
|
6420 | x: x,
|
6421 | y: y
|
6422 | },
|
6423 | {
|
6424 | x: x + width,
|
6425 | y: y
|
6426 | },
|
6427 | {
|
6428 | x: x + width,
|
6429 | y: y + height
|
6430 |
|
6431 | }];
|
6432 | },
|
6433 | getPathBox = function (path) {
|
6434 | var _path$getBoundingClie = path.getBoundingClientRect(),
|
6435 | width = _path$getBoundingClie.width,
|
6436 | height = _path$getBoundingClie.height,
|
6437 | items = getRectSegList(path),
|
6438 | x = items[0].x,
|
6439 | y = Math.min(items[0].y, items[1].y);
|
6440 |
|
6441 | return {
|
6442 | x: x,
|
6443 | y: y,
|
6444 | width: width,
|
6445 | height: height
|
6446 | };
|
6447 | },
|
6448 | getBrushSelection = function (ctx) {
|
6449 | var selection = null,
|
6450 | event = on_event,
|
6451 | main = ctx.context || ctx.main;
|
6452 | return event && event.constructor.name === "BrushEvent" ? selection = event.selection : main && (selection = main.select(".".concat(config_classes.brush)).node()) && (selection = brushSelection(selection)), selection;
|
6453 | },
|
6454 | getRandom = function () {
|
6455 | var asStr = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0];
|
6456 | return Math.random() + (asStr ? "" : 0);
|
6457 | },
|
6458 | brushEmpty = function (ctx) {
|
6459 | var selection = getBrushSelection(ctx);
|
6460 | return !selection || selection[0] === selection[1];
|
6461 | },
|
6462 | util_extend = function () {
|
6463 | var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
6464 | source = arguments.length > 1 ? arguments[1] : undefined;
|
6465 |
|
6466 | for (var p in source) target[p] = source[p];
|
6467 |
|
6468 | return target;
|
6469 | },
|
6470 | capitalize = function (str) {
|
6471 | return str.charAt(0).toUpperCase() + str.slice(1);
|
6472 | },
|
6473 | toArray = function (v) {
|
6474 | return [].slice.call(v);
|
6475 | },
|
6476 | getCssRules = function (styleSheets) {
|
6477 | var rules = [];
|
6478 | return styleSheets.forEach(function (sheet) {
|
6479 | try {
|
6480 | sheet.cssRules && sheet.cssRules.length && (rules = rules.concat(toArray(sheet.cssRules)));
|
6481 | } catch (e) {
|
6482 | console.error("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
|
6483 | }
|
6484 | }), rules;
|
6485 | },
|
6486 | getUnique = function (data) {
|
6487 | return data.filter(function (v, i, self) {
|
6488 | return self.indexOf(v) === i;
|
6489 | });
|
6490 | },
|
6491 | mergeArray = function (arr) {
|
6492 | return arr && arr.length ? arr.reduce(function (p, c) {
|
6493 | return p.concat(c);
|
6494 | }) : [];
|
6495 | },
|
6496 | mergeObj = function (_mergeObj) {
|
6497 | function mergeObj() {
|
6498 | return _mergeObj.apply(this, arguments);
|
6499 | }
|
6500 |
|
6501 | return mergeObj.toString = function () {
|
6502 | return _mergeObj.toString();
|
6503 | }, mergeObj;
|
6504 | }(function (target) {
|
6505 | for (var _len2 = arguments.length, objectN = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) objectN[_key2 - 1] = arguments[_key2];
|
6506 |
|
6507 | if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
6508 | var source = objectN.shift();
|
6509 | return isObject(target) && isObject(source) && Object.keys(source).forEach(function (key) {
|
6510 | var value = source[key];
|
6511 | isObject(value) ? (!target[key] && (target[key] = {}), target[key] = mergeObj(target[key], value)) : target[key] = isArray(value) ? value.concat() : value;
|
6512 | }), mergeObj.apply(void 0, [target].concat(objectN));
|
6513 | }),
|
6514 | sortValue = function (data) {
|
6515 | var fn,
|
6516 | isAsc = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1];
|
6517 | return data[0] instanceof Date ? fn = isAsc ? function (a, b) {
|
6518 | return a - b;
|
6519 | } : function (a, b) {
|
6520 | return b - a;
|
6521 | } : isAsc && data.every(Number) ? fn = function (a, b) {
|
6522 | return a - b;
|
6523 | } : !isAsc && (fn = function (a, b) {
|
6524 | return a > b && -1 || a < b && 1 || a === b && 0;
|
6525 | }), data.concat().sort(fn);
|
6526 | },
|
6527 | getMinMax = function (type, data) {
|
6528 | var res = data.filter(function (v) {
|
6529 | return notEmpty(v);
|
6530 | });
|
6531 | return res.length ? isNumber(res[0]) ? res = Math[type].apply(Math, toConsumableArray_default()(res)) : res[0] instanceof Date && (res = sortValue(res, type === "min")[0]) : res = undefined, res;
|
6532 | },
|
6533 | getRange = function (start, end) {
|
6534 | var res = [];
|
6535 |
|
6536 | for (var i = start; i < end; i++) res.push(i);
|
6537 |
|
6538 | return res;
|
6539 | },
|
6540 | emulateEvent = {
|
6541 | mouse: function () {
|
6542 | var getParams = function () {
|
6543 | return {
|
6544 | bubbles: !1,
|
6545 | cancelable: !1,
|
6546 | screenX: 0,
|
6547 | screenY: 0,
|
6548 | clientX: 0,
|
6549 | clientY: 0
|
6550 | };
|
6551 | };
|
6552 |
|
6553 | try {
|
6554 | return new MouseEvent("t"), function (el, eventType) {
|
6555 | var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams();
|
6556 | el.dispatchEvent(new MouseEvent(eventType, params));
|
6557 | };
|
6558 | } catch (e) {
|
6559 |
|
6560 | return function (el, eventType) {
|
6561 | var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams(),
|
6562 | mouseEvent = browser["document"].createEvent("MouseEvent");
|
6563 | mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, browser["window"], 0,
|
6564 | params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
6565 | };
|
6566 | }
|
6567 | }(),
|
6568 | touch: function touch(el, eventType, params) {
|
6569 | var touchObj = new Touch(Object.assign({
|
6570 | identifier: Date.now(),
|
6571 | target: el,
|
6572 | radiusX: 2.5,
|
6573 | radiusY: 2.5,
|
6574 | rotationAngle: 10,
|
6575 | force: .5
|
6576 | }, params));
|
6577 | el.dispatchEvent(new TouchEvent(eventType, {
|
6578 | cancelable: !0,
|
6579 | bubbles: !0,
|
6580 | shiftKey: !0,
|
6581 | touches: [touchObj],
|
6582 | targetTouches: [],
|
6583 | changedTouches: [touchObj]
|
6584 | }));
|
6585 | }
|
6586 | },
|
6587 | tplProcess = function (tpl, data) {
|
6588 | var res = tpl;
|
6589 |
|
6590 | for (var x in data) res = res.replace(new RegExp("{=".concat(x, "}"), "g"), data[x]);
|
6591 |
|
6592 | return res;
|
6593 | };
|
6594 |
|
6595 |
|
6596 |
|
6597 | var src_ascending = (function(a, b) {
|
6598 | return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
6599 | });
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 | var bisector = (function(compare) {
|
6605 | if (compare.length === 1) compare = ascendingComparator(compare);
|
6606 | return {
|
6607 | left: function(a, x, lo, hi) {
|
6608 | if (lo == null) lo = 0;
|
6609 | if (hi == null) hi = a.length;
|
6610 | while (lo < hi) {
|
6611 | var mid = lo + hi >>> 1;
|
6612 | if (compare(a[mid], x) < 0) lo = mid + 1;
|
6613 | else hi = mid;
|
6614 | }
|
6615 | return lo;
|
6616 | },
|
6617 | right: function(a, x, lo, hi) {
|
6618 | if (lo == null) lo = 0;
|
6619 | if (hi == null) hi = a.length;
|
6620 | while (lo < hi) {
|
6621 | var mid = lo + hi >>> 1;
|
6622 | if (compare(a[mid], x) > 0) hi = mid;
|
6623 | else lo = mid + 1;
|
6624 | }
|
6625 | return lo;
|
6626 | }
|
6627 | };
|
6628 | });
|
6629 |
|
6630 | function ascendingComparator(f) {
|
6631 | return function(d, x) {
|
6632 | return src_ascending(f(d), x);
|
6633 | };
|
6634 | }
|
6635 |
|
6636 |
|
6637 |
|
6638 |
|
6639 |
|
6640 | var ascendingBisect = bisector(src_ascending);
|
6641 | var bisectRight = ascendingBisect.right;
|
6642 | var bisectLeft = ascendingBisect.left;
|
6643 | var bisect = (bisectRight);
|
6644 |
|
6645 |
|
6646 | var pairs = (function(array, f) {
|
6647 | if (f == null) f = pair;
|
6648 | var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);
|
6649 | while (i < n) pairs[i] = f(p, p = array[++i]);
|
6650 | return pairs;
|
6651 | });
|
6652 |
|
6653 | function pair(a, b) {
|
6654 | return [a, b];
|
6655 | }
|
6656 |
|
6657 |
|
6658 |
|
6659 |
|
6660 | var cross = (function(values0, values1, reduce) {
|
6661 | var n0 = values0.length,
|
6662 | n1 = values1.length,
|
6663 | values = new Array(n0 * n1),
|
6664 | i0,
|
6665 | i1,
|
6666 | i,
|
6667 | value0;
|
6668 |
|
6669 | if (reduce == null) reduce = pair;
|
6670 |
|
6671 | for (i0 = i = 0; i0 < n0; ++i0) {
|
6672 | for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {
|
6673 | values[i] = reduce(value0, values1[i1]);
|
6674 | }
|
6675 | }
|
6676 |
|
6677 | return values;
|
6678 | });
|
6679 |
|
6680 |
|
6681 | var descending = (function(a, b) {
|
6682 | return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
6683 | });
|
6684 |
|
6685 |
|
6686 | var src_number = (function(x) {
|
6687 | return x === null ? NaN : +x;
|
6688 | });
|
6689 |
|
6690 |
|
6691 |
|
6692 |
|
6693 | var variance = (function(values, valueof) {
|
6694 | var n = values.length,
|
6695 | m = 0,
|
6696 | i = -1,
|
6697 | mean = 0,
|
6698 | value,
|
6699 | delta,
|
6700 | sum = 0;
|
6701 |
|
6702 | if (valueof == null) {
|
6703 | while (++i < n) {
|
6704 | if (!isNaN(value = src_number(values[i]))) {
|
6705 | delta = value - mean;
|
6706 | mean += delta / ++m;
|
6707 | sum += delta * (value - mean);
|
6708 | }
|
6709 | }
|
6710 | }
|
6711 |
|
6712 | else {
|
6713 | while (++i < n) {
|
6714 | if (!isNaN(value = src_number(valueof(values[i], i, values)))) {
|
6715 | delta = value - mean;
|
6716 | mean += delta / ++m;
|
6717 | sum += delta * (value - mean);
|
6718 | }
|
6719 | }
|
6720 | }
|
6721 |
|
6722 | if (m > 1) return sum / (m - 1);
|
6723 | });
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 | var deviation = (function(array, f) {
|
6729 | var v = variance(array, f);
|
6730 | return v ? Math.sqrt(v) : v;
|
6731 | });
|
6732 |
|
6733 |
|
6734 | var src_extent = (function(values, valueof) {
|
6735 | var n = values.length,
|
6736 | i = -1,
|
6737 | value,
|
6738 | min,
|
6739 | max;
|
6740 |
|
6741 | if (valueof == null) {
|
6742 | while (++i < n) {
|
6743 | if ((value = values[i]) != null && value >= value) {
|
6744 | min = max = value;
|
6745 | while (++i < n) {
|
6746 | if ((value = values[i]) != null) {
|
6747 | if (min > value) min = value;
|
6748 | if (max < value) max = value;
|
6749 | }
|
6750 | }
|
6751 | }
|
6752 | }
|
6753 | }
|
6754 |
|
6755 | else {
|
6756 | while (++i < n) {
|
6757 | if ((value = valueof(values[i], i, values)) != null && value >= value) {
|
6758 | min = max = value;
|
6759 | while (++i < n) {
|
6760 | if ((value = valueof(values[i], i, values)) != null) {
|
6761 | if (min > value) min = value;
|
6762 | if (max < value) max = value;
|
6763 | }
|
6764 | }
|
6765 | }
|
6766 | }
|
6767 | }
|
6768 |
|
6769 | return [min, max];
|
6770 | });
|
6771 |
|
6772 |
|
6773 | var array_array = Array.prototype;
|
6774 |
|
6775 | var array_slice = array_array.slice;
|
6776 | var map = array_array.map;
|
6777 |
|
6778 |
|
6779 | var d3_array_src_constant = (function(x) {
|
6780 | return function() {
|
6781 | return x;
|
6782 | };
|
6783 | });
|
6784 |
|
6785 |
|
6786 | var d3_array_src_identity = (function(x) {
|
6787 | return x;
|
6788 | });
|
6789 |
|
6790 |
|
6791 | var src_range = (function(start, stop, step) {
|
6792 | start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
6793 |
|
6794 | var i = -1,
|
6795 | n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
|
6796 | range = new Array(n);
|
6797 |
|
6798 | while (++i < n) {
|
6799 | range[i] = start + i * step;
|
6800 | }
|
6801 |
|
6802 | return range;
|
6803 | });
|
6804 |
|
6805 |
|
6806 | var e10 = Math.sqrt(50),
|
6807 | e5 = Math.sqrt(10),
|
6808 | e2 = Math.sqrt(2);
|
6809 |
|
6810 | var src_ticks = (function(start, stop, count) {
|
6811 | var reverse,
|
6812 | i = -1,
|
6813 | n,
|
6814 | ticks,
|
6815 | step;
|
6816 |
|
6817 | stop = +stop, start = +start, count = +count;
|
6818 | if (start === stop && count > 0) return [start];
|
6819 | if (reverse = stop < start) n = start, start = stop, stop = n;
|
6820 | if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
|
6821 |
|
6822 | if (step > 0) {
|
6823 | start = Math.ceil(start / step);
|
6824 | stop = Math.floor(stop / step);
|
6825 | ticks = new Array(n = Math.ceil(stop - start + 1));
|
6826 | while (++i < n) ticks[i] = (start + i) * step;
|
6827 | } else {
|
6828 | start = Math.floor(start * step);
|
6829 | stop = Math.ceil(stop * step);
|
6830 | ticks = new Array(n = Math.ceil(start - stop + 1));
|
6831 | while (++i < n) ticks[i] = (start - i) / step;
|
6832 | }
|
6833 |
|
6834 | if (reverse) ticks.reverse();
|
6835 |
|
6836 | return ticks;
|
6837 | });
|
6838 |
|
6839 | function tickIncrement(start, stop, count) {
|
6840 | var step = (stop - start) / Math.max(0, count),
|
6841 | power = Math.floor(Math.log(step) / Math.LN10),
|
6842 | error = step / Math.pow(10, power);
|
6843 | return power >= 0
|
6844 | ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
|
6845 | : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
|
6846 | }
|
6847 |
|
6848 | function tickStep(start, stop, count) {
|
6849 | var step0 = Math.abs(stop - start) / Math.max(0, count),
|
6850 | step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
|
6851 | error = step0 / step1;
|
6852 | if (error >= e10) step1 *= 10;
|
6853 | else if (error >= e5) step1 *= 5;
|
6854 | else if (error >= e2) step1 *= 2;
|
6855 | return stop < start ? -step1 : step1;
|
6856 | }
|
6857 |
|
6858 |
|
6859 | var sturges = (function(values) {
|
6860 | return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
|
6861 | });
|
6862 |
|
6863 |
|
6864 |
|
6865 |
|
6866 |
|
6867 |
|
6868 |
|
6869 |
|
6870 |
|
6871 |
|
6872 |
|
6873 | var src_histogram = (function() {
|
6874 | var value = d3_array_src_identity,
|
6875 | domain = src_extent,
|
6876 | threshold = sturges;
|
6877 |
|
6878 | function histogram(data) {
|
6879 | var i,
|
6880 | n = data.length,
|
6881 | x,
|
6882 | values = new Array(n);
|
6883 |
|
6884 | for (i = 0; i < n; ++i) {
|
6885 | values[i] = value(data[i], i, data);
|
6886 | }
|
6887 |
|
6888 | var xz = domain(values),
|
6889 | x0 = xz[0],
|
6890 | x1 = xz[1],
|
6891 | tz = threshold(values, x0, x1);
|
6892 |
|
6893 |
|
6894 | if (!Array.isArray(tz)) {
|
6895 | tz = tickStep(x0, x1, tz);
|
6896 | tz = src_range(Math.ceil(x0 / tz) * tz, x1, tz);
|
6897 | }
|
6898 |
|
6899 |
|
6900 | var m = tz.length;
|
6901 | while (tz[0] <= x0) tz.shift(), --m;
|
6902 | while (tz[m - 1] > x1) tz.pop(), --m;
|
6903 |
|
6904 | var bins = new Array(m + 1),
|
6905 | bin;
|
6906 |
|
6907 |
|
6908 | for (i = 0; i <= m; ++i) {
|
6909 | bin = bins[i] = [];
|
6910 | bin.x0 = i > 0 ? tz[i - 1] : x0;
|
6911 | bin.x1 = i < m ? tz[i] : x1;
|
6912 | }
|
6913 |
|
6914 |
|
6915 | for (i = 0; i < n; ++i) {
|
6916 | x = values[i];
|
6917 | if (x0 <= x && x <= x1) {
|
6918 | bins[bisect(tz, x, 0, m)].push(data[i]);
|
6919 | }
|
6920 | }
|
6921 |
|
6922 | return bins;
|
6923 | }
|
6924 |
|
6925 | histogram.value = function(_) {
|
6926 | return arguments.length ? (value = typeof _ === "function" ? _ : d3_array_src_constant(_), histogram) : value;
|
6927 | };
|
6928 |
|
6929 | histogram.domain = function(_) {
|
6930 | return arguments.length ? (domain = typeof _ === "function" ? _ : d3_array_src_constant([_[0], _[1]]), histogram) : domain;
|
6931 | };
|
6932 |
|
6933 | histogram.thresholds = function(_) {
|
6934 | return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? d3_array_src_constant(array_slice.call(_)) : d3_array_src_constant(_), histogram) : threshold;
|
6935 | };
|
6936 |
|
6937 | return histogram;
|
6938 | });
|
6939 |
|
6940 |
|
6941 |
|
6942 |
|
6943 | var quantile = (function(values, p, valueof) {
|
6944 | if (valueof == null) valueof = src_number;
|
6945 | if (!(n = values.length)) return;
|
6946 | if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
|
6947 | if (p >= 1) return +valueof(values[n - 1], n - 1, values);
|
6948 | var n,
|
6949 | i = (n - 1) * p,
|
6950 | i0 = Math.floor(i),
|
6951 | value0 = +valueof(values[i0], i0, values),
|
6952 | value1 = +valueof(values[i0 + 1], i0 + 1, values);
|
6953 | return value0 + (value1 - value0) * (i - i0);
|
6954 | });
|
6955 |
|
6956 |
|
6957 |
|
6958 |
|
6959 |
|
6960 |
|
6961 |
|
6962 | var freedmanDiaconis = (function(values, min, max) {
|
6963 | values = map.call(values, src_number).sort(src_ascending);
|
6964 | return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3)));
|
6965 | });
|
6966 |
|
6967 |
|
6968 |
|
6969 |
|
6970 | var scott = (function(values, min, max) {
|
6971 | return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
|
6972 | });
|
6973 |
|
6974 |
|
6975 | var src_max = (function(values, valueof) {
|
6976 | var n = values.length,
|
6977 | i = -1,
|
6978 | value,
|
6979 | max;
|
6980 |
|
6981 | if (valueof == null) {
|
6982 | while (++i < n) {
|
6983 | if ((value = values[i]) != null && value >= value) {
|
6984 | max = value;
|
6985 | while (++i < n) {
|
6986 | if ((value = values[i]) != null && value > max) {
|
6987 | max = value;
|
6988 | }
|
6989 | }
|
6990 | }
|
6991 | }
|
6992 | }
|
6993 |
|
6994 | else {
|
6995 | while (++i < n) {
|
6996 | if ((value = valueof(values[i], i, values)) != null && value >= value) {
|
6997 | max = value;
|
6998 | while (++i < n) {
|
6999 | if ((value = valueof(values[i], i, values)) != null && value > max) {
|
7000 | max = value;
|
7001 | }
|
7002 | }
|
7003 | }
|
7004 | }
|
7005 | }
|
7006 |
|
7007 | return max;
|
7008 | });
|
7009 |
|
7010 |
|
7011 |
|
7012 |
|
7013 | var src_mean = (function(values, valueof) {
|
7014 | var n = values.length,
|
7015 | m = n,
|
7016 | i = -1,
|
7017 | value,
|
7018 | sum = 0;
|
7019 |
|
7020 | if (valueof == null) {
|
7021 | while (++i < n) {
|
7022 | if (!isNaN(value = src_number(values[i]))) sum += value;
|
7023 | else --m;
|
7024 | }
|
7025 | }
|
7026 |
|
7027 | else {
|
7028 | while (++i < n) {
|
7029 | if (!isNaN(value = src_number(valueof(values[i], i, values)))) sum += value;
|
7030 | else --m;
|
7031 | }
|
7032 | }
|
7033 |
|
7034 | if (m) return sum / m;
|
7035 | });
|
7036 |
|
7037 |
|
7038 |
|
7039 |
|
7040 |
|
7041 |
|
7042 | var median = (function(values, valueof) {
|
7043 | var n = values.length,
|
7044 | i = -1,
|
7045 | value,
|
7046 | numbers = [];
|
7047 |
|
7048 | if (valueof == null) {
|
7049 | while (++i < n) {
|
7050 | if (!isNaN(value = src_number(values[i]))) {
|
7051 | numbers.push(value);
|
7052 | }
|
7053 | }
|
7054 | }
|
7055 |
|
7056 | else {
|
7057 | while (++i < n) {
|
7058 | if (!isNaN(value = src_number(valueof(values[i], i, values)))) {
|
7059 | numbers.push(value);
|
7060 | }
|
7061 | }
|
7062 | }
|
7063 |
|
7064 | return quantile(numbers.sort(src_ascending), 0.5);
|
7065 | });
|
7066 |
|
7067 |
|
7068 | var src_merge = (function(arrays) {
|
7069 | var n = arrays.length,
|
7070 | m,
|
7071 | i = -1,
|
7072 | j = 0,
|
7073 | merged,
|
7074 | array;
|
7075 |
|
7076 | while (++i < n) j += arrays[i].length;
|
7077 | merged = new Array(j);
|
7078 |
|
7079 | while (--n >= 0) {
|
7080 | array = arrays[n];
|
7081 | m = array.length;
|
7082 | while (--m >= 0) {
|
7083 | merged[--j] = array[m];
|
7084 | }
|
7085 | }
|
7086 |
|
7087 | return merged;
|
7088 | });
|
7089 |
|
7090 |
|
7091 | var src_min = (function(values, valueof) {
|
7092 | var n = values.length,
|
7093 | i = -1,
|
7094 | value,
|
7095 | min;
|
7096 |
|
7097 | if (valueof == null) {
|
7098 | while (++i < n) {
|
7099 | if ((value = values[i]) != null && value >= value) {
|
7100 | min = value;
|
7101 | while (++i < n) {
|
7102 | if ((value = values[i]) != null && min > value) {
|
7103 | min = value;
|
7104 | }
|
7105 | }
|
7106 | }
|
7107 | }
|
7108 | }
|
7109 |
|
7110 | else {
|
7111 | while (++i < n) {
|
7112 | if ((value = valueof(values[i], i, values)) != null && value >= value) {
|
7113 | min = value;
|
7114 | while (++i < n) {
|
7115 | if ((value = valueof(values[i], i, values)) != null && min > value) {
|
7116 | min = value;
|
7117 | }
|
7118 | }
|
7119 | }
|
7120 | }
|
7121 | }
|
7122 |
|
7123 | return min;
|
7124 | });
|
7125 |
|
7126 |
|
7127 | var permute = (function(array, indexes) {
|
7128 | var i = indexes.length, permutes = new Array(i);
|
7129 | while (i--) permutes[i] = array[indexes[i]];
|
7130 | return permutes;
|
7131 | });
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 | var scan = (function(values, compare) {
|
7137 | if (!(n = values.length)) return;
|
7138 | var n,
|
7139 | i = 0,
|
7140 | j = 0,
|
7141 | xi,
|
7142 | xj = values[j];
|
7143 |
|
7144 | if (compare == null) compare = src_ascending;
|
7145 |
|
7146 | while (++i < n) {
|
7147 | if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) {
|
7148 | xj = xi, j = i;
|
7149 | }
|
7150 | }
|
7151 |
|
7152 | if (compare(xj, xj) === 0) return j;
|
7153 | });
|
7154 |
|
7155 |
|
7156 | var shuffle = (function(array, i0, i1) {
|
7157 | var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
|
7158 | t,
|
7159 | i;
|
7160 |
|
7161 | while (m) {
|
7162 | i = Math.random() * m-- | 0;
|
7163 | t = array[m + i0];
|
7164 | array[m + i0] = array[i + i0];
|
7165 | array[i + i0] = t;
|
7166 | }
|
7167 |
|
7168 | return array;
|
7169 | });
|
7170 |
|
7171 |
|
7172 | var src_sum = (function(values, valueof) {
|
7173 | var n = values.length,
|
7174 | i = -1,
|
7175 | value,
|
7176 | sum = 0;
|
7177 |
|
7178 | if (valueof == null) {
|
7179 | while (++i < n) {
|
7180 | if (value = +values[i]) sum += value;
|
7181 | }
|
7182 | }
|
7183 |
|
7184 | else {
|
7185 | while (++i < n) {
|
7186 | if (value = +valueof(values[i], i, values)) sum += value;
|
7187 | }
|
7188 | }
|
7189 |
|
7190 | return sum;
|
7191 | });
|
7192 |
|
7193 |
|
7194 |
|
7195 |
|
7196 | var src_transpose = (function(matrix) {
|
7197 | if (!(n = matrix.length)) return [];
|
7198 | for (var i = -1, m = src_min(matrix, transpose_length), transpose = new Array(m); ++i < m;) {
|
7199 | for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
|
7200 | row[j] = matrix[j][i];
|
7201 | }
|
7202 | }
|
7203 | return transpose;
|
7204 | });
|
7205 |
|
7206 | function transpose_length(d) {
|
7207 | return d.length;
|
7208 | }
|
7209 |
|
7210 |
|
7211 |
|
7212 |
|
7213 | var zip = (function() {
|
7214 | return src_transpose(arguments);
|
7215 | });
|
7216 |
|
7217 |
|
7218 |
|
7219 |
|
7220 |
|
7221 |
|
7222 |
|
7223 |
|
7224 |
|
7225 |
|
7226 |
|
7227 |
|
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 |
|
7235 |
|
7236 |
|
7237 |
|
7238 |
|
7239 |
|
7240 |
|
7241 |
|
7242 |
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 | function initRange(domain, range) {
|
7248 | switch (arguments.length) {
|
7249 | case 0: break;
|
7250 | case 1: this.range(domain); break;
|
7251 | default: this.range(range).domain(domain); break;
|
7252 | }
|
7253 | return this;
|
7254 | }
|
7255 |
|
7256 | function initInterpolator(domain, interpolator) {
|
7257 | switch (arguments.length) {
|
7258 | case 0: break;
|
7259 | case 1: this.interpolator(domain); break;
|
7260 | default: this.interpolator(interpolator).domain(domain); break;
|
7261 | }
|
7262 | return this;
|
7263 | }
|
7264 |
|
7265 |
|
7266 | var map_prefix = "$";
|
7267 |
|
7268 | function Map() {}
|
7269 |
|
7270 | Map.prototype = map_map.prototype = {
|
7271 | constructor: Map,
|
7272 | has: function(key) {
|
7273 | return (map_prefix + key) in this;
|
7274 | },
|
7275 | get: function(key) {
|
7276 | return this[map_prefix + key];
|
7277 | },
|
7278 | set: function(key, value) {
|
7279 | this[map_prefix + key] = value;
|
7280 | return this;
|
7281 | },
|
7282 | remove: function(key) {
|
7283 | var property = map_prefix + key;
|
7284 | return property in this && delete this[property];
|
7285 | },
|
7286 | clear: function() {
|
7287 | for (var property in this) if (property[0] === map_prefix) delete this[property];
|
7288 | },
|
7289 | keys: function() {
|
7290 | var keys = [];
|
7291 | for (var property in this) if (property[0] === map_prefix) keys.push(property.slice(1));
|
7292 | return keys;
|
7293 | },
|
7294 | values: function() {
|
7295 | var values = [];
|
7296 | for (var property in this) if (property[0] === map_prefix) values.push(this[property]);
|
7297 | return values;
|
7298 | },
|
7299 | entries: function() {
|
7300 | var entries = [];
|
7301 | for (var property in this) if (property[0] === map_prefix) entries.push({key: property.slice(1), value: this[property]});
|
7302 | return entries;
|
7303 | },
|
7304 | size: function() {
|
7305 | var size = 0;
|
7306 | for (var property in this) if (property[0] === map_prefix) ++size;
|
7307 | return size;
|
7308 | },
|
7309 | empty: function() {
|
7310 | for (var property in this) if (property[0] === map_prefix) return false;
|
7311 | return true;
|
7312 | },
|
7313 | each: function(f) {
|
7314 | for (var property in this) if (property[0] === map_prefix) f(this[property], property.slice(1), this);
|
7315 | }
|
7316 | };
|
7317 |
|
7318 | function map_map(object, f) {
|
7319 | var map = new Map;
|
7320 |
|
7321 |
|
7322 | if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });
|
7323 |
|
7324 |
|
7325 | else if (Array.isArray(object)) {
|
7326 | var i = -1,
|
7327 | n = object.length,
|
7328 | o;
|
7329 |
|
7330 | if (f == null) while (++i < n) map.set(i, object[i]);
|
7331 | else while (++i < n) map.set(f(o = object[i], i, object), o);
|
7332 | }
|
7333 |
|
7334 |
|
7335 | else if (object) for (var key in object) map.set(key, object[key]);
|
7336 |
|
7337 | return map;
|
7338 | }
|
7339 |
|
7340 | var src_map = (map_map);
|
7341 |
|
7342 |
|
7343 |
|
7344 |
|
7345 | var src_nest = (function() {
|
7346 | var keys = [],
|
7347 | sortKeys = [],
|
7348 | sortValues,
|
7349 | rollup,
|
7350 | nest;
|
7351 |
|
7352 | function apply(array, depth, createResult, setResult) {
|
7353 | if (depth >= keys.length) {
|
7354 | if (sortValues != null) array.sort(sortValues);
|
7355 | return rollup != null ? rollup(array) : array;
|
7356 | }
|
7357 |
|
7358 | var i = -1,
|
7359 | n = array.length,
|
7360 | key = keys[depth++],
|
7361 | keyValue,
|
7362 | value,
|
7363 | valuesByKey = src_map(),
|
7364 | values,
|
7365 | result = createResult();
|
7366 |
|
7367 | while (++i < n) {
|
7368 | if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) {
|
7369 | values.push(value);
|
7370 | } else {
|
7371 | valuesByKey.set(keyValue, [value]);
|
7372 | }
|
7373 | }
|
7374 |
|
7375 | valuesByKey.each(function(values, key) {
|
7376 | setResult(result, key, apply(values, depth, createResult, setResult));
|
7377 | });
|
7378 |
|
7379 | return result;
|
7380 | }
|
7381 |
|
7382 | function entries(map, depth) {
|
7383 | if (++depth > keys.length) return map;
|
7384 | var array, sortKey = sortKeys[depth - 1];
|
7385 | if (rollup != null && depth >= keys.length) array = map.entries();
|
7386 | else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });
|
7387 | return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;
|
7388 | }
|
7389 |
|
7390 | return nest = {
|
7391 | object: function(array) { return apply(array, 0, createObject, setObject); },
|
7392 | map: function(array) { return apply(array, 0, createMap, setMap); },
|
7393 | entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },
|
7394 | key: function(d) { keys.push(d); return nest; },
|
7395 | sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },
|
7396 | sortValues: function(order) { sortValues = order; return nest; },
|
7397 | rollup: function(f) { rollup = f; return nest; }
|
7398 | };
|
7399 | });
|
7400 |
|
7401 | function createObject() {
|
7402 | return {};
|
7403 | }
|
7404 |
|
7405 | function setObject(object, key, value) {
|
7406 | object[key] = value;
|
7407 | }
|
7408 |
|
7409 | function createMap() {
|
7410 | return src_map();
|
7411 | }
|
7412 |
|
7413 | function setMap(map, key, value) {
|
7414 | map.set(key, value);
|
7415 | }
|
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 | function Set() {}
|
7421 |
|
7422 | var proto = src_map.prototype;
|
7423 |
|
7424 | Set.prototype = set_set.prototype = {
|
7425 | constructor: Set,
|
7426 | has: proto.has,
|
7427 | add: function(value) {
|
7428 | value += "";
|
7429 | this[map_prefix + value] = value;
|
7430 | return this;
|
7431 | },
|
7432 | remove: proto.remove,
|
7433 | clear: proto.clear,
|
7434 | values: proto.keys,
|
7435 | size: proto.size,
|
7436 | empty: proto.empty,
|
7437 | each: proto.each
|
7438 | };
|
7439 |
|
7440 | function set_set(object, f) {
|
7441 | var set = new Set;
|
7442 |
|
7443 | // Copy constructor.
|
7444 | if (object instanceof Set) object.each(function(value) { set.add(value); });
|
7445 |
|
7446 | // Otherwise, assume it’s an array.
|
7447 | else if (object) {
|
7448 | var i = -1, n = object.length;
|
7449 | if (f == null) while (++i < n) set.add(object[i]);
|
7450 | else while (++i < n) set.add(f(object[i], i, object));
|
7451 | }
|
7452 |
|
7453 | return set;
|
7454 | }
|
7455 |
|
7456 | /* harmony default export */ var src_set = (set_set);
|
7457 |
|
7458 | // CONCATENATED MODULE: ./node_modules/d3-collection/src/keys.js
|
7459 | /* harmony default export */ var src_keys = (function(map) {
|
7460 | var keys = [];
|
7461 | for (var key in map) keys.push(key);
|
7462 | return keys;
|
7463 | });
|
7464 |
|
7465 |
|
7466 | var src_values = (function(map) {
|
7467 | var values = [];
|
7468 | for (var key in map) values.push(map[key]);
|
7469 | return values;
|
7470 | });
|
7471 |
|
7472 |
|
7473 | var src_entries = (function(map) {
|
7474 | var entries = [];
|
7475 | for (var key in map) entries.push({key: key, value: map[key]});
|
7476 | return entries;
|
7477 | });
|
7478 |
|
7479 |
|
7480 |
|
7481 |
|
7482 |
|
7483 |
|
7484 |
|
7485 |
|
7486 |
|
7487 |
|
7488 | var src_array_array = Array.prototype;
|
7489 |
|
7490 | var array_map = src_array_array.map;
|
7491 | var src_array_slice = src_array_array.slice;
|
7492 |
|
7493 |
|
7494 |
|
7495 |
|
7496 |
|
7497 |
|
7498 | var implicit = {name: "implicit"};
|
7499 |
|
7500 | function ordinal() {
|
7501 | var index = src_map(),
|
7502 | domain = [],
|
7503 | range = [],
|
7504 | unknown = implicit;
|
7505 |
|
7506 | function scale(d) {
|
7507 | var key = d + "", i = index.get(key);
|
7508 | if (!i) {
|
7509 | if (unknown !== implicit) return unknown;
|
7510 | index.set(key, i = domain.push(d));
|
7511 | }
|
7512 | return range[(i - 1) % range.length];
|
7513 | }
|
7514 |
|
7515 | scale.domain = function(_) {
|
7516 | if (!arguments.length) return domain.slice();
|
7517 | domain = [], index = src_map();
|
7518 | var i = -1, n = _.length, d, key;
|
7519 | while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
|
7520 | return scale;
|
7521 | };
|
7522 |
|
7523 | scale.range = function(_) {
|
7524 | return arguments.length ? (range = src_array_slice.call(_), scale) : range.slice();
|
7525 | };
|
7526 |
|
7527 | scale.unknown = function(_) {
|
7528 | return arguments.length ? (unknown = _, scale) : unknown;
|
7529 | };
|
7530 |
|
7531 | scale.copy = function() {
|
7532 | return ordinal(domain, range).unknown(unknown);
|
7533 | };
|
7534 |
|
7535 | initRange.apply(scale, arguments);
|
7536 |
|
7537 | return scale;
|
7538 | }
|
7539 |
|
7540 |
|
7541 |
|
7542 |
|
7543 |
|
7544 |
|
7545 | function band() {
|
7546 | var scale = ordinal().unknown(undefined),
|
7547 | domain = scale.domain,
|
7548 | ordinalRange = scale.range,
|
7549 | range = [0, 1],
|
7550 | step,
|
7551 | bandwidth,
|
7552 | round = false,
|
7553 | paddingInner = 0,
|
7554 | paddingOuter = 0,
|
7555 | align = 0.5;
|
7556 |
|
7557 | delete scale.unknown;
|
7558 |
|
7559 | function rescale() {
|
7560 | var n = domain().length,
|
7561 | reverse = range[1] < range[0],
|
7562 | start = range[reverse - 0],
|
7563 | stop = range[1 - reverse];
|
7564 | step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
7565 | if (round) step = Math.floor(step);
|
7566 | start += (stop - start - step * (n - paddingInner)) * align;
|
7567 | bandwidth = step * (1 - paddingInner);
|
7568 | if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
|
7569 | var values = src_range(n).map(function(i) { return start + step * i; });
|
7570 | return ordinalRange(reverse ? values.reverse() : values);
|
7571 | }
|
7572 |
|
7573 | scale.domain = function(_) {
|
7574 | return arguments.length ? (domain(_), rescale()) : domain();
|
7575 | };
|
7576 |
|
7577 | scale.range = function(_) {
|
7578 | return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice();
|
7579 | };
|
7580 |
|
7581 | scale.rangeRound = function(_) {
|
7582 | return range = [+_[0], +_[1]], round = true, rescale();
|
7583 | };
|
7584 |
|
7585 | scale.bandwidth = function() {
|
7586 | return bandwidth;
|
7587 | };
|
7588 |
|
7589 | scale.step = function() {
|
7590 | return step;
|
7591 | };
|
7592 |
|
7593 | scale.round = function(_) {
|
7594 | return arguments.length ? (round = !!_, rescale()) : round;
|
7595 | };
|
7596 |
|
7597 | scale.padding = function(_) {
|
7598 | return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
|
7599 | };
|
7600 |
|
7601 | scale.paddingInner = function(_) {
|
7602 | return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
|
7603 | };
|
7604 |
|
7605 | scale.paddingOuter = function(_) {
|
7606 | return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
|
7607 | };
|
7608 |
|
7609 | scale.align = function(_) {
|
7610 | return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
7611 | };
|
7612 |
|
7613 | scale.copy = function() {
|
7614 | return band(domain(), range)
|
7615 | .round(round)
|
7616 | .paddingInner(paddingInner)
|
7617 | .paddingOuter(paddingOuter)
|
7618 | .align(align);
|
7619 | };
|
7620 |
|
7621 | return initRange.apply(rescale(), arguments);
|
7622 | }
|
7623 |
|
7624 | function pointish(scale) {
|
7625 | var copy = scale.copy;
|
7626 |
|
7627 | scale.padding = scale.paddingOuter;
|
7628 | delete scale.paddingInner;
|
7629 | delete scale.paddingOuter;
|
7630 |
|
7631 | scale.copy = function() {
|
7632 | return pointish(copy());
|
7633 | };
|
7634 |
|
7635 | return scale;
|
7636 | }
|
7637 |
|
7638 | function band_point() {
|
7639 | return pointish(band.apply(null, arguments).paddingInner(1));
|
7640 | }
|
7641 |
|
7642 |
|
7643 | var d3_scale_src_constant = (function(x) {
|
7644 | return function() {
|
7645 | return x;
|
7646 | };
|
7647 | });
|
7648 |
|
7649 |
|
7650 | var d3_scale_src_number = (function(x) {
|
7651 | return +x;
|
7652 | });
|
7653 |
|
7654 |
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 | var unit = [0, 1];
|
7662 |
|
7663 | function continuous_identity(x) {
|
7664 | return x;
|
7665 | }
|
7666 |
|
7667 | function normalize(a, b) {
|
7668 | return (b -= (a = +a))
|
7669 | ? function(x) { return (x - a) / b; }
|
7670 | : d3_scale_src_constant(isNaN(b) ? NaN : 0.5);
|
7671 | }
|
7672 |
|
7673 | function clamper(domain) {
|
7674 | var a = domain[0], b = domain[domain.length - 1], t;
|
7675 | if (a > b) t = a, a = b, b = t;
|
7676 | return function(x) { return Math.max(a, Math.min(b, x)); };
|
7677 | }
|
7678 |
|
7679 |
|
7680 |
|
7681 | function bimap(domain, range, interpolate) {
|
7682 | var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
|
7683 | if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
|
7684 | else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
7685 | return function(x) { return r0(d0(x)); };
|
7686 | }
|
7687 |
|
7688 | function polymap(domain, range, interpolate) {
|
7689 | var j = Math.min(domain.length, range.length) - 1,
|
7690 | d = new Array(j),
|
7691 | r = new Array(j),
|
7692 | i = -1;
|
7693 |
|
7694 |
|
7695 | if (domain[j] < domain[0]) {
|
7696 | domain = domain.slice().reverse();
|
7697 | range = range.slice().reverse();
|
7698 | }
|
7699 |
|
7700 | while (++i < j) {
|
7701 | d[i] = normalize(domain[i], domain[i + 1]);
|
7702 | r[i] = interpolate(range[i], range[i + 1]);
|
7703 | }
|
7704 |
|
7705 | return function(x) {
|
7706 | var i = bisect(domain, x, 1, j) - 1;
|
7707 | return r[i](d[i](x));
|
7708 | };
|
7709 | }
|
7710 |
|
7711 | function copy(source, target) {
|
7712 | return target
|
7713 | .domain(source.domain())
|
7714 | .range(source.range())
|
7715 | .interpolate(source.interpolate())
|
7716 | .clamp(source.clamp())
|
7717 | .unknown(source.unknown());
|
7718 | }
|
7719 |
|
7720 | function transformer() {
|
7721 | var domain = unit,
|
7722 | range = unit,
|
7723 | interpolate = src_value,
|
7724 | transform,
|
7725 | untransform,
|
7726 | unknown,
|
7727 | clamp = continuous_identity,
|
7728 | piecewise,
|
7729 | output,
|
7730 | input;
|
7731 |
|
7732 | function rescale() {
|
7733 | piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
|
7734 | output = input = null;
|
7735 | return scale;
|
7736 | }
|
7737 |
|
7738 | function scale(x) {
|
7739 | return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
|
7740 | }
|
7741 |
|
7742 | scale.invert = function(y) {
|
7743 | return clamp(untransform((input || (input = piecewise(range, domain.map(transform), number)))(y)));
|
7744 | };
|
7745 |
|
7746 | scale.domain = function(_) {
|
7747 | return arguments.length ? (domain = array_map.call(_, d3_scale_src_number), clamp === continuous_identity || (clamp = clamper(domain)), rescale()) : domain.slice();
|
7748 | };
|
7749 |
|
7750 | scale.range = function(_) {
|
7751 | return arguments.length ? (range = src_array_slice.call(_), rescale()) : range.slice();
|
7752 | };
|
7753 |
|
7754 | scale.rangeRound = function(_) {
|
7755 | return range = src_array_slice.call(_), interpolate = src_round, rescale();
|
7756 | };
|
7757 |
|
7758 | scale.clamp = function(_) {
|
7759 | return arguments.length ? (clamp = _ ? clamper(domain) : continuous_identity, scale) : clamp !== continuous_identity;
|
7760 | };
|
7761 |
|
7762 | scale.interpolate = function(_) {
|
7763 | return arguments.length ? (interpolate = _, rescale()) : interpolate;
|
7764 | };
|
7765 |
|
7766 | scale.unknown = function(_) {
|
7767 | return arguments.length ? (unknown = _, scale) : unknown;
|
7768 | };
|
7769 |
|
7770 | return function(t, u) {
|
7771 | transform = t, untransform = u;
|
7772 | return rescale();
|
7773 | };
|
7774 | }
|
7775 |
|
7776 | function continuous(transform, untransform) {
|
7777 | return transformer()(transform, untransform);
|
7778 | }
|
7779 |
|
7780 |
|
7781 |
|
7782 |
|
7783 |
|
7784 | var formatDecimal = (function(x, p) {
|
7785 | if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null;
|
7786 | var i, coefficient = x.slice(0, i);
|
7787 |
|
7788 |
|
7789 |
|
7790 | return [
|
7791 | coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
7792 | +x.slice(i + 1)
|
7793 | ];
|
7794 | });
|
7795 |
|
7796 |
|
7797 |
|
7798 |
|
7799 | var src_exponent = (function(x) {
|
7800 | return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
|
7801 | });
|
7802 |
|
7803 |
|
7804 | var formatGroup = (function(grouping, thousands) {
|
7805 | return function(value, width) {
|
7806 | var i = value.length,
|
7807 | t = [],
|
7808 | j = 0,
|
7809 | g = grouping[0],
|
7810 | length = 0;
|
7811 |
|
7812 | while (i > 0 && g > 0) {
|
7813 | if (length + g + 1 > width) g = Math.max(1, width - length);
|
7814 | t.push(value.substring(i -= g, i + g));
|
7815 | if ((length += g + 1) > width) break;
|
7816 | g = grouping[j = (j + 1) % grouping.length];
|
7817 | }
|
7818 |
|
7819 | return t.reverse().join(thousands);
|
7820 | };
|
7821 | });
|
7822 |
|
7823 |
|
7824 | var formatNumerals = (function(numerals) {
|
7825 | return function(value) {
|
7826 | return value.replace(/[0-9]/g, function(i) {
|
7827 | return numerals[+i];
|
7828 | });
|
7829 | };
|
7830 | });
|
7831 |
|
7832 |
|
7833 |
|
7834 | var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
7835 |
|
7836 | function formatSpecifier(specifier) {
|
7837 | return new FormatSpecifier(specifier);
|
7838 | }
|
7839 |
|
7840 | formatSpecifier.prototype = FormatSpecifier.prototype;
|
7841 |
|
7842 | function FormatSpecifier(specifier) {
|
7843 | if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
7844 | var match;
|
7845 | this.fill = match[1] || " ";
|
7846 | this.align = match[2] || ">";
|
7847 | this.sign = match[3] || "-";
|
7848 | this.symbol = match[4] || "";
|
7849 | this.zero = !!match[5];
|
7850 | this.width = match[6] && +match[6];
|
7851 | this.comma = !!match[7];
|
7852 | this.precision = match[8] && +match[8].slice(1);
|
7853 | this.trim = !!match[9];
|
7854 | this.type = match[10] || "";
|
7855 | }
|
7856 |
|
7857 | FormatSpecifier.prototype.toString = function() {
|
7858 | return this.fill
|
7859 | + this.align
|
7860 | + this.sign
|
7861 | + this.symbol
|
7862 | + (this.zero ? "0" : "")
|
7863 | + (this.width == null ? "" : Math.max(1, this.width | 0))
|
7864 | + (this.comma ? "," : "")
|
7865 | + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
|
7866 | + (this.trim ? "~" : "")
|
7867 | + this.type;
|
7868 | };
|
7869 |
|
7870 |
|
7871 |
|
7872 | var formatTrim = (function(s) {
|
7873 | out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
7874 | switch (s[i]) {
|
7875 | case ".": i0 = i1 = i; break;
|
7876 | case "0": if (i0 === 0) i0 = i; i1 = i; break;
|
7877 | default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break;
|
7878 | }
|
7879 | }
|
7880 | return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
7881 | });
|
7882 |
|
7883 |
|
7884 |
|
7885 |
|
7886 | var prefixExponent;
|
7887 |
|
7888 | var formatPrefixAuto = (function(x, p) {
|
7889 | var d = formatDecimal(x, p);
|
7890 | if (!d) return x + "";
|
7891 | var coefficient = d[0],
|
7892 | exponent = d[1],
|
7893 | i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
|
7894 | n = coefficient.length;
|
7895 | return i === n ? coefficient
|
7896 | : i > n ? coefficient + new Array(i - n + 1).join("0")
|
7897 | : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
|
7898 | : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0];
|
7899 | });
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 | var formatRounded = (function(x, p) {
|
7905 | var d = formatDecimal(x, p);
|
7906 | if (!d) return x + "";
|
7907 | var coefficient = d[0],
|
7908 | exponent = d[1];
|
7909 | return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
|
7910 | : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
|
7911 | : coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
7912 | });
|
7913 |
|
7914 |
|
7915 |
|
7916 |
|
7917 |
|
7918 | var formatTypes = ({
|
7919 | "%": function(x, p) { return (x * 100).toFixed(p); },
|
7920 | "b": function(x) { return Math.round(x).toString(2); },
|
7921 | "c": function(x) { return x + ""; },
|
7922 | "d": function(x) { return Math.round(x).toString(10); },
|
7923 | "e": function(x, p) { return x.toExponential(p); },
|
7924 | "f": function(x, p) { return x.toFixed(p); },
|
7925 | "g": function(x, p) { return x.toPrecision(p); },
|
7926 | "o": function(x) { return Math.round(x).toString(8); },
|
7927 | "p": function(x, p) { return formatRounded(x * 100, p); },
|
7928 | "r": formatRounded,
|
7929 | "s": formatPrefixAuto,
|
7930 | "X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
|
7931 | "x": function(x) { return Math.round(x).toString(16); }
|
7932 | });
|
7933 |
|
7934 |
|
7935 | var d3_format_src_identity = (function(x) {
|
7936 | return x;
|
7937 | });
|
7938 |
|
7939 |
|
7940 |
|
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 |
|
7948 |
|
7949 | var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
7950 |
|
7951 | var src_locale = (function(locale) {
|
7952 | var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : d3_format_src_identity,
|
7953 | currency = locale.currency,
|
7954 | decimal = locale.decimal,
|
7955 | numerals = locale.numerals ? formatNumerals(locale.numerals) : d3_format_src_identity,
|
7956 | percent = locale.percent || "%";
|
7957 |
|
7958 | function newFormat(specifier) {
|
7959 | specifier = formatSpecifier(specifier);
|
7960 |
|
7961 | var fill = specifier.fill,
|
7962 | align = specifier.align,
|
7963 | sign = specifier.sign,
|
7964 | symbol = specifier.symbol,
|
7965 | zero = specifier.zero,
|
7966 | width = specifier.width,
|
7967 | comma = specifier.comma,
|
7968 | precision = specifier.precision,
|
7969 | trim = specifier.trim,
|
7970 | type = specifier.type;
|
7971 |
|
7972 |
|
7973 | if (type === "n") comma = true, type = "g";
|
7974 |
|
7975 |
|
7976 | else if (!formatTypes[type]) precision == null && (precision = 12), trim = true, type = "g";
|
7977 |
|
7978 |
|
7979 | if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
|
7980 |
|
7981 |
|
7982 |
|
7983 | var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
|
7984 | suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? percent : "";
|
7985 |
|
7986 |
|
7987 |
|
7988 |
|
7989 | var formatType = formatTypes[type],
|
7990 | maybeSuffix = /[defgprs%]/.test(type);
|
7991 |
|
7992 |
|
7993 |
|
7994 |
|
7995 |
|
7996 | precision = precision == null ? 6
|
7997 | : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
|
7998 | : Math.max(0, Math.min(20, precision));
|
7999 |
|
8000 | function format(value) {
|
8001 | var valuePrefix = prefix,
|
8002 | valueSuffix = suffix,
|
8003 | i, n, c;
|
8004 |
|
8005 | if (type === "c") {
|
8006 | valueSuffix = formatType(value) + valueSuffix;
|
8007 | value = "";
|
8008 | } else {
|
8009 | value = +value;
|
8010 |
|
8011 |
|
8012 | var valueNegative = value < 0;
|
8013 | value = formatType(Math.abs(value), precision);
|
8014 |
|
8015 |
|
8016 | if (trim) value = formatTrim(value);
|
8017 |
|
8018 |
|
8019 | if (valueNegative && +value === 0) valueNegative = false;
|
8020 |
|
8021 |
|
8022 | valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
8023 | valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
8024 |
|
8025 |
|
8026 |
|
8027 | if (maybeSuffix) {
|
8028 | i = -1, n = value.length;
|
8029 | while (++i < n) {
|
8030 | if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
8031 | valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
8032 | value = value.slice(0, i);
|
8033 | break;
|
8034 | }
|
8035 | }
|
8036 | }
|
8037 | }
|
8038 |
|
8039 |
|
8040 | if (comma && !zero) value = group(value, Infinity);
|
8041 |
|
8042 |
|
8043 | var length = valuePrefix.length + value.length + valueSuffix.length,
|
8044 | padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
8045 |
|
8046 |
|
8047 | if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
8048 |
|
8049 |
|
8050 | switch (align) {
|
8051 | case "<": value = valuePrefix + value + valueSuffix + padding; break;
|
8052 | case "=": value = valuePrefix + padding + value + valueSuffix; break;
|
8053 | case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
|
8054 | default: value = padding + valuePrefix + value + valueSuffix; break;
|
8055 | }
|
8056 |
|
8057 | return numerals(value);
|
8058 | }
|
8059 |
|
8060 | format.toString = function() {
|
8061 | return specifier + "";
|
8062 | };
|
8063 |
|
8064 | return format;
|
8065 | }
|
8066 |
|
8067 | function formatPrefix(specifier, value) {
|
8068 | var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
|
8069 | e = Math.max(-8, Math.min(8, Math.floor(src_exponent(value) / 3))) * 3,
|
8070 | k = Math.pow(10, -e),
|
8071 | prefix = prefixes[8 + e / 3];
|
8072 | return function(value) {
|
8073 | return f(k * value) + prefix;
|
8074 | };
|
8075 | }
|
8076 |
|
8077 | return {
|
8078 | format: newFormat,
|
8079 | formatPrefix: formatPrefix
|
8080 | };
|
8081 | });
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 | var src_defaultLocale_locale;
|
8087 | var defaultLocale_format;
|
8088 | var defaultLocale_formatPrefix;
|
8089 |
|
8090 | defaultLocale_defaultLocale({
|
8091 | decimal: ".",
|
8092 | thousands: ",",
|
8093 | grouping: [3],
|
8094 | currency: ["$", ""]
|
8095 | });
|
8096 |
|
8097 | function defaultLocale_defaultLocale(definition) {
|
8098 | src_defaultLocale_locale = src_locale(definition);
|
8099 | defaultLocale_format = src_defaultLocale_locale.format;
|
8100 | defaultLocale_formatPrefix = src_defaultLocale_locale.formatPrefix;
|
8101 | return src_defaultLocale_locale;
|
8102 | }
|
8103 |
|
8104 |
|
8105 |
|
8106 |
|
8107 | var precisionFixed = (function(step) {
|
8108 | return Math.max(0, -src_exponent(Math.abs(step)));
|
8109 | });
|
8110 |
|
8111 |
|
8112 |
|
8113 |
|
8114 | var precisionPrefix = (function(step, value) {
|
8115 | return Math.max(0, Math.max(-8, Math.min(8, Math.floor(src_exponent(value) / 3))) * 3 - src_exponent(Math.abs(step)));
|
8116 | });
|
8117 |
|
8118 |
|
8119 |
|
8120 |
|
8121 | var precisionRound = (function(step, max) {
|
8122 | step = Math.abs(step), max = Math.abs(max) - step;
|
8123 | return Math.max(0, src_exponent(max) - src_exponent(step)) + 1;
|
8124 | });
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 | var src_tickFormat = (function(start, stop, count, specifier) {
|
8139 | var step = tickStep(start, stop, count),
|
8140 | precision;
|
8141 | specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
8142 | switch (specifier.type) {
|
8143 | case "s": {
|
8144 | var value = Math.max(Math.abs(start), Math.abs(stop));
|
8145 | if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
|
8146 | return defaultLocale_formatPrefix(specifier, value);
|
8147 | }
|
8148 | case "":
|
8149 | case "e":
|
8150 | case "g":
|
8151 | case "p":
|
8152 | case "r": {
|
8153 | if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
8154 | break;
|
8155 | }
|
8156 | case "f":
|
8157 | case "%": {
|
8158 | if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
8159 | break;
|
8160 | }
|
8161 | }
|
8162 | return defaultLocale_format(specifier);
|
8163 | });
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 |
|
8171 | function linearish(scale) {
|
8172 | var domain = scale.domain;
|
8173 |
|
8174 | scale.ticks = function(count) {
|
8175 | var d = domain();
|
8176 | return src_ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
8177 | };
|
8178 |
|
8179 | scale.tickFormat = function(count, specifier) {
|
8180 | var d = domain();
|
8181 | return src_tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
|
8182 | };
|
8183 |
|
8184 | scale.nice = function(count) {
|
8185 | if (count == null) count = 10;
|
8186 |
|
8187 | var d = domain(),
|
8188 | i0 = 0,
|
8189 | i1 = d.length - 1,
|
8190 | start = d[i0],
|
8191 | stop = d[i1],
|
8192 | step;
|
8193 |
|
8194 | if (stop < start) {
|
8195 | step = start, start = stop, stop = step;
|
8196 | step = i0, i0 = i1, i1 = step;
|
8197 | }
|
8198 |
|
8199 | step = tickIncrement(start, stop, count);
|
8200 |
|
8201 | if (step > 0) {
|
8202 | start = Math.floor(start / step) * step;
|
8203 | stop = Math.ceil(stop / step) * step;
|
8204 | step = tickIncrement(start, stop, count);
|
8205 | } else if (step < 0) {
|
8206 | start = Math.ceil(start * step) / step;
|
8207 | stop = Math.floor(stop * step) / step;
|
8208 | step = tickIncrement(start, stop, count);
|
8209 | }
|
8210 |
|
8211 | if (step > 0) {
|
8212 | d[i0] = Math.floor(start / step) * step;
|
8213 | d[i1] = Math.ceil(stop / step) * step;
|
8214 | domain(d);
|
8215 | } else if (step < 0) {
|
8216 | d[i0] = Math.ceil(start * step) / step;
|
8217 | d[i1] = Math.floor(stop * step) / step;
|
8218 | domain(d);
|
8219 | }
|
8220 |
|
8221 | return scale;
|
8222 | };
|
8223 |
|
8224 | return scale;
|
8225 | }
|
8226 |
|
8227 | function src_linear_linear() {
|
8228 | var scale = continuous(continuous_identity, continuous_identity);
|
8229 |
|
8230 | scale.copy = function() {
|
8231 | return copy(scale, src_linear_linear());
|
8232 | };
|
8233 |
|
8234 | initRange.apply(scale, arguments);
|
8235 |
|
8236 | return linearish(scale);
|
8237 | }
|
8238 |
|
8239 |
|
8240 |
|
8241 |
|
8242 |
|
8243 |
|
8244 | function identity_identity(domain) {
|
8245 | var unknown;
|
8246 |
|
8247 | function scale(x) {
|
8248 | return isNaN(x = +x) ? unknown : x;
|
8249 | }
|
8250 |
|
8251 | scale.invert = scale;
|
8252 |
|
8253 | scale.domain = scale.range = function(_) {
|
8254 | return arguments.length ? (domain = array_map.call(_, d3_scale_src_number), scale) : domain.slice();
|
8255 | };
|
8256 |
|
8257 | scale.unknown = function(_) {
|
8258 | return arguments.length ? (unknown = _, scale) : unknown;
|
8259 | };
|
8260 |
|
8261 | scale.copy = function() {
|
8262 | return identity_identity(domain).unknown(unknown);
|
8263 | };
|
8264 |
|
8265 | domain = arguments.length ? array_map.call(domain, d3_scale_src_number) : [0, 1];
|
8266 |
|
8267 | return linearish(scale);
|
8268 | }
|
8269 |
|
8270 |
|
8271 | var nice = (function(domain, interval) {
|
8272 | domain = domain.slice();
|
8273 |
|
8274 | var i0 = 0,
|
8275 | i1 = domain.length - 1,
|
8276 | x0 = domain[i0],
|
8277 | x1 = domain[i1],
|
8278 | t;
|
8279 |
|
8280 | if (x1 < x0) {
|
8281 | t = i0, i0 = i1, i1 = t;
|
8282 | t = x0, x0 = x1, x1 = t;
|
8283 | }
|
8284 |
|
8285 | domain[i0] = interval.floor(x0);
|
8286 | domain[i1] = interval.ceil(x1);
|
8287 | return domain;
|
8288 | });
|
8289 |
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 |
|
8295 |
|
8296 |
|
8297 | function transformLog(x) {
|
8298 | return Math.log(x);
|
8299 | }
|
8300 |
|
8301 | function transformExp(x) {
|
8302 | return Math.exp(x);
|
8303 | }
|
8304 |
|
8305 | function transformLogn(x) {
|
8306 | return -Math.log(-x);
|
8307 | }
|
8308 |
|
8309 | function transformExpn(x) {
|
8310 | return -Math.exp(-x);
|
8311 | }
|
8312 |
|
8313 | function pow10(x) {
|
8314 | return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
|
8315 | }
|
8316 |
|
8317 | function powp(base) {
|
8318 | return base === 10 ? pow10
|
8319 | : base === Math.E ? Math.exp
|
8320 | : function(x) { return Math.pow(base, x); };
|
8321 | }
|
8322 |
|
8323 | function logp(base) {
|
8324 | return base === Math.E ? Math.log
|
8325 | : base === 10 && Math.log10
|
8326 | || base === 2 && Math.log2
|
8327 | || (base = Math.log(base), function(x) { return Math.log(x) / base; });
|
8328 | }
|
8329 |
|
8330 | function reflect(f) {
|
8331 | return function(x) {
|
8332 | return -f(-x);
|
8333 | };
|
8334 | }
|
8335 |
|
8336 | function loggish(transform) {
|
8337 | var scale = transform(transformLog, transformExp),
|
8338 | domain = scale.domain,
|
8339 | base = 10,
|
8340 | logs,
|
8341 | pows;
|
8342 |
|
8343 | function rescale() {
|
8344 | logs = logp(base), pows = powp(base);
|
8345 | if (domain()[0] < 0) {
|
8346 | logs = reflect(logs), pows = reflect(pows);
|
8347 | transform(transformLogn, transformExpn);
|
8348 | } else {
|
8349 | transform(transformLog, transformExp);
|
8350 | }
|
8351 | return scale;
|
8352 | }
|
8353 |
|
8354 | scale.base = function(_) {
|
8355 | return arguments.length ? (base = +_, rescale()) : base;
|
8356 | };
|
8357 |
|
8358 | scale.domain = function(_) {
|
8359 | return arguments.length ? (domain(_), rescale()) : domain();
|
8360 | };
|
8361 |
|
8362 | scale.ticks = function(count) {
|
8363 | var d = domain(),
|
8364 | u = d[0],
|
8365 | v = d[d.length - 1],
|
8366 | r;
|
8367 |
|
8368 | if (r = v < u) i = u, u = v, v = i;
|
8369 |
|
8370 | var i = logs(u),
|
8371 | j = logs(v),
|
8372 | p,
|
8373 | k,
|
8374 | t,
|
8375 | n = count == null ? 10 : +count,
|
8376 | z = [];
|
8377 |
|
8378 | if (!(base % 1) && j - i < n) {
|
8379 | i = Math.round(i) - 1, j = Math.round(j) + 1;
|
8380 | if (u > 0) for (; i < j; ++i) {
|
8381 | for (k = 1, p = pows(i); k < base; ++k) {
|
8382 | t = p * k;
|
8383 | if (t < u) continue;
|
8384 | if (t > v) break;
|
8385 | z.push(t);
|
8386 | }
|
8387 | } else for (; i < j; ++i) {
|
8388 | for (k = base - 1, p = pows(i); k >= 1; --k) {
|
8389 | t = p * k;
|
8390 | if (t < u) continue;
|
8391 | if (t > v) break;
|
8392 | z.push(t);
|
8393 | }
|
8394 | }
|
8395 | } else {
|
8396 | z = src_ticks(i, j, Math.min(j - i, n)).map(pows);
|
8397 | }
|
8398 |
|
8399 | return r ? z.reverse() : z;
|
8400 | };
|
8401 |
|
8402 | scale.tickFormat = function(count, specifier) {
|
8403 | if (specifier == null) specifier = base === 10 ? ".0e" : ",";
|
8404 | if (typeof specifier !== "function") specifier = defaultLocale_format(specifier);
|
8405 | if (count === Infinity) return specifier;
|
8406 | if (count == null) count = 10;
|
8407 | var k = Math.max(1, base * count / scale.ticks().length);
|
8408 | return function(d) {
|
8409 | var i = d / pows(Math.round(logs(d)));
|
8410 | if (i * base < base - 0.5) i *= base;
|
8411 | return i <= k ? specifier(d) : "";
|
8412 | };
|
8413 | };
|
8414 |
|
8415 | scale.nice = function() {
|
8416 | return domain(nice(domain(), {
|
8417 | floor: function(x) { return pows(Math.floor(logs(x))); },
|
8418 | ceil: function(x) { return pows(Math.ceil(logs(x))); }
|
8419 | }));
|
8420 | };
|
8421 |
|
8422 | return scale;
|
8423 | }
|
8424 |
|
8425 | function log() {
|
8426 | var scale = loggish(transformer()).domain([1, 10]);
|
8427 |
|
8428 | scale.copy = function() {
|
8429 | return copy(scale, log()).base(scale.base());
|
8430 | };
|
8431 |
|
8432 | initRange.apply(scale, arguments);
|
8433 |
|
8434 | return scale;
|
8435 | }
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 | function transformSymlog(c) {
|
8443 | return function(x) {
|
8444 | return Math.sign(x) * Math.log1p(Math.abs(x / c));
|
8445 | };
|
8446 | }
|
8447 |
|
8448 | function transformSymexp(c) {
|
8449 | return function(x) {
|
8450 | return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
|
8451 | };
|
8452 | }
|
8453 |
|
8454 | function symlogish(transform) {
|
8455 | var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));
|
8456 |
|
8457 | scale.constant = function(_) {
|
8458 | return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
|
8459 | };
|
8460 |
|
8461 | return linearish(scale);
|
8462 | }
|
8463 |
|
8464 | function symlog() {
|
8465 | var scale = symlogish(transformer());
|
8466 |
|
8467 | scale.copy = function() {
|
8468 | return copy(scale, symlog()).constant(scale.constant());
|
8469 | };
|
8470 |
|
8471 | return initRange.apply(scale, arguments);
|
8472 | }
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 | function transformPow(exponent) {
|
8480 | return function(x) {
|
8481 | return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
|
8482 | };
|
8483 | }
|
8484 |
|
8485 | function transformSqrt(x) {
|
8486 | return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
|
8487 | }
|
8488 |
|
8489 | function transformSquare(x) {
|
8490 | return x < 0 ? -x * x : x * x;
|
8491 | }
|
8492 |
|
8493 | function powish(transform) {
|
8494 | var scale = transform(continuous_identity, continuous_identity),
|
8495 | exponent = 1;
|
8496 |
|
8497 | function rescale() {
|
8498 | return exponent === 1 ? transform(continuous_identity, continuous_identity)
|
8499 | : exponent === 0.5 ? transform(transformSqrt, transformSquare)
|
8500 | : transform(transformPow(exponent), transformPow(1 / exponent));
|
8501 | }
|
8502 |
|
8503 | scale.exponent = function(_) {
|
8504 | return arguments.length ? (exponent = +_, rescale()) : exponent;
|
8505 | };
|
8506 |
|
8507 | return linearish(scale);
|
8508 | }
|
8509 |
|
8510 | function pow() {
|
8511 | var scale = powish(transformer());
|
8512 |
|
8513 | scale.copy = function() {
|
8514 | return copy(scale, pow()).exponent(scale.exponent());
|
8515 | };
|
8516 |
|
8517 | initRange.apply(scale, arguments);
|
8518 |
|
8519 | return scale;
|
8520 | }
|
8521 |
|
8522 | function sqrt() {
|
8523 | return pow.apply(null, arguments).exponent(0.5);
|
8524 | }
|
8525 |
|
8526 |
|
8527 |
|
8528 |
|
8529 |
|
8530 |
|
8531 | function quantile_quantile() {
|
8532 | var domain = [],
|
8533 | range = [],
|
8534 | thresholds = [],
|
8535 | unknown;
|
8536 |
|
8537 | function rescale() {
|
8538 | var i = 0, n = Math.max(1, range.length);
|
8539 | thresholds = new Array(n - 1);
|
8540 | while (++i < n) thresholds[i - 1] = quantile(domain, i / n);
|
8541 | return scale;
|
8542 | }
|
8543 |
|
8544 | function scale(x) {
|
8545 | return isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];
|
8546 | }
|
8547 |
|
8548 | scale.invertExtent = function(y) {
|
8549 | var i = range.indexOf(y);
|
8550 | return i < 0 ? [NaN, NaN] : [
|
8551 | i > 0 ? thresholds[i - 1] : domain[0],
|
8552 | i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
|
8553 | ];
|
8554 | };
|
8555 |
|
8556 | scale.domain = function(_) {
|
8557 | if (!arguments.length) return domain.slice();
|
8558 | domain = [];
|
8559 | for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
|
8560 | domain.sort(src_ascending);
|
8561 | return rescale();
|
8562 | };
|
8563 |
|
8564 | scale.range = function(_) {
|
8565 | return arguments.length ? (range = src_array_slice.call(_), rescale()) : range.slice();
|
8566 | };
|
8567 |
|
8568 | scale.unknown = function(_) {
|
8569 | return arguments.length ? (unknown = _, scale) : unknown;
|
8570 | };
|
8571 |
|
8572 | scale.quantiles = function() {
|
8573 | return thresholds.slice();
|
8574 | };
|
8575 |
|
8576 | scale.copy = function() {
|
8577 | return quantile_quantile()
|
8578 | .domain(domain)
|
8579 | .range(range)
|
8580 | .unknown(unknown);
|
8581 | };
|
8582 |
|
8583 | return initRange.apply(scale, arguments);
|
8584 | }
|
8585 |
|
8586 |
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 | function quantize_quantize() {
|
8593 | var x0 = 0,
|
8594 | x1 = 1,
|
8595 | n = 1,
|
8596 | domain = [0.5],
|
8597 | range = [0, 1],
|
8598 | unknown;
|
8599 |
|
8600 | function scale(x) {
|
8601 | return x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
8602 | }
|
8603 |
|
8604 | function rescale() {
|
8605 | var i = -1;
|
8606 | domain = new Array(n);
|
8607 | while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
8608 | return scale;
|
8609 | }
|
8610 |
|
8611 | scale.domain = function(_) {
|
8612 | return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
|
8613 | };
|
8614 |
|
8615 | scale.range = function(_) {
|
8616 | return arguments.length ? (n = (range = src_array_slice.call(_)).length - 1, rescale()) : range.slice();
|
8617 | };
|
8618 |
|
8619 | scale.invertExtent = function(y) {
|
8620 | var i = range.indexOf(y);
|
8621 | return i < 0 ? [NaN, NaN]
|
8622 | : i < 1 ? [x0, domain[0]]
|
8623 | : i >= n ? [domain[n - 1], x1]
|
8624 | : [domain[i - 1], domain[i]];
|
8625 | };
|
8626 |
|
8627 | scale.unknown = function(_) {
|
8628 | return arguments.length ? (unknown = _, scale) : scale;
|
8629 | };
|
8630 |
|
8631 | scale.thresholds = function() {
|
8632 | return domain.slice();
|
8633 | };
|
8634 |
|
8635 | scale.copy = function() {
|
8636 | return quantize_quantize()
|
8637 | .domain([x0, x1])
|
8638 | .range(range)
|
8639 | .unknown(unknown);
|
8640 | };
|
8641 |
|
8642 | return initRange.apply(linearish(scale), arguments);
|
8643 | }
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 | function threshold_threshold() {
|
8651 | var domain = [0.5],
|
8652 | range = [0, 1],
|
8653 | unknown,
|
8654 | n = 1;
|
8655 |
|
8656 | function scale(x) {
|
8657 | return x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
8658 | }
|
8659 |
|
8660 | scale.domain = function(_) {
|
8661 | return arguments.length ? (domain = src_array_slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
|
8662 | };
|
8663 |
|
8664 | scale.range = function(_) {
|
8665 | return arguments.length ? (range = src_array_slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
|
8666 | };
|
8667 |
|
8668 | scale.invertExtent = function(y) {
|
8669 | var i = range.indexOf(y);
|
8670 | return [domain[i - 1], domain[i]];
|
8671 | };
|
8672 |
|
8673 | scale.unknown = function(_) {
|
8674 | return arguments.length ? (unknown = _, scale) : unknown;
|
8675 | };
|
8676 |
|
8677 | scale.copy = function() {
|
8678 | return threshold_threshold()
|
8679 | .domain(domain)
|
8680 | .range(range)
|
8681 | .unknown(unknown);
|
8682 | };
|
8683 |
|
8684 | return initRange.apply(scale, arguments);
|
8685 | }
|
8686 |
|
8687 |
|
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 |
|
8694 |
|
8695 |
|
8696 | var time_durationSecond = 1000,
|
8697 | time_durationMinute = time_durationSecond * 60,
|
8698 | time_durationHour = time_durationMinute * 60,
|
8699 | time_durationDay = time_durationHour * 24,
|
8700 | time_durationWeek = time_durationDay * 7,
|
8701 | durationMonth = time_durationDay * 30,
|
8702 | durationYear = time_durationDay * 365;
|
8703 |
|
8704 | function time_date(t) {
|
8705 | return new Date(t);
|
8706 | }
|
8707 |
|
8708 | function time_number(t) {
|
8709 | return t instanceof Date ? +t : +new Date(+t);
|
8710 | }
|
8711 |
|
8712 | function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
|
8713 | var scale = continuous(continuous_identity, continuous_identity),
|
8714 | invert = scale.invert,
|
8715 | domain = scale.domain;
|
8716 |
|
8717 | var formatMillisecond = format(".%L"),
|
8718 | formatSecond = format(":%S"),
|
8719 | formatMinute = format("%I:%M"),
|
8720 | formatHour = format("%I %p"),
|
8721 | formatDay = format("%a %d"),
|
8722 | formatWeek = format("%b %d"),
|
8723 | formatMonth = format("%B"),
|
8724 | formatYear = format("%Y");
|
8725 |
|
8726 | var tickIntervals = [
|
8727 | [second, 1, time_durationSecond],
|
8728 | [second, 5, 5 * time_durationSecond],
|
8729 | [second, 15, 15 * time_durationSecond],
|
8730 | [second, 30, 30 * time_durationSecond],
|
8731 | [minute, 1, time_durationMinute],
|
8732 | [minute, 5, 5 * time_durationMinute],
|
8733 | [minute, 15, 15 * time_durationMinute],
|
8734 | [minute, 30, 30 * time_durationMinute],
|
8735 | [ hour, 1, time_durationHour ],
|
8736 | [ hour, 3, 3 * time_durationHour ],
|
8737 | [ hour, 6, 6 * time_durationHour ],
|
8738 | [ hour, 12, 12 * time_durationHour ],
|
8739 | [ day, 1, time_durationDay ],
|
8740 | [ day, 2, 2 * time_durationDay ],
|
8741 | [ week, 1, time_durationWeek ],
|
8742 | [ month, 1, durationMonth ],
|
8743 | [ month, 3, 3 * durationMonth ],
|
8744 | [ year, 1, durationYear ]
|
8745 | ];
|
8746 |
|
8747 | function tickFormat(date) {
|
8748 | return (second(date) < date ? formatMillisecond
|
8749 | : minute(date) < date ? formatSecond
|
8750 | : hour(date) < date ? formatMinute
|
8751 | : day(date) < date ? formatHour
|
8752 | : month(date) < date ? (week(date) < date ? formatDay : formatWeek)
|
8753 | : year(date) < date ? formatMonth
|
8754 | : formatYear)(date);
|
8755 | }
|
8756 |
|
8757 | function tickInterval(interval, start, stop, step) {
|
8758 | if (interval == null) interval = 10;
|
8759 |
|
8760 |
|
8761 |
|
8762 |
|
8763 | if (typeof interval === "number") {
|
8764 | var target = Math.abs(stop - start) / interval,
|
8765 | i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);
|
8766 | if (i === tickIntervals.length) {
|
8767 | step = tickStep(start / durationYear, stop / durationYear, interval);
|
8768 | interval = year;
|
8769 | } else if (i) {
|
8770 | i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
|
8771 | step = i[1];
|
8772 | interval = i[0];
|
8773 | } else {
|
8774 | step = Math.max(tickStep(start, stop, interval), 1);
|
8775 | interval = millisecond;
|
8776 | }
|
8777 | }
|
8778 |
|
8779 | return step == null ? interval : interval.every(step);
|
8780 | }
|
8781 |
|
8782 | scale.invert = function(y) {
|
8783 | return new Date(invert(y));
|
8784 | };
|
8785 |
|
8786 | scale.domain = function(_) {
|
8787 | return arguments.length ? domain(array_map.call(_, time_number)) : domain().map(time_date);
|
8788 | };
|
8789 |
|
8790 | scale.ticks = function(interval, step) {
|
8791 | var d = domain(),
|
8792 | t0 = d[0],
|
8793 | t1 = d[d.length - 1],
|
8794 | r = t1 < t0,
|
8795 | t;
|
8796 | if (r) t = t0, t0 = t1, t1 = t;
|
8797 | t = tickInterval(interval, t0, t1, step);
|
8798 | t = t ? t.range(t0, t1 + 1) : [];
|
8799 | return r ? t.reverse() : t;
|
8800 | };
|
8801 |
|
8802 | scale.tickFormat = function(count, specifier) {
|
8803 | return specifier == null ? tickFormat : format(specifier);
|
8804 | };
|
8805 |
|
8806 | scale.nice = function(interval, step) {
|
8807 | var d = domain();
|
8808 | return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
|
8809 | ? domain(nice(d, interval))
|
8810 | : scale;
|
8811 | };
|
8812 |
|
8813 | scale.copy = function() {
|
8814 | return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
|
8815 | };
|
8816 |
|
8817 | return scale;
|
8818 | }
|
8819 |
|
8820 | var src_time = (function() {
|
8821 | return initRange.apply(calendar(src_year, src_month, sunday, src_day, src_hour, src_minute, src_second, src_millisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
|
8822 | });
|
8823 |
|
8824 |
|
8825 |
|
8826 |
|
8827 |
|
8828 |
|
8829 |
|
8830 | var utcTime = (function() {
|
8831 | return initRange.apply(calendar(src_utcYear, src_utcMonth, utcSunday, src_utcDay, src_utcHour, src_utcMinute, src_second, src_millisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
|
8832 | });
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 | function sequential_transformer() {
|
8843 | var x0 = 0,
|
8844 | x1 = 1,
|
8845 | t0,
|
8846 | t1,
|
8847 | k10,
|
8848 | transform,
|
8849 | interpolator = continuous_identity,
|
8850 | clamp = false,
|
8851 | unknown;
|
8852 |
|
8853 | function scale(x) {
|
8854 | return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
|
8855 | }
|
8856 |
|
8857 | scale.domain = function(_) {
|
8858 | return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
|
8859 | };
|
8860 |
|
8861 | scale.clamp = function(_) {
|
8862 | return arguments.length ? (clamp = !!_, scale) : clamp;
|
8863 | };
|
8864 |
|
8865 | scale.interpolator = function(_) {
|
8866 | return arguments.length ? (interpolator = _, scale) : interpolator;
|
8867 | };
|
8868 |
|
8869 | scale.unknown = function(_) {
|
8870 | return arguments.length ? (unknown = _, scale) : unknown;
|
8871 | };
|
8872 |
|
8873 | return function(t) {
|
8874 | transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
|
8875 | return scale;
|
8876 | };
|
8877 | }
|
8878 |
|
8879 | function sequential_copy(source, target) {
|
8880 | return target
|
8881 | .domain(source.domain())
|
8882 | .interpolator(source.interpolator())
|
8883 | .clamp(source.clamp())
|
8884 | .unknown(source.unknown());
|
8885 | }
|
8886 |
|
8887 | function sequential() {
|
8888 | var scale = linearish(sequential_transformer()(continuous_identity));
|
8889 |
|
8890 | scale.copy = function() {
|
8891 | return sequential_copy(scale, sequential());
|
8892 | };
|
8893 |
|
8894 | return initInterpolator.apply(scale, arguments);
|
8895 | }
|
8896 |
|
8897 | function sequentialLog() {
|
8898 | var scale = loggish(sequential_transformer()).domain([1, 10]);
|
8899 |
|
8900 | scale.copy = function() {
|
8901 | return sequential_copy(scale, sequentialLog()).base(scale.base());
|
8902 | };
|
8903 |
|
8904 | return initInterpolator.apply(scale, arguments);
|
8905 | }
|
8906 |
|
8907 | function sequentialSymlog() {
|
8908 | var scale = symlogish(sequential_transformer());
|
8909 |
|
8910 | scale.copy = function() {
|
8911 | return sequential_copy(scale, sequentialSymlog()).constant(scale.constant());
|
8912 | };
|
8913 |
|
8914 | return initInterpolator.apply(scale, arguments);
|
8915 | }
|
8916 |
|
8917 | function sequentialPow() {
|
8918 | var scale = powish(sequential_transformer());
|
8919 |
|
8920 | scale.copy = function() {
|
8921 | return sequential_copy(scale, sequentialPow()).exponent(scale.exponent());
|
8922 | };
|
8923 |
|
8924 | return initInterpolator.apply(scale, arguments);
|
8925 | }
|
8926 |
|
8927 | function sequentialSqrt() {
|
8928 | return sequentialPow.apply(null, arguments).exponent(0.5);
|
8929 | }
|
8930 |
|
8931 |
|
8932 |
|
8933 |
|
8934 |
|
8935 |
|
8936 | function sequentialQuantile() {
|
8937 | var domain = [],
|
8938 | interpolator = continuous_identity;
|
8939 |
|
8940 | function scale(x) {
|
8941 | if (!isNaN(x = +x)) return interpolator((bisect(domain, x) - 1) / (domain.length - 1));
|
8942 | }
|
8943 |
|
8944 | scale.domain = function(_) {
|
8945 | if (!arguments.length) return domain.slice();
|
8946 | domain = [];
|
8947 | for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
|
8948 | domain.sort(src_ascending);
|
8949 | return scale;
|
8950 | };
|
8951 |
|
8952 | scale.interpolator = function(_) {
|
8953 | return arguments.length ? (interpolator = _, scale) : interpolator;
|
8954 | };
|
8955 |
|
8956 | scale.copy = function() {
|
8957 | return sequentialQuantile(interpolator).domain(domain);
|
8958 | };
|
8959 |
|
8960 | return initInterpolator.apply(scale, arguments);
|
8961 | }
|
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 | function diverging_transformer() {
|
8973 | var x0 = 0,
|
8974 | x1 = 0.5,
|
8975 | x2 = 1,
|
8976 | t0,
|
8977 | t1,
|
8978 | t2,
|
8979 | k10,
|
8980 | k21,
|
8981 | interpolator = continuous_identity,
|
8982 | transform,
|
8983 | clamp = false,
|
8984 | unknown;
|
8985 |
|
8986 | function scale(x) {
|
8987 | return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (x < t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));
|
8988 | }
|
8989 |
|
8990 | scale.domain = function(_) {
|
8991 | return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), t2 = transform(x2 = +_[2]), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), scale) : [x0, x1, x2];
|
8992 | };
|
8993 |
|
8994 | scale.clamp = function(_) {
|
8995 | return arguments.length ? (clamp = !!_, scale) : clamp;
|
8996 | };
|
8997 |
|
8998 | scale.interpolator = function(_) {
|
8999 | return arguments.length ? (interpolator = _, scale) : interpolator;
|
9000 | };
|
9001 |
|
9002 | scale.unknown = function(_) {
|
9003 | return arguments.length ? (unknown = _, scale) : unknown;
|
9004 | };
|
9005 |
|
9006 | return function(t) {
|
9007 | transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1);
|
9008 | return scale;
|
9009 | };
|
9010 | }
|
9011 |
|
9012 | function diverging() {
|
9013 | var scale = linearish(diverging_transformer()(continuous_identity));
|
9014 |
|
9015 | scale.copy = function() {
|
9016 | return sequential_copy(scale, diverging());
|
9017 | };
|
9018 |
|
9019 | return initInterpolator.apply(scale, arguments);
|
9020 | }
|
9021 |
|
9022 | function divergingLog() {
|
9023 | var scale = loggish(diverging_transformer()).domain([0.1, 1, 10]);
|
9024 |
|
9025 | scale.copy = function() {
|
9026 | return sequential_copy(scale, divergingLog()).base(scale.base());
|
9027 | };
|
9028 |
|
9029 | return initInterpolator.apply(scale, arguments);
|
9030 | }
|
9031 |
|
9032 | function divergingSymlog() {
|
9033 | var scale = symlogish(diverging_transformer());
|
9034 |
|
9035 | scale.copy = function() {
|
9036 | return sequential_copy(scale, divergingSymlog()).constant(scale.constant());
|
9037 | };
|
9038 |
|
9039 | return initInterpolator.apply(scale, arguments);
|
9040 | }
|
9041 |
|
9042 | function divergingPow() {
|
9043 | var scale = powish(diverging_transformer());
|
9044 |
|
9045 | scale.copy = function() {
|
9046 | return sequential_copy(scale, divergingPow()).exponent(scale.exponent());
|
9047 | };
|
9048 |
|
9049 | return initInterpolator.apply(scale, arguments);
|
9050 | }
|
9051 |
|
9052 | function divergingSqrt() {
|
9053 | return divergingPow.apply(null, arguments).exponent(0.5);
|
9054 | }
|
9055 |
|
9056 |
|
9057 |
|
9058 |
|
9059 |
|
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 |
|
9065 |
|
9066 |
|
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 |
|
9081 |
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 |
|
9087 |
|
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 |
|
9093 |
|
9094 |
|
9095 |
|
9096 |
|
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 | var AxisRendererHelper_AxisRendererHelper =
|
9103 |
|
9104 | function () {
|
9105 | function AxisRendererHelper(config, params) {
|
9106 | classCallCheck_default()(this, AxisRendererHelper);
|
9107 |
|
9108 | var scale = src_linear_linear();
|
9109 | this.config = config, this.scale = scale, (config.noTransition || !params.config.transition_duration) && (config.withoutTransition = !0), config.range = scale.rangeExtent ? scale.rangeExtent() : this.scaleExtent((params.orgXScale || scale).range());
|
9110 | }
|
9111 | |
9112 |
|
9113 |
|
9114 |
|
9115 |
|
9116 |
|
9117 |
|
9118 |
|
9119 | return createClass_default()(AxisRendererHelper, [{
|
9120 | key: "axisX",
|
9121 | value: function axisX(selection, x) {
|
9122 | var _this = this;
|
9123 |
|
9124 | selection.attr("transform", function (d) {
|
9125 | return "translate(".concat(Math.ceil(x(d) + _this.config.tickOffset), ",0)");
|
9126 | });
|
9127 | }
|
9128 | }, {
|
9129 | key: "axisY",
|
9130 | value: function axisY(selection, y) {
|
9131 | selection.attr("transform", function (d) {
|
9132 | return "translate(0,".concat(Math.ceil(y(d)), ")");
|
9133 | });
|
9134 | }
|
9135 | }, {
|
9136 | key: "scaleExtent",
|
9137 | value: function scaleExtent(domain) {
|
9138 | var start = domain[0],
|
9139 | stop = domain[domain.length - 1];
|
9140 | return start < stop ? [start, stop] : [stop, start];
|
9141 | }
|
9142 | }, {
|
9143 | key: "generateTicks",
|
9144 | value: function generateTicks(scale) {
|
9145 | var ticks = [];
|
9146 | if (scale.ticks) return scale.ticks.apply(scale, toConsumableArray_default()(this.config.tickArguments || [])).map(function (v) {
|
9147 | return (
|
9148 | isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v
|
9149 | );
|
9150 | });
|
9151 |
|
9152 | for (var domain = scale.domain(), i = Math.ceil(domain[0]); i < domain[1]; i++) ticks.push(i);
|
9153 |
|
9154 | return ticks.length > 0 && ticks[0] > 0 && ticks.unshift(ticks[0] - (ticks[1] - ticks[0])), ticks;
|
9155 | }
|
9156 | }, {
|
9157 | key: "copyScale",
|
9158 | value: function copyScale() {
|
9159 | var newScale = this.scale.copy();
|
9160 | return newScale.domain().length || newScale.domain(this.scale.domain()), newScale;
|
9161 | }
|
9162 | }, {
|
9163 | key: "textFormatted",
|
9164 | value: function textFormatted(v) {
|
9165 | var tickFormat = this.config.tickFormat,
|
9166 | value = /\d+\.\d+0{5,}\d$/.test(v) ? +(v + "").replace(/0+\d$/, "") : v,
|
9167 | formatted = tickFormat ? tickFormat(value) : value;
|
9168 |
|
9169 |
|
9170 |
|
9171 | return isDefined(formatted) ? formatted : "";
|
9172 | }
|
9173 | }, {
|
9174 | key: "transitionise",
|
9175 | value: function transitionise(selection) {
|
9176 | var config = this.config;
|
9177 | return config.withoutTransition ? selection.interrupt() : selection.transition(config.transition);
|
9178 | }
|
9179 | }], [{
|
9180 | key: "getSizeFor1Char",
|
9181 | value: function getSizeFor1Char(node) {
|
9182 |
|
9183 | var size = {
|
9184 | w: 5.5,
|
9185 | h: 11.5
|
9186 | };
|
9187 | return node.empty() || node.select("text").text("0").call(function (el) {
|
9188 | try {
|
9189 | var _el$node$getBBox = el.node().getBBox(),
|
9190 | width = _el$node$getBBox.width,
|
9191 | height = _el$node$getBBox.height;
|
9192 |
|
9193 | width && height && (size.w = width, size.h = height), el.text("");
|
9194 | } catch (e) {}
|
9195 | }), this.getSizeFor1Char = function () {
|
9196 | return size;
|
9197 | }, size;
|
9198 | }
|
9199 | }]), AxisRendererHelper;
|
9200 | }();
|
9201 |
|
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 |
|
9208 |
|
9209 |
|
9210 |
|
9211 |
|
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 | var AxisRenderer_AxisRenderer =
|
9217 |
|
9218 | function () {
|
9219 | function AxisRenderer() {
|
9220 | var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
9221 |
|
9222 | classCallCheck_default()(this, AxisRenderer);
|
9223 |
|
9224 | var config = {
|
9225 | innerTickSize: 6,
|
9226 | outerTickSize: params.outerTick ? 6 : 0,
|
9227 | orient: "bottom",
|
9228 | range: [],
|
9229 | tickArguments: null,
|
9230 | tickCentered: null,
|
9231 | tickCulling: !0,
|
9232 | tickFormat: null,
|
9233 | tickLength: 9,
|
9234 | tickOffset: 0,
|
9235 | tickPadding: 3,
|
9236 | tickValues: null,
|
9237 | transition: null,
|
9238 | noTransition: params.noTransition
|
9239 | };
|
9240 | config.tickLength = Math.max(config.innerTickSize, 0) + config.tickPadding, this.helper = new AxisRendererHelper_AxisRendererHelper(config, params), this.config = config, this.params = params;
|
9241 | }
|
9242 | |
9243 |
|
9244 |
|
9245 |
|
9246 |
|
9247 |
|
9248 |
|
9249 | return createClass_default()(AxisRenderer, [{
|
9250 | key: "create",
|
9251 | value: function create(g) {
|
9252 | var ctx = this,
|
9253 | config = this.config,
|
9254 | params = this.params,
|
9255 | helperInst = this.helper,
|
9256 | scale = helperInst.scale,
|
9257 | orient = config.orient,
|
9258 | splitTickText = this.splitTickText.bind(this),
|
9259 | isLeftRight = /^(left|right)$/.test(orient),
|
9260 | isTopBottom = /^(top|bottom)$/.test(orient),
|
9261 | tickTransform = helperInst[isTopBottom ? "axisX" : "axisY"],
|
9262 | axisPx = tickTransform === helperInst.axisX ? "y" : "x",
|
9263 | sign = /^(top|left)$/.test(orient) ? -1 : 1,
|
9264 | rotate = params.tickTextRotate;
|
9265 | this.config.range = scale.rangeExtent ? scale.rangeExtent() : helperInst.scaleExtent((params.orgXScale || scale).range());
|
9266 | var _config = config,
|
9267 | innerTickSize = _config.innerTickSize,
|
9268 | tickLength = _config.tickLength,
|
9269 | range = _config.range,
|
9270 | name = params.name,
|
9271 | tickTextPos = name && /^(x|y|y2)$/.test(name) ? params.config["axis_".concat(name, "_tick_text_position")] : {
|
9272 | x: 0,
|
9273 | y: 0
|
9274 | },
|
9275 | prefix = name === "subX" ? "subchart_axis_x" : "axis_".concat(name),
|
9276 | axisShow = params.config["".concat(prefix, "_show")],
|
9277 | tickShow = {
|
9278 | tick: !!axisShow && params.config["".concat(prefix, "_tick_show")],
|
9279 | text: !!axisShow && params.config["".concat(prefix, "_tick_text_show")]
|
9280 | },
|
9281 | $g = null;
|
9282 |
|
9283 | g.each(function () {
|
9284 | var g = src_select(this),
|
9285 | scale0 = this.__chart__ || scale,
|
9286 | scale1 = helperInst.copyScale();
|
9287 | $g = g, this.__chart__ = scale1, config.tickOffset = params.isCategory ? Math.ceil((scale1(1) - scale1(0)) / 2) : 0;
|
9288 |
|
9289 | var path = g.selectAll(".domain").data([0]);
|
9290 |
|
9291 | if (path.enter().append("path").attr("class", "domain").merge(helperInst.transitionise(path)).attr("d", function () {
|
9292 | var outerTickSized = config.outerTickSize * sign;
|
9293 | return isTopBottom ? "M".concat(range[0], ",").concat(outerTickSized, "V0H").concat(range[1], "V").concat(outerTickSized) : "M".concat(outerTickSized, ",").concat(range[0], "H0V").concat(range[1], "H").concat(outerTickSized);
|
9294 | }), tickShow.tick || tickShow.text) {
|
9295 |
|
9296 | var ticks = config.tickValues || helperInst.generateTicks(scale1),
|
9297 | tick = g.selectAll(".tick").data(ticks, scale1),
|
9298 | tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", "1"),
|
9299 | tickExit = tick.exit().remove();
|
9300 |
|
9301 | tick = tickEnter.merge(tick), tickShow.tick && tickEnter.append("line"), tickShow.text && tickEnter.append("text");
|
9302 | var sizeFor1Char = AxisRendererHelper_AxisRendererHelper.getSizeFor1Char(tick),
|
9303 | counts = [],
|
9304 | tspan = tick.select("text").selectAll("tspan").data(function (d, index) {
|
9305 | var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helperInst.textFormatted(d)) ? helperInst.textFormatted(d).concat() : [helperInst.textFormatted(d)];
|
9306 | return counts[index] = split.length, split.map(function (splitted) {
|
9307 | return {
|
9308 | index: index,
|
9309 | splitted: splitted
|
9310 | };
|
9311 | });
|
9312 | });
|
9313 | tspan.exit().remove(), tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) {
|
9314 | return d.splitted;
|
9315 | }), tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", function () {
|
9316 | var dx = 0;
|
9317 | return orient === "bottom" && rotate && (dx = 8 * Math.sin(Math.PI * (rotate / 180))), dx + (tickTextPos.x || 0);
|
9318 | }()).attr("dy", function (d, i) {
|
9319 | var dy = 0;
|
9320 | return orient !== "top" && (dy = sizeFor1Char.h, i === 0 && (dy = isLeftRight ? -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) : tickTextPos.y === 0 ? ".71em" : 0)), isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || ".71em";
|
9321 | });
|
9322 | var lineUpdate = tick.select("line"),
|
9323 | textUpdate = tick.select("text");
|
9324 |
|
9325 | if (tickEnter.select("line").attr("".concat(axisPx, "2"), innerTickSize * sign), tickEnter.select("text").attr("".concat(axisPx), tickLength * sign), ctx.setTickLineTextPosition(lineUpdate, textUpdate), params.tickTitle && textUpdate.append && textUpdate.append("title").each(function (index) {
|
9326 | src_select(this).text(params.tickTitle[index]);
|
9327 | }), scale1.bandwidth) {
|
9328 | var x = scale1,
|
9329 | dx = x.bandwidth() / 2;
|
9330 | scale0 = function (d) {
|
9331 | return x(d) + dx;
|
9332 | }, scale1 = scale0;
|
9333 | } else scale0.bandwidth ? scale0 = scale1 : tickTransform.call(helperInst, tickExit, scale1);
|
9334 |
|
9335 | tickTransform.call(helperInst, tickEnter, scale0), tickTransform.call(helperInst, helperInst.transitionise(tick).style("opacity", "1"), scale1);
|
9336 | }
|
9337 | }), this.g = $g;
|
9338 | }
|
9339 | |
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 |
|
9345 | }, {
|
9346 | key: "getTickXY",
|
9347 | value: function getTickXY() {
|
9348 | var config = this.config,
|
9349 | pos = {
|
9350 | x: 0,
|
9351 | y: 0
|
9352 | };
|
9353 | return this.params.isCategory && (pos.x = config.tickCentered ? 0 : config.tickOffset, pos.y = config.tickCentered ? config.tickOffset : 0), pos;
|
9354 | }
|
9355 | |
9356 |
|
9357 |
|
9358 |
|
9359 |
|
9360 |
|
9361 |
|
9362 | }, {
|
9363 | key: "getTickSize",
|
9364 | value: function getTickSize(d) {
|
9365 | var scale = this.helper.scale,
|
9366 | config = this.config,
|
9367 | innerTickSize = config.innerTickSize,
|
9368 | range = config.range,
|
9369 | tickPosition = scale(d) + (config.tickCentered ? 0 : config.tickOffset);
|
9370 | return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;
|
9371 | }
|
9372 | |
9373 |
|
9374 |
|
9375 |
|
9376 |
|
9377 |
|
9378 |
|
9379 |
|
9380 | }, {
|
9381 | key: "setTickLineTextPosition",
|
9382 | value: function setTickLineTextPosition(lineUpdate, textUpdate) {
|
9383 | var tickPos = this.getTickXY(),
|
9384 | _this$config = this.config,
|
9385 | innerTickSize = _this$config.innerTickSize,
|
9386 | orient = _this$config.orient,
|
9387 | tickLength = _this$config.tickLength,
|
9388 | tickOffset = _this$config.tickOffset,
|
9389 | rotate = this.params.tickTextRotate;
|
9390 | orient === "bottom" ? (lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", this.getTickSize.bind(this)), textUpdate.attr("x", 0).attr("y", function yForText(r) {
|
9391 | return r ? 11.5 - 2.5 * (r / 15) * (r > 0 ? 1 : -1) : tickLength;
|
9392 | }(rotate)).style("text-anchor", function textAnchorForText(r) {
|
9393 | return r ? r > 0 ? "start" : "end" : "middle";
|
9394 | }(rotate)).attr("transform", function textTransform(r) {
|
9395 | return r ? "rotate(".concat(r, ")") : null;
|
9396 | }(rotate))) : orient === "top" ? (lineUpdate.attr("x2", 0).attr("y2", -innerTickSize), textUpdate.attr("x", 0).attr("y", -tickLength * 2).style("text-anchor", "middle")) : orient === "left" ? (lineUpdate.attr("x2", -innerTickSize).attr("y1", tickPos.y).attr("y2", tickPos.y), textUpdate.attr("x", -tickLength).attr("y", tickOffset).style("text-anchor", "end")) : orient === "right" ? (lineUpdate.attr("x2", innerTickSize).attr("y2", 0), textUpdate.attr("x", tickLength).attr("y", 0).style("text-anchor", "start")) : void 0;
|
9397 | }
|
9398 |
|
9399 | }, {
|
9400 | key: "splitTickText",
|
9401 | value: function splitTickText(d, scale, ticks, isLeftRight, charWidth) {
|
9402 | function split(splitted, text) {
|
9403 | for (var subtext, spaceIndex, textWidth, i = 1; i < text.length; i++)
|
9404 | if (text.charAt(i) === " " && (spaceIndex = i), subtext = text.substr(0, i + 1), textWidth = charWidth * subtext.length, tickWidth < textWidth) return split(splitted.concat(text.substr(0, spaceIndex || i)), text.slice(spaceIndex ? spaceIndex + 1 : i));
|
9405 |
|
9406 | return splitted.concat(text);
|
9407 | }
|
9408 |
|
9409 | var params = this.params,
|
9410 | tickText = this.helper.textFormatted(d),
|
9411 | splitted = isString(tickText) && tickText.indexOf("\n") > -1 ? tickText.split("\n") : [];
|
9412 | if (splitted.length) return splitted;
|
9413 | if (isArray(tickText)) return tickText;
|
9414 | var tickWidth = params.tickWidth;
|
9415 | return (!tickWidth || tickWidth <= 0) && (tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110), split(splitted, tickText + "");
|
9416 | }
|
9417 | }, {
|
9418 | key: "scale",
|
9419 | value: function scale(x) {
|
9420 | return arguments.length ? (this.helper.scale = x, this) : this.helper.scale;
|
9421 | }
|
9422 | }, {
|
9423 | key: "orient",
|
9424 | value: function orient(x) {
|
9425 | return arguments.length ? (this.config.orient = x in {
|
9426 | top: 1,
|
9427 | right: 1,
|
9428 | bottom: 1,
|
9429 | left: 1
|
9430 | } ? x + "" : "bottom", this) : this.config.orient;
|
9431 | }
|
9432 | }, {
|
9433 | key: "tickFormat",
|
9434 | value: function tickFormat(format) {
|
9435 | return arguments.length ? (this.config.tickFormat = format, this) : this.config.tickFormat;
|
9436 | }
|
9437 | }, {
|
9438 | key: "tickCentered",
|
9439 | value: function tickCentered(isCentered) {
|
9440 | var config = this.config;
|
9441 | return arguments.length ? (config.tickCentered = isCentered, this) : config.tickCentered;
|
9442 | }
|
9443 | |
9444 |
|
9445 |
|
9446 |
|
9447 |
|
9448 |
|
9449 |
|
9450 | }, {
|
9451 | key: "tickOffset",
|
9452 | value: function tickOffset() {
|
9453 | return this.config.tickOffset;
|
9454 | }
|
9455 | |
9456 |
|
9457 |
|
9458 |
|
9459 |
|
9460 |
|
9461 |
|
9462 | }, {
|
9463 | key: "tickInterval",
|
9464 | value: function tickInterval(size) {
|
9465 | var interval;
|
9466 | if (this.params.isCategory) interval = this.config.tickOffset * 2;else {
|
9467 | var length = this.g.select("path.domain").node().getTotalLength() - this.config.outerTickSize * 2;
|
9468 | interval = length / (size || this.g.selectAll("line").size());
|
9469 | }
|
9470 | return interval === Infinity ? 0 : interval;
|
9471 | }
|
9472 | }, {
|
9473 | key: "ticks",
|
9474 | value: function ticks() {
|
9475 | for (var config = this.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
9476 |
|
9477 | return args.length ? (config.tickArguments = toArray(args), this) : config.tickArguments;
|
9478 | }
|
9479 | }, {
|
9480 | key: "tickCulling",
|
9481 | value: function tickCulling(culling) {
|
9482 | var config = this.config;
|
9483 | return arguments.length ? (config.tickCulling = culling, this) : config.tickCulling;
|
9484 | }
|
9485 | }, {
|
9486 | key: "tickValues",
|
9487 | value: function tickValues(x) {
|
9488 | var _this = this,
|
9489 | config = this.config;
|
9490 |
|
9491 | if (isFunction(x)) config.tickValues = function () {
|
9492 | return x(_this.helper.scale.domain());
|
9493 | };else {
|
9494 | if (!arguments.length) return config.tickValues;
|
9495 | config.tickValues = x;
|
9496 | }
|
9497 | return this;
|
9498 | }
|
9499 | }, {
|
9500 | key: "setTransition",
|
9501 | value: function setTransition(t) {
|
9502 | return this.config.transition = t, this;
|
9503 | }
|
9504 | }]), AxisRenderer;
|
9505 | }();
|
9506 |
|
9507 |
|
9508 |
|
9509 |
|
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 |
|
9515 |
|
9516 |
|
9517 |
|
9518 |
|
9519 |
|
9520 |
|
9521 |
|
9522 | var isHorizontal = function ($$, forHorizontal) {
|
9523 | var isRotated = $$.config.axis_rotated;
|
9524 | return forHorizontal ? isRotated : !isRotated;
|
9525 | },
|
9526 | getAxisClassName = function (id) {
|
9527 | return "".concat(config_classes.axis, " ").concat(config_classes["axis".concat(capitalize(id))]);
|
9528 | };
|
9529 |
|
9530 | var Axis_Axis =
|
9531 |
|
9532 | function () {
|
9533 | function Axis(owner) {
|
9534 | classCallCheck_default()(this, Axis), this.owner = owner, this.setOrient();
|
9535 | }
|
9536 |
|
9537 | return createClass_default()(Axis, [{
|
9538 | key: "init",
|
9539 | value: function init() {
|
9540 | var _this = this,
|
9541 | $$ = this.owner,
|
9542 | config = $$.config,
|
9543 | isRotated = config.axis_rotated,
|
9544 | main = $$.main,
|
9545 | target = ["x", "y"];
|
9546 |
|
9547 | config.axis_y2_show && target.push("y2"), $$.axesList = {}, target.forEach(function (v) {
|
9548 | var classAxis = getAxisClassName(v),
|
9549 | classLabel = config_classes["axis".concat(capitalize(v), "Label")];
|
9550 | $$.axes[v] = main.append("g").attr("class", classAxis).attr("clip-path", function () {
|
9551 | var res = null;
|
9552 | return v === "x" ? res = $$.clipPathForXAxis : v === "y" && config.axis_y_inner && (res = $$.clipPathForYAxis), res;
|
9553 | }).attr("transform", $$.getTranslate(v)).style("visibility", config["axis_".concat(v, "_show")] ? "visible" : "hidden"), $$.axes[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", _this.textAnchorForXAxisLabel.bind(_this)), _this.generateAxes(v);
|
9554 | });
|
9555 | }
|
9556 | |
9557 |
|
9558 |
|
9559 |
|
9560 |
|
9561 | }, {
|
9562 | key: "setOrient",
|
9563 | value: function setOrient() {
|
9564 | var $$ = this.owner,
|
9565 | config = $$.config,
|
9566 | isRotated = config.axis_rotated,
|
9567 | yInner = config.axis_y_inner,
|
9568 | y2Inner = config.axis_y2_inner;
|
9569 | $$.xOrient = isRotated ? "left" : "bottom", $$.yOrient = isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left", $$.y2Orient = isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right", $$.subXOrient = isRotated ? "left" : "bottom";
|
9570 | }
|
9571 | |
9572 |
|
9573 |
|
9574 |
|
9575 |
|
9576 |
|
9577 |
|
9578 | }, {
|
9579 | key: "generateAxes",
|
9580 | value: function generateAxes(id) {
|
9581 | var d3Axis,
|
9582 | $$ = this.owner,
|
9583 | config = $$.config,
|
9584 | axes = [],
|
9585 | axesConfig = config["axis_".concat(id, "_axes")],
|
9586 | isRotated = config.axis_rotated;
|
9587 | id === "x" ? d3Axis = isRotated ? axisLeft : axisBottom : id === "y" ? d3Axis = isRotated ? axisBottom : axisLeft : id === "y2" && (d3Axis = isRotated ? axisTop : axisRight), axesConfig.length && axesConfig.forEach(function (v) {
|
9588 | var tick = v.tick;
|
9589 | axes.push(d3Axis($$[id]).ticks(tick.count).tickFormat(tick.format || function (x) {
|
9590 | return x;
|
9591 | }).tickValues(tick.values).tickSizeOuter(tick.outer === !1 ? 0 : 6));
|
9592 | }), $$.axesList[id] = axes;
|
9593 | }
|
9594 | |
9595 |
|
9596 |
|
9597 |
|
9598 |
|
9599 | }, {
|
9600 | key: "updateAxes",
|
9601 | value: function updateAxes() {
|
9602 | var $$ = this.owner,
|
9603 | config = $$.config;
|
9604 | Object.keys($$.axesList).forEach(function (id) {
|
9605 | var range = $$[id].range();
|
9606 | $$.axesList[id].forEach(function (v, i) {
|
9607 | var axisRange = v.scale().range();
|
9608 |
|
9609 |
|
9610 | range.every(function (v, i) {
|
9611 | return v === axisRange[i];
|
9612 | }) || v.scale().range(range);
|
9613 | var className = "".concat(getAxisClassName(id), "-").concat(i + 1),
|
9614 | g = $$.main.select(".".concat(className.replace(/\s/, ".")));
|
9615 | g.empty() ? g = $$.main.append("g").attr("class", className).style("visibility", config["axis_".concat(id, "_show")] ? "visible" : "hidden").call(v) : $$.xAxis.helper.transitionise(g).call(v.scale($$[id])), g.attr("transform", $$.getTranslate(id, i + 1));
|
9616 | });
|
9617 | });
|
9618 | }
|
9619 |
|
9620 | }, {
|
9621 | key: "getXAxis",
|
9622 | value: function getXAxis(name, scale, outerTick, noTransition, noTickTextRotate) {
|
9623 | var $$ = this.owner,
|
9624 | config = $$.config,
|
9625 | isCategory = $$.isCategorized(),
|
9626 | orient = $$["".concat(name, "Orient")],
|
9627 | tickFormat = $$.xAxisTickFormat,
|
9628 | tickValues = $$.xAxisTickValues,
|
9629 | axisParams = {
|
9630 | isCategory: isCategory,
|
9631 | outerTick: outerTick,
|
9632 | noTransition: noTransition,
|
9633 | config: config,
|
9634 | name: name,
|
9635 | tickMultiline: config.axis_x_tick_multiline,
|
9636 | tickWidth: config.axis_x_tick_width,
|
9637 | tickTextRotate: noTickTextRotate ? 0 : config.axis_x_tick_rotate,
|
9638 | tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
9639 | orgXScale: $$.x
|
9640 | },
|
9641 | axis = new AxisRenderer_AxisRenderer(axisParams).scale($$.zoomScale || scale).orient(orient),
|
9642 | newTickValues = tickValues;
|
9643 | return $$.isTimeSeries() && tickValues && !isFunction(tickValues) && (newTickValues = tickValues.map(function (v) {
|
9644 | return $$.parseDate(v);
|
9645 | })), axis.tickFormat(tickFormat).tickValues(newTickValues), isCategory && (axis.tickCentered(config.axis_x_tick_centered), isEmpty(config.axis_x_tick_culling) && (config.axis_x_tick_culling = !1)), config.axis_x_tick_count && axis.ticks(config.axis_x_tick_count), axis;
|
9646 | }
|
9647 |
|
9648 | }, {
|
9649 | key: "getYAxis",
|
9650 | value: function getYAxis(name, scale, outerTick, noTransition, noTickTextRotate) {
|
9651 | var $$ = this.owner,
|
9652 | config = $$.config,
|
9653 | orient = $$["".concat(name, "Orient")],
|
9654 | tickFormat = config["axis_".concat(name, "_tick_format")],
|
9655 | tickValues = $$["".concat(name, "AxisTickValues")],
|
9656 | axisParams = {
|
9657 | outerTick: outerTick,
|
9658 | noTransition: noTransition,
|
9659 | config: config,
|
9660 | name: name,
|
9661 | tickTextRotate: noTickTextRotate ? 0 : config.axis_y_tick_rotate
|
9662 | },
|
9663 | axis = new AxisRenderer_AxisRenderer(axisParams).scale(scale).orient(orient).tickFormat(tickFormat || $$.isStackNormalized() && function (x) {
|
9664 | return "".concat(x, "%");
|
9665 | });
|
9666 | return $$.isTimeSeriesY() ?
|
9667 | axis.ticks(config.axis_y_tick_time_value) : axis.tickValues(tickValues), axis;
|
9668 | }
|
9669 | }, {
|
9670 | key: "updateXAxisTickValues",
|
9671 | value: function updateXAxisTickValues(targets, axis) {
|
9672 | var values,
|
9673 | $$ = this.owner,
|
9674 | config = $$.config,
|
9675 | fit = config.axis_x_tick_fit,
|
9676 | count = config.axis_x_tick_count;
|
9677 | return (fit || count && fit) && (values = this.generateTickValues($$.mapTargetsToUniqueXs(targets), count, $$.isTimeSeries())), axis ? axis.tickValues(values) : $$.xAxis && ($$.xAxis.tickValues(values), $$.subXAxis.tickValues(values)), values;
|
9678 | }
|
9679 | }, {
|
9680 | key: "getId",
|
9681 | value: function getId(id) {
|
9682 | var config = this.owner.config;
|
9683 | return id in config.data_axes ? config.data_axes[id] : "y";
|
9684 | }
|
9685 | }, {
|
9686 | key: "getXAxisTickFormat",
|
9687 | value: function getXAxisTickFormat() {
|
9688 | var format,
|
9689 | $$ = this.owner,
|
9690 | config = $$.config,
|
9691 | tickFormat = config.axis_x_tick_format,
|
9692 | isTimeSeries = $$.isTimeSeries(),
|
9693 | isCategorized = $$.isCategorized();
|
9694 | return tickFormat ? isFunction(tickFormat) ? format = tickFormat : isTimeSeries && (format = function (date) {
|
9695 | return date ? $$.axisTimeFormat(tickFormat)(date) : "";
|
9696 | }) : format = isTimeSeries ? $$.defaultAxisTimeFormat : isCategorized ? $$.categoryName : function (v) {
|
9697 | return v < 0 ? v.toFixed(0) : v;
|
9698 | }, isFunction(format) ? function (v) {
|
9699 | return format.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]);
|
9700 | } : format;
|
9701 | }
|
9702 | }, {
|
9703 | key: "getTickValues",
|
9704 | value: function getTickValues(id) {
|
9705 | var $$ = this.owner,
|
9706 | tickValues = $$.config["axis_".concat(id, "_tick_values")],
|
9707 | axis = $$["".concat(id, "Axis")];
|
9708 | return tickValues || (axis ? axis.tickValues() : undefined);
|
9709 | }
|
9710 | }, {
|
9711 | key: "getXAxisTickValues",
|
9712 | value: function getXAxisTickValues() {
|
9713 | return this.getTickValues("x");
|
9714 | }
|
9715 | }, {
|
9716 | key: "getYAxisTickValues",
|
9717 | value: function getYAxisTickValues() {
|
9718 | return this.getTickValues("y");
|
9719 | }
|
9720 | }, {
|
9721 | key: "getY2AxisTickValues",
|
9722 | value: function getY2AxisTickValues() {
|
9723 | return this.getTickValues("y2");
|
9724 | }
|
9725 | }, {
|
9726 | key: "getLabelOptionByAxisId",
|
9727 | value: function getLabelOptionByAxisId(id) {
|
9728 | return this.owner.config["axis_".concat(id, "_label")];
|
9729 | }
|
9730 | }, {
|
9731 | key: "getLabelText",
|
9732 | value: function getLabelText(id) {
|
9733 | var option = this.getLabelOptionByAxisId(id);
|
9734 | return isString(option) ? option : option ? option.text : null;
|
9735 | }
|
9736 | }, {
|
9737 | key: "setLabelText",
|
9738 | value: function setLabelText(id, text) {
|
9739 | var $$ = this.owner,
|
9740 | config = $$.config,
|
9741 | option = this.getLabelOptionByAxisId(id);
|
9742 | isString(option) ? config["axis_".concat(id, "_label")] = text : option && (option.text = text);
|
9743 | }
|
9744 | }, {
|
9745 | key: "getLabelPosition",
|
9746 | value: function getLabelPosition(id, defaultPosition) {
|
9747 | var isRotated = this.owner.config.axis_rotated,
|
9748 | option = this.getLabelOptionByAxisId(id),
|
9749 | position = isObjectType(option) && option.position ? option.position : defaultPosition[+!isRotated],
|
9750 | has = function (v) {
|
9751 | return !!~position.indexOf(v);
|
9752 | };
|
9753 |
|
9754 | return {
|
9755 | isInner: has("inner"),
|
9756 | isOuter: has("outer"),
|
9757 | isLeft: has("left"),
|
9758 | isCenter: has("center"),
|
9759 | isRight: has("right"),
|
9760 | isTop: has("top"),
|
9761 | isMiddle: has("middle"),
|
9762 | isBottom: has("bottom")
|
9763 | };
|
9764 | }
|
9765 | }, {
|
9766 | key: "getXAxisLabelPosition",
|
9767 | value: function getXAxisLabelPosition() {
|
9768 | return this.getLabelPosition("x", ["inner-top", "inner-right"]);
|
9769 | }
|
9770 | }, {
|
9771 | key: "getYAxisLabelPosition",
|
9772 | value: function getYAxisLabelPosition() {
|
9773 | return this.getLabelPosition("y", ["inner-right", "inner-top"]);
|
9774 | }
|
9775 | }, {
|
9776 | key: "getY2AxisLabelPosition",
|
9777 | value: function getY2AxisLabelPosition() {
|
9778 | return this.getLabelPosition("y2", ["inner-right", "inner-top"]);
|
9779 | }
|
9780 | }, {
|
9781 | key: "getLabelPositionById",
|
9782 | value: function getLabelPositionById(id) {
|
9783 | return this["get".concat(id.toUpperCase(), "AxisLabelPosition")]();
|
9784 | }
|
9785 | }, {
|
9786 | key: "textForXAxisLabel",
|
9787 | value: function textForXAxisLabel() {
|
9788 | return this.getLabelText("x");
|
9789 | }
|
9790 | }, {
|
9791 | key: "textForYAxisLabel",
|
9792 | value: function textForYAxisLabel() {
|
9793 | return this.getLabelText("y");
|
9794 | }
|
9795 | }, {
|
9796 | key: "textForY2AxisLabel",
|
9797 | value: function textForY2AxisLabel() {
|
9798 | return this.getLabelText("y2");
|
9799 | }
|
9800 | }, {
|
9801 | key: "xForAxisLabel",
|
9802 | value: function xForAxisLabel(position) {
|
9803 | var forHorizontal = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
9804 | $$ = this.owner,
|
9805 | x = position.isMiddle ? -$$.height / 2 : 0;
|
9806 | return isHorizontal($$, forHorizontal) ? x = position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width : position.isBottom && (x = -$$.height), x;
|
9807 | }
|
9808 | }, {
|
9809 | key: "dxForAxisLabel",
|
9810 | value: function dxForAxisLabel(position) {
|
9811 | var forHorizontal = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
9812 | $$ = this.owner,
|
9813 | dx = position.isBottom ? "0.5em" : "0";
|
9814 | return isHorizontal($$, forHorizontal) ? dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0" : position.isTop && (dx = "-0.5em"), dx;
|
9815 | }
|
9816 | }, {
|
9817 | key: "textAnchorForAxisLabel",
|
9818 | value: function textAnchorForAxisLabel(position) {
|
9819 | var forHorizontal = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
9820 | $$ = this.owner,
|
9821 | anchor = position.isMiddle ? "middle" : "end";
|
9822 | return isHorizontal($$, forHorizontal) ? anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end" : position.isBottom && (anchor = "start"), anchor;
|
9823 | }
|
9824 | }, {
|
9825 | key: "xForXAxisLabel",
|
9826 | value: function xForXAxisLabel() {
|
9827 | return this.xForAxisLabel(this.getXAxisLabelPosition(), !1);
|
9828 | }
|
9829 | }, {
|
9830 | key: "xForYAxisLabel",
|
9831 | value: function xForYAxisLabel() {
|
9832 | return this.xForAxisLabel(this.getYAxisLabelPosition());
|
9833 | }
|
9834 | }, {
|
9835 | key: "xForY2AxisLabel",
|
9836 | value: function xForY2AxisLabel() {
|
9837 | return this.xForAxisLabel(this.getY2AxisLabelPosition());
|
9838 | }
|
9839 | }, {
|
9840 | key: "dxForXAxisLabel",
|
9841 | value: function dxForXAxisLabel() {
|
9842 | return this.dxForAxisLabel(this.getXAxisLabelPosition(), !1);
|
9843 | }
|
9844 | }, {
|
9845 | key: "dxForYAxisLabel",
|
9846 | value: function dxForYAxisLabel() {
|
9847 | return this.dxForAxisLabel(this.getYAxisLabelPosition());
|
9848 | }
|
9849 | }, {
|
9850 | key: "dxForY2AxisLabel",
|
9851 | value: function dxForY2AxisLabel() {
|
9852 | return this.dxForAxisLabel(this.getY2AxisLabelPosition());
|
9853 | }
|
9854 | }, {
|
9855 | key: "dyForXAxisLabel",
|
9856 | value: function dyForXAxisLabel() {
|
9857 | var $$ = this.owner,
|
9858 | config = $$.config,
|
9859 | isInner = this.getXAxisLabelPosition().isInner,
|
9860 | xHeight = config.axis_x_height;
|
9861 | return config.axis_rotated ? isInner ? "1.2em" : -25 - this.getMaxTickWidth("x") : isInner ? "-0.5em" : xHeight ? xHeight - 10 : "3em";
|
9862 | }
|
9863 | }, {
|
9864 | key: "dyForYAxisLabel",
|
9865 | value: function dyForYAxisLabel() {
|
9866 | var $$ = this.owner,
|
9867 | isInner = this.getYAxisLabelPosition().isInner;
|
9868 | return $$.config.axis_rotated ? isInner ? "-0.5em" : "3em" : isInner ? "1.2em" : -10 - ($$.config.axis_y_inner ? 0 : this.getMaxTickWidth("y") + 10);
|
9869 | }
|
9870 | }, {
|
9871 | key: "dyForY2AxisLabel",
|
9872 | value: function dyForY2AxisLabel() {
|
9873 | var $$ = this.owner,
|
9874 | isInner = this.getY2AxisLabelPosition().isInner;
|
9875 | return $$.config.axis_rotated ? isInner ? "1.2em" : "-2.2em" : isInner ? "-0.5em" : 15 + ($$.config.axis_y2_inner ? 0 : this.getMaxTickWidth("y2") + 15);
|
9876 | }
|
9877 | }, {
|
9878 | key: "textAnchorForXAxisLabel",
|
9879 | value: function textAnchorForXAxisLabel() {
|
9880 | return this.textAnchorForAxisLabel(this.getXAxisLabelPosition(), !1);
|
9881 | }
|
9882 | }, {
|
9883 | key: "textAnchorForYAxisLabel",
|
9884 | value: function textAnchorForYAxisLabel() {
|
9885 | return this.textAnchorForAxisLabel(this.getYAxisLabelPosition());
|
9886 | }
|
9887 | }, {
|
9888 | key: "textAnchorForY2AxisLabel",
|
9889 | value: function textAnchorForY2AxisLabel() {
|
9890 | return this.textAnchorForAxisLabel(this.getY2AxisLabelPosition());
|
9891 | }
|
9892 | }, {
|
9893 | key: "getMaxTickWidth",
|
9894 | value: function getMaxTickWidth(id, withoutRecompute) {
|
9895 | var $$ = this.owner,
|
9896 | config = $$.config,
|
9897 | currentTickMax = $$.currentMaxTickWidths[id],
|
9898 | maxWidth = 0;
|
9899 | if (withoutRecompute || !config["axis_".concat(id, "_show")]) return currentTickMax.size;
|
9900 |
|
9901 | if ($$.svg) {
|
9902 | var isYAxis = /^y2?$/.test(id),
|
9903 | targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
9904 | getFrom = isYAxis ? "getY" : "getX",
|
9905 | scale = $$[id].copy().domain($$["".concat(getFrom, "Domain")](targetsToShow, id)),
|
9906 | domain = scale.domain();
|
9907 |
|
9908 | if (isArray(currentTickMax.domain) && currentTickMax.domain.every(function (v, i) {
|
9909 | return v === domain[i];
|
9910 | })) return currentTickMax.size;
|
9911 | currentTickMax.domain = domain;
|
9912 | var axis = this["".concat(getFrom, "Axis")](id, scale, !1, !1, !0),
|
9913 | tickCount = config["axis_".concat(id, "_tick_count")];
|
9914 | tickCount && axis.tickValues(this.generateTickValues(domain, tickCount, isYAxis ? $$.isTimeSeriesY() : $$.isTimeSeries())), isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
|
9915 | var dummy = $$.selectChart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0px").style("left", "0px");
|
9916 | axis.create(dummy), dummy.selectAll("text").each(function () {
|
9917 | maxWidth = Math.max(maxWidth, this.getBoundingClientRect().width);
|
9918 | }), dummy.remove();
|
9919 | }
|
9920 |
|
9921 | return maxWidth > 0 && (currentTickMax.size = maxWidth), currentTickMax.size;
|
9922 | }
|
9923 | }, {
|
9924 | key: "updateLabels",
|
9925 | value: function updateLabels(withTransition) {
|
9926 | var _this2 = this,
|
9927 | $$ = this.owner,
|
9928 | labels = {
|
9929 | X: $$.main.select(".".concat(config_classes.axisX, " .").concat(config_classes.axisXLabel)),
|
9930 | Y: $$.main.select(".".concat(config_classes.axisY, " .").concat(config_classes.axisYLabel)),
|
9931 | Y2: $$.main.select(".".concat(config_classes.axisY2, " .").concat(config_classes.axisY2Label))
|
9932 | };
|
9933 |
|
9934 | Object.keys(labels).filter(function (id) {
|
9935 | return !labels[id].empty();
|
9936 | }).forEach(function (v) {
|
9937 | var node = labels[v],
|
9938 | axisLabel = "".concat(v, "AxisLabel");
|
9939 | (withTransition ? node.transition() : node).attr("x", _this2["xFor".concat(axisLabel)].bind(_this2)).attr("dx", _this2["dxFor".concat(axisLabel)].bind(_this2)).attr("dy", _this2["dyFor".concat(axisLabel)].bind(_this2)).text(_this2["textFor".concat(axisLabel)].bind(_this2));
|
9940 | });
|
9941 | }
|
9942 | }, {
|
9943 | key: "getPadding",
|
9944 | value: function getPadding(padding, key, defaultValue, domainLength) {
|
9945 | var p = isNumber(padding) ? padding : padding[key];
|
9946 | return isValue(p) ? padding.unit === "ratio" ? padding[key] * domainLength : this.convertPixelsToAxisPadding(p, domainLength) : defaultValue;
|
9947 | }
|
9948 | }, {
|
9949 | key: "convertPixelsToAxisPadding",
|
9950 | value: function convertPixelsToAxisPadding(pixels, domainLength) {
|
9951 | var $$ = this.owner,
|
9952 | length = $$.config.axis_rotated ? $$.width : $$.height;
|
9953 | return domainLength * (pixels / length);
|
9954 | }
|
9955 | }, {
|
9956 | key: "generateTickValues",
|
9957 | value: function generateTickValues(values, tickCount, forTimeSeries) {
|
9958 | var start,
|
9959 | end,
|
9960 | count,
|
9961 | interval,
|
9962 | i,
|
9963 | tickValue,
|
9964 | tickValues = values;
|
9965 |
|
9966 | if (tickCount) {
|
9967 | var targetCount = isFunction(tickCount) ? tickCount() : tickCount;
|
9968 |
|
9969 | if (targetCount === 1) tickValues = [values[0]];else if (targetCount === 2) tickValues = [values[0], values[values.length - 1]];else if (targetCount > 2) {
|
9970 | for (count = targetCount - 2, start = values[0], end = values[values.length - 1], interval = (end - start) / (count + 1), tickValues = [start], i = 0; i < count; i++) tickValue = +start + interval * (i + 1), tickValues.push(forTimeSeries ? new Date(tickValue) : tickValue);
|
9971 |
|
9972 | tickValues.push(end);
|
9973 | }
|
9974 | }
|
9975 |
|
9976 | return forTimeSeries || (tickValues = tickValues.sort(function (a, b) {
|
9977 | return a - b;
|
9978 | })), tickValues;
|
9979 | }
|
9980 | }, {
|
9981 | key: "generateTransitions",
|
9982 | value: function generateTransitions(duration) {
|
9983 | var $$ = this.owner,
|
9984 | axes = $$.axes,
|
9985 | _map = ["x", "y", "y2", "subx"].map(function (v) {
|
9986 | var axis = axes[v];
|
9987 | return axis && duration && (axis = axis.transition().duration(duration)), axis;
|
9988 | }),
|
9989 | _map2 = slicedToArray_default()(_map, 4),
|
9990 | axisX = _map2[0],
|
9991 | axisY = _map2[1],
|
9992 | axisY2 = _map2[2],
|
9993 | axisSubX = _map2[3];
|
9994 |
|
9995 | return {
|
9996 | axisX: axisX,
|
9997 | axisY: axisY,
|
9998 | axisY2: axisY2,
|
9999 | axisSubX: axisSubX
|
10000 | };
|
10001 | }
|
10002 | }, {
|
10003 | key: "redraw",
|
10004 | value: function redraw(transitions, isHidden, isInit) {
|
10005 | var $$ = this.owner,
|
10006 | opacity = isHidden ? "0" : "1";
|
10007 | ["x", "y", "y2", "subX"].forEach(function (id) {
|
10008 | var axis = $$["".concat(id, "Axis")];
|
10009 | axis && (!isInit && (axis.config.withoutTransition = !$$.config.transition_duration), $$.axes[id.toLowerCase()].style("opacity", opacity), axis.create(transitions["axis".concat(capitalize(id))]));
|
10010 | }), this.updateAxes();
|
10011 | }
|
10012 | }]), Axis;
|
10013 | }();
|
10014 |
|
10015 |
|
10016 |
|
10017 |
|
10018 |
|
10019 |
|
10020 |
|
10021 |
|
10022 |
|
10023 |
|
10024 |
|
10025 |
|
10026 |
|
10027 |
|
10028 |
|
10029 |
|
10030 |
|
10031 |
|
10032 |
|
10033 |
|
10034 |
|
10035 |
|
10036 |
|
10037 |
|
10038 |
|
10039 |
|
10040 |
|
10041 | var ChartInternal_ChartInternal =
|
10042 |
|
10043 | function () {
|
10044 | function ChartInternal(api) {
|
10045 | classCallCheck_default()(this, ChartInternal);
|
10046 |
|
10047 | var $$ = this;
|
10048 | $$.api = api, $$.config = $$.getOptions(), $$.data = {}, $$.cache = {}, $$.axes = {};
|
10049 | }
|
10050 |
|
10051 | return createClass_default()(ChartInternal, [{
|
10052 | key: "beforeInit",
|
10053 | value: function beforeInit() {
|
10054 | var $$ = this;
|
10055 | $$.callPluginHook("$beforeInit"), callFn($$.config.onbeforeinit, $$);
|
10056 | }
|
10057 | }, {
|
10058 | key: "afterInit",
|
10059 | value: function afterInit() {
|
10060 | var $$ = this;
|
10061 | $$.callPluginHook("$afterInit"), callFn($$.config.onafterinit, $$);
|
10062 | }
|
10063 | }, {
|
10064 | key: "init",
|
10065 | value: function init() {
|
10066 | var $$ = this;
|
10067 | $$.initParams();
|
10068 | var convertedData = $$.convertData($$.config, $$.initWithData);
|
10069 | convertedData && $$.initWithData(convertedData);
|
10070 | }
|
10071 | }, {
|
10072 | key: "initParams",
|
10073 | value: function initParams() {
|
10074 | var _this = this,
|
10075 | $$ = this,
|
10076 | config = $$.config,
|
10077 | isRotated = config.axis_rotated;
|
10078 |
|
10079 | $$.datetimeId = "bb-".concat(+new Date()), $$.initClip(), $$.dragStart = null, $$.dragging = !1, $$.flowing = !1, $$.cancelClick = !1, $$.mouseover = !1, $$.transiting = !1, $$.color = $$.generateColor(), $$.levelColor = $$.generateLevelColor(), $$.point = $$.generatePoint(), $$.extraLineClasses = $$.generateExtraLineClass(), $$.dataTimeFormat = config.data_xLocaltime ? timeParse : utcParse, $$.axisTimeFormat = config.axis_x_localtime ? timeFormat : utcFormat;
|
10080 | var isDragZoom = $$.config.zoom_enabled && $$.config.zoom_enabled.type === "drag";
|
10081 | $$.defaultAxisTimeFormat = function (d) {
|
10082 | var isZoomed = isDragZoom ? _this.zoomScale : _this.zoomScale && $$.x.orgDomain().toString() !== _this.zoomScale.domain().toString(),
|
10083 | specifier = d.getMilliseconds() && ".%L" || d.getSeconds() && ".:%S" || d.getMinutes() && "%I:%M" || d.getHours() && "%I %p" || d.getDate() !== 1 && "%b %d" || isZoomed && d.getDate() === 1 && "%b\'%y" || d.getMonth() && "%-m/%-d" || "%Y";
|
10084 | return $$.axisTimeFormat(specifier)(d);
|
10085 | }, $$.hiddenTargetIds = [], $$.hiddenLegendIds = [], $$.focusedTargetIds = [], $$.defocusedTargetIds = [], $$.isLegendRight = config.legend_position === "right", $$.isLegendInset = config.legend_position === "inset", $$.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right", $$.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left", $$.legendStep = 0, $$.legendItemWidth = 0, $$.legendItemHeight = 0, $$.currentMaxTickWidths = {
|
10086 | x: {
|
10087 | size: 0,
|
10088 | domain: ""
|
10089 | },
|
10090 | y: {
|
10091 | size: 0,
|
10092 | domain: ""
|
10093 | },
|
10094 | y2: {
|
10095 | size: 0,
|
10096 | domain: ""
|
10097 | }
|
10098 | }, $$.rotated_padding_left = 30, $$.rotated_padding_right = isRotated && !config.axis_x_show ? 0 : 30, $$.rotated_padding_top = 5, $$.withoutFadeIn = {}, $$.inputType = $$.convertInputType(), $$.axes.subx = src_selectAll([]);
|
10099 | }
|
10100 | }, {
|
10101 | key: "initWithData",
|
10102 | value: function initWithData(data) {
|
10103 | var $$ = this,
|
10104 | config = $$.config;
|
10105 | $$.axis = new Axis_Axis($$), config.zoom_enabled && $$.initZoom();
|
10106 | var bindto = {
|
10107 | element: config.bindto,
|
10108 | classname: "bb"
|
10109 | };
|
10110 |
|
10111 | if (isObject(config.bindto) && (bindto.element = config.bindto.element || "#chart", bindto.classname = config.bindto.classname || bindto.classname), $$.selectChart = isFunction(bindto.element.node) ? config.bindto.element : src_select(bindto.element || []), $$.selectChart.empty() && ($$.selectChart = src_select(browser["document"].body.appendChild(browser["document"].createElement("div")))), $$.selectChart.html("").classed(bindto.classname, !0), $$.data.xs = {}, $$.data.targets = $$.convertDataToTargets(data), config.data_filter && ($$.data.targets = $$.data.targets.filter(config.data_filter)), config.data_hide && $$.addHiddenTargetIds(config.data_hide === !0 ? $$.mapToIds($$.data.targets) : config.data_hide), config.legend_hide && $$.addHiddenLegendIds(config.legend_hide === !0 ? $$.mapToIds($$.data.targets) : config.legend_hide), $$.hasType("gauge") && (config.legend_show = !1), $$.updateSizes(), $$.updateScales(!0), $$.x && ($$.x.domain(sortValue($$.getXDomain($$.data.targets))), $$.subX.domain($$.x.domain()), $$.orgXDomain = $$.x.domain()), $$.y && ($$.y.domain($$.getYDomain($$.data.targets, "y")), $$.subY.domain($$.y.domain())), $$.y2 && ($$.y2.domain($$.getYDomain($$.data.targets, "y2")), $$.subY2 && $$.subY2.domain($$.y2.domain())), $$.svg = $$.selectChart.append("svg").style("overflow", "hidden").style("display", "block"), config.interaction_enabled && $$.inputType) {
|
10112 | var isTouch = $$.inputType === "touch";
|
10113 | $$.svg.on(isTouch ? "touchstart" : "mouseenter", function () {
|
10114 | return callFn(config.onover, $$);
|
10115 | }).on(isTouch ? "touchend" : "mouseleave", function () {
|
10116 | return callFn(config.onout, $$);
|
10117 | });
|
10118 | }
|
10119 |
|
10120 | config.svg_classname && $$.svg.attr("class", config.svg_classname), $$.defs = $$.svg.append("defs"), $$.clipChart = $$.appendClip($$.defs, $$.clipId), $$.clipXAxis = $$.appendClip($$.defs, $$.clipIdForXAxis), $$.clipYAxis = $$.appendClip($$.defs, $$.clipIdForYAxis), $$.clipGrid = $$.appendClip($$.defs, $$.clipIdForGrid), isFunction(config.color_tiles) && $$.patterns && $$.patterns.forEach(function (p) {
|
10121 | return $$.defs.append(function () {
|
10122 | return p.node;
|
10123 | });
|
10124 | }), $$.updateSvgSize();
|
10125 |
|
10126 | var main = $$.svg.append("g").attr("transform", $$.getTranslate("main"));
|
10127 |
|
10128 |
|
10129 | if ($$.main = main, config.subchart_show && $$.initSubchart(), $$.initTooltip && $$.initTooltip(), $$.initLegend && $$.initLegend(), $$.initTitle && $$.initTitle(), config.data_empty_label_text && main.append("text").attr("class", "".concat(config_classes.text, " ").concat(config_classes.empty)).attr("text-anchor", "middle")
|
10130 | .attr("dominant-baseline", "middle"), $$.initRegion(), config.clipPath || $$.axis.init(), main.append("g").attr("class", config_classes.chart).attr("clip-path", $$.clipPath), $$.callPluginHook("$init"), $$.initEventRect(), $$.initChartElements(), $$.initGrid(), main.insert("rect", config.zoom_privileged ? null : "g.".concat(config_classes.regions)).attr("class", config_classes.zoomRect).attr("width", $$.width).attr("height", $$.height).style("opacity", "0").on("dblclick.zoom", null), config.clipPath && $$.axis.init(), $$.updateTargets($$.data.targets), $$.updateDimension(), config.oninit.call($$), $$.redraw({
|
10131 | withTransition: !1,
|
10132 | withTransform: !0,
|
10133 | withUpdateXDomain: !0,
|
10134 | withUpdateOrgXDomain: !0,
|
10135 | withTransitionForAxis: !1,
|
10136 | initializing: !0
|
10137 | }), config.data_onmin || config.data_onmax) {
|
10138 | var minMax = $$.getMinMaxData();
|
10139 | callFn(config.data_onmin, $$, minMax.min), callFn(config.data_onmax, $$, minMax.max);
|
10140 | }
|
10141 |
|
10142 |
|
10143 | $$.bindResize(), $$.api.element = $$.selectChart.node();
|
10144 | }
|
10145 | }, {
|
10146 | key: "initChartElements",
|
10147 | value: function initChartElements() {
|
10148 | var $$ = this;
|
10149 | ["Bar", "Radar", "Line", "Bubble", "Arc", "Gauge", "Pie"].forEach(function (v) {
|
10150 | $$["init".concat(v)]();
|
10151 | }), notEmpty($$.config.data_labels) && $$.initText();
|
10152 | }
|
10153 | }, {
|
10154 | key: "getChartElements",
|
10155 | value: function getChartElements() {
|
10156 | var $$ = this;
|
10157 | return {
|
10158 | chart: $$.selectChart,
|
10159 | svg: $$.svg,
|
10160 | defs: $$.defs,
|
10161 | main: $$.main,
|
10162 | tooltip: $$.tooltip,
|
10163 | legend: $$.legend,
|
10164 | title: $$.title,
|
10165 | grid: $$.grid,
|
10166 | arc: $$.arcs,
|
10167 | bar: {
|
10168 | bars: $$.mainBar
|
10169 | },
|
10170 | line: {
|
10171 | lines: $$.mainLine,
|
10172 | areas: $$.mainArea,
|
10173 | circles: $$.mainCircle
|
10174 | },
|
10175 | text: {
|
10176 | texts: $$.mainText
|
10177 | }
|
10178 | };
|
10179 | }
|
10180 | }, {
|
10181 | key: "smoothLines",
|
10182 | value: function smoothLines(el, type) {
|
10183 | type === "grid" && el.each(function () {
|
10184 | var g = src_select(this),
|
10185 | _map = ["x1", "x2", "y1", "y2"].map(function (v) {
|
10186 | return Math.ceil(g.attr(v));
|
10187 | }),
|
10188 | _map2 = slicedToArray_default()(_map, 4),
|
10189 | x1 = _map2[0],
|
10190 | x2 = _map2[1],
|
10191 | y1 = _map2[2],
|
10192 | y2 = _map2[3];
|
10193 |
|
10194 | g.attr({
|
10195 | x1: x1,
|
10196 | x2: x2,
|
10197 | y1: y1,
|
10198 | y2: y2
|
10199 | });
|
10200 | });
|
10201 | }
|
10202 | |
10203 |
|
10204 |
|
10205 |
|
10206 |
|
10207 |
|
10208 | }, {
|
10209 | key: "updateSizes",
|
10210 | value: function updateSizes(isInit) {
|
10211 | var $$ = this,
|
10212 | config = $$.config,
|
10213 | isRotated = config.axis_rotated,
|
10214 | hasArc = $$.hasArcType(),
|
10215 | legend = {
|
10216 | width: $$.legend ? $$.getLegendWidth() : 0,
|
10217 | height: $$.legend ? $$.getLegendHeight() : 0
|
10218 | },
|
10219 | legendHeightForBottom = $$.isLegendRight || $$.isLegendInset ? 0 : legend.height,
|
10220 | xAxisHeight = isRotated || hasArc ? 0 : $$.getHorizontalAxisHeight("x"),
|
10221 | subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
10222 | subchartHeight = config.subchart_show && !hasArc ? config.subchart_size_height + subchartXAxisHeight : 0;
|
10223 | isInit || $$.setContainerSize(), $$.margin = isRotated ? {
|
10224 | top: $$.getHorizontalAxisHeight("y2") + $$.getCurrentPaddingTop(),
|
10225 | right: hasArc ? 0 : $$.getCurrentPaddingRight(),
|
10226 | bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
10227 | left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
|
10228 | } : {
|
10229 | top: 4 + $$.getCurrentPaddingTop(),
|
10230 |
|
10231 | right: hasArc ? 0 : $$.getCurrentPaddingRight(),
|
10232 | bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
10233 | left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
10234 | }, $$.margin2 = isRotated ? {
|
10235 | top: $$.margin.top,
|
10236 | right: NaN,
|
10237 | bottom: 20 + legendHeightForBottom,
|
10238 | left: $$.rotated_padding_left
|
10239 | } : {
|
10240 | top: $$.currentHeight - subchartHeight - legendHeightForBottom,
|
10241 | right: NaN,
|
10242 | bottom: subchartXAxisHeight + legendHeightForBottom,
|
10243 | left: $$.margin.left
|
10244 | }, $$.margin3 = {
|
10245 | top: 0,
|
10246 | right: NaN,
|
10247 | bottom: 0,
|
10248 | left: 0
|
10249 | }, $$.updateSizeForLegend && $$.updateSizeForLegend(legend), $$.width = $$.currentWidth - $$.margin.left - $$.margin.right, $$.height = $$.currentHeight - $$.margin.top - $$.margin.bottom, $$.width < 0 && ($$.width = 0), $$.height < 0 && ($$.height = 0), $$.width2 = isRotated ? $$.margin.left - $$.rotated_padding_left - $$.rotated_padding_right : $$.width, $$.height2 = isRotated ? $$.height : $$.currentHeight - $$.margin2.top - $$.margin2.bottom, $$.width2 < 0 && ($$.width2 = 0), $$.height2 < 0 && ($$.height2 = 0), $$.arcWidth = $$.width - ($$.isLegendRight ? legend.width + 10 : 0), $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10), $$.hasType("gauge") && !config.gauge_fullCircle && ($$.arcHeight += $$.height - $$.getGaugeLabelHeight()), $$.updateRadius && $$.updateRadius(), $$.isLegendRight && hasArc && ($$.margin3.left = $$.arcWidth / 2 + $$.radiusExpanded * 1.1);
|
10250 | }
|
10251 | |
10252 |
|
10253 |
|
10254 |
|
10255 |
|
10256 |
|
10257 | }, {
|
10258 | key: "updateTargets",
|
10259 | value: function updateTargets(targets) {
|
10260 | var $$ = this;
|
10261 |
|
10262 | $$.updateTargetsForText(targets), $$.updateTargetsForBar(targets), $$.updateTargetsForLine(targets), $$.hasArcType(targets) && ($$.hasType("radar") ? $$.updateTargetsForRadar(targets) : $$.updateTargetsForArc(targets)), $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets), $$.showTargets();
|
10263 | }
|
10264 | |
10265 |
|
10266 |
|
10267 |
|
10268 |
|
10269 | }, {
|
10270 | key: "showTargets",
|
10271 | value: function showTargets() {
|
10272 | var $$ = this;
|
10273 | $$.svg.selectAll(".".concat(config_classes.target)).filter(function (d) {
|
10274 | return $$.isTargetToShow(d.id);
|
10275 | }).transition().duration($$.config.transition_duration).style("opacity", "1");
|
10276 | }
|
10277 | }, {
|
10278 | key: "getWithOption",
|
10279 | value: function getWithOption(options) {
|
10280 | var withOptions = {
|
10281 | Y: !0,
|
10282 | Subchart: !0,
|
10283 | Transition: !0,
|
10284 | EventRect: !0,
|
10285 | Dimension: !0,
|
10286 | TrimXDomain: !0,
|
10287 | Transform: !1,
|
10288 | UpdateXDomain: !1,
|
10289 | UpdateOrgXDomain: !1,
|
10290 | Legend: !1,
|
10291 | UpdateXAxis: "UpdateXDomain",
|
10292 | TransitionForExit: "Transition",
|
10293 | TransitionForAxis: "Transition"
|
10294 | };
|
10295 | return Object.keys(withOptions).forEach(function (key) {
|
10296 | var defVal = withOptions[key];
|
10297 | isString(defVal) && (defVal = withOptions[defVal]), withOptions[key] = getOption(options, "with".concat(key), defVal);
|
10298 | }), withOptions;
|
10299 | }
|
10300 | }, {
|
10301 | key: "redraw",
|
10302 | value: function redraw() {
|
10303 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
10304 | transitionsValue = arguments.length > 1 ? arguments[1] : undefined,
|
10305 | $$ = this,
|
10306 | main = $$.main,
|
10307 | config = $$.config,
|
10308 | targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
10309 | initializing = options.initializing,
|
10310 | flow = options.flow,
|
10311 | wth = $$.getWithOption(options),
|
10312 | duration = wth.Transition ? config.transition_duration : 0,
|
10313 | durationForExit = wth.TransitionForExit ? duration : 0,
|
10314 | durationForAxis = wth.TransitionForAxis ? duration : 0,
|
10315 | transitions = transitionsValue || $$.axis.generateTransitions(durationForAxis);
|
10316 | initializing && config.tooltip_init_show || $$.inputType !== "touch" || $$.hideTooltip(), $$.updateSizes(initializing), wth.Legend && config.legend_show ? $$.updateLegend($$.mapToIds($$.data.targets), options, transitions) : wth.Dimension && $$.updateDimension(!0), $$.redrawAxis(targetsToShow, wth, transitions, flow, initializing), $$.updateCircleY(), $$.updateXgridFocus(), config.data_empty_label_text && main.select("text.".concat(config_classes.text, ".").concat(config_classes.empty)).attr("x", $$.width / 2).attr("y", $$.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null), $$.updateGrid(duration), $$.updateRegion(duration), $$.updateBar(durationForExit), $$.updateLine(durationForExit), $$.updateArea(durationForExit), $$.updateCircle(), $$.hasDataLabel() && $$.updateText(durationForExit), $$.redrawTitle && $$.redrawTitle(), $$.arcs && $$.redrawArc(duration, durationForExit, wth.Transform), $$.radars && $$.redrawRadar(duration, durationForExit), $$.mainText && main.selectAll(".".concat(config_classes.selectedCircles)).filter($$.isBarType.bind($$)).selectAll("circle").remove(), config.interaction_enabled && !flow && wth.EventRect && ($$.redrawEventRect(), $$.bindZoomEvent()), $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart), $$.callPluginHook("$redraw", options, duration);
|
10317 | }
|
10318 | |
10319 |
|
10320 |
|
10321 |
|
10322 |
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 | }, {
|
10328 | key: "redrawAxis",
|
10329 | value: function redrawAxis(targetsToShow, wth, transitions, flow, isInit) {
|
10330 | var tickValues,
|
10331 | intervalForCulling,
|
10332 | xDomainForZoom,
|
10333 | $$ = this,
|
10334 | config = $$.config,
|
10335 | hasArcType = $$.hasArcType(),
|
10336 | hasZoom = !!$$.zoomScale;
|
10337 |
|
10338 | if (!hasZoom && $$.isCategorized() && targetsToShow.length === 0 && $$.x.domain([0, $$.axes.x.selectAll(".tick").size()]), $$.x && targetsToShow.length ? (!hasZoom && $$.updateXDomain(targetsToShow, wth.UpdateXDomain, wth.UpdateOrgXDomain, wth.TrimXDomain), !config.axis_x_tick_values && (tickValues = $$.axis.updateXAxisTickValues(targetsToShow))) : $$.xAxis && ($$.xAxis.tickValues([]), $$.subXAxis.tickValues([])), config.zoom_rescale && !flow && (xDomainForZoom = $$.x.orgDomain()), ["y", "y2"].forEach(function (key) {
|
10339 | var axis = $$[key];
|
10340 |
|
10341 | if (axis) {
|
10342 | var tickValues = config["axis_".concat(key, "_tick_values")],
|
10343 | tickCount = config["axis_".concat(key, "_tick_count")];
|
10344 |
|
10345 | if (axis.domain($$.getYDomain(targetsToShow, key, xDomainForZoom)), !tickValues && tickCount) {
|
10346 | var domain = axis.domain();
|
10347 | $$["".concat(key, "Axis")].tickValues($$.axis.generateTickValues(domain, domain.every(function (v) {
|
10348 | return v === 0;
|
10349 | }) ? 1 : tickCount, $$.isTimeSeriesY()));
|
10350 | }
|
10351 | }
|
10352 | }), $$.axis.redraw(transitions, hasArcType, isInit), $$.axis.updateLabels(wth.Transition), (wth.UpdateXDomain || wth.UpdateXAxis) && targetsToShow.length) if (config.axis_x_tick_culling && tickValues) {
|
10353 | for (var i = 1; i < tickValues.length; i++) if (tickValues.length / i < config.axis_x_tick_culling_max) {
|
10354 | intervalForCulling = i;
|
10355 | break;
|
10356 | }
|
10357 |
|
10358 | $$.svg.selectAll(".".concat(config_classes.axisX, " .tick text")).each(function (d) {
|
10359 | var index = tickValues.indexOf(d);
|
10360 | index >= 0 && src_select(this).style("display", index % intervalForCulling ? "none" : "block");
|
10361 | });
|
10362 | } else $$.svg.selectAll(".".concat(config_classes.axisX, " .tick text")).style("display", "block");
|
10363 |
|
10364 | wth.Y && ($$.subY && $$.subY.domain($$.getYDomain(targetsToShow, "y")), $$.subY2 && $$.subY2.domain($$.getYDomain(targetsToShow, "y2")));
|
10365 | }
|
10366 | |
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 |
|
10372 |
|
10373 |
|
10374 |
|
10375 | }, {
|
10376 | key: "generateRedrawList",
|
10377 | value: function generateRedrawList(targetsToShow, flow, duration, withSubchart) {
|
10378 | var $$ = this,
|
10379 | config = $$.config,
|
10380 | shape = $$.getDrawShape();
|
10381 | config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape);
|
10382 |
|
10383 | var flowFn = flow && $$.generateFlow({
|
10384 | targets: targetsToShow,
|
10385 | flow: flow,
|
10386 | duration: flow.duration,
|
10387 | shape: shape,
|
10388 | xv: $$.xv.bind($$)
|
10389 | }),
|
10390 | isTransition = (duration || flowFn) && $$.isTabVisible(),
|
10391 | redrawList = $$.getRedrawList(shape, flow, flowFn, isTransition),
|
10392 | afterRedraw = flow || config.onrendered ? function () {
|
10393 | flowFn && flowFn(), callFn(config.onrendered, $$);
|
10394 | } : null;
|
10395 | if (afterRedraw)
|
10396 | if (isTransition) {
|
10397 |
|
10398 | var waitForDraw = $$.generateWait();
|
10399 |
|
10400 | src_transition_transition().duration(duration).each(function () {
|
10401 | redrawList.reduce(function (acc, t1) {
|
10402 | return acc.concat(t1);
|
10403 | }, []).forEach(function (t) {
|
10404 | return waitForDraw.add(t);
|
10405 | });
|
10406 | }).call(waitForDraw, afterRedraw);
|
10407 | } else afterRedraw();
|
10408 |
|
10409 | $$.mapToIds($$.data.targets).forEach(function (id) {
|
10410 | $$.withoutFadeIn[id] = !0;
|
10411 | });
|
10412 | }
|
10413 | |
10414 |
|
10415 |
|
10416 |
|
10417 |
|
10418 |
|
10419 | }, {
|
10420 | key: "getDrawShape",
|
10421 | value: function getDrawShape() {
|
10422 | var $$ = this,
|
10423 | isRotated = $$.config.axis_rotated,
|
10424 | hasRadar = $$.hasType("radar"),
|
10425 | shape = {
|
10426 | type: {},
|
10427 | indices: {}
|
10428 | };
|
10429 |
|
10430 |
|
10431 | if ($$.hasTypeOf("Line") || $$.hasType("bubble") || $$.hasType("scatter")) {
|
10432 | var indices = $$.getShapeIndices($$.isLineType);
|
10433 |
|
10434 | if (shape.indices.line = indices, shape.type.line = $$.generateDrawLine ? $$.generateDrawLine(indices, !1) : undefined, $$.hasTypeOf("Area")) {
|
10435 | var _indices = $$.getShapeIndices($$.isAreaType);
|
10436 |
|
10437 | shape.indices.area = _indices, shape.type.area = $$.generateDrawArea ? $$.generateDrawArea(_indices, !1) : undefined;
|
10438 | }
|
10439 | }
|
10440 |
|
10441 | if ($$.hasType("bar")) {
|
10442 | var _indices2 = $$.getShapeIndices($$.isBarType);
|
10443 |
|
10444 | shape.indices.bar = _indices2, shape.type.bar = $$.generateDrawBar ? $$.generateDrawBar(_indices2) : undefined;
|
10445 | }
|
10446 |
|
10447 | return shape.pos = {
|
10448 | xForText: $$.generateXYForText(shape.indices, !0),
|
10449 | yForText: $$.generateXYForText(shape.indices, !1),
|
10450 |
|
10451 | cx: (hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX).bind($$),
|
10452 | cy: (hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY).bind($$)
|
10453 | }, shape;
|
10454 | }
|
10455 | }, {
|
10456 | key: "getRedrawList",
|
10457 | value: function getRedrawList(shape, flow, flowFn, isTransition) {
|
10458 | var $$ = this,
|
10459 | config = $$.config,
|
10460 | hasArcType = $$.hasArcType(),
|
10461 | _shape$pos = shape.pos,
|
10462 | cx = _shape$pos.cx,
|
10463 | cy = _shape$pos.cy,
|
10464 | xForText = _shape$pos.xForText,
|
10465 | yForText = _shape$pos.yForText,
|
10466 | list = [];
|
10467 |
|
10468 | if (!hasArcType) {
|
10469 | var _shape$type = shape.type,
|
10470 | area = _shape$type.area,
|
10471 | bar = _shape$type.bar,
|
10472 | line = _shape$type.line;
|
10473 | (config.grid_x_lines.length || config.grid_y_lines.length) && list.push($$.redrawGrid(isTransition)), config.regions.length && list.push($$.redrawRegion(isTransition)), $$.hasTypeOf("Line") && (list.push($$.redrawLine(line, isTransition)), $$.hasTypeOf("Area") && list.push($$.redrawArea(area, isTransition))), $$.hasType("bar") && list.push($$.redrawBar(bar, isTransition)), notEmpty(config.data_labels) && list.push($$.redrawText(xForText, yForText, flow, isTransition));
|
10474 | }
|
10475 |
|
10476 | return (!hasArcType || $$.hasType("radar")) && list.push($$.redrawCircle(cx, cy, isTransition, flowFn)), list;
|
10477 | }
|
10478 | }, {
|
10479 | key: "updateAndRedraw",
|
10480 | value: function updateAndRedraw() {
|
10481 | var transitions,
|
10482 | options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
10483 | $$ = this,
|
10484 | config = $$.config;
|
10485 | options.withTransition = getOption(options, "withTransition", !0), options.withTransform = getOption(options, "withTransform", !1), options.withLegend = getOption(options, "withLegend", !1), options.withUpdateXDomain = !0, options.withUpdateOrgXDomain = !0, options.withTransitionForExit = !1, options.withTransitionForTransform = getOption(options, "withTransitionForTransform", options.withTransition), options.withLegend && config.legend_show || (transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0), $$.updateScales(), $$.updateSvgSize(), $$.transformAll(options.withTransitionForTransform, transitions)), $$.redraw(options, transitions);
|
10486 | }
|
10487 | }, {
|
10488 | key: "redrawWithoutRescale",
|
10489 | value: function redrawWithoutRescale() {
|
10490 | this.redraw({
|
10491 | withY: !1,
|
10492 | withSubchart: !1,
|
10493 | withEventRect: !1,
|
10494 | withTransitionForAxis: !1
|
10495 | });
|
10496 | }
|
10497 | }, {
|
10498 | key: "isTimeSeries",
|
10499 | value: function isTimeSeries() {
|
10500 | return this.config.axis_x_type === "timeseries";
|
10501 | }
|
10502 | }, {
|
10503 | key: "isCategorized",
|
10504 | value: function isCategorized() {
|
10505 | return this.config.axis_x_type.indexOf("category") >= 0 || this.hasType("radar");
|
10506 | }
|
10507 | }, {
|
10508 | key: "isCustomX",
|
10509 | value: function isCustomX() {
|
10510 | var $$ = this,
|
10511 | config = $$.config;
|
10512 | return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));
|
10513 | }
|
10514 | }, {
|
10515 | key: "isTimeSeriesY",
|
10516 | value: function isTimeSeriesY() {
|
10517 | return this.config.axis_y_type === "timeseries";
|
10518 | }
|
10519 | }, {
|
10520 | key: "getTranslate",
|
10521 | value: function getTranslate(target) {
|
10522 | var x,
|
10523 | y,
|
10524 | index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0,
|
10525 | $$ = this,
|
10526 | config = $$.config,
|
10527 | isRotated = config.axis_rotated,
|
10528 | padding = 0;
|
10529 | if (index && /^(x|y2?)$/.test(target) && (padding = $$.getAxisSize(target) * index), target === "main") x = asHalfPixel($$.margin.left), y = asHalfPixel($$.margin.top);else if (target === "context") x = asHalfPixel($$.margin2.left), y = asHalfPixel($$.margin2.top);else if (target === "legend") x = $$.margin3.left, y = $$.margin3.top;else if (target === "x") x = isRotated ? -padding : 0, y = isRotated ? 0 : $$.height + padding;else if (target === "y") x = isRotated ? 0 : -padding, y = isRotated ? $$.height + padding : 0;else if (target === "y2") x = isRotated ? 0 : $$.width + padding, y = isRotated ? 1 - padding : 0;else if (target === "subx") x = 0, y = isRotated ? 0 : $$.height2;else if (target === "arc") x = $$.arcWidth / 2, y = $$.arcHeight / 2;else if (target === "radar") {
|
10530 | var _$$$getRadarSize = $$.getRadarSize(),
|
10531 | _$$$getRadarSize2 = slicedToArray_default()(_$$$getRadarSize, 1),
|
10532 | width = _$$$getRadarSize2[0];
|
10533 |
|
10534 | x = $$.width / 2 - width, y = asHalfPixel($$.margin.top);
|
10535 | }
|
10536 | return "translate(".concat(x, ", ").concat(y, ")");
|
10537 | }
|
10538 | }, {
|
10539 | key: "initialOpacity",
|
10540 | value: function initialOpacity(d) {
|
10541 | return this.getBaseValue(d) !== null && this.withoutFadeIn[d.id] ? "1" : "0";
|
10542 | }
|
10543 | }, {
|
10544 | key: "initialOpacityForCircle",
|
10545 | value: function initialOpacityForCircle(d) {
|
10546 | return this.getBaseValue(d) !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0";
|
10547 | }
|
10548 | }, {
|
10549 | key: "opacityForCircle",
|
10550 | value: function opacityForCircle(d) {
|
10551 | var opacity = this.config.point_show ? "1" : "0";
|
10552 | return isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0";
|
10553 | }
|
10554 | }, {
|
10555 | key: "opacityForText",
|
10556 | value: function opacityForText() {
|
10557 | return this.hasDataLabel() ? "1" : "0";
|
10558 | }
|
10559 | }, {
|
10560 | key: "xx",
|
10561 | value: function xx(d) {
|
10562 | var fn = this.config.zoom_enabled && this.zoomScale ? this.zoomScale : this.x;
|
10563 | return d ? fn(d.x) : null;
|
10564 | }
|
10565 | }, {
|
10566 | key: "xv",
|
10567 | value: function xv(d) {
|
10568 | var $$ = this,
|
10569 | value = $$.getBaseValue(d);
|
10570 | return $$.isTimeSeries() ? value = $$.parseDate(value) : $$.isCategorized() && isString(value) && (value = $$.config.axis_x_categories.indexOf(value)), Math.ceil($$.x(value));
|
10571 | }
|
10572 | }, {
|
10573 | key: "yv",
|
10574 | value: function yv(d) {
|
10575 | var $$ = this,
|
10576 | yScale = d.axis && d.axis === "y2" ? $$.y2 : $$.y;
|
10577 | return Math.ceil(yScale($$.getBaseValue(d)));
|
10578 | }
|
10579 | }, {
|
10580 | key: "subxx",
|
10581 | value: function subxx(d) {
|
10582 | return d ? this.subX(d.x) : null;
|
10583 | }
|
10584 | }, {
|
10585 | key: "transformMain",
|
10586 | value: function transformMain(withTransition, transitions) {
|
10587 | var xAxis,
|
10588 | yAxis,
|
10589 | y2Axis,
|
10590 | $$ = this;
|
10591 | transitions && transitions.axisX ? xAxis = transitions.axisX : (xAxis = $$.main.select(".".concat(config_classes.axisX)), withTransition && (xAxis = xAxis.transition())), transitions && transitions.axisY ? yAxis = transitions.axisY : (yAxis = $$.main.select(".".concat(config_classes.axisY)), withTransition && (yAxis = yAxis.transition())), transitions && transitions.axisY2 ? y2Axis = transitions.axisY2 : (y2Axis = $$.main.select(".".concat(config_classes.axisY2)), withTransition && (y2Axis = y2Axis.transition())), (withTransition ? $$.main.transition() : $$.main).attr("transform", $$.getTranslate("main")), xAxis.attr("transform", $$.getTranslate("x")), yAxis.attr("transform", $$.getTranslate("y")), y2Axis.attr("transform", $$.getTranslate("y2")), $$.main.select(".".concat(config_classes.chartArcs)).attr("transform", $$.getTranslate("arc"));
|
10592 | }
|
10593 | }, {
|
10594 | key: "transformAll",
|
10595 | value: function transformAll(withTransition, transitions) {
|
10596 | var $$ = this;
|
10597 | $$.transformMain(withTransition, transitions), $$.config.subchart_show && $$.transformContext(withTransition, transitions), $$.legend && $$.transformLegend(withTransition);
|
10598 | }
|
10599 | }, {
|
10600 | key: "updateSvgSize",
|
10601 | value: function updateSvgSize() {
|
10602 | var $$ = this,
|
10603 | brush = $$.svg.select(".".concat(config_classes.brush, " .overlay")),
|
10604 | brushSize = {
|
10605 | width: 0,
|
10606 | height: 0
|
10607 | };
|
10608 | brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), $$.svg.attr("width", $$.currentWidth).attr("height", $$.currentHeight), $$.svg.selectAll(["#".concat($$.clipId), "#".concat($$.clipIdForGrid)]).select("rect").attr("width", $$.width).attr("height", $$.height), $$.svg.select("#".concat($$.clipIdForXAxis)).select("rect").attr("x", $$.getXAxisClipX.bind($$)).attr("y", $$.getXAxisClipY.bind($$)).attr("width", $$.getXAxisClipWidth.bind($$)).attr("height", $$.getXAxisClipHeight.bind($$)), $$.svg.select("#".concat($$.clipIdForYAxis)).select("rect").attr("x", $$.getYAxisClipX.bind($$)).attr("y", $$.getYAxisClipY.bind($$)).attr("width", $$.getYAxisClipWidth.bind($$)).attr("height", $$.getYAxisClipHeight.bind($$)), $$.svg.select("#".concat($$.clipIdForSubchart)).select("rect").attr("width", $$.width).attr("height", brushSize.height), $$.svg.select(".".concat(config_classes.zoomRect)).attr("width", $$.width).attr("height", $$.height);
|
10609 | }
|
10610 | }, {
|
10611 | key: "updateDimension",
|
10612 | value: function updateDimension(withoutAxis) {
|
10613 | var $$ = this;
|
10614 | withoutAxis || ($$.xAxis && $$.config.axis_rotated ? ($$.xAxis.create($$.axes.x), $$.subXAxis.create($$.axes.subx)) : ($$.yAxis && $$.yAxis.create($$.axes.y), $$.y2Axis && $$.y2Axis.create($$.axes.y2))), $$.updateScales(withoutAxis), $$.updateSvgSize(), $$.transformAll(!1);
|
10615 | }
|
10616 | }, {
|
10617 | key: "bindResize",
|
10618 | value: function bindResize() {
|
10619 | var $$ = this,
|
10620 | config = $$.config;
|
10621 | $$.resizeFunction = $$.generateResize(), $$.resizeFunction.add(config.onresize.bind($$)), config.resize_auto && $$.resizeFunction.add(function () {
|
10622 | $$.resizeTimeout && (browser["window"].clearTimeout($$.resizeTimeout), $$.resizeTimeout = null), $$.resizeTimeout = browser["window"].setTimeout(function () {
|
10623 | $$.api.flush(!1, !0);
|
10624 | }, 200);
|
10625 | }), $$.resizeFunction.add(config.onresized.bind($$)), browser["window"].addEventListener("resize", $$.resizeFunction);
|
10626 | }
|
10627 | }, {
|
10628 | key: "generateResize",
|
10629 | value: function generateResize() {
|
10630 | function callResizeFunctions() {
|
10631 | resizeFunctions.forEach(function (f) {
|
10632 | return f();
|
10633 | });
|
10634 | }
|
10635 |
|
10636 | var resizeFunctions = [];
|
10637 | return callResizeFunctions.add = function (f) {
|
10638 | return resizeFunctions.push(f);
|
10639 | }, callResizeFunctions.remove = function (f) {
|
10640 | return resizeFunctions.splice(resizeFunctions.indexOf(f), 1);
|
10641 | }, callResizeFunctions;
|
10642 | }
|
10643 | }, {
|
10644 | key: "endall",
|
10645 | value: function endall(transition, callback) {
|
10646 | var n = 0;
|
10647 | transition.each(function () {
|
10648 | return ++n;
|
10649 | }).on("end", function () {
|
10650 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
10651 |
|
10652 | --n || callback.apply.apply(callback, [this].concat(args));
|
10653 | });
|
10654 | }
|
10655 | }, {
|
10656 | key: "generateWait",
|
10657 | value: function generateWait() {
|
10658 | var transitionsToWait = [],
|
10659 | f = function (transition, callback) {
|
10660 | function loop() {
|
10661 | var done = 0;
|
10662 | transitionsToWait.forEach(function (t) {
|
10663 | if (t.empty()) return void done++;
|
10664 |
|
10665 | try {
|
10666 | t.transition();
|
10667 | } catch (e) {
|
10668 | done++;
|
10669 | }
|
10670 | }), timer && clearTimeout(timer), done === transitionsToWait.length ? callback && callback() : timer = setTimeout(loop, 50);
|
10671 | }
|
10672 |
|
10673 | var timer;
|
10674 | loop();
|
10675 | };
|
10676 |
|
10677 | return f.add = function (transition) {
|
10678 | isArray(transition) ? transitionsToWait = transitionsToWait.concat(transition) : transitionsToWait.push(transition);
|
10679 | }, f;
|
10680 | }
|
10681 | }, {
|
10682 | key: "parseDate",
|
10683 | value: function parseDate(date) {
|
10684 | var parsedDate,
|
10685 | $$ = this;
|
10686 | return date instanceof Date ? parsedDate = date : isString(date) ? parsedDate = $$.dataTimeFormat($$.config.data_xFormat)(date) : isNumber(date) && !isNaN(date) && (parsedDate = new Date(+date)), (!parsedDate || isNaN(+parsedDate)) && console && console.error && console.error("Failed to parse x '".concat(date, "' to Date object")), parsedDate;
|
10687 | }
|
10688 | }, {
|
10689 | key: "isTabVisible",
|
10690 | value: function isTabVisible() {
|
10691 | return !browser["document"].hidden;
|
10692 | }
|
10693 | }, {
|
10694 | key: "convertInputType",
|
10695 | value: function convertInputType() {
|
10696 | var $$ = this,
|
10697 | config = $$.config,
|
10698 | isMobile = browser["window"].navigator && "maxTouchPoints" in browser["window"].navigator && browser["window"].navigator.maxTouchPoints > 0 || !1,
|
10699 | hasMouse = config.interaction_inputType_mouse && !isMobile && "onmouseover" in browser["window"],
|
10700 | hasTouch = !1;
|
10701 | return config.interaction_inputType_touch && (hasTouch = "ontouchmove" in browser["window"] || browser["window"].DocumentTouch && browser["document"] instanceof browser["window"].DocumentTouch), hasMouse && "mouse" || hasTouch && "touch" || null;
|
10702 | }
|
10703 | |
10704 |
|
10705 |
|
10706 |
|
10707 |
|
10708 |
|
10709 | }, {
|
10710 | key: "callPluginHook",
|
10711 | value: function callPluginHook(phase) {
|
10712 | for (var _this2 = this, _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
10713 |
|
10714 | this.config.plugins.forEach(function (v) {
|
10715 | phase === "$beforeInit" && (v.$$ = _this2, _this2.api.plugins.push(v)), v[phase].apply(v, args);
|
10716 | });
|
10717 | }
|
10718 | }]), ChartInternal;
|
10719 | }();
|
10720 |
|
10721 |
|
10722 |
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 |
|
10733 |
|
10734 |
|
10735 |
|
10736 |
|
10737 |
|
10738 |
|
10739 |
|
10740 |
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 |
|
10748 |
|
10749 |
|
10750 |
|
10751 |
|
10752 |
|
10753 |
|
10754 |
|
10755 |
|
10756 |
|
10757 |
|
10758 |
|
10759 |
|
10760 |
|
10761 |
|
10762 |
|
10763 |
|
10764 |
|
10765 |
|
10766 |
|
10767 |
|
10768 |
|
10769 |
|
10770 |
|
10771 |
|
10772 |
|
10773 |
|
10774 |
|
10775 |
|
10776 |
|
10777 | var Chart_Chart = function Chart(config) {
|
10778 | classCallCheck_default()(this, Chart);
|
10779 |
|
10780 | var $$ = new ChartInternal_ChartInternal(this);
|
10781 | |
10782 |
|
10783 |
|
10784 |
|
10785 |
|
10786 |
|
10787 |
|
10788 |
|
10789 |
|
10790 |
|
10791 |
|
10792 |
|
10793 |
|
10794 |
|
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 | this.plugins = [], this.internal = $$, $$.loadConfig(config), $$.beforeInit(config), $$.init(), this.$ = $$.getChartElements(), $$.afterInit(config), function bindThis(fn, target, argThis) {
|
10801 | Object.keys(fn).forEach(function (key) {
|
10802 | target[key] = fn[key].bind(argThis), Object.keys(fn[key]).length && bindThis(fn[key], target[key], argThis);
|
10803 | });
|
10804 | }(Chart.prototype, this, this);
|
10805 | };
|
10806 |
|
10807 |
|
10808 |
|
10809 |
|
10810 |
|
10811 |
|
10812 |
|
10813 |
|
10814 |
|
10815 |
|
10816 |
|
10817 |
|
10818 |
|
10819 |
|
10820 |
|
10821 |
|
10822 | var Options_Options = function Options() {
|
10823 | return classCallCheck_default()(this, Options), {
|
10824 | |
10825 |
|
10826 |
|
10827 |
|
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 |
|
10834 |
|
10835 |
|
10836 |
|
10837 |
|
10838 |
|
10839 |
|
10840 |
|
10841 |
|
10842 |
|
10843 |
|
10844 |
|
10845 |
|
10846 |
|
10847 |
|
10848 |
|
10849 |
|
10850 | bindto: "#chart",
|
10851 |
|
10852 | |
10853 |
|
10854 |
|
10855 |
|
10856 |
|
10857 |
|
10858 |
|
10859 |
|
10860 |
|
10861 |
|
10862 |
|
10863 |
|
10864 |
|
10865 |
|
10866 | clipPath: !0,
|
10867 |
|
10868 | |
10869 |
|
10870 |
|
10871 |
|
10872 |
|
10873 |
|
10874 |
|
10875 |
|
10876 |
|
10877 |
|
10878 |
|
10879 | svg_classname: undefined,
|
10880 |
|
10881 | |
10882 |
|
10883 |
|
10884 |
|
10885 |
|
10886 |
|
10887 |
|
10888 |
|
10889 |
|
10890 |
|
10891 |
|
10892 |
|
10893 |
|
10894 |
|
10895 |
|
10896 | size_width: undefined,
|
10897 | size_height: undefined,
|
10898 |
|
10899 | |
10900 |
|
10901 |
|
10902 |
|
10903 |
|
10904 |
|
10905 |
|
10906 |
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 |
|
10914 |
|
10915 |
|
10916 | padding_left: undefined,
|
10917 | padding_right: undefined,
|
10918 | padding_top: undefined,
|
10919 | padding_bottom: undefined,
|
10920 |
|
10921 | |
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 | resize_auto: !0,
|
10933 |
|
10934 | |
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 |
|
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 |
|
10947 |
|
10948 |
|
10949 |
|
10950 |
|
10951 |
|
10952 |
|
10953 |
|
10954 |
|
10955 |
|
10956 |
|
10957 |
|
10958 |
|
10959 |
|
10960 |
|
10961 |
|
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 |
|
10967 |
|
10968 |
|
10969 |
|
10970 |
|
10971 |
|
10972 |
|
10973 |
|
10974 |
|
10975 |
|
10976 |
|
10977 |
|
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 | zoom_enabled: undefined,
|
10984 | zoom_extent: undefined,
|
10985 | zoom_privileged: !1,
|
10986 | zoom_rescale: !1,
|
10987 | zoom_onzoom: undefined,
|
10988 | zoom_onzoomstart: undefined,
|
10989 | zoom_onzoomend: undefined,
|
10990 | zoom_resetButton: !0,
|
10991 | zoom_x_min: undefined,
|
10992 | zoom_x_max: undefined,
|
10993 |
|
10994 | |
10995 |
|
10996 |
|
10997 |
|
10998 |
|
10999 |
|
11000 |
|
11001 |
|
11002 |
|
11003 |
|
11004 |
|
11005 |
|
11006 |
|
11007 |
|
11008 |
|
11009 |
|
11010 |
|
11011 |
|
11012 |
|
11013 |
|
11014 |
|
11015 |
|
11016 |
|
11017 |
|
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 |
|
11025 | interaction_enabled: !0,
|
11026 | interaction_brighten: !0,
|
11027 | interaction_inputType_mouse: !0,
|
11028 | interaction_inputType_touch: {},
|
11029 |
|
11030 | |
11031 |
|
11032 |
|
11033 |
|
11034 |
|
11035 |
|
11036 |
|
11037 |
|
11038 |
|
11039 |
|
11040 |
|
11041 | onover: function onover() {},
|
11042 |
|
11043 | |
11044 |
|
11045 |
|
11046 |
|
11047 |
|
11048 |
|
11049 |
|
11050 |
|
11051 |
|
11052 |
|
11053 |
|
11054 | onout: function onout() {},
|
11055 |
|
11056 | |
11057 |
|
11058 |
|
11059 |
|
11060 |
|
11061 |
|
11062 |
|
11063 |
|
11064 |
|
11065 |
|
11066 |
|
11067 | onresize: function onresize() {},
|
11068 |
|
11069 | |
11070 |
|
11071 |
|
11072 |
|
11073 |
|
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 | onresized: function onresized() {},
|
11081 |
|
11082 | |
11083 |
|
11084 |
|
11085 |
|
11086 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 |
|
11092 |
|
11093 | onbeforeinit: undefined,
|
11094 |
|
11095 | |
11096 |
|
11097 |
|
11098 |
|
11099 |
|
11100 |
|
11101 |
|
11102 |
|
11103 |
|
11104 |
|
11105 |
|
11106 | oninit: function oninit() {},
|
11107 |
|
11108 | |
11109 |
|
11110 |
|
11111 |
|
11112 |
|
11113 |
|
11114 |
|
11115 |
|
11116 |
|
11117 |
|
11118 |
|
11119 | onafterinit: undefined,
|
11120 |
|
11121 | |
11122 |
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 |
|
11129 |
|
11130 |
|
11131 |
|
11132 | onrendered: undefined,
|
11133 |
|
11134 | |
11135 |
|
11136 |
|
11137 |
|
11138 |
|
11139 |
|
11140 |
|
11141 |
|
11142 |
|
11143 |
|
11144 |
|
11145 |
|
11146 | transition_duration: 350,
|
11147 |
|
11148 | |
11149 |
|
11150 |
|
11151 |
|
11152 |
|
11153 |
|
11154 |
|
11155 |
|
11156 |
|
11157 |
|
11158 |
|
11159 |
|
11160 | data_x: undefined,
|
11161 |
|
11162 | |
11163 |
|
11164 |
|
11165 |
|
11166 |
|
11167 |
|
11168 |
|
11169 |
|
11170 |
|
11171 |
|
11172 |
|
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 | data_xs: {},
|
11178 |
|
11179 | |
11180 |
|
11181 |
|
11182 |
|
11183 |
|
11184 |
|
11185 |
|
11186 |
|
11187 |
|
11188 |
|
11189 |
|
11190 |
|
11191 |
|
11192 |
|
11193 |
|
11194 |
|
11195 |
|
11196 |
|
11197 |
|
11198 |
|
11199 |
|
11200 |
|
11201 |
|
11202 | data_xFormat: "%Y-%m-%d",
|
11203 |
|
11204 | |
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 |
|
11210 |
|
11211 |
|
11212 |
|
11213 |
|
11214 |
|
11215 | data_xLocaltime: !0,
|
11216 |
|
11217 | |
11218 |
|
11219 |
|
11220 |
|
11221 |
|
11222 |
|
11223 |
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 | data_xSort: !0,
|
11229 |
|
11230 | |
11231 |
|
11232 |
|
11233 |
|
11234 |
|
11235 |
|
11236 |
|
11237 |
|
11238 |
|
11239 |
|
11240 |
|
11241 |
|
11242 |
|
11243 |
|
11244 |
|
11245 |
|
11246 |
|
11247 |
|
11248 |
|
11249 | data_idConverter: function data_idConverter(id) {
|
11250 | return id;
|
11251 | },
|
11252 |
|
11253 | |
11254 |
|
11255 |
|
11256 |
|
11257 |
|
11258 |
|
11259 |
|
11260 |
|
11261 |
|
11262 |
|
11263 |
|
11264 |
|
11265 |
|
11266 |
|
11267 |
|
11268 | data_names: {},
|
11269 |
|
11270 | |
11271 |
|
11272 |
|
11273 |
|
11274 |
|
11275 |
|
11276 |
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 |
|
11285 | data_classes: {},
|
11286 |
|
11287 | |
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 |
|
11298 |
|
11299 |
|
11300 |
|
11301 | data_groups: [],
|
11302 |
|
11303 | |
11304 |
|
11305 |
|
11306 |
|
11307 |
|
11308 |
|
11309 |
|
11310 |
|
11311 |
|
11312 |
|
11313 |
|
11314 |
|
11315 |
|
11316 |
|
11317 | data_axes: {},
|
11318 |
|
11319 | |
11320 |
|
11321 |
|
11322 |
|
11323 |
|
11324 |
|
11325 |
|
11326 |
|
11327 |
|
11328 |
|
11329 |
|
11330 |
|
11331 |
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 |
|
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 |
|
11346 |
|
11347 | data_type: undefined,
|
11348 |
|
11349 | |
11350 |
|
11351 |
|
11352 |
|
11353 |
|
11354 |
|
11355 |
|
11356 |
|
11357 |
|
11358 |
|
11359 |
|
11360 |
|
11361 |
|
11362 |
|
11363 |
|
11364 |
|
11365 | data_types: {},
|
11366 |
|
11367 | |
11368 |
|
11369 |
|
11370 |
|
11371 |
|
11372 |
|
11373 |
|
11374 |
|
11375 |
|
11376 |
|
11377 |
|
11378 |
|
11379 |
|
11380 |
|
11381 |
|
11382 |
|
11383 |
|
11384 |
|
11385 |
|
11386 |
|
11387 |
|
11388 |
|
11389 |
|
11390 |
|
11391 |
|
11392 |
|
11393 |
|
11394 |
|
11395 |
|
11396 |
|
11397 |
|
11398 |
|
11399 |
|
11400 |
|
11401 |
|
11402 |
|
11403 |
|
11404 |
|
11405 |
|
11406 |
|
11407 |
|
11408 |
|
11409 |
|
11410 |
|
11411 |
|
11412 |
|
11413 |
|
11414 |
|
11415 |
|
11416 |
|
11417 |
|
11418 |
|
11419 |
|
11420 |
|
11421 |
|
11422 |
|
11423 |
|
11424 |
|
11425 |
|
11426 | data_labels: {},
|
11427 | data_labels_colors: undefined,
|
11428 | data_labels_position: {},
|
11429 |
|
11430 | |
11431 |
|
11432 |
|
11433 |
|
11434 |
|
11435 |
|
11436 |
|
11437 |
|
11438 |
|
11439 |
|
11440 |
|
11441 |
|
11442 |
|
11443 |
|
11444 |
|
11445 |
|
11446 |
|
11447 |
|
11448 |
|
11449 |
|
11450 |
|
11451 |
|
11452 |
|
11453 |
|
11454 |
|
11455 |
|
11456 |
|
11457 |
|
11458 |
|
11459 |
|
11460 |
|
11461 |
|
11462 |
|
11463 |
|
11464 |
|
11465 |
|
11466 |
|
11467 |
|
11468 | data_order: "desc",
|
11469 |
|
11470 | |
11471 |
|
11472 |
|
11473 |
|
11474 |
|
11475 |
|
11476 |
|
11477 |
|
11478 |
|
11479 |
|
11480 |
|
11481 |
|
11482 |
|
11483 |
|
11484 |
|
11485 |
|
11486 |
|
11487 |
|
11488 |
|
11489 |
|
11490 |
|
11491 |
|
11492 |
|
11493 |
|
11494 |
|
11495 |
|
11496 |
|
11497 |
|
11498 | data_regions: {},
|
11499 |
|
11500 | |
11501 |
|
11502 |
|
11503 |
|
11504 |
|
11505 |
|
11506 |
|
11507 |
|
11508 |
|
11509 |
|
11510 |
|
11511 |
|
11512 |
|
11513 | data_color: undefined,
|
11514 |
|
11515 | |
11516 |
|
11517 |
|
11518 |
|
11519 |
|
11520 |
|
11521 |
|
11522 |
|
11523 |
|
11524 |
|
11525 |
|
11526 |
|
11527 |
|
11528 |
|
11529 |
|
11530 |
|
11531 |
|
11532 | data_colors: {},
|
11533 |
|
11534 | |
11535 |
|
11536 |
|
11537 |
|
11538 |
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 |
|
11544 |
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 |
|
11550 | data_hide: !1,
|
11551 |
|
11552 | |
11553 |
|
11554 |
|
11555 |
|
11556 |
|
11557 |
|
11558 |
|
11559 |
|
11560 |
|
11561 |
|
11562 |
|
11563 |
|
11564 |
|
11565 |
|
11566 |
|
11567 |
|
11568 |
|
11569 |
|
11570 | data_filter: undefined,
|
11571 |
|
11572 | |
11573 |
|
11574 |
|
11575 |
|
11576 |
|
11577 |
|
11578 |
|
11579 |
|
11580 |
|
11581 |
|
11582 |
|
11583 |
|
11584 |
|
11585 |
|
11586 |
|
11587 |
|
11588 |
|
11589 |
|
11590 | data_stack_normalize: !1,
|
11591 |
|
11592 | |
11593 |
|
11594 |
|
11595 |
|
11596 |
|
11597 |
|
11598 |
|
11599 |
|
11600 |
|
11601 |
|
11602 |
|
11603 |
|
11604 |
|
11605 |
|
11606 |
|
11607 | data_selection_enabled: !1,
|
11608 |
|
11609 | |
11610 |
|
11611 |
|
11612 |
|
11613 |
|
11614 |
|
11615 |
|
11616 |
|
11617 |
|
11618 |
|
11619 |
|
11620 |
|
11621 |
|
11622 |
|
11623 | data_selection_grouped: !1,
|
11624 |
|
11625 | |
11626 |
|
11627 |
|
11628 |
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 | data_selection_isselectable: function data_selection_isselectable() {
|
11640 | return !0;
|
11641 | },
|
11642 |
|
11643 | |
11644 |
|
11645 |
|
11646 |
|
11647 |
|
11648 |
|
11649 |
|
11650 |
|
11651 |
|
11652 |
|
11653 |
|
11654 |
|
11655 |
|
11656 |
|
11657 | data_selection_multiple: !0,
|
11658 |
|
11659 | |
11660 |
|
11661 |
|
11662 |
|
11663 |
|
11664 |
|
11665 |
|
11666 |
|
11667 |
|
11668 |
|
11669 |
|
11670 |
|
11671 |
|
11672 |
|
11673 |
|
11674 | data_selection_draggable: !1,
|
11675 |
|
11676 | |
11677 |
|
11678 |
|
11679 |
|
11680 |
|
11681 |
|
11682 |
|
11683 |
|
11684 |
|
11685 |
|
11686 |
|
11687 |
|
11688 | data_onclick: function data_onclick() {},
|
11689 |
|
11690 | |
11691 |
|
11692 |
|
11693 |
|
11694 |
|
11695 |
|
11696 |
|
11697 |
|
11698 |
|
11699 |
|
11700 |
|
11701 |
|
11702 | data_onover: function data_onover() {},
|
11703 |
|
11704 | |
11705 |
|
11706 |
|
11707 |
|
11708 |
|
11709 |
|
11710 |
|
11711 |
|
11712 |
|
11713 |
|
11714 |
|
11715 |
|
11716 | data_onout: function data_onout() {},
|
11717 |
|
11718 | |
11719 |
|
11720 |
|
11721 |
|
11722 |
|
11723 |
|
11724 |
|
11725 |
|
11726 |
|
11727 |
|
11728 |
|
11729 |
|
11730 |
|
11731 |
|
11732 |
|
11733 | data_onselected: function data_onselected() {},
|
11734 |
|
11735 | |
11736 |
|
11737 |
|
11738 |
|
11739 |
|
11740 |
|
11741 |
|
11742 |
|
11743 |
|
11744 |
|
11745 |
|
11746 |
|
11747 |
|
11748 |
|
11749 |
|
11750 | data_onunselected: function data_onunselected() {},
|
11751 |
|
11752 | |
11753 |
|
11754 |
|
11755 |
|
11756 |
|
11757 |
|
11758 |
|
11759 |
|
11760 |
|
11761 |
|
11762 |
|
11763 |
|
11764 |
|
11765 |
|
11766 | data_onmin: undefined,
|
11767 |
|
11768 | |
11769 |
|
11770 |
|
11771 |
|
11772 |
|
11773 |
|
11774 |
|
11775 |
|
11776 |
|
11777 |
|
11778 |
|
11779 |
|
11780 |
|
11781 |
|
11782 | data_onmax: undefined,
|
11783 |
|
11784 | |
11785 |
|
11786 |
|
11787 |
|
11788 |
|
11789 |
|
11790 |
|
11791 |
|
11792 |
|
11793 |
|
11794 |
|
11795 |
|
11796 | data_url: undefined,
|
11797 |
|
11798 | |
11799 |
|
11800 |
|
11801 |
|
11802 |
|
11803 |
|
11804 |
|
11805 |
|
11806 |
|
11807 |
|
11808 |
|
11809 |
|
11810 |
|
11811 |
|
11812 |
|
11813 |
|
11814 |
|
11815 | data_headers: undefined,
|
11816 |
|
11817 | |
11818 |
|
11819 |
|
11820 |
|
11821 |
|
11822 |
|
11823 |
|
11824 |
|
11825 |
|
11826 |
|
11827 |
|
11828 |
|
11829 |
|
11830 |
|
11831 |
|
11832 |
|
11833 |
|
11834 |
|
11835 |
|
11836 |
|
11837 |
|
11838 |
|
11839 | data_json: undefined,
|
11840 |
|
11841 | |
11842 |
|
11843 |
|
11844 |
|
11845 |
|
11846 |
|
11847 |
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 |
|
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 |
|
11869 |
|
11870 |
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 |
|
11876 |
|
11877 |
|
11878 |
|
11879 |
|
11880 | data_rows: undefined,
|
11881 |
|
11882 | |
11883 |
|
11884 |
|
11885 |
|
11886 |
|
11887 |
|
11888 |
|
11889 |
|
11890 |
|
11891 |
|
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 |
|
11897 |
|
11898 |
|
11899 |
|
11900 |
|
11901 |
|
11902 |
|
11903 |
|
11904 |
|
11905 |
|
11906 |
|
11907 |
|
11908 |
|
11909 |
|
11910 |
|
11911 |
|
11912 | data_columns: undefined,
|
11913 |
|
11914 | |
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 |
|
11920 |
|
11921 |
|
11922 |
|
11923 |
|
11924 |
|
11925 | data_mimeType: undefined,
|
11926 |
|
11927 | |
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 |
|
11935 |
|
11936 |
|
11937 |
|
11938 |
|
11939 |
|
11940 |
|
11941 |
|
11942 |
|
11943 |
|
11944 |
|
11945 |
|
11946 |
|
11947 |
|
11948 | data_keys: undefined,
|
11949 |
|
11950 | |
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 |
|
11963 |
|
11964 |
|
11965 |
|
11966 | data_empty_label_text: "",
|
11967 |
|
11968 | |
11969 |
|
11970 |
|
11971 |
|
11972 |
|
11973 |
|
11974 |
|
11975 |
|
11976 |
|
11977 |
|
11978 |
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 |
|
11985 |
|
11986 |
|
11987 |
|
11988 |
|
11989 |
|
11990 |
|
11991 |
|
11992 |
|
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 |
|
12000 |
|
12001 | subchart_show: !1,
|
12002 | subchart_size_height: 60,
|
12003 | subchart_axis_x_show: !0,
|
12004 | subchart_axis_x_tick_show: !0,
|
12005 | subchart_axis_x_tick_text_show: !0,
|
12006 | subchart_onbrush: function subchart_onbrush() {},
|
12007 |
|
12008 | |
12009 |
|
12010 |
|
12011 |
|
12012 |
|
12013 |
|
12014 |
|
12015 |
|
12016 |
|
12017 |
|
12018 |
|
12019 |
|
12020 |
|
12021 |
|
12022 |
|
12023 |
|
12024 |
|
12025 |
|
12026 |
|
12027 |
|
12028 |
|
12029 |
|
12030 |
|
12031 |
|
12032 |
|
12033 |
|
12034 |
|
12035 |
|
12036 |
|
12037 |
|
12038 |
|
12039 |
|
12040 |
|
12041 |
|
12042 |
|
12043 |
|
12044 |
|
12045 |
|
12046 |
|
12047 |
|
12048 |
|
12049 |
|
12050 |
|
12051 |
|
12052 |
|
12053 |
|
12054 |
|
12055 |
|
12056 |
|
12057 |
|
12058 |
|
12059 |
|
12060 |
|
12061 |
|
12062 |
|
12063 |
|
12064 |
|
12065 |
|
12066 |
|
12067 |
|
12068 |
|
12069 |
|
12070 |
|
12071 |
|
12072 |
|
12073 |
|
12074 |
|
12075 |
|
12076 |
|
12077 |
|
12078 |
|
12079 |
|
12080 |
|
12081 | color_pattern: [],
|
12082 | color_tiles: undefined,
|
12083 | color_threshold: {},
|
12084 | color_onover: undefined,
|
12085 |
|
12086 | |
12087 |
|
12088 |
|
12089 |
|
12090 |
|
12091 |
|
12092 |
|
12093 |
|
12094 |
|
12095 |
|
12096 |
|
12097 |
|
12098 |
|
12099 |
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 |
|
12105 |
|
12106 |
|
12107 |
|
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 |
|
12115 |
|
12116 |
|
12117 |
|
12118 |
|
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 |
|
12130 |
|
12131 |
|
12132 |
|
12133 |
|
12134 |
|
12135 |
|
12136 |
|
12137 |
|
12138 |
|
12139 |
|
12140 |
|
12141 |
|
12142 |
|
12143 |
|
12144 |
|
12145 |
|
12146 |
|
12147 |
|
12148 |
|
12149 |
|
12150 |
|
12151 |
|
12152 |
|
12153 |
|
12154 |
|
12155 |
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 |
|
12161 |
|
12162 |
|
12163 |
|
12164 |
|
12165 |
|
12166 |
|
12167 |
|
12168 |
|
12169 |
|
12170 | legend_show: !0,
|
12171 | legend_hide: !1,
|
12172 | legend_contents_bindto: undefined,
|
12173 | legend_contents_template: undefined,
|
12174 | legend_position: "bottom",
|
12175 | legend_inset_anchor: "top-left",
|
12176 | legend_inset_x: 10,
|
12177 | legend_inset_y: 0,
|
12178 | legend_inset_step: undefined,
|
12179 | legend_item_onclick: undefined,
|
12180 | legend_item_onover: undefined,
|
12181 | legend_item_onout: undefined,
|
12182 | legend_equally: !1,
|
12183 | legend_padding: 0,
|
12184 | legend_item_tile_width: 10,
|
12185 | legend_item_tile_height: 10,
|
12186 | legend_usePoint: !1,
|
12187 |
|
12188 | |
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 | axis_rotated: !1,
|
12200 |
|
12201 | |
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 | axis_x_clipPath: !0,
|
12213 |
|
12214 | |
12215 |
|
12216 |
|
12217 |
|
12218 |
|
12219 |
|
12220 |
|
12221 |
|
12222 |
|
12223 |
|
12224 |
|
12225 |
|
12226 |
|
12227 | axis_x_show: !0,
|
12228 |
|
12229 | |
12230 |
|
12231 |
|
12232 |
|
12233 |
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 | axis_x_type: "indexed",
|
12250 |
|
12251 | |
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 |
|
12257 |
|
12258 |
|
12259 |
|
12260 |
|
12261 |
|
12262 |
|
12263 |
|
12264 |
|
12265 | axis_x_localtime: !0,
|
12266 |
|
12267 | |
12268 |
|
12269 |
|
12270 |
|
12271 |
|
12272 |
|
12273 |
|
12274 |
|
12275 |
|
12276 |
|
12277 |
|
12278 |
|
12279 |
|
12280 |
|
12281 | axis_x_categories: [],
|
12282 |
|
12283 | |
12284 |
|
12285 |
|
12286 |
|
12287 |
|
12288 |
|
12289 |
|
12290 |
|
12291 |
|
12292 |
|
12293 |
|
12294 |
|
12295 |
|
12296 |
|
12297 |
|
12298 | axis_x_tick_centered: !1,
|
12299 |
|
12300 | |
12301 |
|
12302 |
|
12303 |
|
12304 |
|
12305 |
|
12306 |
|
12307 |
|
12308 |
|
12309 |
|
12310 |
|
12311 |
|
12312 |
|
12313 |
|
12314 |
|
12315 |
|
12316 |
|
12317 |
|
12318 |
|
12319 |
|
12320 |
|
12321 |
|
12322 |
|
12323 |
|
12324 |
|
12325 |
|
12326 |
|
12327 | axis_x_tick_format: undefined,
|
12328 |
|
12329 | |
12330 |
|
12331 |
|
12332 |
|
12333 |
|
12334 |
|
12335 |
|
12336 |
|
12337 |
|
12338 |
|
12339 |
|
12340 |
|
12341 |
|
12342 |
|
12343 |
|
12344 |
|
12345 |
|
12346 |
|
12347 |
|
12348 | axis_x_tick_culling: {},
|
12349 |
|
12350 | |
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 |
|
12362 |
|
12363 |
|
12364 |
|
12365 |
|
12366 |
|
12367 | axis_x_tick_culling_max: 10,
|
12368 |
|
12369 | |
12370 |
|
12371 |
|
12372 |
|
12373 |
|
12374 |
|
12375 |
|
12376 |
|
12377 |
|
12378 |
|
12379 |
|
12380 |
|
12381 |
|
12382 |
|
12383 |
|
12384 |
|
12385 | axis_x_tick_count: undefined,
|
12386 |
|
12387 | |
12388 |
|
12389 |
|
12390 |
|
12391 |
|
12392 |
|
12393 |
|
12394 |
|
12395 |
|
12396 |
|
12397 |
|
12398 |
|
12399 |
|
12400 |
|
12401 |
|
12402 |
|
12403 | axis_x_tick_show: !0,
|
12404 |
|
12405 | |
12406 |
|
12407 |
|
12408 |
|
12409 |
|
12410 |
|
12411 |
|
12412 |
|
12413 |
|
12414 |
|
12415 |
|
12416 |
|
12417 |
|
12418 |
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 | axis_x_tick_text_show: !0,
|
12424 |
|
12425 | |
12426 |
|
12427 |
|
12428 |
|
12429 |
|
12430 |
|
12431 |
|
12432 |
|
12433 |
|
12434 |
|
12435 |
|
12436 |
|
12437 |
|
12438 |
|
12439 |
|
12440 |
|
12441 |
|
12442 |
|
12443 |
|
12444 |
|
12445 | axis_x_tick_text_position: {
|
12446 | x: 0,
|
12447 | y: 0
|
12448 | },
|
12449 |
|
12450 | |
12451 |
|
12452 |
|
12453 |
|
12454 |
|
12455 |
|
12456 |
|
12457 |
|
12458 |
|
12459 |
|
12460 |
|
12461 |
|
12462 |
|
12463 |
|
12464 |
|
12465 |
|
12466 |
|
12467 |
|
12468 |
|
12469 | axis_x_tick_fit: !0,
|
12470 |
|
12471 | |
12472 |
|
12473 |
|
12474 |
|
12475 |
|
12476 |
|
12477 |
|
12478 |
|
12479 |
|
12480 |
|
12481 |
|
12482 |
|
12483 |
|
12484 |
|
12485 |
|
12486 |
|
12487 | axis_x_tick_values: null,
|
12488 |
|
12489 | |
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 |
|
12497 |
|
12498 |
|
12499 |
|
12500 |
|
12501 |
|
12502 |
|
12503 |
|
12504 |
|
12505 |
|
12506 | axis_x_tick_rotate: 0,
|
12507 |
|
12508 | |
12509 |
|
12510 |
|
12511 |
|
12512 |
|
12513 |
|
12514 |
|
12515 |
|
12516 |
|
12517 |
|
12518 |
|
12519 |
|
12520 |
|
12521 |
|
12522 |
|
12523 | axis_x_tick_outer: !0,
|
12524 |
|
12525 | |
12526 |
|
12527 |
|
12528 |
|
12529 |
|
12530 |
|
12531 |
|
12532 |
|
12533 |
|
12534 |
|
12535 |
|
12536 |
|
12537 |
|
12538 |
|
12539 |
|
12540 |
|
12541 |
|
12542 |
|
12543 |
|
12544 |
|
12545 |
|
12546 |
|
12547 |
|
12548 |
|
12549 |
|
12550 |
|
12551 |
|
12552 |
|
12553 | axis_x_tick_multiline: !0,
|
12554 |
|
12555 | |
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 |
|
12561 |
|
12562 |
|
12563 |
|
12564 |
|
12565 |
|
12566 |
|
12567 |
|
12568 |
|
12569 |
|
12570 |
|
12571 |
|
12572 | axis_x_tick_width: null,
|
12573 |
|
12574 | |
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 |
|
12585 |
|
12586 |
|
12587 |
|
12588 |
|
12589 |
|
12590 | axis_x_tick_tooltip: !1,
|
12591 |
|
12592 | |
12593 |
|
12594 |
|
12595 |
|
12596 |
|
12597 |
|
12598 |
|
12599 |
|
12600 |
|
12601 |
|
12602 |
|
12603 |
|
12604 |
|
12605 | axis_x_max: undefined,
|
12606 |
|
12607 | |
12608 |
|
12609 |
|
12610 |
|
12611 |
|
12612 |
|
12613 |
|
12614 |
|
12615 |
|
12616 |
|
12617 |
|
12618 |
|
12619 |
|
12620 | axis_x_min: undefined,
|
12621 |
|
12622 | |
12623 |
|
12624 |
|
12625 |
|
12626 |
|
12627 |
|
12628 |
|
12629 |
|
12630 |
|
12631 |
|
12632 |
|
12633 |
|
12634 |
|
12635 |
|
12636 |
|
12637 |
|
12638 |
|
12639 |
|
12640 |
|
12641 |
|
12642 |
|
12643 |
|
12644 |
|
12645 |
|
12646 |
|
12647 |
|
12648 |
|
12649 |
|
12650 |
|
12651 | axis_x_padding: {},
|
12652 |
|
12653 | |
12654 |
|
12655 |
|
12656 |
|
12657 |
|
12658 |
|
12659 |
|
12660 |
|
12661 |
|
12662 |
|
12663 |
|
12664 |
|
12665 |
|
12666 |
|
12667 | axis_x_height: undefined,
|
12668 |
|
12669 | |
12670 |
|
12671 |
|
12672 |
|
12673 |
|
12674 |
|
12675 |
|
12676 |
|
12677 |
|
12678 |
|
12679 |
|
12680 |
|
12681 |
|
12682 |
|
12683 |
|
12684 |
|
12685 |
|
12686 |
|
12687 |
|
12688 |
|
12689 |
|
12690 |
|
12691 |
|
12692 |
|
12693 |
|
12694 |
|
12695 |
|
12696 |
|
12697 | axis_x_extent: undefined,
|
12698 |
|
12699 | |
12700 |
|
12701 |
|
12702 |
|
12703 |
|
12704 |
|
12705 |
|
12706 |
|
12707 |
|
12708 |
|
12709 |
|
12710 |
|
12711 |
|
12712 |
|
12713 |
|
12714 |
|
12715 |
|
12716 |
|
12717 |
|
12718 |
|
12719 |
|
12720 |
|
12721 |
|
12722 |
|
12723 |
|
12724 |
|
12725 |
|
12726 |
|
12727 |
|
12728 |
|
12729 |
|
12730 |
|
12731 |
|
12732 |
|
12733 |
|
12734 |
|
12735 |
|
12736 | axis_x_label: {},
|
12737 |
|
12738 | |
12739 |
|
12740 |
|
12741 |
|
12742 |
|
12743 |
|
12744 |
|
12745 |
|
12746 |
|
12747 |
|
12748 |
|
12749 |
|
12750 |
|
12751 |
|
12752 |
|
12753 |
|
12754 |
|
12755 |
|
12756 |
|
12757 |
|
12758 |
|
12759 |
|
12760 |
|
12761 |
|
12762 |
|
12763 |
|
12764 |
|
12765 |
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 | axis_x_axes: [],
|
12772 |
|
12773 | |
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 |
|
12783 | axis_y_clipPath: !0,
|
12784 |
|
12785 | |
12786 |
|
12787 |
|
12788 |
|
12789 |
|
12790 |
|
12791 |
|
12792 |
|
12793 |
|
12794 |
|
12795 |
|
12796 |
|
12797 |
|
12798 | axis_y_show: !0,
|
12799 |
|
12800 | |
12801 |
|
12802 |
|
12803 |
|
12804 |
|
12805 |
|
12806 |
|
12807 |
|
12808 |
|
12809 |
|
12810 |
|
12811 |
|
12812 |
|
12813 |
|
12814 |
|
12815 |
|
12816 |
|
12817 | axis_y_type: undefined,
|
12818 |
|
12819 | |
12820 |
|
12821 |
|
12822 |
|
12823 |
|
12824 |
|
12825 |
|
12826 |
|
12827 |
|
12828 |
|
12829 |
|
12830 |
|
12831 |
|
12832 |
|
12833 | axis_y_max: undefined,
|
12834 |
|
12835 | |
12836 |
|
12837 |
|
12838 |
|
12839 |
|
12840 |
|
12841 |
|
12842 |
|
12843 |
|
12844 |
|
12845 |
|
12846 |
|
12847 |
|
12848 |
|
12849 |
|
12850 | axis_y_min: undefined,
|
12851 |
|
12852 | |
12853 |
|
12854 |
|
12855 |
|
12856 |
|
12857 |
|
12858 |
|
12859 |
|
12860 |
|
12861 |
|
12862 |
|
12863 |
|
12864 |
|
12865 |
|
12866 | axis_y_inverted: !1,
|
12867 |
|
12868 | |
12869 |
|
12870 |
|
12871 |
|
12872 |
|
12873 |
|
12874 |
|
12875 |
|
12876 |
|
12877 |
|
12878 |
|
12879 |
|
12880 |
|
12881 | axis_y_center: undefined,
|
12882 |
|
12883 | |
12884 |
|
12885 |
|
12886 |
|
12887 |
|
12888 |
|
12889 |
|
12890 |
|
12891 |
|
12892 |
|
12893 |
|
12894 |
|
12895 |
|
12896 | axis_y_inner: !1,
|
12897 |
|
12898 | |
12899 |
|
12900 |
|
12901 |
|
12902 |
|
12903 |
|
12904 |
|
12905 |
|
12906 |
|
12907 |
|
12908 |
|
12909 |
|
12910 |
|
12911 |
|
12912 |
|
12913 |
|
12914 |
|
12915 |
|
12916 |
|
12917 |
|
12918 |
|
12919 |
|
12920 |
|
12921 | axis_y_label: {},
|
12922 |
|
12923 | |
12924 |
|
12925 |
|
12926 |
|
12927 |
|
12928 |
|
12929 |
|
12930 |
|
12931 |
|
12932 |
|
12933 |
|
12934 |
|
12935 |
|
12936 |
|
12937 |
|
12938 |
|
12939 |
|
12940 |
|
12941 | axis_y_tick_format: undefined,
|
12942 |
|
12943 | |
12944 |
|
12945 |
|
12946 |
|
12947 |
|
12948 |
|
12949 |
|
12950 |
|
12951 |
|
12952 |
|
12953 |
|
12954 |
|
12955 |
|
12956 |
|
12957 |
|
12958 | axis_y_tick_outer: !0,
|
12959 |
|
12960 | |
12961 |
|
12962 |
|
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 |
|
12970 |
|
12971 |
|
12972 |
|
12973 |
|
12974 |
|
12975 | axis_y_tick_values: null,
|
12976 | axis_y_tick_rotate: 0,
|
12977 |
|
12978 | |
12979 |
|
12980 |
|
12981 |
|
12982 |
|
12983 |
|
12984 |
|
12985 |
|
12986 |
|
12987 |
|
12988 |
|
12989 |
|
12990 |
|
12991 |
|
12992 |
|
12993 |
|
12994 | axis_y_tick_count: undefined,
|
12995 |
|
12996 | |
12997 |
|
12998 |
|
12999 |
|
13000 |
|
13001 |
|
13002 |
|
13003 |
|
13004 |
|
13005 |
|
13006 |
|
13007 |
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 | axis_y_tick_show: !0,
|
13013 |
|
13014 | |
13015 |
|
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 |
|
13029 |
|
13030 |
|
13031 |
|
13032 | axis_y_tick_text_show: !0,
|
13033 |
|
13034 | |
13035 |
|
13036 |
|
13037 |
|
13038 |
|
13039 |
|
13040 |
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 |
|
13049 |
|
13050 |
|
13051 |
|
13052 |
|
13053 |
|
13054 | axis_y_tick_text_position: {
|
13055 | x: 0,
|
13056 | y: 0
|
13057 | },
|
13058 |
|
13059 | |
13060 |
|
13061 |
|
13062 |
|
13063 |
|
13064 |
|
13065 |
|
13066 |
|
13067 |
|
13068 |
|
13069 |
|
13070 |
|
13071 |
|
13072 |
|
13073 |
|
13074 |
|
13075 |
|
13076 |
|
13077 |
|
13078 |
|
13079 |
|
13080 |
|
13081 | axis_y_tick_time_value: undefined,
|
13082 |
|
13083 | |
13084 |
|
13085 |
|
13086 |
|
13087 |
|
13088 |
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 |
|
13096 |
|
13097 |
|
13098 |
|
13099 |
|
13100 |
|
13101 |
|
13102 |
|
13103 | axis_y_padding: {},
|
13104 |
|
13105 | |
13106 |
|
13107 |
|
13108 |
|
13109 |
|
13110 |
|
13111 |
|
13112 |
|
13113 |
|
13114 |
|
13115 |
|
13116 |
|
13117 |
|
13118 |
|
13119 | axis_y_default: undefined,
|
13120 |
|
13121 | |
13122 |
|
13123 |
|
13124 |
|
13125 |
|
13126 |
|
13127 |
|
13128 |
|
13129 |
|
13130 |
|
13131 |
|
13132 |
|
13133 |
|
13134 |
|
13135 |
|
13136 |
|
13137 |
|
13138 |
|
13139 |
|
13140 |
|
13141 |
|
13142 |
|
13143 |
|
13144 |
|
13145 |
|
13146 |
|
13147 |
|
13148 |
|
13149 |
|
13150 |
|
13151 |
|
13152 |
|
13153 |
|
13154 | axis_y_axes: [],
|
13155 |
|
13156 | |
13157 |
|
13158 |
|
13159 |
|
13160 |
|
13161 |
|
13162 |
|
13163 |
|
13164 |
|
13165 |
|
13166 |
|
13167 |
|
13168 |
|
13169 | axis_y2_show: !1,
|
13170 |
|
13171 | |
13172 |
|
13173 |
|
13174 |
|
13175 |
|
13176 |
|
13177 |
|
13178 |
|
13179 |
|
13180 |
|
13181 |
|
13182 |
|
13183 |
|
13184 | axis_y2_max: undefined,
|
13185 |
|
13186 | |
13187 |
|
13188 |
|
13189 |
|
13190 |
|
13191 |
|
13192 |
|
13193 |
|
13194 |
|
13195 |
|
13196 |
|
13197 |
|
13198 |
|
13199 | axis_y2_min: undefined,
|
13200 |
|
13201 | |
13202 |
|
13203 |
|
13204 |
|
13205 |
|
13206 |
|
13207 |
|
13208 |
|
13209 |
|
13210 |
|
13211 |
|
13212 |
|
13213 |
|
13214 |
|
13215 | axis_y2_inverted: !1,
|
13216 |
|
13217 | |
13218 |
|
13219 |
|
13220 |
|
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 |
|
13227 |
|
13228 |
|
13229 |
|
13230 | axis_y2_center: undefined,
|
13231 |
|
13232 | |
13233 |
|
13234 |
|
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 |
|
13240 |
|
13241 |
|
13242 |
|
13243 |
|
13244 |
|
13245 | axis_y2_inner: !1,
|
13246 |
|
13247 | |
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 |
|
13254 |
|
13255 |
|
13256 |
|
13257 |
|
13258 |
|
13259 |
|
13260 |
|
13261 |
|
13262 |
|
13263 |
|
13264 |
|
13265 |
|
13266 |
|
13267 |
|
13268 |
|
13269 |
|
13270 | axis_y2_label: {},
|
13271 |
|
13272 | |
13273 |
|
13274 |
|
13275 |
|
13276 |
|
13277 |
|
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 |
|
13283 |
|
13284 |
|
13285 |
|
13286 |
|
13287 |
|
13288 |
|
13289 | axis_y2_tick_format: undefined,
|
13290 |
|
13291 | |
13292 |
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 |
|
13306 | axis_y2_tick_outer: !0,
|
13307 |
|
13308 | |
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 |
|
13319 |
|
13320 |
|
13321 |
|
13322 |
|
13323 | axis_y2_tick_values: null,
|
13324 |
|
13325 | |
13326 |
|
13327 |
|
13328 |
|
13329 |
|
13330 |
|
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 | axis_y2_tick_count: undefined,
|
13342 |
|
13343 | |
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 |
|
13349 |
|
13350 |
|
13351 |
|
13352 |
|
13353 |
|
13354 |
|
13355 |
|
13356 |
|
13357 |
|
13358 |
|
13359 | axis_y2_tick_show: !0,
|
13360 |
|
13361 | |
13362 |
|
13363 |
|
13364 |
|
13365 |
|
13366 |
|
13367 |
|
13368 |
|
13369 |
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 |
|
13376 |
|
13377 |
|
13378 |
|
13379 | axis_y2_tick_text_show: !0,
|
13380 |
|
13381 | |
13382 |
|
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 |
|
13393 |
|
13394 |
|
13395 |
|
13396 |
|
13397 |
|
13398 |
|
13399 |
|
13400 |
|
13401 | axis_y2_tick_text_position: {
|
13402 | x: 0,
|
13403 | y: 0
|
13404 | },
|
13405 |
|
13406 | |
13407 |
|
13408 |
|
13409 |
|
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 |
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 | axis_y2_padding: {},
|
13424 |
|
13425 | |
13426 |
|
13427 |
|
13428 |
|
13429 |
|
13430 |
|
13431 |
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 |
|
13439 | axis_y2_default: undefined,
|
13440 |
|
13441 | |
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 |
|
13458 |
|
13459 |
|
13460 |
|
13461 |
|
13462 |
|
13463 |
|
13464 |
|
13465 |
|
13466 |
|
13467 |
|
13468 |
|
13469 |
|
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 | axis_y2_axes: [],
|
13475 |
|
13476 | |
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 |
|
13484 |
|
13485 |
|
13486 |
|
13487 |
|
13488 |
|
13489 |
|
13490 |
|
13491 |
|
13492 |
|
13493 |
|
13494 |
|
13495 |
|
13496 |
|
13497 |
|
13498 |
|
13499 |
|
13500 |
|
13501 |
|
13502 |
|
13503 |
|
13504 |
|
13505 |
|
13506 |
|
13507 |
|
13508 |
|
13509 |
|
13510 |
|
13511 |
|
13512 |
|
13513 |
|
13514 |
|
13515 |
|
13516 |
|
13517 |
|
13518 |
|
13519 |
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 | grid_x_show: !1,
|
13525 | grid_x_type: "tick",
|
13526 | grid_x_lines: [],
|
13527 | grid_y_show: !1,
|
13528 | grid_y_lines: [],
|
13529 | grid_y_ticks: 10,
|
13530 | grid_focus_show: !0,
|
13531 | grid_front: !1,
|
13532 | grid_lines_front: !0,
|
13533 |
|
13534 | |
13535 |
|
13536 |
|
13537 |
|
13538 |
|
13539 |
|
13540 |
|
13541 |
|
13542 |
|
13543 |
|
13544 |
|
13545 |
|
13546 |
|
13547 |
|
13548 |
|
13549 |
|
13550 |
|
13551 |
|
13552 |
|
13553 |
|
13554 |
|
13555 |
|
13556 |
|
13557 |
|
13558 |
|
13559 |
|
13560 |
|
13561 |
|
13562 |
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 |
|
13568 |
|
13569 |
|
13570 |
|
13571 |
|
13572 |
|
13573 |
|
13574 |
|
13575 |
|
13576 |
|
13577 |
|
13578 |
|
13579 |
|
13580 |
|
13581 |
|
13582 |
|
13583 |
|
13584 |
|
13585 |
|
13586 |
|
13587 |
|
13588 |
|
13589 |
|
13590 |
|
13591 |
|
13592 |
|
13593 |
|
13594 |
|
13595 |
|
13596 |
|
13597 |
|
13598 |
|
13599 |
|
13600 | point_show: !0,
|
13601 | point_r: 2.5,
|
13602 | point_sensitivity: 10,
|
13603 | point_focus_expand_enabled: !0,
|
13604 | point_focus_expand_r: undefined,
|
13605 | point_pattern: [],
|
13606 | point_select_r: undefined,
|
13607 | point_type: "circle",
|
13608 |
|
13609 | |
13610 |
|
13611 |
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 |
|
13619 |
|
13620 |
|
13621 |
|
13622 |
|
13623 |
|
13624 |
|
13625 |
|
13626 |
|
13627 |
|
13628 |
|
13629 |
|
13630 |
|
13631 |
|
13632 |
|
13633 |
|
13634 |
|
13635 |
|
13636 |
|
13637 |
|
13638 |
|
13639 |
|
13640 |
|
13641 |
|
13642 |
|
13643 | line_connectNull: !1,
|
13644 | line_step_type: "step",
|
13645 | line_classes: undefined,
|
13646 | line_point: !0,
|
13647 |
|
13648 | |
13649 |
|
13650 |
|
13651 |
|
13652 |
|
13653 |
|
13654 |
|
13655 |
|
13656 |
|
13657 |
|
13658 |
|
13659 |
|
13660 |
|
13661 |
|
13662 |
|
13663 |
|
13664 |
|
13665 |
|
13666 |
|
13667 |
|
13668 |
|
13669 |
|
13670 |
|
13671 |
|
13672 |
|
13673 |
|
13674 |
|
13675 |
|
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 |
|
13684 |
|
13685 |
|
13686 |
|
13687 |
|
13688 |
|
13689 |
|
13690 |
|
13691 |
|
13692 |
|
13693 |
|
13694 |
|
13695 |
|
13696 |
|
13697 |
|
13698 |
|
13699 |
|
13700 |
|
13701 |
|
13702 |
|
13703 |
|
13704 |
|
13705 |
|
13706 | bar_padding: 0,
|
13707 | bar_radius: undefined,
|
13708 | bar_radius_ratio: undefined,
|
13709 | bar_sensitivity: 2,
|
13710 | bar_width: undefined,
|
13711 | bar_width_ratio: .6,
|
13712 | bar_width_max: undefined,
|
13713 | bar_zerobased: !0,
|
13714 |
|
13715 | |
13716 |
|
13717 |
|
13718 |
|
13719 |
|
13720 |
|
13721 |
|
13722 |
|
13723 |
|
13724 |
|
13725 |
|
13726 |
|
13727 |
|
13728 |
|
13729 |
|
13730 |
|
13731 |
|
13732 |
|
13733 |
|
13734 |
|
13735 | bubble_maxR: 35,
|
13736 |
|
13737 | |
13738 |
|
13739 |
|
13740 |
|
13741 |
|
13742 |
|
13743 |
|
13744 |
|
13745 |
|
13746 |
|
13747 |
|
13748 |
|
13749 |
|
13750 |
|
13751 |
|
13752 |
|
13753 |
|
13754 |
|
13755 |
|
13756 |
|
13757 |
|
13758 |
|
13759 |
|
13760 |
|
13761 |
|
13762 |
|
13763 |
|
13764 |
|
13765 |
|
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 |
|
13771 |
|
13772 |
|
13773 |
|
13774 |
|
13775 |
|
13776 |
|
13777 |
|
13778 |
|
13779 |
|
13780 |
|
13781 |
|
13782 |
|
13783 | area_zerobased: !0,
|
13784 | area_above: !1,
|
13785 | area_linearGradient: !1,
|
13786 |
|
13787 | |
13788 |
|
13789 |
|
13790 |
|
13791 |
|
13792 |
|
13793 |
|
13794 |
|
13795 |
|
13796 |
|
13797 |
|
13798 |
|
13799 |
|
13800 |
|
13801 |
|
13802 |
|
13803 |
|
13804 |
|
13805 |
|
13806 |
|
13807 |
|
13808 |
|
13809 |
|
13810 |
|
13811 |
|
13812 |
|
13813 |
|
13814 |
|
13815 |
|
13816 |
|
13817 |
|
13818 |
|
13819 |
|
13820 |
|
13821 |
|
13822 |
|
13823 |
|
13824 |
|
13825 |
|
13826 |
|
13827 |
|
13828 |
|
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 |
|
13835 |
|
13836 |
|
13837 |
|
13838 |
|
13839 |
|
13840 |
|
13841 |
|
13842 | pie_label_show: !0,
|
13843 | pie_label_format: undefined,
|
13844 | pie_label_threshold: .05,
|
13845 | pie_label_ratio: undefined,
|
13846 | pie_expand: {},
|
13847 | pie_expand_duration: 50,
|
13848 | pie_innerRadius: 0,
|
13849 | pie_padAngle: 0,
|
13850 | pie_padding: 0,
|
13851 |
|
13852 | |
13853 |
|
13854 |
|
13855 |
|
13856 |
|
13857 |
|
13858 |
|
13859 |
|
13860 |
|
13861 |
|
13862 |
|
13863 |
|
13864 | plugins: [],
|
13865 |
|
13866 | |
13867 |
|
13868 |
|
13869 |
|
13870 |
|
13871 |
|
13872 |
|
13873 |
|
13874 |
|
13875 |
|
13876 |
|
13877 |
|
13878 |
|
13879 |
|
13880 |
|
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 |
|
13886 |
|
13887 |
|
13888 |
|
13889 |
|
13890 |
|
13891 |
|
13892 |
|
13893 |
|
13894 |
|
13895 |
|
13896 |
|
13897 |
|
13898 |
|
13899 |
|
13900 |
|
13901 |
|
13902 |
|
13903 |
|
13904 |
|
13905 |
|
13906 |
|
13907 |
|
13908 |
|
13909 |
|
13910 |
|
13911 | gauge_fullCircle: !1,
|
13912 | gauge_label_show: !0,
|
13913 | gauge_label_format: undefined,
|
13914 | gauge_min: 0,
|
13915 | gauge_max: 100,
|
13916 | gauge_startingAngle: -1 * Math.PI / 2,
|
13917 | gauge_label_extents: undefined,
|
13918 | gauge_title: "",
|
13919 | gauge_units: undefined,
|
13920 | gauge_width: undefined,
|
13921 | gauge_expand: {},
|
13922 | gauge_expand_duration: 50,
|
13923 |
|
13924 | |
13925 |
|
13926 |
|
13927 |
|
13928 |
|
13929 |
|
13930 |
|
13931 |
|
13932 |
|
13933 |
|
13934 |
|
13935 |
|
13936 |
|
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 |
|
13942 |
|
13943 |
|
13944 |
|
13945 |
|
13946 |
|
13947 |
|
13948 |
|
13949 |
|
13950 |
|
13951 |
|
13952 |
|
13953 |
|
13954 |
|
13955 |
|
13956 |
|
13957 |
|
13958 |
|
13959 |
|
13960 |
|
13961 |
|
13962 |
|
13963 |
|
13964 |
|
13965 |
|
13966 | donut_label_show: !0,
|
13967 | donut_label_format: undefined,
|
13968 | donut_label_threshold: .05,
|
13969 | donut_label_ratio: undefined,
|
13970 | donut_width: undefined,
|
13971 | donut_title: "",
|
13972 | donut_expand: {},
|
13973 | donut_expand_duration: 50,
|
13974 | donut_padAngle: 0,
|
13975 |
|
13976 | |
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 |
|
13982 |
|
13983 |
|
13984 |
|
13985 |
|
13986 |
|
13987 |
|
13988 |
|
13989 |
|
13990 |
|
13991 |
|
13992 |
|
13993 |
|
13994 |
|
13995 |
|
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 |
|
14002 |
|
14003 |
|
14004 |
|
14005 |
|
14006 |
|
14007 |
|
14008 |
|
14009 | spline_interpolation_type: "cardinal",
|
14010 |
|
14011 | |
14012 |
|
14013 |
|
14014 |
|
14015 |
|
14016 |
|
14017 |
|
14018 |
|
14019 |
|
14020 |
|
14021 |
|
14022 |
|
14023 |
|
14024 |
|
14025 |
|
14026 |
|
14027 |
|
14028 |
|
14029 |
|
14030 |
|
14031 |
|
14032 |
|
14033 |
|
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 |
|
14040 |
|
14041 |
|
14042 |
|
14043 |
|
14044 |
|
14045 |
|
14046 |
|
14047 |
|
14048 |
|
14049 |
|
14050 |
|
14051 |
|
14052 |
|
14053 |
|
14054 |
|
14055 |
|
14056 |
|
14057 |
|
14058 |
|
14059 |
|
14060 | radar_axis_max: undefined,
|
14061 | radar_axis_line_show: !0,
|
14062 | radar_axis_text_show: !0,
|
14063 | radar_level_depth: 3,
|
14064 | radar_level_show: !0,
|
14065 | radar_level_text_format: function radar_level_text_format(x) {
|
14066 | return x % 1 === 0 ? x : x.toFixed(2);
|
14067 | },
|
14068 | radar_level_text_show: !0,
|
14069 | radar_size_ratio: .87,
|
14070 | radar_direction_clockwise: !1,
|
14071 |
|
14072 | |
14073 |
|
14074 |
|
14075 |
|
14076 |
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 |
|
14087 |
|
14088 |
|
14089 |
|
14090 | regions: [],
|
14091 |
|
14092 | |
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 |
|
14099 |
|
14100 |
|
14101 |
|
14102 |
|
14103 |
|
14104 |
|
14105 |
|
14106 |
|
14107 |
|
14108 |
|
14109 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 |
|
14124 |
|
14125 |
|
14126 |
|
14127 |
|
14128 |
|
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 |
|
14138 |
|
14139 |
|
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 |
|
14145 |
|
14146 |
|
14147 |
|
14148 |
|
14149 |
|
14150 |
|
14151 |
|
14152 |
|
14153 |
|
14154 |
|
14155 |
|
14156 |
|
14157 |
|
14158 |
|
14159 |
|
14160 |
|
14161 |
|
14162 |
|
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 |
|
14168 |
|
14169 |
|
14170 |
|
14171 |
|
14172 |
|
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 |
|
14179 |
|
14180 |
|
14181 |
|
14182 |
|
14183 |
|
14184 |
|
14185 |
|
14186 |
|
14187 |
|
14188 |
|
14189 |
|
14190 |
|
14191 |
|
14192 |
|
14193 |
|
14194 |
|
14195 |
|
14196 |
|
14197 |
|
14198 |
|
14199 |
|
14200 |
|
14201 |
|
14202 |
|
14203 |
|
14204 |
|
14205 |
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 |
|
14211 |
|
14212 |
|
14213 |
|
14214 |
|
14215 |
|
14216 |
|
14217 |
|
14218 |
|
14219 |
|
14220 |
|
14221 |
|
14222 |
|
14223 |
|
14224 |
|
14225 |
|
14226 |
|
14227 |
|
14228 |
|
14229 |
|
14230 |
|
14231 |
|
14232 |
|
14233 |
|
14234 |
|
14235 |
|
14236 |
|
14237 |
|
14238 |
|
14239 | tooltip_show: !0,
|
14240 | tooltip_doNotHide: !1,
|
14241 | tooltip_grouped: !0,
|
14242 | tooltip_format_title: undefined,
|
14243 | tooltip_format_name: undefined,
|
14244 | tooltip_format_value: undefined,
|
14245 | tooltip_position: undefined,
|
14246 | tooltip_contents: {},
|
14247 | tooltip_init_show: !1,
|
14248 | tooltip_init_x: 0,
|
14249 | tooltip_init_position: {
|
14250 | top: "0px",
|
14251 | left: "50px"
|
14252 | },
|
14253 | tooltip_linked: !1,
|
14254 | tooltip_linked_name: "",
|
14255 | tooltip_onshow: function tooltip_onshow() {},
|
14256 | tooltip_onhide: function tooltip_onhide() {},
|
14257 | tooltip_onshown: function tooltip_onshown() {},
|
14258 | tooltip_onhidden: function tooltip_onhidden() {},
|
14259 | tooltip_order: null,
|
14260 |
|
14261 | |
14262 |
|
14263 |
|
14264 |
|
14265 |
|
14266 |
|
14267 |
|
14268 |
|
14269 |
|
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 |
|
14275 |
|
14276 |
|
14277 |
|
14278 |
|
14279 |
|
14280 |
|
14281 |
|
14282 |
|
14283 |
|
14284 |
|
14285 |
|
14286 |
|
14287 |
|
14288 |
|
14289 | title_text: undefined,
|
14290 | title_padding: {
|
14291 | top: 0,
|
14292 | right: 0,
|
14293 | bottom: 0,
|
14294 | left: 0
|
14295 | },
|
14296 | title_position: "center"
|
14297 | };
|
14298 | };
|
14299 |
|
14300 |
|
14301 |
|
14302 |
|
14303 |
|
14304 |
|
14305 |
|
14306 |
|
14307 |
|
14308 |
|
14309 | util_extend(ChartInternal_ChartInternal.prototype, {
|
14310 | getOptions: function getOptions() {
|
14311 | return new Options_Options();
|
14312 | },
|
14313 |
|
14314 | |
14315 |
|
14316 |
|
14317 |
|
14318 |
|
14319 | loadConfig: function loadConfig(config) {
|
14320 | var target,
|
14321 | keys,
|
14322 | read,
|
14323 | thisConfig = this.config,
|
14324 | find = function () {
|
14325 | var key = keys.shift();
|
14326 | return key && target && isObjectType(target) && key in target ? (target = target[key], find()) : key ? undefined : target;
|
14327 | };
|
14328 |
|
14329 | Object.keys(thisConfig).forEach(function (key) {
|
14330 | target = config, keys = key.split("_"), read = find(), isDefined(read) && (thisConfig[key] = read);
|
14331 | });
|
14332 | }
|
14333 | });
|
14334 |
|
14335 |
|
14336 |
|
14337 |
|
14338 |
|
14339 |
|
14340 |
|
14341 |
|
14342 | util_extend(ChartInternal_ChartInternal.prototype, {
|
14343 | getScale: function getScale(min, max, forTimeseries) {
|
14344 | return (forTimeseries ? src_time() : src_linear_linear()).range([min, max]);
|
14345 | },
|
14346 |
|
14347 | |
14348 |
|
14349 |
|
14350 |
|
14351 |
|
14352 |
|
14353 |
|
14354 |
|
14355 |
|
14356 | getX: function getX(min, max, domain, offset) {
|
14357 | var $$ = this,
|
14358 | scale = $$.zoomScale || $$.getScale(min, max, $$.isTimeSeries());
|
14359 | return $$.getCustomizedScale(domain ? scale.domain(domain) : scale, offset);
|
14360 | },
|
14361 |
|
14362 | |
14363 |
|
14364 |
|
14365 |
|
14366 |
|
14367 |
|
14368 |
|
14369 |
|
14370 | getY: function getY(min, max, domain) {
|
14371 | var scale = this.getScale(min, max, this.isTimeSeriesY());
|
14372 | return domain && scale.domain(domain), scale;
|
14373 | },
|
14374 |
|
14375 | |
14376 |
|
14377 |
|
14378 |
|
14379 |
|
14380 |
|
14381 |
|
14382 | getCustomizedScale: function getCustomizedScale(scaleValue, offsetValue) {
|
14383 | var $$ = this,
|
14384 | offset = offsetValue || function () {
|
14385 | return $$.xAxis.tickOffset();
|
14386 | },
|
14387 | scale = function (d, raw) {
|
14388 | var v = scaleValue(d) + offset();
|
14389 | return raw ? v : Math.ceil(v);
|
14390 | };
|
14391 |
|
14392 |
|
14393 | for (var key in scaleValue) scale[key] = scaleValue[key];
|
14394 |
|
14395 | return scale.orgDomain = function () {
|
14396 | return scaleValue.domain();
|
14397 | }, scale.orgScale = function () {
|
14398 | return scaleValue;
|
14399 | }, $$.isCategorized() && (scale.domain = function (domainValue) {
|
14400 | var domain = domainValue;
|
14401 | return arguments.length ? (scaleValue.domain(domain), scale) : (domain = this.orgDomain(), [domain[0], domain[1] + 1]);
|
14402 | }), scale;
|
14403 | },
|
14404 | getYScale: function getYScale(id) {
|
14405 | return this.axis.getId(id) === "y2" ? this.y2 : this.y;
|
14406 | },
|
14407 | getSubYScale: function getSubYScale(id) {
|
14408 | return this.axis.getId(id) === "y2" ? this.subY2 : this.subY;
|
14409 | },
|
14410 |
|
14411 | |
14412 |
|
14413 |
|
14414 |
|
14415 |
|
14416 | updateScales: function updateScales(isInit) {
|
14417 | var updateXDomain = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
14418 | $$ = this,
|
14419 | config = $$.config,
|
14420 | isRotated = config.axis_rotated;
|
14421 | $$.xMin = isRotated ? 1 : 0, $$.xMax = isRotated ? $$.height : $$.width, $$.yMin = isRotated ? 0 : $$.height, $$.yMax = isRotated ? $$.width : 1, $$.subXMin = $$.xMin, $$.subXMax = $$.xMax, $$.subYMin = isRotated ? 0 : $$.height2, $$.subYMax = isRotated ? $$.width2 : 1;
|
14422 |
|
14423 |
|
14424 | var xDomain = updateXDomain && $$.x && $$.x.orgDomain(),
|
14425 | xSubDomain = updateXDomain && $$.orgXDomain;
|
14426 |
|
14427 |
|
14428 | $$.x = $$.getX($$.xMin, $$.xMax, xDomain, function () {
|
14429 | return $$.xAxis.tickOffset();
|
14430 | }), $$.subX = $$.getX($$.xMin, $$.xMax, xSubDomain, function (d) {
|
14431 | return d % 1 ? 0 : $$.subXAxis.tickOffset();
|
14432 | }), $$.xAxisTickFormat = $$.axis.getXAxisTickFormat(), $$.xAxisTickValues = $$.axis.getXAxisTickValues(), $$.xAxis = $$.axis.getXAxis("x", $$.x, config.axis_x_tick_outer, isInit), $$.subXAxis = $$.axis.getXAxis("subX", $$.subX, config.axis_x_tick_outer, isInit), $$.y = $$.getY($$.yMin, $$.yMax, $$.y ? $$.y.domain() : config.axis_y_default), $$.subY = $$.getY($$.subYMin, $$.subYMax, $$.subY ? $$.subY.domain() : config.axis_y_default), $$.yAxisTickValues = $$.axis.getYAxisTickValues(), $$.yAxis = $$.axis.getYAxis("y", $$.y, config.axis_y_tick_outer, isInit), config.axis_y2_show && ($$.y2 = $$.getY($$.yMin, $$.yMax, $$.y2 ? $$.y2.domain() : config.axis_y2_default), $$.subY2 = $$.getY($$.subYMin, $$.subYMax, $$.subY2 ? $$.subY2.domain() : config.axis_y2_default), $$.y2AxisTickValues = $$.axis.getY2AxisTickValues(), $$.y2Axis = $$.axis.getYAxis("y2", $$.y2, config.axis_y2_tick_outer, isInit)), $$.updateArc && $$.updateArc();
|
14433 | }
|
14434 | });
|
14435 |
|
14436 |
|
14437 |
|
14438 |
|
14439 |
|
14440 |
|
14441 |
|
14442 |
|
14443 |
|
14444 | util_extend(ChartInternal_ChartInternal.prototype, {
|
14445 | getYDomainMinMax: function getYDomainMinMax(targets, type) {
|
14446 | var $$ = this,
|
14447 | config = $$.config,
|
14448 | isMin = type === "min",
|
14449 | dataGroups = config.data_groups,
|
14450 | ids = $$.mapToIds(targets),
|
14451 | ys = $$.getValuesAsIdKeyed(targets);
|
14452 | return dataGroups.length > 0 && function () {
|
14453 | for (var idsInGroup, _ret, hasValue = $$["has".concat(isMin ? "Negative" : "Positive", "ValueInTargets")](targets), _loop = function (j, _idsInGroup) {
|
14454 | if (_idsInGroup = _idsInGroup.filter(function (v) {
|
14455 | return ids.indexOf(v) >= 0;
|
14456 | }), _idsInGroup.length === 0) return idsInGroup = _idsInGroup, "continue";
|
14457 | var baseId = _idsInGroup[0],
|
14458 | baseAxisId = $$.axis.getId(baseId);
|
14459 | hasValue && ys[baseId] && (ys[baseId] = ys[baseId].map(function (v) {
|
14460 | return (isMin ? v < 0 : v > 0) ? v : 0;
|
14461 | }));
|
14462 |
|
14463 | for (var id, _ret2, _loop2 = function (k, id) {
|
14464 | if (!ys[id]) return "continue";
|
14465 | var axisId = $$.axis.getId(id);
|
14466 | ys[id].forEach(function (v, i) {
|
14467 | var val = +v,
|
14468 | meetCondition = isMin ? val > 0 : val < 0;
|
14469 | axisId !== baseAxisId || hasValue && meetCondition || (ys[baseId][i] += val);
|
14470 | });
|
14471 | }, k = 1; id = _idsInGroup[k]; k++) _ret2 = _loop2(k, id), _ret2 === "continue";
|
14472 |
|
14473 | idsInGroup = _idsInGroup;
|
14474 | }, j = 0; idsInGroup = dataGroups[j]; j++) _ret = _loop(j, idsInGroup), _ret === "continue";
|
14475 | }(), getMinMax(type, Object.keys(ys).map(function (key) {
|
14476 | return getMinMax(type, ys[key]);
|
14477 | }));
|
14478 | },
|
14479 | getYDomainMin: function getYDomainMin(targets) {
|
14480 | return this.getYDomainMinMax(targets, "min");
|
14481 | },
|
14482 | getYDomainMax: function getYDomainMax(targets) {
|
14483 | return this.getYDomainMinMax(targets, "max");
|
14484 | },
|
14485 | getYDomain: function getYDomain(targets, axisId, xDomain) {
|
14486 | var $$ = this,
|
14487 | config = $$.config;
|
14488 | if ($$.isStackNormalized()) return [0, 100];
|
14489 | var targetsByAxisId = targets.filter(function (t) {
|
14490 | return $$.axis.getId(t.id) === axisId;
|
14491 | }),
|
14492 | yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId,
|
14493 | yMin = config["axis_".concat(axisId, "_min")],
|
14494 | yMax = config["axis_".concat(axisId, "_max")],
|
14495 | yDomainMin = $$.getYDomainMin(yTargets),
|
14496 | yDomainMax = $$.getYDomainMax(yTargets),
|
14497 | center = config["axis_".concat(axisId, "_center")],
|
14498 | isZeroBased = $$.hasType("bar", yTargets) && config.bar_zerobased || $$.hasType("area", yTargets) && config.area_zerobased,
|
14499 | isInverted = config["axis_".concat(axisId, "_inverted")],
|
14500 | showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,
|
14501 | showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
14502 | if (yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin < yMax ? yDomainMin : yMax - 10 : yDomainMin, yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin < yDomainMax ? yDomainMax : yMin + 10 : yDomainMax, yTargets.length === 0)
|
14503 | return $$[axisId].domain();
|
14504 | isNaN(yDomainMin) && (yDomainMin = 0), isNaN(yDomainMax) && (yDomainMax = yDomainMin), yDomainMin === yDomainMax && (yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0);
|
14505 | var isAllPositive = yDomainMin >= 0 && yDomainMax >= 0,
|
14506 | isAllNegative = yDomainMin <= 0 && yDomainMax <= 0;
|
14507 | (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) && (isZeroBased = !1), isZeroBased && (isAllPositive && (yDomainMin = 0), isAllNegative && (yDomainMax = 0));
|
14508 | var domainLength = Math.abs(yDomainMax - yDomainMin),
|
14509 | padding = {
|
14510 | top: domainLength * .1,
|
14511 | bottom: domainLength * .1
|
14512 | };
|
14513 |
|
14514 | if (isDefined(center)) {
|
14515 | var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
|
14516 | yDomainMax = center + yDomainAbs, yDomainMin = center - yDomainAbs;
|
14517 | }
|
14518 |
|
14519 |
|
14520 | if (showHorizontalDataLabel) {
|
14521 | var diff = diffDomain($$.y.range()),
|
14522 | ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map(function (v) {
|
14523 | return v / diff;
|
14524 | });
|
14525 | ["bottom", "top"].forEach(function (v, i) {
|
14526 | padding[v] += domainLength * (ratio[i] / (1 - ratio[0] - ratio[1]));
|
14527 | });
|
14528 | } else if (showVerticalDataLabel) {
|
14529 | var lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height");
|
14530 | ["bottom", "top"].forEach(function (v, i) {
|
14531 | padding[v] += $$.axis.convertPixelsToAxisPadding(lengths[i], domainLength);
|
14532 | });
|
14533 | }
|
14534 |
|
14535 | if (/^y2?$/.test(axisId)) {
|
14536 | var p = config["axis_".concat(axisId, "_padding")];
|
14537 | notEmpty(p) && ["bottom", "top"].forEach(function (v) {
|
14538 | padding[v] = $$.axis.getPadding(p, v, padding[v], domainLength);
|
14539 | });
|
14540 | }
|
14541 |
|
14542 |
|
14543 | isZeroBased && (isAllPositive && (padding.bottom = yDomainMin), isAllNegative && (padding.top = -yDomainMax));
|
14544 | var domain = [yDomainMin - padding.bottom, yDomainMax + padding.top];
|
14545 | return isInverted ? domain.reverse() : domain;
|
14546 | },
|
14547 | getXDomainMinMax: function getXDomainMinMax(targets, type) {
|
14548 | var $$ = this,
|
14549 | value = $$.config["axis_x_".concat(type)];
|
14550 | return isDefined(value) ? $$.isTimeSeries() ? $$.parseDate(value) : value : getMinMax(type, targets.map(function (t) {
|
14551 | return getMinMax(type, t.values.map(function (v) {
|
14552 | return v.x;
|
14553 | }));
|
14554 | }));
|
14555 | },
|
14556 | getXDomainMin: function getXDomainMin(targets) {
|
14557 | return this.getXDomainMinMax(targets, "min");
|
14558 | },
|
14559 | getXDomainMax: function getXDomainMax(targets) {
|
14560 | return this.getXDomainMinMax(targets, "max");
|
14561 | },
|
14562 | getXDomainPadding: function getXDomainPadding(domain) {
|
14563 | var maxDataCount,
|
14564 | padding,
|
14565 | $$ = this,
|
14566 | config = $$.config,
|
14567 | diff = domain[1] - domain[0],
|
14568 | xPadding = config.axis_x_padding;
|
14569 | $$.isCategorized() ? padding = 0 : $$.hasType("bar") ? (maxDataCount = $$.getMaxDataCount(), padding = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5) : padding = diff * .01;
|
14570 | var left = padding,
|
14571 | right = padding;
|
14572 | return isObject(xPadding) && notEmpty(xPadding) ? (left = isValue(xPadding.left) ? xPadding.left : padding, right = isValue(xPadding.right) ? xPadding.right : padding) : isNumber(config.axis_x_padding) && (left = xPadding, right = xPadding), {
|
14573 | left: left,
|
14574 | right: right
|
14575 | };
|
14576 | },
|
14577 | getXDomain: function getXDomain(targets) {
|
14578 | var $$ = this,
|
14579 | xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)],
|
14580 | firstX = xDomain[0],
|
14581 | lastX = xDomain[1],
|
14582 | padding = $$.getXDomainPadding(xDomain),
|
14583 | min = 0,
|
14584 | max = 0;
|
14585 | return firstX - lastX !== 0 || $$.isCategorized() || ($$.isTimeSeries() ? (firstX = new Date(firstX.getTime() * .5), lastX = new Date(lastX.getTime() * 1.5)) : (firstX = firstX === 0 ? 1 : firstX * .5, lastX = lastX === 0 ? -1 : lastX * 1.5)), (firstX || firstX === 0) && (min = $$.isTimeSeries() ? new Date(firstX.getTime() - padding.left) : firstX - padding.left), (lastX || lastX === 0) && (max = $$.isTimeSeries() ? new Date(lastX.getTime() + padding.right) : lastX + padding.right), [min, max];
|
14586 | },
|
14587 | updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
|
14588 | var $$ = this,
|
14589 | config = $$.config,
|
14590 | zoomEnabled = config.zoom_enabled;
|
14591 |
|
14592 | if (withUpdateOrgXDomain && ($$.x.domain(domain || sortValue($$.getXDomain(targets))), $$.orgXDomain = $$.x.domain(), zoomEnabled && $$.zoom.updateScaleExtent(), $$.subX.domain($$.x.domain()), $$.brush && $$.brush.scale($$.subX)), withUpdateXDomain) {
|
14593 | var domainValue = domain || !$$.brush || brushEmpty($$) ? $$.orgXDomain : getBrushSelection($$).map($$.subX.invert);
|
14594 | $$.x.domain(domainValue), zoomEnabled && $$.zoom.updateScaleExtent();
|
14595 | }
|
14596 |
|
14597 |
|
14598 | return withTrim && $$.x.domain($$.trimXDomain($$.x.orgDomain())), $$.x.domain();
|
14599 | },
|
14600 | trimXDomain: function trimXDomain(domain) {
|
14601 | var zoomDomain = this.getZoomDomain(),
|
14602 | _zoomDomain = slicedToArray_default()(zoomDomain, 2),
|
14603 | min = _zoomDomain[0],
|
14604 | max = _zoomDomain[1];
|
14605 |
|
14606 | return domain[0] <= min && (domain[1] = +domain[1] + (min - domain[0]), domain[0] = min), max <= domain[1] && (domain[0] = +domain[0] - (domain[1] - max), domain[1] = max), domain;
|
14607 | }
|
14608 | });
|
14609 |
|
14610 |
|
14611 |
|
14612 |
|
14613 |
|
14614 |
|
14615 |
|
14616 |
|
14617 |
|
14618 |
|
14619 | util_extend(ChartInternal_ChartInternal.prototype, {
|
14620 | isX: function isX(key) {
|
14621 | var $$ = this,
|
14622 | config = $$.config,
|
14623 | dataKey = config.data_x && key === config.data_x,
|
14624 | existValue = notEmpty(config.data_xs) && util_hasValue(config.data_xs, key);
|
14625 | return dataKey || existValue;
|
14626 | },
|
14627 | isNotX: function isNotX(key) {
|
14628 | return !this.isX(key);
|
14629 | },
|
14630 | isStackNormalized: function isStackNormalized() {
|
14631 | var config = this.config;
|
14632 | return config.data_stack_normalize && config.data_groups.length;
|
14633 | },
|
14634 | isGrouped: function isGrouped(id) {
|
14635 | return this.config.data_groups.map(function (v) {
|
14636 | return v.indexOf(id) >= 0;
|
14637 | })[0];
|
14638 | },
|
14639 | getXKey: function getXKey(id) {
|
14640 | var $$ = this,
|
14641 | config = $$.config;
|
14642 | return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;
|
14643 | },
|
14644 | getXValuesOfXKey: function getXValuesOfXKey(key, targets) {
|
14645 | var xValues,
|
14646 | $$ = this,
|
14647 | ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [];
|
14648 | return ids.forEach(function (id) {
|
14649 | $$.getXKey(id) === key && (xValues = $$.data.xs[id]);
|
14650 | }), xValues;
|
14651 | },
|
14652 |
|
14653 | |
14654 |
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 |
|
14660 | getIndexByX: function getIndexByX(x, basedX) {
|
14661 | var $$ = this;
|
14662 | return basedX ? basedX.indexOf(isString(x) ? x : +x) : ($$.filterByX($$.data.targets, x)[0] || {
|
14663 | index: null
|
14664 | }).index;
|
14665 | },
|
14666 | getXValue: function getXValue(id, i) {
|
14667 | var $$ = this;
|
14668 | return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;
|
14669 | },
|
14670 | getOtherTargetXs: function getOtherTargetXs() {
|
14671 | var $$ = this,
|
14672 | idsForX = Object.keys($$.data.xs);
|
14673 | return idsForX.length ? $$.data.xs[idsForX[0]] : null;
|
14674 | },
|
14675 | getOtherTargetX: function getOtherTargetX(index) {
|
14676 | var xs = this.getOtherTargetXs();
|
14677 | return xs && index < xs.length ? xs[index] : null;
|
14678 | },
|
14679 | addXs: function addXs(xs) {
|
14680 | var $$ = this;
|
14681 | Object.keys(xs).forEach(function (id) {
|
14682 | $$.config.data_xs[id] = xs[id];
|
14683 | });
|
14684 | },
|
14685 | hasMultipleX: function hasMultipleX(xs) {
|
14686 | return Object.keys(xs).map(function (id) {
|
14687 | return xs[id];
|
14688 | }).length > 1;
|
14689 | },
|
14690 | isMultipleX: function isMultipleX() {
|
14691 | return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType("bubble") || this.hasType("scatter");
|
14692 | },
|
14693 | addName: function addName(data) {
|
14694 | var name,
|
14695 | $$ = this;
|
14696 | return data && (name = $$.config.data_names[data.id], data.name = name === undefined ? data.id : name), data;
|
14697 | },
|
14698 | getAllValuesOnIndex: function getAllValuesOnIndex(index) {
|
14699 | var $$ = this;
|
14700 | return $$.filterTargetsToShow($$.data.targets).map(function (t) {
|
14701 | return $$.addName($$.getValueOnIndex(t.values, index));
|
14702 | });
|
14703 | },
|
14704 | getValueOnIndex: function getValueOnIndex(values, index) {
|
14705 | var valueOnIndex = values.filter(function (v) {
|
14706 | return v.index === index;
|
14707 | });
|
14708 | return valueOnIndex.length ? valueOnIndex[0] : null;
|
14709 | },
|
14710 | updateTargetX: function updateTargetX(targets, x) {
|
14711 | var $$ = this;
|
14712 | targets.forEach(function (t) {
|
14713 | t.values.forEach(function (v, i) {
|
14714 | v.x = $$.generateTargetX(x[i], t.id, i);
|
14715 | }), $$.data.xs[t.id] = x;
|
14716 | });
|
14717 | },
|
14718 | updateTargetXs: function updateTargetXs(targets, xs) {
|
14719 | var $$ = this;
|
14720 | targets.forEach(function (t) {
|
14721 | xs[t.id] && $$.updateTargetX([t], xs[t.id]);
|
14722 | });
|
14723 | },
|
14724 | generateTargetX: function generateTargetX(rawX, id, index) {
|
14725 | var $$ = this,
|
14726 | x = $$.isCategorized() ? index : rawX || index;
|
14727 | return $$.isTimeSeries() ? x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)) : $$.isCustomX() && !$$.isCategorized() && (x = isValue(rawX) ? +rawX : $$.getXValue(id, index)), x;
|
14728 | },
|
14729 | cloneTarget: function cloneTarget(target) {
|
14730 | return {
|
14731 | id: target.id,
|
14732 | id_org: target.id_org,
|
14733 | values: target.values.map(function (d) {
|
14734 | return {
|
14735 | x: d.x,
|
14736 | value: d.value,
|
14737 | id: d.id
|
14738 | };
|
14739 | })
|
14740 | };
|
14741 | },
|
14742 | updateXs: function updateXs() {
|
14743 | var $$ = this,
|
14744 | targets = $$.data.targets;
|
14745 | targets.length && ($$.xs = [], targets[0].values.forEach(function (v) {
|
14746 | $$.xs[v.index] = v.x;
|
14747 | }));
|
14748 | },
|
14749 | getPrevX: function getPrevX(i) {
|
14750 | var x = this.xs[i - 1];
|
14751 | return isDefined(x) ? x : null;
|
14752 | },
|
14753 | getNextX: function getNextX(i) {
|
14754 | var x = this.xs[i + 1];
|
14755 | return isDefined(x) ? x : null;
|
14756 | },
|
14757 |
|
14758 | |
14759 |
|
14760 |
|
14761 |
|
14762 |
|
14763 |
|
14764 | getBaseValue: function getBaseValue(data) {
|
14765 | var $$ = this,
|
14766 | value = data.value;
|
14767 | return value && $$.isAreaRangeType(data) && (value = $$.getAreaRangeData(data, "mid")), value;
|
14768 | },
|
14769 |
|
14770 | |
14771 |
|
14772 |
|
14773 |
|
14774 |
|
14775 |
|
14776 | getMinMaxValue: function getMinMaxValue(data) {
|
14777 | var min,
|
14778 | max,
|
14779 | getBaseValue = this.getBaseValue.bind(this);
|
14780 | return (data || this.data.targets.map(function (t) {
|
14781 | return t.values;
|
14782 | })).forEach(function (v, i) {
|
14783 | var value = v.map(getBaseValue).filter(isNumber);
|
14784 | min = Math.min.apply(Math, [i ? min : Infinity].concat(toConsumableArray_default()(value))), max = Math.max.apply(Math, [i ? max : -Infinity].concat(toConsumableArray_default()(value)));
|
14785 | }), {
|
14786 | min: min,
|
14787 | max: max
|
14788 | };
|
14789 | },
|
14790 |
|
14791 | |
14792 |
|
14793 |
|
14794 |
|
14795 |
|
14796 | getMinMaxData: function getMinMaxData() {
|
14797 | var $$ = this,
|
14798 | cacheKey = "$minMaxData",
|
14799 | minMaxData = $$.getCache(cacheKey);
|
14800 |
|
14801 | if (!minMaxData) {
|
14802 | var data = $$.data.targets.map(function (t) {
|
14803 | return t.values;
|
14804 | }),
|
14805 | minMax = $$.getMinMaxValue(data),
|
14806 | min = [],
|
14807 | max = [];
|
14808 |
|
14809 | data.forEach(function (v) {
|
14810 | var minData = $$.getFilteredDataByValue(v, minMax.min),
|
14811 | maxData = $$.getFilteredDataByValue(v, minMax.max);
|
14812 | minData.length && (min = min.concat(minData)), maxData.length && (max = max.concat(maxData));
|
14813 | }), $$.addCache(cacheKey, minMaxData = {
|
14814 | min: min,
|
14815 | max: max
|
14816 | });
|
14817 | }
|
14818 |
|
14819 | return minMaxData;
|
14820 | },
|
14821 |
|
14822 | |
14823 |
|
14824 |
|
14825 |
|
14826 |
|
14827 | getTotalPerIndex: function getTotalPerIndex() {
|
14828 | var $$ = this,
|
14829 | sum = $$.getCache("$totalPerIndex");
|
14830 | return $$.isStackNormalized() && !sum && (sum = [], $$.data.targets.forEach(function (row) {
|
14831 | row.values.forEach(function (v, i) {
|
14832 | sum[i] || (sum[i] = 0), sum[i] += isNumber(v.value) ? v.value : 0;
|
14833 | });
|
14834 | })), sum;
|
14835 | },
|
14836 |
|
14837 | |
14838 |
|
14839 |
|
14840 |
|
14841 |
|
14842 | getTotalDataSum: function getTotalDataSum() {
|
14843 | var $$ = this,
|
14844 | cacheKey = "$totalDataSum",
|
14845 | totalDataSum = $$.getCache(cacheKey);
|
14846 |
|
14847 | if (!totalDataSum) {
|
14848 | var total = mergeArray($$.data.targets.map(function (t) {
|
14849 | return t.values;
|
14850 | })).map(function (v) {
|
14851 | return v.value;
|
14852 | }).reduce(function (p, c) {
|
14853 | return p + c;
|
14854 | });
|
14855 | $$.addCache(cacheKey, totalDataSum = total);
|
14856 | }
|
14857 |
|
14858 | return totalDataSum;
|
14859 | },
|
14860 |
|
14861 | |
14862 |
|
14863 |
|
14864 |
|
14865 |
|
14866 |
|
14867 |
|
14868 | getFilteredDataByValue: function getFilteredDataByValue(data, value) {
|
14869 | var _this = this;
|
14870 |
|
14871 | return data.filter(function (t) {
|
14872 | return _this.getBaseValue(t) === value;
|
14873 | });
|
14874 | },
|
14875 |
|
14876 | |
14877 |
|
14878 |
|
14879 |
|
14880 |
|
14881 | getMaxDataCount: function getMaxDataCount() {
|
14882 | return Math.max.apply(Math, toConsumableArray_default()(this.data.targets.map(function (t) {
|
14883 | return t.values.length;
|
14884 | })));
|
14885 | },
|
14886 | getMaxDataCountTarget: function getMaxDataCountTarget(targets) {
|
14887 | var maxTarget,
|
14888 | length = targets.length,
|
14889 | max = 0;
|
14890 | return length > 1 ? targets.forEach(function (t) {
|
14891 | t.values.length > max && (maxTarget = t, max = t.values.length);
|
14892 | }) : maxTarget = length ? targets[0] : null, maxTarget;
|
14893 | },
|
14894 | mapToIds: function mapToIds(targets) {
|
14895 | return targets.map(function (d) {
|
14896 | return d.id;
|
14897 | });
|
14898 | },
|
14899 | mapToTargetIds: function mapToTargetIds(ids) {
|
14900 | var $$ = this;
|
14901 | return ids ? isArray(ids) ? ids.concat() : [ids] : $$.mapToIds($$.data.targets);
|
14902 | },
|
14903 | hasTarget: function hasTarget(targets, id) {
|
14904 | var ids = this.mapToIds(targets);
|
14905 |
|
14906 | for (var val, i = 0; val = ids[i]; i++) if (val === id) return !0;
|
14907 |
|
14908 | return !1;
|
14909 | },
|
14910 | isTargetToShow: function isTargetToShow(targetId) {
|
14911 | return this.hiddenTargetIds.indexOf(targetId) < 0;
|
14912 | },
|
14913 | isLegendToShow: function isLegendToShow(targetId) {
|
14914 | return this.hiddenLegendIds.indexOf(targetId) < 0;
|
14915 | },
|
14916 | filterTargetsToShow: function filterTargetsToShow(targets) {
|
14917 | var $$ = this;
|
14918 | return (targets || $$.data.targets).filter(function (t) {
|
14919 | return $$.isTargetToShow(t.id);
|
14920 | });
|
14921 | },
|
14922 | mapTargetsToUniqueXs: function mapTargetsToUniqueXs(targets) {
|
14923 | var $$ = this,
|
14924 | xs = [];
|
14925 | return targets && targets.length && (xs = getUnique(mergeArray(targets.map(function (t) {
|
14926 | return t.values.map(function (v) {
|
14927 | return +v.x;
|
14928 | });
|
14929 | }))), xs = $$.isTimeSeries() ? xs.map(function (x) {
|
14930 | return new Date(+x);
|
14931 | }) : xs.map(function (x) {
|
14932 | return +x;
|
14933 | })), sortValue(xs);
|
14934 | },
|
14935 | addHiddenTargetIds: function addHiddenTargetIds(targetIds) {
|
14936 | this.hiddenTargetIds = this.hiddenTargetIds.concat(targetIds);
|
14937 | },
|
14938 | removeHiddenTargetIds: function removeHiddenTargetIds(targetIds) {
|
14939 | this.hiddenTargetIds = this.hiddenTargetIds.filter(function (id) {
|
14940 | return targetIds.indexOf(id) < 0;
|
14941 | });
|
14942 | },
|
14943 | addHiddenLegendIds: function addHiddenLegendIds(targetIds) {
|
14944 | this.hiddenLegendIds = this.hiddenLegendIds.concat(targetIds);
|
14945 | },
|
14946 | removeHiddenLegendIds: function removeHiddenLegendIds(targetIds) {
|
14947 | this.hiddenLegendIds = this.hiddenLegendIds.filter(function (id) {
|
14948 | return targetIds.indexOf(id) < 0;
|
14949 | });
|
14950 | },
|
14951 | getValuesAsIdKeyed: function getValuesAsIdKeyed(targets) {
|
14952 | var $$ = this,
|
14953 | ys = {},
|
14954 | isMultipleX = $$.isMultipleX(),
|
14955 | xs = isMultipleX ? $$.mapTargetsToUniqueXs(targets).map(function (v) {
|
14956 | return isString(v) ? v : +v;
|
14957 | }) : null;
|
14958 | return targets.forEach(function (t) {
|
14959 | var data = [];
|
14960 | t.values.forEach(function (v) {
|
14961 | var value = v.value;
|
14962 | isArray(value) ? data.push.apply(data, toConsumableArray_default()(value)) : isObject(value) && "high" in value ? data.push.apply(data, toConsumableArray_default()(Object.values(value))) : isMultipleX ? data[$$.getIndexByX(v.x, xs)] = value : data.push(value);
|
14963 | }), ys[t.id] = data;
|
14964 | }), ys;
|
14965 | },
|
14966 | checkValueInTargets: function checkValueInTargets(targets, checker) {
|
14967 | var values,
|
14968 | ids = Object.keys(targets);
|
14969 |
|
14970 | for (var i = 0; i < ids.length; i++) {
|
14971 | values = targets[ids[i]].values;
|
14972 |
|
14973 | for (var j = 0; j < values.length; j++) if (checker(values[j].value)) return !0;
|
14974 | }
|
14975 |
|
14976 | return !1;
|
14977 | },
|
14978 | hasMultiTargets: function hasMultiTargets() {
|
14979 | return this.filterTargetsToShow().length > 1;
|
14980 | },
|
14981 | hasNegativeValueInTargets: function hasNegativeValueInTargets(targets) {
|
14982 | return this.checkValueInTargets(targets, function (v) {
|
14983 | return v < 0;
|
14984 | });
|
14985 | },
|
14986 | hasPositiveValueInTargets: function hasPositiveValueInTargets(targets) {
|
14987 | return this.checkValueInTargets(targets, function (v) {
|
14988 | return v > 0;
|
14989 | });
|
14990 | },
|
14991 | _checkOrder: function _checkOrder(type) {
|
14992 | var config = this.config,
|
14993 | order = config.data_order;
|
14994 | return isString(order) && order.toLowerCase() === type;
|
14995 | },
|
14996 | isOrderDesc: function isOrderDesc() {
|
14997 | return this._checkOrder("desc");
|
14998 | },
|
14999 | isOrderAsc: function isOrderAsc() {
|
15000 | return this._checkOrder("asc");
|
15001 | },
|
15002 |
|
15003 | |
15004 |
|
15005 |
|
15006 |
|
15007 |
|
15008 |
|
15009 | orderTargets: function orderTargets(targetsValue) {
|
15010 | var $$ = this,
|
15011 | config = $$.config,
|
15012 | targets = toConsumableArray_default()(targetsValue),
|
15013 | orderAsc = $$.isOrderAsc(),
|
15014 | orderDesc = $$.isOrderDesc();
|
15015 |
|
15016 |
|
15017 | return orderAsc || orderDesc ? targets.sort(function (t1, t2) {
|
15018 | var reducer = function (p, c) {
|
15019 | return p + Math.abs(c.value);
|
15020 | },
|
15021 | t1Sum = t1.values.reduce(reducer, 0),
|
15022 | t2Sum = t2.values.reduce(reducer, 0);
|
15023 |
|
15024 | return orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
15025 | }) : isFunction(config.data_order) && targets.sort(config.data_order), targets;
|
15026 | },
|
15027 | filterByX: function filterByX(targets, x) {
|
15028 | return mergeArray(targets.map(function (t) {
|
15029 | return t.values;
|
15030 | })).filter(function (v) {
|
15031 | return v.x - x === 0;
|
15032 | });
|
15033 | },
|
15034 | filterRemoveNull: function filterRemoveNull(data) {
|
15035 | var _this2 = this;
|
15036 |
|
15037 | return data.filter(function (d) {
|
15038 | return isValue(_this2.getBaseValue(d));
|
15039 | });
|
15040 | },
|
15041 | filterByXDomain: function filterByXDomain(targets, xDomain) {
|
15042 | return targets.map(function (t) {
|
15043 | return {
|
15044 | id: t.id,
|
15045 | id_org: t.id_org,
|
15046 | values: t.values.filter(function (v) {
|
15047 | return xDomain[0] <= v.x && v.x <= xDomain[1];
|
15048 | })
|
15049 | };
|
15050 | });
|
15051 | },
|
15052 | hasDataLabel: function hasDataLabel() {
|
15053 | var dataLabels = this.config.data_labels;
|
15054 | return isBoolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels);
|
15055 | },
|
15056 | getDataLabelLength: function getDataLabelLength(min, max, key) {
|
15057 | var $$ = this,
|
15058 | lengths = [0, 0];
|
15059 | return $$.selectChart.select("svg").selectAll(".dummy").data([min, max]).enter().append("text").text(function (d) {
|
15060 | return $$.dataLabelFormat(d.id)(d);
|
15061 | }).each(function (d, i) {
|
15062 | lengths[i] = this.getBoundingClientRect()[key] * 1.3;
|
15063 | }).remove(), lengths;
|
15064 | },
|
15065 | isNoneArc: function isNoneArc(d) {
|
15066 | return this.hasTarget(this.data.targets, d.id);
|
15067 | },
|
15068 | isArc: function isArc(d) {
|
15069 | return "data" in d && this.hasTarget(this.data.targets, d.data.id);
|
15070 | },
|
15071 | findSameXOfValues: function findSameXOfValues(values, index) {
|
15072 | var i,
|
15073 | targetX = values[index].x,
|
15074 | sames = [];
|
15075 |
|
15076 | for (i = index - 1; i >= 0 && !(targetX !== values[i].x); i--) sames.push(values[i]);
|
15077 |
|
15078 | for (i = index; i < values.length && !(targetX !== values[i].x); i++) sames.push(values[i]);
|
15079 |
|
15080 | return sames;
|
15081 | },
|
15082 | findClosestFromTargets: function findClosestFromTargets(targets, pos) {
|
15083 | var $$ = this,
|
15084 | candidates = targets.map(function (target) {
|
15085 | return $$.findClosest(target.values, pos);
|
15086 | });
|
15087 |
|
15088 |
|
15089 | return $$.findClosest(candidates, pos);
|
15090 | },
|
15091 | findClosest: function findClosest(values, pos) {
|
15092 | var closest,
|
15093 | $$ = this,
|
15094 | minDist = $$.config.point_sensitivity;
|
15095 | return values.filter(function (v) {
|
15096 | return v && $$.isBarType(v.id);
|
15097 | }).forEach(function (v) {
|
15098 | var shape = $$.main.select(".".concat(config_classes.bars).concat($$.getTargetSelectorSuffix(v.id), " .").concat(config_classes.bar, "-").concat(v.index)).node();
|
15099 | !closest && $$.isWithinBar(shape) && (closest = v);
|
15100 | }), values.filter(function (v) {
|
15101 | return v && !$$.isBarType(v.id);
|
15102 | }).forEach(function (v) {
|
15103 | var d = $$.dist(v, pos);
|
15104 | d < minDist && (minDist = d, closest = v);
|
15105 | }), closest;
|
15106 | },
|
15107 | dist: function dist(data, pos) {
|
15108 | var $$ = this,
|
15109 | isRotated = $$.config.axis_rotated,
|
15110 | xIndex = isRotated ? 1 : 0,
|
15111 | yIndex = isRotated ? 0 : 1,
|
15112 | y = $$.circleY(data, data.index),
|
15113 | x = ($$.zoomScale || $$.x)(data.x);
|
15114 | return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));
|
15115 | },
|
15116 |
|
15117 | |
15118 |
|
15119 |
|
15120 |
|
15121 |
|
15122 |
|
15123 | convertValuesToStep: function convertValuesToStep(values) {
|
15124 | var $$ = this,
|
15125 | config = $$.config,
|
15126 | isRotated = config.axis_rotated,
|
15127 | stepType = config.line_step_type,
|
15128 | isCategorized = $$.isCategorized(),
|
15129 | converted = isArray(values) ? values.concat() : [values];
|
15130 | if (!isRotated && !isCategorized) return values;
|
15131 |
|
15132 | var id = converted[0].id,
|
15133 | x = converted[0].x - 1,
|
15134 | value = converted[0].value;
|
15135 |
|
15136 | return isCategorized && converted.unshift({
|
15137 | x: x,
|
15138 | value: value,
|
15139 | id: id
|
15140 | }), stepType === "step-after" && converted.unshift({
|
15141 | x: x - 1,
|
15142 | value: value,
|
15143 | id: id
|
15144 | }), x = converted.length, value = converted[x - 1].value, isCategorized && converted.push({
|
15145 | x: x,
|
15146 | value: value,
|
15147 | id: id
|
15148 | }), stepType === "step-before" && converted.push({
|
15149 | x: x + 1,
|
15150 | value: value,
|
15151 | id: id
|
15152 | }), converted;
|
15153 | },
|
15154 | convertValuesToRange: function convertValuesToRange(values) {
|
15155 | var converted = isArray(values) ? values.concat() : [values],
|
15156 | ranges = [];
|
15157 | return converted.forEach(function (range) {
|
15158 | var x = range.x,
|
15159 | id = range.id;
|
15160 | ranges.push({
|
15161 | x: x,
|
15162 | id: id,
|
15163 | value: range.value[0]
|
15164 | }), ranges.push({
|
15165 | x: x,
|
15166 | id: id,
|
15167 | value: range.value[2]
|
15168 | });
|
15169 | }), ranges;
|
15170 | },
|
15171 | updateDataAttributes: function updateDataAttributes(name, attrs) {
|
15172 | var $$ = this,
|
15173 | config = $$.config,
|
15174 | current = config["data_".concat(name)];
|
15175 | return isUndefined(attrs) ? current : (Object.keys(attrs).forEach(function (id) {
|
15176 | current[id] = attrs[id];
|
15177 | }), $$.redraw({
|
15178 | withLegend: !0
|
15179 | }), current);
|
15180 | },
|
15181 | getAreaRangeData: function getAreaRangeData(d, type) {
|
15182 | var value = d.value;
|
15183 |
|
15184 | if (isArray(value)) {
|
15185 | var index = ["high", "mid", "low"].indexOf(type);
|
15186 | return index === -1 ? null : value[index];
|
15187 | }
|
15188 |
|
15189 | return value[type];
|
15190 | },
|
15191 |
|
15192 | |
15193 |
|
15194 |
|
15195 |
|
15196 |
|
15197 |
|
15198 |
|
15199 |
|
15200 | getRatio: function getRatio(type, d, asPercent) {
|
15201 | var $$ = this,
|
15202 | config = $$.config,
|
15203 | api = $$.api,
|
15204 | ratio = 0;
|
15205 |
|
15206 | if (d && api.data.shown.call(api).length) {
|
15207 | var dataValues = api.data.values.bind(api);
|
15208 | if (ratio = d.ratio || d.value, type === "arc") {
|
15209 |
|
15210 | if ($$.pie.padAngle()()) {
|
15211 | var total = $$.getTotalDataSum();
|
15212 | $$.hiddenTargetIds.length && (total -= dataValues($$.hiddenTargetIds).reduce(function (p, c) {
|
15213 | return p + c;
|
15214 | })), ratio = d.value / total;
|
15215 | } else ratio = (d.endAngle - d.startAngle) / (Math.PI * ($$.hasType("gauge") && !config.gauge_fullCircle ? 1 : 2));
|
15216 | } else if (type === "index") {
|
15217 | var _total = this.getTotalPerIndex();
|
15218 |
|
15219 | if ($$.hiddenTargetIds.length) {
|
15220 | var hiddenSum = dataValues($$.hiddenTargetIds, !1);
|
15221 | hiddenSum.length && (hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
15222 | return acc.map(function (v, i) {
|
15223 | return (isNumber(v) ? v : 0) + curr[i];
|
15224 | });
|
15225 | }), _total = _total.map(function (v, i) {
|
15226 | return v - hiddenSum[i];
|
15227 | }));
|
15228 | }
|
15229 |
|
15230 | d.ratio = isNumber(d.value) && _total && _total[d.index] > 0 ? d.value / _total[d.index] : 0, ratio = d.ratio;
|
15231 | } else type === "radar" && (ratio = parseFloat(Math.max(d.value, 0)) / $$.maxValue * config.radar_size_ratio);
|
15232 | }
|
15233 |
|
15234 | return asPercent && ratio ? ratio * 100 : ratio;
|
15235 | }
|
15236 | });
|
15237 |
|
15238 | var EOL = {},
|
15239 | EOF = {},
|
15240 | QUOTE = 34,
|
15241 | NEWLINE = 10,
|
15242 | RETURN = 13;
|
15243 |
|
15244 | function objectConverter(columns) {
|
15245 | return new Function("d", "return {" + columns.map(function(name, i) {
|
15246 | return JSON.stringify(name) + ": d[" + i + "]";
|
15247 | }).join(",") + "}");
|
15248 | }
|
15249 |
|
15250 | function customConverter(columns, f) {
|
15251 | var object = objectConverter(columns);
|
15252 | return function(row, i) {
|
15253 | return f(object(row), i, columns);
|
15254 | };
|
15255 | }
|
15256 |
|
15257 |
|
15258 | function inferColumns(rows) {
|
15259 | var columnSet = Object.create(null),
|
15260 | columns = [];
|
15261 |
|
15262 | rows.forEach(function(row) {
|
15263 | for (var column in row) {
|
15264 | if (!(column in columnSet)) {
|
15265 | columns.push(columnSet[column] = column);
|
15266 | }
|
15267 | }
|
15268 | });
|
15269 |
|
15270 | return columns;
|
15271 | }
|
15272 |
|
15273 | function dsv_pad(value, width) {
|
15274 | var s = value + "", length = s.length;
|
15275 | return length < width ? new Array(width - length + 1).join(0) + s : s;
|
15276 | }
|
15277 |
|
15278 | function dsv_formatYear(year) {
|
15279 | return year < 0 ? "-" + dsv_pad(-year, 6)
|
15280 | : year > 9999 ? "+" + dsv_pad(year, 6)
|
15281 | : dsv_pad(year, 4);
|
15282 | }
|
15283 |
|
15284 | function formatDate(date) {
|
15285 | var hours = date.getUTCHours(),
|
15286 | minutes = date.getUTCMinutes(),
|
15287 | seconds = date.getUTCSeconds(),
|
15288 | milliseconds = date.getUTCMilliseconds();
|
15289 | return isNaN(date) ? "Invalid Date"
|
15290 | : dsv_formatYear(date.getUTCFullYear(), 4) + "-" + dsv_pad(date.getUTCMonth() + 1, 2) + "-" + dsv_pad(date.getUTCDate(), 2)
|
15291 | + (milliseconds ? "T" + dsv_pad(hours, 2) + ":" + dsv_pad(minutes, 2) + ":" + dsv_pad(seconds, 2) + "." + dsv_pad(milliseconds, 3) + "Z"
|
15292 | : seconds ? "T" + dsv_pad(hours, 2) + ":" + dsv_pad(minutes, 2) + ":" + dsv_pad(seconds, 2) + "Z"
|
15293 | : minutes || hours ? "T" + dsv_pad(hours, 2) + ":" + dsv_pad(minutes, 2) + "Z"
|
15294 | : "");
|
15295 | }
|
15296 |
|
15297 | var dsv = (function(delimiter) {
|
15298 | var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
|
15299 | DELIMITER = delimiter.charCodeAt(0);
|
15300 |
|
15301 | function parse(text, f) {
|
15302 | var convert, columns, rows = parseRows(text, function(row, i) {
|
15303 | if (convert) return convert(row, i - 1);
|
15304 | columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
|
15305 | });
|
15306 | rows.columns = columns || [];
|
15307 | return rows;
|
15308 | }
|
15309 |
|
15310 | function parseRows(text, f) {
|
15311 | var rows = [],
|
15312 | N = text.length,
|
15313 | I = 0,
|
15314 | n = 0,
|
15315 | t,
|
15316 | eof = N <= 0,
|
15317 | eol = false;
|
15318 |
|
15319 |
|
15320 | if (text.charCodeAt(N - 1) === NEWLINE) --N;
|
15321 | if (text.charCodeAt(N - 1) === RETURN) --N;
|
15322 |
|
15323 | function token() {
|
15324 | if (eof) return EOF;
|
15325 | if (eol) return eol = false, EOL;
|
15326 |
|
15327 |
|
15328 | var i, j = I, c;
|
15329 | if (text.charCodeAt(j) === QUOTE) {
|
15330 | while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);
|
15331 | if ((i = I) >= N) eof = true;
|
15332 | else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;
|
15333 | else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
|
15334 | return text.slice(j + 1, i - 1).replace(/""/g, "\"");
|
15335 | }
|
15336 |
|
15337 | // Find next delimiter or newline.
|
15338 | while (I < N) {
|
15339 | if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;
|
15340 | else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }
|
15341 | else if (c !== DELIMITER) continue;
|
15342 | return text.slice(j, i);
|
15343 | }
|
15344 |
|
15345 | // Return last token before EOF.
|
15346 | return eof = true, text.slice(j, N);
|
15347 | }
|
15348 |
|
15349 | while ((t = token()) !== EOF) {
|
15350 | var row = [];
|
15351 | while (t !== EOL && t !== EOF) row.push(t), t = token();
|
15352 | if (f && (row = f(row, n++)) == null) continue;
|
15353 | rows.push(row);
|
15354 | }
|
15355 |
|
15356 | return rows;
|
15357 | }
|
15358 |
|
15359 | function preformatBody(rows, columns) {
|
15360 | return rows.map(function(row) {
|
15361 | return columns.map(function(column) {
|
15362 | return formatValue(row[column]);
|
15363 | }).join(delimiter);
|
15364 | });
|
15365 | }
|
15366 |
|
15367 | function format(rows, columns) {
|
15368 | if (columns == null) columns = inferColumns(rows);
|
15369 | return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n");
|
15370 | }
|
15371 |
|
15372 | function formatBody(rows, columns) {
|
15373 | if (columns == null) columns = inferColumns(rows);
|
15374 | return preformatBody(rows, columns).join("\n");
|
15375 | }
|
15376 |
|
15377 | function formatRows(rows) {
|
15378 | return rows.map(formatRow).join("\n");
|
15379 | }
|
15380 |
|
15381 | function formatRow(row) {
|
15382 | return row.map(formatValue).join(delimiter);
|
15383 | }
|
15384 |
|
15385 | function formatValue(value) {
|
15386 | return value == null ? ""
|
15387 | : value instanceof Date ? formatDate(value)
|
15388 | : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\""
|
15389 | : value;
|
15390 | }
|
15391 |
|
15392 | return {
|
15393 | parse: parse,
|
15394 | parseRows: parseRows,
|
15395 | format: format,
|
15396 | formatBody: formatBody,
|
15397 | formatRows: formatRows
|
15398 | };
|
15399 | });
|
15400 |
|
15401 | // CONCATENATED MODULE: ./node_modules/d3-dsv/src/csv.js
|
15402 |
|
15403 |
|
15404 | var csv = dsv(",");
|
15405 |
|
15406 | var csvParse = csv.parse;
|
15407 | var csvParseRows = csv.parseRows;
|
15408 | var csvFormat = csv.format;
|
15409 | var csvFormatBody = csv.formatBody;
|
15410 | var csvFormatRows = csv.formatRows;
|
15411 |
|
15412 | // CONCATENATED MODULE: ./node_modules/d3-dsv/src/tsv.js
|
15413 |
|
15414 |
|
15415 | var tsv_tsv = dsv("\t");
|
15416 |
|
15417 | var tsvParse = tsv_tsv.parse;
|
15418 | var tsvParseRows = tsv_tsv.parseRows;
|
15419 | var tsvFormat = tsv_tsv.format;
|
15420 | var tsvFormatBody = tsv_tsv.formatBody;
|
15421 | var tsvFormatRows = tsv_tsv.formatRows;
|
15422 |
|
15423 | // CONCATENATED MODULE: ./node_modules/d3-dsv/src/autoType.js
|
15424 | function autoType(object) {
|
15425 | for (var key in object) {
|
15426 | var value = object[key].trim(), number;
|
15427 | if (!value) value = null;
|
15428 | else if (value === "true") value = true;
|
15429 | else if (value === "false") value = false;
|
15430 | else if (value === "NaN") value = NaN;
|
15431 | else if (!isNaN(number = +value)) value = number;
|
15432 | else if (/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/.test(value)) value = new Date(value);
|
15433 | else continue;
|
15434 | object[key] = value;
|
15435 | }
|
15436 | return object;
|
15437 | }
|
15438 |
|
15439 | // CONCATENATED MODULE: ./node_modules/d3-dsv/src/index.js
|
15440 |
|
15441 |
|
15442 |
|
15443 |
|
15444 |
|
15445 | // CONCATENATED MODULE: ./src/data/data.convert.js
|
15446 | /**
|
15447 | * Copyright (c) 2017 ~ present NAVER Corp.
|
15448 | * billboard.js project is licensed under the MIT license
|
15449 | */
|
15450 |
|
15451 |
|
15452 |
|
15453 | util_extend(ChartInternal_ChartInternal.prototype, {
|
15454 | /**
|
15455 | * Convert data according its type
|
15456 | * @param {Object} args data object
|
15457 | * @param {Function} [callback] callback for url(XHR) type loading
|
15458 | * @return {Object}
|
15459 | * @private
|
15460 | */
|
15461 | convertData: function convertData(args, callback) {
|
15462 | var data,
|
15463 | $$ = this;
|
15464 | if (args.bindto ? (data = {}, ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) {
|
15465 | var key = "data_".concat(v);
|
15466 | key in args && (data[v] = args[key]);
|
15467 | })) : data = args, data.url && callback) $$.convertUrlToData(data.url, data.mimeType, data.headers, data.keys, callback);else if (data.json) data = $$.convertJsonToData(data.json, data.keys);else if (data.rows) data = $$.convertRowsToData(data.rows);else if (data.columns) data = $$.convertColumnsToData(data.columns);else if (args.bindto) throw Error("url or json or rows or columns is required.");
|
15468 | return data;
|
15469 | },
|
15470 | convertUrlToData: function convertUrlToData(url) {
|
15471 | var _this = this,
|
15472 | mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "csv",
|
15473 | headers = arguments.length > 2 ? arguments[2] : undefined,
|
15474 | keys = arguments.length > 3 ? arguments[3] : undefined,
|
15475 | done = arguments.length > 4 ? arguments[4] : undefined,
|
15476 | req = new XMLHttpRequest();
|
15477 |
|
15478 | headers && Object.keys(headers).forEach(function (key) {
|
15479 | req.setRequestHeader(key, headers[key]);
|
15480 | }), req.open("GET", url), req.onreadystatechange = function () {
|
15481 | if (req.readyState === 4) if (req.status === 200) {
|
15482 | var response = req.responseText;
|
15483 | response && done.call(_this, _this["convert".concat(capitalize(mimeType), "ToData")](mimeType === "json" ? JSON.parse(response) : response, keys));
|
15484 | } else throw new Error("".concat(url, ": Something went wrong loading!"));
|
15485 | }, req.send();
|
15486 | },
|
15487 | _convertCsvTsvToData: function _convertCsvTsvToData(parser, xsv) {
|
15488 | var d,
|
15489 | rows = parser.rows(xsv);
|
15490 | return rows.length === 1 ? (d = [{}], rows[0].forEach(function (id) {
|
15491 | d[0][id] = null;
|
15492 | })) : d = parser.parse(xsv), d;
|
15493 | },
|
15494 | convertCsvToData: function convertCsvToData(xsv) {
|
15495 | return this._convertCsvTsvToData({
|
15496 | rows: csvParseRows,
|
15497 | parse: csvParse
|
15498 | }, xsv);
|
15499 | },
|
15500 | convertTsvToData: function convertTsvToData(tsv) {
|
15501 | return this._convertCsvTsvToData({
|
15502 | rows: tsvParseRows,
|
15503 | parse: tsvParse
|
15504 | }, tsv);
|
15505 | },
|
15506 | convertJsonToData: function convertJsonToData(json, keysParam) {
|
15507 | var targetKeys,
|
15508 | data,
|
15509 | _this2 = this,
|
15510 | config = this.config,
|
15511 | newRows = [];
|
15512 |
|
15513 | if (isArray(json)) {
|
15514 | var keys = keysParam || config.data_keys;
|
15515 | keys.x ? (targetKeys = keys.value.concat(keys.x), config.data_x = keys.x) : targetKeys = keys.value, newRows.push(targetKeys), json.forEach(function (o) {
|
15516 | var newRow = targetKeys.map(function (key) {
|
15517 | // convert undefined to null because undefined data will be removed in convertDataToTargets()
|
15518 | var v = _this2.findValueInJson(o, key);
|
15519 |
|
15520 | return isUndefined(v) && (v = null), v;
|
15521 | });
|
15522 | newRows.push(newRow);
|
15523 | }), data = this.convertRowsToData(newRows);
|
15524 | } else Object.keys(json).forEach(function (key) {
|
15525 | var tmp = json[key].concat();
|
15526 | tmp.unshift(key), newRows.push(tmp);
|
15527 | }), data = this.convertColumnsToData(newRows);
|
15528 |
|
15529 | return data;
|
15530 | },
|
15531 | findValueInJson: function findValueInJson(object, path) {
|
15532 | if (object[path] !== undefined) return object[path];
|
15533 | var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"),
|
15534 | pathArray = convertedPath.replace(/^\./, "").split("."),
|
15535 | target = object; // convert indexes to properties (replace [] with .)
|
15536 |
|
15537 | return pathArray.some(function (k) {
|
15538 | return !(target = target && k in target ? target[k] : undefined);
|
15539 | }), target;
|
15540 | },
|
15541 | convertRowsToData: function convertRowsToData(rows) {
|
15542 | var keys = rows[0],
|
15543 | newRows = [];
|
15544 |
|
15545 | for (var i = 1, len1 = rows.length; i < len1; i++) {
|
15546 | var newRow = {};
|
15547 |
|
15548 | for (var j = 0, len2 = rows[i].length; j < len2; j++) {
|
15549 | if (isUndefined(rows[i][j])) throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!"));
|
15550 | newRow[keys[j]] = rows[i][j];
|
15551 | }
|
15552 |
|
15553 | newRows.push(newRow);
|
15554 | }
|
15555 |
|
15556 | return newRows;
|
15557 | },
|
15558 | convertColumnsToData: function convertColumnsToData(columns) {
|
15559 | var newRows = [];
|
15560 |
|
15561 | for (var i = 0, len1 = columns.length; i < len1; i++) {
|
15562 | var key = columns[i][0];
|
15563 |
|
15564 | for (var j = 1, len2 = columns[i].length; j < len2; j++) {
|
15565 | if (isUndefined(newRows[j - 1]) && (newRows[j - 1] = {}), isUndefined(columns[i][j])) throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!"));
|
15566 | newRows[j - 1][key] = columns[i][j];
|
15567 | }
|
15568 | }
|
15569 |
|
15570 | return newRows;
|
15571 | },
|
15572 | convertDataToTargets: function convertDataToTargets(data, appendXs) {
|
15573 | var xsData,
|
15574 | _this3 = this,
|
15575 | $$ = this,
|
15576 | config = $$.config,
|
15577 | dataKeys = Object.keys(data[0] || {}),
|
15578 | ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [],
|
15579 | xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : [];
|
15580 |
|
15581 | ids.forEach(function (id) {
|
15582 | var xKey = _this3.getXKey(id);
|
15583 |
|
15584 | _this3.isCustomX() || _this3.isTimeSeries() ? xs.indexOf(xKey) >= 0 ? xsData = (appendXs && $$.data.xs[id] || []).concat(data.map(function (d) {
|
15585 | return d[xKey];
|
15586 | }).filter(isValue).map(function (rawX, i) {
|
15587 | return $$.generateTargetX(rawX, id, i);
|
15588 | })) : config.data_x ? xsData = _this3.getOtherTargetXs() : notEmpty(config.data_xs) && (xsData = $$.getXValuesOfXKey(xKey, $$.data.targets)) : xsData = data.map(function (d, i) {
|
15589 | return i;
|
15590 | }), xsData && (_this3.data.xs[id] = xsData);
|
15591 | }), ids.forEach(function (id) {
|
15592 | if (!xsData) throw new Error("x is not defined for id = \"".concat(id, "\"."));
|
15593 | });
|
15594 | // convert to target
|
15595 | var targets = ids.map(function (id, index) {
|
15596 | var convertedId = config.data_idConverter(id),
|
15597 | xKey = $$.getXKey(id),
|
15598 | isCategorized = $$.isCustomX() && $$.isCategorized(),
|
15599 | hasCategory = isCategorized && data.map(function (v) {
|
15600 | return v.x;
|
15601 | }).every(function (v) {
|
15602 | return config.axis_x_categories.indexOf(v) > -1;
|
15603 | });
|
15604 | return {
|
15605 | id: convertedId,
|
15606 | id_org: id,
|
15607 | values: data.map(function (d, i) {
|
15608 | var x,
|
15609 | rawX = d[xKey],
|
15610 | value = d[id];
|
15611 | return value = value === null || isNaN(value) ? isArray(value) || isObject(value) && value.high ? value : null : +d[id], isCategorized && index === 0 && !isUndefined(rawX) ? (!hasCategory && index === 0 && i === 0 && (config.axis_x_categories = []), x = config.axis_x_categories.indexOf(rawX), x === -1 && (x = config.axis_x_categories.length, config.axis_x_categories.push(rawX))) : x = $$.generateTargetX(rawX, id, i), (isUndefined(d[id]) || $$.data.xs[id].length <= i) && (x = undefined), {
|
15612 | x: x,
|
15613 | value: value,
|
15614 | id: convertedId
|
15615 | };
|
15616 | }).filter(function (v) {
|
15617 | return isDefined(v.x);
|
15618 | })
|
15619 | };
|
15620 | }); // finish targets
|
15621 |
|
15622 | return targets.forEach(function (t) {
|
15623 | config.data_xSort && (t.values = t.values.sort(function (v1, v2) {
|
15624 | var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
|
15625 | x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
|
15626 | return x1 - x2;
|
15627 | })), t.values.forEach(function (v, i) {
|
15628 | return v.index = i;
|
15629 | }), $$.data.xs[t.id].sort(function (v1, v2) {
|
15630 | return v1 - v2;
|
15631 | });
|
15632 | }), $$.hasNegativeValue = $$.hasNegativeValueInTargets(targets), $$.hasPositiveValue = $$.hasPositiveValueInTargets(targets), config.data_type && $$.setTargetType($$.mapToIds(targets).filter(function (id) {
|
15633 | return !(id in config.data_types);
|
15634 | }), config.data_type), targets.forEach(function (d) {
|
15635 | return $$.addCache(d.id_org, d, !0);
|
15636 | }), targets;
|
15637 | }
|
15638 | });
|
15639 | // CONCATENATED MODULE: ./src/data/data.load.js
|
15640 | /**
|
15641 | * Copyright (c) 2017 ~ present NAVER Corp.
|
15642 | * billboard.js project is licensed under the MIT license
|
15643 | */
|
15644 |
|
15645 |
|
15646 |
|
15647 | util_extend(ChartInternal_ChartInternal.prototype, {
|
15648 | load: function load(rawTargets, args) {
|
15649 | var $$ = this,
|
15650 | targets = rawTargets;
|
15651 | // Set targets
|
15652 | // Redraw with new targets
|
15653 | targets && (args.filter && (targets = targets.filter(args.filter)), (args.type || args.types) && targets.forEach(function (t) {
|
15654 | var type = args.types && args.types[t.id] || args.type;
|
15655 | $$.setTargetType(t.id, type);
|
15656 | }), $$.data.targets.forEach(function (d) {
|
15657 | for (var i = 0; i < targets.length; i++) if (d.id === targets[i].id) {
|
15658 | d.values = targets[i].values, targets.splice(i, 1);
|
15659 | break;
|
15660 | }
|
15661 | }), $$.data.targets = $$.data.targets.concat(targets)), $$.updateTargets($$.data.targets), $$.redraw({
|
15662 | withUpdateOrgXDomain: !0,
|
15663 | withUpdateXDomain: !0,
|
15664 | withLegend: !0
|
15665 | }), args.done && args.done();
|
15666 | },
|
15667 | loadFromArgs: function loadFromArgs(args) {
|
15668 | var $$ = this; // prevent load when chart is already destroyed
|
15669 |
|
15670 | if ($$.config) {
|
15671 | $$.resetCache();
|
15672 | var data = args.data || $$.convertData(args, function (d) {
|
15673 | return $$.load($$.convertDataToTargets(d), args);
|
15674 | });
|
15675 | $$.load(data ? $$.convertDataToTargets(data) : null, args);
|
15676 | } // reset internally cached data
|
15677 |
|
15678 | },
|
15679 | unload: function unload(rawTargetIds, customDoneCb) {
|
15680 | var $$ = this,
|
15681 | done = customDoneCb,
|
15682 | targetIds = rawTargetIds;
|
15683 | // If no target, call done and return
|
15684 | return $$.resetCache(), done || (done = function () {}), targetIds = targetIds.filter(function (id) {
|
15685 | return $$.hasTarget($$.data.targets, id);
|
15686 | }), targetIds && targetIds.length !== 0 ? void ($$.svg.selectAll(targetIds.map(function (id) {
|
15687 | return $$.selectorTarget(id);
|
15688 | })).transition().style("opacity", "0").remove().call($$.endall, done), targetIds.forEach(function (id) {
|
15689 | $$.withoutFadeIn[id] = !1, $$.legend && $$.legend.selectAll(".".concat(config_classes.legendItem).concat($$.getTargetSelectorSuffix(id))).remove(), $$.data.targets = $$.data.targets.filter(function (t) {
|
15690 | return t.id !== id;
|
15691 | });
|
15692 | })) : void done();
|
15693 | }
|
15694 | });
|
15695 | // CONCATENATED MODULE: ./src/internals/category.js
|
15696 | /**
|
15697 | * Copyright (c) 2017 ~ present NAVER Corp.
|
15698 | * billboard.js project is licensed under the MIT license
|
15699 | */
|
15700 |
|
15701 |
|
15702 | util_extend(ChartInternal_ChartInternal.prototype, {
|
15703 | /**
|
15704 | * Category Name
|
15705 | * @private
|
15706 | * @param {Number} index
|
15707 | * @returns {String} gategory Name
|
15708 | */
|
15709 | categoryName: function categoryName(i) {
|
15710 | var config = this.config;
|
15711 | return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;
|
15712 | }
|
15713 | });
|
15714 | // CONCATENATED MODULE: ./src/interactions/interaction.js
|
15715 | /**
|
15716 | * Copyright (c) 2017 ~ present NAVER Corp.
|
15717 | * billboard.js project is licensed under the MIT license
|
15718 | */
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 |
|
15724 |
|
15725 | util_extend(ChartInternal_ChartInternal.prototype, {
|
15726 | /**
|
15727 | * Initialize the area that detects the event.
|
15728 | * Add a container for the zone that detects the event.
|
15729 | * @private
|
15730 | */
|
15731 | initEventRect: function initEventRect() {
|
15732 | var $$ = this;
|
15733 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.eventRects).style("fill-opacity", "0");
|
15734 | },
|
15735 |
|
15736 | /**
|
15737 | * Redraws the area that detects the event.
|
15738 | * @private
|
15739 | */
|
15740 | redrawEventRect: function redrawEventRect() {
|
15741 | var eventRectUpdate,
|
15742 | $$ = this,
|
15743 | config = $$.config,
|
15744 | isMultipleX = $$.isMultipleX(),
|
15745 | zoomEnabled = config.zoom_enabled,
|
15746 | eventRects = $$.main.select(".".concat(config_classes.eventRects)).style("cursor", zoomEnabled && zoomEnabled.type !== "drag" ? config.axis_rotated ? "ns-resize" : "ew-resize" : null).classed(config_classes.eventRectsMultiple, isMultipleX).classed(config_classes.eventRectsSingle, !isMultipleX);
|
15747 | if (eventRects.selectAll(".".concat(config_classes.eventRect)).remove(), $$.eventRect = eventRects.selectAll(".".concat(config_classes.eventRect)), isMultipleX) eventRectUpdate = $$.eventRect.data([0]), eventRectUpdate = $$.generateEventRectsForMultipleXs(eventRectUpdate.enter()).merge(eventRectUpdate);else {
|
15748 | // Set data and update $$.eventRect
|
15749 | var maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets);
|
15750 | eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []), $$.eventRect = eventRects.selectAll(".".concat(config_classes.eventRect)), eventRectUpdate = $$.eventRect.data(function (d) {
|
15751 | return d;
|
15752 | }), eventRectUpdate.exit().remove(), eventRectUpdate = $$.generateEventRectsForSingleX(eventRectUpdate.enter()).merge(eventRectUpdate);
|
15753 | }
|
15754 | $$.updateEventRect(eventRectUpdate), $$.inputType !== "touch" || $$.svg.on("touchstart.eventRect") || $$.hasArcType() || $$.bindTouchOnEventRect(isMultipleX);
|
15755 | },
|
15756 | bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) {
|
15757 | var startPx,
|
15758 | $$ = this,
|
15759 | config = $$.config,
|
15760 | getEventRect = function () {
|
15761 | var touch = on_event.changedTouches[0];
|
15762 | return src_select(browser["document"].elementFromPoint(touch.clientX, touch.clientY));
|
15763 | },
|
15764 | getIndex = function (eventRect) {
|
15765 | var index = eventRect && eventRect.attr("class") && eventRect.attr("class").replace(new RegExp("(".concat(config_classes.eventRect, "-?|s)"), "g"), "") * 1;
|
15766 | return (isNaN(index) || index === null) && (index = -1), index;
|
15767 | },
|
15768 | selectRect = function (context) {
|
15769 | if (isMultipleX) $$.selectRectForMultipleXs(context);else {
|
15770 | var eventRect = getEventRect(),
|
15771 | index = getIndex(eventRect);
|
15772 | $$.callOverOutForTouch(index), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index);
|
15773 | }
|
15774 | },
|
15775 | preventDefault = config.interaction_inputType_touch.preventDefault,
|
15776 | isPrevented = isBoolean(preventDefault) && preventDefault || !1,
|
15777 | preventThreshold = !isNaN(preventDefault) && preventDefault || null,
|
15778 | preventEvent = function (event) {
|
15779 | var eventType = event.type,
|
15780 | touch = event.changedTouches[0],
|
15781 | currentXY = touch["client".concat(config.axis_rotated ? "Y" : "X")];
|
15782 | eventType === "touchstart" ? isPrevented ? event.preventDefault() : preventThreshold !== null && (startPx = currentXY) : eventType === "touchmove" && (isPrevented || startPx === !0 || preventThreshold !== null && Math.abs(startPx - currentXY) >= preventThreshold) && (startPx = !0, event.preventDefault());
|
15783 | };
|
15784 |
|
15785 | // bind touch events
|
15786 | $$.svg.on("touchstart.eventRect touchmove.eventRect", function () {
|
15787 | var eventRect = getEventRect();
|
15788 |
|
15789 | if (!eventRect.empty() && eventRect.classed(config_classes.eventRect)) {
|
15790 | if ($$.dragging || $$.flowing || $$.hasArcType()) return;
|
15791 | preventEvent(on_event), selectRect(this);
|
15792 | } else $$.unselectRect(), $$.callOverOutForTouch();
|
15793 | }).on("touchend.eventRect", function () {
|
15794 | var eventRect = getEventRect();
|
15795 | !eventRect.empty() && eventRect.classed(config_classes.eventRect) && ($$.hasArcType() || !$$.toggleShape || $$.cancelClick) && $$.cancelClick && ($$.cancelClick = !1);
|
15796 | });
|
15797 | },
|
15798 |
|
15799 | /**
|
15800 | * Updates the location and size of the eventRect.
|
15801 | * @private
|
15802 | * @param {Object} d3.select(CLASS.eventRects) object.
|
15803 | */
|
15804 | updateEventRect: function updateEventRect(eventRectUpdate) {
|
15805 | var x,
|
15806 | y,
|
15807 | w,
|
15808 | h,
|
15809 | $$ = this,
|
15810 | config = $$.config,
|
15811 | xScale = $$.zoomScale || $$.x,
|
15812 | eventRectData = eventRectUpdate || $$.eventRect.data(),
|
15813 | isRotated = config.axis_rotated;
|
15814 | if ($$.isMultipleX()) // TODO: rotated not supported yet
|
15815 | x = 0, y = 0, w = $$.width, h = $$.height;else {
|
15816 | var rectW, rectX;
|
15817 | if ($$.isCategorized()) rectW = $$.getEventRectWidth(), rectX = function (d) {
|
15818 | return xScale(d.x) - rectW / 2;
|
15819 | };else {
|
15820 | $$.updateXs();
|
15821 |
|
15822 | var getPrevNextX = function (d) {
|
15823 | var index = d.index;
|
15824 | return {
|
15825 | prev: $$.getPrevX(index),
|
15826 | next: $$.getNextX(index)
|
15827 | };
|
15828 | };
|
15829 |
|
15830 | rectW = function (d) {
|
15831 | var x = getPrevNextX(d); // if there this is a single data point make the eventRect full width (or height)
|
15832 |
|
15833 | return x.prev === null && x.next === null ? isRotated ? $$.height : $$.width : (x.prev === null && (x.prev = xScale.domain()[0]), x.next === null && (x.next = xScale.domain()[1]), Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2));
|
15834 | }, rectX = function (d) {
|
15835 | var x = getPrevNextX(d),
|
15836 | thisX = $$.data.xs[d.id][d.index];
|
15837 | // if there this is a single data point position the eventRect at 0
|
15838 | return x.prev === null && x.next === null ? 0 : (x.prev === null && (x.prev = xScale.domain()[0]), (xScale(thisX) + xScale(x.prev)) / 2);
|
15839 | };
|
15840 | }
|
15841 | x = isRotated ? 0 : rectX, y = isRotated ? rectX : 0, w = isRotated ? $$.width : rectW, h = isRotated ? rectW : $$.height;
|
15842 | }
|
15843 | eventRectData.attr("class", $$.classEvent.bind($$)).attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
15844 | },
|
15845 | selectRectForSingle: function selectRectForSingle(context, eventRect, index) {
|
15846 | var $$ = this,
|
15847 | config = $$.config,
|
15848 | isSelectionEnabled = config.data_selection_enabled,
|
15849 | isSelectionGrouped = config.data_selection_grouped,
|
15850 | isTooltipGrouped = config.tooltip_grouped,
|
15851 | selectedData = $$.getAllValuesOnIndex(index);
|
15852 | isTooltipGrouped && ($$.showTooltip(selectedData, context), $$.showXGridFocus(selectedData), !isSelectionEnabled || isSelectionGrouped) || $$.main.selectAll(".".concat(config_classes.shape, "-").concat(index)).each(function () {
|
15853 | src_select(this).classed(config_classes.EXPANDED, !0), isSelectionEnabled && eventRect.style("cursor", isSelectionGrouped ? "pointer" : null), isTooltipGrouped || ($$.hideXGridFocus(), $$.hideTooltip(), !isSelectionGrouped && $$.expandCirclesBars(index));
|
15854 | }).filter(function (d) {
|
15855 | return $$.isWithinShape(this, d);
|
15856 | }).call(function (selected) {
|
15857 | var d = selected.data();
|
15858 | isSelectionEnabled && (isSelectionGrouped || config.data_selection_isselectable(d)) && eventRect.style("cursor", "pointer"), isTooltipGrouped || ($$.showTooltip(d, context), $$.showXGridFocus(d), $$.unexpandCircles(), selected.each(function (d) {
|
15859 | return $$.expandCirclesBars(index, d.id);
|
15860 | }));
|
15861 | });
|
15862 | },
|
15863 | expandCirclesBars: function expandCirclesBars(index, id, reset) {
|
15864 | var $$ = this,
|
15865 | config = $$.config;
|
15866 | config.point_focus_expand_enabled && $$.expandCircles(index, id, reset), $$.expandBars(index, id, reset);
|
15867 | },
|
15868 | selectRectForMultipleXs: function selectRectForMultipleXs(context) {
|
15869 | var $$ = this,
|
15870 | config = $$.config,
|
15871 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
15872 |
|
15873 | // do nothing when dragging
|
15874 | if (!($$.dragging || $$.hasArcType(targetsToShow))) {
|
15875 | var mouse = src_mouse(context),
|
15876 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
15877 | if ($$.mouseover && (!closest || closest.id !== $$.mouseover.id) && (config.data_onout.call($$.api, $$.mouseover), $$.mouseover = undefined), !closest) return void $$.unselectRect();
|
15878 | var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x),
|
15879 | selectedData = sameXData.map(function (d) {
|
15880 | return $$.addName(d);
|
15881 | }); // show tooltip when cursor is close to some point
|
15882 |
|
15883 | $$.showTooltip(selectedData, context), $$.expandCirclesBars(closest.index, closest.id, !0), $$.showXGridFocus(selectedData), ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && ($$.svg.select(".".concat(config_classes.eventRect)).style("cursor", "pointer"), !$$.mouseover && (config.data_onover.call($$.api, closest), $$.mouseover = closest));
|
15884 | }
|
15885 | },
|
15886 |
|
15887 | /**
|
15888 | * Unselect EventRect.
|
15889 | * @private
|
15890 | */
|
15891 | unselectRect: function unselectRect() {
|
15892 | var $$ = this;
|
15893 | $$.svg.select(".".concat(config_classes.eventRect)).style("cursor", null), $$.hideXGridFocus(), $$.hideTooltip(), $$._handleLinkedCharts(!1), $$.unexpandCircles(), $$.unexpandBars();
|
15894 | },
|
15895 |
|
15896 | /**
|
15897 | * Handle data.onover/out callback options
|
15898 | * @param {Boolean} isOver
|
15899 | * @param {Number|Object} d
|
15900 | * @private
|
15901 | */
|
15902 | setOverOut: function setOverOut(isOver, d) {
|
15903 | var $$ = this,
|
15904 | config = $$.config,
|
15905 | isArc = isObject(d);
|
15906 |
|
15907 | // Call event handler
|
15908 | if (isArc || d !== -1) {
|
15909 | var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
15910 | config.color_onover && $$.setOverColor(isOver, d, isArc), isArc ? callback(d) : (isOver && $$.expandCirclesBars(d, null, !0), !$$.isMultipleX() && $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).each(callback));
|
15911 | }
|
15912 | },
|
15913 |
|
15914 | /**
|
15915 | * Call data.onover/out callback for touch event
|
15916 | * @param {Number|Object} d target index or data object for Arc type
|
15917 | * @private
|
15918 | */
|
15919 | callOverOutForTouch: function callOverOutForTouch(d) {
|
15920 | var $$ = this,
|
15921 | callee = $$.callOverOutForTouch,
|
15922 | last = callee.last;
|
15923 | (isObject(d) && last ? d.id !== last.id : d !== last) && ((last || isNumber(last)) && $$.setOverOut(!1, last), (d || isNumber(d)) && $$.setOverOut(!0, d), callee.last = d);
|
15924 | },
|
15925 |
|
15926 | /**
|
15927 | * Return draggable selection function
|
15928 | * @return {Function}
|
15929 | * @private
|
15930 | */
|
15931 | getDraggableSelection: function getDraggableSelection() {
|
15932 | var $$ = this,
|
15933 | config = $$.config;
|
15934 | return config.interaction_enabled && config.data_selection_draggable && $$.drag ? src_drag().on("drag", function () {
|
15935 | $$.drag(src_mouse(this));
|
15936 | }).on("start", function () {
|
15937 | $$.dragstart(src_mouse(this));
|
15938 | }).on("end", function () {
|
15939 | $$.dragend();
|
15940 | }) : function () {};
|
15941 | },
|
15942 |
|
15943 | /**
|
15944 | * Create eventRect for each data on the x-axis.
|
15945 | * Register touch and drag events.
|
15946 | * @private
|
15947 | * @param {Object} d3.select(CLASS.eventRects) object.
|
15948 | * @returns {Object} d3.select(CLASS.eventRects) object.
|
15949 | */
|
15950 | generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) {
|
15951 | var $$ = this,
|
15952 | config = $$.config,
|
15953 | rect = eventRectEnter.append("rect").attr("class", $$.classEvent.bind($$)).style("cursor", config.data_selection_enabled && config.data_selection_grouped ? "pointer" : null).on("click", function (d) {
|
15954 | $$.clickHandlerForSingleX.bind(this)(d, $$);
|
15955 | }).call($$.getDraggableSelection());
|
15956 | return $$.inputType === "mouse" && rect.on("mouseover", function (d) {
|
15957 | $$.dragging || $$.flowing || $$.hasArcType() || $$.setOverOut(!0, d.index);
|
15958 | }).on("mousemove", function (d) {
|
15959 | // do nothing while dragging/flowing
|
15960 | if (!($$.dragging || $$.flowing || $$.hasArcType())) {
|
15961 | var index = d.index,
|
15962 | eventRect = $$.svg.select(".".concat(config_classes.eventRect, "-").concat(index));
|
15963 | $$.isStepType(d) && $$.config.line_step_type === "step-after" && src_mouse(this)[0] < $$.x($$.getXValue(d.id, index)) && (index -= 1), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, eventRect, index);
|
15964 | }
|
15965 | }).on("mouseout", function (d) {
|
15966 | !$$.config || $$.hasArcType() || ($$.unselectRect(), $$.setOverOut(!1, d.index));
|
15967 | }), rect;
|
15968 | },
|
15969 | clickHandlerForSingleX: function clickHandlerForSingleX(d, ctx) {
|
15970 | var $$ = ctx,
|
15971 | config = $$.config;
|
15972 | if ($$.hasArcType() || !$$.toggleShape || $$.cancelClick) return void ($$.cancelClick && ($$.cancelClick = !1));
|
15973 | var index = d.index;
|
15974 | $$.main.selectAll(".".concat(config_classes.shape, "-").concat(index)).each(function (d2) {
|
15975 | (config.data_selection_grouped || $$.isWithinShape(this, d2)) && ($$.toggleShape(this, d2, index), config.data_onclick.call($$.api, d2, this));
|
15976 | });
|
15977 | },
|
15978 |
|
15979 | /**
|
15980 | * Create an eventRect,
|
15981 | * Register touch and drag events.
|
15982 | * @private
|
15983 | * @param {Object} d3.select(CLASS.eventRects) object.
|
15984 | * @returns {Object} d3.select(CLASS.eventRects) object.
|
15985 | */
|
15986 | generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) {
|
15987 | var $$ = this,
|
15988 | rect = eventRectEnter.append("rect").attr("x", 0).attr("y", 0).attr("width", $$.width).attr("height", $$.height).attr("class", config_classes.eventRect).on("click", function () {
|
15989 | $$.clickHandlerForMultipleXS.bind(this)($$);
|
15990 | }).call($$.getDraggableSelection());
|
15991 | return $$.inputType === "mouse" && rect.on("mouseover mousemove", function () {
|
15992 | $$.selectRectForMultipleXs(this);
|
15993 | }).on("mouseout", function () {
|
15994 | !$$.config || $$.hasArcType() || $$.unselectRect();
|
15995 | }), rect;
|
15996 | },
|
15997 | clickHandlerForMultipleXS: function clickHandlerForMultipleXS(ctx) {
|
15998 | var $$ = ctx,
|
15999 | config = $$.config,
|
16000 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
16001 |
|
16002 | if (!$$.hasArcType(targetsToShow)) {
|
16003 | var mouse = src_mouse(this),
|
16004 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
16005 | !closest || ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && $$.main.selectAll(".".concat(config_classes.shapes).concat($$.getTargetSelectorSuffix(closest.id))).selectAll(".".concat(config_classes.shape, "-").concat(closest.index)).each(function () {
|
16006 | (config.data_selection_grouped || $$.isWithinShape(this, closest)) && ($$.toggleShape(this, closest, closest.index), config.data_onclick.call($$.api, closest, this));
|
16007 | });
|
16008 | } // select if selection enabled
|
16009 |
|
16010 | },
|
16011 |
|
16012 | /**
|
16013 | * Dispatch a mouse event.
|
16014 | * @private
|
16015 | * @param {String} type event type
|
16016 | * @param {Number} index Index of eventRect
|
16017 | * @param {Array} mouse x and y coordinate value
|
16018 | */
|
16019 | dispatchEvent: function dispatchEvent(type, index, mouse) {
|
16020 | var $$ = this,
|
16021 | isMultipleX = $$.isMultipleX(),
|
16022 | selector = ".".concat(isMultipleX ? config_classes.eventRect : "".concat(config_classes.eventRect, "-").concat(index)),
|
16023 | eventRect = $$.main.select(selector).node(),
|
16024 | _eventRect$getBoundin = eventRect.getBoundingClientRect(),
|
16025 | width = _eventRect$getBoundin.width,
|
16026 | left = _eventRect$getBoundin.left,
|
16027 | top = _eventRect$getBoundin.top,
|
16028 | x = left + (mouse ? mouse[0] : 0) + (isMultipleX ? 0 : width / 2),
|
16029 | y = top + (mouse ? mouse[1] : 0);
|
16030 |
|
16031 | emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](eventRect, type, {
|
16032 | screenX: x,
|
16033 | screenY: y,
|
16034 | clientX: x,
|
16035 | clientY: y
|
16036 | });
|
16037 | }
|
16038 | });
|
16039 | // CONCATENATED MODULE: ./src/internals/size.js
|
16040 | /**
|
16041 | * Copyright (c) 2017 ~ present NAVER Corp.
|
16042 | * billboard.js project is licensed under the MIT license
|
16043 | */
|
16044 |
|
16045 |
|
16046 |
|
16047 |
|
16048 | util_extend(ChartInternal_ChartInternal.prototype, {
|
16049 | /**
|
16050 | * Update container size
|
16051 | * @private
|
16052 | */
|
16053 | setContainerSize: function setContainerSize() {
|
16054 | var $$ = this;
|
16055 | $$.currentWidth = $$.getCurrentWidth(), $$.currentHeight = $$.getCurrentHeight();
|
16056 | },
|
16057 | getCurrentWidth: function getCurrentWidth() {
|
16058 | var $$ = this;
|
16059 | return $$.config.size_width || $$.getParentWidth();
|
16060 | },
|
16061 | getCurrentHeight: function getCurrentHeight() {
|
16062 | var $$ = this,
|
16063 | config = $$.config,
|
16064 | h = config.size_height || $$.getParentHeight();
|
16065 | return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1);
|
16066 | },
|
16067 |
|
16068 | /**
|
16069 | * Get Axis size according its position
|
16070 | * @param {String} id Axis id value - x, y or y2
|
16071 | * @return {number} size Axis size value
|
16072 | * @private
|
16073 | */
|
16074 | getAxisSize: function getAxisSize(id) {
|
16075 | var $$ = this,
|
16076 | config = $$.config,
|
16077 | isRotated = config.axis_rotated;
|
16078 | return isRotated && id === "x" || !isRotated && /y2?/.test(id) ? $$.getAxisWidthByAxisId(id, !0) : $$.getHorizontalAxisHeight(id);
|
16079 | },
|
16080 | getCurrentPaddingTop: function getCurrentPaddingTop() {
|
16081 | var $$ = this,
|
16082 | config = $$.config,
|
16083 | axesLen = config.axis_y2_axes.length,
|
16084 | padding = isValue(config.padding_top) ? config.padding_top : 0;
|
16085 | return $$.title && $$.title.node() && (padding += $$.getTitlePadding()), axesLen && config.axis_rotated && (padding += $$.getHorizontalAxisHeight("y2") * axesLen), padding;
|
16086 | },
|
16087 | getCurrentPaddingBottom: function getCurrentPaddingBottom() {
|
16088 | var $$ = this,
|
16089 | config = $$.config,
|
16090 | axisId = config.axis_rotated ? "y" : "x",
|
16091 | axesLen = config["axis_".concat(axisId, "_axes")].length,
|
16092 | padding = isValue(config.padding_bottom) ? config.padding_bottom : 0;
|
16093 | return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
16094 | },
|
16095 | getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
|
16096 | var padding,
|
16097 | $$ = this,
|
16098 | config = $$.config,
|
16099 | isRotated = config.axis_rotated,
|
16100 | axisId = isRotated ? "x" : "y",
|
16101 | axesLen = config["axis_".concat(axisId, "_axes")].length,
|
16102 | axisWidth = $$.getAxisWidthByAxisId(axisId, withoutRecompute);
|
16103 | return padding = isValue(config.padding_left) ? config.padding_left : isRotated ? config.axis_x_show ? Math.max(ceil10(axisWidth), 40) : 1 : !config.axis_y_show || config.axis_y_inner ? $$.axis.getYAxisLabelPosition().isOuter ? 30 : 1 : ceil10(axisWidth), padding + axisWidth * axesLen;
|
16104 | },
|
16105 | getCurrentPaddingRight: function getCurrentPaddingRight() {
|
16106 | var padding,
|
16107 | $$ = this,
|
16108 | config = $$.config,
|
16109 | legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
16110 | axesLen = config.axis_y2_axes.length,
|
16111 | axisWidth = $$.getAxisWidthByAxisId("y2");
|
16112 | return padding = isValue(config.padding_right) ? config.padding_right + 1 : config.axis_rotated ? 10 + legendWidthOnRight : !config.axis_y2_show || config.axis_y2_inner ? 2 + legendWidthOnRight + ($$.axis.getY2AxisLabelPosition().isOuter ? 20 : 0) : ceil10(axisWidth) + legendWidthOnRight, padding + axisWidth * axesLen;
|
16113 | },
|
16114 |
|
16115 | /**
|
16116 | * Get the parent rect element's size
|
16117 | * @param {String} key property/attribute name
|
16118 | * @private
|
16119 | */
|
16120 | getParentRectValue: function getParentRectValue(key) {
|
16121 | for (var v, offsetName = "offset".concat(capitalize(key)), parent = this.selectChart.node(); !v && parent && parent.tagName !== "BODY";) {
|
16122 | try {
|
16123 | v = parent.getBoundingClientRect()[key];
|
16124 | } catch (e) {
|
16125 | offsetName in parent && (v = parent[offsetName]);
|
16126 | }
|
16127 |
|
16128 | parent = parent.parentNode;
|
16129 | }
|
16130 |
|
16131 | if (key === "width") {
|
16132 | // Sometimes element's width value is incorrect(ex. flex container)
|
16133 | // In this case, use body's offsetWidth instead.
|
16134 | var bodyWidth = browser["document"].body.offsetWidth;
|
16135 | v > bodyWidth && (v = bodyWidth);
|
16136 | }
|
16137 |
|
16138 | return v;
|
16139 | },
|
16140 | getParentWidth: function getParentWidth() {
|
16141 | return this.getParentRectValue("width");
|
16142 | },
|
16143 | getParentHeight: function getParentHeight() {
|
16144 | var h = this.selectChart.style("height");
|
16145 | return h.indexOf("px") > 0 ? parseInt(h, 10) : 0;
|
16146 | },
|
16147 | getSvgLeft: function getSvgLeft(withoutRecompute) {
|
16148 | var $$ = this,
|
16149 | config = $$.config,
|
16150 | hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner,
|
16151 | leftAxisClass = config.axis_rotated ? config_classes.axisX : config_classes.axisY,
|
16152 | leftAxis = $$.main.select(".".concat(leftAxisClass)).node(),
|
16153 | svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {
|
16154 | right: 0
|
16155 | },
|
16156 | chartRect = $$.selectChart.node().getBoundingClientRect(),
|
16157 | hasArc = $$.hasArcType(),
|
16158 | svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));
|
16159 | return svgLeft > 0 ? svgLeft : 0;
|
16160 | },
|
16161 | getAxisWidthByAxisId: function getAxisWidthByAxisId(id, withoutRecompute) {
|
16162 | var $$ = this,
|
16163 | position = $$.axis.getLabelPositionById(id);
|
16164 | return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40);
|
16165 | },
|
16166 | getHorizontalAxisHeight: function getHorizontalAxisHeight(id) {
|
16167 | var $$ = this,
|
16168 | config = $$.config,
|
16169 | isRotated = config.axis_rotated,
|
16170 | h = 30;
|
16171 | return id !== "x" || config.axis_x_show ? id === "x" && config.axis_x_height ? config.axis_x_height : id !== "y" || config.axis_y_show ? id !== "y2" || config.axis_y2_show ? ((id === "x" && !isRotated && config.axis_x_tick_rotate || id === "y" && isRotated && config.axis_y_tick_rotate) && (h = 30 + $$.axis.getMaxTickWidth(id) * Math.cos(Math.PI * (90 - config["axis_".concat(id, "_tick_rotate")]) / 180)), h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id !== "y2" || isRotated ? 0 : -10)) : $$.rotated_padding_top : !config.legend_show || $$.isLegendRight || $$.isLegendInset ? 1 : 10 : 8; // Calculate x/y axis height when tick rotated
|
16172 | },
|
16173 | getEventRectWidth: function getEventRectWidth() {
|
16174 | return Math.max(0, this.xAxis.tickInterval());
|
16175 | }
|
16176 | });
|
16177 | // CONCATENATED MODULE: ./node_modules/d3-path/src/path.js
|
16178 | var path_pi = Math.PI,
|
16179 | path_tau = 2 * path_pi,
|
16180 | path_epsilon = 1e-6,
|
16181 | tauEpsilon = path_tau - path_epsilon;
|
16182 |
|
16183 | function Path() {
|
16184 | this._x0 = this._y0 = // start of current subpath
|
16185 | this._x1 = this._y1 = null; // end of current subpath
|
16186 | this._ = "";
|
16187 | }
|
16188 |
|
16189 | function path_path() {
|
16190 | return new Path;
|
16191 | }
|
16192 |
|
16193 | Path.prototype = path_path.prototype = {
|
16194 | constructor: Path,
|
16195 | moveTo: function(x, y) {
|
16196 | this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
|
16197 | },
|
16198 | closePath: function() {
|
16199 | if (this._x1 !== null) {
|
16200 | this._x1 = this._x0, this._y1 = this._y0;
|
16201 | this._ += "Z";
|
16202 | }
|
16203 | },
|
16204 | lineTo: function(x, y) {
|
16205 | this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
|
16206 | },
|
16207 | quadraticCurveTo: function(x1, y1, x, y) {
|
16208 | this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
16209 | },
|
16210 | bezierCurveTo: function(x1, y1, x2, y2, x, y) {
|
16211 | this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
16212 | },
|
16213 | arcTo: function(x1, y1, x2, y2, r) {
|
16214 | x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
16215 | var x0 = this._x1,
|
16216 | y0 = this._y1,
|
16217 | x21 = x2 - x1,
|
16218 | y21 = y2 - y1,
|
16219 | x01 = x0 - x1,
|
16220 | y01 = y0 - y1,
|
16221 | l01_2 = x01 * x01 + y01 * y01;
|
16222 |
|
16223 | // Is the radius negative? Error.
|
16224 | if (r < 0) throw new Error("negative radius: " + r);
|
16225 |
|
16226 | // Is this path empty? Move to (x1,y1).
|
16227 | if (this._x1 === null) {
|
16228 | this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
|
16229 | }
|
16230 |
|
16231 | // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
16232 | else if (!(l01_2 > path_epsilon));
|
16233 |
|
16234 | // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
16235 | // Equivalently, is (x1,y1) coincident with (x2,y2)?
|
16236 | // Or, is the radius zero? Line to (x1,y1).
|
16237 | else if (!(Math.abs(y01 * x21 - y21 * x01) > path_epsilon) || !r) {
|
16238 | this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
|
16239 | }
|
16240 |
|
16241 | // Otherwise, draw an arc!
|
16242 | else {
|
16243 | var x20 = x2 - x0,
|
16244 | y20 = y2 - y0,
|
16245 | l21_2 = x21 * x21 + y21 * y21,
|
16246 | l20_2 = x20 * x20 + y20 * y20,
|
16247 | l21 = Math.sqrt(l21_2),
|
16248 | l01 = Math.sqrt(l01_2),
|
16249 | l = r * Math.tan((path_pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
|
16250 | t01 = l / l01,
|
16251 | t21 = l / l21;
|
16252 |
|
16253 | // If the start tangent is not coincident with (x0,y0), line to.
|
16254 | if (Math.abs(t01 - 1) > path_epsilon) {
|
16255 | this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
|
16256 | }
|
16257 |
|
16258 | this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
|
16259 | }
|
16260 | },
|
16261 | arc: function(x, y, r, a0, a1, ccw) {
|
16262 | x = +x, y = +y, r = +r;
|
16263 | var dx = r * Math.cos(a0),
|
16264 | dy = r * Math.sin(a0),
|
16265 | x0 = x + dx,
|
16266 | y0 = y + dy,
|
16267 | cw = 1 ^ ccw,
|
16268 | da = ccw ? a0 - a1 : a1 - a0;
|
16269 |
|
16270 | // Is the radius negative? Error.
|
16271 | if (r < 0) throw new Error("negative radius: " + r);
|
16272 |
|
16273 | // Is this path empty? Move to (x0,y0).
|
16274 | if (this._x1 === null) {
|
16275 | this._ += "M" + x0 + "," + y0;
|
16276 | }
|
16277 |
|
16278 | // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
16279 | else if (Math.abs(this._x1 - x0) > path_epsilon || Math.abs(this._y1 - y0) > path_epsilon) {
|
16280 | this._ += "L" + x0 + "," + y0;
|
16281 | }
|
16282 |
|
16283 | // Is this arc empty? We’re done.
|
16284 | if (!r) return;
|
16285 |
|
16286 | // Does the angle go the wrong way? Flip the direction.
|
16287 | if (da < 0) da = da % path_tau + path_tau;
|
16288 |
|
16289 | // Is this a complete circle? Draw two arcs to complete the circle.
|
16290 | if (da > tauEpsilon) {
|
16291 | this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
|
16292 | }
|
16293 |
|
16294 | // Is this arc non-empty? Draw an arc!
|
16295 | else if (da > path_epsilon) {
|
16296 | this._ += "A" + r + "," + r + ",0," + (+(da >= path_pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
16297 | }
|
16298 | },
|
16299 | rect: function(x, y, w, h) {
|
16300 | this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
|
16301 | },
|
16302 | toString: function() {
|
16303 | return this._;
|
16304 | }
|
16305 | };
|
16306 |
|
16307 | /* harmony default export */ var src_path = (path_path);
|
16308 |
|
16309 | // CONCATENATED MODULE: ./node_modules/d3-path/src/index.js
|
16310 |
|
16311 |
|
16312 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/constant.js
|
16313 | /* harmony default export */ var d3_shape_src_constant = (function(x) {
|
16314 | return function constant() {
|
16315 | return x;
|
16316 | };
|
16317 | });
|
16318 |
|
16319 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/math.js
|
16320 | var abs = Math.abs;
|
16321 | var atan2 = Math.atan2;
|
16322 | var cos = Math.cos;
|
16323 | var math_max = Math.max;
|
16324 | var math_min = Math.min;
|
16325 | var sin = Math.sin;
|
16326 | var math_sqrt = Math.sqrt;
|
16327 |
|
16328 | var math_epsilon = 1e-12;
|
16329 | var math_pi = Math.PI;
|
16330 | var math_halfPi = math_pi / 2;
|
16331 | var math_tau = 2 * math_pi;
|
16332 |
|
16333 | function acos(x) {
|
16334 | return x > 1 ? 0 : x < -1 ? math_pi : Math.acos(x);
|
16335 | }
|
16336 |
|
16337 | function asin(x) {
|
16338 | return x >= 1 ? math_halfPi : x <= -1 ? -math_halfPi : Math.asin(x);
|
16339 | }
|
16340 |
|
16341 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/arc.js
|
16342 |
|
16343 |
|
16344 |
|
16345 |
|
16346 | function arcInnerRadius(d) {
|
16347 | return d.innerRadius;
|
16348 | }
|
16349 |
|
16350 | function arcOuterRadius(d) {
|
16351 | return d.outerRadius;
|
16352 | }
|
16353 |
|
16354 | function arcStartAngle(d) {
|
16355 | return d.startAngle;
|
16356 | }
|
16357 |
|
16358 | function arcEndAngle(d) {
|
16359 | return d.endAngle;
|
16360 | }
|
16361 |
|
16362 | function arcPadAngle(d) {
|
16363 | return d && d.padAngle; // Note: optional!
|
16364 | }
|
16365 |
|
16366 | function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
16367 | var x10 = x1 - x0, y10 = y1 - y0,
|
16368 | x32 = x3 - x2, y32 = y3 - y2,
|
16369 | t = y32 * x10 - x32 * y10;
|
16370 | if (t * t < math_epsilon) return;
|
16371 | t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
16372 | return [x0 + t * x10, y0 + t * y10];
|
16373 | }
|
16374 |
|
16375 | // Compute perpendicular offset line of length rc.
|
16376 | // http://mathworld.wolfram.com/Circle-LineIntersection.html
|
16377 | function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
16378 | var x01 = x0 - x1,
|
16379 | y01 = y0 - y1,
|
16380 | lo = (cw ? rc : -rc) / math_sqrt(x01 * x01 + y01 * y01),
|
16381 | ox = lo * y01,
|
16382 | oy = -lo * x01,
|
16383 | x11 = x0 + ox,
|
16384 | y11 = y0 + oy,
|
16385 | x10 = x1 + ox,
|
16386 | y10 = y1 + oy,
|
16387 | x00 = (x11 + x10) / 2,
|
16388 | y00 = (y11 + y10) / 2,
|
16389 | dx = x10 - x11,
|
16390 | dy = y10 - y11,
|
16391 | d2 = dx * dx + dy * dy,
|
16392 | r = r1 - rc,
|
16393 | D = x11 * y10 - x10 * y11,
|
16394 | d = (dy < 0 ? -1 : 1) * math_sqrt(math_max(0, r * r * d2 - D * D)),
|
16395 | cx0 = (D * dy - dx * d) / d2,
|
16396 | cy0 = (-D * dx - dy * d) / d2,
|
16397 | cx1 = (D * dy + dx * d) / d2,
|
16398 | cy1 = (-D * dx + dy * d) / d2,
|
16399 | dx0 = cx0 - x00,
|
16400 | dy0 = cy0 - y00,
|
16401 | dx1 = cx1 - x00,
|
16402 | dy1 = cy1 - y00;
|
16403 |
|
16404 | // Pick the closer of the two intersection points.
|
16405 | // TODO Is there a faster way to determine which intersection to use?
|
16406 | if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
16407 |
|
16408 | return {
|
16409 | cx: cx0,
|
16410 | cy: cy0,
|
16411 | x01: -ox,
|
16412 | y01: -oy,
|
16413 | x11: cx0 * (r1 / r - 1),
|
16414 | y11: cy0 * (r1 / r - 1)
|
16415 | };
|
16416 | }
|
16417 |
|
16418 | /* harmony default export */ var src_arc = (function() {
|
16419 | var innerRadius = arcInnerRadius,
|
16420 | outerRadius = arcOuterRadius,
|
16421 | cornerRadius = d3_shape_src_constant(0),
|
16422 | padRadius = null,
|
16423 | startAngle = arcStartAngle,
|
16424 | endAngle = arcEndAngle,
|
16425 | padAngle = arcPadAngle,
|
16426 | context = null;
|
16427 |
|
16428 | function arc() {
|
16429 | var buffer,
|
16430 | r,
|
16431 | r0 = +innerRadius.apply(this, arguments),
|
16432 | r1 = +outerRadius.apply(this, arguments),
|
16433 | a0 = startAngle.apply(this, arguments) - math_halfPi,
|
16434 | a1 = endAngle.apply(this, arguments) - math_halfPi,
|
16435 | da = abs(a1 - a0),
|
16436 | cw = a1 > a0;
|
16437 |
|
16438 | if (!context) context = buffer = src_path();
|
16439 |
|
16440 | // Ensure that the outer radius is always larger than the inner radius.
|
16441 | if (r1 < r0) r = r1, r1 = r0, r0 = r;
|
16442 |
|
16443 | // Is it a point?
|
16444 | if (!(r1 > math_epsilon)) context.moveTo(0, 0);
|
16445 |
|
16446 | // Or is it a circle or annulus?
|
16447 | else if (da > math_tau - math_epsilon) {
|
16448 | context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
16449 | context.arc(0, 0, r1, a0, a1, !cw);
|
16450 | if (r0 > math_epsilon) {
|
16451 | context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
16452 | context.arc(0, 0, r0, a1, a0, cw);
|
16453 | }
|
16454 | }
|
16455 |
|
16456 | // Or is it a circular or annular sector?
|
16457 | else {
|
16458 | var a01 = a0,
|
16459 | a11 = a1,
|
16460 | a00 = a0,
|
16461 | a10 = a1,
|
16462 | da0 = da,
|
16463 | da1 = da,
|
16464 | ap = padAngle.apply(this, arguments) / 2,
|
16465 | rp = (ap > math_epsilon) && (padRadius ? +padRadius.apply(this, arguments) : math_sqrt(r0 * r0 + r1 * r1)),
|
16466 | rc = math_min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
|
16467 | rc0 = rc,
|
16468 | rc1 = rc,
|
16469 | t0,
|
16470 | t1;
|
16471 |
|
16472 | // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
16473 | if (rp > math_epsilon) {
|
16474 | var p0 = asin(rp / r0 * sin(ap)),
|
16475 | p1 = asin(rp / r1 * sin(ap));
|
16476 | if ((da0 -= p0 * 2) > math_epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
|
16477 | else da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
16478 | if ((da1 -= p1 * 2) > math_epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
|
16479 | else da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
16480 | }
|
16481 |
|
16482 | var x01 = r1 * cos(a01),
|
16483 | y01 = r1 * sin(a01),
|
16484 | x10 = r0 * cos(a10),
|
16485 | y10 = r0 * sin(a10);
|
16486 |
|
16487 | // Apply rounded corners?
|
16488 | if (rc > math_epsilon) {
|
16489 | var x11 = r1 * cos(a11),
|
16490 | y11 = r1 * sin(a11),
|
16491 | x00 = r0 * cos(a00),
|
16492 | y00 = r0 * sin(a00),
|
16493 | oc;
|
16494 |
|
16495 | // Restrict the corner radius according to the sector angle.
|
16496 | if (da < math_pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
|
16497 | var ax = x01 - oc[0],
|
16498 | ay = y01 - oc[1],
|
16499 | bx = x11 - oc[0],
|
16500 | by = y11 - oc[1],
|
16501 | kc = 1 / sin(acos((ax * bx + ay * by) / (math_sqrt(ax * ax + ay * ay) * math_sqrt(bx * bx + by * by))) / 2),
|
16502 | lc = math_sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
16503 | rc0 = math_min(rc, (r0 - lc) / (kc - 1));
|
16504 | rc1 = math_min(rc, (r1 - lc) / (kc + 1));
|
16505 | }
|
16506 | }
|
16507 |
|
16508 | // Is the sector collapsed to a line?
|
16509 | if (!(da1 > math_epsilon)) context.moveTo(x01, y01);
|
16510 |
|
16511 | // Does the sector’s outer ring have rounded corners?
|
16512 | else if (rc1 > math_epsilon) {
|
16513 | t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
16514 | t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
16515 |
|
16516 | context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
16517 |
|
16518 | // Have the corners merged?
|
16519 | if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
16520 |
|
16521 | // Otherwise, draw the two corners and the ring.
|
16522 | else {
|
16523 | context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
16524 | context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
16525 | context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
16526 | }
|
16527 | }
|
16528 |
|
16529 | // Or is the outer ring just a circular arc?
|
16530 | else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
16531 |
|
16532 | // Is there no inner ring, and it’s a circular sector?
|
16533 | // Or perhaps it’s an annular sector collapsed due to padding?
|
16534 | if (!(r0 > math_epsilon) || !(da0 > math_epsilon)) context.lineTo(x10, y10);
|
16535 |
|
16536 | // Does the sector’s inner ring (or point) have rounded corners?
|
16537 | else if (rc0 > math_epsilon) {
|
16538 | t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
16539 | t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
16540 |
|
16541 | context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
16542 |
|
16543 | // Have the corners merged?
|
16544 | if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
16545 |
|
16546 | // Otherwise, draw the two corners and the ring.
|
16547 | else {
|
16548 | context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
16549 | context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
16550 | context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
16551 | }
|
16552 | }
|
16553 |
|
16554 | // Or is the inner ring just a circular arc?
|
16555 | else context.arc(0, 0, r0, a10, a00, cw);
|
16556 | }
|
16557 |
|
16558 | context.closePath();
|
16559 |
|
16560 | if (buffer) return context = null, buffer + "" || null;
|
16561 | }
|
16562 |
|
16563 | arc.centroid = function() {
|
16564 | var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
|
16565 | a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - math_pi / 2;
|
16566 | return [cos(a) * r, sin(a) * r];
|
16567 | };
|
16568 |
|
16569 | arc.innerRadius = function(_) {
|
16570 | return arguments.length ? (innerRadius = typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : innerRadius;
|
16571 | };
|
16572 |
|
16573 | arc.outerRadius = function(_) {
|
16574 | return arguments.length ? (outerRadius = typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : outerRadius;
|
16575 | };
|
16576 |
|
16577 | arc.cornerRadius = function(_) {
|
16578 | return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : cornerRadius;
|
16579 | };
|
16580 |
|
16581 | arc.padRadius = function(_) {
|
16582 | return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : padRadius;
|
16583 | };
|
16584 |
|
16585 | arc.startAngle = function(_) {
|
16586 | return arguments.length ? (startAngle = typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : startAngle;
|
16587 | };
|
16588 |
|
16589 | arc.endAngle = function(_) {
|
16590 | return arguments.length ? (endAngle = typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : endAngle;
|
16591 | };
|
16592 |
|
16593 | arc.padAngle = function(_) {
|
16594 | return arguments.length ? (padAngle = typeof _ === "function" ? _ : d3_shape_src_constant(+_), arc) : padAngle;
|
16595 | };
|
16596 |
|
16597 | arc.context = function(_) {
|
16598 | return arguments.length ? ((context = _ == null ? null : _), arc) : context;
|
16599 | };
|
16600 |
|
16601 | return arc;
|
16602 | });
|
16603 |
|
16604 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/linear.js
|
16605 | function Linear(context) {
|
16606 | this._context = context;
|
16607 | }
|
16608 |
|
16609 | Linear.prototype = {
|
16610 | areaStart: function() {
|
16611 | this._line = 0;
|
16612 | },
|
16613 | areaEnd: function() {
|
16614 | this._line = NaN;
|
16615 | },
|
16616 | lineStart: function() {
|
16617 | this._point = 0;
|
16618 | },
|
16619 | lineEnd: function() {
|
16620 | if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
16621 | this._line = 1 - this._line;
|
16622 | },
|
16623 | point: function(x, y) {
|
16624 | x = +x, y = +y;
|
16625 | switch (this._point) {
|
16626 | case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
16627 | case 1: this._point = 2; // proceed
|
16628 | default: this._context.lineTo(x, y); break;
|
16629 | }
|
16630 | }
|
16631 | };
|
16632 |
|
16633 | /* harmony default export */ var curve_linear = (function(context) {
|
16634 | return new Linear(context);
|
16635 | });
|
16636 |
|
16637 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/point.js
|
16638 | function point_x(p) {
|
16639 | return p[0];
|
16640 | }
|
16641 |
|
16642 | function point_y(p) {
|
16643 | return p[1];
|
16644 | }
|
16645 |
|
16646 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/line.js
|
16647 |
|
16648 |
|
16649 |
|
16650 |
|
16651 |
|
16652 | /* harmony default export */ var src_line = (function() {
|
16653 | var x = point_x,
|
16654 | y = point_y,
|
16655 | defined = d3_shape_src_constant(true),
|
16656 | context = null,
|
16657 | curve = curve_linear,
|
16658 | output = null;
|
16659 |
|
16660 | function line(data) {
|
16661 | var i,
|
16662 | n = data.length,
|
16663 | d,
|
16664 | defined0 = false,
|
16665 | buffer;
|
16666 |
|
16667 | if (context == null) output = curve(buffer = src_path());
|
16668 |
|
16669 | for (i = 0; i <= n; ++i) {
|
16670 | if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
16671 | if (defined0 = !defined0) output.lineStart();
|
16672 | else output.lineEnd();
|
16673 | }
|
16674 | if (defined0) output.point(+x(d, i, data), +y(d, i, data));
|
16675 | }
|
16676 |
|
16677 | if (buffer) return output = null, buffer + "" || null;
|
16678 | }
|
16679 |
|
16680 | line.x = function(_) {
|
16681 | return arguments.length ? (x = typeof _ === "function" ? _ : d3_shape_src_constant(+_), line) : x;
|
16682 | };
|
16683 |
|
16684 | line.y = function(_) {
|
16685 | return arguments.length ? (y = typeof _ === "function" ? _ : d3_shape_src_constant(+_), line) : y;
|
16686 | };
|
16687 |
|
16688 | line.defined = function(_) {
|
16689 | return arguments.length ? (defined = typeof _ === "function" ? _ : d3_shape_src_constant(!!_), line) : defined;
|
16690 | };
|
16691 |
|
16692 | line.curve = function(_) {
|
16693 | return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
|
16694 | };
|
16695 |
|
16696 | line.context = function(_) {
|
16697 | return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
|
16698 | };
|
16699 |
|
16700 | return line;
|
16701 | });
|
16702 |
|
16703 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/area.js
|
16704 |
|
16705 |
|
16706 |
|
16707 |
|
16708 |
|
16709 |
|
16710 | /* harmony default export */ var src_area = (function() {
|
16711 | var x0 = point_x,
|
16712 | x1 = null,
|
16713 | y0 = d3_shape_src_constant(0),
|
16714 | y1 = point_y,
|
16715 | defined = d3_shape_src_constant(true),
|
16716 | context = null,
|
16717 | curve = curve_linear,
|
16718 | output = null;
|
16719 |
|
16720 | function area(data) {
|
16721 | var i,
|
16722 | j,
|
16723 | k,
|
16724 | n = data.length,
|
16725 | d,
|
16726 | defined0 = false,
|
16727 | buffer,
|
16728 | x0z = new Array(n),
|
16729 | y0z = new Array(n);
|
16730 |
|
16731 | if (context == null) output = curve(buffer = src_path());
|
16732 |
|
16733 | for (i = 0; i <= n; ++i) {
|
16734 | if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
16735 | if (defined0 = !defined0) {
|
16736 | j = i;
|
16737 | output.areaStart();
|
16738 | output.lineStart();
|
16739 | } else {
|
16740 | output.lineEnd();
|
16741 | output.lineStart();
|
16742 | for (k = i - 1; k >= j; --k) {
|
16743 | output.point(x0z[k], y0z[k]);
|
16744 | }
|
16745 | output.lineEnd();
|
16746 | output.areaEnd();
|
16747 | }
|
16748 | }
|
16749 | if (defined0) {
|
16750 | x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
|
16751 | output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
|
16752 | }
|
16753 | }
|
16754 |
|
16755 | if (buffer) return output = null, buffer + "" || null;
|
16756 | }
|
16757 |
|
16758 | function arealine() {
|
16759 | return src_line().defined(defined).curve(curve).context(context);
|
16760 | }
|
16761 |
|
16762 | area.x = function(_) {
|
16763 | return arguments.length ? (x0 = typeof _ === "function" ? _ : d3_shape_src_constant(+_), x1 = null, area) : x0;
|
16764 | };
|
16765 |
|
16766 | area.x0 = function(_) {
|
16767 | return arguments.length ? (x0 = typeof _ === "function" ? _ : d3_shape_src_constant(+_), area) : x0;
|
16768 | };
|
16769 |
|
16770 | area.x1 = function(_) {
|
16771 | return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : d3_shape_src_constant(+_), area) : x1;
|
16772 | };
|
16773 |
|
16774 | area.y = function(_) {
|
16775 | return arguments.length ? (y0 = typeof _ === "function" ? _ : d3_shape_src_constant(+_), y1 = null, area) : y0;
|
16776 | };
|
16777 |
|
16778 | area.y0 = function(_) {
|
16779 | return arguments.length ? (y0 = typeof _ === "function" ? _ : d3_shape_src_constant(+_), area) : y0;
|
16780 | };
|
16781 |
|
16782 | area.y1 = function(_) {
|
16783 | return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : d3_shape_src_constant(+_), area) : y1;
|
16784 | };
|
16785 |
|
16786 | area.lineX0 =
|
16787 | area.lineY0 = function() {
|
16788 | return arealine().x(x0).y(y0);
|
16789 | };
|
16790 |
|
16791 | area.lineY1 = function() {
|
16792 | return arealine().x(x0).y(y1);
|
16793 | };
|
16794 |
|
16795 | area.lineX1 = function() {
|
16796 | return arealine().x(x1).y(y0);
|
16797 | };
|
16798 |
|
16799 | area.defined = function(_) {
|
16800 | return arguments.length ? (defined = typeof _ === "function" ? _ : d3_shape_src_constant(!!_), area) : defined;
|
16801 | };
|
16802 |
|
16803 | area.curve = function(_) {
|
16804 | return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
|
16805 | };
|
16806 |
|
16807 | area.context = function(_) {
|
16808 | return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
|
16809 | };
|
16810 |
|
16811 | return area;
|
16812 | });
|
16813 |
|
16814 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/descending.js
|
16815 | /* harmony default export */ var src_descending = (function(a, b) {
|
16816 | return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
16817 | });
|
16818 |
|
16819 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/identity.js
|
16820 | /* harmony default export */ var d3_shape_src_identity = (function(d) {
|
16821 | return d;
|
16822 | });
|
16823 |
|
16824 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/pie.js
|
16825 |
|
16826 |
|
16827 |
|
16828 |
|
16829 |
|
16830 | /* harmony default export */ var src_pie = (function() {
|
16831 | var value = d3_shape_src_identity,
|
16832 | sortValues = src_descending,
|
16833 | sort = null,
|
16834 | startAngle = d3_shape_src_constant(0),
|
16835 | endAngle = d3_shape_src_constant(math_tau),
|
16836 | padAngle = d3_shape_src_constant(0);
|
16837 |
|
16838 | function pie(data) {
|
16839 | var i,
|
16840 | n = data.length,
|
16841 | j,
|
16842 | k,
|
16843 | sum = 0,
|
16844 | index = new Array(n),
|
16845 | arcs = new Array(n),
|
16846 | a0 = +startAngle.apply(this, arguments),
|
16847 | da = Math.min(math_tau, Math.max(-math_tau, endAngle.apply(this, arguments) - a0)),
|
16848 | a1,
|
16849 | p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
|
16850 | pa = p * (da < 0 ? -1 : 1),
|
16851 | v;
|
16852 |
|
16853 | for (i = 0; i < n; ++i) {
|
16854 | if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
|
16855 | sum += v;
|
16856 | }
|
16857 | }
|
16858 |
|
16859 | // Optionally sort the arcs by previously-computed values or by data.
|
16860 | if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });
|
16861 | else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });
|
16862 |
|
16863 | // Compute the arcs! They are stored in the original data's order.
|
16864 | for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
|
16865 | j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
16866 | data: data[j],
|
16867 | index: i,
|
16868 | value: v,
|
16869 | startAngle: a0,
|
16870 | endAngle: a1,
|
16871 | padAngle: p
|
16872 | };
|
16873 | }
|
16874 |
|
16875 | return arcs;
|
16876 | }
|
16877 |
|
16878 | pie.value = function(_) {
|
16879 | return arguments.length ? (value = typeof _ === "function" ? _ : d3_shape_src_constant(+_), pie) : value;
|
16880 | };
|
16881 |
|
16882 | pie.sortValues = function(_) {
|
16883 | return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
16884 | };
|
16885 |
|
16886 | pie.sort = function(_) {
|
16887 | return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
16888 | };
|
16889 |
|
16890 | pie.startAngle = function(_) {
|
16891 | return arguments.length ? (startAngle = typeof _ === "function" ? _ : d3_shape_src_constant(+_), pie) : startAngle;
|
16892 | };
|
16893 |
|
16894 | pie.endAngle = function(_) {
|
16895 | return arguments.length ? (endAngle = typeof _ === "function" ? _ : d3_shape_src_constant(+_), pie) : endAngle;
|
16896 | };
|
16897 |
|
16898 | pie.padAngle = function(_) {
|
16899 | return arguments.length ? (padAngle = typeof _ === "function" ? _ : d3_shape_src_constant(+_), pie) : padAngle;
|
16900 | };
|
16901 |
|
16902 | return pie;
|
16903 | });
|
16904 |
|
16905 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/radial.js
|
16906 |
|
16907 |
|
16908 | var curveRadialLinear = curveRadial(curve_linear);
|
16909 |
|
16910 | function Radial(curve) {
|
16911 | this._curve = curve;
|
16912 | }
|
16913 |
|
16914 | Radial.prototype = {
|
16915 | areaStart: function() {
|
16916 | this._curve.areaStart();
|
16917 | },
|
16918 | areaEnd: function() {
|
16919 | this._curve.areaEnd();
|
16920 | },
|
16921 | lineStart: function() {
|
16922 | this._curve.lineStart();
|
16923 | },
|
16924 | lineEnd: function() {
|
16925 | this._curve.lineEnd();
|
16926 | },
|
16927 | point: function(a, r) {
|
16928 | this._curve.point(r * Math.sin(a), r * -Math.cos(a));
|
16929 | }
|
16930 | };
|
16931 |
|
16932 | function curveRadial(curve) {
|
16933 |
|
16934 | function radial(context) {
|
16935 | return new Radial(curve(context));
|
16936 | }
|
16937 |
|
16938 | radial._curve = curve;
|
16939 |
|
16940 | return radial;
|
16941 | }
|
16942 |
|
16943 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/lineRadial.js
|
16944 |
|
16945 |
|
16946 |
|
16947 | function lineRadial(l) {
|
16948 | var c = l.curve;
|
16949 |
|
16950 | l.angle = l.x, delete l.x;
|
16951 | l.radius = l.y, delete l.y;
|
16952 |
|
16953 | l.curve = function(_) {
|
16954 | return arguments.length ? c(curveRadial(_)) : c()._curve;
|
16955 | };
|
16956 |
|
16957 | return l;
|
16958 | }
|
16959 |
|
16960 | /* harmony default export */ var src_lineRadial = (function() {
|
16961 | return lineRadial(src_line().curve(curveRadialLinear));
|
16962 | });
|
16963 |
|
16964 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/areaRadial.js
|
16965 |
|
16966 |
|
16967 |
|
16968 |
|
16969 | /* harmony default export */ var areaRadial = (function() {
|
16970 | var a = src_area().curve(curveRadialLinear),
|
16971 | c = a.curve,
|
16972 | x0 = a.lineX0,
|
16973 | x1 = a.lineX1,
|
16974 | y0 = a.lineY0,
|
16975 | y1 = a.lineY1;
|
16976 |
|
16977 | a.angle = a.x, delete a.x;
|
16978 | a.startAngle = a.x0, delete a.x0;
|
16979 | a.endAngle = a.x1, delete a.x1;
|
16980 | a.radius = a.y, delete a.y;
|
16981 | a.innerRadius = a.y0, delete a.y0;
|
16982 | a.outerRadius = a.y1, delete a.y1;
|
16983 | a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0;
|
16984 | a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1;
|
16985 | a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0;
|
16986 | a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;
|
16987 |
|
16988 | a.curve = function(_) {
|
16989 | return arguments.length ? c(curveRadial(_)) : c()._curve;
|
16990 | };
|
16991 |
|
16992 | return a;
|
16993 | });
|
16994 |
|
16995 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/pointRadial.js
|
16996 | /* harmony default export */ var pointRadial = (function(x, y) {
|
16997 | return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
|
16998 | });
|
16999 |
|
17000 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/array.js
|
17001 | var d3_shape_src_array_slice = Array.prototype.slice;
|
17002 |
|
17003 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/link/index.js
|
17004 |
|
17005 |
|
17006 |
|
17007 |
|
17008 |
|
17009 |
|
17010 | function linkSource(d) {
|
17011 | return d.source;
|
17012 | }
|
17013 |
|
17014 | function linkTarget(d) {
|
17015 | return d.target;
|
17016 | }
|
17017 |
|
17018 | function link_link(curve) {
|
17019 | var source = linkSource,
|
17020 | target = linkTarget,
|
17021 | x = point_x,
|
17022 | y = point_y,
|
17023 | context = null;
|
17024 |
|
17025 | function link() {
|
17026 | var buffer, argv = d3_shape_src_array_slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
|
17027 | if (!context) context = buffer = src_path();
|
17028 | curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));
|
17029 | if (buffer) return context = null, buffer + "" || null;
|
17030 | }
|
17031 |
|
17032 | link.source = function(_) {
|
17033 | return arguments.length ? (source = _, link) : source;
|
17034 | };
|
17035 |
|
17036 | link.target = function(_) {
|
17037 | return arguments.length ? (target = _, link) : target;
|
17038 | };
|
17039 |
|
17040 | link.x = function(_) {
|
17041 | return arguments.length ? (x = typeof _ === "function" ? _ : d3_shape_src_constant(+_), link) : x;
|
17042 | };
|
17043 |
|
17044 | link.y = function(_) {
|
17045 | return arguments.length ? (y = typeof _ === "function" ? _ : d3_shape_src_constant(+_), link) : y;
|
17046 | };
|
17047 |
|
17048 | link.context = function(_) {
|
17049 | return arguments.length ? ((context = _ == null ? null : _), link) : context;
|
17050 | };
|
17051 |
|
17052 | return link;
|
17053 | }
|
17054 |
|
17055 | function curveHorizontal(context, x0, y0, x1, y1) {
|
17056 | context.moveTo(x0, y0);
|
17057 | context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
|
17058 | }
|
17059 |
|
17060 | function curveVertical(context, x0, y0, x1, y1) {
|
17061 | context.moveTo(x0, y0);
|
17062 | context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
|
17063 | }
|
17064 |
|
17065 | function link_curveRadial(context, x0, y0, x1, y1) {
|
17066 | var p0 = pointRadial(x0, y0),
|
17067 | p1 = pointRadial(x0, y0 = (y0 + y1) / 2),
|
17068 | p2 = pointRadial(x1, y0),
|
17069 | p3 = pointRadial(x1, y1);
|
17070 | context.moveTo(p0[0], p0[1]);
|
17071 | context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
|
17072 | }
|
17073 |
|
17074 | function linkHorizontal() {
|
17075 | return link_link(curveHorizontal);
|
17076 | }
|
17077 |
|
17078 | function linkVertical() {
|
17079 | return link_link(curveVertical);
|
17080 | }
|
17081 |
|
17082 | function linkRadial() {
|
17083 | var l = link_link(link_curveRadial);
|
17084 | l.angle = l.x, delete l.x;
|
17085 | l.radius = l.y, delete l.y;
|
17086 | return l;
|
17087 | }
|
17088 |
|
17089 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/circle.js
|
17090 |
|
17091 |
|
17092 | /* harmony default export */ var circle = ({
|
17093 | draw: function(context, size) {
|
17094 | var r = Math.sqrt(size / math_pi);
|
17095 | context.moveTo(r, 0);
|
17096 | context.arc(0, 0, r, 0, math_tau);
|
17097 | }
|
17098 | });
|
17099 |
|
17100 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/cross.js
|
17101 | /* harmony default export */ var symbol_cross = ({
|
17102 | draw: function(context, size) {
|
17103 | var r = Math.sqrt(size / 5) / 2;
|
17104 | context.moveTo(-3 * r, -r);
|
17105 | context.lineTo(-r, -r);
|
17106 | context.lineTo(-r, -3 * r);
|
17107 | context.lineTo(r, -3 * r);
|
17108 | context.lineTo(r, -r);
|
17109 | context.lineTo(3 * r, -r);
|
17110 | context.lineTo(3 * r, r);
|
17111 | context.lineTo(r, r);
|
17112 | context.lineTo(r, 3 * r);
|
17113 | context.lineTo(-r, 3 * r);
|
17114 | context.lineTo(-r, r);
|
17115 | context.lineTo(-3 * r, r);
|
17116 | context.closePath();
|
17117 | }
|
17118 | });
|
17119 |
|
17120 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/diamond.js
|
17121 | var tan30 = Math.sqrt(1 / 3),
|
17122 | tan30_2 = tan30 * 2;
|
17123 |
|
17124 | /* harmony default export */ var diamond = ({
|
17125 | draw: function(context, size) {
|
17126 | var y = Math.sqrt(size / tan30_2),
|
17127 | x = y * tan30;
|
17128 | context.moveTo(0, -y);
|
17129 | context.lineTo(x, 0);
|
17130 | context.lineTo(0, y);
|
17131 | context.lineTo(-x, 0);
|
17132 | context.closePath();
|
17133 | }
|
17134 | });
|
17135 |
|
17136 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/star.js
|
17137 |
|
17138 |
|
17139 | var ka = 0.89081309152928522810,
|
17140 | kr = Math.sin(math_pi / 10) / Math.sin(7 * math_pi / 10),
|
17141 | kx = Math.sin(math_tau / 10) * kr,
|
17142 | ky = -Math.cos(math_tau / 10) * kr;
|
17143 |
|
17144 | /* harmony default export */ var star = ({
|
17145 | draw: function(context, size) {
|
17146 | var r = Math.sqrt(size * ka),
|
17147 | x = kx * r,
|
17148 | y = ky * r;
|
17149 | context.moveTo(0, -r);
|
17150 | context.lineTo(x, y);
|
17151 | for (var i = 1; i < 5; ++i) {
|
17152 | var a = math_tau * i / 5,
|
17153 | c = Math.cos(a),
|
17154 | s = Math.sin(a);
|
17155 | context.lineTo(s * r, -c * r);
|
17156 | context.lineTo(c * x - s * y, s * x + c * y);
|
17157 | }
|
17158 | context.closePath();
|
17159 | }
|
17160 | });
|
17161 |
|
17162 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/square.js
|
17163 | /* harmony default export */ var square = ({
|
17164 | draw: function(context, size) {
|
17165 | var w = Math.sqrt(size),
|
17166 | x = -w / 2;
|
17167 | context.rect(x, x, w, w);
|
17168 | }
|
17169 | });
|
17170 |
|
17171 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/triangle.js
|
17172 | var sqrt3 = Math.sqrt(3);
|
17173 |
|
17174 | /* harmony default export */ var triangle = ({
|
17175 | draw: function(context, size) {
|
17176 | var y = -Math.sqrt(size / (sqrt3 * 3));
|
17177 | context.moveTo(0, y * 2);
|
17178 | context.lineTo(-sqrt3 * y, -y);
|
17179 | context.lineTo(sqrt3 * y, -y);
|
17180 | context.closePath();
|
17181 | }
|
17182 | });
|
17183 |
|
17184 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol/wye.js
|
17185 | var wye_c = -0.5,
|
17186 | wye_s = Math.sqrt(3) / 2,
|
17187 | wye_k = 1 / Math.sqrt(12),
|
17188 | wye_a = (wye_k / 2 + 1) * 3;
|
17189 |
|
17190 | /* harmony default export */ var wye = ({
|
17191 | draw: function(context, size) {
|
17192 | var r = Math.sqrt(size / wye_a),
|
17193 | x0 = r / 2,
|
17194 | y0 = r * wye_k,
|
17195 | x1 = x0,
|
17196 | y1 = r * wye_k + r,
|
17197 | x2 = -x1,
|
17198 | y2 = y1;
|
17199 | context.moveTo(x0, y0);
|
17200 | context.lineTo(x1, y1);
|
17201 | context.lineTo(x2, y2);
|
17202 | context.lineTo(wye_c * x0 - wye_s * y0, wye_s * x0 + wye_c * y0);
|
17203 | context.lineTo(wye_c * x1 - wye_s * y1, wye_s * x1 + wye_c * y1);
|
17204 | context.lineTo(wye_c * x2 - wye_s * y2, wye_s * x2 + wye_c * y2);
|
17205 | context.lineTo(wye_c * x0 + wye_s * y0, wye_c * y0 - wye_s * x0);
|
17206 | context.lineTo(wye_c * x1 + wye_s * y1, wye_c * y1 - wye_s * x1);
|
17207 | context.lineTo(wye_c * x2 + wye_s * y2, wye_c * y2 - wye_s * x2);
|
17208 | context.closePath();
|
17209 | }
|
17210 | });
|
17211 |
|
17212 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/symbol.js
|
17213 |
|
17214 |
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 |
|
17221 |
|
17222 |
|
17223 | var symbols = [
|
17224 | circle,
|
17225 | symbol_cross,
|
17226 | diamond,
|
17227 | square,
|
17228 | star,
|
17229 | triangle,
|
17230 | wye
|
17231 | ];
|
17232 |
|
17233 | /* harmony default export */ var src_symbol = (function() {
|
17234 | var type = d3_shape_src_constant(circle),
|
17235 | size = d3_shape_src_constant(64),
|
17236 | context = null;
|
17237 |
|
17238 | function symbol() {
|
17239 | var buffer;
|
17240 | if (!context) context = buffer = src_path();
|
17241 | type.apply(this, arguments).draw(context, +size.apply(this, arguments));
|
17242 | if (buffer) return context = null, buffer + "" || null;
|
17243 | }
|
17244 |
|
17245 | symbol.type = function(_) {
|
17246 | return arguments.length ? (type = typeof _ === "function" ? _ : d3_shape_src_constant(_), symbol) : type;
|
17247 | };
|
17248 |
|
17249 | symbol.size = function(_) {
|
17250 | return arguments.length ? (size = typeof _ === "function" ? _ : d3_shape_src_constant(+_), symbol) : size;
|
17251 | };
|
17252 |
|
17253 | symbol.context = function(_) {
|
17254 | return arguments.length ? (context = _ == null ? null : _, symbol) : context;
|
17255 | };
|
17256 |
|
17257 | return symbol;
|
17258 | });
|
17259 |
|
17260 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/noop.js
|
17261 | /* harmony default export */ var src_noop = (function() {});
|
17262 |
|
17263 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/basis.js
|
17264 | function basis_point(that, x, y) {
|
17265 | that._context.bezierCurveTo(
|
17266 | (2 * that._x0 + that._x1) / 3,
|
17267 | (2 * that._y0 + that._y1) / 3,
|
17268 | (that._x0 + 2 * that._x1) / 3,
|
17269 | (that._y0 + 2 * that._y1) / 3,
|
17270 | (that._x0 + 4 * that._x1 + x) / 6,
|
17271 | (that._y0 + 4 * that._y1 + y) / 6
|
17272 | );
|
17273 | }
|
17274 |
|
17275 | function Basis(context) {
|
17276 | this._context = context;
|
17277 | }
|
17278 |
|
17279 | Basis.prototype = {
|
17280 | areaStart: function() {
|
17281 | this._line = 0;
|
17282 | },
|
17283 | areaEnd: function() {
|
17284 | this._line = NaN;
|
17285 | },
|
17286 | lineStart: function() {
|
17287 | this._x0 = this._x1 =
|
17288 | this._y0 = this._y1 = NaN;
|
17289 | this._point = 0;
|
17290 | },
|
17291 | lineEnd: function() {
|
17292 | switch (this._point) {
|
17293 | case 3: basis_point(this, this._x1, this._y1); // proceed
|
17294 | case 2: this._context.lineTo(this._x1, this._y1); break;
|
17295 | }
|
17296 | if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
17297 | this._line = 1 - this._line;
|
17298 | },
|
17299 | point: function(x, y) {
|
17300 | x = +x, y = +y;
|
17301 | switch (this._point) {
|
17302 | case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
17303 | case 1: this._point = 2; break;
|
17304 | case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
|
17305 | default: basis_point(this, x, y); break;
|
17306 | }
|
17307 | this._x0 = this._x1, this._x1 = x;
|
17308 | this._y0 = this._y1, this._y1 = y;
|
17309 | }
|
17310 | };
|
17311 |
|
17312 | /* harmony default export */ var curve_basis = (function(context) {
|
17313 | return new Basis(context);
|
17314 | });
|
17315 |
|
17316 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/basisClosed.js
|
17317 |
|
17318 |
|
17319 |
|
17320 | function BasisClosed(context) {
|
17321 | this._context = context;
|
17322 | }
|
17323 |
|
17324 | BasisClosed.prototype = {
|
17325 | areaStart: src_noop,
|
17326 | areaEnd: src_noop,
|
17327 | lineStart: function() {
|
17328 | this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =
|
17329 | this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
|
17330 | this._point = 0;
|
17331 | },
|
17332 | lineEnd: function() {
|
17333 | switch (this._point) {
|
17334 | case 1: {
|
17335 | this._context.moveTo(this._x2, this._y2);
|
17336 | this._context.closePath();
|
17337 | break;
|
17338 | }
|
17339 | case 2: {
|
17340 | this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
|
17341 | this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
|
17342 | this._context.closePath();
|
17343 | break;
|
17344 | }
|
17345 | case 3: {
|
17346 | this.point(this._x2, this._y2);
|
17347 | this.point(this._x3, this._y3);
|
17348 | this.point(this._x4, this._y4);
|
17349 | break;
|
17350 | }
|
17351 | }
|
17352 | },
|
17353 | point: function(x, y) {
|
17354 | x = +x, y = +y;
|
17355 | switch (this._point) {
|
17356 | case 0: this._point = 1; this._x2 = x, this._y2 = y; break;
|
17357 | case 1: this._point = 2; this._x3 = x, this._y3 = y; break;
|
17358 | case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;
|
17359 | default: basis_point(this, x, y); break;
|
17360 | }
|
17361 | this._x0 = this._x1, this._x1 = x;
|
17362 | this._y0 = this._y1, this._y1 = y;
|
17363 | }
|
17364 | };
|
17365 |
|
17366 | /* harmony default export */ var curve_basisClosed = (function(context) {
|
17367 | return new BasisClosed(context);
|
17368 | });
|
17369 |
|
17370 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/basisOpen.js
|
17371 |
|
17372 |
|
17373 | function BasisOpen(context) {
|
17374 | this._context = context;
|
17375 | }
|
17376 |
|
17377 | BasisOpen.prototype = {
|
17378 | areaStart: function() {
|
17379 | this._line = 0;
|
17380 | },
|
17381 | areaEnd: function() {
|
17382 | this._line = NaN;
|
17383 | },
|
17384 | lineStart: function() {
|
17385 | this._x0 = this._x1 =
|
17386 | this._y0 = this._y1 = NaN;
|
17387 | this._point = 0;
|
17388 | },
|
17389 | lineEnd: function() {
|
17390 | if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
|
17391 | this._line = 1 - this._line;
|
17392 | },
|
17393 | point: function(x, y) {
|
17394 | x = +x, y = +y;
|
17395 | switch (this._point) {
|
17396 | case 0: this._point = 1; break;
|
17397 | case 1: this._point = 2; break;
|
17398 | case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;
|
17399 | case 3: this._point = 4; // proceed
|
17400 | default: basis_point(this, x, y); break;
|
17401 | }
|
17402 | this._x0 = this._x1, this._x1 = x;
|
17403 | this._y0 = this._y1, this._y1 = y;
|
17404 | }
|
17405 | };
|
17406 |
|
17407 | /* harmony default export */ var basisOpen = (function(context) {
|
17408 | return new BasisOpen(context);
|
17409 | });
|
17410 |
|
17411 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/bundle.js
|
17412 |
|
17413 |
|
17414 | function Bundle(context, beta) {
|
17415 | this._basis = new Basis(context);
|
17416 | this._beta = beta;
|
17417 | }
|
17418 |
|
17419 | Bundle.prototype = {
|
17420 | lineStart: function() {
|
17421 | this._x = [];
|
17422 | this._y = [];
|
17423 | this._basis.lineStart();
|
17424 | },
|
17425 | lineEnd: function() {
|
17426 | var x = this._x,
|
17427 | y = this._y,
|
17428 | j = x.length - 1;
|
17429 |
|
17430 | if (j > 0) {
|
17431 | var x0 = x[0],
|
17432 | y0 = y[0],
|
17433 | dx = x[j] - x0,
|
17434 | dy = y[j] - y0,
|
17435 | i = -1,
|
17436 | t;
|
17437 |
|
17438 | while (++i <= j) {
|
17439 | t = i / j;
|
17440 | this._basis.point(
|
17441 | this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
|
17442 | this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
|
17443 | );
|
17444 | }
|
17445 | }
|
17446 |
|
17447 | this._x = this._y = null;
|
17448 | this._basis.lineEnd();
|
17449 | },
|
17450 | point: function(x, y) {
|
17451 | this._x.push(+x);
|
17452 | this._y.push(+y);
|
17453 | }
|
17454 | };
|
17455 |
|
17456 | /* harmony default export */ var curve_bundle = ((function custom(beta) {
|
17457 |
|
17458 | function bundle(context) {
|
17459 | return beta === 1 ? new Basis(context) : new Bundle(context, beta);
|
17460 | }
|
17461 |
|
17462 | bundle.beta = function(beta) {
|
17463 | return custom(+beta);
|
17464 | };
|
17465 |
|
17466 | return bundle;
|
17467 | })(0.85));
|
17468 |
|
17469 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/cardinal.js
|
17470 | function cardinal_point(that, x, y) {
|
17471 | that._context.bezierCurveTo(
|
17472 | that._x1 + that._k * (that._x2 - that._x0),
|
17473 | that._y1 + that._k * (that._y2 - that._y0),
|
17474 | that._x2 + that._k * (that._x1 - x),
|
17475 | that._y2 + that._k * (that._y1 - y),
|
17476 | that._x2,
|
17477 | that._y2
|
17478 | );
|
17479 | }
|
17480 |
|
17481 | function Cardinal(context, tension) {
|
17482 | this._context = context;
|
17483 | this._k = (1 - tension) / 6;
|
17484 | }
|
17485 |
|
17486 | Cardinal.prototype = {
|
17487 | areaStart: function() {
|
17488 | this._line = 0;
|
17489 | },
|
17490 | areaEnd: function() {
|
17491 | this._line = NaN;
|
17492 | },
|
17493 | lineStart: function() {
|
17494 | this._x0 = this._x1 = this._x2 =
|
17495 | this._y0 = this._y1 = this._y2 = NaN;
|
17496 | this._point = 0;
|
17497 | },
|
17498 | lineEnd: function() {
|
17499 | switch (this._point) {
|
17500 | case 2: this._context.lineTo(this._x2, this._y2); break;
|
17501 | case 3: cardinal_point(this, this._x1, this._y1); break;
|
17502 | }
|
17503 | if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
17504 | this._line = 1 - this._line;
|
17505 | },
|
17506 | point: function(x, y) {
|
17507 | x = +x, y = +y;
|
17508 | switch (this._point) {
|
17509 | case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
17510 | case 1: this._point = 2; this._x1 = x, this._y1 = y; break;
|
17511 | case 2: this._point = 3; // proceed
|
17512 | default: cardinal_point(this, x, y); break;
|
17513 | }
|
17514 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
17515 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
17516 | }
|
17517 | };
|
17518 |
|
17519 | /* harmony default export */ var cardinal = ((function custom(tension) {
|
17520 |
|
17521 | function cardinal(context) {
|
17522 | return new Cardinal(context, tension);
|
17523 | }
|
17524 |
|
17525 | cardinal.tension = function(tension) {
|
17526 | return custom(+tension);
|
17527 | };
|
17528 |
|
17529 | return cardinal;
|
17530 | })(0));
|
17531 |
|
17532 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/cardinalClosed.js
|
17533 |
|
17534 |
|
17535 |
|
17536 | function CardinalClosed(context, tension) {
|
17537 | this._context = context;
|
17538 | this._k = (1 - tension) / 6;
|
17539 | }
|
17540 |
|
17541 | CardinalClosed.prototype = {
|
17542 | areaStart: src_noop,
|
17543 | areaEnd: src_noop,
|
17544 | lineStart: function() {
|
17545 | this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
|
17546 | this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
17547 | this._point = 0;
|
17548 | },
|
17549 | lineEnd: function() {
|
17550 | switch (this._point) {
|
17551 | case 1: {
|
17552 | this._context.moveTo(this._x3, this._y3);
|
17553 | this._context.closePath();
|
17554 | break;
|
17555 | }
|
17556 | case 2: {
|
17557 | this._context.lineTo(this._x3, this._y3);
|
17558 | this._context.closePath();
|
17559 | break;
|
17560 | }
|
17561 | case 3: {
|
17562 | this.point(this._x3, this._y3);
|
17563 | this.point(this._x4, this._y4);
|
17564 | this.point(this._x5, this._y5);
|
17565 | break;
|
17566 | }
|
17567 | }
|
17568 | },
|
17569 | point: function(x, y) {
|
17570 | x = +x, y = +y;
|
17571 | switch (this._point) {
|
17572 | case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
|
17573 | case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
|
17574 | case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
|
17575 | default: cardinal_point(this, x, y); break;
|
17576 | }
|
17577 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
17578 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
17579 | }
|
17580 | };
|
17581 |
|
17582 | /* harmony default export */ var cardinalClosed = ((function custom(tension) {
|
17583 |
|
17584 | function cardinal(context) {
|
17585 | return new CardinalClosed(context, tension);
|
17586 | }
|
17587 |
|
17588 | cardinal.tension = function(tension) {
|
17589 | return custom(+tension);
|
17590 | };
|
17591 |
|
17592 | return cardinal;
|
17593 | })(0));
|
17594 |
|
17595 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/cardinalOpen.js
|
17596 |
|
17597 |
|
17598 | function CardinalOpen(context, tension) {
|
17599 | this._context = context;
|
17600 | this._k = (1 - tension) / 6;
|
17601 | }
|
17602 |
|
17603 | CardinalOpen.prototype = {
|
17604 | areaStart: function() {
|
17605 | this._line = 0;
|
17606 | },
|
17607 | areaEnd: function() {
|
17608 | this._line = NaN;
|
17609 | },
|
17610 | lineStart: function() {
|
17611 | this._x0 = this._x1 = this._x2 =
|
17612 | this._y0 = this._y1 = this._y2 = NaN;
|
17613 | this._point = 0;
|
17614 | },
|
17615 | lineEnd: function() {
|
17616 | if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
|
17617 | this._line = 1 - this._line;
|
17618 | },
|
17619 | point: function(x, y) {
|
17620 | x = +x, y = +y;
|
17621 | switch (this._point) {
|
17622 | case 0: this._point = 1; break;
|
17623 | case 1: this._point = 2; break;
|
17624 | case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
|
17625 | case 3: this._point = 4; // proceed
|
17626 | default: cardinal_point(this, x, y); break;
|
17627 | }
|
17628 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
17629 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
17630 | }
|
17631 | };
|
17632 |
|
17633 | /* harmony default export */ var cardinalOpen = ((function custom(tension) {
|
17634 |
|
17635 | function cardinal(context) {
|
17636 | return new CardinalOpen(context, tension);
|
17637 | }
|
17638 |
|
17639 | cardinal.tension = function(tension) {
|
17640 | return custom(+tension);
|
17641 | };
|
17642 |
|
17643 | return cardinal;
|
17644 | })(0));
|
17645 |
|
17646 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/catmullRom.js
|
17647 |
|
17648 |
|
17649 |
|
17650 | function catmullRom_point(that, x, y) {
|
17651 | var x1 = that._x1,
|
17652 | y1 = that._y1,
|
17653 | x2 = that._x2,
|
17654 | y2 = that._y2;
|
17655 |
|
17656 | if (that._l01_a > math_epsilon) {
|
17657 | var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
|
17658 | n = 3 * that._l01_a * (that._l01_a + that._l12_a);
|
17659 | x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
|
17660 | y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
|
17661 | }
|
17662 |
|
17663 | if (that._l23_a > math_epsilon) {
|
17664 | var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
|
17665 | m = 3 * that._l23_a * (that._l23_a + that._l12_a);
|
17666 | x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
|
17667 | y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
|
17668 | }
|
17669 |
|
17670 | that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
|
17671 | }
|
17672 |
|
17673 | function CatmullRom(context, alpha) {
|
17674 | this._context = context;
|
17675 | this._alpha = alpha;
|
17676 | }
|
17677 |
|
17678 | CatmullRom.prototype = {
|
17679 | areaStart: function() {
|
17680 | this._line = 0;
|
17681 | },
|
17682 | areaEnd: function() {
|
17683 | this._line = NaN;
|
17684 | },
|
17685 | lineStart: function() {
|
17686 | this._x0 = this._x1 = this._x2 =
|
17687 | this._y0 = this._y1 = this._y2 = NaN;
|
17688 | this._l01_a = this._l12_a = this._l23_a =
|
17689 | this._l01_2a = this._l12_2a = this._l23_2a =
|
17690 | this._point = 0;
|
17691 | },
|
17692 | lineEnd: function() {
|
17693 | switch (this._point) {
|
17694 | case 2: this._context.lineTo(this._x2, this._y2); break;
|
17695 | case 3: this.point(this._x2, this._y2); break;
|
17696 | }
|
17697 | if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
17698 | this._line = 1 - this._line;
|
17699 | },
|
17700 | point: function(x, y) {
|
17701 | x = +x, y = +y;
|
17702 |
|
17703 | if (this._point) {
|
17704 | var x23 = this._x2 - x,
|
17705 | y23 = this._y2 - y;
|
17706 | this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
17707 | }
|
17708 |
|
17709 | switch (this._point) {
|
17710 | case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
17711 | case 1: this._point = 2; break;
|
17712 | case 2: this._point = 3; // proceed
|
17713 | default: catmullRom_point(this, x, y); break;
|
17714 | }
|
17715 |
|
17716 | this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
17717 | this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
17718 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
17719 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
17720 | }
|
17721 | };
|
17722 |
|
17723 | /* harmony default export */ var curve_catmullRom = ((function custom(alpha) {
|
17724 |
|
17725 | function catmullRom(context) {
|
17726 | return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
|
17727 | }
|
17728 |
|
17729 | catmullRom.alpha = function(alpha) {
|
17730 | return custom(+alpha);
|
17731 | };
|
17732 |
|
17733 | return catmullRom;
|
17734 | })(0.5));
|
17735 |
|
17736 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/catmullRomClosed.js
|
17737 |
|
17738 |
|
17739 |
|
17740 |
|
17741 | function CatmullRomClosed(context, alpha) {
|
17742 | this._context = context;
|
17743 | this._alpha = alpha;
|
17744 | }
|
17745 |
|
17746 | CatmullRomClosed.prototype = {
|
17747 | areaStart: src_noop,
|
17748 | areaEnd: src_noop,
|
17749 | lineStart: function() {
|
17750 | this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
|
17751 | this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
17752 | this._l01_a = this._l12_a = this._l23_a =
|
17753 | this._l01_2a = this._l12_2a = this._l23_2a =
|
17754 | this._point = 0;
|
17755 | },
|
17756 | lineEnd: function() {
|
17757 | switch (this._point) {
|
17758 | case 1: {
|
17759 | this._context.moveTo(this._x3, this._y3);
|
17760 | this._context.closePath();
|
17761 | break;
|
17762 | }
|
17763 | case 2: {
|
17764 | this._context.lineTo(this._x3, this._y3);
|
17765 | this._context.closePath();
|
17766 | break;
|
17767 | }
|
17768 | case 3: {
|
17769 | this.point(this._x3, this._y3);
|
17770 | this.point(this._x4, this._y4);
|
17771 | this.point(this._x5, this._y5);
|
17772 | break;
|
17773 | }
|
17774 | }
|
17775 | },
|
17776 | point: function(x, y) {
|
17777 | x = +x, y = +y;
|
17778 |
|
17779 | if (this._point) {
|
17780 | var x23 = this._x2 - x,
|
17781 | y23 = this._y2 - y;
|
17782 | this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
17783 | }
|
17784 |
|
17785 | switch (this._point) {
|
17786 | case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
|
17787 | case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
|
17788 | case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
|
17789 | default: catmullRom_point(this, x, y); break;
|
17790 | }
|
17791 |
|
17792 | this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
17793 | this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
17794 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
17795 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
17796 | }
|
17797 | };
|
17798 |
|
17799 | /* harmony default export */ var catmullRomClosed = ((function custom(alpha) {
|
17800 |
|
17801 | function catmullRom(context) {
|
17802 | return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
|
17803 | }
|
17804 |
|
17805 | catmullRom.alpha = function(alpha) {
|
17806 | return custom(+alpha);
|
17807 | };
|
17808 |
|
17809 | return catmullRom;
|
17810 | })(0.5));
|
17811 |
|
17812 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/catmullRomOpen.js
|
17813 |
|
17814 |
|
17815 |
|
17816 | function CatmullRomOpen(context, alpha) {
|
17817 | this._context = context;
|
17818 | this._alpha = alpha;
|
17819 | }
|
17820 |
|
17821 | CatmullRomOpen.prototype = {
|
17822 | areaStart: function() {
|
17823 | this._line = 0;
|
17824 | },
|
17825 | areaEnd: function() {
|
17826 | this._line = NaN;
|
17827 | },
|
17828 | lineStart: function() {
|
17829 | this._x0 = this._x1 = this._x2 =
|
17830 | this._y0 = this._y1 = this._y2 = NaN;
|
17831 | this._l01_a = this._l12_a = this._l23_a =
|
17832 | this._l01_2a = this._l12_2a = this._l23_2a =
|
17833 | this._point = 0;
|
17834 | },
|
17835 | lineEnd: function() {
|
17836 | if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
|
17837 | this._line = 1 - this._line;
|
17838 | },
|
17839 | point: function(x, y) {
|
17840 | x = +x, y = +y;
|
17841 |
|
17842 | if (this._point) {
|
17843 | var x23 = this._x2 - x,
|
17844 | y23 = this._y2 - y;
|
17845 | this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
17846 | }
|
17847 |
|
17848 | switch (this._point) {
|
17849 | case 0: this._point = 1; break;
|
17850 | case 1: this._point = 2; break;
|
17851 | case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
|
17852 | case 3: this._point = 4; // proceed
|
17853 | default: catmullRom_point(this, x, y); break;
|
17854 | }
|
17855 |
|
17856 | this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
17857 | this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
17858 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
17859 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
17860 | }
|
17861 | };
|
17862 |
|
17863 | /* harmony default export */ var catmullRomOpen = ((function custom(alpha) {
|
17864 |
|
17865 | function catmullRom(context) {
|
17866 | return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
|
17867 | }
|
17868 |
|
17869 | catmullRom.alpha = function(alpha) {
|
17870 | return custom(+alpha);
|
17871 | };
|
17872 |
|
17873 | return catmullRom;
|
17874 | })(0.5));
|
17875 |
|
17876 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/linearClosed.js
|
17877 |
|
17878 |
|
17879 | function LinearClosed(context) {
|
17880 | this._context = context;
|
17881 | }
|
17882 |
|
17883 | LinearClosed.prototype = {
|
17884 | areaStart: src_noop,
|
17885 | areaEnd: src_noop,
|
17886 | lineStart: function() {
|
17887 | this._point = 0;
|
17888 | },
|
17889 | lineEnd: function() {
|
17890 | if (this._point) this._context.closePath();
|
17891 | },
|
17892 | point: function(x, y) {
|
17893 | x = +x, y = +y;
|
17894 | if (this._point) this._context.lineTo(x, y);
|
17895 | else this._point = 1, this._context.moveTo(x, y);
|
17896 | }
|
17897 | };
|
17898 |
|
17899 | /* harmony default export */ var linearClosed = (function(context) {
|
17900 | return new LinearClosed(context);
|
17901 | });
|
17902 |
|
17903 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/monotone.js
|
17904 | function monotone_sign(x) {
|
17905 | return x < 0 ? -1 : 1;
|
17906 | }
|
17907 |
|
17908 | // Calculate the slopes of the tangents (Hermite-type interpolation) based on
|
17909 | // the following paper: Steffen, M. 1990. A Simple Method for Monotonic
|
17910 | // Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
|
17911 | // NOV(II), P. 443, 1990.
|
17912 | function slope3(that, x2, y2) {
|
17913 | var h0 = that._x1 - that._x0,
|
17914 | h1 = x2 - that._x1,
|
17915 | s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
|
17916 | s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
|
17917 | p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
17918 | return (monotone_sign(s0) + monotone_sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
|
17919 | }
|
17920 |
|
17921 | // Calculate a one-sided slope.
|
17922 | function slope2(that, t) {
|
17923 | var h = that._x1 - that._x0;
|
17924 | return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
|
17925 | }
|
17926 |
|
17927 | // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
|
17928 | // "you can express cubic Hermite interpolation in terms of cubic Bézier curves
|
17929 | // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
|
17930 | function monotone_point(that, t0, t1) {
|
17931 | var x0 = that._x0,
|
17932 | y0 = that._y0,
|
17933 | x1 = that._x1,
|
17934 | y1 = that._y1,
|
17935 | dx = (x1 - x0) / 3;
|
17936 | that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
|
17937 | }
|
17938 |
|
17939 | function MonotoneX(context) {
|
17940 | this._context = context;
|
17941 | }
|
17942 |
|
17943 | MonotoneX.prototype = {
|
17944 | areaStart: function() {
|
17945 | this._line = 0;
|
17946 | },
|
17947 | areaEnd: function() {
|
17948 | this._line = NaN;
|
17949 | },
|
17950 | lineStart: function() {
|
17951 | this._x0 = this._x1 =
|
17952 | this._y0 = this._y1 =
|
17953 | this._t0 = NaN;
|
17954 | this._point = 0;
|
17955 | },
|
17956 | lineEnd: function() {
|
17957 | switch (this._point) {
|
17958 | case 2: this._context.lineTo(this._x1, this._y1); break;
|
17959 | case 3: monotone_point(this, this._t0, slope2(this, this._t0)); break;
|
17960 | }
|
17961 | if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
17962 | this._line = 1 - this._line;
|
17963 | },
|
17964 | point: function(x, y) {
|
17965 | var t1 = NaN;
|
17966 |
|
17967 | x = +x, y = +y;
|
17968 | if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
|
17969 | switch (this._point) {
|
17970 | case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
17971 | case 1: this._point = 2; break;
|
17972 | case 2: this._point = 3; monotone_point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;
|
17973 | default: monotone_point(this, this._t0, t1 = slope3(this, x, y)); break;
|
17974 | }
|
17975 |
|
17976 | this._x0 = this._x1, this._x1 = x;
|
17977 | this._y0 = this._y1, this._y1 = y;
|
17978 | this._t0 = t1;
|
17979 | }
|
17980 | }
|
17981 |
|
17982 | function MonotoneY(context) {
|
17983 | this._context = new ReflectContext(context);
|
17984 | }
|
17985 |
|
17986 | (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
|
17987 | MonotoneX.prototype.point.call(this, y, x);
|
17988 | };
|
17989 |
|
17990 | function ReflectContext(context) {
|
17991 | this._context = context;
|
17992 | }
|
17993 |
|
17994 | ReflectContext.prototype = {
|
17995 | moveTo: function(x, y) { this._context.moveTo(y, x); },
|
17996 | closePath: function() { this._context.closePath(); },
|
17997 | lineTo: function(x, y) { this._context.lineTo(y, x); },
|
17998 | bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }
|
17999 | };
|
18000 |
|
18001 | function monotoneX(context) {
|
18002 | return new MonotoneX(context);
|
18003 | }
|
18004 |
|
18005 | function monotoneY(context) {
|
18006 | return new MonotoneY(context);
|
18007 | }
|
18008 |
|
18009 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/natural.js
|
18010 | function Natural(context) {
|
18011 | this._context = context;
|
18012 | }
|
18013 |
|
18014 | Natural.prototype = {
|
18015 | areaStart: function() {
|
18016 | this._line = 0;
|
18017 | },
|
18018 | areaEnd: function() {
|
18019 | this._line = NaN;
|
18020 | },
|
18021 | lineStart: function() {
|
18022 | this._x = [];
|
18023 | this._y = [];
|
18024 | },
|
18025 | lineEnd: function() {
|
18026 | var x = this._x,
|
18027 | y = this._y,
|
18028 | n = x.length;
|
18029 |
|
18030 | if (n) {
|
18031 | this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
|
18032 | if (n === 2) {
|
18033 | this._context.lineTo(x[1], y[1]);
|
18034 | } else {
|
18035 | var px = controlPoints(x),
|
18036 | py = controlPoints(y);
|
18037 | for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
|
18038 | this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
|
18039 | }
|
18040 | }
|
18041 | }
|
18042 |
|
18043 | if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();
|
18044 | this._line = 1 - this._line;
|
18045 | this._x = this._y = null;
|
18046 | },
|
18047 | point: function(x, y) {
|
18048 | this._x.push(+x);
|
18049 | this._y.push(+y);
|
18050 | }
|
18051 | };
|
18052 |
|
18053 | // See https://www.particleincell.com/2012/bezier-splines/ for derivation.
|
18054 | function controlPoints(x) {
|
18055 | var i,
|
18056 | n = x.length - 1,
|
18057 | m,
|
18058 | a = new Array(n),
|
18059 | b = new Array(n),
|
18060 | r = new Array(n);
|
18061 | a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
|
18062 | for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
|
18063 | a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
|
18064 | for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
|
18065 | a[n - 1] = r[n - 1] / b[n - 1];
|
18066 | for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
|
18067 | b[n - 1] = (x[n] + a[n - 1]) / 2;
|
18068 | for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
|
18069 | return [a, b];
|
18070 | }
|
18071 |
|
18072 | /* harmony default export */ var natural = (function(context) {
|
18073 | return new Natural(context);
|
18074 | });
|
18075 |
|
18076 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/curve/step.js
|
18077 | function Step(context, t) {
|
18078 | this._context = context;
|
18079 | this._t = t;
|
18080 | }
|
18081 |
|
18082 | Step.prototype = {
|
18083 | areaStart: function() {
|
18084 | this._line = 0;
|
18085 | },
|
18086 | areaEnd: function() {
|
18087 | this._line = NaN;
|
18088 | },
|
18089 | lineStart: function() {
|
18090 | this._x = this._y = NaN;
|
18091 | this._point = 0;
|
18092 | },
|
18093 | lineEnd: function() {
|
18094 | if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
|
18095 | if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
18096 | if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
|
18097 | },
|
18098 | point: function(x, y) {
|
18099 | x = +x, y = +y;
|
18100 | switch (this._point) {
|
18101 | case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
18102 | case 1: this._point = 2; // proceed
|
18103 | default: {
|
18104 | if (this._t <= 0) {
|
18105 | this._context.lineTo(this._x, y);
|
18106 | this._context.lineTo(x, y);
|
18107 | } else {
|
18108 | var x1 = this._x * (1 - this._t) + x * this._t;
|
18109 | this._context.lineTo(x1, this._y);
|
18110 | this._context.lineTo(x1, y);
|
18111 | }
|
18112 | break;
|
18113 | }
|
18114 | }
|
18115 | this._x = x, this._y = y;
|
18116 | }
|
18117 | };
|
18118 |
|
18119 | /* harmony default export */ var curve_step = (function(context) {
|
18120 | return new Step(context, 0.5);
|
18121 | });
|
18122 |
|
18123 | function stepBefore(context) {
|
18124 | return new Step(context, 0);
|
18125 | }
|
18126 |
|
18127 | function stepAfter(context) {
|
18128 | return new Step(context, 1);
|
18129 | }
|
18130 |
|
18131 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/offset/none.js
|
18132 | /* harmony default export */ var offset_none = (function(series, order) {
|
18133 | if (!((n = series.length) > 1)) return;
|
18134 | for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
|
18135 | s0 = s1, s1 = series[order[i]];
|
18136 | for (j = 0; j < m; ++j) {
|
18137 | s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
|
18138 | }
|
18139 | }
|
18140 | });
|
18141 |
|
18142 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/order/none.js
|
18143 | /* harmony default export */ var order_none = (function(series) {
|
18144 | var n = series.length, o = new Array(n);
|
18145 | while (--n >= 0) o[n] = n;
|
18146 | return o;
|
18147 | });
|
18148 |
|
18149 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/stack.js
|
18150 |
|
18151 |
|
18152 |
|
18153 |
|
18154 |
|
18155 | function stackValue(d, key) {
|
18156 | return d[key];
|
18157 | }
|
18158 |
|
18159 | /* harmony default export */ var src_stack = (function() {
|
18160 | var keys = d3_shape_src_constant([]),
|
18161 | order = order_none,
|
18162 | offset = offset_none,
|
18163 | value = stackValue;
|
18164 |
|
18165 | function stack(data) {
|
18166 | var kz = keys.apply(this, arguments),
|
18167 | i,
|
18168 | m = data.length,
|
18169 | n = kz.length,
|
18170 | sz = new Array(n),
|
18171 | oz;
|
18172 |
|
18173 | for (i = 0; i < n; ++i) {
|
18174 | for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {
|
18175 | si[j] = sij = [0, +value(data[j], ki, j, data)];
|
18176 | sij.data = data[j];
|
18177 | }
|
18178 | si.key = ki;
|
18179 | }
|
18180 |
|
18181 | for (i = 0, oz = order(sz); i < n; ++i) {
|
18182 | sz[oz[i]].index = i;
|
18183 | }
|
18184 |
|
18185 | offset(sz, oz);
|
18186 | return sz;
|
18187 | }
|
18188 |
|
18189 | stack.keys = function(_) {
|
18190 | return arguments.length ? (keys = typeof _ === "function" ? _ : d3_shape_src_constant(d3_shape_src_array_slice.call(_)), stack) : keys;
|
18191 | };
|
18192 |
|
18193 | stack.value = function(_) {
|
18194 | return arguments.length ? (value = typeof _ === "function" ? _ : d3_shape_src_constant(+_), stack) : value;
|
18195 | };
|
18196 |
|
18197 | stack.order = function(_) {
|
18198 | return arguments.length ? (order = _ == null ? order_none : typeof _ === "function" ? _ : d3_shape_src_constant(d3_shape_src_array_slice.call(_)), stack) : order;
|
18199 | };
|
18200 |
|
18201 | stack.offset = function(_) {
|
18202 | return arguments.length ? (offset = _ == null ? offset_none : _, stack) : offset;
|
18203 | };
|
18204 |
|
18205 | return stack;
|
18206 | });
|
18207 |
|
18208 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/offset/expand.js
|
18209 |
|
18210 |
|
18211 | /* harmony default export */ var expand = (function(series, order) {
|
18212 | if (!((n = series.length) > 0)) return;
|
18213 | for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
|
18214 | for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
|
18215 | if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
|
18216 | }
|
18217 | offset_none(series, order);
|
18218 | });
|
18219 |
|
18220 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/offset/diverging.js
|
18221 | /* harmony default export */ var offset_diverging = (function(series, order) {
|
18222 | if (!((n = series.length) > 0)) return;
|
18223 | for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
|
18224 | for (yp = yn = 0, i = 0; i < n; ++i) {
|
18225 | if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) {
|
18226 | d[0] = yp, d[1] = yp += dy;
|
18227 | } else if (dy < 0) {
|
18228 | d[1] = yn, d[0] = yn += dy;
|
18229 | } else {
|
18230 | d[0] = yp;
|
18231 | }
|
18232 | }
|
18233 | }
|
18234 | });
|
18235 |
|
18236 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/offset/silhouette.js
|
18237 |
|
18238 |
|
18239 | /* harmony default export */ var silhouette = (function(series, order) {
|
18240 | if (!((n = series.length) > 0)) return;
|
18241 | for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
|
18242 | for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
|
18243 | s0[j][1] += s0[j][0] = -y / 2;
|
18244 | }
|
18245 | offset_none(series, order);
|
18246 | });
|
18247 |
|
18248 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/offset/wiggle.js
|
18249 |
|
18250 |
|
18251 | /* harmony default export */ var wiggle = (function(series, order) {
|
18252 | if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;
|
18253 | for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
|
18254 | for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
|
18255 | var si = series[order[i]],
|
18256 | sij0 = si[j][1] || 0,
|
18257 | sij1 = si[j - 1][1] || 0,
|
18258 | s3 = (sij0 - sij1) / 2;
|
18259 | for (var k = 0; k < i; ++k) {
|
18260 | var sk = series[order[k]],
|
18261 | skj0 = sk[j][1] || 0,
|
18262 | skj1 = sk[j - 1][1] || 0;
|
18263 | s3 += skj0 - skj1;
|
18264 | }
|
18265 | s1 += sij0, s2 += s3 * sij0;
|
18266 | }
|
18267 | s0[j - 1][1] += s0[j - 1][0] = y;
|
18268 | if (s1) y -= s2 / s1;
|
18269 | }
|
18270 | s0[j - 1][1] += s0[j - 1][0] = y;
|
18271 | offset_none(series, order);
|
18272 | });
|
18273 |
|
18274 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/order/appearance.js
|
18275 |
|
18276 |
|
18277 | /* harmony default export */ var appearance = (function(series) {
|
18278 | var peaks = series.map(peak);
|
18279 | return order_none(series).sort(function(a, b) { return peaks[a] - peaks[b]; });
|
18280 | });
|
18281 |
|
18282 | function peak(series) {
|
18283 | var i = -1, j = 0, n = series.length, vi, vj = -Infinity;
|
18284 | while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;
|
18285 | return j;
|
18286 | }
|
18287 |
|
18288 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/order/ascending.js
|
18289 |
|
18290 |
|
18291 | /* harmony default export */ var order_ascending = (function(series) {
|
18292 | var sums = series.map(ascending_sum);
|
18293 | return order_none(series).sort(function(a, b) { return sums[a] - sums[b]; });
|
18294 | });
|
18295 |
|
18296 | function ascending_sum(series) {
|
18297 | var s = 0, i = -1, n = series.length, v;
|
18298 | while (++i < n) if (v = +series[i][1]) s += v;
|
18299 | return s;
|
18300 | }
|
18301 |
|
18302 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/order/descending.js
|
18303 |
|
18304 |
|
18305 | /* harmony default export */ var order_descending = (function(series) {
|
18306 | return order_ascending(series).reverse();
|
18307 | });
|
18308 |
|
18309 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/order/insideOut.js
|
18310 |
|
18311 |
|
18312 |
|
18313 | /* harmony default export */ var insideOut = (function(series) {
|
18314 | var n = series.length,
|
18315 | i,
|
18316 | j,
|
18317 | sums = series.map(ascending_sum),
|
18318 | order = appearance(series),
|
18319 | top = 0,
|
18320 | bottom = 0,
|
18321 | tops = [],
|
18322 | bottoms = [];
|
18323 |
|
18324 | for (i = 0; i < n; ++i) {
|
18325 | j = order[i];
|
18326 | if (top < bottom) {
|
18327 | top += sums[j];
|
18328 | tops.push(j);
|
18329 | } else {
|
18330 | bottom += sums[j];
|
18331 | bottoms.push(j);
|
18332 | }
|
18333 | }
|
18334 |
|
18335 | return bottoms.reverse().concat(tops);
|
18336 | });
|
18337 |
|
18338 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/order/reverse.js
|
18339 |
|
18340 |
|
18341 | /* harmony default export */ var order_reverse = (function(series) {
|
18342 | return order_none(series).reverse();
|
18343 | });
|
18344 |
|
18345 | // CONCATENATED MODULE: ./node_modules/d3-shape/src/index.js
|
18346 |
|
18347 |
|
18348 |
|
18349 |
|
18350 | // Note: radialArea is deprecated!
|
18351 | // Note: radialLine is deprecated!
|
18352 |
|
18353 |
|
18354 |
|
18355 |
|
18356 |
|
18357 |
|
18358 |
|
18359 |
|
18360 |
|
18361 |
|
18362 |
|
18363 |
|
18364 |
|
18365 |
|
18366 |
|
18367 |
|
18368 |
|
18369 |
|
18370 |
|
18371 |
|
18372 |
|
18373 |
|
18374 |
|
18375 |
|
18376 |
|
18377 |
|
18378 |
|
18379 |
|
18380 |
|
18381 |
|
18382 |
|
18383 |
|
18384 |
|
18385 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 |
|
18391 |
|
18392 |
|
18393 | // CONCATENATED MODULE: ./src/shape/shape.js
|
18394 | /**
|
18395 | * Copyright (c) 2017 ~ present NAVER Corp.
|
18396 | * billboard.js project is licensed under the MIT license
|
18397 | */
|
18398 |
|
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 | util_extend(ChartInternal_ChartInternal.prototype, {
|
18404 | getShapeIndices: function getShapeIndices(typeFilter) {
|
18405 | var $$ = this,
|
18406 | config = $$.config,
|
18407 | indices = {},
|
18408 | i = 0;
|
18409 | return $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) {
|
18410 | for (var groups, j = 0; groups = config.data_groups[j]; j++) if (!(groups.indexOf(d.id) < 0)) for (var _row4, _k4 = 0; _row4 = groups[_k4]; _k4++) if (_row4 in indices) {
|
18411 | indices[d.id] = indices[_row4];
|
18412 | break;
|
18413 | }
|
18414 |
|
18415 | isUndefined(indices[d.id]) && (indices[d.id] = i++);
|
18416 | }), indices.__max__ = i - 1, indices;
|
18417 | },
|
18418 | getShapeX: function getShapeX(offset, targetsNum, indices, isSub) {
|
18419 | var $$ = this,
|
18420 | scale = isSub ? $$.subX : $$.zoomScale || $$.x,
|
18421 | barPadding = $$.config.bar_padding,
|
18422 | sum = function (p, c) {
|
18423 | return p + c;
|
18424 | },
|
18425 | halfWidth = isObjectType(offset) && offset.total.length ? offset.total.reduce(sum) / 2 : 0;
|
18426 |
|
18427 | return function (d) {
|
18428 | var index = d.id in indices ? indices[d.id] : 0,
|
18429 | x = 0;
|
18430 |
|
18431 | if (notEmpty(d.x)) {
|
18432 | var xPos = scale(d.x);
|
18433 | x = halfWidth ? xPos - (offset[d.id] || offset.width) + offset.total.slice(0, index + 1).reduce(sum) - halfWidth : xPos - (isNumber(offset) ? offset : offset.width) * (targetsNum / 2 - index);
|
18434 | } // adjust x position for bar.padding optionq
|
18435 |
|
18436 |
|
18437 | return offset && x && targetsNum > 1 && barPadding && (index && (x += barPadding * index), targetsNum > 2 ? x -= (targetsNum - 1) * barPadding / 2 : targetsNum === 2 && (x -= barPadding / 2)), x;
|
18438 | };
|
18439 | },
|
18440 | getShapeY: function getShapeY(isSub) {
|
18441 | var $$ = this,
|
18442 | isStackNormalized = $$.isStackNormalized();
|
18443 | return function (d) {
|
18444 | return (isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id))(isStackNormalized ? $$.getRatio("index", d, !0) : d.value);
|
18445 | };
|
18446 | },
|
18447 | getShapeOffset: function getShapeOffset(typeFilter, indices, isSub) {
|
18448 | var $$ = this,
|
18449 | targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),
|
18450 | targetIds = targets.map(function (t) {
|
18451 | return t.id;
|
18452 | });
|
18453 | return function (d, idx) {
|
18454 | var scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id),
|
18455 | y0 = scale(0),
|
18456 | offset = y0,
|
18457 | i = idx;
|
18458 | return targets.forEach(function (t) {
|
18459 | var rowValues = $$.isStepType(d) ? $$.convertValuesToStep(t.values) : t.values,
|
18460 | values = rowValues.map(function (v) {
|
18461 | return $$.isStackNormalized() ? $$.getRatio("index", v, !0) : v.value;
|
18462 | });
|
18463 | t.id === d.id || indices[t.id] !== indices[d.id] || targetIds.indexOf(t.id) < targetIds.indexOf(d.id) && ((isUndefined(rowValues[i]) || +rowValues[i].x !== +d.x) && (i = -1, rowValues.forEach(function (v, j) {
|
18464 | var x1 = v.x.constructor === Date ? +v.x : v.x,
|
18465 | x2 = d.x.constructor === Date ? +d.x : d.x;
|
18466 | x1 === x2 && (i = j);
|
18467 | })), i in rowValues && rowValues[i].value * d.value >= 0 && (offset += scale(values[i]) - y0));
|
18468 | }), offset;
|
18469 | };
|
18470 | },
|
18471 | isWithinShape: function isWithinShape(that, d) {
|
18472 | var isWithin,
|
18473 | $$ = this,
|
18474 | shape = src_select(that);
|
18475 | return $$.isTargetToShow(d.id) ? $$.hasValidPointType(that.nodeName) ? isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.isBubbleType(d) ? $$.pointSelectR(d) * 1.5 : 0) : that.nodeName === "path" && (isWithin = !shape.classed(config_classes.bar) || $$.isWithinBar(that)) : isWithin = !1, isWithin;
|
18476 | },
|
18477 | getInterpolate: function getInterpolate(d) {
|
18478 | var $$ = this,
|
18479 | interpolation = $$.getInterpolateType(d);
|
18480 | return {
|
18481 | "basis": curve_basis,
|
18482 | "basis-closed": curve_basisClosed,
|
18483 | "basis-open": basisOpen,
|
18484 | "bundle": curve_bundle,
|
18485 | "cardinal": cardinal,
|
18486 | "cardinal-closed": cardinalClosed,
|
18487 | "cardinal-open": cardinalOpen,
|
18488 | "catmull-rom": curve_catmullRom,
|
18489 | "catmull-rom-closed": catmullRomClosed,
|
18490 | "catmull-rom-open": catmullRomOpen,
|
18491 | "monotone-x": monotoneX,
|
18492 | "monotone-y": monotoneY,
|
18493 | "natural": natural,
|
18494 | "linear-closed": linearClosed,
|
18495 | "linear": curve_linear,
|
18496 | "step": curve_step,
|
18497 | "step-after": stepAfter,
|
18498 | "step-before": stepBefore
|
18499 | }[interpolation];
|
18500 | },
|
18501 | getInterpolateType: function getInterpolateType(d) {
|
18502 | var $$ = this,
|
18503 | type = $$.config.spline_interpolation_type,
|
18504 | interpolation = $$.isInterpolationType(type) ? type : "cardinal";
|
18505 | return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? $$.config.line_step_type : "linear";
|
18506 | }
|
18507 | });
|
18508 | // CONCATENATED MODULE: ./src/shape/arc.js
|
18509 | /**
|
18510 | * Copyright (c) 2017 ~ present NAVER Corp.
|
18511 | * billboard.js project is licensed under the MIT license
|
18512 | */
|
18513 |
|
18514 |
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 |
|
18520 | util_extend(ChartInternal_ChartInternal.prototype, {
|
18521 | initPie: function initPie() {
|
18522 | var $$ = this,
|
18523 | config = $$.config,
|
18524 | padding = config.pie_padding,
|
18525 | padAngle = $$.hasType("pie") && padding ? padding * .01 : config["".concat(config.data_type, "_padAngle")] ? config["".concat(config.data_type, "_padAngle")] : 0;
|
18526 | $$.pie = src_pie().padAngle(padAngle).sortValues($$.isOrderAsc() || $$.isOrderDesc() ? function (a, b) {
|
18527 | return $$.isOrderAsc() ? a - b : b - a;
|
18528 | } : null).value(function (d) {
|
18529 | return d.values.reduce(function (a, b) {
|
18530 | return a + b.value;
|
18531 | }, 0);
|
18532 | });
|
18533 | },
|
18534 | updateRadius: function updateRadius() {
|
18535 | var $$ = this,
|
18536 | config = $$.config,
|
18537 | radius = config.pie_innerRadius,
|
18538 | padding = config.pie_padding,
|
18539 | w = config.gauge_width || config.donut_width;
|
18540 | $$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2, $$.radius = $$.radiusExpanded * .95, $$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : .6;
|
18541 | var innerRadius = radius || (padding ? padding * ($$.innerRadiusRatio + .1) : 0); // NOTE: innerRadius can be an object by user setting, only for 'pie' type
|
18542 |
|
18543 | $$.innerRadius = $$.hasType("donut") || $$.hasType("gauge") ? $$.radius * $$.innerRadiusRatio : innerRadius;
|
18544 | },
|
18545 | getInnerRadius: function getInnerRadius(d) {
|
18546 | var $$ = this,
|
18547 | radius = $$.innerRadius;
|
18548 | return !isNumber(radius) && d && (radius = radius[d.data.id] || 0), radius;
|
18549 | },
|
18550 | updateArc: function updateArc() {
|
18551 | var $$ = this;
|
18552 | $$.svgArc = $$.getSvgArc(), $$.svgArcExpanded = $$.getSvgArcExpanded(), $$.svgArcExpandedSub = $$.getSvgArcExpanded(.98);
|
18553 | },
|
18554 | updateAngle: function updateAngle(dValue) {
|
18555 | var $$ = this,
|
18556 | config = $$.config,
|
18557 | pie = $$.pie,
|
18558 | d = dValue,
|
18559 | found = !1;
|
18560 | if (!config) return null;
|
18561 |
|
18562 | if (d.data && $$.isGaugeType(d.data)) {
|
18563 | var totalSum = $$.getTotalDataSum(); // if gauge_max less than totalSum, make totalSum to max value
|
18564 |
|
18565 | totalSum > config.gauge_max && (config.gauge_max = totalSum);
|
18566 | var radius = Math.PI * (config.gauge_fullCircle ? 2 : 1),
|
18567 | gStart = config.gauge_startingAngle,
|
18568 | gEnd = radius * (totalSum / (config.gauge_max - config.gauge_min));
|
18569 | pie = $$.pie.startAngle(gStart).endAngle(gEnd + gStart);
|
18570 | }
|
18571 |
|
18572 | return pie($$.filterTargetsToShow()).forEach(function (t) {
|
18573 | found || t.data.id !== d.data.id || (found = !0, d = t);
|
18574 | }), isNaN(d.startAngle) && (d.startAngle = 0), isNaN(d.endAngle) && (d.endAngle = d.startAngle), found ? d : null;
|
18575 | },
|
18576 | getSvgArc: function getSvgArc() {
|
18577 | var $$ = this,
|
18578 | ir = $$.getInnerRadius(),
|
18579 | arc = src_arc().outerRadius($$.radius).innerRadius(isNumber(ir) ? ir : 0),
|
18580 | newArc = function (d, withoutUpdate) {
|
18581 | var path = "M 0 0";
|
18582 |
|
18583 | if (d.value || d.data) {
|
18584 | isNumber(ir) || (arc = arc.innerRadius($$.getInnerRadius(d)));
|
18585 | var updated = !withoutUpdate && $$.updateAngle(d);
|
18586 | withoutUpdate ? path = arc(d) : updated && (path = arc(updated));
|
18587 | }
|
18588 |
|
18589 | return path;
|
18590 | };
|
18591 |
|
18592 | return newArc.centroid = arc.centroid, newArc;
|
18593 | },
|
18594 | getSvgArcExpanded: function getSvgArcExpanded(rate) {
|
18595 | var $$ = this,
|
18596 | arc = src_arc().outerRadius($$.radiusExpanded * (rate || 1));
|
18597 | return function (d) {
|
18598 | var updated = $$.updateAngle(d);
|
18599 | return updated ? arc.innerRadius($$.getInnerRadius(d))(updated) : "M 0 0";
|
18600 | };
|
18601 | },
|
18602 | getArc: function getArc(d, withoutUpdate, force) {
|
18603 | return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
18604 | },
|
18605 | transformForArcLabel: function transformForArcLabel(d) {
|
18606 | var $$ = this,
|
18607 | config = $$.config,
|
18608 | updated = $$.updateAngle(d),
|
18609 | translate = "";
|
18610 |
|
18611 | if (updated && (!$$.hasType("gauge") || $$.hasMultiTargets())) {
|
18612 | var c = this.svgArc.centroid(updated),
|
18613 | x = isNaN(c[0]) ? 0 : c[0],
|
18614 | y = isNaN(c[1]) ? 0 : c[1],
|
18615 | h = Math.sqrt(x * x + y * y),
|
18616 | ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio;
|
18617 | ratio = ratio ? isFunction(ratio) ? ratio(d, $$.radius, h) : ratio : $$.radius && (h ? (36 / $$.radius > .375 ? 1.175 - 36 / $$.radius : .8) * $$.radius / h : 0), translate = "translate(".concat(x * ratio, ",").concat(y * ratio, ")");
|
18618 | }
|
18619 |
|
18620 | return translate;
|
18621 | },
|
18622 | convertToArcData: function convertToArcData(d) {
|
18623 | return this.addName({
|
18624 | id: d.data.id,
|
18625 | value: d.value,
|
18626 | ratio: this.getRatio("arc", d),
|
18627 | index: d.index
|
18628 | });
|
18629 | },
|
18630 | textForArcLabel: function textForArcLabel(selection) {
|
18631 | var $$ = this;
|
18632 | $$.shouldShowArcLabel() && selection.each(function (d) {
|
18633 | var node = src_select(this),
|
18634 | updated = $$.updateAngle(d),
|
18635 | value = updated ? updated.value : null,
|
18636 | ratio = $$.getRatio("arc", updated),
|
18637 | id = d.data.id,
|
18638 | isUnderThreshold = $$.hasType("gauge") || $$.meetsArcLabelThreshold(ratio);
|
18639 |
|
18640 | if (isUnderThreshold) {
|
18641 | var text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, id).toString();
|
18642 | setTextValue(node, text);
|
18643 | }
|
18644 | });
|
18645 | },
|
18646 | textForGaugeMinMax: function textForGaugeMinMax(value, isMax) {
|
18647 | var format = this.getGaugeLabelExtents();
|
18648 | return format ? format(value, isMax) : value;
|
18649 | },
|
18650 | expandArc: function expandArc(targetIds) {
|
18651 | var $$ = this; // MEMO: avoid to cancel transition
|
18652 |
|
18653 | if ($$.transiting) {
|
18654 | var interval = setInterval(function () {
|
18655 | $$.transiting || (clearInterval(interval), $$.legend.selectAll(".".concat(config_classes.legendItemFocused)).size() > 0 && $$.expandArc(targetIds));
|
18656 | }, 10);
|
18657 | return;
|
18658 | }
|
18659 |
|
18660 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
18661 | $$.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(config_classes.chartArc))).each(function (d) {
|
18662 | if ($$.shouldExpand(d.data.id) && d.value !== 0) {
|
18663 | var expandDuration = $$.expandDuration(d.data.id);
|
18664 | src_select(this).selectAll("path").transition().duration(expandDuration).attr("d", $$.svgArcExpanded).transition().duration(expandDuration * 2).attr("d", $$.svgArcExpandedSub);
|
18665 | }
|
18666 | });
|
18667 | },
|
18668 | unexpandArc: function unexpandArc(targetIds) {
|
18669 | var $$ = this;
|
18670 |
|
18671 | if (!$$.transiting) {
|
18672 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
18673 | $$.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(config_classes.chartArc))).selectAll("path").transition().duration(function (d) {
|
18674 | return $$.expandDuration(d.data.id);
|
18675 | }).attr("d", $$.svgArc), $$.svg.selectAll("".concat(config_classes.arc)).style("opacity", "1");
|
18676 | }
|
18677 | },
|
18678 | expandDuration: function expandDuration(id) {
|
18679 | var type,
|
18680 | $$ = this,
|
18681 | config = $$.config;
|
18682 | return $$.isDonutType(id) ? type = "donut" : $$.isGaugeType(id) ? type = "gauge" : $$.isPieType(id) && (type = "pie"), type ? config["".concat(type, "_expand_duration")] : 50;
|
18683 | },
|
18684 | shouldExpand: function shouldExpand(id) {
|
18685 | var $$ = this,
|
18686 | config = $$.config;
|
18687 | return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
|
18688 | },
|
18689 | shouldShowArcLabel: function shouldShowArcLabel() {
|
18690 | var $$ = this,
|
18691 | config = $$.config;
|
18692 | return ["pie", "donut", "gauge"].some(function (v) {
|
18693 | return $$.hasType(v) && config["".concat(v, "_label_show")];
|
18694 | });
|
18695 | },
|
18696 | meetsArcLabelThreshold: function meetsArcLabelThreshold(ratio) {
|
18697 | var $$ = this,
|
18698 | config = $$.config,
|
18699 | threshold = $$.hasType("donut") ? config.donut_label_threshold : config.pie_label_threshold;
|
18700 | return ratio >= threshold;
|
18701 | },
|
18702 | getArcLabelFormat: function getArcLabelFormat() {
|
18703 | var $$ = this,
|
18704 | config = $$.config,
|
18705 | format = config.pie_label_format;
|
18706 | return $$.hasType("gauge") ? format = config.gauge_label_format : $$.hasType("donut") && (format = config.donut_label_format), format;
|
18707 | },
|
18708 | getGaugeLabelExtents: function getGaugeLabelExtents() {
|
18709 | var config = this.config;
|
18710 | return config.gauge_label_extents;
|
18711 | },
|
18712 | getArcTitle: function getArcTitle() {
|
18713 | var $$ = this,
|
18714 | type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
|
18715 | return type ? $$.config["".concat(type, "_title")] : "";
|
18716 | },
|
18717 | updateTargetsForArc: function updateTargetsForArc(targets) {
|
18718 | var $$ = this,
|
18719 | main = $$.main,
|
18720 | hasGauge = $$.hasType("gauge"),
|
18721 | classChartArc = $$.classChartArc.bind($$),
|
18722 | classArcs = $$.classArcs.bind($$),
|
18723 | classFocus = $$.classFocus.bind($$),
|
18724 | mainPieUpdate = main.select(".".concat(config_classes.chartArcs)).selectAll(".".concat(config_classes.chartArc)).data($$.pie(targets)).attr("class", function (d) {
|
18725 | return classChartArc(d) + classFocus(d.data);
|
18726 | }),
|
18727 | mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc);
|
18728 | mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate), mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : ".35em").style("opacity", "0").style("text-anchor", "middle").style("pointer-events", "none");
|
18729 | },
|
18730 | initArc: function initArc() {
|
18731 | var $$ = this;
|
18732 | $$.arcs = $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartArcs).attr("transform", $$.getTranslate("arc")), $$.setArcTitle();
|
18733 | },
|
18734 |
|
18735 | /**
|
18736 | * Set arc title text
|
18737 | * @private
|
18738 | */
|
18739 | setArcTitle: function setArcTitle() {
|
18740 | var $$ = this,
|
18741 | title = $$.getArcTitle(),
|
18742 | hasGauge = $$.hasType("gauge");
|
18743 |
|
18744 | if (title) {
|
18745 | var text = $$.arcs.append("text").attr("class", config_classes[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"]).style("text-anchor", "middle");
|
18746 | hasGauge && text.attr("dy", "-0.3em").style("font-size", "27px"), setTextValue(text, title, hasGauge ? undefined : [-1.3, 1.3]);
|
18747 | }
|
18748 | },
|
18749 | redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
18750 | var $$ = this,
|
18751 | config = $$.config,
|
18752 | main = $$.main,
|
18753 | hasInteraction = config.interaction_enabled,
|
18754 | mainArc = main.selectAll(".".concat(config_classes.arcs)).selectAll(".".concat(config_classes.arc)).data($$.arcData.bind($$));
|
18755 | // bind arc events
|
18756 | mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove(), mainArc = mainArc.enter().append("path").attr("class", $$.classArc.bind($$)).style("fill", function (d) {
|
18757 | return $$.color(d.data);
|
18758 | }).style("cursor", function (d) {
|
18759 | return hasInteraction && (config.data_selection_isselectable(d) ? "pointer" : null);
|
18760 | }).style("opacity", "0").each(function (d) {
|
18761 | $$.isGaugeType(d.data) && (d.startAngle = config.gauge_startingAngle, d.endAngle = config.gauge_startingAngle), this._current = d;
|
18762 | }).merge(mainArc), mainArc.attr("transform", function (d) {
|
18763 | return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
|
18764 | }).style("opacity", function (d) {
|
18765 | return d === this._current ? "0" : "1";
|
18766 | }).each(function () {
|
18767 | $$.transiting = !0;
|
18768 | }).transition().duration(duration).attrTween("d", function (d) {
|
18769 | var updated = $$.updateAngle(d);
|
18770 | if (!updated) return function () {
|
18771 | return "M 0 0";
|
18772 | };
|
18773 | isNaN(this._current.startAngle) && (this._current.startAngle = 0), isNaN(this._current.endAngle) && (this._current.endAngle = this._current.startAngle);
|
18774 | var interpolate = src_value(this._current, updated);
|
18775 | return this._current = interpolate(0), function (t) {
|
18776 | var interpolated = interpolate(t);
|
18777 | // data.id will be updated by interporator
|
18778 | return interpolated.data = d.data, $$.getArc(interpolated, !0);
|
18779 | };
|
18780 | }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
|
18781 | return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id);
|
18782 | }) // Where gauge reading color would receive customization.
|
18783 | .style("opacity", "1").call($$.endall, function () {
|
18784 | $$.transiting = !1;
|
18785 | }), hasInteraction && $$.bindArcEvent(mainArc), $$.redrawArcText(duration);
|
18786 | },
|
18787 | bindArcEvent: function bindArcEvent(arc) {
|
18788 | function selectArc(_this, arcData, id) {
|
18789 | $$.expandArc(id), $$.api.focus(id), $$.toggleFocusLegend(id, !0), $$.showTooltip([arcData], _this);
|
18790 | }
|
18791 |
|
18792 | function unselectArc(arcData) {
|
18793 | var id = arcData && arcData.id || undefined;
|
18794 | $$.unexpandArc(id), $$.api.revert(), $$.revertLegend(), $$.hideTooltip();
|
18795 | }
|
18796 |
|
18797 | var $$ = this,
|
18798 | isTouch = $$.inputType === "touch",
|
18799 | isMouse = $$.inputType === "mouse";
|
18800 |
|
18801 | // touch events
|
18802 | if (arc.on("click", function (d, i) {
|
18803 | var arcData,
|
18804 | updated = $$.updateAngle(d);
|
18805 | updated && (arcData = $$.convertToArcData(updated), $$.toggleShape && $$.toggleShape(this, arcData, i), $$.config.data_onclick.call($$.api, arcData, this));
|
18806 | }), isMouse && arc.on("mouseover", function (d) {
|
18807 | if (!$$.transiting) // skip while transiting
|
18808 | {
|
18809 | var updated = $$.updateAngle(d),
|
18810 | arcData = updated ? $$.convertToArcData(updated) : null,
|
18811 | id = arcData && arcData.id || undefined;
|
18812 | selectArc(this, arcData, id), $$.setOverOut(!0, arcData);
|
18813 | }
|
18814 | }).on("mouseout", function (d) {
|
18815 | if (!$$.transiting) // skip while transiting
|
18816 | {
|
18817 | var updated = $$.updateAngle(d),
|
18818 | arcData = updated ? $$.convertToArcData(updated) : null;
|
18819 | unselectArc(), $$.setOverOut(!1, arcData);
|
18820 | }
|
18821 | }).on("mousemove", function (d) {
|
18822 | var updated = $$.updateAngle(d),
|
18823 | arcData = updated ? $$.convertToArcData(updated) : null;
|
18824 | $$.showTooltip([arcData], this);
|
18825 | }), isTouch && $$.hasArcType() && !$$.radars) {
|
18826 | var getEventArc = function () {
|
18827 | var touch = on_event.changedTouches[0],
|
18828 | eventArc = src_select(browser["document"].elementFromPoint(touch.clientX, touch.clientY));
|
18829 | return eventArc;
|
18830 | },
|
18831 | handler = function () {
|
18832 | if (!$$.transiting) // skip while transiting
|
18833 | {
|
18834 | var eventArc = getEventArc(),
|
18835 | datum = eventArc.datum(),
|
18836 | updated = datum && datum.data && datum.data.id ? $$.updateAngle(datum) : null,
|
18837 | arcData = updated ? $$.convertToArcData(updated) : null,
|
18838 | id = arcData && arcData.id || undefined;
|
18839 | $$.callOverOutForTouch(arcData), isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
18840 | }
|
18841 | };
|
18842 |
|
18843 | $$.svg.on("touchstart", handler).on("touchmove", handler);
|
18844 | }
|
18845 | },
|
18846 | redrawArcText: function redrawArcText(duration) {
|
18847 | var $$ = this,
|
18848 | config = $$.config,
|
18849 | main = $$.main,
|
18850 | hasGauge = $$.hasType("gauge"),
|
18851 | text = main.selectAll(".".concat(config_classes.chartArc)).select("text").style("opacity", "0").attr("class", function (d) {
|
18852 | return $$.isGaugeType(d.data) ? config_classes.gaugeValue : null;
|
18853 | }).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
|
18854 | return $$.isGaugeType(d.data) && !$$.hasMultiTargets() ? "".concat(Math.round($$.radius / 5), "px") : "";
|
18855 | }).transition().duration(duration).style("opacity", function (d) {
|
18856 | return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? "1" : "0";
|
18857 | });
|
18858 |
|
18859 | if (main.select(".".concat(config_classes.chartArcsTitle)).style("opacity", $$.hasType("donut") || hasGauge ? "1" : "0"), hasGauge) {
|
18860 | var isFullCircle = config.gauge_fullCircle,
|
18861 | endAngle = (isFullCircle ? -4 : -1) * config.gauge_startingAngle;
|
18862 | isFullCircle && text.attr("dy", "".concat(Math.round($$.radius / 14))), $$.arcs.select(".".concat(config_classes.chartArcsBackground)).attr("d", function () {
|
18863 | var d = {
|
18864 | data: [{
|
18865 | value: config.gauge_max
|
18866 | }],
|
18867 | startAngle: config.gauge_startingAngle,
|
18868 | endAngle: endAngle
|
18869 | };
|
18870 | return $$.getArc(d, !0, !0);
|
18871 | }), $$.arcs.select(".".concat(config_classes.chartArcsGaugeUnit)).attr("dy", ".75em").text(config.gauge_label_show ? config.gauge_units : ""), config.gauge_label_show && ($$.arcs.select(".".concat(config_classes.chartArcsGaugeMin)).attr("dx", "".concat(-1 * ($$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)), "px")).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_min, !1)), !isFullCircle && $$.arcs.select(".".concat(config_classes.chartArcsGaugeMax)).attr("dx", "".concat($$.innerRadius + ($$.radius - $$.innerRadius) / 2, "px")).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0)));
|
18872 | }
|
18873 | },
|
18874 | initGauge: function initGauge() {
|
18875 | var $$ = this,
|
18876 | config = $$.config,
|
18877 | arcs = $$.arcs,
|
18878 | appendText = function (className) {
|
18879 | arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none");
|
18880 | };
|
18881 |
|
18882 | $$.hasType("gauge") && (arcs.append("path").attr("class", config_classes.chartArcsBackground), config.gauge_units && appendText(config_classes.chartArcsGaugeUnit), config.gauge_label_show && (appendText(config_classes.chartArcsGaugeMin), !config.gauge_fullCircle && appendText(config_classes.chartArcsGaugeMax)));
|
18883 | },
|
18884 | getGaugeLabelHeight: function getGaugeLabelHeight() {
|
18885 | return this.config.gauge_label_show ? 20 : 0;
|
18886 | }
|
18887 | });
|
18888 | // CONCATENATED MODULE: ./src/shape/bar.js
|
18889 |
|
18890 |
|
18891 | /**
|
18892 | * Copyright (c) 2017 ~ present NAVER Corp.
|
18893 | * billboard.js project is licensed under the MIT license
|
18894 | */
|
18895 |
|
18896 |
|
18897 |
|
18898 |
|
18899 | util_extend(ChartInternal_ChartInternal.prototype, {
|
18900 | initBar: function initBar() {
|
18901 | var $$ = this;
|
18902 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartBars);
|
18903 | },
|
18904 | updateTargetsForBar: function updateTargetsForBar(targets) {
|
18905 | var $$ = this,
|
18906 | config = $$.config,
|
18907 | classChartBar = $$.classChartBar.bind($$),
|
18908 | classBars = $$.classBars.bind($$),
|
18909 | classFocus = $$.classFocus.bind($$),
|
18910 | mainBarUpdate = $$.main.select(".".concat(config_classes.chartBars)).selectAll(".".concat(config_classes.chartBar)).data(targets).attr("class", function (d) {
|
18911 | return classChartBar(d) + classFocus(d);
|
18912 | }),
|
18913 | mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", "none");
|
18914 | // Bars for each data
|
18915 | mainBarEnter.append("g").attr("class", classBars).style("cursor", function (d) {
|
18916 | return config.data_selection_isselectable(d) ? "pointer" : null;
|
18917 | });
|
18918 | },
|
18919 | updateBar: function updateBar(durationForExit) {
|
18920 | var $$ = this,
|
18921 | barData = $$.barData.bind($$),
|
18922 | classBar = $$.classBar.bind($$),
|
18923 | initialOpacity = $$.initialOpacity.bind($$);
|
18924 | $$.mainBar = $$.main.selectAll(".".concat(config_classes.bars)).selectAll(".".concat(config_classes.bar)).data(barData), $$.mainBar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainBar = $$.mainBar.enter().append("path").attr("class", classBar).style("fill", $$.color).merge($$.mainBar).style("opacity", initialOpacity);
|
18925 | },
|
18926 | redrawBar: function redrawBar(drawBar, withTransition) {
|
18927 | return [(withTransition ? this.mainBar.transition(getRandom()) : this.mainBar).attr("d", drawBar).style("fill", this.color).style("opacity", "1")];
|
18928 | },
|
18929 | getBarW: function getBarW(axis, barTargetsNum) {
|
18930 | var result,
|
18931 | $$ = this,
|
18932 | config = $$.config,
|
18933 | tickInterval = axis.tickInterval($$.getMaxDataCount()),
|
18934 | isGrouped = config.data_groups.length,
|
18935 | getWidth = function (id) {
|
18936 | var width = id ? config.bar_width[id] : config.bar_width,
|
18937 | ratio = id ? width.ratio : config.bar_width_ratio,
|
18938 | max = id ? width.max : config.bar_width_max,
|
18939 | w = isNumber(width) ? width : barTargetsNum ? tickInterval * ratio / barTargetsNum : 0;
|
18940 | return max && w > max ? max : w;
|
18941 | };
|
18942 |
|
18943 | return result = getWidth(), !isGrouped && isObjectType(config.bar_width) && (result = {
|
18944 | width: result,
|
18945 | total: []
|
18946 | }, $$.filterTargetsToShow($$.data.targets).forEach(function (v) {
|
18947 | config.bar_width[v.id] && (result[v.id] = getWidth(v.id), result.total.push(result[v.id] || result.width));
|
18948 | })), result;
|
18949 | },
|
18950 | getBars: function getBars(i, id) {
|
18951 | var $$ = this,
|
18952 | suffix = isValue(i) ? "-".concat(i) : "";
|
18953 | return (id ? $$.main.selectAll(".".concat(config_classes.bars).concat($$.getTargetSelectorSuffix(id))) : $$.main).selectAll(".".concat(config_classes.bar).concat(suffix));
|
18954 | },
|
18955 | expandBars: function expandBars(i, id, reset) {
|
18956 | var $$ = this;
|
18957 | reset && $$.unexpandBars(), $$.getBars(i, id).classed(config_classes.EXPANDED, !0);
|
18958 | },
|
18959 | unexpandBars: function unexpandBars(i) {
|
18960 | this.getBars(i).classed(config_classes.EXPANDED, !1);
|
18961 | },
|
18962 | generateDrawBar: function generateDrawBar(barIndices, isSub) {
|
18963 | var $$ = this,
|
18964 | config = $$.config,
|
18965 | getPoints = $$.generateGetBarPoints(barIndices, isSub),
|
18966 | isRotated = config.axis_rotated,
|
18967 | isGrouped = config.data_groups.length,
|
18968 | barRadius = config.bar_radius,
|
18969 | barRadiusRatio = config.bar_radius_ratio,
|
18970 | getRadius = isNumber(barRadius) && barRadius > 0 ? function () {
|
18971 | return barRadius;
|
18972 | } : isNumber(barRadiusRatio) ? function (w) {
|
18973 | return w * barRadiusRatio;
|
18974 | } : null;
|
18975 | return function (d, i) {
|
18976 | // 4 points that make a bar
|
18977 | var points = getPoints(d, i),
|
18978 | indexX = +isRotated,
|
18979 | indexY = +!indexX,
|
18980 | isNegative = d.value < 0,
|
18981 | pathRadius = ["", ""],
|
18982 | radius = 0; // switch points if axis is rotated, not applicable for sub chart
|
18983 |
|
18984 | if (getRadius && !isGrouped) {
|
18985 | var index = isRotated ? indexY : indexX,
|
18986 | barW = points[2][index] - points[0][index];
|
18987 | radius = getRadius(barW);
|
18988 | var arc = "a".concat(radius, ",").concat(radius, " ").concat(isNegative ? "1 0 0" : "0 0 1", " ");
|
18989 | pathRadius[+!isRotated] = "".concat(arc).concat(radius, ",").concat(radius), pathRadius[+isRotated] = "".concat(arc).concat([-radius, radius][isRotated ? "sort" : "reverse"]()), isNegative && pathRadius.reverse();
|
18990 | } // path string data shouldn't be containing new line chars
|
18991 | // https://github.com/naver/billboard.js/issues/530
|
18992 |
|
18993 |
|
18994 | var path = isRotated ? "H".concat(points[1][indexX] - radius, " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) : "V".concat(points[1][indexY] + (isNegative ? -radius : radius), " ").concat(pathRadius[0], "H").concat(points[2][indexX] - radius, " ").concat(pathRadius[1], "V").concat(points[3][indexY]);
|
18995 | return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
|
18996 | };
|
18997 | },
|
18998 | generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) {
|
18999 | var $$ = this,
|
19000 | axis = isSub ? $$.subXAxis : $$.xAxis,
|
19001 | barTargetsNum = barIndices.__max__ + 1,
|
19002 | barW = $$.getBarW(axis, barTargetsNum),
|
19003 | barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub),
|
19004 | barY = $$.getShapeY(!!isSub),
|
19005 | barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),
|
19006 | yScale = isSub ? $$.getSubYScale : $$.getYScale;
|
19007 | return function (d, i) {
|
19008 | var y0 = yScale.call($$, d.id)(0),
|
19009 | offset = barOffset(d, i) || y0,
|
19010 | width = isNumber(barW) ? barW : barW[d.id] || barW.width,
|
19011 | posX = barX(d),
|
19012 | posY = barY(d);
|
19013 | // 4 points that make a bar
|
19014 | return $$.config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0), posY -= y0 - offset, [[posX, offset], [posX, posY], [posX + width, posY], [posX + width, offset]];
|
19015 | };
|
19016 | },
|
19017 | isWithinBar: function isWithinBar(that) {
|
19018 | var mouse = src_mouse(that),
|
19019 | list = getRectSegList(that),
|
19020 | _list2 = slicedToArray_default()(list, 2),
|
19021 | seg0 = _list2[0],
|
19022 | seg1 = _list2[1],
|
19023 | x = Math.min(seg0.x, seg1.x),
|
19024 | y = Math.min(seg0.y, seg1.y),
|
19025 | offset = this.config.bar_sensitivity,
|
19026 | _that$getBBox = that.getBBox(),
|
19027 | width = _that$getBBox.width,
|
19028 | height = _that$getBBox.height;
|
19029 |
|
19030 | return x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
|
19031 | }
|
19032 | });
|
19033 | // CONCATENATED MODULE: ./src/shape/bubble.js
|
19034 | /**
|
19035 | * Copyright (c) 2017 ~ present NAVER Corp.
|
19036 | * billboard.js project is licensed under the MIT license
|
19037 | */
|
19038 |
|
19039 |
|
19040 | util_extend(ChartInternal_ChartInternal.prototype, {
|
19041 | /**
|
19042 | * Initializer
|
19043 | * @private
|
19044 | */
|
19045 | initBubble: function initBubble() {
|
19046 | var $$ = this,
|
19047 | config = $$.config;
|
19048 | $$.hasType("bubble") && (config.point_show = !0, config.point_type = "circle", config.point_sensitivity = 25);
|
19049 | },
|
19050 |
|
19051 | /**
|
19052 | * Get user agent's computed value for the total length of the path in user units
|
19053 | * https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement/getTotalLength
|
19054 | * @return {Number}
|
19055 | * @private
|
19056 | */
|
19057 | getBaseLength: function getBaseLength() {
|
19058 | var $$ = this,
|
19059 | cacheKey = "$baseLength",
|
19060 | baseLength = $$.getCache(cacheKey);
|
19061 | return baseLength || $$.addCache(cacheKey, baseLength = getMinMax("min", [$$.axes.x.select("path").node().getTotalLength(), $$.axes.y.select("path").node().getTotalLength()])), baseLength;
|
19062 | },
|
19063 |
|
19064 | /**
|
19065 | * Get the radius value for bubble circle
|
19066 | * @param {Object} d
|
19067 | * @return {Number}
|
19068 | * @private
|
19069 | */
|
19070 | getBubbleR: function getBubbleR(d) {
|
19071 | var $$ = this,
|
19072 | maxR = $$.config.bubble_maxR;
|
19073 | isFunction(maxR) ? maxR = maxR(d) : !isNumber(maxR) && (maxR = $$.getBaseLength() / ($$.getMaxDataCount() * 2) + 12);
|
19074 | var max = getMinMax("max", $$.getMinMaxData().max.map(function (d) {
|
19075 | return isObject(d.value) ? d.value.mid : d.value;
|
19076 | })),
|
19077 | maxArea = maxR * maxR * Math.PI,
|
19078 | area = d.value * (maxArea / max);
|
19079 | return Math.sqrt(area / Math.PI);
|
19080 | }
|
19081 | });
|
19082 | // CONCATENATED MODULE: ./src/shape/line.js
|
19083 | /**
|
19084 | * Copyright (c) 2017 ~ present NAVER Corp.
|
19085 | * billboard.js project is licensed under the MIT license
|
19086 | */
|
19087 |
|
19088 |
|
19089 |
|
19090 |
|
19091 |
|
19092 | util_extend(ChartInternal_ChartInternal.prototype, {
|
19093 | initLine: function initLine() {
|
19094 | var $$ = this;
|
19095 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartLines);
|
19096 | },
|
19097 | updateTargetsForLine: function updateTargetsForLine(targets) {
|
19098 | var $$ = this,
|
19099 | config = $$.config,
|
19100 | classChartLine = $$.classChartLine.bind($$),
|
19101 | classLines = $$.classLines.bind($$),
|
19102 | classAreas = $$.classAreas.bind($$),
|
19103 | classCircles = $$.classCircles.bind($$),
|
19104 | classFocus = $$.classFocus.bind($$),
|
19105 | mainLineUpdate = $$.main.select(".".concat(config_classes.chartLines)).selectAll(".".concat(config_classes.chartLine)).data(targets).attr("class", function (d) {
|
19106 | return classChartLine(d) + classFocus(d);
|
19107 | }),
|
19108 | mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", "none");
|
19109 | // Lines for each data
|
19110 | // Areas
|
19111 | // Update date for selected circles
|
19112 | mainLineEnter.append("g").attr("class", classLines), mainLineEnter.append("g").attr("class", classAreas), config.point_show && (config.data_selection_enabled && mainLineEnter.append("g").attr("class", function (d) {
|
19113 | return $$.generateClass(config_classes.selectedCircles, d.id);
|
19114 | }), mainLineEnter.append("g").attr("class", classCircles).style("cursor", function (d) {
|
19115 | return config.data_selection_isselectable(d) ? "pointer" : null;
|
19116 | })), targets.forEach(function (t) {
|
19117 | $$.main.selectAll(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(t.id))).selectAll("".concat(config_classes.selectedCircle)).each(function (d) {
|
19118 | d.value = t.values[d.index].value;
|
19119 | });
|
19120 | });
|
19121 | },
|
19122 | updateLine: function updateLine(durationForExit) {
|
19123 | var $$ = this;
|
19124 | $$.mainLine = $$.main.selectAll(".".concat(config_classes.lines)).selectAll(".".concat(config_classes.line)).data($$.lineData.bind($$)), $$.mainLine.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainLine = $$.mainLine.enter().append("path").attr("class", function (d) {
|
19125 | return "".concat($$.classLine.bind($$)(d), " ").concat($$.extraLineClasses(d) || "");
|
19126 | }).style("stroke", $$.color).merge($$.mainLine).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) {
|
19127 | return $$.isStepType(d) ? "crispEdges" : "";
|
19128 | }).attr("transform", null);
|
19129 | },
|
19130 | redrawLine: function redrawLine(drawLine, withTransition) {
|
19131 | return [(withTransition ? this.mainLine.transition(getRandom()) : this.mainLine).attr("d", drawLine).style("stroke", this.color).style("opacity", "1")];
|
19132 | },
|
19133 |
|
19134 | /**
|
19135 | * Get the curve interpolate
|
19136 | * @param {Array} d Data object
|
19137 | * @return {Function}
|
19138 | * @private
|
19139 | */
|
19140 | getCurve: function getCurve(d) {
|
19141 | var $$ = this,
|
19142 | isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d);
|
19143 | // when is step & rotated, should be computed in different way
|
19144 | // https://github.com/naver/billboard.js/issues/471
|
19145 | return isRotatedStepType ? function (context) {
|
19146 | var step = $$.getInterpolate(d)(context); // keep the original method
|
19147 |
|
19148 | return step.orgPoint = step.point, step.pointRotated = function (x, y) {
|
19149 | this._point === 1 && (this._point = 2);
|
19150 | var y1 = this._y * (1 - this._t) + y * this._t;
|
19151 | this._context.lineTo(this._x, y1), this._context.lineTo(x, y1), this._x = x, this._y = y;
|
19152 | }, step.point = function (x, y) {
|
19153 | this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
|
19154 | }, step;
|
19155 | } : $$.getInterpolate(d);
|
19156 | },
|
19157 | generateDrawLine: function generateDrawLine(lineIndices, isSub) {
|
19158 | var $$ = this,
|
19159 | config = $$.config,
|
19160 | lineConnectNull = config.line_connectNull,
|
19161 | isRotated = config.axis_rotated,
|
19162 | getPoints = $$.generateGetLinePoints(lineIndices, isSub),
|
19163 | yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,
|
19164 | xValue = function (d) {
|
19165 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
19166 | },
|
19167 | yValue = function (d, i) {
|
19168 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.getBaseValue(d));
|
19169 | },
|
19170 | line = src_line();
|
19171 |
|
19172 | line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue), lineConnectNull || (line = line.defined(function (d) {
|
19173 | return $$.getBaseValue(d) !== null;
|
19174 | }));
|
19175 | var x = isSub ? $$.subX : $$.x;
|
19176 | return function (d) {
|
19177 | var path,
|
19178 | y = yScaleGetter.call($$, d.id),
|
19179 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
19180 | x0 = 0,
|
19181 | y0 = 0;
|
19182 |
|
19183 | if ($$.isLineType(d)) {
|
19184 | var regions = config.data_regions[d.id];
|
19185 | regions ? path = $$.lineWithRegions(values, x, y, regions) : ($$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = line.curve($$.getCurve(d))(values));
|
19186 | } else values[0] && (x0 = x(values[0].x), y0 = y(values[0].value)), path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
19187 |
|
19188 | return path || "M 0 0";
|
19189 | };
|
19190 | },
|
19191 | generateGetLinePoints: function generateGetLinePoints(lineIndices, isSubValue) {
|
19192 | // partial duplication of generateGetBarPoints
|
19193 | var $$ = this,
|
19194 | config = $$.config,
|
19195 | lineTargetsNum = lineIndices.__max__ + 1,
|
19196 | isSub = !!isSubValue,
|
19197 | x = $$.getShapeX(0, lineTargetsNum, lineIndices, isSub),
|
19198 | y = $$.getShapeY(isSub),
|
19199 | lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub),
|
19200 | yScale = isSub ? $$.getSubYScale : $$.getYScale;
|
19201 | return function (d, i) {
|
19202 | var y0 = yScale.call($$, d.id)(0),
|
19203 | offset = lineOffset(d, i) || y0,
|
19204 | posX = x(d),
|
19205 | posY = y(d);
|
19206 | config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0);
|
19207 | // 1 point that marks the line position
|
19208 | var point = [posX, posY - (y0 - offset)];
|
19209 | return [point, point, // from here and below, needed for compatibility
|
19210 | point, point];
|
19211 | };
|
19212 | },
|
19213 | lineWithRegions: function lineWithRegions(d, x, y, _regions) {
|
19214 | var xp,
|
19215 | yp,
|
19216 | diff,
|
19217 | diffx2,
|
19218 | $$ = this,
|
19219 | config = $$.config,
|
19220 | isRotated = config.axis_rotated,
|
19221 | isTimeSeries = $$.isTimeSeries(),
|
19222 | xOffset = $$.isCategorized() ? .5 : 0,
|
19223 | regions = [],
|
19224 | dasharray = "2 2",
|
19225 | isWithinRegions = function (withinX, withinRegions) {
|
19226 | for (var reg, i = 0; reg = withinRegions[i]; i++) if (reg.start < withinX && withinX <= reg.end) return reg.style;
|
19227 |
|
19228 | return !1;
|
19229 | };
|
19230 |
|
19231 | // Check start/end of regions
|
19232 | if (isDefined(_regions)) {
|
19233 | var getValue = function (v, def) {
|
19234 | return isUndefined(v) ? def : isTimeSeries ? $$.parseDate(v) : v;
|
19235 | };
|
19236 |
|
19237 | for (var reg, i = 0; reg = _regions[i]; i++) {
|
19238 | var start = getValue(reg.start, d[0].x),
|
19239 | end = getValue(reg.end, d[d.length - 1].x),
|
19240 | style = reg.style || {
|
19241 | dasharray: dasharray
|
19242 | };
|
19243 | regions[i] = {
|
19244 | start: start,
|
19245 | end: end,
|
19246 | style: style
|
19247 | };
|
19248 | }
|
19249 | } // Set scales
|
19250 |
|
19251 |
|
19252 | var xValue = isRotated ? function (dt) {
|
19253 | return y(dt.value);
|
19254 | } : function (dt) {
|
19255 | return x(dt.x);
|
19256 | },
|
19257 | yValue = isRotated ? function (dt) {
|
19258 | return x(dt.x);
|
19259 | } : function (dt) {
|
19260 | return y(dt.value);
|
19261 | },
|
19262 | generateM = function (points) {
|
19263 | return "M".concat(points[0][0], ",").concat(points[0][1], "L").concat(points[1][0], ",").concat(points[1][1]);
|
19264 | },
|
19265 | sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) {
|
19266 | var x0 = d0.x.getTime(),
|
19267 | xDiff = d1.x - d0.x,
|
19268 | xv0 = new Date(x0 + xDiff * k),
|
19269 | xv1 = new Date(x0 + xDiff * (k + timeseriesDiff)),
|
19270 | points = isRotated ? [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] : [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
|
19271 | return generateM(points);
|
19272 | } : function (d0, d1, k, otherDiff) {
|
19273 | var points = isRotated ? [[y(yp(k), !0), x(xp(k))], [y(yp(k + otherDiff), !0), x(xp(k + otherDiff))]] : [[x(xp(k), !0), y(yp(k))], [x(xp(k + otherDiff), !0), y(yp(k + otherDiff))]];
|
19274 | return generateM(points);
|
19275 | },
|
19276 | path = "M";
|
19277 |
|
19278 | for (var data, _i = 0; data = d[_i]; _i++) {
|
19279 | var prevData = d[_i - 1],
|
19280 | style = isWithinRegions(data.x, regions);
|
19281 | // Draw as normal
|
19282 | if (isUndefined(regions) || !style) path += "".concat(_i ? "L" : "").concat(xValue(data), ",").concat(yValue(data));else {
|
19283 | try {
|
19284 | style = style.dasharray.split(" ");
|
19285 | } catch (e) {
|
19286 | style = dasharray.split(" ");
|
19287 | } // Draw with region // TODO: Fix for horizotal charts
|
19288 |
|
19289 |
|
19290 | xp = $$.getScale(prevData.x + xOffset, data.x + xOffset, isTimeSeries), yp = $$.getScale(prevData.value, data.value);
|
19291 | var dx = x(data.x) - x(prevData.x),
|
19292 | dy = y(data.value) - y(prevData.value),
|
19293 | dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
|
19294 | diff = style[0] / dd, diffx2 = diff * style[1];
|
19295 |
|
19296 | for (var j = diff; j <= 1; j += diffx2) path += sWithRegion(prevData, data, j, diff), j + diffx2 >= 1 && (path += sWithRegion(prevData, data, 1, 0));
|
19297 | }
|
19298 | }
|
19299 |
|
19300 | return path;
|
19301 | },
|
19302 | updateAreaGradient: function updateAreaGradient() {
|
19303 | var $$ = this;
|
19304 | $$.data.targets.forEach(function (d) {
|
19305 | var id = "".concat($$.datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id));
|
19306 |
|
19307 | if ($$.isAreaType(d) && $$.defs.select("#".concat(id)).empty()) {
|
19308 | var color = $$.color(d),
|
19309 | _$$$config$area_linea = $$.config.area_linearGradient,
|
19310 | _$$$config$area_linea2 = _$$$config$area_linea.x,
|
19311 | x = _$$$config$area_linea2 === void 0 ? [0, 0] : _$$$config$area_linea2,
|
19312 | _$$$config$area_linea3 = _$$$config$area_linea.y,
|
19313 | y = _$$$config$area_linea3 === void 0 ? [0, 1] : _$$$config$area_linea3,
|
19314 | _$$$config$area_linea4 = _$$$config$area_linea.stops,
|
19315 | stops = _$$$config$area_linea4 === void 0 ? [[0, color, 1], [1, color, 0]] : _$$$config$area_linea4,
|
19316 | linearGradient = $$.defs.append("linearGradient").attr("id", "".concat(id)).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
19317 | stops.forEach(function (v) {
|
19318 | var stopColor = isFunction(v[1]) ? v[1](d.id) : v[1];
|
19319 | linearGradient.append("stop").attr("offset", v[0]).attr("stop-color", stopColor || color).attr("stop-opacity", v[2]);
|
19320 | });
|
19321 | }
|
19322 | });
|
19323 | },
|
19324 | updateAreaColor: function updateAreaColor(d) {
|
19325 | var $$ = this;
|
19326 | return $$.config.area_linearGradient ? "url(#".concat($$.datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id), ")") : $$.color(d);
|
19327 | },
|
19328 | updateArea: function updateArea(durationForExit) {
|
19329 | var $$ = this;
|
19330 | $$.config.area_linearGradient && $$.updateAreaGradient(), $$.mainArea = $$.main.selectAll(".".concat(config_classes.areas)).selectAll(".".concat(config_classes.area)).data($$.lineData.bind($$)), $$.mainArea.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainArea = $$.mainArea.enter().append("path").attr("class", $$.classArea.bind($$)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () {
|
19331 | return $$.orgAreaOpacity = src_select(this).style("opacity"), "0";
|
19332 | }).merge($$.mainArea), $$.mainArea.style("opacity", $$.orgAreaOpacity);
|
19333 | },
|
19334 | redrawArea: function redrawArea(drawArea, withTransition) {
|
19335 | var $$ = this;
|
19336 | return [(withTransition ? $$.mainArea.transition(getRandom()) : $$.mainArea).attr("d", drawArea).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function (d) {
|
19337 | return $$.isAreaRangeType(d) ? $$.orgAreaOpacity / 1.75 : $$.orgAreaOpacity;
|
19338 | })];
|
19339 | },
|
19340 |
|
19341 | /**
|
19342 | * Generate area path data
|
19343 | * @param areaIndices
|
19344 | * @param isSub
|
19345 | * @return {function(*=): (*|string)}
|
19346 | * @private
|
19347 | */
|
19348 | generateDrawArea: function generateDrawArea(areaIndices, isSub) {
|
19349 | var $$ = this,
|
19350 | config = $$.config,
|
19351 | lineConnectNull = config.line_connectNull,
|
19352 | isRotated = config.axis_rotated,
|
19353 | getPoints = $$.generateGetAreaPoints(areaIndices, isSub),
|
19354 | yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,
|
19355 | xValue = function (d) {
|
19356 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
19357 | },
|
19358 | value0 = function (d, i) {
|
19359 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.isAreaRangeType(d) ? $$.getAreaRangeData(d, "high") : 0);
|
19360 | },
|
19361 | value1 = function (d, i) {
|
19362 | return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)($$.isAreaRangeType(d) ? $$.getAreaRangeData(d, "low") : d.value);
|
19363 | };
|
19364 |
|
19365 | return function (d) {
|
19366 | var path,
|
19367 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
19368 | x0 = 0,
|
19369 | y0 = 0;
|
19370 |
|
19371 | if ($$.isAreaType(d)) {
|
19372 | var area = src_area();
|
19373 | area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1), lineConnectNull || (area = area.defined(function (d) {
|
19374 | return $$.getBaseValue(d) !== null;
|
19375 | })), $$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = area.curve($$.getCurve(d))(values);
|
19376 | } else values[0] && (x0 = $$.x(values[0].x), y0 = $$.getYScale(d.id)(values[0].value)), path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
19377 |
|
19378 | return path || "M 0 0";
|
19379 | };
|
19380 | },
|
19381 | generateGetAreaPoints: function generateGetAreaPoints(areaIndices, isSub) {
|
19382 | // partial duplication of generateGetBarPoints
|
19383 | var $$ = this,
|
19384 | config = $$.config,
|
19385 | areaTargetsNum = areaIndices.__max__ + 1,
|
19386 | x = $$.getShapeX(0, areaTargetsNum, areaIndices, !!isSub),
|
19387 | y = $$.getShapeY(!!isSub),
|
19388 | areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, !!isSub),
|
19389 | yScale = isSub ? $$.getSubYScale : $$.getYScale;
|
19390 | return function (d, i) {
|
19391 | var y0 = yScale.call($$, d.id)(0),
|
19392 | offset = areaOffset(d, i) || y0,
|
19393 | posX = x(d),
|
19394 | posY = y(d);
|
19395 | // 1 point that marks the area position
|
19396 | return config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0), [[posX, offset], [posX, posY - (y0 - offset)], [posX, posY - (y0 - offset)], // needed for compatibility
|
19397 | [posX, offset] // needed for compatibility
|
19398 | ];
|
19399 | };
|
19400 | },
|
19401 | updateCircle: function updateCircle() {
|
19402 | var $$ = this;
|
19403 | $$.config.point_show && ($$.mainCircle = $$.main.selectAll(".".concat(config_classes.circles)).selectAll(".".concat(config_classes.circle)).data(function (d) {
|
19404 | return !$$.isBarType(d) && (!$$.isLineType(d) || $$.shouldDrawPointsForLine(d)) && $$.labelishData(d);
|
19405 | }), $$.mainCircle.exit().remove(), $$.mainCircle = $$.mainCircle.enter().append($$.point("create", this, $$.classCircle.bind($$), $$.pointR.bind($$), $$.color)).merge($$.mainCircle).style("stroke", $$.color).style("opacity", $$.initialOpacityForCircle.bind($$)));
|
19406 | },
|
19407 | redrawCircle: function redrawCircle(cx, cy, withTransition, flow) {
|
19408 | var $$ = this,
|
19409 | selectedCircles = $$.main.selectAll(".".concat(config_classes.selectedCircle));
|
19410 | if (!$$.config.point_show) return [];
|
19411 | var mainCircles = [];
|
19412 | $$.mainCircle.each(function (d) {
|
19413 | var fn = $$.point("update", $$, cx, cy, $$.opacityForCircle.bind($$), $$.color, withTransition, flow, selectedCircles).bind(this),
|
19414 | result = fn(d);
|
19415 | mainCircles.push(result);
|
19416 | });
|
19417 | var posAttr = $$.isCirclePoint() ? "c" : "";
|
19418 | return [mainCircles, selectedCircles.attr("".concat(posAttr, "x"), cx).attr("".concat(posAttr, "y"), cy)];
|
19419 | },
|
19420 | circleX: function circleX(d) {
|
19421 | var $$ = this,
|
19422 | hasValue = isValue(d.x);
|
19423 | return $$.config.zoom_enabled && $$.zoomScale ? hasValue ? $$.zoomScale(d.x) : null : hasValue ? $$.x(d.x) : null;
|
19424 | },
|
19425 | updateCircleY: function updateCircleY() {
|
19426 | var $$ = this;
|
19427 |
|
19428 | $$.circleY = function (d, i) {
|
19429 | var id = d.id;
|
19430 | return $$.isGrouped(id) ? $$.generateGetLinePoints($$.getShapeIndices($$.isLineType))(d, i)[0][1] : $$.getYScale(id)($$.getBaseValue(d));
|
19431 | };
|
19432 | },
|
19433 | getCircles: function getCircles(i, id) {
|
19434 | var $$ = this,
|
19435 | suffix = isValue(i) ? "-".concat(i) : "";
|
19436 | return (id ? $$.main.selectAll(".".concat(config_classes.circles).concat($$.getTargetSelectorSuffix(id))) : $$.main).selectAll(".".concat(config_classes.circle).concat(suffix));
|
19437 | },
|
19438 | expandCircles: function expandCircles(i, id, reset) {
|
19439 | var $$ = this,
|
19440 | r = $$.pointExpandedR.bind($$);
|
19441 | reset && $$.unexpandCircles();
|
19442 | var circles = $$.getCircles(i, id).classed(config_classes.EXPANDED, !0),
|
19443 | scale = r(circles) / $$.config.point_r,
|
19444 | ratio = 1 - scale;
|
19445 | $$.isCirclePoint() ? circles.attr("r", r) : circles.each(function () {
|
19446 | var point = src_select(this);
|
19447 | if (this.tagName === "circle") point.attr("r", r);else {
|
19448 | var _this$getBBox = this.getBBox(),
|
19449 | width = _this$getBBox.width,
|
19450 | height = _this$getBBox.height,
|
19451 | x = ratio * (+point.attr("x") + width / 2),
|
19452 | y = ratio * (+point.attr("y") + height / 2);
|
19453 |
|
19454 | point.attr("transform", "translate(".concat(x, " ").concat(y, ") scale(").concat(scale, ")"));
|
19455 | }
|
19456 | });
|
19457 | },
|
19458 | unexpandCircles: function unexpandCircles(i) {
|
19459 | var $$ = this,
|
19460 | r = $$.pointR.bind($$),
|
19461 | circles = $$.getCircles(i).filter(function () {
|
19462 | return src_select(this).classed(config_classes.EXPANDED);
|
19463 | }).classed(config_classes.EXPANDED, !1);
|
19464 | circles.attr("r", r), $$.isCirclePoint() || circles.attr("transform", "scale(".concat(r(circles) / $$.config.point_r, ")"));
|
19465 | },
|
19466 | pointR: function (d) {
|
19467 | var $$ = this,
|
19468 | config = $$.config,
|
19469 | pointR = config.point_r,
|
19470 | r = pointR;
|
19471 | return $$.isStepType(d) ? r = 0 : $$.isBubbleType(d) ? r = $$.getBubbleR(d) : isFunction(pointR) && (r = pointR(d)), r;
|
19472 | },
|
19473 | pointExpandedR: function pointExpandedR(d) {
|
19474 | var $$ = this,
|
19475 | config = $$.config,
|
19476 | scale = $$.isBubbleType(d) ? 1.15 : 1.75;
|
19477 | return config.point_focus_expand_enabled ? config.point_focus_expand_r || $$.pointR(d) * scale : $$.pointR(d);
|
19478 | },
|
19479 | pointSelectR: function pointSelectR(d) {
|
19480 | var $$ = this,
|
19481 | selectR = $$.config.point_select_r;
|
19482 | return isFunction(selectR) ? selectR(d) : selectR || $$.pointR(d) * 4;
|
19483 | },
|
19484 | isWithinCircle: function isWithinCircle(node, r) {
|
19485 | var mouse = src_mouse(node),
|
19486 | element = src_select(node),
|
19487 | prefix = this.isCirclePoint() ? "c" : "",
|
19488 | cx = +element.attr("".concat(prefix, "x")),
|
19489 | cy = +element.attr("".concat(prefix, "y"));
|
19490 |
|
19491 | // if node don't have cx/y or x/y attribute value
|
19492 | if (!(cx || cy) && node.nodeType === 1) {
|
19493 | var _ref = node.getBBox ? node.getBBox() : node.getBoundingClientRect(),
|
19494 | x = _ref.x,
|
19495 | y = _ref.y;
|
19496 |
|
19497 | cx = x, cy = y;
|
19498 | }
|
19499 |
|
19500 | var is = Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
|
19501 | return is;
|
19502 | },
|
19503 | isWithinStep: function isWithinStep(that, y) {
|
19504 | return Math.abs(y - src_mouse(that)[1]) < 30;
|
19505 | },
|
19506 | shouldDrawPointsForLine: function shouldDrawPointsForLine(d) {
|
19507 | var linePoint = this.config.line_point;
|
19508 | return linePoint === !0 || isArray(linePoint) && linePoint.indexOf(d.id) !== -1;
|
19509 | }
|
19510 | });
|
19511 | // CONCATENATED MODULE: ./src/shape/point.js
|
19512 | /**
|
19513 | * Copyright (c) 2017 ~ present NAVER Corp.
|
19514 | * billboard.js project is licensed under the MIT license
|
19515 | */
|
19516 |
|
19517 |
|
19518 |
|
19519 |
|
19520 | util_extend(ChartInternal_ChartInternal.prototype, {
|
19521 | hasValidPointType: function hasValidPointType(type) {
|
19522 | return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type);
|
19523 | },
|
19524 | hasValidPointDrawMethods: function hasValidPointDrawMethods(type) {
|
19525 | var pointType = type || this.config.point_type;
|
19526 | return isObjectType(pointType) && isFunction(pointType.create) && isFunction(pointType.update);
|
19527 | },
|
19528 | insertPointInfoDefs: function insertPointInfoDefs(point, id) {
|
19529 | var $$ = this,
|
19530 | copyAttr = function (from, target) {
|
19531 | for (var name, attribs = from.attributes, i = 0; name = attribs[i]; i++) name = name.name, target.setAttribute(name, from.getAttribute(name));
|
19532 | },
|
19533 | doc = new DOMParser().parseFromString(point, "image/svg+xml"),
|
19534 | node = doc.documentElement,
|
19535 | clone = browser["document"].createElementNS(namespaces.svg, node.nodeName.toLowerCase());
|
19536 |
|
19537 | if (clone.id = id, clone.style.fill = "inherit", clone.style.stroke = "inherit", copyAttr(node, clone), node.childNodes && node.childNodes.length) {
|
19538 | var parent = src_select(clone);
|
19539 | "innerHTML" in clone ? parent.html(node.innerHTML) : toArray(node.childNodes).forEach(function (v) {
|
19540 | copyAttr(v, parent.append(v.tagName).node());
|
19541 | });
|
19542 | }
|
19543 |
|
19544 | $$.defs.node().appendChild(clone);
|
19545 | },
|
19546 | pointFromDefs: function pointFromDefs(id) {
|
19547 | return this.defs.select("#".concat(id));
|
19548 | },
|
19549 | generatePoint: function generatePoint() {
|
19550 | var $$ = this,
|
19551 | config = $$.config,
|
19552 | ids = [],
|
19553 | pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
19554 | return function (method, context) {
|
19555 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
19556 |
|
19557 | return function (d) {
|
19558 | var point,
|
19559 | id = d.id || d.data && d.data.id || d,
|
19560 | element = src_select(this);
|
19561 | if (ids.indexOf(id) < 0 && ids.push(id), point = pattern[ids.indexOf(id) % pattern.length], $$.hasValidPointType(point)) point = $$[point];else if (!$$.hasValidPointDrawMethods(point)) {
|
19562 | var pointId = "".concat($$.datetimeId, "-point-").concat(id),
|
19563 | pointFromDefs = $$.pointFromDefs(pointId);
|
19564 | if (pointFromDefs.size() < 1 && $$.insertPointInfoDefs(point, pointId), method === "create") return $$.custom.create.bind(context).apply(void 0, [element, pointId].concat(args));
|
19565 | if (method === "update") return $$.custom.update.bind(context).apply(void 0, [element].concat(args));
|
19566 | }
|
19567 | return point[method].bind(context).apply(void 0, [element].concat(args));
|
19568 | };
|
19569 | };
|
19570 | },
|
19571 | getTransitionName: function getTransitionName() {
|
19572 | return getRandom();
|
19573 | },
|
19574 | custom: {
|
19575 | create: function create(element, id, cssClassFn, sizeFn, fillStyleFn) {
|
19576 | return element.append("use").attr("xlink:href", "#".concat(id)).attr("class", cssClassFn).style("fill", fillStyleFn).node();
|
19577 | },
|
19578 | update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
19579 | var $$ = this,
|
19580 | _element$node$getBBox = element.node().getBBox(),
|
19581 | width = _element$node$getBBox.width,
|
19582 | height = _element$node$getBBox.height,
|
19583 | xPosFn2 = function (d) {
|
19584 | return xPosFn(d) - width / 2;
|
19585 | },
|
19586 | yPosFn2 = function (d) {
|
19587 | return yPosFn(d) - height / 2;
|
19588 | },
|
19589 | mainCircles = element;
|
19590 |
|
19591 | if (withTransition) {
|
19592 | var transitionName = $$.getTransitionName();
|
19593 | flow && (mainCircles = element.attr("x", xPosFn2)), mainCircles = element.transition(transitionName).attr("x", xPosFn2).attr("y", yPosFn2).transition(transitionName), selectedCircles.transition($$.getTransitionName());
|
19594 | } else mainCircles = element.attr("x", xPosFn2).attr("y", yPosFn2);
|
19595 |
|
19596 | return mainCircles.style("opacity", opacityStyleFn).style("fill", fillStyleFn);
|
19597 | }
|
19598 | },
|
19599 | // 'circle' data point
|
19600 | circle: {
|
19601 | create: function create(element, cssClassFn, sizeFn, fillStyleFn) {
|
19602 | return element.append("circle").attr("class", cssClassFn).attr("r", sizeFn).style("fill", fillStyleFn).node();
|
19603 | },
|
19604 | update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
19605 | var $$ = this,
|
19606 | mainCircles = element;
|
19607 |
|
19608 | if ($$.hasType("bubble") && (mainCircles = mainCircles.attr("r", $$.pointR.bind($$))), withTransition) {
|
19609 | var transitionName = $$.getTransitionName();
|
19610 | flow && (mainCircles = mainCircles.attr("cx", xPosFn)), mainCircles = element.attr("cx") ? mainCircles.transition(transitionName).attr("cx", xPosFn).attr("cy", yPosFn).transition(transitionName) : mainCircles.attr("cx", xPosFn).attr("cy", yPosFn), selectedCircles.transition($$.getTransitionName());
|
19611 | } else mainCircles = mainCircles.attr("cx", xPosFn).attr("cy", yPosFn);
|
19612 |
|
19613 | return mainCircles.style("opacity", opacityStyleFn).style("fill", fillStyleFn);
|
19614 | }
|
19615 | },
|
19616 | // 'rectangle' data point
|
19617 | rectangle: {
|
19618 | create: function create(element, cssClassFn, sizeFn, fillStyleFn) {
|
19619 | var rectSizeFn = function (d) {
|
19620 | return sizeFn(d) * 2;
|
19621 | };
|
19622 |
|
19623 | return element.append("rect").attr("class", cssClassFn).attr("width", rectSizeFn).attr("height", rectSizeFn).style("fill", fillStyleFn).node();
|
19624 | },
|
19625 | update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
19626 | var $$ = this,
|
19627 | r = $$.config.point_r,
|
19628 | rectXPosFn = function (d) {
|
19629 | return xPosFn(d) - r;
|
19630 | },
|
19631 | rectYPosFn = function (d) {
|
19632 | return yPosFn(d) - r;
|
19633 | },
|
19634 | mainCircles = element;
|
19635 |
|
19636 | if (withTransition) {
|
19637 | var transitionName = $$.getTransitionName();
|
19638 | flow && (mainCircles = mainCircles.attr("x", rectXPosFn)), mainCircles = mainCircles.transition(transitionName).attr("x", rectXPosFn).attr("y", rectYPosFn).transition(transitionName), selectedCircles.transition($$.getTransitionName());
|
19639 | } else mainCircles = mainCircles.attr("x", rectXPosFn).attr("y", rectYPosFn);
|
19640 |
|
19641 | return mainCircles.style("opacity", opacityStyleFn).style("fill", fillStyleFn);
|
19642 | }
|
19643 | }
|
19644 | });
|
19645 | // CONCATENATED MODULE: ./src/shape/radar.js
|
19646 |
|
19647 |
|
19648 | /**
|
19649 | * Copyright (c) 2017 ~ present NAVER Corp.
|
19650 | * billboard.js project is licensed under the MIT license
|
19651 | */
|
19652 |
|
19653 |
|
19654 |
|
19655 |
|
19656 | /**
|
19657 | * Get the position value
|
19658 | * @param {Boolean} isClockwise If the direction is clockwise
|
19659 | * @param {String} type Coordinate type 'x' or 'y'
|
19660 | * @param {Number} edge Number of edge
|
19661 | * @param {Number} pos The indexed position
|
19662 | * @param {Number} range
|
19663 | * @param {Number} ratio
|
19664 | * @return {number}
|
19665 | * @private
|
19666 | */
|
19667 |
|
19668 | function getPosition(isClockwise, type, edge, pos, range, ratio) {
|
19669 | var index = isClockwise && pos > 0 ? edge - pos : pos,
|
19670 | r = 2 * Math.PI,
|
19671 | func = type === "x" ? Math.sin : Math.cos;
|
19672 | return range * (1 - ratio * func(index * r / edge));
|
19673 | } // cache key
|
19674 |
|
19675 |
|
19676 | var radar_cacheKey = "$radarPoints";
|
19677 | util_extend(ChartInternal_ChartInternal.prototype, {
|
19678 | initRadar: function initRadar() {
|
19679 | var $$ = this,
|
19680 | config = $$.config;
|
19681 | $$.hasType("radar") && ($$.radars = $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartRadars), $$.radars.levels = $$.radars.append("g").attr("class", config_classes.levels), $$.radars.axes = $$.radars.append("g").attr("class", config_classes.axis), $$.radars.shapes = $$.radars.append("g").attr("class", config_classes.shapes), $$.maxValue = config.radar_axis_max || $$.getMinMaxData().max[0].value);
|
19682 | },
|
19683 | getRadarSize: function getRadarSize() {
|
19684 | var $$ = this,
|
19685 | config = $$.config,
|
19686 | padding = config.axis_x_categories.length < 4 ? -20 : 10,
|
19687 | size = (Math.min($$.arcWidth, $$.arcHeight) - padding) / 2;
|
19688 | return [size, size];
|
19689 | },
|
19690 | updateTargetsForRadar: function updateTargetsForRadar(targets) {
|
19691 | var $$ = this,
|
19692 | config = $$.config;
|
19693 | isEmpty(config.axis_x_categories) && (config.axis_x_categories = getRange(0, getMinMax("max", targets.map(function (v) {
|
19694 | return v.values.length;
|
19695 | })))), $$.generateRadarPoints();
|
19696 | },
|
19697 | getRadarPosition: function getRadarPosition(type, index, range, ratio) {
|
19698 | var $$ = this,
|
19699 | config = $$.config,
|
19700 | _$$$getRadarSize = $$.getRadarSize(),
|
19701 | _$$$getRadarSize2 = slicedToArray_default()(_$$$getRadarSize, 2),
|
19702 | width = _$$$getRadarSize2[0],
|
19703 | height = _$$$getRadarSize2[1],
|
19704 | edge = config.axis_x_categories.length,
|
19705 | isClockwise = config.radar_direction_clockwise,
|
19706 | pos = toArray(type).map(function (v) {
|
19707 | return getPosition(isClockwise, v, edge, index, isDefined(range) ? range : type === "x" ? width : height, isNumber(ratio) ? ratio : config.radar_size_ratio);
|
19708 | });
|
19709 |
|
19710 | return pos.length === 1 ? pos[0] : pos;
|
19711 | },
|
19712 |
|
19713 | /**
|
19714 | * Generate data points
|
19715 | * @private
|
19716 | */
|
19717 | generateRadarPoints: function generateRadarPoints() {
|
19718 | var $$ = this,
|
19719 | targets = $$.data.targets,
|
19720 | _$$$getRadarSize3 = $$.getRadarSize(),
|
19721 | _$$$getRadarSize4 = slicedToArray_default()(_$$$getRadarSize3, 2),
|
19722 | width = _$$$getRadarSize4[0],
|
19723 | height = _$$$getRadarSize4[1],
|
19724 | points = $$.getCache(radar_cacheKey) || {},
|
19725 | size = points._size;
|
19726 |
|
19727 | size && (size.width === width || size.height === height) || (targets.forEach(function (d) {
|
19728 | points[d.id] = d.values.map(function (v, i) {
|
19729 | return $$.getRadarPosition(["x", "y"], i, undefined, $$.getRatio("radar", v));
|
19730 | });
|
19731 | }), points._size = {
|
19732 | width: width,
|
19733 | height: height
|
19734 | }, $$.addCache(radar_cacheKey, points));
|
19735 | },
|
19736 | redrawRadar: function redrawRadar(duration, durationForExit) {
|
19737 | var $$ = this,
|
19738 | translate = $$.getTranslate("radar");
|
19739 | translate && ($$.radars.attr("transform", translate), $$.main.selectAll(".".concat(config_classes.circles)).attr("transform", translate), $$.main.select(".".concat(config_classes.chartTexts)).attr("transform", translate), $$.generateRadarPoints(), $$.updateRadarLevel(), $$.updateRadarAxes(), $$.updateRadarShape(duration, durationForExit));
|
19740 | },
|
19741 | generateGetRadarPoints: function generateGetRadarPoints() {
|
19742 | var $$ = this,
|
19743 | points = $$.getCache(radar_cacheKey);
|
19744 | return function (d, i) {
|
19745 | var point = points[d.id][i];
|
19746 | return [point, point, point, point];
|
19747 | };
|
19748 | },
|
19749 | updateRadarLevel: function updateRadarLevel() {
|
19750 | var $$ = this,
|
19751 | config = $$.config,
|
19752 | _$$$getRadarSize5 = $$.getRadarSize(),
|
19753 | _$$$getRadarSize6 = slicedToArray_default()(_$$$getRadarSize5, 2),
|
19754 | width = _$$$getRadarSize6[0],
|
19755 | height = _$$$getRadarSize6[1],
|
19756 | depth = config.radar_level_depth,
|
19757 | edge = config.axis_x_categories.length,
|
19758 | showText = config.radar_level_text_show,
|
19759 | radarLevels = $$.radars.levels,
|
19760 | levelData = getRange(0, depth),
|
19761 | radius = config.radar_size_ratio * Math.min(width, height),
|
19762 | levelRatio = levelData.map(function (l) {
|
19763 | return radius * ((l + 1) / depth);
|
19764 | }),
|
19765 | levelTextFormat = config.radar_level_text_format,
|
19766 | points = levelData.map(function (v) {
|
19767 | var range = levelRatio[v],
|
19768 | pos = getRange(0, edge).map(function (i) {
|
19769 | return $$.getRadarPosition(["x", "y"], i, range, 1).join(",");
|
19770 | });
|
19771 | return pos.join(" ");
|
19772 | }),
|
19773 | level = radarLevels.selectAll(".".concat(config_classes.level)).data(levelData);
|
19774 |
|
19775 | level.exit().remove();
|
19776 | var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
19777 | return "".concat(config_classes.level, " ").concat(config_classes.level, "-").concat(i);
|
19778 | });
|
19779 | levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden"), showText && (radarLevels.select("text").empty() && radarLevels.append("text").attr("dx", "-.5em").attr("dy", "-.7em").style("text-anchor", "end").text(function () {
|
19780 | return levelTextFormat(0);
|
19781 | }), levelEnter.append("text").attr("dx", "-.5em").style("text-anchor", "end").text(function (d) {
|
19782 | return levelTextFormat($$.maxValue / levelData.length * (d + 1));
|
19783 | })), levelEnter.merge(level).attr("transform", function (d) {
|
19784 | return "translate(".concat(width - levelRatio[d], ", ").concat(height - levelRatio[d], ")");
|
19785 | }).selectAll("polygon").attr("points", function (d) {
|
19786 | return points[d];
|
19787 | }), showText && radarLevels.selectAll("text").attr("x", function (d) {
|
19788 | return isUndefined(d) ? width : points[d].split(",")[0];
|
19789 | }).attr("y", function (d) {
|
19790 | return isUndefined(d) ? height : 0;
|
19791 | });
|
19792 | },
|
19793 | updateRadarAxes: function updateRadarAxes() {
|
19794 | var $$ = this,
|
19795 | config = $$.config,
|
19796 | _$$$getRadarSize7 = $$.getRadarSize(),
|
19797 | _$$$getRadarSize8 = slicedToArray_default()(_$$$getRadarSize7, 2),
|
19798 | width = _$$$getRadarSize8[0],
|
19799 | height = _$$$getRadarSize8[1],
|
19800 | categories = config.axis_x_categories,
|
19801 | axis = $$.radars.axes.selectAll("g").data(categories);
|
19802 |
|
19803 | axis.exit().remove();
|
19804 | var axisEnter = axis.enter().append("g").attr("class", function (d, i) {
|
19805 | return "".concat(config_classes.axis, "-").concat(i);
|
19806 | });
|
19807 | config.radar_axis_line_show && axisEnter.append("line"), config.radar_axis_text_show && axisEnter.append("text"), axis = axisEnter.merge(axis), config.radar_axis_line_show && axis.select("line").attr("x1", width).attr("y1", height).attr("x2", function (d, i) {
|
19808 | return $$.getRadarPosition("x", i);
|
19809 | }).attr("y2", function (d, i) {
|
19810 | return $$.getRadarPosition("y", i);
|
19811 | }), config.radar_axis_text_show && axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
|
19812 | selection.each(function (d) {
|
19813 | setTextValue(src_select(this), d, [-1.2, 1.2]);
|
19814 | });
|
19815 | }).datum(function (d, i) {
|
19816 | return {
|
19817 | index: i
|
19818 | };
|
19819 | }).attr("transform", function (d, i) {
|
19820 | return "translate(".concat($$.getRadarPosition("x", i, undefined, 1), " ").concat($$.getRadarPosition("y", i, undefined, 1), ")");
|
19821 | }), $$.bindEvent();
|
19822 | },
|
19823 | bindEvent: function bindEvent() {
|
19824 | var _this = this,
|
19825 | $$ = this,
|
19826 | config = $$.config;
|
19827 |
|
19828 | if (config.interaction_enabled) {
|
19829 | var isMouse = $$.inputType === "mouse",
|
19830 | getIndex = function () {
|
19831 | var target = on_event.target; // in case of multilined axis text
|
19832 |
|
19833 | /tspan/i.test(target.tagName) && (target = target.parentNode);
|
19834 | var d = src_select(target).datum();
|
19835 | return d && Object.keys(d).length === 1 ? d.index : undefined;
|
19836 | },
|
19837 | hide = function () {
|
19838 | var index = getIndex(),
|
19839 | noIndex = isUndefined(index);
|
19840 | (isMouse || noIndex) && (_this.hideTooltip(), _this.unexpandCircles(), isMouse ? $$.setOverOut(!1, index) : noIndex && $$.callOverOutForTouch());
|
19841 | };
|
19842 |
|
19843 | $$.radars.select(".".concat(config_classes.axis)).on(isMouse ? "mouseover " : "touchstart", function () {
|
19844 | if (!$$.transiting) // skip while transiting
|
19845 | {
|
19846 | var index = getIndex();
|
19847 | $$.selectRectForSingle($$.svg.node(), null, index), isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
|
19848 | }
|
19849 | }).on("mouseout", isMouse ? hide : null), isMouse || $$.svg.on("touchstart", hide);
|
19850 | }
|
19851 | },
|
19852 | updateRadarShape: function updateRadarShape(duration, durationForExit) {
|
19853 | var $$ = this,
|
19854 | targets = $$.data.targets,
|
19855 | points = $$.getCache(radar_cacheKey),
|
19856 | areas = $$.radars.shapes.selectAll("polygon").data(targets),
|
19857 | areasEnter = areas.enter().append("g").attr("class", $$.classChartRadar.bind($$));
|
19858 | areas.exit().transition().duration(durationForExit).remove(), areasEnter.append("polygon").merge(areas).transition().duration(duration).style("fill", function (d) {
|
19859 | return $$.color(d);
|
19860 | }).style("stroke", function (d) {
|
19861 | return $$.color(d);
|
19862 | }).attr("points", function (d) {
|
19863 | return points[d.id].join(" ");
|
19864 | });
|
19865 | },
|
19866 |
|
19867 | /**
|
19868 | * Get data point x coordinate
|
19869 | * @param {Object} d Data object
|
19870 | * @return {Number}
|
19871 | * @private
|
19872 | */
|
19873 | radarCircleX: function radarCircleX(d) {
|
19874 | return this.getCache(radar_cacheKey)[d.id][d.index][0];
|
19875 | },
|
19876 |
|
19877 | /**
|
19878 | * Get data point y coordinate
|
19879 | * @param {Object} d Data object
|
19880 | * @return {Number}
|
19881 | * @private
|
19882 | */
|
19883 | radarCircleY: function radarCircleY(d) {
|
19884 | return this.getCache(radar_cacheKey)[d.id][d.index][1];
|
19885 | }
|
19886 | });
|
19887 | // CONCATENATED MODULE: ./src/internals/text.js
|
19888 | /**
|
19889 | * Copyright (c) 2017 ~ present NAVER Corp.
|
19890 | * billboard.js project is licensed under the MIT license
|
19891 | */
|
19892 |
|
19893 |
|
19894 |
|
19895 |
|
19896 | util_extend(ChartInternal_ChartInternal.prototype, {
|
19897 | /**
|
19898 | * Initializes the text
|
19899 | * @private
|
19900 | */
|
19901 | initText: function initText() {
|
19902 | var $$ = this;
|
19903 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartTexts), $$.mainText = src_selectAll([]);
|
19904 | },
|
19905 |
|
19906 | /**
|
19907 | * Update chartText
|
19908 | * @private
|
19909 | * @param {Object} $$.data.targets
|
19910 | */
|
19911 | updateTargetsForText: function updateTargetsForText(targets) {
|
19912 | var $$ = this,
|
19913 | classChartText = $$.classChartText.bind($$),
|
19914 | classTexts = $$.classTexts.bind($$),
|
19915 | classFocus = $$.classFocus.bind($$),
|
19916 | mainTextUpdate = $$.main.select(".".concat(config_classes.chartTexts)).selectAll(".".concat(config_classes.chartText)).data(targets).attr("class", function (d) {
|
19917 | return classChartText(d) + classFocus(d);
|
19918 | }),
|
19919 | mainTextEnter = mainTextUpdate.enter().append("g").attr("class", classChartText).style("opacity", "0").style("pointer-events", "none");
|
19920 | mainTextEnter.append("g").attr("class", classTexts);
|
19921 | },
|
19922 |
|
19923 | /**
|
19924 | * Update text
|
19925 | * @private
|
19926 | * @param {Number} Fade-out transition duration
|
19927 | */
|
19928 | updateText: function updateText(durationForExit) {
|
19929 | var _this = this,
|
19930 | $$ = this,
|
19931 | config = $$.config,
|
19932 | dataFn = $$.labelishData.bind($$),
|
19933 | classText = $$.classText.bind($$);
|
19934 |
|
19935 | $$.mainText = $$.main.selectAll(".".concat(config_classes.texts)).selectAll(".".concat(config_classes.text)).data(function (d) {
|
19936 | return _this.isRadarType(d) ? d.values : dataFn(d);
|
19937 | }), $$.mainText.exit().transition().duration(durationForExit).style("fill-opacity", "0").remove(), $$.mainText = $$.mainText.enter().append("text").merge($$.mainText).attr("class", classText).attr("text-anchor", function (d) {
|
19938 | return config.axis_rotated ? d.value < 0 ? "end" : "start" : "middle";
|
19939 | }).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", "0").text(function (d, i, j) {
|
19940 | return $$.dataLabelFormat(d.id)(d.value, d.id, i, j);
|
19941 | });
|
19942 | },
|
19943 | updateTextColor: function updateTextColor(d) {
|
19944 | var color,
|
19945 | $$ = this,
|
19946 | labelColors = $$.config.data_labels_colors;
|
19947 | return isString(labelColors) ? color = labelColors : isObject(labelColors) && (color = labelColors[d.id]), color || $$.color(d);
|
19948 | },
|
19949 |
|
19950 | /**
|
19951 | * Redraw chartText
|
19952 | * @param {Function} x Positioning function for x
|
19953 | * @param {Function} y Positioning function for y
|
19954 | * @param {Boolean} forFlow
|
19955 | * @param {Boolean} withTransition transition is enabled
|
19956 | * @private
|
19957 | */
|
19958 | redrawText: function redrawText(x, y, forFlow, withTransition) {
|
19959 | var $$ = this,
|
19960 | t = getRandom(),
|
19961 | opacityForText = forFlow ? 0 : $$.opacityForText.bind($$);
|
19962 | return [this.mainText.each(function () {
|
19963 | var text = src_select(this); // do not apply transition for newly added text elements
|
19964 |
|
19965 | (withTransition && text.attr("x") ? text.transition(t) : text).attr("x", x).attr("y", y).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", opacityForText);
|
19966 | })];
|
19967 | },
|
19968 |
|
19969 | /**
|
19970 | * Gets the getBoundingClientRect value of the element
|
19971 | * @private
|
19972 | * @param {HTMLElement|d3.selection} element
|
19973 | * @param {String} className
|
19974 | * @returns {Object} value of element.getBoundingClientRect()
|
19975 | */
|
19976 | getTextRect: function getTextRect(element, className) {
|
19977 | var $$ = this,
|
19978 | base = element.node ? element.node() : element;
|
19979 | /text/i.test(base.tagName) || (base = base.querySelector("text"));
|
19980 | var text = base.textContent,
|
19981 | cacheKey = "$".concat(text.replace(/\W/g, "_")),
|
19982 | rect = $$.getCache(cacheKey);
|
19983 | return rect || ($$.svg.append("text").style("visibility", "hidden").style("font", src_select(base).style("font")).classed(className, !0).text(text).call(function (v) {
|
19984 | rect = v.node().getBoundingClientRect();
|
19985 | }).remove(), $$.addCache(cacheKey, rect)), rect;
|
19986 | },
|
19987 |
|
19988 | /**
|
19989 | * Gets the x or y coordinate of the text
|
19990 | * @param {Object} indices Indices values
|
19991 | * @param {Boolean} forX whether or not to x
|
19992 | * @returns {Number} coordinates
|
19993 | * @private
|
19994 | */
|
19995 | generateXYForText: function generateXYForText(indices, forX) {
|
19996 | var $$ = this,
|
19997 | types = Object.keys(indices),
|
19998 | points = {},
|
19999 | getter = forX ? $$.getXForText : $$.getYForText;
|
20000 | return $$.hasType("radar") && types.push("radar"), types.forEach(function (v) {
|
20001 | points[v] = $$["generateGet".concat(capitalize(v), "Points")](indices[v], !1);
|
20002 | }), function (d, i) {
|
20003 | var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isRadarType(d) && "radar" || "line";
|
20004 | return getter.call($$, points[type](d, i), d, this);
|
20005 | };
|
20006 | },
|
20007 |
|
20008 | /**
|
20009 | * Get centerized text position for bar type data.label.text
|
20010 | * @private
|
20011 | * @param {Object} d Data object
|
20012 | * @param {Array} points Data points position
|
20013 | * @param {HTMLElement} textElement Data label text element
|
20014 | * @returns {Number} Position value
|
20015 | */
|
20016 | getCenteredTextPos: function getCenteredTextPos(d, points, textElement) {
|
20017 | var $$ = this,
|
20018 | config = $$.config,
|
20019 | isRotated = config.axis_rotated;
|
20020 |
|
20021 | if (config.data_labels.centered && $$.isBarType(d)) {
|
20022 | var rect = textElement.getBoundingClientRect(),
|
20023 | isPositive = d.value >= 0;
|
20024 |
|
20025 | if (isRotated) {
|
20026 | var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
20027 | return isPositive ? -w - 3 : w + 2;
|
20028 | }
|
20029 |
|
20030 | var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
20031 | return isPositive ? h : -h - 2;
|
20032 | }
|
20033 |
|
20034 | return 0;
|
20035 | },
|
20036 |
|
20037 | /**
|
20038 | * Gets the x coordinate of the text
|
20039 | * @private
|
20040 | * @param {Object} points
|
20041 | * @param {Object} data
|
20042 | * @param {HTMLElement} element
|
20043 | * @returns {Number} x coordinate
|
20044 | */
|
20045 | getXForText: function getXForText(points, d, textElement) {
|
20046 | var xPos,
|
20047 | padding,
|
20048 | $$ = this,
|
20049 | config = $$.config,
|
20050 | isRotated = config.axis_rotated;
|
20051 | return isRotated ? (padding = $$.isBarType(d) ? 4 : 6, xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1)) : xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : points[0][0], d.value === null && (xPos > $$.width ? xPos = $$.width - textElement.getBoundingClientRect().width : xPos < 0 && (xPos = 4)), isRotated && (xPos += $$.getCenteredTextPos(d, points, textElement)), xPos + (config.data_labels_position.x || 0);
|
20052 | },
|
20053 |
|
20054 | /**
|
20055 | * Gets the y coordinate of the text
|
20056 | * @private
|
20057 | * @param {Object} points
|
20058 | * @param {Object} data
|
20059 | * @param {HTMLElement} element
|
20060 | * @returns {Number} y coordinate
|
20061 | */
|
20062 | getYForText: function getYForText(points, d, textElement) {
|
20063 | var yPos,
|
20064 | $$ = this,
|
20065 | config = $$.config,
|
20066 | isRotated = config.axis_rotated,
|
20067 | r = config.point_r,
|
20068 | rect = textElement.getBoundingClientRect(),
|
20069 | baseY = 3;
|
20070 | if (isRotated) yPos = (points[0][0] + points[2][0] + rect.height * .6) / 2;else if (yPos = points[2][1], isNumber(r) && r > 5 && ($$.isLineType(d) || $$.isScatterType(d)) && (baseY += config.point_r / 2.3), d.value < 0 || d.value === 0 && !$$.hasPositiveValue) yPos += rect.height, $$.isBarType(d) ? yPos -= baseY : !$$.isBarType(d) && (yPos += baseY);else {
|
20071 | var diff = -baseY * 2;
|
20072 | $$.isBarType(d) ? diff = -baseY : $$.isBubbleType(d) && (diff = baseY), yPos += diff;
|
20073 | } // show labels regardless of the domain if value is null
|
20074 |
|
20075 | if (d.value === null && !isRotated) {
|
20076 | var boxHeight = rect.height;
|
20077 | yPos < boxHeight ? yPos = boxHeight : yPos > this.height && (yPos = this.height - 4);
|
20078 | }
|
20079 |
|
20080 | return isRotated || (yPos += $$.getCenteredTextPos(d, points, textElement)), yPos + (config.data_labels_position.y || 0);
|
20081 | }
|
20082 | });
|
20083 | // CONCATENATED MODULE: ./src/internals/type.js
|
20084 | /**
|
20085 | * Copyright (c) 2017 ~ present NAVER Corp.
|
20086 | * billboard.js project is licensed under the MIT license
|
20087 | */
|
20088 |
|
20089 | // defined chart types as category
|
20090 |
|
20091 | var TYPES = {
|
20092 | Area: ["area", "area-spline", "area-spline-range", "area-line-range", "area-step"],
|
20093 | AreaRange: ["area-spline-range", "area-line-range"],
|
20094 | Arc: ["pie", "donut", "gauge", "radar"],
|
20095 | Line: ["line", "spline", "area", "area-spline", "area-spline-range", "area-line-range", "step", "area-step"],
|
20096 | Step: ["step", "area-step"],
|
20097 | Spline: ["spline", "area-spline", "area-spline-range"]
|
20098 | };
|
20099 | util_extend(ChartInternal_ChartInternal.prototype, {
|
20100 | setTargetType: function setTargetType(targetIds, type) {
|
20101 | var $$ = this,
|
20102 | config = $$.config;
|
20103 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
20104 | $$.withoutFadeIn[id] = type === config.data_types[id], config.data_types[id] = type;
|
20105 | }), targetIds || (config.data_type = type);
|
20106 | },
|
20107 | hasType: function hasType(type, targetsValue) {
|
20108 | var $$ = this,
|
20109 | types = $$.config.data_types,
|
20110 | targets = targetsValue || $$.data.targets,
|
20111 | has = !1;
|
20112 | return targets && targets.length ? targets.forEach(function (target) {
|
20113 | var t = types[target.id];
|
20114 | (t && t.indexOf(type) >= 0 || !t && type === "line") && (has = !0);
|
20115 | }) : Object.keys(types).length ? Object.keys(types).forEach(function (id) {
|
20116 | types[id] === type && (has = !0);
|
20117 | }) : has = $$.config.data_type === type, has;
|
20118 | },
|
20119 |
|
20120 | /**
|
20121 | * Check if contains given chart types
|
20122 | * @parma {String} type Type key
|
20123 | * @param {Object} targets
|
20124 | * @param {Array} exclude Excluded types
|
20125 | * @return {boolean}
|
20126 | * @private
|
20127 | */
|
20128 | hasTypeOf: function hasTypeOf(type, targets) {
|
20129 | var _this = this,
|
20130 | exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
20131 |
|
20132 | return !TYPES[type].filter(function (v) {
|
20133 | return exclude.indexOf(v) === -1;
|
20134 | }).every(function (v) {
|
20135 | return !_this.hasType(v, targets);
|
20136 | });
|
20137 | },
|
20138 |
|
20139 | /**
|
20140 | * Check if given data is certain chart type
|
20141 | * @param {Object} d Data object
|
20142 | * @param {String} type chart type
|
20143 | * @return {Boolean}
|
20144 | * @private
|
20145 | */
|
20146 | isTypeOf: function isTypeOf(d, type) {
|
20147 | var id = isString(d) ? d : d.id,
|
20148 | dataType = this.config.data_types[id];
|
20149 | return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
20150 | },
|
20151 |
|
20152 | /**
|
20153 | * Check if contains arc types chart
|
20154 | * @param {Object} targets
|
20155 | * @param {Array} exclude Excluded types
|
20156 | * @return {boolean}
|
20157 | * @private
|
20158 | */
|
20159 | hasArcType: function hasArcType(targets, exclude) {
|
20160 | return this.hasTypeOf("Arc", targets, exclude);
|
20161 | },
|
20162 | isLineType: function isLineType(d) {
|
20163 | var id = isString(d) ? d : d.id;
|
20164 | return !this.config.data_types[id] || this.isTypeOf(id, TYPES.Line);
|
20165 | },
|
20166 | isStepType: function isStepType(d) {
|
20167 | return this.isTypeOf(d, TYPES.Step);
|
20168 | },
|
20169 | isSplineType: function isSplineType(d) {
|
20170 | return this.isTypeOf(d, TYPES.Spline);
|
20171 | },
|
20172 | isAreaType: function isAreaType(d) {
|
20173 | return this.isTypeOf(d, TYPES.Area);
|
20174 | },
|
20175 | isAreaRangeType: function isAreaRangeType(d) {
|
20176 | return this.isTypeOf(d, TYPES.AreaRange);
|
20177 | },
|
20178 | isBarType: function isBarType(d) {
|
20179 | return this.isTypeOf(d, "bar");
|
20180 | },
|
20181 | isBubbleType: function isBubbleType(d) {
|
20182 | return this.isTypeOf(d, "bubble");
|
20183 | },
|
20184 | isScatterType: function isScatterType(d) {
|
20185 | return this.isTypeOf(d, "scatter");
|
20186 | },
|
20187 | isPieType: function isPieType(d) {
|
20188 | return this.isTypeOf(d, "pie");
|
20189 | },
|
20190 | isGaugeType: function isGaugeType(d) {
|
20191 | return this.isTypeOf(d, "gauge");
|
20192 | },
|
20193 | isDonutType: function isDonutType(d) {
|
20194 | return this.isTypeOf(d, "donut");
|
20195 | },
|
20196 | isRadarType: function isRadarType(d) {
|
20197 | return this.isTypeOf(d, "radar");
|
20198 | },
|
20199 | isArcType: function isArcType(d) {
|
20200 | return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
|
20201 | },
|
20202 | // determine if is 'circle' data point
|
20203 | isCirclePoint: function isCirclePoint() {
|
20204 | var config = this.config,
|
20205 | pattern = config.point_pattern;
|
20206 | return config.point_type === "circle" && (!pattern || isArray(pattern) && pattern.length === 0);
|
20207 | },
|
20208 | lineData: function lineData(d) {
|
20209 | return this.isLineType(d) ? [d] : [];
|
20210 | },
|
20211 | arcData: function arcData(d) {
|
20212 | return this.isArcType(d.data) ? [d] : [];
|
20213 | },
|
20214 | barData: function barData(d) {
|
20215 | return this.isBarType(d) ? d.values : [];
|
20216 | },
|
20217 |
|
20218 | /**
|
20219 | * Get data adapt for data label showing
|
20220 | * @param {Object} d Data object
|
20221 | * @return {Array}
|
20222 | * @private
|
20223 | */
|
20224 | labelishData: function labelishData(d) {
|
20225 | return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isRadarType(d) ? d.values : [];
|
20226 | },
|
20227 | barLineBubbleData: function barLineBubbleData(d) {
|
20228 | return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
|
20229 | },
|
20230 | // https://github.com/d3/d3-shape#curves
|
20231 | isInterpolationType: function isInterpolationType(type) {
|
20232 | return ["basis", "basis-closed", "basis-open", "bundle", "cardinal", "cardinal-closed", "cardinal-open", "catmull-rom", "catmull-rom-closed", "catmull-rom-open", "linear", "linear-closed", "monotone-x", "monotone-y", "natural"].indexOf(type) >= 0;
|
20233 | }
|
20234 | });
|
20235 | // CONCATENATED MODULE: ./src/internals/grid.js
|
20236 | /**
|
20237 | * Copyright (c) 2017 ~ present NAVER Corp.
|
20238 | * billboard.js project is licensed under the MIT license
|
20239 | */
|
20240 |
|
20241 |
|
20242 |
|
20243 | // Grid position and text anchor helpers
|
20244 |
|
20245 | var getGridTextAnchor = function (d) {
|
20246 | return isValue(d.position) || "end";
|
20247 | },
|
20248 | getGridTextDx = function (d) {
|
20249 | return d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
20250 | },
|
20251 | getGridTextX = function (isX, width, height) {
|
20252 | return function (d) {
|
20253 | var x = isX ? 0 : width;
|
20254 | return d.position === "start" ? x = isX ? -height : 0 : d.position === "middle" && (x = (isX ? -height : width) / 2), x;
|
20255 | };
|
20256 | };
|
20257 |
|
20258 | util_extend(ChartInternal_ChartInternal.prototype, {
|
20259 | initGrid: function initGrid() {
|
20260 | var $$ = this;
|
20261 | $$.xgrid = src_selectAll([]), $$.initGridLines(), $$.initXYFocusGrid();
|
20262 | },
|
20263 | initGridLines: function initGridLines() {
|
20264 | var $$ = this,
|
20265 | config = $$.config;
|
20266 | (config.grid_x_lines.length || config.grid_y_lines.length) && ($$.gridLines = $$.main.insert("g", ".".concat(config_classes.chart).concat(config.grid_lines_front ? " + *" : "")).attr("clip-path", $$.clipPathForGrid).attr("class", "".concat(config_classes.grid, " ").concat(config_classes.gridLines)), $$.gridLines.append("g").attr("class", config_classes.xgridLines), $$.gridLines.append("g").attr("class", config_classes.ygridLines), $$.xgridLines = src_selectAll([]));
|
20267 | },
|
20268 | updateXGrid: function updateXGrid(withoutUpdate) {
|
20269 | var $$ = this,
|
20270 | config = $$.config,
|
20271 | isRotated = config.axis_rotated,
|
20272 | xgridData = $$.generateGridData(config.grid_x_type, $$.x),
|
20273 | tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0,
|
20274 | pos = function (d) {
|
20275 | return (($$.zoomScale || $$.x)(d) + tickOffset) * (isRotated ? -1 : 1);
|
20276 | };
|
20277 |
|
20278 | $$.xgridAttr = isRotated ? {
|
20279 | "x1": 0,
|
20280 | "x2": $$.width,
|
20281 | "y1": pos,
|
20282 | "y2": pos
|
20283 | } : {
|
20284 | "x1": pos,
|
20285 | "x2": pos,
|
20286 | "y1": 0,
|
20287 | "y2": $$.height
|
20288 | }, $$.xgrid = $$.main.select(".".concat(config_classes.xgrids)).selectAll(".".concat(config_classes.xgrid)).data(xgridData), $$.xgrid.exit().remove(), $$.xgrid = $$.xgrid.enter().append("line").attr("class", config_classes.xgrid).merge($$.xgrid), withoutUpdate || $$.xgrid.each(function () {
|
20289 | var grid = src_select(this);
|
20290 | Object.keys($$.xgridAttr).forEach(function (id) {
|
20291 | grid.attr(id, $$.xgridAttr[id]).style("opacity", function () {
|
20292 | return grid.attr(isRotated ? "y1" : "x1") === (isRotated ? $$.height : 0) ? "0" : "1";
|
20293 | });
|
20294 | });
|
20295 | });
|
20296 | },
|
20297 | updateYGrid: function updateYGrid() {
|
20298 | var $$ = this,
|
20299 | config = $$.config,
|
20300 | isRotated = config.axis_rotated,
|
20301 | gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks),
|
20302 | pos = function (d) {
|
20303 | return Math.ceil($$.y(d));
|
20304 | };
|
20305 |
|
20306 | $$.ygrid = $$.main.select(".".concat(config_classes.ygrids)).selectAll(".".concat(config_classes.ygrid)).data(gridValues), $$.ygrid.exit().remove(), $$.ygrid = $$.ygrid.enter().append("line").attr("class", config_classes.ygrid).merge($$.ygrid), $$.ygrid.attr("x1", isRotated ? pos : 0).attr("x2", isRotated ? pos : $$.width).attr("y1", isRotated ? 0 : pos).attr("y2", isRotated ? $$.height : pos), $$.smoothLines($$.ygrid, "grid");
|
20307 | },
|
20308 | updateGrid: function updateGrid(duration) {
|
20309 | var $$ = this;
|
20310 | // hide if arc type
|
20311 | $$.gridLines || $$.initGridLines(), $$.grid.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.main.select("line.".concat(config_classes.xgridFocus)).style("visibility", "hidden"), $$.updateXGridLines(duration), $$.updateYGridLines(duration);
|
20312 | },
|
20313 |
|
20314 | /**
|
20315 | * Update X Grid lines
|
20316 | * @param {Number} duration
|
20317 | * @private
|
20318 | */
|
20319 | updateXGridLines: function updateXGridLines(duration) {
|
20320 | var $$ = this,
|
20321 | main = $$.main,
|
20322 | config = $$.config,
|
20323 | isRotated = config.axis_rotated;
|
20324 | config.grid_x_show && $$.updateXGrid(), $$.xgridLines = main.select(".".concat(config_classes.xgridLines)).selectAll(".".concat(config_classes.xgridLine)).data(config.grid_x_lines), $$.xgridLines.exit().transition().duration(duration).style("opacity", "0").remove();
|
20325 | // enter
|
20326 | var xgridLine = $$.xgridLines.enter().append("g");
|
20327 | xgridLine.append("line").style("opacity", "0"), xgridLine.append("text").attr("transform", isRotated ? "" : "rotate(-90)").attr("dy", -5).style("opacity", "0"), $$.xgridLines = xgridLine.merge($$.xgridLines), $$.xgridLines.attr("class", function (d) {
|
20328 | return "".concat(config_classes.xgridLine, " ").concat(d["class"] || "").trim();
|
20329 | }).select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx).transition().duration(duration).text(function (d) {
|
20330 | return d.text;
|
20331 | }).transition().style("opacity", "1");
|
20332 | },
|
20333 |
|
20334 | /**
|
20335 | * Update Y Grid lines
|
20336 | * @param {Number} duration
|
20337 | * @private
|
20338 | */
|
20339 | updateYGridLines: function updateYGridLines(duration) {
|
20340 | var $$ = this,
|
20341 | main = $$.main,
|
20342 | config = $$.config,
|
20343 | isRotated = config.axis_rotated;
|
20344 | config.grid_y_show && $$.updateYGrid(), $$.ygridLines = main.select(".".concat(config_classes.ygridLines)).selectAll(".".concat(config_classes.ygridLine)).data(config.grid_y_lines), $$.ygridLines.exit().transition().duration(duration).style("opacity", "0").remove();
|
20345 | // enter
|
20346 | var ygridLine = $$.ygridLines.enter().append("g");
|
20347 | ygridLine.append("line").style("opacity", "0"), ygridLine.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0"), $$.ygridLines = ygridLine.merge($$.ygridLines);
|
20348 | // update
|
20349 | var yv = $$.yv.bind($$);
|
20350 | $$.ygridLines.attr("class", function (d) {
|
20351 | return "".concat(config_classes.ygridLine, " ").concat(d["class"] || "").trim();
|
20352 | }).select("line").transition().duration(duration).attr("x1", isRotated ? yv : 0).attr("x2", isRotated ? yv : $$.width).attr("y1", isRotated ? 0 : yv).attr("y2", isRotated ? $$.height : yv).transition().style("opacity", "1"), $$.ygridLines.select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx).transition().duration(duration).attr("dy", -5).attr("x", getGridTextX(isRotated, $$.width, $$.height)).attr("y", yv).text(function (d) {
|
20353 | return d.text;
|
20354 | }).transition().style("opacity", "1");
|
20355 | },
|
20356 | redrawGrid: function redrawGrid(withTransition) {
|
20357 | var $$ = this,
|
20358 | isRotated = $$.config.axis_rotated,
|
20359 | xv = $$.xv.bind($$),
|
20360 | lines = $$.xgridLines.select("line"),
|
20361 | texts = $$.xgridLines.select("text");
|
20362 | return lines = (withTransition ? lines.transition() : lines).attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? $$.width : xv).attr("y1", isRotated ? xv : 0).attr("y2", isRotated ? xv : $$.height), texts = (withTransition ? texts.transition() : texts).attr("x", getGridTextX(!isRotated, $$.width, $$.height)).attr("y", xv).text(function (d) {
|
20363 | return d.text;
|
20364 | }), [(withTransition ? lines.transition() : lines).style("opacity", "1"), (withTransition ? texts.transition() : texts).style("opacity", "1")];
|
20365 | },
|
20366 | initXYFocusGrid: function initXYFocusGrid() {
|
20367 | var $$ = this,
|
20368 | config = $$.config,
|
20369 | isFront = config.grid_front,
|
20370 | className = ".".concat(config_classes[isFront && $$.gridLines ? "gridLines" : "chart"]).concat(isFront ? " + *" : "");
|
20371 | $$.grid = $$.main.insert("g", className).attr("clip-path", $$.clipPathForGrid).attr("class", config_classes.grid), config.grid_x_show && $$.grid.append("g").attr("class", config_classes.xgrids), config.grid_y_show && $$.grid.append("g").attr("class", config_classes.ygrids), config.grid_focus_show && $$.grid.append("g").attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus);
|
20372 | },
|
20373 | showXGridFocus: function showXGridFocus(selectedData) {
|
20374 | var $$ = this,
|
20375 | config = $$.config,
|
20376 | isRotated = config.axis_rotated,
|
20377 | dataToShow = selectedData.filter(function (d) {
|
20378 | return d && isValue($$.getBaseValue(d));
|
20379 | }),
|
20380 | focusEl = $$.main.selectAll("line.".concat(config_classes.xgridFocus)),
|
20381 | xx = $$.xx.bind($$);
|
20382 | !config.tooltip_show || $$.hasType("bubble") || $$.hasType("scatter") || $$.hasArcType() || (focusEl.style("visibility", "visible").data([dataToShow[0]]).attr(isRotated ? "y1" : "x1", xx).attr(isRotated ? "y2" : "x2", xx), $$.smoothLines(focusEl, "grid")); // Hide when bubble/scatter/stanford plot exists
|
20383 | },
|
20384 | hideXGridFocus: function hideXGridFocus() {
|
20385 | this.main.select("line.".concat(config_classes.xgridFocus)).style("visibility", "hidden");
|
20386 | },
|
20387 | updateXgridFocus: function updateXgridFocus() {
|
20388 | var $$ = this,
|
20389 | isRotated = $$.config.axis_rotated;
|
20390 | $$.main.select("line.".concat(config_classes.xgridFocus)).attr("x1", isRotated ? 0 : -10).attr("x2", isRotated ? $$.width : -10).attr("y1", isRotated ? -10 : 0).attr("y2", isRotated ? -10 : $$.height);
|
20391 | },
|
20392 | generateGridData: function generateGridData(type, scale) {
|
20393 | var $$ = this,
|
20394 | tickNum = $$.main.select(".".concat(config_classes.axisX)).selectAll(".tick").size(),
|
20395 | gridData = [];
|
20396 |
|
20397 | if (type === "year") {
|
20398 | var xDomain = $$.getXDomain(),
|
20399 | firstYear = xDomain[0].getFullYear(),
|
20400 | lastYear = xDomain[1].getFullYear();
|
20401 |
|
20402 | for (var i = firstYear; i <= lastYear; i++) gridData.push(new Date("".concat(i, "-01-01 00:00:00")));
|
20403 | } else gridData = scale.ticks(10), gridData.length > tickNum && (gridData = gridData.filter(function (d) {
|
20404 | return (d + "").indexOf(".") < 0;
|
20405 | }));
|
20406 |
|
20407 | return gridData;
|
20408 | },
|
20409 | getGridFilterToRemove: function getGridFilterToRemove(params) {
|
20410 | return params ? function (line) {
|
20411 | var found = !1;
|
20412 | return (isArray(params) ? params.concat() : [params]).forEach(function (param) {
|
20413 | ("value" in param && line.value === param.value || "class" in param && line["class"] === param["class"]) && (found = !0);
|
20414 | }), found;
|
20415 | } : function () {
|
20416 | return !0;
|
20417 | };
|
20418 | },
|
20419 | removeGridLines: function removeGridLines(params, forX) {
|
20420 | var $$ = this,
|
20421 | config = $$.config,
|
20422 | toRemove = $$.getGridFilterToRemove(params),
|
20423 | classLines = forX ? config_classes.xgridLines : config_classes.ygridLines,
|
20424 | classLine = forX ? config_classes.xgridLine : config_classes.ygridLine;
|
20425 | $$.main.select(".".concat(classLines)).selectAll(".".concat(classLine)).filter(toRemove).transition().duration(config.transition_duration).style("opacity", "0").remove();
|
20426 | var gridLines = "grid_".concat(forX ? "x" : "y", "_lines");
|
20427 | config[gridLines] = config[gridLines].filter(function toShow(line) {
|
20428 | return !toRemove(line);
|
20429 | });
|
20430 | }
|
20431 | });
|
20432 | // CONCATENATED MODULE: ./src/internals/tooltip.js
|
20433 |
|
20434 |
|
20435 |
|
20436 | /**
|
20437 | * Copyright (c) 2017 ~ present NAVER Corp.
|
20438 | * billboard.js project is licensed under the MIT license
|
20439 | */
|
20440 |
|
20441 |
|
20442 |
|
20443 |
|
20444 |
|
20445 | util_extend(ChartInternal_ChartInternal.prototype, {
|
20446 | /**
|
20447 | * Initializes the tooltip
|
20448 | * @private
|
20449 | */
|
20450 | initTooltip: function initTooltip() {
|
20451 | var $$ = this,
|
20452 | config = $$.config,
|
20453 | bindto = config.tooltip_contents.bindto;
|
20454 |
|
20455 | // Show tooltip if needed
|
20456 | if ($$.tooltip = src_select(bindto), $$.tooltip.empty() && ($$.tooltip = $$.selectChart.style("position", "relative").append("div").attr("class", config_classes.tooltipContainer).style("position", "absolute").style("pointer-events", "none").style("display", "none")), config.tooltip_init_show) {
|
20457 | if ($$.isTimeSeries() && isString(config.tooltip_init_x)) {
|
20458 | var i,
|
20459 | val,
|
20460 | targets = $$.data.targets[0];
|
20461 |
|
20462 | for (config.tooltip_init_x = $$.parseDate(config.tooltip_init_x), i = 0; (val = targets.values[i]) && val.x - config.tooltip_init_x !== 0; i++);
|
20463 |
|
20464 | config.tooltip_init_x = i;
|
20465 | }
|
20466 |
|
20467 | $$.tooltip.html($$.getTooltipHTML($$.data.targets.map(function (d) {
|
20468 | return $$.addName(d.values[config.tooltip_init_x]);
|
20469 | }), $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType(null, ["radar"])), $$.color)), bindto || $$.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", "block");
|
20470 | }
|
20471 | },
|
20472 |
|
20473 | /**
|
20474 | * Get the tooltip HTML string
|
20475 | * @param {...any} args
|
20476 | * @private
|
20477 | * @return {String} Formatted HTML string
|
20478 | */
|
20479 | getTooltipHTML: function getTooltipHTML() {
|
20480 | for (var _config$tooltip_conte, _$$, $$ = this, config = $$.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
20481 |
|
20482 | return isFunction(config.tooltip_contents) ? (_config$tooltip_conte = config.tooltip_contents).call.apply(_config$tooltip_conte, [$$].concat(args)) : (_$$ = $$).getTooltipContent.apply(_$$, args);
|
20483 | },
|
20484 |
|
20485 | /**
|
20486 | * Returns the tooltip content(HTML string)
|
20487 | * @param {Object} d data
|
20488 | * @param {Function} defaultTitleFormat Default title format
|
20489 | * @param {Function} defaultValueFormat Default format for each data value in the tooltip.
|
20490 | * @param {Function} color Color function
|
20491 | * @returns {String} html
|
20492 | * @private
|
20493 | */
|
20494 | getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) {
|
20495 | var $$ = this,
|
20496 | config = $$.config,
|
20497 | titleFormat = config.tooltip_format_title || defaultTitleFormat,
|
20498 | nameFormat = config.tooltip_format_name || function (name) {
|
20499 | return name;
|
20500 | },
|
20501 | valueFormat = config.tooltip_format_value || ($$.isStackNormalized() ? function (v, ratio) {
|
20502 | return "".concat((ratio * 100).toFixed(2), "%");
|
20503 | } : defaultValueFormat),
|
20504 | order = config.tooltip_order,
|
20505 | getRowValue = function (row) {
|
20506 | return $$.getBaseValue(row);
|
20507 | },
|
20508 | getBgColor = $$.levelColor ? function (row) {
|
20509 | return $$.levelColor(row.value);
|
20510 | } : function (row) {
|
20511 | return color(row);
|
20512 | },
|
20513 | contents = config.tooltip_contents,
|
20514 | tplStr = contents.template;
|
20515 |
|
20516 | if (order === null && config.data_groups.length) {
|
20517 | // for stacked data, order should aligned with the visually displayed data
|
20518 | var ids = $$.orderTargets($$.data.targets).map(function (i2) {
|
20519 | return i2.id;
|
20520 | }).reverse();
|
20521 | d.sort(function (a, b) {
|
20522 | var v1 = a ? a.value : null,
|
20523 | v2 = b ? b.value : null;
|
20524 | return v1 > 0 && v2 > 0 && (v1 = a.id ? ids.indexOf(a.id) : null, v2 = b.id ? ids.indexOf(b.id) : null), v1 - v2;
|
20525 | });
|
20526 | } else if (/^(asc|desc)$/.test(order)) {
|
20527 | d.sort(function (a, b) {
|
20528 | var v1 = a ? getRowValue(a) : null,
|
20529 | v2 = b ? getRowValue(b) : null;
|
20530 | return order === "asc" ? v1 - v2 : v2 - v1;
|
20531 | });
|
20532 | } else isFunction(order) && d.sort(order);
|
20533 |
|
20534 | var text,
|
20535 | row,
|
20536 | param,
|
20537 | value,
|
20538 | i,
|
20539 | tpl = $$.getTooltipContentTemplate(tplStr);
|
20540 |
|
20541 | for (i = 0; row = d[i]; i++) if (getRowValue(row) || getRowValue(row) === 0) {
|
20542 | if (isUndefined(text)) {
|
20543 | var title = sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
20544 | text = tplProcess(tpl[0], {
|
20545 | CLASS_TOOLTIP: config_classes.tooltip,
|
20546 | TITLE: isValue(title) ? tplStr ? title : "<tr><th colspan=\"2\">".concat(title, "</th></tr>") : ""
|
20547 | });
|
20548 | }
|
20549 |
|
20550 | if (param = [row.ratio, row.id, row.index, d], value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(toConsumableArray_default()(param)))), $$.isAreaRangeType(row)) {
|
20551 | var _map = ["high", "low"].map(function (v) {
|
20552 | return sanitise(valueFormat.apply(void 0, [$$.getAreaRangeData(row, v)].concat(toConsumableArray_default()(param))));
|
20553 | }),
|
20554 | _map2 = slicedToArray_default()(_map, 2),
|
20555 | high = _map2[0],
|
20556 | low = _map2[1];
|
20557 |
|
20558 | value = "<b>Mid:</b> ".concat(value, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low);
|
20559 | }
|
20560 |
|
20561 | if (value !== undefined) {
|
20562 | var _ret = function () {
|
20563 | // Skip elements when their name is set to null
|
20564 | if (row.name === null) return "continue";
|
20565 | var name = sanitise(nameFormat.apply(void 0, [row.name].concat(toConsumableArray_default()(param)))),
|
20566 | color = getBgColor(row),
|
20567 | contentValue = {
|
20568 | CLASS_TOOLTIP_NAME: config_classes.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
20569 | COLOR: tplStr || !$$.patterns ? color : "<svg><rect style=\"fill:".concat(color, "\" width=\"10\" height=\"10\"></rect></svg>"),
|
20570 | NAME: name,
|
20571 | VALUE: value
|
20572 | };
|
20573 | tplStr && isObject(contents.text) && Object.keys(contents.text).forEach(function (key) {
|
20574 | contentValue[key] = contents.text[key][i];
|
20575 | }), text += tplProcess(tpl[1], contentValue);
|
20576 | }();
|
20577 |
|
20578 | if (_ret === "continue") continue;
|
20579 | }
|
20580 | }
|
20581 |
|
20582 | return "".concat(text, "</table>");
|
20583 | },
|
20584 |
|
20585 | |
20586 |
|
20587 |
|
20588 |
|
20589 |
|
20590 |
|
20591 | getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) {
|
20592 | return (tplStr || "<table class=\"{=CLASS_TOOLTIP}\"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class=\"{=CLASS_TOOLTIP_NAME}\">\n\t\t\t\t\t<td class=\"name\">".concat(this.patterns ? "{=COLOR}" : "<span style=\"background-color:{=COLOR}\"></span>", "{=NAME}</td>\n\t\t\t\t\t<td class=\"value\">{=VALUE}</td>\n\t\t\t\t</tr>}}\n\t\t\t</tbody></table>")).replace(/(\r?\n|\t)/g, "").split(/{{(.*)}}/);
|
20593 | },
|
20594 |
|
20595 | |
20596 |
|
20597 |
|
20598 |
|
20599 |
|
20600 |
|
20601 |
|
20602 |
|
20603 |
|
20604 | tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) {
|
20605 | var $$ = this,
|
20606 | config = $$.config,
|
20607 | _d3Mouse = src_mouse(element),
|
20608 | _d3Mouse2 = slicedToArray_default()(_d3Mouse, 2),
|
20609 | left = _d3Mouse2[0],
|
20610 | top = _d3Mouse2[1],
|
20611 | svgLeft = $$.getSvgLeft(!0),
|
20612 | chartRight = svgLeft + $$.currentWidth - $$.getCurrentPaddingRight();
|
20613 |
|
20614 |
|
20615 | if (top += 20, $$.hasArcType()) {
|
20616 | var raw = $$.inputType === "touch" || $$.hasType("radar");
|
20617 | raw || (top += $$.height / 2, left += ($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2);
|
20618 | } else {
|
20619 | var dataScale = $$.x(dataToShow[0].x);
|
20620 | config.axis_rotated ? (top = dataScale + 20, left += svgLeft + 100, chartRight -= svgLeft) : (top -= 5, left = svgLeft + $$.getCurrentPaddingLeft(!0) + 20 + ($$.zoomScale ? left : dataScale));
|
20621 | }
|
20622 |
|
20623 | var right = left + tWidth;
|
20624 | return right > chartRight && (left -= right - chartRight + 20), top + tHeight > $$.currentHeight && (top -= tHeight + 30), top < 0 && (top = 0), {
|
20625 | top: top,
|
20626 | left: left
|
20627 | };
|
20628 | },
|
20629 |
|
20630 | |
20631 |
|
20632 |
|
20633 |
|
20634 |
|
20635 |
|
20636 | showTooltip: function showTooltip(selectedData, element) {
|
20637 | var $$ = this,
|
20638 | config = $$.config,
|
20639 | bindto = config.tooltip_contents.bindto,
|
20640 | forArc = $$.hasArcType(null, ["radar"]),
|
20641 | dataToShow = selectedData.filter(function (d) {
|
20642 | return d && isValue($$.getBaseValue(d));
|
20643 | }),
|
20644 | positionFunction = config.tooltip_position || $$.tooltipPosition;
|
20645 |
|
20646 | if (dataToShow.length !== 0 && config.tooltip_show) {
|
20647 | var datum = $$.tooltip.datum(),
|
20648 | dataStr = JSON.stringify(selectedData),
|
20649 | width = datum && datum.width || 0,
|
20650 | height = datum && datum.height || 0;
|
20651 |
|
20652 | if (!datum || datum.current !== dataStr) {
|
20653 | var index = selectedData.concat().sort()[0].index;
|
20654 | callFn(config.tooltip_onshow, $$), $$.tooltip.html($$.getTooltipHTML(selectedData, $$.axis.getXAxisTickFormat(), $$.getYFormat(forArc), $$.color)).style("display", null).style("visibility", null)
|
20655 | .datum({
|
20656 | index: index,
|
20657 | current: dataStr,
|
20658 | width: width = $$.tooltip.property("offsetWidth"),
|
20659 | height: height = $$.tooltip.property("offsetHeight")
|
20660 | }), callFn(config.tooltip_onshown, $$), $$._handleLinkedCharts(!0, index);
|
20661 | }
|
20662 |
|
20663 | if (!bindto) {
|
20664 |
|
20665 | var position = positionFunction.call(this, dataToShow, width, height, element);
|
20666 |
|
20667 | $$.tooltip.style("top", "".concat(position.top, "px")).style("left", "".concat(position.left, "px"));
|
20668 | }
|
20669 | }
|
20670 | },
|
20671 |
|
20672 | |
20673 |
|
20674 |
|
20675 |
|
20676 |
|
20677 | hideTooltip: function hideTooltip(force) {
|
20678 | var $$ = this,
|
20679 | config = $$.config;
|
20680 | (!config.tooltip_doNotHide || force) && (callFn(config.tooltip_onhide, $$), this.tooltip.style("display", "none").style("visibility", "hidden")
|
20681 | .datum(null), callFn(config.tooltip_onhidden, $$));
|
20682 | },
|
20683 |
|
20684 | |
20685 |
|
20686 |
|
20687 |
|
20688 |
|
20689 |
|
20690 | _handleLinkedCharts: function _handleLinkedCharts(show, index) {
|
20691 | var $$ = this;
|
20692 |
|
20693 | if ($$.config.tooltip_linked) {
|
20694 | var linkedName = $$.config.tooltip_linked_name;
|
20695 | ($$.api.internal.charts || []).forEach(function (c) {
|
20696 | if (c !== $$.api) {
|
20697 | var _config = c.internal.config,
|
20698 | isLinked = _config.tooltip_linked,
|
20699 | name = _config.tooltip_linked_name,
|
20700 | isInDom = browser["document"].body.contains(c.element);
|
20701 |
|
20702 | if (isLinked && linkedName === name && isInDom) {
|
20703 | var data = c.internal.tooltip.data()[0],
|
20704 | isNotSameIndex = index !== (data && data.index);
|
20705 |
|
20706 |
|
20707 | try {
|
20708 | show && isNotSameIndex ? c.tooltip.show({
|
20709 | index: index
|
20710 | }) : !show && c.tooltip.hide();
|
20711 | } catch (e) {}
|
20712 | }
|
20713 | }
|
20714 | });
|
20715 | }
|
20716 | }
|
20717 | });
|
20718 |
|
20719 |
|
20720 |
|
20721 |
|
20722 |
|
20723 |
|
20724 |
|
20725 |
|
20726 |
|
20727 |
|
20728 | util_extend(ChartInternal_ChartInternal.prototype, {
|
20729 | |
20730 |
|
20731 |
|
20732 |
|
20733 | initLegend: function initLegend() {
|
20734 | var $$ = this,
|
20735 | config = $$.config;
|
20736 | $$.legendItemTextBox = {}, $$.legendHasRendered = !1, $$.legend = $$.svg.append("g"), config.legend_show ? ($$.legend.attr("transform", $$.getTranslate("legend")), $$.updateLegend()) : ($$.legend.style("visibility", "hidden"), $$.hiddenLegendIds = $$.mapToIds($$.data.targets));
|
20737 | },
|
20738 |
|
20739 | |
20740 |
|
20741 |
|
20742 |
|
20743 |
|
20744 |
|
20745 |
|
20746 | updateLegend: function updateLegend(targetIds, options, transitions) {
|
20747 | var $$ = this,
|
20748 | config = $$.config,
|
20749 | optionz = options || {
|
20750 | withTransform: !1,
|
20751 | withTransitionForTransform: !1,
|
20752 | withTransition: !1
|
20753 | };
|
20754 |
|
20755 |
|
20756 |
|
20757 | optionz.withTransition = getOption(optionz, "withTransition", !0), optionz.withTransitionForTransform = getOption(optionz, "withTransitionForTransform", !0), config.legend_contents_bindto && config.legend_contents_template ? $$.updateLegendTemplate() : $$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions), $$.legend.selectAll(".".concat(config_classes.legendItem)).classed(config_classes.legendItemHidden, function (id) {
|
20758 | return !$$.isTargetToShow(id);
|
20759 | }), $$.updateScales(!1, !$$.zoomScale), $$.updateSvgSize(), $$.transformAll(optionz.withTransitionForTransform, transitions), $$.legendHasRendered = !0;
|
20760 | },
|
20761 |
|
20762 | |
20763 |
|
20764 |
|
20765 |
|
20766 | updateLegendTemplate: function updateLegendTemplate() {
|
20767 | var $$ = this,
|
20768 | config = $$.config,
|
20769 | wrapper = src_select(config.legend_contents_bindto),
|
20770 | template = config.legend_contents_template;
|
20771 |
|
20772 | if (!wrapper.empty()) {
|
20773 | var targets = $$.mapToIds($$.data.targets),
|
20774 | ids = [],
|
20775 | html = "";
|
20776 | targets.forEach(function (v) {
|
20777 | var content = isFunction(template) ? template.call($$, v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, {
|
20778 | COLOR: $$.color(v),
|
20779 | TITLE: v
|
20780 | });
|
20781 | content && (ids.push(v), html += content);
|
20782 | });
|
20783 | var legendItem = wrapper.html(html).selectAll(function () {
|
20784 | return this.childNodes;
|
20785 | }).data(ids);
|
20786 | $$.setLegendItem(legendItem), $$.legend = wrapper;
|
20787 | }
|
20788 | },
|
20789 |
|
20790 | |
20791 |
|
20792 |
|
20793 |
|
20794 |
|
20795 | updateSizeForLegend: function updateSizeForLegend(size) {
|
20796 | var $$ = this,
|
20797 | config = $$.config,
|
20798 | width = size.width,
|
20799 | height = size.height,
|
20800 | insetLegendPosition = {
|
20801 | top: $$.isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : $$.currentHeight - height - $$.getCurrentPaddingBottom() - config.legend_inset_y,
|
20802 | left: $$.isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : $$.currentWidth - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5
|
20803 | };
|
20804 | $$.margin3 = {
|
20805 | top: $$.isLegendRight ? 0 : $$.isLegendInset ? insetLegendPosition.top : $$.currentHeight - height,
|
20806 | right: NaN,
|
20807 | bottom: 0,
|
20808 | left: $$.isLegendRight ? $$.currentWidth - width : $$.isLegendInset ? insetLegendPosition.left : 0
|
20809 | };
|
20810 | },
|
20811 |
|
20812 | |
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 | transformLegend: function transformLegend(withTransition) {
|
20818 | var $$ = this;
|
20819 | (withTransition ? $$.legend.transition() : $$.legend).attr("transform", $$.getTranslate("legend"));
|
20820 | },
|
20821 |
|
20822 | |
20823 |
|
20824 |
|
20825 |
|
20826 |
|
20827 | updateLegendStep: function updateLegendStep(step) {
|
20828 | this.legendStep = step;
|
20829 | },
|
20830 |
|
20831 | |
20832 |
|
20833 |
|
20834 |
|
20835 |
|
20836 | updateLegendItemWidth: function updateLegendItemWidth(w) {
|
20837 | this.legendItemWidth = w;
|
20838 | },
|
20839 |
|
20840 | |
20841 |
|
20842 |
|
20843 |
|
20844 |
|
20845 | updateLegendItemHeight: function updateLegendItemHeight(h) {
|
20846 | this.legendItemHeight = h;
|
20847 | },
|
20848 |
|
20849 | |
20850 |
|
20851 |
|
20852 |
|
20853 |
|
20854 | getLegendWidth: function getLegendWidth() {
|
20855 | var $$ = this;
|
20856 | return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0;
|
20857 | },
|
20858 |
|
20859 | |
20860 |
|
20861 |
|
20862 |
|
20863 |
|
20864 | getLegendHeight: function getLegendHeight() {
|
20865 | var $$ = this;
|
20866 | return $$.config.legend_show ? $$.isLegendRight ? $$.currentHeight : Math.max(20, $$.legendItemHeight) * ($$.legendStep + 1) : 0;
|
20867 | },
|
20868 |
|
20869 | |
20870 |
|
20871 |
|
20872 |
|
20873 |
|
20874 |
|
20875 | opacityForLegend: function opacityForLegend(legendItem) {
|
20876 | return legendItem.classed(config_classes.legendItemHidden) ? null : "1";
|
20877 | },
|
20878 |
|
20879 | |
20880 |
|
20881 |
|
20882 |
|
20883 |
|
20884 |
|
20885 | opacityForUnfocusedLegend: function opacityForUnfocusedLegend(legendItem) {
|
20886 | return legendItem.classed(config_classes.legendItemHidden) ? null : "0.3";
|
20887 | },
|
20888 |
|
20889 | |
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 |
|
20895 | toggleFocusLegend: function toggleFocusLegend(targetIds, focus) {
|
20896 | var $$ = this,
|
20897 | targetIdz = $$.mapToTargetIds(targetIds);
|
20898 | $$.legend.selectAll(".".concat(config_classes.legendItem)).filter(function (id) {
|
20899 | return targetIdz.indexOf(id) >= 0;
|
20900 | }).classed(config_classes.legendItemFocused, focus).transition().duration(100).style("opacity", function () {
|
20901 | return (focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend).call($$, src_select(this));
|
20902 | });
|
20903 | },
|
20904 |
|
20905 | |
20906 |
|
20907 |
|
20908 |
|
20909 | revertLegend: function revertLegend() {
|
20910 | var $$ = this;
|
20911 | $$.legend.selectAll(".".concat(config_classes.legendItem)).classed(config_classes.legendItemFocused, !1).transition().duration(100).style("opacity", function () {
|
20912 | return $$.opacityForLegend(src_select(this));
|
20913 | });
|
20914 | },
|
20915 |
|
20916 | |
20917 |
|
20918 |
|
20919 |
|
20920 |
|
20921 | showLegend: function showLegend(targetIds) {
|
20922 | var $$ = this,
|
20923 | config = $$.config;
|
20924 | config.legend_show || (config.legend_show = !0, $$.legend.style("visibility", "visible"), !$$.legendHasRendered && $$.updateLegend()), $$.removeHiddenLegendIds(targetIds), $$.legend.selectAll($$.selectorLegends(targetIds)).style("visibility", "visible").transition().style("opacity", function () {
|
20925 | return $$.opacityForLegend(src_select(this));
|
20926 | });
|
20927 | },
|
20928 |
|
20929 | |
20930 |
|
20931 |
|
20932 |
|
20933 |
|
20934 | hideLegend: function hideLegend(targetIds) {
|
20935 | var $$ = this,
|
20936 | config = $$.config;
|
20937 | config.legend_show && isEmpty(targetIds) && (config.legend_show = !1, $$.legend.style("visibility", "hidden")), $$.addHiddenLegendIds(targetIds), $$.legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden");
|
20938 | },
|
20939 |
|
20940 | |
20941 |
|
20942 |
|
20943 |
|
20944 | clearLegendItemTextBoxCache: function clearLegendItemTextBoxCache() {
|
20945 | this.legendItemTextBox = {};
|
20946 | },
|
20947 |
|
20948 | |
20949 |
|
20950 |
|
20951 |
|
20952 |
|
20953 | setLegendItem: function setLegendItem(item) {
|
20954 | var $$ = this,
|
20955 | config = $$.config,
|
20956 | isTouch = $$.inputType === "touch";
|
20957 | item.attr("class", function (id) {
|
20958 | var node = src_select(this),
|
20959 | itemClass = !node.empty() && node.attr("class") || "";
|
20960 | return itemClass + $$.generateClass(config_classes.legendItem, id);
|
20961 | }).style("visibility", function (id) {
|
20962 | return $$.isLegendToShow(id) ? "visible" : "hidden";
|
20963 | }).style("cursor", "pointer").on("click", function (id) {
|
20964 | callFn(config.legend_item_onclick, $$, id) || (on_event.altKey ? ($$.api.hide(), $$.api.show(id)) : ($$.api.toggle(id), !isTouch && $$.isTargetToShow(id) ? $$.api.focus(id) : $$.api.revert())), isTouch && $$.hideTooltip();
|
20965 | }), isTouch || item.on("mouseout", function (id) {
|
20966 | callFn(config.legend_item_onout, $$, id) || (src_select(this).classed(config_classes.legendItemFocused, !1), $$.api.revert());
|
20967 | }).on("mouseover", function (id) {
|
20968 | callFn(config.legend_item_onover, $$, id) || (src_select(this).classed(config_classes.legendItemFocused, !0), !$$.transiting && $$.isTargetToShow(id) && $$.api.focus(id));
|
20969 | });
|
20970 | },
|
20971 |
|
20972 | |
20973 |
|
20974 |
|
20975 |
|
20976 |
|
20977 |
|
20978 | updateLegendElement: function updateLegendElement(targetIds, options) {
|
20979 | var xForLegend,
|
20980 | yForLegend,
|
20981 | background,
|
20982 | $$ = this,
|
20983 | config = $$.config,
|
20984 | posMin = 10,
|
20985 | tileWidth = config.legend_item_tile_width + 5,
|
20986 | maxWidth = 0,
|
20987 | maxHeight = 0,
|
20988 | totalLength = 0,
|
20989 | offsets = {},
|
20990 | widths = {},
|
20991 | heights = {},
|
20992 | margins = [0],
|
20993 | steps = {},
|
20994 | step = 0,
|
20995 | isLegendRightOrInset = $$.isLegendRight || $$.isLegendInset,
|
20996 | targetIdz = targetIds.filter(function (id) {
|
20997 | return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
|
20998 | }),
|
20999 | withTransition = options.withTransition,
|
21000 | getTextBox = function (textElement, id) {
|
21001 | return $$.legendItemTextBox[id] || ($$.legendItemTextBox[id] = $$.getTextRect(textElement, config_classes.legendItem)), $$.legendItemTextBox[id];
|
21002 | },
|
21003 | updatePositions = function (textElement, id, index) {
|
21004 | var margin,
|
21005 | isLast = index === targetIdz.length - 1,
|
21006 | box = getTextBox(textElement, id),
|
21007 | itemWidth = box.width + tileWidth + (isLast && !isLegendRightOrInset ? 0 : 10) + config.legend_padding,
|
21008 | itemHeight = box.height + 4,
|
21009 | itemLength = isLegendRightOrInset ? itemHeight : itemWidth,
|
21010 | areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(),
|
21011 | updateValues = function (id2, withoutStep) {
|
21012 | withoutStep || (margin = (areaLength - totalLength - itemLength) / 2, margin < posMin && (margin = (areaLength - itemLength) / 2, totalLength = 0, step++)), steps[id2] = step, margins[step] = $$.isLegendInset ? 10 : margin, offsets[id2] = totalLength, totalLength += itemLength;
|
21013 | };
|
21014 |
|
21015 | if (index === 0 && (totalLength = 0, step = 0, maxWidth = 0, maxHeight = 0), config.legend_show && !$$.isLegendToShow(id)) return widths[id] = 0, heights[id] = 0, steps[id] = 0, void (offsets[id] = 0);
|
21016 | widths[id] = itemWidth, heights[id] = itemHeight, (!maxWidth || itemWidth >= maxWidth) && (maxWidth = itemWidth), (!maxHeight || itemHeight >= maxHeight) && (maxHeight = itemHeight);
|
21017 | var maxLength = isLegendRightOrInset ? maxHeight : maxWidth;
|
21018 | config.legend_equally ? (Object.keys(widths).forEach(function (id2) {
|
21019 | return widths[id2] = maxWidth;
|
21020 | }), Object.keys(heights).forEach(function (id2) {
|
21021 | return heights[id2] = maxHeight;
|
21022 | }), margin = (areaLength - maxLength * targetIdz.length) / 2, margin < posMin ? (totalLength = 0, step = 0, targetIdz.forEach(function (id2) {
|
21023 | return updateValues(id2);
|
21024 | })) : updateValues(id, !0)) : updateValues(id);
|
21025 | };
|
21026 |
|
21027 | $$.isLegendInset && (step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length, $$.updateLegendStep(step)), $$.isLegendRight ? (xForLegend = function (id) {
|
21028 | return maxWidth * steps[id];
|
21029 | }, yForLegend = function (id) {
|
21030 | return margins[steps[id]] + offsets[id];
|
21031 | }) : $$.isLegendInset ? (xForLegend = function (id) {
|
21032 | return maxWidth * steps[id] + 10;
|
21033 | }, yForLegend = function (id) {
|
21034 | return margins[steps[id]] + offsets[id];
|
21035 | }) : (xForLegend = function (id) {
|
21036 | return margins[steps[id]] + offsets[id];
|
21037 | }, yForLegend = function (id) {
|
21038 | return maxHeight * steps[id];
|
21039 | });
|
21040 |
|
21041 | var xForLegendText = function (id, i) {
|
21042 | return xForLegend(id, i) + 4 + config.legend_item_tile_width;
|
21043 | },
|
21044 | xForLegendRect = function (id, i) {
|
21045 | return xForLegend(id, i);
|
21046 | },
|
21047 | x1ForLegendTile = function (id, i) {
|
21048 | return xForLegend(id, i) - 2;
|
21049 | },
|
21050 | x2ForLegendTile = function (id, i) {
|
21051 | return xForLegend(id, i) - 2 + config.legend_item_tile_width;
|
21052 | },
|
21053 | yForLegendText = function (id, i) {
|
21054 | return yForLegend(id, i) + 9;
|
21055 | },
|
21056 | yForLegendRect = function (id, i) {
|
21057 | return yForLegend(id, i) - 5;
|
21058 | },
|
21059 | yForLegendTile = function (id, i) {
|
21060 | return yForLegend(id, i) + 4;
|
21061 | },
|
21062 | pos = -200,
|
21063 | l = $$.legend.selectAll(".".concat(config_classes.legendItem)).data(targetIdz).enter().append("g");
|
21064 |
|
21065 | $$.setLegendItem(l), l.append("text").text(function (id) {
|
21066 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
21067 | }).each(function (id, i) {
|
21068 | updatePositions(this, id, i);
|
21069 | }).style("pointer-events", "none").attr("x", isLegendRightOrInset ? xForLegendText : pos).attr("y", isLegendRightOrInset ? pos : yForLegendText), l.append("rect").attr("class", config_classes.legendItemEvent).style("fill-opacity", "0").attr("x", isLegendRightOrInset ? xForLegendRect : pos).attr("y", isLegendRightOrInset ? pos : yForLegendRect);
|
21070 | var usePoint = $$.config.legend_usePoint;
|
21071 |
|
21072 | if (usePoint) {
|
21073 | var ids = [];
|
21074 | l.append(function (d) {
|
21075 | var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
21076 | ids.indexOf(d) === -1 && ids.push(d);
|
21077 | var point = pattern[ids.indexOf(d) % pattern.length];
|
21078 | return point === "rectangle" && (point = "rect"), browser["document"].createElementNS(namespaces.svg, $$.hasValidPointType(point) ? point : "use");
|
21079 | }).attr("class", config_classes.legendItemPoint).style("fill", function (d) {
|
21080 | return $$.color(d);
|
21081 | }).style("pointer-events", "none").attr("href", function (data, idx, selection) {
|
21082 | var node = selection[idx],
|
21083 | nodeName = node.nodeName.toLowerCase();
|
21084 | return nodeName === "use" ? "#".concat($$.datetimeId, "-point-").concat(data) : undefined;
|
21085 | });
|
21086 | } else l.append("line").attr("class", config_classes.legendItemTile).style("stroke", $$.color).style("pointer-events", "none").attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos).attr("y1", isLegendRightOrInset ? pos : yForLegendTile).attr("x2", isLegendRightOrInset ? x2ForLegendTile : pos).attr("y2", isLegendRightOrInset ? pos : yForLegendTile).attr("stroke-width", config.legend_item_tile_height);
|
21087 |
|
21088 |
|
21089 | background = $$.legend.select(".".concat(config_classes.legendBackground, " rect")), $$.isLegendInset && maxWidth > 0 && background.size() === 0 && (background = $$.legend.insert("g", ".".concat(config_classes.legendItem)).attr("class", config_classes.legendBackground).append("rect"));
|
21090 | var texts = $$.legend.selectAll("text").data(targetIdz).text(function (id) {
|
21091 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
21092 | })
|
21093 | .each(function (id, i) {
|
21094 | updatePositions(this, id, i);
|
21095 | });
|
21096 | (withTransition ? texts.transition() : texts).attr("x", xForLegendText).attr("y", yForLegendText);
|
21097 | var rects = $$.legend.selectAll("rect.".concat(config_classes.legendItemEvent)).data(targetIdz);
|
21098 |
|
21099 | if ((withTransition ? rects.transition() : rects).attr("width", function (id) {
|
21100 | return widths[id];
|
21101 | }).attr("height", function (id) {
|
21102 | return heights[id];
|
21103 | }).attr("x", xForLegendRect).attr("y", yForLegendRect), usePoint) {
|
21104 | var tiles = $$.legend.selectAll(".".concat(config_classes.legendItemPoint)).data(targetIdz);
|
21105 | (withTransition ? tiles.transition() : tiles).each(function () {
|
21106 | var radius,
|
21107 | width,
|
21108 | height,
|
21109 | nodeName = this.nodeName.toLowerCase(),
|
21110 | pointR = $$.config.point_r,
|
21111 | x = "x",
|
21112 | y = "y",
|
21113 | xOffset = 2,
|
21114 | yOffset = 2.5;
|
21115 |
|
21116 | if (nodeName === "circle") {
|
21117 | var size = pointR * .2;
|
21118 | x = "cx", y = "cy", radius = pointR + size, xOffset = pointR * 2, yOffset = -size;
|
21119 | } else if (nodeName === "rect") {
|
21120 | var _size = pointR * 2.5;
|
21121 |
|
21122 | width = _size, height = _size, yOffset = 3;
|
21123 | }
|
21124 |
|
21125 | src_select(this).attr(x, function (d) {
|
21126 | return x1ForLegendTile(d) + xOffset;
|
21127 | }).attr(y, function (d) {
|
21128 | return yForLegendTile(d) - yOffset;
|
21129 | }).attr("r", radius).attr("width", width).attr("height", height);
|
21130 | });
|
21131 | } else {
|
21132 | var _tiles = $$.legend.selectAll("line.".concat(config_classes.legendItemTile)).data(targetIdz);
|
21133 |
|
21134 | (withTransition ? _tiles.transition() : _tiles).style("stroke", $$.color).attr("x1", x1ForLegendTile).attr("y1", yForLegendTile).attr("x2", x2ForLegendTile).attr("y2", yForLegendTile);
|
21135 | }
|
21136 |
|
21137 | background && (withTransition ? background.transition() : background).attr("height", $$.getLegendHeight() - 12).attr("width", maxWidth * (step + 1) + 10), $$.updateLegendItemWidth(maxWidth), $$.updateLegendItemHeight(maxHeight), $$.updateLegendStep(step);
|
21138 | }
|
21139 | });
|
21140 |
|
21141 |
|
21142 |
|
21143 |
|
21144 |
|
21145 |
|
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 |
|
21152 |
|
21153 |
|
21154 |
|
21155 |
|
21156 | var getTextPos = function () {
|
21157 | var position,
|
21158 | pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "left",
|
21159 | width = arguments.length > 1 ? arguments[1] : undefined,
|
21160 | isNum = isNumber(width);
|
21161 | return position = pos.indexOf("center") > -1 ? isNum ? width / 2 : "middle" : pos.indexOf("right") > -1 ? isNum ? width : "end" : isNum ? 0 : "start", position;
|
21162 | };
|
21163 |
|
21164 | util_extend(ChartInternal_ChartInternal.prototype, {
|
21165 | |
21166 |
|
21167 |
|
21168 |
|
21169 | initTitle: function initTitle() {
|
21170 | var $$ = this;
|
21171 |
|
21172 | if ($$.config.title_text) {
|
21173 | $$.title = $$.svg.append("g");
|
21174 | var text = $$.title.append("text").style("text-anchor", getTextPos($$.config.title_position)).attr("class", config_classes.title);
|
21175 | setTextValue(text, $$.config.title_text, [.3, 1.5]);
|
21176 | }
|
21177 | },
|
21178 |
|
21179 | |
21180 |
|
21181 |
|
21182 |
|
21183 | redrawTitle: function redrawTitle() {
|
21184 | var $$ = this;
|
21185 |
|
21186 | if ($$.title) {
|
21187 | var y = $$.yForTitle.call($$);
|
21188 | /g/i.test($$.title.node().tagName) ? $$.title.attr("transform", "translate(".concat(getTextPos($$.config.title_position, $$.currentWidth), ", ").concat(y, ")")) : $$.title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
21189 | }
|
21190 | },
|
21191 |
|
21192 | |
21193 |
|
21194 |
|
21195 |
|
21196 |
|
21197 | xForTitle: function xForTitle() {
|
21198 | var x,
|
21199 | $$ = this,
|
21200 | config = $$.config,
|
21201 | position = config.title_position || "left";
|
21202 | return /(right|center)/.test(position) ? (x = $$.currentWidth - $$.getTextRect($$.title, config_classes.title).width, position.indexOf("right") >= 0 ? x -= config.title_padding.right || 0 : position.indexOf("center") >= 0 && (x /= 2)) : x = config.title_padding.left || 0, x;
|
21203 | },
|
21204 |
|
21205 | |
21206 |
|
21207 |
|
21208 |
|
21209 |
|
21210 | yForTitle: function yForTitle() {
|
21211 | var $$ = this;
|
21212 | return ($$.config.title_padding.top || 0) + $$.getTextRect($$.title, config_classes.title).height;
|
21213 | },
|
21214 |
|
21215 | |
21216 |
|
21217 |
|
21218 |
|
21219 |
|
21220 | getTitlePadding: function getTitlePadding() {
|
21221 | var $$ = this;
|
21222 | return $$.yForTitle() + ($$.config.title_padding.bottom || 0);
|
21223 | }
|
21224 | });
|
21225 |
|
21226 |
|
21227 |
|
21228 |
|
21229 |
|
21230 |
|
21231 |
|
21232 |
|
21233 | util_extend(ChartInternal_ChartInternal.prototype, {
|
21234 | initClip: function initClip() {
|
21235 | var $$ = this;
|
21236 |
|
21237 |
|
21238 | $$.clipId = "".concat($$.datetimeId, "-clip"), $$.clipIdForXAxis = "".concat($$.clipId, "-xaxis"), $$.clipIdForYAxis = "".concat($$.clipId, "-yaxis"), $$.clipIdForGrid = "".concat($$.clipId, "-grid"), $$.clipPath = $$.getClipPath($$.clipId), $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis), $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis), $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid);
|
21239 | },
|
21240 | getClipPath: function getClipPath(id) {
|
21241 | var $$ = this,
|
21242 | config = $$.config;
|
21243 | if (!config.clipPath && /-clip$/.test(id) || !config.axis_x_clipPath && /-clip-xaxis$/.test(id) || !config.axis_y_clipPath && /-clip-yaxis$/.test(id)) return null;
|
21244 | var isIE9 = !!browser["window"].navigator && browser["window"].navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0;
|
21245 | return "url(".concat(isIE9 ? "" : browser["document"].URL.split("#")[0], "#").concat(id, ")");
|
21246 | },
|
21247 | appendClip: function appendClip(parent, id) {
|
21248 | return parent.append("clipPath").attr("id", id).append("rect");
|
21249 | },
|
21250 | getAxisClipX: function getAxisClipX(forHorizontal) {
|
21251 |
|
21252 | var left = Math.max(30, this.margin.left);
|
21253 | return forHorizontal ? -(1 + left) : -(left - 1);
|
21254 | },
|
21255 | getAxisClipY: function getAxisClipY(forHorizontal) {
|
21256 | return forHorizontal ? -20 : -this.margin.top;
|
21257 | },
|
21258 | getXAxisClipX: function getXAxisClipX() {
|
21259 | var $$ = this;
|
21260 | return $$.getAxisClipX(!$$.config.axis_rotated);
|
21261 | },
|
21262 | getXAxisClipY: function getXAxisClipY() {
|
21263 | var $$ = this;
|
21264 | return $$.getAxisClipY(!$$.config.axis_rotated);
|
21265 | },
|
21266 | getYAxisClipX: function getYAxisClipX() {
|
21267 | var $$ = this;
|
21268 | return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated);
|
21269 | },
|
21270 | getYAxisClipY: function getYAxisClipY() {
|
21271 | var $$ = this;
|
21272 | return $$.getAxisClipY($$.config.axis_rotated);
|
21273 | },
|
21274 | getAxisClipWidth: function getAxisClipWidth(forHorizontal) {
|
21275 | var $$ = this,
|
21276 | left = Math.max(30, $$.margin.left),
|
21277 | right = Math.max(30, $$.margin.right);
|
21278 |
|
21279 | return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20;
|
21280 | },
|
21281 | getAxisClipHeight: function getAxisClipHeight(forHorizontal) {
|
21282 |
|
21283 | return (forHorizontal ? this.margin.bottom : this.margin.top + this.height) + 20;
|
21284 | },
|
21285 | getXAxisClipWidth: function getXAxisClipWidth() {
|
21286 | var $$ = this;
|
21287 | return $$.getAxisClipWidth(!$$.config.axis_rotated);
|
21288 | },
|
21289 | getXAxisClipHeight: function getXAxisClipHeight() {
|
21290 | var $$ = this;
|
21291 | return $$.getAxisClipHeight(!$$.config.axis_rotated);
|
21292 | },
|
21293 | getYAxisClipWidth: function getYAxisClipWidth() {
|
21294 | var $$ = this;
|
21295 | return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0);
|
21296 | },
|
21297 | getYAxisClipHeight: function getYAxisClipHeight() {
|
21298 | var $$ = this;
|
21299 | return $$.getAxisClipHeight($$.config.axis_rotated);
|
21300 | }
|
21301 | });
|
21302 |
|
21303 |
|
21304 |
|
21305 |
|
21306 |
|
21307 |
|
21308 |
|
21309 |
|
21310 |
|
21311 |
|
21312 | util_extend(ChartInternal_ChartInternal.prototype, {
|
21313 | initRegion: function initRegion() {
|
21314 | var $$ = this;
|
21315 | $$.region = $$.main.append("g").attr("clip-path", $$.clipPath).attr("class", config_classes.regions);
|
21316 | },
|
21317 | updateRegion: function updateRegion(duration) {
|
21318 | var $$ = this,
|
21319 | config = $$.config;
|
21320 |
|
21321 |
|
21322 | $$.region.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.mainRegion = $$.main.select(".".concat(config_classes.regions)).selectAll(".".concat(config_classes.region)).data(config.regions), $$.mainRegion.exit().transition().duration(duration).style("opacity", "0").remove(), $$.mainRegion = $$.mainRegion.enter().append("g").merge($$.mainRegion).attr("class", $$.classRegion.bind($$)), $$.mainRegion.append("rect").style("fill-opacity", "0");
|
21323 | },
|
21324 | redrawRegion: function redrawRegion(withTransition) {
|
21325 | var $$ = this,
|
21326 | regions = $$.mainRegion.select("rect");
|
21327 | return regions = (withTransition ? regions.transition() : regions).attr("x", $$.regionX.bind($$)).attr("y", $$.regionY.bind($$)).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$)), [(withTransition ? regions.transition() : regions).style("fill-opacity", function (d) {
|
21328 | return isValue(d.opacity) ? d.opacity : "0.1";
|
21329 | }).on("end", function () {
|
21330 | src_select(this.parentNode).selectAll("rect:not([x])").remove();
|
21331 | })];
|
21332 | },
|
21333 | getRegionXY: function getRegionXY(type, d) {
|
21334 | var scale,
|
21335 | $$ = this,
|
21336 | config = $$.config,
|
21337 | isRotated = config.axis_rotated,
|
21338 | isX = type === "x",
|
21339 | key = "start",
|
21340 | pos = 0;
|
21341 | return d.axis === "y" || d.axis === "y2" ? (!isX && (key = "end"), (isX ? isRotated : !isRotated) && key in d && (scale = $$[d.axis], pos = scale(d[key]))) : (isX ? !isRotated : isRotated) && key in d && (scale = $$.zoomScale || $$.x, pos = scale($$.isTimeSeries() ? $$.parseDate(d[key]) : d[key])), pos;
|
21342 | },
|
21343 | regionX: function regionX(d) {
|
21344 | return this.getRegionXY("x", d);
|
21345 | },
|
21346 | regionY: function regionY(d) {
|
21347 | return this.getRegionXY("y", d);
|
21348 | },
|
21349 | getRegionSize: function getRegionSize(type, d) {
|
21350 | var scale,
|
21351 | $$ = this,
|
21352 | config = $$.config,
|
21353 | isRotated = config.axis_rotated,
|
21354 | isWidth = type === "width",
|
21355 | start = $$[isWidth ? "regionX" : "regionY"](d),
|
21356 | key = "end",
|
21357 | end = $$[type];
|
21358 | return d.axis === "y" || d.axis === "y2" ? (!isWidth && (key = "start"), (isWidth ? isRotated : !isRotated) && key in d && (scale = $$[d.axis], end = scale(d[key]))) : (isWidth ? !isRotated : isRotated) && key in d && (scale = $$.zoomScale || $$.x, end = scale($$.isTimeSeries() ? $$.parseDate(d[key]) : d[key])), end < start ? 0 : end - start;
|
21359 | },
|
21360 | regionWidth: function regionWidth(d) {
|
21361 | return this.getRegionSize("width", d);
|
21362 | },
|
21363 | regionHeight: function regionHeight(d) {
|
21364 | return this.getRegionSize("height", d);
|
21365 | },
|
21366 | isRegionOnX: function isRegionOnX(d) {
|
21367 | return !d.axis || d.axis === "x";
|
21368 | }
|
21369 | });
|
21370 |
|
21371 |
|
21372 |
|
21373 |
|
21374 |
|
21375 |
|
21376 |
|
21377 |
|
21378 |
|
21379 |
|
21380 |
|
21381 | util_extend(ChartInternal_ChartInternal.prototype, {
|
21382 | |
21383 |
|
21384 |
|
21385 |
|
21386 |
|
21387 |
|
21388 | drag: function drag(mouse) {
|
21389 | var $$ = this,
|
21390 | config = $$.config,
|
21391 | main = $$.main;
|
21392 |
|
21393 | if (!$$.hasArcType() && config.data_selection_enabled && (
|
21394 | !config.zoom_enabled || $$.zoom.altDomain) && config.data_selection_multiple
|
21395 | ) {
|
21396 | var _$$$dragStart = slicedToArray_default()($$.dragStart, 2),
|
21397 | sx = _$$$dragStart[0],
|
21398 | sy = _$$$dragStart[1],
|
21399 | _mouse = slicedToArray_default()(mouse, 2),
|
21400 | mx = _mouse[0],
|
21401 | my = _mouse[1],
|
21402 | minX = Math.min(sx, mx),
|
21403 | maxX = Math.max(sx, mx),
|
21404 | minY = config.data_selection_grouped ? $$.margin.top : Math.min(sy, my),
|
21405 | maxY = config.data_selection_grouped ? $$.height : Math.max(sy, my);
|
21406 |
|
21407 | main.select(".".concat(config_classes.dragarea)).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY), main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).filter(function (d) {
|
21408 | return config.data_selection_isselectable(d);
|
21409 | }).each(function (d, i) {
|
21410 | var toggle,
|
21411 | shape = src_select(this),
|
21412 | isSelected = shape.classed(config_classes.SELECTED),
|
21413 | isIncluded = shape.classed(config_classes.INCLUDED),
|
21414 | isWithin = !1;
|
21415 |
|
21416 | if (shape.classed(config_classes.circle)) {
|
21417 | var x = shape.attr("cx") * 1,
|
21418 | y = shape.attr("cy") * 1;
|
21419 | toggle = $$.togglePoint, isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
21420 | } else if (shape.classed(config_classes.bar)) {
|
21421 | var _getPathBox = getPathBox(this),
|
21422 | _x = _getPathBox.x,
|
21423 | y = _getPathBox.y,
|
21424 | width = _getPathBox.width,
|
21425 | height = _getPathBox.height;
|
21426 |
|
21427 | toggle = $$.togglePath, isWithin = !(maxX < _x || _x + width < minX) && !(maxY < y || y + height < minY);
|
21428 | } else
|
21429 | return;
|
21430 |
|
21431 | isWithin ^ isIncluded && (shape.classed(config_classes.INCLUDED, !isIncluded), shape.classed(config_classes.SELECTED, !isSelected), toggle.call($$, !isSelected, shape, d, i));
|
21432 | });
|
21433 | }
|
21434 | },
|
21435 |
|
21436 | |
21437 |
|
21438 |
|
21439 |
|
21440 |
|
21441 |
|
21442 | dragstart: function dragstart(mouse) {
|
21443 | var $$ = this,
|
21444 | config = $$.config;
|
21445 | $$.hasArcType() || !config.data_selection_enabled || ($$.dragStart = mouse, $$.main.select(".".concat(config_classes.chart)).append("rect").attr("class", config_classes.dragarea).style("opacity", "0.1"), $$.setDragStatus(!0));
|
21446 | },
|
21447 |
|
21448 | |
21449 |
|
21450 |
|
21451 |
|
21452 |
|
21453 | dragend: function dragend() {
|
21454 | var $$ = this,
|
21455 | config = $$.config;
|
21456 | $$.hasArcType() || !config.data_selection_enabled || ($$.main.select(".".concat(config_classes.dragarea)).transition().duration(100).style("opacity", "0").remove(), $$.main.selectAll(".".concat(config_classes.shape)).classed(config_classes.INCLUDED, !1), $$.setDragStatus(!1));
|
21457 | },
|
21458 | setDragStatus: function setDragStatus(isDragging) {
|
21459 | this.dragging = isDragging;
|
21460 | }
|
21461 | });
|
21462 |
|
21463 |
|
21464 |
|
21465 |
|
21466 |
|
21467 |
|
21468 |
|
21469 |
|
21470 |
|
21471 |
|
21472 | util_extend(ChartInternal_ChartInternal.prototype, {
|
21473 | |
21474 |
|
21475 |
|
21476 |
|
21477 |
|
21478 |
|
21479 |
|
21480 | selectPoint: function selectPoint(target, d, i) {
|
21481 | var $$ = this,
|
21482 | config = $$.config,
|
21483 | isRotated = config.axis_rotated,
|
21484 | cx = (isRotated ? $$.circleY : $$.circleX).bind($$),
|
21485 | cy = (isRotated ? $$.circleX : $$.circleY).bind($$),
|
21486 | r = $$.pointSelectR.bind($$);
|
21487 |
|
21488 | callFn(config.data_onselected, $$.api, d, target.node()), $$.main.select(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(d.id))).selectAll(".".concat(config_classes.selectedCircle, "-").concat(i)).data([d]).enter().append("circle").attr("class", function () {
|
21489 | return $$.generateClass(config_classes.selectedCircle, i);
|
21490 | }).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", function (d2) {
|
21491 | return $$.pointSelectR(d2) * 1.4;
|
21492 | }).transition().duration(100).attr("r", r);
|
21493 | },
|
21494 |
|
21495 | |
21496 |
|
21497 |
|
21498 |
|
21499 |
|
21500 |
|
21501 |
|
21502 | unselectPoint: function unselectPoint(target, d, i) {
|
21503 | var $$ = this;
|
21504 |
|
21505 | callFn($$.config.data_onunselected, $$.api, d, target.node()), $$.main.select(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(d.id))).selectAll(".".concat(config_classes.selectedCircle, "-").concat(i)).transition().duration(100).attr("r", 0).remove();
|
21506 | },
|
21507 |
|
21508 | |
21509 |
|
21510 |
|
21511 |
|
21512 |
|
21513 |
|
21514 |
|
21515 |
|
21516 | togglePoint: function togglePoint(selected, target, d, i) {
|
21517 | var method = "".concat(selected ? "" : "un", "selectPoint");
|
21518 | this[method](target, d, i);
|
21519 | },
|
21520 |
|
21521 | |
21522 |
|
21523 |
|
21524 |
|
21525 |
|
21526 |
|
21527 | selectPath: function selectPath(target, d) {
|
21528 | var $$ = this,
|
21529 | config = $$.config;
|
21530 | callFn(config.data_onselected, $$, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () {
|
21531 | return color_rgb($$.color(d)).brighter(.75);
|
21532 | });
|
21533 | },
|
21534 |
|
21535 | |
21536 |
|
21537 |
|
21538 |
|
21539 |
|
21540 |
|
21541 | unselectPath: function unselectPath(target, d) {
|
21542 | var $$ = this,
|
21543 | config = $$.config;
|
21544 | callFn(config.data_onunselected, $$, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () {
|
21545 | return $$.color(d);
|
21546 | });
|
21547 | },
|
21548 |
|
21549 | |
21550 |
|
21551 |
|
21552 |
|
21553 |
|
21554 |
|
21555 |
|
21556 |
|
21557 | togglePath: function togglePath(selected, target, d, i) {
|
21558 | this["".concat(selected ? "" : "un", "selectPath")](target, d, i);
|
21559 | },
|
21560 |
|
21561 | |
21562 |
|
21563 |
|
21564 |
|
21565 |
|
21566 |
|
21567 |
|
21568 | getToggle: function getToggle(that, d) {
|
21569 | var $$ = this;
|
21570 | return that.nodeName === "path" ? $$.togglePath : $$.isStepType(d) ? function () {} :
|
21571 | $$.togglePoint;
|
21572 | },
|
21573 |
|
21574 | |
21575 |
|
21576 |
|
21577 |
|
21578 |
|
21579 |
|
21580 |
|
21581 | toggleShape: function toggleShape(that, d, i) {
|
21582 | var toggledShape,
|
21583 | $$ = this,
|
21584 | config = $$.config,
|
21585 | shape = src_select(that),
|
21586 | isSelected = shape.classed(config_classes.SELECTED),
|
21587 | toggle = $$.getToggle(that, d).bind($$);
|
21588 |
|
21589 | if (config.data_selection_enabled && config.data_selection_isselectable(d)) {
|
21590 | if (!config.data_selection_multiple) {
|
21591 | var selector = ".".concat(config_classes.shapes);
|
21592 | config.data_selection_grouped && (selector += $$.getTargetSelectorSuffix(d.id)), $$.main.selectAll(selector).selectAll(".".concat(config_classes.shape)).each(function (d, i) {
|
21593 | var shape = src_select(this);
|
21594 | shape.classed(config_classes.SELECTED) && (toggledShape = shape, toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i));
|
21595 | });
|
21596 | }
|
21597 |
|
21598 | toggledShape && toggledShape.node() === shape.node() || (shape.classed(config_classes.SELECTED, !isSelected), toggle(!isSelected, shape, d, i));
|
21599 | }
|
21600 | }
|
21601 | });
|
21602 |
|
21603 |
|
21604 |
|
21605 |
|
21606 |
|
21607 |
|
21608 |
|
21609 |
|
21610 |
|
21611 |
|
21612 | util_extend(ChartInternal_ChartInternal.prototype, {
|
21613 | |
21614 |
|
21615 |
|
21616 |
|
21617 | initBrush: function initBrush() {
|
21618 | var $$ = this,
|
21619 | config = $$.config,
|
21620 | isRotated = config.axis_rotated;
|
21621 | $$.brush = isRotated ? brushY() : brushX();
|
21622 |
|
21623 |
|
21624 | var lastDomain,
|
21625 | timeout,
|
21626 | brushHandler = function () {
|
21627 | $$.redrawForBrush();
|
21628 | },
|
21629 | getBrushSize = function () {
|
21630 | var brush = $$.svg.select(".".concat(config_classes.brush, " .overlay")),
|
21631 | brushSize = {
|
21632 | width: 0,
|
21633 | height: 0
|
21634 | };
|
21635 | return brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), brushSize[isRotated ? "width" : "height"];
|
21636 | };
|
21637 |
|
21638 |
|
21639 | $$.brush.on("start", function () {
|
21640 | $$.inputType === "touch" && $$.hideTooltip(), brushHandler();
|
21641 | }).on("brush", brushHandler).on("end", function () {
|
21642 | lastDomain = $$.x.orgDomain();
|
21643 | }), $$.brush.updateResize = function () {
|
21644 | var _this = this;
|
21645 |
|
21646 | timeout && clearTimeout(timeout), timeout = setTimeout(function () {
|
21647 | var selection = _this.getSelection();
|
21648 |
|
21649 | lastDomain && brushSelection(selection.node()) && _this.move(selection, lastDomain.map($$.subX.orgScale()));
|
21650 | }, 0);
|
21651 | }, $$.brush.update = function () {
|
21652 | var extent = this.extent()();
|
21653 | return extent[1].filter(function (v) {
|
21654 | return isNaN(v);
|
21655 | }).length === 0 && $$.context && $$.context.select(".".concat(config_classes.brush)).call(this), this;
|
21656 | }, $$.brush.scale = function (scale) {
|
21657 | var h = config.subchart_size_height || getBrushSize(),
|
21658 | extent = $$.getExtent();
|
21659 |
|
21660 |
|
21661 |
|
21662 | !extent && scale.range ? extent = [[0, 0], [scale.range()[1], h]] : isArray(extent) && (extent = extent.map(function (v, i) {
|
21663 | return [v, i > 0 ? h : i];
|
21664 | })), isRotated && extent[1].reverse(), this.extent(extent), this.update();
|
21665 | }, $$.brush.getSelection = function () {
|
21666 | return $$.context ? $$.context.select(".".concat(config_classes.brush)) : src_select([]);
|
21667 | };
|
21668 | },
|
21669 |
|
21670 | |
21671 |
|
21672 |
|
21673 |
|
21674 | initSubchart: function initSubchart() {
|
21675 | var $$ = this,
|
21676 | config = $$.config,
|
21677 | visibility = config.subchart_show ? "visible" : "hidden",
|
21678 | clipId = "".concat($$.clipId, "-subchart"),
|
21679 | clipPath = $$.getClipPath(clipId);
|
21680 | $$.clipIdForSubchart = clipId, $$.appendClip($$.defs, clipId), $$.initBrush(), $$.context = $$.svg.append("g").attr("transform", $$.getTranslate("context"));
|
21681 | var context = $$.context;
|
21682 |
|
21683 |
|
21684 |
|
21685 |
|
21686 |
|
21687 |
|
21688 | context.style("visibility", visibility), context.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart), $$.hasType("bar") && context.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartBars), context.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartLines), context.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).call($$.brush), $$.axes.subx = context.append("g").attr("class", config_classes.axisX).attr("transform", $$.getTranslate("subx")).attr("clip-path", config.axis_rotated ? "" : $$.clipPathForXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden");
|
21689 | },
|
21690 |
|
21691 | |
21692 |
|
21693 |
|
21694 |
|
21695 |
|
21696 | updateTargetsForSubchart: function updateTargetsForSubchart(targets) {
|
21697 | var $$ = this,
|
21698 | context = $$.context,
|
21699 | config = $$.config,
|
21700 | classChartBar = $$.classChartBar.bind($$),
|
21701 | classBars = $$.classBars.bind($$),
|
21702 | classChartLine = $$.classChartLine.bind($$),
|
21703 | classLines = $$.classLines.bind($$),
|
21704 | classAreas = $$.classAreas.bind($$);
|
21705 |
|
21706 | if (config.subchart_show) {
|
21707 |
|
21708 | var contextBarUpdate = context.select(".".concat(config_classes.chartBars)).selectAll(".".concat(config_classes.chartBar)).data(targets).attr("class", classChartBar),
|
21709 | contextBarEnter = contextBarUpdate.enter().append("g").style("opacity", "0").attr("class", classChartBar).merge(contextBarUpdate);
|
21710 | contextBarEnter.append("g").attr("class", classBars);
|
21711 |
|
21712 | var contextLineUpdate = context.select(".".concat(config_classes.chartLines)).selectAll(".".concat(config_classes.chartLine)).data(targets).attr("class", classChartLine),
|
21713 | contextLineEnter = contextLineUpdate.enter().append("g").style("opacity", "0").attr("class", classChartLine).merge(contextLineUpdate);
|
21714 |
|
21715 |
|
21716 |
|
21717 | contextLineEnter.append("g").attr("class", classLines), $$.hasType("area") && contextLineEnter.append("g").attr("class", classAreas), context.selectAll(".".concat(config_classes.brush, " rect")).attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? $$.width2 : $$.height2);
|
21718 | }
|
21719 | },
|
21720 |
|
21721 | |
21722 |
|
21723 |
|
21724 |
|
21725 |
|
21726 | updateBarForSubchart: function updateBarForSubchart(durationForExit) {
|
21727 | var $$ = this;
|
21728 | $$.contextBar = $$.context.selectAll(".".concat(config_classes.bars)).selectAll(".".concat(config_classes.bar)).data($$.barData.bind($$)), $$.contextBar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextBar = $$.contextBar.enter().append("path").attr("class", $$.classBar.bind($$)).style("stroke", "none").style("fill", $$.color).merge($$.contextBar).style("opacity", $$.initialOpacity.bind($$));
|
21729 | },
|
21730 |
|
21731 | |
21732 |
|
21733 |
|
21734 |
|
21735 |
|
21736 |
|
21737 |
|
21738 | redrawBarForSubchart: function redrawBarForSubchart(drawBarOnSub, withTransition, duration) {
|
21739 | var contextBar = withTransition ? this.contextBar.transition(getRandom()).duration(duration) : this.contextBar;
|
21740 | contextBar.attr("d", drawBarOnSub).style("opacity", "1");
|
21741 | },
|
21742 |
|
21743 | |
21744 |
|
21745 |
|
21746 |
|
21747 |
|
21748 | updateLineForSubchart: function updateLineForSubchart(durationForExit) {
|
21749 | var $$ = this;
|
21750 | $$.contextLine = $$.context.selectAll(".".concat(config_classes.lines)).selectAll(".".concat(config_classes.line)).data($$.lineData.bind($$)), $$.contextLine.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextLine = $$.contextLine.enter().append("path").attr("class", $$.classLine.bind($$)).style("stroke", $$.color).merge($$.contextLine).style("opacity", $$.initialOpacity.bind($$));
|
21751 | },
|
21752 |
|
21753 | |
21754 |
|
21755 |
|
21756 |
|
21757 |
|
21758 |
|
21759 |
|
21760 | redrawLineForSubchart: function redrawLineForSubchart(drawLineOnSub, withTransition, duration) {
|
21761 | var contextLine = withTransition ? this.contextLine.transition(getRandom()).duration(duration) : this.contextLine;
|
21762 | contextLine.attr("d", drawLineOnSub).style("opacity", "1");
|
21763 | },
|
21764 |
|
21765 | |
21766 |
|
21767 |
|
21768 |
|
21769 |
|
21770 | updateAreaForSubchart: function updateAreaForSubchart(durationForExit) {
|
21771 | var $$ = this;
|
21772 | $$.contextArea = $$.context.selectAll(".".concat(config_classes.areas)).selectAll(".".concat(config_classes.area)).data($$.lineData.bind($$)), $$.contextArea.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextArea = $$.contextArea.enter().append("path").attr("class", $$.classArea.bind($$)).style("fill", $$.color).style("opacity", function () {
|
21773 | return $$.orgAreaOpacity = src_select(this).style("opacity"), "0";
|
21774 | }).merge($$.contextArea).style("opacity", "0");
|
21775 | },
|
21776 |
|
21777 | |
21778 |
|
21779 |
|
21780 |
|
21781 |
|
21782 |
|
21783 |
|
21784 | redrawAreaForSubchart: function redrawAreaForSubchart(drawAreaOnSub, withTransition, duration) {
|
21785 | var contextArea = withTransition ? this.contextArea.transition(getRandom()).duration(duration) : this.contextArea;
|
21786 | contextArea.attr("d", drawAreaOnSub).style("fill", this.color).style("opacity", this.orgAreaOpacity);
|
21787 | },
|
21788 |
|
21789 | |
21790 |
|
21791 |
|
21792 |
|
21793 |
|
21794 |
|
21795 |
|
21796 | redrawSubchart: function redrawSubchart(withSubchart, duration, shape) {
|
21797 | var $$ = this,
|
21798 | config = $$.config;
|
21799 | $$.context.style("visibility", config.subchart_show ? "visible" : "hidden"), config.subchart_show && (on_event && on_event.type === "zoom" && $$.brush.update(), withSubchart && (!brushEmpty($$) && $$.brush.update(), Object.keys(shape.type).forEach(function (v) {
|
21800 | var name = capitalize(v),
|
21801 | draw = $$["generateDraw".concat(name)](shape.indices[v], !0);
|
21802 | $$["update".concat(name, "ForSubchart")](duration), $$["redraw".concat(name, "ForSubchart")](draw, duration, duration);
|
21803 | })));
|
21804 | },
|
21805 |
|
21806 | |
21807 |
|
21808 |
|
21809 |
|
21810 | redrawForBrush: function redrawForBrush() {
|
21811 | var $$ = this;
|
21812 | $$.redraw({
|
21813 | withTransition: !1,
|
21814 | withY: $$.config.zoom_rescale,
|
21815 | withSubchart: !1,
|
21816 | withUpdateXDomain: !0,
|
21817 | withDimension: !1
|
21818 | }), $$.config.subchart_onbrush.call($$.api, $$.x.orgDomain());
|
21819 | },
|
21820 |
|
21821 | |
21822 |
|
21823 |
|
21824 |
|
21825 |
|
21826 |
|
21827 | transformContext: function transformContext(withTransition, transitions) {
|
21828 | var subXAxis,
|
21829 | $$ = this;
|
21830 | transitions && transitions.axisSubX ? subXAxis = transitions.axisSubX : (subXAxis = $$.context.select(".".concat(config_classes.axisX)), withTransition && (subXAxis = subXAxis.transition())), $$.context.attr("transform", $$.getTranslate("context")), subXAxis.attr("transform", $$.getTranslate("subx"));
|
21831 | },
|
21832 |
|
21833 | |
21834 |
|
21835 |
|
21836 |
|
21837 |
|
21838 | getExtent: function getExtent() {
|
21839 | var $$ = this,
|
21840 | extent = $$.config.axis_x_extent;
|
21841 | return extent && (isFunction(extent) ? extent = extent($$.getXDomain($$.data.targets), $$.subX) : $$.isTimeSeries() && extent.every(isNaN) && (extent = extent.map(function (v) {
|
21842 | return $$.subX($$.parseDate(v));
|
21843 | }))), extent;
|
21844 | }
|
21845 | });
|
21846 |
|
21847 | var d3_zoom_src_constant = (function(x) {
|
21848 | return function() {
|
21849 | return x;
|
21850 | };
|
21851 | });
|
21852 |
|
21853 |
|
21854 | function ZoomEvent(target, type, transform) {
|
21855 | this.target = target;
|
21856 | this.type = type;
|
21857 | this.transform = transform;
|
21858 | }
|
21859 |
|
21860 |
|
21861 | function Transform(k, x, y) {
|
21862 | this.k = k;
|
21863 | this.x = x;
|
21864 | this.y = y;
|
21865 | }
|
21866 |
|
21867 | Transform.prototype = {
|
21868 | constructor: Transform,
|
21869 | scale: function(k) {
|
21870 | return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
|
21871 | },
|
21872 | translate: function(x, y) {
|
21873 | return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
|
21874 | },
|
21875 | apply: function(point) {
|
21876 | return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
21877 | },
|
21878 | applyX: function(x) {
|
21879 | return x * this.k + this.x;
|
21880 | },
|
21881 | applyY: function(y) {
|
21882 | return y * this.k + this.y;
|
21883 | },
|
21884 | invert: function(location) {
|
21885 | return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
21886 | },
|
21887 | invertX: function(x) {
|
21888 | return (x - this.x) / this.k;
|
21889 | },
|
21890 | invertY: function(y) {
|
21891 | return (y - this.y) / this.k;
|
21892 | },
|
21893 | rescaleX: function(x) {
|
21894 | return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
|
21895 | },
|
21896 | rescaleY: function(y) {
|
21897 | return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
|
21898 | },
|
21899 | toString: function() {
|
21900 | return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
21901 | }
|
21902 | };
|
21903 |
|
21904 | var transform_identity = new Transform(1, 0, 0);
|
21905 |
|
21906 | transform_transform.prototype = Transform.prototype;
|
21907 |
|
21908 | function transform_transform(node) {
|
21909 | return node.__zoom || transform_identity;
|
21910 | }
|
21911 |
|
21912 |
|
21913 |
|
21914 |
|
21915 | function src_noevent_nopropagation() {
|
21916 | on_event.stopImmediatePropagation();
|
21917 | }
|
21918 |
|
21919 | var d3_zoom_src_noevent = (function() {
|
21920 | on_event.preventDefault();
|
21921 | on_event.stopImmediatePropagation();
|
21922 | });
|
21923 |
|
21924 |
|
21925 |
|
21926 |
|
21927 |
|
21928 |
|
21929 |
|
21930 |
|
21931 |
|
21932 |
|
21933 |
|
21934 |
|
21935 |
|
21936 | function zoom_defaultFilter() {
|
21937 | return !on_event.button;
|
21938 | }
|
21939 |
|
21940 | function zoom_defaultExtent() {
|
21941 | var e = this, w, h;
|
21942 | if (e instanceof SVGElement) {
|
21943 | e = e.ownerSVGElement || e;
|
21944 | w = e.width.baseVal.value;
|
21945 | h = e.height.baseVal.value;
|
21946 | } else {
|
21947 | w = e.clientWidth;
|
21948 | h = e.clientHeight;
|
21949 | }
|
21950 | return [[0, 0], [w, h]];
|
21951 | }
|
21952 |
|
21953 | function defaultTransform() {
|
21954 | return this.__zoom || transform_identity;
|
21955 | }
|
21956 |
|
21957 | function defaultWheelDelta() {
|
21958 | return -on_event.deltaY * (on_event.deltaMode ? 120 : 1) / 500;
|
21959 | }
|
21960 |
|
21961 | function zoom_defaultTouchable() {
|
21962 | return "ontouchstart" in this;
|
21963 | }
|
21964 |
|
21965 | function defaultConstrain(transform, extent, translateExtent) {
|
21966 | var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
|
21967 | dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
|
21968 | dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
|
21969 | dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
|
21970 | return transform.translate(
|
21971 | dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
|
21972 | dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
|
21973 | );
|
21974 | }
|
21975 |
|
21976 | var d3_zoom_src_zoom = (function() {
|
21977 | var filter = zoom_defaultFilter,
|
21978 | extent = zoom_defaultExtent,
|
21979 | constrain = defaultConstrain,
|
21980 | wheelDelta = defaultWheelDelta,
|
21981 | touchable = zoom_defaultTouchable,
|
21982 | scaleExtent = [0, Infinity],
|
21983 | translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
|
21984 | duration = 250,
|
21985 | interpolate = src_zoom,
|
21986 | gestures = [],
|
21987 | listeners = src_dispatch("start", "zoom", "end"),
|
21988 | touchstarting,
|
21989 | touchending,
|
21990 | touchDelay = 500,
|
21991 | wheelDelay = 150,
|
21992 | clickDistance2 = 0;
|
21993 |
|
21994 | function zoom(selection) {
|
21995 | selection
|
21996 | .property("__zoom", defaultTransform)
|
21997 | .on("wheel.zoom", wheeled)
|
21998 | .on("mousedown.zoom", mousedowned)
|
21999 | .on("dblclick.zoom", dblclicked)
|
22000 | .filter(touchable)
|
22001 | .on("touchstart.zoom", touchstarted)
|
22002 | .on("touchmove.zoom", touchmoved)
|
22003 | .on("touchend.zoom touchcancel.zoom", touchended)
|
22004 | .style("touch-action", "none")
|
22005 | .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
22006 | }
|
22007 |
|
22008 | zoom.transform = function(collection, transform) {
|
22009 | var selection = collection.selection ? collection.selection() : collection;
|
22010 | selection.property("__zoom", defaultTransform);
|
22011 | if (collection !== selection) {
|
22012 | schedule(collection, transform);
|
22013 | } else {
|
22014 | selection.interrupt().each(function() {
|
22015 | gesture(this, arguments)
|
22016 | .start()
|
22017 | .zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform)
|
22018 | .end();
|
22019 | });
|
22020 | }
|
22021 | };
|
22022 |
|
22023 | zoom.scaleBy = function(selection, k) {
|
22024 | zoom.scaleTo(selection, function() {
|
22025 | var k0 = this.__zoom.k,
|
22026 | k1 = typeof k === "function" ? k.apply(this, arguments) : k;
|
22027 | return k0 * k1;
|
22028 | });
|
22029 | };
|
22030 |
|
22031 | zoom.scaleTo = function(selection, k) {
|
22032 | zoom.transform(selection, function() {
|
22033 | var e = extent.apply(this, arguments),
|
22034 | t0 = this.__zoom,
|
22035 | p0 = centroid(e),
|
22036 | p1 = t0.invert(p0),
|
22037 | k1 = typeof k === "function" ? k.apply(this, arguments) : k;
|
22038 | return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
|
22039 | });
|
22040 | };
|
22041 |
|
22042 | zoom.translateBy = function(selection, x, y) {
|
22043 | zoom.transform(selection, function() {
|
22044 | return constrain(this.__zoom.translate(
|
22045 | typeof x === "function" ? x.apply(this, arguments) : x,
|
22046 | typeof y === "function" ? y.apply(this, arguments) : y
|
22047 | ), extent.apply(this, arguments), translateExtent);
|
22048 | });
|
22049 | };
|
22050 |
|
22051 | zoom.translateTo = function(selection, x, y) {
|
22052 | zoom.transform(selection, function() {
|
22053 | var e = extent.apply(this, arguments),
|
22054 | t = this.__zoom,
|
22055 | p = centroid(e);
|
22056 | return constrain(transform_identity.translate(p[0], p[1]).scale(t.k).translate(
|
22057 | typeof x === "function" ? -x.apply(this, arguments) : -x,
|
22058 | typeof y === "function" ? -y.apply(this, arguments) : -y
|
22059 | ), e, translateExtent);
|
22060 | });
|
22061 | };
|
22062 |
|
22063 | function scale(transform, k) {
|
22064 | k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
|
22065 | return k === transform.k ? transform : new Transform(k, transform.x, transform.y);
|
22066 | }
|
22067 |
|
22068 | function translate(transform, p0, p1) {
|
22069 | var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;
|
22070 | return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
|
22071 | }
|
22072 |
|
22073 | function centroid(extent) {
|
22074 | return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
|
22075 | }
|
22076 |
|
22077 | function schedule(transition, transform, center) {
|
22078 | transition
|
22079 | .on("start.zoom", function() { gesture(this, arguments).start(); })
|
22080 | .on("interrupt.zoom end.zoom", function() { gesture(this, arguments).end(); })
|
22081 | .tween("zoom", function() {
|
22082 | var that = this,
|
22083 | args = arguments,
|
22084 | g = gesture(that, args),
|
22085 | e = extent.apply(that, args),
|
22086 | p = center || centroid(e),
|
22087 | w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
|
22088 | a = that.__zoom,
|
22089 | b = typeof transform === "function" ? transform.apply(that, args) : transform,
|
22090 | i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
|
22091 | return function(t) {
|
22092 | if (t === 1) t = b;
|
22093 | else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }
|
22094 | g.zoom(null, t);
|
22095 | };
|
22096 | });
|
22097 | }
|
22098 |
|
22099 | function gesture(that, args) {
|
22100 | for (var i = 0, n = gestures.length, g; i < n; ++i) {
|
22101 | if ((g = gestures[i]).that === that) {
|
22102 | return g;
|
22103 | }
|
22104 | }
|
22105 | return new Gesture(that, args);
|
22106 | }
|
22107 |
|
22108 | function Gesture(that, args) {
|
22109 | this.that = that;
|
22110 | this.args = args;
|
22111 | this.index = -1;
|
22112 | this.active = 0;
|
22113 | this.extent = extent.apply(that, args);
|
22114 | }
|
22115 |
|
22116 | Gesture.prototype = {
|
22117 | start: function() {
|
22118 | if (++this.active === 1) {
|
22119 | this.index = gestures.push(this) - 1;
|
22120 | this.emit("start");
|
22121 | }
|
22122 | return this;
|
22123 | },
|
22124 | zoom: function(key, transform) {
|
22125 | if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
|
22126 | if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
|
22127 | if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
|
22128 | this.that.__zoom = transform;
|
22129 | this.emit("zoom");
|
22130 | return this;
|
22131 | },
|
22132 | end: function() {
|
22133 | if (--this.active === 0) {
|
22134 | gestures.splice(this.index, 1);
|
22135 | this.index = -1;
|
22136 | this.emit("end");
|
22137 | }
|
22138 | return this;
|
22139 | },
|
22140 | emit: function(type) {
|
22141 | customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);
|
22142 | }
|
22143 | };
|
22144 |
|
22145 | function wheeled() {
|
22146 | if (!filter.apply(this, arguments)) return;
|
22147 | var g = gesture(this, arguments),
|
22148 | t = this.__zoom,
|
22149 | k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
|
22150 | p = src_mouse(this);
|
22151 |
|
22152 |
|
22153 |
|
22154 | if (g.wheel) {
|
22155 | if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
|
22156 | g.mouse[1] = t.invert(g.mouse[0] = p);
|
22157 | }
|
22158 | clearTimeout(g.wheel);
|
22159 | }
|
22160 |
|
22161 |
|
22162 | else if (t.k === k) return;
|
22163 |
|
22164 |
|
22165 | else {
|
22166 | g.mouse = [p, t.invert(p)];
|
22167 | interrupt(this);
|
22168 | g.start();
|
22169 | }
|
22170 |
|
22171 | d3_zoom_src_noevent();
|
22172 | g.wheel = setTimeout(wheelidled, wheelDelay);
|
22173 | g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
|
22174 |
|
22175 | function wheelidled() {
|
22176 | g.wheel = null;
|
22177 | g.end();
|
22178 | }
|
22179 | }
|
22180 |
|
22181 | function mousedowned() {
|
22182 | if (touchending || !filter.apply(this, arguments)) return;
|
22183 | var g = gesture(this, arguments),
|
22184 | v = src_select(on_event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
|
22185 | p = src_mouse(this),
|
22186 | x0 = on_event.clientX,
|
22187 | y0 = on_event.clientY;
|
22188 |
|
22189 | nodrag(on_event.view);
|
22190 | src_noevent_nopropagation();
|
22191 | g.mouse = [p, this.__zoom.invert(p)];
|
22192 | interrupt(this);
|
22193 | g.start();
|
22194 |
|
22195 | function mousemoved() {
|
22196 | d3_zoom_src_noevent();
|
22197 | if (!g.moved) {
|
22198 | var dx = on_event.clientX - x0, dy = on_event.clientY - y0;
|
22199 | g.moved = dx * dx + dy * dy > clickDistance2;
|
22200 | }
|
22201 | g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = src_mouse(g.that), g.mouse[1]), g.extent, translateExtent));
|
22202 | }
|
22203 |
|
22204 | function mouseupped() {
|
22205 | v.on("mousemove.zoom mouseup.zoom", null);
|
22206 | yesdrag(on_event.view, g.moved);
|
22207 | d3_zoom_src_noevent();
|
22208 | g.end();
|
22209 | }
|
22210 | }
|
22211 |
|
22212 | function dblclicked() {
|
22213 | if (!filter.apply(this, arguments)) return;
|
22214 | var t0 = this.__zoom,
|
22215 | p0 = src_mouse(this),
|
22216 | p1 = t0.invert(p0),
|
22217 | k1 = t0.k * (on_event.shiftKey ? 0.5 : 2),
|
22218 | t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
|
22219 |
|
22220 | d3_zoom_src_noevent();
|
22221 | if (duration > 0) src_select(this).transition().duration(duration).call(schedule, t1, p0);
|
22222 | else src_select(this).call(zoom.transform, t1);
|
22223 | }
|
22224 |
|
22225 | function touchstarted() {
|
22226 | if (!filter.apply(this, arguments)) return;
|
22227 | var g = gesture(this, arguments),
|
22228 | touches = on_event.changedTouches,
|
22229 | started,
|
22230 | n = touches.length, i, t, p;
|
22231 |
|
22232 | src_noevent_nopropagation();
|
22233 | for (i = 0; i < n; ++i) {
|
22234 | t = touches[i], p = src_touch(this, touches, t.identifier);
|
22235 | p = [p, this.__zoom.invert(p), t.identifier];
|
22236 | if (!g.touch0) g.touch0 = p, started = true;
|
22237 | else if (!g.touch1) g.touch1 = p;
|
22238 | }
|
22239 |
|
22240 |
|
22241 | if (touchstarting) {
|
22242 | touchstarting = clearTimeout(touchstarting);
|
22243 | if (!g.touch1) {
|
22244 | g.end();
|
22245 | p = src_select(this).on("dblclick.zoom");
|
22246 | if (p) p.apply(this, arguments);
|
22247 | return;
|
22248 | }
|
22249 | }
|
22250 |
|
22251 | if (started) {
|
22252 | touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);
|
22253 | interrupt(this);
|
22254 | g.start();
|
22255 | }
|
22256 | }
|
22257 |
|
22258 | function touchmoved() {
|
22259 | var g = gesture(this, arguments),
|
22260 | touches = on_event.changedTouches,
|
22261 | n = touches.length, i, t, p, l;
|
22262 |
|
22263 | d3_zoom_src_noevent();
|
22264 | if (touchstarting) touchstarting = clearTimeout(touchstarting);
|
22265 | for (i = 0; i < n; ++i) {
|
22266 | t = touches[i], p = src_touch(this, touches, t.identifier);
|
22267 | if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;
|
22268 | else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;
|
22269 | }
|
22270 | t = g.that.__zoom;
|
22271 | if (g.touch1) {
|
22272 | var p0 = g.touch0[0], l0 = g.touch0[1],
|
22273 | p1 = g.touch1[0], l1 = g.touch1[1],
|
22274 | dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,
|
22275 | dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
|
22276 | t = scale(t, Math.sqrt(dp / dl));
|
22277 | p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
|
22278 | l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
|
22279 | }
|
22280 | else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
|
22281 | else return;
|
22282 | g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
|
22283 | }
|
22284 |
|
22285 | function touchended() {
|
22286 | var g = gesture(this, arguments),
|
22287 | touches = on_event.changedTouches,
|
22288 | n = touches.length, i, t;
|
22289 |
|
22290 | src_noevent_nopropagation();
|
22291 | if (touchending) clearTimeout(touchending);
|
22292 | touchending = setTimeout(function() { touchending = null; }, touchDelay);
|
22293 | for (i = 0; i < n; ++i) {
|
22294 | t = touches[i];
|
22295 | if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;
|
22296 | else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;
|
22297 | }
|
22298 | if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;
|
22299 | if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);
|
22300 | else g.end();
|
22301 | }
|
22302 |
|
22303 | zoom.wheelDelta = function(_) {
|
22304 | return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : d3_zoom_src_constant(+_), zoom) : wheelDelta;
|
22305 | };
|
22306 |
|
22307 | zoom.filter = function(_) {
|
22308 | return arguments.length ? (filter = typeof _ === "function" ? _ : d3_zoom_src_constant(!!_), zoom) : filter;
|
22309 | };
|
22310 |
|
22311 | zoom.touchable = function(_) {
|
22312 | return arguments.length ? (touchable = typeof _ === "function" ? _ : d3_zoom_src_constant(!!_), zoom) : touchable;
|
22313 | };
|
22314 |
|
22315 | zoom.extent = function(_) {
|
22316 | return arguments.length ? (extent = typeof _ === "function" ? _ : d3_zoom_src_constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
|
22317 | };
|
22318 |
|
22319 | zoom.scaleExtent = function(_) {
|
22320 | return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
|
22321 | };
|
22322 |
|
22323 | zoom.translateExtent = function(_) {
|
22324 | return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
|
22325 | };
|
22326 |
|
22327 | zoom.constrain = function(_) {
|
22328 | return arguments.length ? (constrain = _, zoom) : constrain;
|
22329 | };
|
22330 |
|
22331 | zoom.duration = function(_) {
|
22332 | return arguments.length ? (duration = +_, zoom) : duration;
|
22333 | };
|
22334 |
|
22335 | zoom.interpolate = function(_) {
|
22336 | return arguments.length ? (interpolate = _, zoom) : interpolate;
|
22337 | };
|
22338 |
|
22339 | zoom.on = function() {
|
22340 | var value = listeners.on.apply(listeners, arguments);
|
22341 | return value === listeners ? zoom : value;
|
22342 | };
|
22343 |
|
22344 | zoom.clickDistance = function(_) {
|
22345 | return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
|
22346 | };
|
22347 |
|
22348 | return zoom;
|
22349 | });
|
22350 |
|
22351 |
|
22352 |
|
22353 |
|
22354 |
|
22355 |
|
22356 |
|
22357 |
|
22358 |
|
22359 |
|
22360 |
|
22361 |
|
22362 |
|
22363 |
|
22364 |
|
22365 |
|
22366 |
|
22367 |
|
22368 |
|
22369 | util_extend(ChartInternal_ChartInternal.prototype, {
|
22370 | |
22371 |
|
22372 |
|
22373 |
|
22374 | initZoom: function initZoom() {
|
22375 | var $$ = this;
|
22376 | $$.zoomScale = null, $$.generateZoom(), $$.initZoomBehaviour();
|
22377 | },
|
22378 |
|
22379 | |
22380 |
|
22381 |
|
22382 |
|
22383 |
|
22384 | bindZoomEvent: function bindZoomEvent() {
|
22385 | var bind = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0],
|
22386 | $$ = this,
|
22387 | zoomEnabled = $$.config.zoom_enabled;
|
22388 | $$.redrawEventRect();
|
22389 | var eventRects = $$.main.select(".".concat(config_classes.eventRects));
|
22390 | zoomEnabled && bind ? $$.bindZoomOnEventRect(eventRects, zoomEnabled.type) : bind === !1 && ($$.api.unzoom(), eventRects.on(".zoom", null).on(".drag", null));
|
22391 | },
|
22392 |
|
22393 | |
22394 |
|
22395 |
|
22396 |
|
22397 | generateZoom: function generateZoom() {
|
22398 | var $$ = this,
|
22399 | config = $$.config,
|
22400 | zoom = d3_zoom_src_zoom().duration(0).on("start", $$.onZoomStart.bind($$)).on("zoom", $$.onZoom.bind($$)).on("end", $$.onZoomEnd.bind($$));
|
22401 |
|
22402 |
|
22403 | |
22404 |
|
22405 |
|
22406 |
|
22407 |
|
22408 | zoom.orgScaleExtent = function () {
|
22409 | var extent = config.zoom_extent || [1, 10];
|
22410 | return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])];
|
22411 | }, zoom.updateScaleExtent = function () {
|
22412 | var ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()),
|
22413 | extent = this.orgScaleExtent();
|
22414 | return this.scaleExtent([extent[0] * ratio, extent[1] * ratio]), this;
|
22415 | }, zoom.updateTransformScale = function (transform) {
|
22416 | $$.orgXScale && $$.orgXScale.range($$.x.range());
|
22417 |
|
22418 | var newScale = transform[config.axis_rotated ? "rescaleY" : "rescaleX"]($$.orgXScale || $$.x),
|
22419 | domain = $$.trimXDomain(newScale.domain()),
|
22420 | rescale = config.zoom_rescale;
|
22421 | newScale.domain(domain, $$.orgXDomain), $$.zoomScale = $$.getCustomizedScale(newScale), $$.xAxis.scale($$.zoomScale), rescale && (!$$.orgXScale && ($$.orgXScale = $$.x.copy()), $$.x.domain(domain));
|
22422 | }, $$.zoom = zoom;
|
22423 | },
|
22424 |
|
22425 | |
22426 |
|
22427 |
|
22428 |
|
22429 | onZoomStart: function onZoomStart() {
|
22430 | var $$ = this,
|
22431 | event = on_event.sourceEvent;
|
22432 | event && ($$.zoom.startEvent = event, callFn($$.config.zoom_onzoomstart, $$.api, event));
|
22433 | },
|
22434 |
|
22435 | |
22436 |
|
22437 |
|
22438 |
|
22439 | onZoom: function onZoom() {
|
22440 | var $$ = this,
|
22441 | config = $$.config,
|
22442 | event = on_event;
|
22443 |
|
22444 | if (config.zoom_enabled && event.sourceEvent && $$.filterTargetsToShow($$.data.targets).length !== 0) {
|
22445 | var isMousemove = event.sourceEvent.type === "mousemove",
|
22446 | isZoomOut = event.sourceEvent.wheelDelta < 0,
|
22447 | transform = event.transform;
|
22448 | !isMousemove && isZoomOut && $$.x.domain().every(function (v, i) {
|
22449 | return v !== $$.orgXDomain[i];
|
22450 | }) && $$.x.domain($$.orgXDomain), $$.zoom.updateTransformScale(transform), $$.isCategorized() && $$.x.orgDomain()[0] === $$.orgXDomain[0] && $$.x.domain([$$.orgXDomain[0] - 1e-10, $$.x.orgDomain()[1]]), $$.redraw({
|
22451 | withTransition: !1,
|
22452 | withY: config.zoom_rescale,
|
22453 | withSubchart: !1,
|
22454 | withEventRect: !1,
|
22455 | withDimension: !1
|
22456 | }), $$.cancelClick = isMousemove, callFn(config.zoom_onzoom, $$.api, $$.zoomScale.domain());
|
22457 | }
|
22458 | },
|
22459 |
|
22460 | |
22461 |
|
22462 |
|
22463 |
|
22464 | onZoomEnd: function onZoomEnd() {
|
22465 | var $$ = this,
|
22466 | startEvent = $$.zoom.startEvent;
|
22467 |
|
22468 | !startEvent || event && startEvent.clientX === event.clientX && startEvent.clientY === event.clientY || ($$.redrawEventRect(), $$.updateZoom(), callFn($$.config.zoom_onzoomend, $$.api, $$[$$.zoomScale ? "zoomScale" : "subX"].domain()));
|
22469 | },
|
22470 |
|
22471 | |
22472 |
|
22473 |
|
22474 |
|
22475 |
|
22476 | getZoomDomain: function getZoomDomain() {
|
22477 | var $$ = this,
|
22478 | config = $$.config,
|
22479 | _$$$orgXDomain = slicedToArray_default()($$.orgXDomain, 2),
|
22480 | min = _$$$orgXDomain[0],
|
22481 | max = _$$$orgXDomain[1];
|
22482 |
|
22483 | return isDefined(config.zoom_x_min) && (min = getMinMax("min", [min, config.zoom_x_min])), isDefined(config.zoom_x_max) && (max = getMinMax("max", [max, config.zoom_x_max])), [min, max];
|
22484 | },
|
22485 |
|
22486 | |
22487 |
|
22488 |
|
22489 |
|
22490 |
|
22491 | updateZoom: function updateZoom(force) {
|
22492 | var $$ = this;
|
22493 |
|
22494 | if ($$.zoomScale) {
|
22495 | var zoomDomain = $$.zoomScale.domain(),
|
22496 | xDomain = $$.subX.domain(),
|
22497 | delta = .015,
|
22498 | isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
|
22499 | (force || isfullyShown) && ($$.xAxis.scale($$.subX), $$.x.domain($$.subX.orgDomain()), $$.zoomScale = null);
|
22500 | }
|
22501 | },
|
22502 |
|
22503 | |
22504 |
|
22505 |
|
22506 |
|
22507 | bindZoomOnEventRect: function bindZoomOnEventRect(eventRects, type) {
|
22508 | var $$ = this,
|
22509 | behaviour = type === "drag" ? $$.zoomBehaviour : $$.zoom;
|
22510 | eventRects.call(behaviour).on("dblclick.zoom", null);
|
22511 | },
|
22512 |
|
22513 | |
22514 |
|
22515 |
|
22516 |
|
22517 | initZoomBehaviour: function initZoomBehaviour() {
|
22518 | var $$ = this,
|
22519 | config = $$.config,
|
22520 | isRotated = config.axis_rotated,
|
22521 | start = 0,
|
22522 | end = 0,
|
22523 | zoomRect = null,
|
22524 | prop = {
|
22525 | axis: isRotated ? "y" : "x",
|
22526 | attr: isRotated ? "height" : "width",
|
22527 | index: isRotated ? 1 : 0
|
22528 | };
|
22529 | $$.zoomBehaviour = src_drag().clickDistance(4).on("start", function () {
|
22530 | $$.setDragStatus(!0), zoomRect || (zoomRect = $$.main.append("rect").attr("clip-path", $$.clipPath).attr("class", config_classes.zoomBrush).attr("width", isRotated ? $$.width : 0).attr("height", isRotated ? 0 : $$.height)), start = src_mouse(this)[prop.index], end = start, zoomRect.attr(prop.axis, start).attr(prop.attr, 0), $$.onZoomStart();
|
22531 | }).on("drag", function () {
|
22532 | end = src_mouse(this)[prop.index], zoomRect.attr(prop.axis, Math.min(start, end)).attr(prop.attr, Math.abs(end - start));
|
22533 | }).on("end", function () {
|
22534 | var _ref,
|
22535 | scale = $$.zoomScale || $$.x;
|
22536 |
|
22537 | if ($$.setDragStatus(!1), zoomRect.attr(prop.axis, 0).attr(prop.attr, 0), start > end && (_ref = [end, start], start = _ref[0], end = _ref[1], _ref), start < 0 && (end += Math.abs(start), start = 0), start !== end) $$.api.zoom([start, end].map(function (v) {
|
22538 | return scale.invert(v);
|
22539 | })), $$.onZoomEnd();else if ($$.isMultipleX()) $$.clickHandlerForMultipleXS.bind(this)($$);else {
|
22540 | var _event = on_event.sourceEvent || on_event,
|
22541 | _ref2 = "clientX" in _event ? [_event.clientX, _event.clientY] : [_event.x, _event.y],
|
22542 | _ref3 = slicedToArray_default()(_ref2, 2),
|
22543 | x = _ref3[0],
|
22544 | y = _ref3[1],
|
22545 | target = browser["document"].elementFromPoint(x, y);
|
22546 |
|
22547 | $$.clickHandlerForSingleX.bind(target)(src_select(target).datum(), $$);
|
22548 | }
|
22549 | });
|
22550 | },
|
22551 | setZoomResetButton: function setZoomResetButton() {
|
22552 | var $$ = this,
|
22553 | config = $$.config,
|
22554 | resetButton = config.zoom_resetButton;
|
22555 | resetButton && config.zoom_enabled.type === "drag" && ($$.zoom.resetBtn ? $$.zoom.resetBtn.style("display", null) : $$.zoom.resetBtn = $$.selectChart.append("div").classed(config_classes.button, !0).append("span").on("click", $$.api.unzoom.bind($$)).classed(config_classes.buttonZoomReset, !0).text(resetButton.text || "Reset Zoom"));
|
22556 | }
|
22557 | });
|
22558 |
|
22559 |
|
22560 |
|
22561 |
|
22562 |
|
22563 |
|
22564 |
|
22565 |
|
22566 |
|
22567 |
|
22568 |
|
22569 |
|
22570 |
|
22571 |
|
22572 |
|
22573 |
|
22574 |
|
22575 |
|
22576 |
|
22577 |
|
22578 |
|
22579 | var colorizePattern = function (pattern, color, id) {
|
22580 | var node = src_select(pattern.cloneNode(!0));
|
22581 | return node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color), {
|
22582 | id: id,
|
22583 | node: node.node()
|
22584 | };
|
22585 | },
|
22586 | schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
|
22587 |
|
22588 |
|
22589 |
|
22590 | util_extend(ChartInternal_ChartInternal.prototype, {
|
22591 | |
22592 |
|
22593 |
|
22594 |
|
22595 |
|
22596 |
|
22597 | getColorFromCss: function getColorFromCss() {
|
22598 | var body = browser["document"].body,
|
22599 | pattern = body["__colorPattern__"];
|
22600 |
|
22601 | if (!pattern) {
|
22602 | var span = browser["document"].createElement("span");
|
22603 | span.className = config_classes.colorPattern, span.style.display = "none", body.appendChild(span);
|
22604 | var content = browser["window"].getComputedStyle(span).backgroundImage;
|
22605 | span.parentNode.removeChild(span), content.indexOf(";") > -1 && (pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) {
|
22606 | return v.trim().replace(/[\"'\s]/g, "");
|
22607 | }).filter(Boolean), body["__colorPattern__"] = pattern);
|
22608 | }
|
22609 |
|
22610 | return pattern;
|
22611 | },
|
22612 | generateColor: function generateColor() {
|
22613 | var $$ = this,
|
22614 | config = $$.config,
|
22615 | colors = config.data_colors,
|
22616 | callback = config.data_color,
|
22617 | ids = [],
|
22618 | pattern = notEmpty(config.color_pattern) ? config.color_pattern : ordinal($$.getColorFromCss() || schemeCategory10).range(),
|
22619 | originalColorPattern = pattern;
|
22620 |
|
22621 | if (isFunction(config.color_tiles)) {
|
22622 | var tiles = config.color_tiles(),
|
22623 | colorizedPatterns = pattern.map(function (p, index) {
|
22624 | var color = p.replace(/[#\(\)\s,]/g, ""),
|
22625 | id = "".concat($$.datetimeId, "-pattern-").concat(color, "-").concat(index);
|
22626 | return colorizePattern(tiles[index % tiles.length], p, id);
|
22627 | });
|
22628 |
|
22629 | pattern = colorizedPatterns.map(function (p) {
|
22630 | return "url(#".concat(p.id, ")");
|
22631 | }), $$.patterns = colorizedPatterns;
|
22632 | }
|
22633 |
|
22634 | return function (d) {
|
22635 | var color,
|
22636 | id = d.id || d.data && d.data.id || d,
|
22637 | isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !$$.config.data_types[id];
|
22638 | return isFunction(colors[id]) ? color = colors[id](d) : colors[id] ? color = colors[id] : (ids.indexOf(id) < 0 && ids.push(id), color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length], colors[id] = color), isFunction(callback) ? callback(color, d) : color;
|
22639 | };
|
22640 | },
|
22641 | generateLevelColor: function generateLevelColor() {
|
22642 | var $$ = this,
|
22643 | config = $$.config,
|
22644 | colors = config.color_pattern,
|
22645 | threshold = config.color_threshold,
|
22646 | asValue = threshold.unit === "value",
|
22647 | max = threshold.max || 100,
|
22648 | values = threshold.values && threshold.values.length ? threshold.values : [];
|
22649 | return notEmpty(threshold) ? function (value) {
|
22650 | var v = asValue ? value : value * 100 / max,
|
22651 | color = colors[colors.length - 1];
|
22652 |
|
22653 | for (var i = 0, l = values.length; i < l; i++) if (v <= values[i]) {
|
22654 | color = colors[i];
|
22655 | break;
|
22656 | }
|
22657 |
|
22658 | return color;
|
22659 | } : null;
|
22660 | },
|
22661 |
|
22662 | |
22663 |
|
22664 |
|
22665 |
|
22666 |
|
22667 |
|
22668 |
|
22669 | setOverColor: function setOverColor(isOver, d) {
|
22670 | var $$ = this,
|
22671 | config = $$.config,
|
22672 | onover = config.color_onover,
|
22673 | color = isOver ? onover : $$.color;
|
22674 | isObject(color) ? color = function (d) {
|
22675 | var id = d.id;
|
22676 | return id in onover ? onover[id] : $$.color(id);
|
22677 | } : isString(color) && (color = function () {
|
22678 | return onover;
|
22679 | }), isObject(d) ? $$.main.selectAll(".".concat(config_classes.arc, "-").concat(d.id)).style("fill", color(d)) : $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).each(function (d) {
|
22680 | var val = color(d);
|
22681 | this.style.stroke = val, this.style.fill = val;
|
22682 | });
|
22683 | }
|
22684 | });
|
22685 |
|
22686 |
|
22687 |
|
22688 |
|
22689 |
|
22690 |
|
22691 |
|
22692 |
|
22693 | var getFormat = function ($$, typeValue, v) {
|
22694 | var config = $$.config,
|
22695 | type = "axis_".concat(typeValue, "_tick_format"),
|
22696 | format = config[type] ? config[type] : $$.defaultValueFormat;
|
22697 | return format(v);
|
22698 | };
|
22699 |
|
22700 | util_extend(ChartInternal_ChartInternal.prototype, {
|
22701 | getYFormat: function getYFormat(forArc) {
|
22702 | var $$ = this,
|
22703 | formatForY = $$.yFormat,
|
22704 | formatForY2 = $$.y2Format;
|
22705 | return forArc && !$$.hasType("gauge") && (formatForY = $$.defaultArcValueFormat, formatForY2 = $$.defaultArcValueFormat), function (v, ratio, id) {
|
22706 | var format = $$.axis.getId(id) === "y2" ? formatForY2 : formatForY;
|
22707 | return format.call($$, v, ratio);
|
22708 | };
|
22709 | },
|
22710 | yFormat: function yFormat(v) {
|
22711 | return getFormat(this, "y", v);
|
22712 | },
|
22713 | y2Format: function y2Format(v) {
|
22714 | return getFormat(this, "y2", v);
|
22715 | },
|
22716 | defaultValueFormat: function defaultValueFormat(v) {
|
22717 | return isValue(v) ? +v : "";
|
22718 | },
|
22719 | defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
22720 | return "".concat((ratio * 100).toFixed(1), "%");
|
22721 | },
|
22722 | dataLabelFormat: function dataLabelFormat(targetId) {
|
22723 | var $$ = this,
|
22724 | dataLabels = $$.config.data_labels,
|
22725 | defaultFormat = function (v) {
|
22726 | return isValue(v) ? +v : "";
|
22727 | },
|
22728 | format = defaultFormat;
|
22729 |
|
22730 | return isFunction(dataLabels.format) ? format = dataLabels.format : isObjectType(dataLabels.format) && (dataLabels.format[targetId] ? format = dataLabels.format[targetId] === !0 ? defaultFormat : dataLabels.format[targetId] : format = function () {
|
22731 | return "";
|
22732 | }), format;
|
22733 | }
|
22734 | });
|
22735 |
|
22736 |
|
22737 |
|
22738 |
|
22739 |
|
22740 |
|
22741 |
|
22742 | util_extend(ChartInternal_ChartInternal.prototype, {
|
22743 | |
22744 |
|
22745 |
|
22746 |
|
22747 |
|
22748 |
|
22749 |
|
22750 | addCache: function addCache(key, value) {
|
22751 | var isDataType = !!(arguments.length > 2 && arguments[2] !== undefined) && arguments[2];
|
22752 | this.cache[key] = isDataType ? this.cloneTarget(value) : value;
|
22753 | },
|
22754 |
|
22755 | |
22756 |
|
22757 |
|
22758 |
|
22759 |
|
22760 | removeCache: function removeCache(key) {
|
22761 | var _this = this;
|
22762 |
|
22763 | toArray(key).forEach(function (v) {
|
22764 | return delete _this.cache[v];
|
22765 | });
|
22766 | },
|
22767 |
|
22768 | |
22769 |
|
22770 |
|
22771 |
|
22772 |
|
22773 |
|
22774 |
|
22775 | getCache: function getCache(key) {
|
22776 | var isDataType = !!(arguments.length > 1 && arguments[1] !== undefined) && arguments[1];
|
22777 |
|
22778 | if (isDataType) {
|
22779 | var targets = [];
|
22780 |
|
22781 | for (var id, i = 0; id = key[i]; i++) id in this.cache && targets.push(this.cloneTarget(this.cache[id]));
|
22782 |
|
22783 | return targets;
|
22784 | }
|
22785 |
|
22786 | return this.cache[key] || null;
|
22787 | },
|
22788 |
|
22789 | |
22790 |
|
22791 |
|
22792 |
|
22793 |
|
22794 | resetCache: function resetCache(all) {
|
22795 | var $$ = this;
|
22796 |
|
22797 | for (var x in $$.cache) (all || /^\$/.test(x)) && ($$.cache[x] = null);
|
22798 | }
|
22799 | });
|
22800 |
|
22801 |
|
22802 |
|
22803 |
|
22804 |
|
22805 |
|
22806 |
|
22807 |
|
22808 | util_extend(ChartInternal_ChartInternal.prototype, {
|
22809 | generateClass: function generateClass(prefix, targetId) {
|
22810 | return " ".concat(prefix, " ").concat(prefix + this.getTargetSelectorSuffix(targetId));
|
22811 | },
|
22812 | classText: function classText(d) {
|
22813 | return this.generateClass(config_classes.text, d.index);
|
22814 | },
|
22815 | classTexts: function classTexts(d) {
|
22816 | return this.generateClass(config_classes.texts, d.id);
|
22817 | },
|
22818 | classShape: function classShape(d) {
|
22819 | return this.generateClass(config_classes.shape, d.index);
|
22820 | },
|
22821 | classShapes: function classShapes(d) {
|
22822 | return this.generateClass(config_classes.shapes, d.id);
|
22823 | },
|
22824 | generateExtraLineClass: function generateExtraLineClass() {
|
22825 | var $$ = this,
|
22826 | classes = $$.config.line_classes || [],
|
22827 | ids = [];
|
22828 | return function (d) {
|
22829 | var id = d.id || d.data && d.data.id || d;
|
22830 | return ids.indexOf(id) < 0 && ids.push(id), classes[ids.indexOf(id) % classes.length];
|
22831 | };
|
22832 | },
|
22833 | classLine: function classLine(d) {
|
22834 | return this.classShape(d) + this.generateClass(config_classes.line, d.id);
|
22835 | },
|
22836 | classLines: function classLines(d) {
|
22837 | return this.classShapes(d) + this.generateClass(config_classes.lines, d.id);
|
22838 | },
|
22839 | classCircle: function classCircle(d) {
|
22840 | return this.classShape(d) + this.generateClass(config_classes.circle, d.index);
|
22841 | },
|
22842 | classCircles: function classCircles(d) {
|
22843 | return this.classShapes(d) + this.generateClass(config_classes.circles, d.id);
|
22844 | },
|
22845 | classBar: function classBar(d) {
|
22846 | return this.classShape(d) + this.generateClass(config_classes.bar, d.index);
|
22847 | },
|
22848 | classBars: function classBars(d) {
|
22849 | return this.classShapes(d) + this.generateClass(config_classes.bars, d.id);
|
22850 | },
|
22851 | classArc: function classArc(d) {
|
22852 | return this.classShape(d.data) + this.generateClass(config_classes.arc, d.data.id);
|
22853 | },
|
22854 | classArcs: function classArcs(d) {
|
22855 | return this.classShapes(d.data) + this.generateClass(config_classes.arcs, d.data.id);
|
22856 | },
|
22857 | classArea: function classArea(d) {
|
22858 | return this.classShape(d) + this.generateClass(config_classes.area, d.id);
|
22859 | },
|
22860 | classAreas: function classAreas(d) {
|
22861 | return this.classShapes(d) + this.generateClass(config_classes.areas, d.id);
|
22862 | },
|
22863 | classRegion: function classRegion(d, i) {
|
22864 | return "".concat(this.generateClass(config_classes.region, i), " ").concat("class" in d ? d["class"] : "");
|
22865 | },
|
22866 | classEvent: function classEvent(d) {
|
22867 | return this.generateClass(config_classes.eventRect, d.index);
|
22868 | },
|
22869 | classTarget: function classTarget(id) {
|
22870 | var additionalClassSuffix = this.config.data_classes[id],
|
22871 | additionalClass = "";
|
22872 | return additionalClassSuffix && (additionalClass = " ".concat(config_classes.target, "-").concat(additionalClassSuffix)), this.generateClass(config_classes.target, id) + additionalClass;
|
22873 | },
|
22874 | classFocus: function classFocus(d) {
|
22875 | return this.classFocused(d) + this.classDefocused(d);
|
22876 | },
|
22877 | classFocused: function classFocused(d) {
|
22878 | return " ".concat(this.focusedTargetIds.indexOf(d.id) >= 0 ? config_classes.focused : "");
|
22879 | },
|
22880 | classDefocused: function classDefocused(d) {
|
22881 | return " ".concat(this.defocusedTargetIds.indexOf(d.id) >= 0 ? config_classes.defocused : "");
|
22882 | },
|
22883 | classChartText: function classChartText(d) {
|
22884 | return config_classes.chartText + this.classTarget(d.id);
|
22885 | },
|
22886 | classChartLine: function classChartLine(d) {
|
22887 | return config_classes.chartLine + this.classTarget(d.id);
|
22888 | },
|
22889 | classChartBar: function classChartBar(d) {
|
22890 | return config_classes.chartBar + this.classTarget(d.id);
|
22891 | },
|
22892 | classChartArc: function classChartArc(d) {
|
22893 | return config_classes.chartArc + this.classTarget(d.data.id);
|
22894 | },
|
22895 | classChartRadar: function classChartRadar(d) {
|
22896 | return config_classes.chartRadar + this.classTarget(d.id);
|
22897 | },
|
22898 | getTargetSelectorSuffix: function getTargetSelectorSuffix(targetId) {
|
22899 | return targetId || targetId === 0 ? "-".concat(targetId).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, "-") : "";
|
22900 | },
|
22901 | selectorTarget: function selectorTarget(id, prefix) {
|
22902 | return "".concat(prefix || "", ".").concat(config_classes.target + this.getTargetSelectorSuffix(id));
|
22903 | },
|
22904 | selectorTargets: function selectorTargets(idsValue, prefix) {
|
22905 | var $$ = this,
|
22906 | ids = idsValue || [];
|
22907 | return ids.length ? ids.map(function (id) {
|
22908 | return $$.selectorTarget(id, prefix);
|
22909 | }) : null;
|
22910 | },
|
22911 | selectorLegend: function selectorLegend(id) {
|
22912 | return ".".concat(config_classes.legendItem + this.getTargetSelectorSuffix(id));
|
22913 | },
|
22914 | selectorLegends: function selectorLegends(ids) {
|
22915 | var $$ = this;
|
22916 | return ids && ids.length ? ids.map(function (id) {
|
22917 | return $$.selectorLegend(id);
|
22918 | }) : null;
|
22919 | }
|
22920 | });
|
22921 |
|
22922 |
|
22923 |
|
22924 |
|
22925 |
|
22926 |
|
22927 |
|
22928 |
|
22929 |
|
22930 | util_extend(Chart_Chart.prototype, {
|
22931 | |
22932 |
|
22933 |
|
22934 |
|
22935 |
|
22936 |
|
22937 |
|
22938 |
|
22939 |
|
22940 |
|
22941 |
|
22942 |
|
22943 |
|
22944 |
|
22945 |
|
22946 |
|
22947 |
|
22948 | focus: function focus(targetIdsValue) {
|
22949 | var $$ = this.internal,
|
22950 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
22951 | candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
22952 | this.revert(), this.defocus(), candidates.classed(config_classes.focused, !0).classed(config_classes.defocused, !1), $$.hasArcType() && $$.expandArc(targetIds), $$.toggleFocusLegend(targetIds, !0), $$.focusedTargetIds = targetIds, $$.defocusedTargetIds = $$.defocusedTargetIds.filter(function (id) {
|
22953 | return targetIds.indexOf(id) < 0;
|
22954 | });
|
22955 | },
|
22956 |
|
22957 | |
22958 |
|
22959 |
|
22960 |
|
22961 |
|
22962 |
|
22963 |
|
22964 |
|
22965 |
|
22966 |
|
22967 |
|
22968 |
|
22969 |
|
22970 |
|
22971 |
|
22972 |
|
22973 |
|
22974 | defocus: function defocus(targetIdsValue) {
|
22975 | var $$ = this.internal,
|
22976 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
22977 | candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
22978 | candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !0), $$.hasArcType() && $$.unexpandArc(targetIds), $$.toggleFocusLegend(targetIds, !1), $$.focusedTargetIds = $$.focusedTargetIds.filter(function (id) {
|
22979 | return targetIds.indexOf(id) < 0;
|
22980 | }), $$.defocusedTargetIds = targetIds;
|
22981 | },
|
22982 |
|
22983 | |
22984 |
|
22985 |
|
22986 |
|
22987 |
|
22988 |
|
22989 |
|
22990 |
|
22991 |
|
22992 |
|
22993 |
|
22994 |
|
22995 |
|
22996 |
|
22997 |
|
22998 |
|
22999 |
|
23000 | revert: function revert(targetIdsValue) {
|
23001 | var $$ = this.internal,
|
23002 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
23003 | candidates = $$.svg.selectAll($$.selectorTargets(targetIds));
|
23004 |
|
23005 | candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !1), $$.hasArcType() && $$.unexpandArc(targetIds), $$.config.legend_show && ($$.showLegend(targetIds.filter($$.isLegendToShow.bind($$))), $$.legend.selectAll($$.selectorLegends(targetIds)).filter(function () {
|
23006 | return src_select(this).classed(config_classes.legendItemFocused);
|
23007 | }).classed(config_classes.legendItemFocused, !1)), $$.focusedTargetIds = [], $$.defocusedTargetIds = [];
|
23008 | }
|
23009 | });
|
23010 |
|
23011 |
|
23012 |
|
23013 |
|
23014 |
|
23015 |
|
23016 |
|
23017 | util_extend(Chart_Chart.prototype, {
|
23018 | |
23019 |
|
23020 |
|
23021 |
|
23022 | _showHide: function _showHide(show, targetIdsValue, options) {
|
23023 | var $$ = this.internal,
|
23024 | targetIds = $$.mapToTargetIds(targetIdsValue);
|
23025 | $$["".concat(show ? "remove" : "add", "HiddenTargetIds")](targetIds);
|
23026 | var targets = $$.svg.selectAll($$.selectorTargets(targetIds)),
|
23027 | opacity = show ? "1" : "0";
|
23028 | targets.transition().style("opacity", opacity, "important").call($$.endall, function () {
|
23029 | targets.style("opacity", null).style("opacity", opacity);
|
23030 | }), options.withLegend && $$["".concat(show ? "show" : "hide", "Legend")](targetIds), $$.redraw({
|
23031 | withUpdateOrgXDomain: !0,
|
23032 | withUpdateXDomain: !0,
|
23033 | withLegend: !0
|
23034 | });
|
23035 | },
|
23036 |
|
23037 | |
23038 |
|
23039 |
|
23040 |
|
23041 |
|
23042 |
|
23043 |
|
23044 |
|
23045 |
|
23046 |
|
23047 |
|
23048 |
|
23049 |
|
23050 |
|
23051 |
|
23052 |
|
23053 |
|
23054 |
|
23055 |
|
23056 | show: function show(targetIdsValue) {
|
23057 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
23058 |
|
23059 | this._showHide(!0, targetIdsValue, options);
|
23060 | },
|
23061 |
|
23062 | |
23063 |
|
23064 |
|
23065 |
|
23066 |
|
23067 |
|
23068 |
|
23069 |
|
23070 |
|
23071 |
|
23072 |
|
23073 |
|
23074 |
|
23075 |
|
23076 |
|
23077 |
|
23078 |
|
23079 |
|
23080 |
|
23081 | hide: function hide(targetIdsValue) {
|
23082 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
23083 |
|
23084 | this._showHide(!1, targetIdsValue, options);
|
23085 | },
|
23086 |
|
23087 | |
23088 |
|
23089 |
|
23090 |
|
23091 |
|
23092 |
|
23093 |
|
23094 |
|
23095 |
|
23096 |
|
23097 |
|
23098 |
|
23099 |
|
23100 |
|
23101 |
|
23102 |
|
23103 |
|
23104 |
|
23105 |
|
23106 | toggle: function toggle(targetIds) {
|
23107 | var _this = this,
|
23108 | options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
23109 | $$ = this.internal,
|
23110 | targets = {
|
23111 | show: [],
|
23112 | hide: []
|
23113 | };
|
23114 |
|
23115 |
|
23116 |
|
23117 |
|
23118 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
23119 | return targets[$$.isTargetToShow(id) ? "hide" : "show"].push(id);
|
23120 | }), targets.show.length && this.show(targets.show, options), targets.hide.length && setTimeout(function () {
|
23121 | return _this.hide(targets.hide, options);
|
23122 | }, 0);
|
23123 | }
|
23124 | });
|
23125 |
|
23126 |
|
23127 |
|
23128 |
|
23129 |
|
23130 |
|
23131 |
|
23132 |
|
23133 |
|
23134 |
|
23135 |
|
23136 |
|
23137 |
|
23138 |
|
23139 |
|
23140 |
|
23141 |
|
23142 |
|
23143 | var withinRange = function (domain, range) {
|
23144 | var _range = slicedToArray_default()(range, 2),
|
23145 | min = _range[0],
|
23146 | max = _range[1];
|
23147 |
|
23148 | return domain.every(function (v, i) {
|
23149 | return i === 0 ? v >= min : v <= max;
|
23150 | });
|
23151 | },
|
23152 | api_zoom_zoom = function (domainValue) {
|
23153 | var resultDomain,
|
23154 | $$ = this.internal,
|
23155 | domain = domainValue;
|
23156 |
|
23157 | if ($$.config.zoom_enabled && domain && withinRange(domain, $$.getZoomDomain())) {
|
23158 | var isTimeSeries = $$.isTimeSeries();
|
23159 |
|
23160 | if (isTimeSeries && (domain = domain.map(function (x) {
|
23161 | return $$.parseDate(x);
|
23162 | })), $$.config.subchart_show) {
|
23163 | var xScale = $$.zoomScale || $$.x;
|
23164 | $$.brush.getSelection().call($$.brush.move, [xScale(domain[0]), xScale(domain[1])]), resultDomain = domain;
|
23165 | } else $$.x.domain(domain), $$.zoomScale = $$.x, $$.xAxis.scale($$.zoomScale), resultDomain = $$.zoomScale.orgDomain();
|
23166 |
|
23167 | $$.redraw({
|
23168 | withTransition: !0,
|
23169 | withY: $$.config.zoom_rescale,
|
23170 | withDimension: !1
|
23171 | }), $$.setZoomResetButton(), callFn($$.config.zoom_onzoom, resultDomain);
|
23172 | } else resultDomain = $$.zoomScale ? $$.zoomScale.domain() : $$.x.orgDomain();
|
23173 |
|
23174 | return resultDomain;
|
23175 | };
|
23176 |
|
23177 |
|
23178 |
|
23179 |
|
23180 |
|
23181 |
|
23182 |
|
23183 |
|
23184 |
|
23185 |
|
23186 |
|
23187 |
|
23188 |
|
23189 |
|
23190 |
|
23191 |
|
23192 |
|
23193 |
|
23194 |
|
23195 | util_extend(api_zoom_zoom, {
|
23196 | |
23197 |
|
23198 |
|
23199 |
|
23200 |
|
23201 |
|
23202 |
|
23203 |
|
23204 |
|
23205 |
|
23206 |
|
23207 |
|
23208 |
|
23209 |
|
23210 |
|
23211 |
|
23212 |
|
23213 |
|
23214 | enable: function enable() {
|
23215 | var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "wheel",
|
23216 | $$ = this.internal,
|
23217 | config = $$.config,
|
23218 | enableType = enabled;
|
23219 | enabled && (enableType = isString(enabled) && /^(drag|wheel)$/.test(enabled) ? {
|
23220 | type: enabled
|
23221 | } : enabled), config.zoom_enabled = enableType, $$.zoom ? enabled === !1 && $$.bindZoomEvent(!1) : ($$.initZoom(), $$.bindZoomEvent()), $$.updateAndRedraw();
|
23222 | },
|
23223 |
|
23224 | |
23225 |
|
23226 |
|
23227 |
|
23228 |
|
23229 |
|
23230 |
|
23231 |
|
23232 |
|
23233 |
|
23234 |
|
23235 | max: function max(_max) {
|
23236 | var $$ = this.internal,
|
23237 | config = $$.config;
|
23238 | return (_max === 0 || _max) && (config.zoom_x_max = getMinMax("max", [$$.orgXDomain[1], _max])), config.zoom_x_max;
|
23239 | },
|
23240 |
|
23241 | |
23242 |
|
23243 |
|
23244 |
|
23245 |
|
23246 |
|
23247 |
|
23248 |
|
23249 |
|
23250 |
|
23251 |
|
23252 | min: function min(_min) {
|
23253 | var $$ = this.internal,
|
23254 | config = $$.config;
|
23255 | return (_min === 0 || _min) && (config.zoom_x_min = getMinMax("min", [$$.orgXDomain[0], _min])), config.zoom_x_min;
|
23256 | },
|
23257 |
|
23258 | |
23259 |
|
23260 |
|
23261 |
|
23262 |
|
23263 |
|
23264 |
|
23265 |
|
23266 |
|
23267 |
|
23268 |
|
23269 |
|
23270 |
|
23271 |
|
23272 |
|
23273 |
|
23274 |
|
23275 | range: function range(_range2) {
|
23276 | var zoom = this.zoom;
|
23277 |
|
23278 | if (isObject(_range2)) {
|
23279 | var min = _range2.min,
|
23280 | max = _range2.max;
|
23281 | isDefined(min) && zoom.min(min), isDefined(max) && zoom.max(max);
|
23282 | }
|
23283 |
|
23284 | return {
|
23285 | min: zoom.min(),
|
23286 | max: zoom.max()
|
23287 | };
|
23288 | }
|
23289 | }), util_extend(Chart_Chart.prototype, {
|
23290 | zoom: api_zoom_zoom,
|
23291 |
|
23292 | |
23293 |
|
23294 |
|
23295 |
|
23296 |
|
23297 |
|
23298 |
|
23299 |
|
23300 | unzoom: function unzoom() {
|
23301 | var $$ = this.internal,
|
23302 | config = $$.config;
|
23303 |
|
23304 | if ($$.zoomScale) {
|
23305 | config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(transform_identity), $$.updateZoom(!0), $$.zoom.resetBtn && $$.zoom.resetBtn.style("display", "none");
|
23306 |
|
23307 | var eventRects = $$.main.select(".".concat(config_classes.eventRects));
|
23308 | transform_transform(eventRects.node()) !== transform_identity && $$.zoom.transform(eventRects, transform_identity), $$.redraw({
|
23309 | withTransition: !0,
|
23310 | withUpdateXDomain: !0,
|
23311 | withUpdateOrgXDomain: !0,
|
23312 | withY: config.zoom_rescale
|
23313 | });
|
23314 | }
|
23315 | }
|
23316 | });
|
23317 |
|
23318 |
|
23319 |
|
23320 |
|
23321 |
|
23322 |
|
23323 |
|
23324 | util_extend(Chart_Chart.prototype, {
|
23325 | |
23326 |
|
23327 |
|
23328 |
|
23329 |
|
23330 |
|
23331 |
|
23332 |
|
23333 |
|
23334 |
|
23335 |
|
23336 |
|
23337 |
|
23338 |
|
23339 |
|
23340 |
|
23341 |
|
23342 |
|
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 |
|
23350 |
|
23351 |
|
23352 |
|
23353 |
|
23354 |
|
23355 |
|
23356 |
|
23357 |
|
23358 |
|
23359 |
|
23360 |
|
23361 |
|
23362 |
|
23363 |
|
23364 |
|
23365 |
|
23366 |
|
23367 |
|
23368 |
|
23369 |
|
23370 |
|
23371 |
|
23372 |
|
23373 |
|
23374 |
|
23375 |
|
23376 |
|
23377 |
|
23378 | load: function load(args) {
|
23379 | var $$ = this.internal,
|
23380 | config = $$.config;
|
23381 |
|
23382 |
|
23383 |
|
23384 |
|
23385 |
|
23386 | args.xs && $$.addXs(args.xs), "names" in args && this.data.names(args.names), "classes" in args && Object.keys(args.classes).forEach(function (id) {
|
23387 | config.data_classes[id] = args.classes[id];
|
23388 | }), "categories" in args && $$.isCategorized() && (config.axis_x_categories = args.categories), "axes" in args && Object.keys(args.axes).forEach(function (id) {
|
23389 | config.data_axes[id] = args.axes[id];
|
23390 | }), "colors" in args && Object.keys(args.colors).forEach(function (id) {
|
23391 | config.data_colors[id] = args.colors[id];
|
23392 | }), "unload" in args && args.unload !== !1 ? $$.unload($$.mapToTargetIds(args.unload === !0 ? null : args.unload), function () {
|
23393 | return $$.loadFromArgs(args);
|
23394 | }) : $$.loadFromArgs(args);
|
23395 | },
|
23396 |
|
23397 | |
23398 |
|
23399 |
|
23400 |
|
23401 |
|
23402 |
|
23403 |
|
23404 |
|
23405 |
|
23406 |
|
23407 |
|
23408 |
|
23409 |
|
23410 |
|
23411 |
|
23412 |
|
23413 |
|
23414 |
|
23415 |
|
23416 |
|
23417 |
|
23418 |
|
23419 |
|
23420 | unload: function unload(argsValue) {
|
23421 | var $$ = this.internal,
|
23422 | args = argsValue || {};
|
23423 | isArray(args) ? args = {
|
23424 | ids: args
|
23425 | } : isString(args) && (args = {
|
23426 | ids: [args]
|
23427 | });
|
23428 | var ids = $$.mapToTargetIds(args.ids);
|
23429 | $$.unload(ids, function () {
|
23430 | $$.redraw({
|
23431 | withUpdateOrgXDomain: !0,
|
23432 | withUpdateXDomain: !0,
|
23433 | withLegend: !0
|
23434 | }), $$.removeCache(ids), args.done && args.done();
|
23435 | });
|
23436 | }
|
23437 | });
|
23438 |
|
23439 |
|
23440 |
|
23441 |
|
23442 |
|
23443 |
|
23444 |
|
23445 |
|
23446 |
|
23447 |
|
23448 |
|
23449 |
|
23450 | util_extend(Chart_Chart.prototype, {
|
23451 | |
23452 |
|
23453 |
|
23454 |
|
23455 |
|
23456 |
|
23457 |
|
23458 |
|
23459 |
|
23460 |
|
23461 |
|
23462 |
|
23463 |
|
23464 |
|
23465 |
|
23466 |
|
23467 |
|
23468 |
|
23469 |
|
23470 |
|
23471 |
|
23472 |
|
23473 |
|
23474 |
|
23475 |
|
23476 |
|
23477 |
|
23478 |
|
23479 |
|
23480 |
|
23481 |
|
23482 |
|
23483 |
|
23484 |
|
23485 |
|
23486 |
|
23487 |
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 |
|
23494 |
|
23495 |
|
23496 |
|
23497 |
|
23498 |
|
23499 |
|
23500 | flow: function flow(args) {
|
23501 | var data,
|
23502 | domain,
|
23503 | diff,
|
23504 | to,
|
23505 | $$ = this.internal,
|
23506 | length = 0,
|
23507 | tail = 0;
|
23508 |
|
23509 | if ((args.json || args.rows || args.columns) && (data = $$.convertData(args)), data && $$.isTabVisible()) {
|
23510 | var notfoundIds = [],
|
23511 | orgDataCount = $$.getMaxDataCount(),
|
23512 | targets = $$.convertDataToTargets(data, !0);
|
23513 | $$.data.targets.forEach(function (t) {
|
23514 | for (var found = !1, i = 0; i < targets.length; i++) if (t.id === targets[i].id) {
|
23515 | found = !0, t.values[t.values.length - 1] && (tail = t.values[t.values.length - 1].index + 1), length = targets[i].values.length;
|
23516 |
|
23517 | for (var _j3 = 0; _j3 < length; _j3++) targets[i].values[_j3].index = tail + _j3, $$.isTimeSeries() || (targets[i].values[_j3].x = tail + _j3);
|
23518 |
|
23519 | t.values = t.values.concat(targets[i].values), targets.splice(i, 1);
|
23520 | break;
|
23521 | }
|
23522 |
|
23523 | found || notfoundIds.push(t.id);
|
23524 | }), $$.data.targets.forEach(function (t) {
|
23525 | for (var _i = 0; _i < notfoundIds.length; _i++) if (t.id === notfoundIds[_i]) {
|
23526 | tail = t.values[t.values.length - 1].index + 1;
|
23527 |
|
23528 | for (var _j4 = 0; _j4 < length; _j4++) t.values.push({
|
23529 | id: t.id,
|
23530 | index: tail + _j4,
|
23531 | x: $$.isTimeSeries() ? $$.getOtherTargetX(tail + _j4) : tail + _j4,
|
23532 | value: null
|
23533 | });
|
23534 | }
|
23535 | }), $$.data.targets.length && targets.forEach(function (t) {
|
23536 | for (var missing = [], i = $$.data.targets[0].values[0].index; i < tail; i++) missing.push({
|
23537 | id: t.id,
|
23538 | index: i,
|
23539 | x: $$.isTimeSeries() ? $$.getOtherTargetX(i) : i,
|
23540 | value: null
|
23541 | });
|
23542 |
|
23543 | t.values.forEach(function (v) {
|
23544 | v.index += tail, $$.isTimeSeries() || (v.x += tail);
|
23545 | }), t.values = missing.concat(t.values);
|
23546 | }), $$.data.targets = $$.data.targets.concat(targets);
|
23547 |
|
23548 |
|
23549 |
|
23550 | var baseTarget = $$.data.targets[0],
|
23551 | baseValue = baseTarget.values[0];
|
23552 | isDefined(args.to) ? (length = 0, to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to, baseTarget.values.forEach(function (v) {
|
23553 | v.x < to && length++;
|
23554 | })) : isDefined(args.length) && (length = args.length), orgDataCount ? orgDataCount === 1 && $$.isTimeSeries() && (diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2, domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)]) : (diff = $$.isTimeSeries() ? baseTarget.values.length > 1 ? baseTarget.values[baseTarget.values.length - 1].x - baseValue.x : baseValue.x - $$.getXDomain($$.data.targets)[0] : 1, domain = [baseValue.x - diff, baseValue.x]), domain && $$.updateXDomain(null, !0, !0, !1, domain), $$.updateTargets($$.data.targets), $$.redraw({
|
23555 | flow: {
|
23556 | index: baseValue.index,
|
23557 | length: length,
|
23558 | duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,
|
23559 | done: args.done,
|
23560 | orgDataCount: orgDataCount
|
23561 | },
|
23562 | withLegend: !0,
|
23563 | withTransition: orgDataCount > 1,
|
23564 | withTrimXDomain: !1,
|
23565 | withUpdateXAxis: !0
|
23566 | });
|
23567 | }
|
23568 | }
|
23569 | }), util_extend(ChartInternal_ChartInternal.prototype, {
|
23570 | |
23571 |
|
23572 |
|
23573 |
|
23574 |
|
23575 |
|
23576 |
|
23577 | generateFlow: function generateFlow(args) {
|
23578 | var $$ = this,
|
23579 | config = $$.config;
|
23580 | return function () {
|
23581 | var translateX,
|
23582 | targets = args.targets,
|
23583 | flow = args.flow,
|
23584 | _args$shape$type = args.shape.type,
|
23585 | drawBar = _args$shape$type.bar,
|
23586 | drawLine = _args$shape$type.line,
|
23587 | drawArea = _args$shape$type.area,
|
23588 | _args$shape$pos = args.shape.pos,
|
23589 | cx = _args$shape$pos.cx,
|
23590 | cy = _args$shape$pos.cy,
|
23591 | xForText = _args$shape$pos.xForText,
|
23592 | yForText = _args$shape$pos.yForText,
|
23593 | xv = args.xv,
|
23594 | duration = args.duration,
|
23595 | scaleX = 1,
|
23596 | flowIndex = flow.index,
|
23597 | flowLength = flow.length,
|
23598 | flowStart = $$.getValueOnIndex($$.data.targets[0].values, flowIndex),
|
23599 | flowEnd = $$.getValueOnIndex($$.data.targets[0].values, flowIndex + flowLength),
|
23600 | orgDomain = $$.x.domain(),
|
23601 | durationForFlow = flow.duration || duration,
|
23602 | done = flow.done || function () {},
|
23603 | wait = $$.generateWait(),
|
23604 | xgrid = $$.xgrid || src_selectAll([]),
|
23605 | xgridLines = $$.xgridLines || src_selectAll([]),
|
23606 | mainRegion = $$.mainRegion || src_selectAll([]),
|
23607 | mainText = $$.mainText || src_selectAll([]),
|
23608 | mainBar = $$.mainBar || src_selectAll([]),
|
23609 | mainLine = $$.mainLine || src_selectAll([]),
|
23610 | mainArea = $$.mainArea || src_selectAll([]),
|
23611 | mainCircle = $$.mainCircle || src_selectAll([]);
|
23612 |
|
23613 | $$.flowing = !0, $$.data.targets.forEach(function (d) {
|
23614 | d.values.splice(0, flowLength);
|
23615 | });
|
23616 |
|
23617 | var domain = $$.updateXDomain(targets, !0, !0);
|
23618 |
|
23619 | $$.updateXGrid && $$.updateXGrid(!0), flow.orgDataCount ? flow.orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x) ? translateX = $$.x(orgDomain[0]) - $$.x(domain[0]) : $$.isTimeSeries() ? translateX = $$.x(orgDomain[0]) - $$.x(domain[0]) : translateX = $$.x(flowStart.x) - $$.x(flowEnd.x) : $$.data.targets[0].values.length === 1 ? $$.isTimeSeries() ? (flowStart = $$.getValueOnIndex($$.data.targets[0].values, 0), flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1), translateX = $$.x(flowStart.x) - $$.x(flowEnd.x)) : translateX = diffDomain(domain) / 2 : translateX = $$.x(orgDomain[0]) - $$.x(domain[0]), scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
23620 | var transform = "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
23621 | $$.hideXGridFocus();
|
23622 | var gt = src_transition_transition().ease(linear_linear).duration(durationForFlow);
|
23623 | wait.add([$$.axes.x.transition(gt).call(function (g) {
|
23624 | return $$.xAxis.setTransition(gt).create(g);
|
23625 | }), mainBar.transition(gt).attr("transform", transform), mainLine.transition(gt).attr("transform", transform), mainArea.transition(gt).attr("transform", transform), mainCircle.transition(gt).attr("transform", transform), mainText.transition(gt).attr("transform", transform), mainRegion.filter($$.isRegionOnX).transition(gt).attr("transform", transform), xgrid.transition(gt).attr("transform", transform), xgridLines.transition(gt).attr("transform", transform)]), gt.call(wait, function () {
|
23626 | var shapes = [],
|
23627 | texts = [],
|
23628 | eventRects = [];
|
23629 |
|
23630 |
|
23631 | if (flowLength) {
|
23632 | for (var index, i = 0; i < flowLength; i++) index = flowIndex + i, shapes.push(".".concat(config_classes.shape, "-").concat(index)), texts.push(".".concat(config_classes.text, "-").concat(index)), eventRects.push(".".concat(config_classes.eventRect, "-").concat(index));
|
23633 |
|
23634 | $$.svg.selectAll(".".concat(config_classes.shapes)).selectAll(shapes).remove(), $$.svg.selectAll(".".concat(config_classes.texts)).selectAll(texts).remove(), $$.svg.selectAll(".".concat(config_classes.eventRects)).selectAll(eventRects).remove(), $$.svg.select(".".concat(config_classes.xgrid)).remove();
|
23635 | }
|
23636 |
|
23637 |
|
23638 | if (xgrid.size() && xgrid.attr("transform", null).attr($$.xgridAttr), xgridLines.attr("transform", null), xgridLines.select("line").attr("x1", config.axis_rotated ? 0 : xv).attr("x2", config.axis_rotated ? $$.width : xv), xgridLines.select("text").attr("x", config.axis_rotated ? $$.width : 0).attr("y", xv), mainBar.attr("transform", null).attr("d", drawBar), mainLine.attr("transform", null).attr("d", drawLine), mainArea.attr("transform", null).attr("d", drawArea), mainCircle.attr("transform", null), $$.isCirclePoint()) mainCircle.attr("cx", cx).attr("cy", cy);else {
|
23639 | var xFunc = function (d) {
|
23640 | return cx(d) - config.point_r;
|
23641 | },
|
23642 | yFunc = function (d) {
|
23643 | return cy(d) - config.point_r;
|
23644 | };
|
23645 |
|
23646 | mainCircle.attr("x", xFunc).attr("y", yFunc).attr("cx", cx)
|
23647 | .attr("cy", cy);
|
23648 | }
|
23649 | mainText.attr("transform", null).attr("x", xForText).attr("y", yForText).style("fill-opacity", $$.opacityForText.bind($$)), mainRegion.attr("transform", null), mainRegion.select("rect").filter($$.isRegionOnX).attr("x", $$.regionX.bind($$)).attr("width", $$.regionWidth.bind($$)), config.interaction_enabled && $$.redrawEventRect(), done(), $$.flowing = !1;
|
23650 | });
|
23651 | };
|
23652 | }
|
23653 | });
|
23654 |
|
23655 |
|
23656 |
|
23657 |
|
23658 |
|
23659 |
|
23660 |
|
23661 |
|
23662 |
|
23663 | util_extend(Chart_Chart.prototype, {
|
23664 | |
23665 |
|
23666 |
|
23667 |
|
23668 |
|
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 | selected: function selected(targetId) {
|
23681 | var $$ = this.internal,
|
23682 | dataPoint = [];
|
23683 | return $$.main.selectAll(".".concat(config_classes.shapes + $$.getTargetSelectorSuffix(targetId))).selectAll(".".concat(config_classes.shape)).filter(function () {
|
23684 | return src_select(this).classed(config_classes.SELECTED);
|
23685 | }).each(function (d) {
|
23686 | return dataPoint.push(d);
|
23687 | }), dataPoint;
|
23688 | },
|
23689 |
|
23690 | |
23691 |
|
23692 |
|
23693 |
|
23694 |
|
23695 |
|
23696 |
|
23697 |
|
23698 |
|
23699 |
|
23700 |
|
23701 |
|
23702 |
|
23703 |
|
23704 |
|
23705 |
|
23706 |
|
23707 |
|
23708 |
|
23709 |
|
23710 |
|
23711 |
|
23712 |
|
23713 |
|
23714 | select: function select(ids, indices, resetOther) {
|
23715 | var $$ = this.internal,
|
23716 | config = $$.config;
|
23717 | config.data_selection_enabled && $$.main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).each(function (d, i) {
|
23718 | var shape = src_select(this),
|
23719 | id = d.data ? d.data.id : d.id,
|
23720 | toggle = $$.getToggle(this, d).bind($$),
|
23721 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
23722 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
23723 | isSelected = shape.classed(config_classes.SELECTED);
|
23724 |
|
23725 | shape.classed(config_classes.line) || shape.classed(config_classes.area) || (isTargetId && isTargetIndex ? config.data_selection_isselectable(d) && !isSelected && toggle(!0, shape.classed(config_classes.SELECTED, !0), d, i) : isDefined(resetOther) && resetOther && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i));
|
23726 | });
|
23727 | },
|
23728 |
|
23729 | |
23730 |
|
23731 |
|
23732 |
|
23733 |
|
23734 |
|
23735 |
|
23736 |
|
23737 |
|
23738 |
|
23739 |
|
23740 |
|
23741 |
|
23742 |
|
23743 |
|
23744 |
|
23745 |
|
23746 | unselect: function unselect(ids, indices) {
|
23747 | var $$ = this.internal,
|
23748 | config = $$.config;
|
23749 | config.data_selection_enabled && $$.main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).each(function (d, i) {
|
23750 | var shape = src_select(this),
|
23751 | id = d.data ? d.data.id : d.id,
|
23752 | toggle = $$.getToggle(this, d).bind($$),
|
23753 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
23754 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
23755 | isSelected = shape.classed(config_classes.SELECTED);
|
23756 |
|
23757 | shape.classed(config_classes.line) || shape.classed(config_classes.area) || isTargetId && isTargetIndex && config.data_selection_isselectable(d) && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i);
|
23758 | });
|
23759 | }
|
23760 | });
|
23761 |
|
23762 |
|
23763 |
|
23764 |
|
23765 |
|
23766 |
|
23767 |
|
23768 |
|
23769 |
|
23770 |
|
23771 |
|
23772 |
|
23773 |
|
23774 |
|
23775 |
|
23776 | function transformTo(targetIds, type, optionsForRedraw) {
|
23777 | var $$ = this,
|
23778 | options = optionsForRedraw || {
|
23779 | withTransitionForAxis: !$$.hasArcType()
|
23780 | };
|
23781 |
|
23782 | options.withTransitionForTransform = !1, $$.transiting = !1, $$.setTargetType(targetIds, type), $$.updateTargets($$.data.targets), $$.updateAndRedraw(options);
|
23783 | }
|
23784 |
|
23785 | util_extend(Chart_Chart.prototype, {
|
23786 | |
23787 |
|
23788 |
|
23789 |
|
23790 |
|
23791 |
|
23792 |
|
23793 |
|
23794 |
|
23795 |
|
23796 |
|
23797 |
|
23798 |
|
23799 |
|
23800 |
|
23801 |
|
23802 |
|
23803 | transform: function transform(type, targetIds) {
|
23804 | var $$ = this.internal,
|
23805 | options = ["pie", "donut"].indexOf(type) >= 0 ? {
|
23806 | withTransform: !0
|
23807 | } : null;
|
23808 | transformTo.bind($$)(targetIds, type, options);
|
23809 | }
|
23810 | });
|
23811 |
|
23812 |
|
23813 |
|
23814 |
|
23815 |
|
23816 |
|
23817 |
|
23818 | util_extend(Chart_Chart.prototype, {
|
23819 | |
23820 |
|
23821 |
|
23822 |
|
23823 |
|
23824 |
|
23825 |
|
23826 |
|
23827 |
|
23828 |
|
23829 |
|
23830 |
|
23831 |
|
23832 | groups: function groups(_groups) {
|
23833 | var $$ = this.internal,
|
23834 | config = $$.config;
|
23835 | return isUndefined(_groups) ? config.data_groups : (config.data_groups = _groups, $$.redraw(), config.data_groups);
|
23836 | }
|
23837 | });
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 |
|
23843 |
|
23844 |
|
23845 |
|
23846 |
|
23847 |
|
23848 |
|
23849 |
|
23850 |
|
23851 |
|
23852 |
|
23853 |
|
23854 |
|
23855 |
|
23856 |
|
23857 |
|
23858 |
|
23859 | var xgrids = function (grids) {
|
23860 | var $$ = this.internal,
|
23861 | config = $$.config;
|
23862 | return grids ? (config.grid_x_lines = grids, $$.redrawWithoutRescale(), config.grid_x_lines) : config.grid_x_lines;
|
23863 | };
|
23864 |
|
23865 | util_extend(xgrids, {
|
23866 | |
23867 |
|
23868 |
|
23869 |
|
23870 |
|
23871 |
|
23872 |
|
23873 |
|
23874 |
|
23875 |
|
23876 |
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 |
|
23883 |
|
23884 |
|
23885 | add: function add(grids) {
|
23886 | return this.xgrids(this.internal.config.grid_x_lines.concat(grids || []));
|
23887 | },
|
23888 |
|
23889 | |
23890 |
|
23891 |
|
23892 |
|
23893 |
|
23894 |
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 |
|
23900 |
|
23901 |
|
23902 |
|
23903 |
|
23904 |
|
23905 |
|
23906 |
|
23907 |
|
23908 | remove: function remove(params) {
|
23909 |
|
23910 | this.internal.removeGridLines(params, !0);
|
23911 | }
|
23912 | });
|
23913 |
|
23914 |
|
23915 |
|
23916 |
|
23917 |
|
23918 |
|
23919 |
|
23920 |
|
23921 |
|
23922 |
|
23923 |
|
23924 |
|
23925 |
|
23926 |
|
23927 | var ygrids = function (grids) {
|
23928 | var $$ = this.internal,
|
23929 | config = $$.config;
|
23930 | return grids ? (config.grid_y_lines = grids, $$.redrawWithoutRescale(), config.grid_y_lines) : config.grid_y_lines;
|
23931 | };
|
23932 |
|
23933 | util_extend(ygrids, {
|
23934 | |
23935 |
|
23936 |
|
23937 |
|
23938 |
|
23939 |
|
23940 |
|
23941 |
|
23942 |
|
23943 |
|
23944 |
|
23945 |
|
23946 |
|
23947 |
|
23948 |
|
23949 |
|
23950 |
|
23951 |
|
23952 |
|
23953 | add: function add(grids) {
|
23954 | return this.ygrids(this.internal.config.grid_y_lines.concat(grids || []));
|
23955 | },
|
23956 |
|
23957 | |
23958 |
|
23959 |
|
23960 |
|
23961 |
|
23962 |
|
23963 |
|
23964 |
|
23965 |
|
23966 |
|
23967 |
|
23968 |
|
23969 |
|
23970 |
|
23971 |
|
23972 |
|
23973 |
|
23974 |
|
23975 |
|
23976 | remove: function remove(params) {
|
23977 |
|
23978 | this.internal.removeGridLines(params, !1);
|
23979 | }
|
23980 | }), util_extend(Chart_Chart.prototype, {
|
23981 | xgrids: xgrids,
|
23982 | ygrids: ygrids
|
23983 | });
|
23984 |
|
23985 |
|
23986 |
|
23987 |
|
23988 |
|
23989 |
|
23990 |
|
23991 |
|
23992 |
|
23993 |
|
23994 |
|
23995 |
|
23996 |
|
23997 |
|
23998 |
|
23999 |
|
24000 |
|
24001 |
|
24002 |
|
24003 |
|
24004 |
|
24005 |
|
24006 |
|
24007 | var api_region_regions = function (_regions) {
|
24008 | var $$ = this.internal,
|
24009 | config = $$.config;
|
24010 | return _regions ? (config.regions = _regions, $$.redrawWithoutRescale(), _regions) : config.regions;
|
24011 | };
|
24012 |
|
24013 | util_extend(api_region_regions, {
|
24014 | |
24015 |
|
24016 |
|
24017 |
|
24018 |
|
24019 |
|
24020 |
|
24021 |
|
24022 |
|
24023 |
|
24024 |
|
24025 |
|
24026 |
|
24027 |
|
24028 |
|
24029 |
|
24030 |
|
24031 |
|
24032 |
|
24033 |
|
24034 | add: function add(regions) {
|
24035 | var $$ = this.internal,
|
24036 | config = $$.config;
|
24037 | return regions ? (config.regions = config.regions.concat(regions), $$.redrawWithoutRescale(), config.regions) : config.regions;
|
24038 | },
|
24039 |
|
24040 | |
24041 |
|
24042 |
|
24043 |
|
24044 |
|
24045 |
|
24046 |
|
24047 |
|
24048 |
|
24049 |
|
24050 |
|
24051 |
|
24052 |
|
24053 |
|
24054 |
|
24055 |
|
24056 |
|
24057 |
|
24058 |
|
24059 | remove: function remove(optionsValue) {
|
24060 | var $$ = this.internal,
|
24061 | config = $$.config,
|
24062 | options = optionsValue || {},
|
24063 | duration = getOption(options, "duration", config.transition_duration),
|
24064 | classes = getOption(options, "classes", [config_classes.region]),
|
24065 | regions = $$.main.select(".".concat(config_classes.regions)).selectAll(classes.map(function (c) {
|
24066 | return ".".concat(c);
|
24067 | }));
|
24068 | return (duration ? regions.transition().duration(duration) : regions).style("opacity", "0").remove(), regions = config.regions, Object.keys(options).length ? (regions = regions.filter(function (region) {
|
24069 | var found = !1;
|
24070 | return !region["class"] || (region["class"].split(" ").forEach(function (c) {
|
24071 | classes.indexOf(c) >= 0 && (found = !0);
|
24072 | }), !found);
|
24073 | }), config.regions = regions) : config.regions = [], regions;
|
24074 | }
|
24075 | }), util_extend(Chart_Chart.prototype, {
|
24076 | regions: api_region_regions
|
24077 | });
|
24078 |
|
24079 |
|
24080 |
|
24081 |
|
24082 |
|
24083 |
|
24084 |
|
24085 |
|
24086 |
|
24087 |
|
24088 |
|
24089 |
|
24090 |
|
24091 |
|
24092 |
|
24093 |
|
24094 |
|
24095 |
|
24096 |
|
24097 |
|
24098 |
|
24099 |
|
24100 |
|
24101 |
|
24102 |
|
24103 |
|
24104 | var api_data_data = function (targetIds) {
|
24105 | var targets = this.internal.data.targets;
|
24106 | return isUndefined(targetIds) ? targets : targets.filter(function (t) {
|
24107 | return targetIds.indexOf(t.id) >= 0;
|
24108 | });
|
24109 | };
|
24110 |
|
24111 | util_extend(api_data_data, {
|
24112 | |
24113 |
|
24114 |
|
24115 |
|
24116 |
|
24117 |
|
24118 |
|
24119 |
|
24120 |
|
24121 |
|
24122 |
|
24123 |
|
24124 |
|
24125 |
|
24126 |
|
24127 |
|
24128 |
|
24129 |
|
24130 | shown: function shown(targetIds) {
|
24131 | return this.internal.filterTargetsToShow(this.data(targetIds));
|
24132 | },
|
24133 |
|
24134 | |
24135 |
|
24136 |
|
24137 |
|
24138 |
|
24139 |
|
24140 |
|
24141 |
|
24142 |
|
24143 |
|
24144 |
|
24145 |
|
24146 | values: function (targetId) {
|
24147 | var flat = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
24148 | values = null;
|
24149 |
|
24150 | if (targetId) {
|
24151 | var targets = this.data(targetId);
|
24152 | targets && isArray(targets) && (values = [], targets.forEach(function (v) {
|
24153 | var dataValue = v.values.map(function (d) {
|
24154 | return d.value;
|
24155 | });
|
24156 | flat ? values = values.concat(dataValue) : values.push(dataValue);
|
24157 | }));
|
24158 | }
|
24159 |
|
24160 | return values;
|
24161 | },
|
24162 |
|
24163 | |
24164 |
|
24165 |
|
24166 |
|
24167 |
|
24168 |
|
24169 |
|
24170 |
|
24171 |
|
24172 |
|
24173 |
|
24174 |
|
24175 |
|
24176 |
|
24177 |
|
24178 |
|
24179 |
|
24180 |
|
24181 | names: function names(_names) {
|
24182 | return this.internal.clearLegendItemTextBoxCache(), this.internal.updateDataAttributes("names", _names);
|
24183 | },
|
24184 |
|
24185 | |
24186 |
|
24187 |
|
24188 |
|
24189 |
|
24190 |
|
24191 |
|
24192 |
|
24193 |
|
24194 |
|
24195 |
|
24196 |
|
24197 |
|
24198 |
|
24199 |
|
24200 |
|
24201 |
|
24202 |
|
24203 | colors: function colors(_colors) {
|
24204 | return this.internal.updateDataAttributes("colors", _colors);
|
24205 | },
|
24206 |
|
24207 | |
24208 |
|
24209 |
|
24210 |
|
24211 |
|
24212 |
|
24213 |
|
24214 |
|
24215 |
|
24216 |
|
24217 |
|
24218 |
|
24219 |
|
24220 |
|
24221 |
|
24222 |
|
24223 |
|
24224 |
|
24225 | axes: function axes(_axes) {
|
24226 | return this.internal.updateDataAttributes("axes", _axes);
|
24227 | },
|
24228 |
|
24229 | |
24230 |
|
24231 |
|
24232 |
|
24233 |
|
24234 |
|
24235 |
|
24236 |
|
24237 |
|
24238 |
|
24239 |
|
24240 | min: function min() {
|
24241 | return this.internal.getMinMaxData().min;
|
24242 | },
|
24243 |
|
24244 | |
24245 |
|
24246 |
|
24247 |
|
24248 |
|
24249 |
|
24250 |
|
24251 |
|
24252 |
|
24253 |
|
24254 |
|
24255 | max: function max() {
|
24256 | return this.internal.getMinMaxData().max;
|
24257 | }
|
24258 | }), util_extend(Chart_Chart.prototype, {
|
24259 | data: api_data_data
|
24260 | });
|
24261 |
|
24262 |
|
24263 |
|
24264 |
|
24265 |
|
24266 |
|
24267 |
|
24268 | util_extend(Chart_Chart.prototype, {
|
24269 | |
24270 |
|
24271 |
|
24272 |
|
24273 |
|
24274 |
|
24275 |
|
24276 |
|
24277 |
|
24278 |
|
24279 | category: function category(i, _category) {
|
24280 | var $$ = this.internal,
|
24281 | config = $$.config;
|
24282 | return arguments.length > 1 && (config.axis_x_categories[i] = _category, $$.redraw()), config.axis_x_categories[i];
|
24283 | },
|
24284 |
|
24285 | |
24286 |
|
24287 |
|
24288 |
|
24289 |
|
24290 |
|
24291 |
|
24292 |
|
24293 |
|
24294 |
|
24295 |
|
24296 | categories: function categories(_categories) {
|
24297 | var $$ = this.internal,
|
24298 | config = $$.config;
|
24299 | return arguments.length ? (config.axis_x_categories = _categories, $$.redraw(), config.axis_x_categories) : config.axis_x_categories;
|
24300 | }
|
24301 | });
|
24302 |
|
24303 |
|
24304 |
|
24305 |
|
24306 |
|
24307 |
|
24308 |
|
24309 | util_extend(Chart_Chart.prototype, {
|
24310 | |
24311 |
|
24312 |
|
24313 |
|
24314 |
|
24315 |
|
24316 |
|
24317 |
|
24318 |
|
24319 | color: function color(id) {
|
24320 | return this.internal.color(id);
|
24321 | }
|
24322 | });
|
24323 |
|
24324 |
|
24325 |
|
24326 |
|
24327 |
|
24328 |
|
24329 |
|
24330 | util_extend(Chart_Chart.prototype, {
|
24331 | |
24332 |
|
24333 |
|
24334 |
|
24335 |
|
24336 |
|
24337 |
|
24338 |
|
24339 |
|
24340 |
|
24341 |
|
24342 |
|
24343 |
|
24344 |
|
24345 | x: function x(_x) {
|
24346 | var $$ = this.internal,
|
24347 | isCategorized = $$.isCustomX() && $$.isCategorized();
|
24348 | return isArray(_x) && (isCategorized ? $$.api.categories(_x) : ($$.updateTargetX($$.data.targets, _x), $$.redraw({
|
24349 | withUpdateOrgXDomain: !0,
|
24350 | withUpdateXDomain: !0
|
24351 | }))), isCategorized ? $$.api.categories() : $$.data.xs;
|
24352 | },
|
24353 |
|
24354 | |
24355 |
|
24356 |
|
24357 |
|
24358 |
|
24359 |
|
24360 |
|
24361 |
|
24362 |
|
24363 |
|
24364 |
|
24365 |
|
24366 |
|
24367 |
|
24368 |
|
24369 |
|
24370 |
|
24371 | xs: function xs(_xs) {
|
24372 | var $$ = this.internal;
|
24373 | return isObject(_xs) && ($$.updateTargetXs($$.data.targets, _xs), $$.redraw({
|
24374 | withUpdateOrgXDomain: !0,
|
24375 | withUpdateXDomain: !0
|
24376 | })), $$.data.xs;
|
24377 | }
|
24378 | });
|
24379 |
|
24380 |
|
24381 |
|
24382 |
|
24383 |
|
24384 |
|
24385 |
|
24386 |
|
24387 |
|
24388 |
|
24389 |
|
24390 |
|
24391 |
|
24392 |
|
24393 |
|
24394 |
|
24395 | var setMinMax = function ($$, type, value) {
|
24396 | var config = $$.config,
|
24397 | axisX = "axis_x_".concat(type),
|
24398 | axisY = "axis_y_".concat(type),
|
24399 | axisY2 = "axis_y2_".concat(type);
|
24400 | return isDefined(value) && (isObjectType(value) ? (isValue(value.x) && (config[axisX] = value.x), isValue(value.y) && (config[axisY] = value.y), isValue(value.y2) && (config[axisY2] = value.y2)) : (config[axisY] = value, config[axisY2] = value), $$.redraw({
|
24401 | withUpdateOrgXDomain: !0,
|
24402 | withUpdateXDomain: !0
|
24403 | })), undefined;
|
24404 | },
|
24405 | api_axis_getMinMax = function ($$, type) {
|
24406 | var config = $$.config;
|
24407 | return {
|
24408 | x: config["axis_x_".concat(type)],
|
24409 | y: config["axis_y_".concat(type)],
|
24410 | y2: config["axis_y2_".concat(type)]
|
24411 | };
|
24412 | },
|
24413 | api_axis_axis = util_extend(function () {}, {
|
24414 | |
24415 |
|
24416 |
|
24417 |
|
24418 |
|
24419 |
|
24420 |
|
24421 |
|
24422 |
|
24423 |
|
24424 |
|
24425 |
|
24426 |
|
24427 | labels: function labels(_labels) {
|
24428 | var $$ = this.internal;
|
24429 | arguments.length && (Object.keys(_labels).forEach(function (axisId) {
|
24430 | $$.axis.setLabelText(axisId, _labels[axisId]);
|
24431 | }), $$.axis.updateLabels());
|
24432 | },
|
24433 |
|
24434 | |
24435 |
|
24436 |
|
24437 |
|
24438 |
|
24439 |
|
24440 |
|
24441 |
|
24442 |
|
24443 |
|
24444 |
|
24445 |
|
24446 |
|
24447 |
|
24448 |
|
24449 |
|
24450 | min: function min(_min) {
|
24451 | var $$ = this.internal;
|
24452 | return arguments.length ? setMinMax($$, "min", _min) : api_axis_getMinMax($$, "min");
|
24453 | },
|
24454 |
|
24455 | |
24456 |
|
24457 |
|
24458 |
|
24459 |
|
24460 |
|
24461 |
|
24462 |
|
24463 |
|
24464 |
|
24465 |
|
24466 |
|
24467 |
|
24468 |
|
24469 |
|
24470 |
|
24471 | max: function max(_max) {
|
24472 | var $$ = this.internal;
|
24473 | return arguments.length ? setMinMax($$, "max", _max) : api_axis_getMinMax($$, "max");
|
24474 | },
|
24475 |
|
24476 | |
24477 |
|
24478 |
|
24479 |
|
24480 |
|
24481 |
|
24482 |
|
24483 |
|
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 |
|
24489 |
|
24490 |
|
24491 |
|
24492 |
|
24493 |
|
24494 |
|
24495 |
|
24496 |
|
24497 | range: function range(_range) {
|
24498 | var axis = this.axis;
|
24499 | if (arguments.length) isDefined(_range.max) && axis.max(_range.max), isDefined(_range.min) && axis.min(_range.min);else return {
|
24500 | max: axis.max(),
|
24501 | min: axis.min()
|
24502 | };
|
24503 | return undefined;
|
24504 | }
|
24505 | });
|
24506 |
|
24507 |
|
24508 |
|
24509 |
|
24510 |
|
24511 |
|
24512 |
|
24513 |
|
24514 |
|
24515 | util_extend(Chart_Chart.prototype, {
|
24516 | axis: api_axis_axis
|
24517 | });
|
24518 |
|
24519 |
|
24520 |
|
24521 |
|
24522 |
|
24523 |
|
24524 |
|
24525 |
|
24526 |
|
24527 |
|
24528 |
|
24529 |
|
24530 | var legend = util_extend(function () {}, {
|
24531 | |
24532 |
|
24533 |
|
24534 |
|
24535 |
|
24536 |
|
24537 |
|
24538 |
|
24539 |
|
24540 |
|
24541 |
|
24542 |
|
24543 |
|
24544 |
|
24545 |
|
24546 |
|
24547 |
|
24548 |
|
24549 |
|
24550 | show: function show(targetIds) {
|
24551 | var $$ = this.internal;
|
24552 | $$.showLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({
|
24553 | withLegend: !0
|
24554 | });
|
24555 | },
|
24556 |
|
24557 | |
24558 |
|
24559 |
|
24560 |
|
24561 |
|
24562 |
|
24563 |
|
24564 |
|
24565 |
|
24566 |
|
24567 |
|
24568 |
|
24569 |
|
24570 |
|
24571 |
|
24572 |
|
24573 |
|
24574 |
|
24575 |
|
24576 | hide: function hide(targetIds) {
|
24577 | var $$ = this.internal;
|
24578 | $$.hideLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({
|
24579 | withLegend: !0
|
24580 | });
|
24581 | }
|
24582 | });
|
24583 | util_extend(Chart_Chart.prototype, {
|
24584 | legend: legend
|
24585 | });
|
24586 |
|
24587 |
|
24588 |
|
24589 |
|
24590 |
|
24591 |
|
24592 |
|
24593 |
|
24594 | util_extend(Chart_Chart.prototype, {
|
24595 | |
24596 |
|
24597 |
|
24598 |
|
24599 |
|
24600 |
|
24601 |
|
24602 |
|
24603 |
|
24604 |
|
24605 |
|
24606 |
|
24607 |
|
24608 | resize: function resize(size) {
|
24609 | var config = this.internal.config;
|
24610 | config.size_width = size ? size.width : null, config.size_height = size ? size.height : null, this.flush(!1, !0);
|
24611 | },
|
24612 |
|
24613 | |
24614 |
|
24615 |
|
24616 |
|
24617 |
|
24618 |
|
24619 |
|
24620 |
|
24621 |
|
24622 |
|
24623 |
|
24624 |
|
24625 |
|
24626 | flush: function flush(soft, isFromResize) {
|
24627 | var $$ = this.internal;
|
24628 |
|
24629 | isFromResize ? $$.brush && $$.brush.updateResize() : $$.axis && $$.axis.setOrient(), $$.zoomScale = null, soft ? $$.redraw({
|
24630 | withTransform: !0,
|
24631 | withUpdateXDomain: !0,
|
24632 | withUpdateOrgXDomain: !0,
|
24633 | withLegend: !0
|
24634 | }) : $$.updateAndRedraw({
|
24635 | withLegend: !0,
|
24636 | withTransition: !1,
|
24637 | withTransitionForTransform: !1
|
24638 | });
|
24639 | },
|
24640 |
|
24641 | |
24642 |
|
24643 |
|
24644 |
|
24645 |
|
24646 |
|
24647 |
|
24648 |
|
24649 | destroy: function destroy() {
|
24650 | var _this = this,
|
24651 | $$ = this.internal;
|
24652 |
|
24653 | return notEmpty($$) && ($$.callPluginHook("$willDestroy"), $$.charts.splice($$.charts.indexOf(this), 1), $$.svg.select("*").interrupt(), isDefined($$.resizeTimeout) && browser["window"].clearTimeout($$.resizeTimeout), browser["window"].removeEventListener("resize", $$.resizeFunction), $$.selectChart.classed("bb", !1).html(""), Object.keys(this).forEach(function (key) {
|
24654 | key === "internal" && Object.keys($$).forEach(function (k) {
|
24655 | $$[k] = null;
|
24656 | }), _this[key] = null, delete _this[key];
|
24657 | })), null;
|
24658 | },
|
24659 |
|
24660 | |
24661 |
|
24662 |
|
24663 |
|
24664 |
|
24665 |
|
24666 |
|
24667 |
|
24668 |
|
24669 |
|
24670 |
|
24671 |
|
24672 |
|
24673 |
|
24674 |
|
24675 |
|
24676 |
|
24677 |
|
24678 |
|
24679 | config: function config(name, value, redraw) {
|
24680 | var res,
|
24681 | $$ = this.internal,
|
24682 | key = name && name.replace(/\./g, "_");
|
24683 | return key in $$.config && (isDefined(value) ? ($$.config[key] = value, res = value, redraw && this.flush()) : res = $$.config[key]), res;
|
24684 | }
|
24685 | });
|
24686 |
|
24687 |
|
24688 |
|
24689 |
|
24690 |
|
24691 |
|
24692 |
|
24693 |
|
24694 |
|
24695 |
|
24696 |
|
24697 |
|
24698 | var tooltip = util_extend(function () {}, {
|
24699 | |
24700 |
|
24701 |
|
24702 |
|
24703 |
|
24704 |
|
24705 |
|
24706 |
|
24707 |
|
24708 |
|
24709 |
|
24710 |
|
24711 |
|
24712 |
|
24713 |
|
24714 |
|
24715 |
|
24716 |
|
24717 |
|
24718 |
|
24719 |
|
24720 |
|
24721 |
|
24722 |
|
24723 |
|
24724 |
|
24725 |
|
24726 |
|
24727 |
|
24728 |
|
24729 |
|
24730 |
|
24731 |
|
24732 |
|
24733 |
|
24734 |
|
24735 |
|
24736 |
|
24737 |
|
24738 |
|
24739 |
|
24740 |
|
24741 |
|
24742 |
|
24743 |
|
24744 |
|
24745 |
|
24746 |
|
24747 |
|
24748 | show: function show() {
|
24749 | var index,
|
24750 | mouse,
|
24751 | args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
24752 | $$ = this.internal;
|
24753 |
|
24754 |
|
24755 | if (args.mouse && (mouse = args.mouse), args.data) {
|
24756 | var y = $$.getYScale(args.data.id)(args.data.value);
|
24757 | $$.isMultipleX() ? mouse = [$$.x(args.data.x), y] : (!$$.config.tooltip_grouped && (mouse = [0, y]), index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x));
|
24758 | } else isDefined(args.x) ? index = $$.getIndexByX(args.x) : isDefined(args.index) && (index = args.index);
|
24759 |
|
24760 |
|
24761 | ($$.inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach(function (eventName) {
|
24762 | $$.dispatchEvent(eventName, index, mouse);
|
24763 | });
|
24764 | },
|
24765 |
|
24766 | |
24767 |
|
24768 |
|
24769 |
|
24770 |
|
24771 |
|
24772 | hide: function hide() {
|
24773 | var $$ = this.internal;
|
24774 | $$.hideTooltip(!0), $$.hideXGridFocus(), $$.unexpandCircles(), $$.unexpandBars();
|
24775 | }
|
24776 | });
|
24777 | util_extend(Chart_Chart.prototype, {
|
24778 | tooltip: tooltip
|
24779 | });
|
24780 |
|
24781 |
|
24782 |
|
24783 |
|
24784 |
|
24785 |
|
24786 |
|
24787 |
|
24788 |
|
24789 |
|
24790 |
|
24791 |
|
24792 |
|
24793 |
|
24794 |
|
24795 |
|
24796 |
|
24797 | var b64EncodeUnicode = function (str) {
|
24798 | return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) {
|
24799 | return String.fromCharCode("0x".concat(p));
|
24800 | }));
|
24801 | },
|
24802 | nodeToSvgDataUrl = function (node, size) {
|
24803 | var serializer = new XMLSerializer(),
|
24804 | clone = node.cloneNode(!0),
|
24805 | cssText = getCssRules(toArray(browser["document"].styleSheets)).filter(function (r) {
|
24806 | return r.cssText;
|
24807 | }).map(function (r) {
|
24808 | return r.cssText;
|
24809 | });
|
24810 | clone.setAttribute("xmlns", namespaces.xhtml);
|
24811 | var nodeXml = serializer.serializeToString(clone),
|
24812 | style = browser["document"].createElement("style");
|
24813 |
|
24814 | style.appendChild(browser["document"].createTextNode(cssText.join("\n")));
|
24815 | var styleXml = serializer.serializeToString(style),
|
24816 | dataStr = "<svg xmlns=\"".concat(namespaces.svg, "\" width=\"").concat(size.width, "\" height=\"").concat(size.height, "\">\n\t\t\t<foreignObject width=\"100%\" height=\"100%\">\n\t\t\t\t").concat(styleXml, "\n\t\t\t\t").concat(nodeXml.replace(/(url\()[^#]+/g, "$1"), "\n\t\t\t</foreignObject></svg>").replace("/\n/g", "%0A");
|
24817 |
|
24818 |
|
24819 | return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr));
|
24820 | };
|
24821 |
|
24822 |
|
24823 |
|
24824 |
|
24825 |
|
24826 |
|
24827 |
|
24828 |
|
24829 | util_extend(Chart_Chart.prototype, {
|
24830 | |
24831 |
|
24832 |
|
24833 |
|
24834 |
|
24835 |
|
24836 |
|
24837 |
|
24838 |
|
24839 |
|
24840 |
|
24841 |
|
24842 |
|
24843 |
|
24844 |
|
24845 |
|
24846 |
|
24847 |
|
24848 |
|
24849 |
|
24850 |
|
24851 |
|
24852 |
|
24853 |
|
24854 |
|
24855 |
|
24856 | "export": function _export(mimeType, callback) {
|
24857 | var $$ = this.internal,
|
24858 | size = {
|
24859 | width: $$.currentWidth,
|
24860 | height: $$.currentHeight
|
24861 | },
|
24862 | svgDataUrl = nodeToSvgDataUrl(this.element, size);
|
24863 |
|
24864 | if (isFunction(callback)) {
|
24865 | var img = new Image();
|
24866 | img.crosssOrigin = "Anonymous", img.onload = function () {
|
24867 | var canvas = browser["document"].createElement("canvas"),
|
24868 | ctx = canvas.getContext("2d");
|
24869 | canvas.width = size.width, canvas.height = size.height, ctx.drawImage(img, 0, 0), callback(canvas.toDataURL(mimeType));
|
24870 | }, img.src = svgDataUrl;
|
24871 | }
|
24872 |
|
24873 | return svgDataUrl;
|
24874 | }
|
24875 | });
|
24876 |
|
24877 | __webpack_require__.d(__webpack_exports__, "bb", function() { return bb; });
|
24878 |
|
24879 |
|
24880 |
|
24881 |
|
24882 |
|
24883 |
|
24884 |
|
24885 |
|
24886 |
|
24887 |
|
24888 |
|
24889 |
|
24890 |
|
24891 |
|
24892 |
|
24893 |
|
24894 |
|
24895 |
|
24896 |
|
24897 |
|
24898 |
|
24899 |
|
24900 |
|
24901 |
|
24902 |
|
24903 |
|
24904 |
|
24905 |
|
24906 |
|
24907 |
|
24908 |
|
24909 |
|
24910 |
|
24911 |
|
24912 |
|
24913 |
|
24914 |
|
24915 |
|
24916 |
|
24917 |
|
24918 |
|
24919 |
|
24920 |
|
24921 |
|
24922 |
|
24923 |
|
24924 |
|
24925 |
|
24926 |
|
24927 |
|
24928 |
|
24929 |
|
24930 |
|
24931 |
|
24932 |
|
24933 |
|
24934 |
|
24935 |
|
24936 |
|
24937 | var _defaults = {},
|
24938 | bb = {
|
24939 | |
24940 |
|
24941 |
|
24942 |
|
24943 |
|
24944 |
|
24945 |
|
24946 | version: "1.9.5",
|
24947 |
|
24948 | |
24949 |
|
24950 |
|
24951 |
|
24952 |
|
24953 |
|
24954 |
|
24955 |
|
24956 |
|
24957 |
|
24958 |
|
24959 |
|
24960 |
|
24961 |
|
24962 |
|
24963 |
|
24964 |
|
24965 |
|
24966 |
|
24967 |
|
24968 |
|
24969 |
|
24970 |
|
24971 |
|
24972 |
|
24973 |
|
24974 | generate: function generate(config) {
|
24975 | var options = mergeObj({}, _defaults, config),
|
24976 | inst = new Chart_Chart(options);
|
24977 | return inst.internal.charts = this.instance, this.instance.push(inst), inst;
|
24978 | },
|
24979 |
|
24980 | |
24981 |
|
24982 |
|
24983 |
|
24984 |
|
24985 |
|
24986 |
|
24987 |
|
24988 |
|
24989 |
|
24990 |
|
24991 |
|
24992 |
|
24993 |
|
24994 |
|
24995 |
|
24996 |
|
24997 |
|
24998 |
|
24999 |
|
25000 |
|
25001 |
|
25002 | defaults: function defaults(options) {
|
25003 | return isObject(options) && (_defaults = options), _defaults;
|
25004 | },
|
25005 |
|
25006 | |
25007 |
|
25008 |
|
25009 |
|
25010 |
|
25011 |
|
25012 |
|
25013 |
|
25014 |
|
25015 |
|
25016 |
|
25017 | instance: [],
|
25018 |
|
25019 | |
25020 |
|
25021 |
|
25022 |
|
25023 |
|
25024 |
|
25025 |
|
25026 |
|
25027 | plugin: {},
|
25028 |
|
25029 | |
25030 |
|
25031 |
|
25032 |
|
25033 | chart: {
|
25034 | fn: Chart_Chart.prototype,
|
25035 | internal: {
|
25036 | fn: ChartInternal_ChartInternal.prototype,
|
25037 | axis: {
|
25038 | fn: Axis_Axis.prototype
|
25039 | }
|
25040 | }
|
25041 | }
|
25042 | };
|
25043 |
|
25044 |
|
25045 |
|
25046 |
|
25047 |
|
25048 |
|
25049 | var core = __webpack_exports__["default"] = (bb);
|
25050 |
|
25051 | })
|
25052 | ]);
|
25053 | }); |
\ | No newline at end of file |