1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | (function webpackUniversalModuleDefinition(root, factory) {
|
11 | if(typeof exports === 'object' && typeof module === 'object')
|
12 | module.exports = factory(require("d3-axis"), require("d3-brush"), require("d3-color"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom"));
|
13 | else if(typeof define === 'function' && define.amd)
|
14 | define(["d3-axis", "d3-brush", "d3-color", "d3-drag", "d3-dsv", "d3-ease", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "d3-time-format", "d3-transition", "d3-zoom"], factory);
|
15 | else {
|
16 | var a = typeof exports === 'object' ? factory(require("d3-axis"), require("d3-brush"), require("d3-color"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom")) : factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
17 | for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
18 | }
|
19 | })(this, function(__WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__14__) {
|
20 | return (function() {
|
21 | "use strict";
|
22 | var __webpack_modules__ = ([
|
23 | ,
|
24 | ,
|
25 |
|
26 | (function(module) {
|
27 |
|
28 | module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
29 |
|
30 | }),
|
31 |
|
32 | (function(module) {
|
33 |
|
34 | module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
|
35 |
|
36 | }),
|
37 |
|
38 | (function(module) {
|
39 |
|
40 | module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
41 |
|
42 | }),
|
43 |
|
44 | (function(module) {
|
45 |
|
46 | module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
|
47 |
|
48 | }),
|
49 |
|
50 | (function(module) {
|
51 |
|
52 | module.exports = __WEBPACK_EXTERNAL_MODULE__6__;
|
53 |
|
54 | }),
|
55 |
|
56 | (function(module) {
|
57 |
|
58 | module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
59 |
|
60 | }),
|
61 |
|
62 | (function(module) {
|
63 |
|
64 | module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
65 |
|
66 | }),
|
67 |
|
68 | (function(module) {
|
69 |
|
70 | module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
71 |
|
72 | }),
|
73 |
|
74 | (function(module) {
|
75 |
|
76 | module.exports = __WEBPACK_EXTERNAL_MODULE__10__;
|
77 |
|
78 | }),
|
79 |
|
80 | (function(module) {
|
81 |
|
82 | module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
|
83 |
|
84 | }),
|
85 |
|
86 | (function(module) {
|
87 |
|
88 | module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
89 |
|
90 | }),
|
91 |
|
92 | (function(module) {
|
93 |
|
94 | module.exports = __WEBPACK_EXTERNAL_MODULE__13__;
|
95 |
|
96 | }),
|
97 |
|
98 | (function(module) {
|
99 |
|
100 | module.exports = __WEBPACK_EXTERNAL_MODULE__14__;
|
101 |
|
102 | })
|
103 | ]);
|
104 |
|
105 |
|
106 | var __webpack_module_cache__ = {};
|
107 |
|
108 |
|
109 | function __webpack_require__(moduleId) {
|
110 |
|
111 | var cachedModule = __webpack_module_cache__[moduleId];
|
112 | if (cachedModule !== undefined) {
|
113 | return cachedModule.exports;
|
114 | }
|
115 |
|
116 | var module = __webpack_module_cache__[moduleId] = {
|
117 |
|
118 |
|
119 | exports: {}
|
120 | };
|
121 |
|
122 |
|
123 | __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
124 |
|
125 |
|
126 | return module.exports;
|
127 | }
|
128 |
|
129 |
|
130 |
|
131 | !function() {
|
132 |
|
133 | __webpack_require__.d = function(exports, definition) {
|
134 | for(var key in definition) {
|
135 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
136 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
137 | }
|
138 | }
|
139 | };
|
140 | }();
|
141 |
|
142 |
|
143 | !function() {
|
144 | __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
145 | }();
|
146 |
|
147 |
|
148 | !function() {
|
149 |
|
150 | __webpack_require__.r = function(exports) {
|
151 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
152 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
153 | }
|
154 | Object.defineProperty(exports, '__esModule', { value: true });
|
155 | };
|
156 | }();
|
157 |
|
158 |
|
159 | var __webpack_exports__ = {};
|
160 |
|
161 | !function() {
|
162 |
|
163 |
|
164 | }();
|
165 |
|
166 | !function() {
|
167 |
|
168 | __webpack_require__.r(__webpack_exports__);
|
169 |
|
170 |
|
171 | __webpack_require__.d(__webpack_exports__, {
|
172 | "bb": function() { return bb; },
|
173 | "default": function() { return bb; }
|
174 | });
|
175 |
|
176 |
|
177 | var resolver_shape_namespaceObject = {};
|
178 | __webpack_require__.r(resolver_shape_namespaceObject);
|
179 | __webpack_require__.d(resolver_shape_namespaceObject, {
|
180 | "area": function() { return _area; },
|
181 | "areaLineRange": function() { return areaLineRange; },
|
182 | "areaSpline": function() { return areaSpline; },
|
183 | "areaSplineRange": function() { return areaSplineRange; },
|
184 | "areaStep": function() { return areaStep; },
|
185 | "bar": function() { return resolver_shape_bar; },
|
186 | "bubble": function() { return resolver_shape_bubble; },
|
187 | "candlestick": function() { return resolver_shape_candlestick; },
|
188 | "donut": function() { return shape_donut; },
|
189 | "gauge": function() { return resolver_shape_gauge; },
|
190 | "line": function() { return resolver_shape_line; },
|
191 | "pie": function() { return shape_pie; },
|
192 | "radar": function() { return resolver_shape_radar; },
|
193 | "scatter": function() { return shape_scatter; },
|
194 | "spline": function() { return shape_spline; },
|
195 | "step": function() { return step; }
|
196 | });
|
197 |
|
198 |
|
199 | var resolver_interaction_namespaceObject = {};
|
200 | __webpack_require__.r(resolver_interaction_namespaceObject);
|
201 | __webpack_require__.d(resolver_interaction_namespaceObject, {
|
202 | "selection": function() { return _selectionModule; },
|
203 | "subchart": function() { return subchartModule; },
|
204 | "zoom": function() { return zoomModule; }
|
205 | });
|
206 |
|
207 |
|
208 | var external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_ = __webpack_require__(4);
|
209 |
|
210 | var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(2);
|
211 | ;
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 | var config_classes = ({
|
222 | arc: "bb-arc",
|
223 | arcLabelLine: "bb-arc-label-line",
|
224 | arcs: "bb-arcs",
|
225 | area: "bb-area",
|
226 | areas: "bb-areas",
|
227 | axis: "bb-axis",
|
228 | axisX: "bb-axis-x",
|
229 | axisXLabel: "bb-axis-x-label",
|
230 | axisY: "bb-axis-y",
|
231 | axisY2: "bb-axis-y2",
|
232 | axisY2Label: "bb-axis-y2-label",
|
233 | axisYLabel: "bb-axis-y-label",
|
234 | bar: "bb-bar",
|
235 | bars: "bb-bars",
|
236 | brush: "bb-brush",
|
237 | button: "bb-button",
|
238 | buttonZoomReset: "bb-zoom-reset",
|
239 | candlestick: "bb-candlestick",
|
240 | candlesticks: "bb-candlesticks",
|
241 | chart: "bb-chart",
|
242 | chartArc: "bb-chart-arc",
|
243 | chartArcs: "bb-chart-arcs",
|
244 | chartArcsBackground: "bb-chart-arcs-background",
|
245 | chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
246 | chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
247 | chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
248 | chartArcsTitle: "bb-chart-arcs-title",
|
249 | chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
250 | chartBar: "bb-chart-bar",
|
251 | chartBars: "bb-chart-bars",
|
252 | chartCandlestick: "bb-chart-candlestick",
|
253 | chartCandlesticks: "bb-chart-candlesticks",
|
254 | chartCircles: "bb-chart-circles",
|
255 | chartLine: "bb-chart-line",
|
256 | chartLines: "bb-chart-lines",
|
257 | chartRadar: "bb-chart-radar",
|
258 | chartRadars: "bb-chart-radars",
|
259 | chartText: "bb-chart-text",
|
260 | chartTexts: "bb-chart-texts",
|
261 | circle: "bb-circle",
|
262 | circles: "bb-circles",
|
263 | colorPattern: "bb-color-pattern",
|
264 | colorScale: "bb-colorscale",
|
265 | defocused: "bb-defocused",
|
266 | dragarea: "bb-dragarea",
|
267 | empty: "bb-empty",
|
268 | eventRect: "bb-event-rect",
|
269 | eventRects: "bb-event-rects",
|
270 | eventRectsMultiple: "bb-event-rects-multiple",
|
271 | eventRectsSingle: "bb-event-rects-single",
|
272 | focused: "bb-focused",
|
273 | gaugeValue: "bb-gauge-value",
|
274 | grid: "bb-grid",
|
275 | gridLines: "bb-grid-lines",
|
276 | legend: "bb-legend",
|
277 | legendBackground: "bb-legend-background",
|
278 | legendItem: "bb-legend-item",
|
279 | legendItemEvent: "bb-legend-item-event",
|
280 | legendItemFocused: "bb-legend-item-focused",
|
281 | legendItemHidden: "bb-legend-item-hidden",
|
282 | legendItemPoint: "bb-legend-item-point",
|
283 | legendItemTile: "bb-legend-item-tile",
|
284 | level: "bb-level",
|
285 | levels: "bb-levels",
|
286 | line: "bb-line",
|
287 | lines: "bb-lines",
|
288 | main: "bb-main",
|
289 | region: "bb-region",
|
290 | regions: "bb-regions",
|
291 | selectedCircle: "bb-selected-circle",
|
292 | selectedCircles: "bb-selected-circles",
|
293 | shape: "bb-shape",
|
294 | shapes: "bb-shapes",
|
295 | stanfordElements: "bb-stanford-elements",
|
296 | stanfordLine: "bb-stanford-line",
|
297 | stanfordLines: "bb-stanford-lines",
|
298 | stanfordRegion: "bb-stanford-region",
|
299 | stanfordRegions: "bb-stanford-regions",
|
300 | subchart: "bb-subchart",
|
301 | target: "bb-target",
|
302 | text: "bb-text",
|
303 | texts: "bb-texts",
|
304 | title: "bb-title",
|
305 | tooltip: "bb-tooltip",
|
306 | tooltipContainer: "bb-tooltip-container",
|
307 | tooltipName: "bb-tooltip-name",
|
308 | valueDown: "bb-value-down",
|
309 | valueUp: "bb-value-up",
|
310 | xgrid: "bb-xgrid",
|
311 | xgridFocus: "bb-xgrid-focus",
|
312 | xgridLine: "bb-xgrid-line",
|
313 | xgridLines: "bb-xgrid-lines",
|
314 | xgrids: "bb-xgrids",
|
315 | ygrid: "bb-ygrid",
|
316 | ygridFocus: "bb-ygrid-focus",
|
317 | ygridLine: "bb-ygrid-line",
|
318 | ygridLines: "bb-ygrid-lines",
|
319 | ygrids: "bb-ygrids",
|
320 | zoomBrush: "bb-zoom-brush",
|
321 | EXPANDED: "_expanded_",
|
322 | SELECTED: "_selected_",
|
323 | INCLUDED: "_included_",
|
324 | TextOverlapping: "text-overlapping"
|
325 | });
|
326 | ;
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 | var Element = function () {
|
339 | return {
|
340 | chart: null,
|
341 | main: null,
|
342 | svg: null,
|
343 | axis: {
|
344 |
|
345 | x: null,
|
346 | y: null,
|
347 | y2: null,
|
348 | subX: null
|
349 | },
|
350 | defs: null,
|
351 | tooltip: null,
|
352 | legend: null,
|
353 | title: null,
|
354 | subchart: {
|
355 | main: null,
|
356 |
|
357 | bar: null,
|
358 |
|
359 | line: null,
|
360 |
|
361 | area: null
|
362 |
|
363 | },
|
364 | arcs: null,
|
365 | bar: null,
|
366 |
|
367 | candlestick: null,
|
368 | line: null,
|
369 |
|
370 | area: null,
|
371 |
|
372 | circle: null,
|
373 |
|
374 | radar: null,
|
375 | text: null,
|
376 |
|
377 | grid: {
|
378 | main: null,
|
379 |
|
380 | x: null,
|
381 |
|
382 | y: null
|
383 |
|
384 | },
|
385 | gridLines: {
|
386 | main: null,
|
387 |
|
388 | x: null,
|
389 |
|
390 | y: null
|
391 |
|
392 | },
|
393 | region: {
|
394 | main: null,
|
395 |
|
396 | list: null
|
397 |
|
398 | },
|
399 | eventRect: null
|
400 | };
|
401 | };
|
402 |
|
403 |
|
404 | ;
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 | var State = function () {
|
417 | return {
|
418 | width: 0,
|
419 | width2: 0,
|
420 | height: 0,
|
421 | height2: 0,
|
422 | margin: {
|
423 | top: 0,
|
424 | bottom: 0,
|
425 | left: 0,
|
426 | right: 0
|
427 | },
|
428 | margin2: {
|
429 | top: 0,
|
430 | bottom: 0,
|
431 | left: 0,
|
432 | right: 0
|
433 | },
|
434 | margin3: {
|
435 | top: 0,
|
436 | bottom: 0,
|
437 | left: 0,
|
438 | right: 0
|
439 | },
|
440 | arcWidth: 0,
|
441 | arcHeight: 0,
|
442 | xAxisHeight: 0,
|
443 | hasAxis: !1,
|
444 | hasRadar: !1,
|
445 | current: {
|
446 | width: 0,
|
447 | height: 0,
|
448 | dataMax: 0,
|
449 | maxTickWidths: {
|
450 | x: {
|
451 | size: 0,
|
452 | ticks: [],
|
453 | clipPath: 0,
|
454 | domain: ""
|
455 | },
|
456 | y: {
|
457 | size: 0,
|
458 | domain: ""
|
459 | },
|
460 | y2: {
|
461 | size: 0,
|
462 | domain: ""
|
463 | }
|
464 | },
|
465 |
|
466 | types: []
|
467 | },
|
468 |
|
469 | isLegendRight: !1,
|
470 | isLegendInset: !1,
|
471 | isLegendTop: !1,
|
472 | isLegendLeft: !1,
|
473 | legendStep: 0,
|
474 | legendItemWidth: 0,
|
475 | legendItemHeight: 0,
|
476 | legendHasRendered: !1,
|
477 | eventReceiver: {
|
478 | currentIdx: -1,
|
479 |
|
480 | rect: {},
|
481 |
|
482 | data: [],
|
483 |
|
484 | coords: []
|
485 |
|
486 | },
|
487 | axis: {
|
488 | x: {
|
489 | padding: {
|
490 | left: 0,
|
491 | right: 0
|
492 | },
|
493 | tickCount: 0
|
494 | }
|
495 | },
|
496 | rotatedPadding: {
|
497 | left: 30,
|
498 | right: 0,
|
499 | top: 5
|
500 | },
|
501 | withoutFadeIn: {},
|
502 | inputType: "",
|
503 | datetimeId: "",
|
504 |
|
505 | clip: {
|
506 | id: "",
|
507 | idXAxis: "",
|
508 | idYAxis: "",
|
509 | idXAxisTickTexts: "",
|
510 | idGrid: "",
|
511 | idSubchart: "",
|
512 |
|
513 | path: "",
|
514 | pathXAxis: "",
|
515 | pathYAxis: "",
|
516 | pathXAxisTickTexts: "",
|
517 | pathGrid: ""
|
518 | },
|
519 |
|
520 | event: null,
|
521 |
|
522 | dragStart: null,
|
523 | dragging: !1,
|
524 | flowing: !1,
|
525 | cancelClick: !1,
|
526 | mouseover: !1,
|
527 | rendered: !1,
|
528 | transiting: !1,
|
529 | redrawing: !1,
|
530 |
|
531 | resizing: !1,
|
532 |
|
533 | toggling: !1,
|
534 |
|
535 | zooming: !1,
|
536 | hasNegativeValue: !1,
|
537 | hasPositiveValue: !0,
|
538 | orgAreaOpacity: "0.2",
|
539 |
|
540 | hiddenTargetIds: [],
|
541 | hiddenLegendIds: [],
|
542 | focusedTargetIds: [],
|
543 | defocusedTargetIds: [],
|
544 |
|
545 | radius: 0,
|
546 | innerRadius: 0,
|
547 | outerRadius: undefined,
|
548 | innerRadiusRatio: 0,
|
549 | gaugeArcWidth: 0,
|
550 | radiusExpanded: 0,
|
551 |
|
552 | xgridAttr: {
|
553 | x1: null,
|
554 | x2: null,
|
555 | y1: null,
|
556 | y2: null
|
557 | }
|
558 | };
|
559 | };
|
560 |
|
561 |
|
562 | ;
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 | var classes = {
|
571 | element: Element,
|
572 | state: State
|
573 | };
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 | var Store = function () {
|
582 | function Store() {
|
583 | var _this = this;
|
584 |
|
585 | Object.keys(classes).forEach(function (v) {
|
586 | _this[v] = new classes[v]();
|
587 | });
|
588 | }
|
589 |
|
590 | var _proto = Store.prototype;
|
591 | return _proto.getStore = function getStore(name) {
|
592 | return this[name];
|
593 | }, Store;
|
594 | }();
|
595 |
|
596 |
|
597 | ;
|
598 | function _defineProperty(obj, key, value) {
|
599 | if (key in obj) {
|
600 | Object.defineProperty(obj, key, {
|
601 | value: value,
|
602 | enumerable: true,
|
603 | configurable: true,
|
604 | writable: true
|
605 | });
|
606 | } else {
|
607 | obj[key] = value;
|
608 | }
|
609 |
|
610 | return obj;
|
611 | }
|
612 | ;
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 | var main = ({
|
622 | |
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 | bindto: "#chart",
|
649 |
|
650 | |
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 | background: {},
|
670 |
|
671 | |
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 | clipPath: !0,
|
686 |
|
687 | |
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 | svg_classname: undefined,
|
700 |
|
701 | |
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | size_width: undefined,
|
718 | size_height: undefined,
|
719 |
|
720 | |
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 | padding_left: undefined,
|
739 | padding_right: undefined,
|
740 | padding_top: undefined,
|
741 | padding_bottom: undefined,
|
742 |
|
743 | |
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 | resize_auto: !0,
|
756 |
|
757 | |
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 | onover: undefined,
|
770 |
|
771 | |
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 | onout: undefined,
|
784 |
|
785 | |
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | onresize: undefined,
|
798 |
|
799 | |
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | onresized: undefined,
|
812 |
|
813 | |
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 | onbeforeinit: undefined,
|
826 |
|
827 | |
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 | oninit: undefined,
|
840 |
|
841 | |
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 | onafterinit: undefined,
|
854 |
|
855 | |
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 | onrendered: undefined,
|
868 |
|
869 | |
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 | transition_duration: 350,
|
883 |
|
884 | |
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 | plugins: [],
|
897 |
|
898 | |
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 | render: {},
|
939 |
|
940 | |
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 | regions: []
|
963 | });
|
964 | ;
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 | var data = ({
|
974 | |
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 | data_x: undefined,
|
987 |
|
988 | |
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 | data_idConverter: function data_idConverter(id) {
|
1008 | return id;
|
1009 | },
|
1010 |
|
1011 | |
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 | data_names: {},
|
1027 |
|
1028 | |
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 | data_classes: {},
|
1044 |
|
1045 | |
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 | data_type: undefined,
|
1103 |
|
1104 | |
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 | data_types: {},
|
1152 |
|
1153 | |
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 | data_order: "desc",
|
1204 |
|
1205 | |
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 | data_groups: [],
|
1220 |
|
1221 | |
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 | data_color: undefined,
|
1235 |
|
1236 | |
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | data_colors: {},
|
1254 |
|
1255 | |
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 | data_labels: {},
|
1338 | data_labels_colors: undefined,
|
1339 | data_labels_position: {},
|
1340 |
|
1341 | |
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | data_hide: !1,
|
1358 |
|
1359 | |
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 | data_filter: undefined,
|
1378 |
|
1379 | |
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 | data_onclick: function data_onclick() {},
|
1399 |
|
1400 | |
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 | data_onover: function data_onover() {},
|
1420 |
|
1421 | |
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 | data_onout: function data_onout() {},
|
1441 |
|
1442 | |
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 | data_onmin: undefined,
|
1457 |
|
1458 | |
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 | data_onmax: undefined,
|
1473 |
|
1474 | |
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 | data_url: undefined,
|
1487 |
|
1488 | |
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 | data_headers: undefined,
|
1506 |
|
1507 | |
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 | data_json: undefined,
|
1530 |
|
1531 | |
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 | data_rows: undefined,
|
1610 |
|
1611 | |
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 | data_columns: undefined,
|
1670 |
|
1671 | |
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 | data_mimeType: "csv",
|
1687 |
|
1688 | |
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 | data_keys: undefined,
|
1710 |
|
1711 | |
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 | data_empty_label_text: ""
|
1728 | });
|
1729 | ;
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 | var color = ({
|
1739 | |
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 | color_pattern: [],
|
1814 | color_tiles: undefined,
|
1815 | color_threshold: {},
|
1816 | color_onover: undefined
|
1817 | });
|
1818 | ;
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 | var interaction = ({
|
1828 | |
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 | interaction_enabled: !0,
|
1861 | interaction_brighten: !0,
|
1862 | interaction_inputType_mouse: !0,
|
1863 | interaction_inputType_touch: {}
|
1864 | });
|
1865 | ;
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 | var legend = ({
|
1875 | |
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 | legend_show: !0,
|
1961 | legend_hide: !1,
|
1962 | legend_contents_bindto: undefined,
|
1963 | legend_contents_template: undefined,
|
1964 | legend_position: "bottom",
|
1965 | legend_inset_anchor: "top-left",
|
1966 | legend_inset_x: 10,
|
1967 | legend_inset_y: 0,
|
1968 | legend_inset_step: undefined,
|
1969 | legend_item_onclick: undefined,
|
1970 | legend_item_onover: undefined,
|
1971 | legend_item_onout: undefined,
|
1972 | legend_equally: !1,
|
1973 | legend_padding: 0,
|
1974 | legend_item_tile_width: 10,
|
1975 | legend_item_tile_height: 10,
|
1976 | legend_usePoint: !1
|
1977 | });
|
1978 | ;
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 | var title = ({
|
1988 | |
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 | title_text: undefined,
|
2018 | title_padding: {
|
2019 | top: 0,
|
2020 | right: 0,
|
2021 | bottom: 0,
|
2022 | left: 0
|
2023 | },
|
2024 | title_position: "center"
|
2025 | });
|
2026 | ;
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 | var tooltip = ({
|
2036 | |
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 | tooltip_show: !0,
|
2204 | tooltip_doNotHide: !1,
|
2205 | tooltip_grouped: !0,
|
2206 | tooltip_format_title: undefined,
|
2207 | tooltip_format_name: undefined,
|
2208 | tooltip_format_value: undefined,
|
2209 | tooltip_position: undefined,
|
2210 | tooltip_contents: {},
|
2211 | tooltip_init_show: !1,
|
2212 | tooltip_init_x: 0,
|
2213 | tooltip_init_position: {
|
2214 | top: "0px",
|
2215 | left: "50px"
|
2216 | },
|
2217 | tooltip_linked: !1,
|
2218 | tooltip_linked_name: "",
|
2219 | tooltip_onshow: function tooltip_onshow() {},
|
2220 | tooltip_onhide: function tooltip_onhide() {},
|
2221 | tooltip_onshown: function tooltip_onshown() {},
|
2222 | tooltip_onhidden: function tooltip_onhidden() {},
|
2223 | tooltip_order: null
|
2224 | });
|
2225 |
|
2226 | var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
2227 | ;
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 | var win = function () {
|
2242 | var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self;
|
2243 | return root || Function("return this")();
|
2244 | }(),
|
2245 | browser_doc = win && win.document;
|
2246 |
|
2247 | ;
|
2248 |
|
2249 |
|
2250 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2251 |
|
2252 | function _objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = arguments[i] == null ? {} : arguments[i], i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 | var isValue = function (v) {
|
2266 | return v || v === 0;
|
2267 | },
|
2268 | isFunction = function (v) {
|
2269 | return typeof v === "function";
|
2270 | },
|
2271 | isString = function (v) {
|
2272 | return typeof v === "string";
|
2273 | },
|
2274 | isNumber = function (v) {
|
2275 | return typeof v === "number";
|
2276 | },
|
2277 | isUndefined = function (v) {
|
2278 | return typeof v === "undefined";
|
2279 | },
|
2280 | isDefined = function (v) {
|
2281 | return typeof v !== "undefined";
|
2282 | },
|
2283 | isboolean = function (v) {
|
2284 | return typeof v === "boolean";
|
2285 | },
|
2286 | ceil10 = function (v) {
|
2287 | return Math.ceil(v / 10) * 10;
|
2288 | },
|
2289 | asHalfPixel = function (n) {
|
2290 | return Math.ceil(n) + .5;
|
2291 | },
|
2292 | diffDomain = function (d) {
|
2293 | return d[1] - d[0];
|
2294 | },
|
2295 | isObjectType = function (v) {
|
2296 | return typeof v === "object";
|
2297 | },
|
2298 | isEmpty = function (o) {
|
2299 | return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
2300 | },
|
2301 | notEmpty = function (o) {
|
2302 | return !isEmpty(o);
|
2303 | },
|
2304 | isArray = function (arr) {
|
2305 | return Array.isArray(arr);
|
2306 | },
|
2307 | isObject = function (obj) {
|
2308 | return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj);
|
2309 | };
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 | function getOption(options, key, defaultValue) {
|
2321 | return isDefined(options[key]) ? options[key] : defaultValue;
|
2322 | }
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 | function hasValue(dict, value) {
|
2333 | var found = !1;
|
2334 | return Object.keys(dict).forEach(function (key) {
|
2335 | return dict[key] === value && (found = !0);
|
2336 | }), found;
|
2337 | }
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 | function callFn(fn) {
|
2348 | 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];
|
2349 |
|
2350 | return isFn && fn.call.apply(fn, args), isFn;
|
2351 | }
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 | function endall(transition, cb) {
|
2361 | var n = 0;
|
2362 | transition.each(function () {
|
2363 | return ++n;
|
2364 | }).on("end", function () {
|
2365 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
|
2366 |
|
2367 | --n || cb.apply.apply(cb, [this].concat(args));
|
2368 | });
|
2369 | }
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 | function sanitise(str) {
|
2379 | return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
2380 | }
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 | function setTextValue(node, text, dy, toMiddle) {
|
2392 | if (dy === void 0 && (dy = [-1, 1]), toMiddle === void 0 && (toMiddle = !1), node && isString(text)) if (text.indexOf("\n") === -1) node.text(text);else {
|
2393 | var diff = [node.text(), text].map(function (v) {
|
2394 | return v.replace(/[\s\n]/g, "");
|
2395 | });
|
2396 |
|
2397 | if (diff[0] !== diff[1]) {
|
2398 | var multiline = text.split("\n"),
|
2399 | len = toMiddle ? multiline.length - 1 : 1;
|
2400 | node.html(""), multiline.forEach(function (v, i) {
|
2401 | node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
2402 | });
|
2403 | }
|
2404 | }
|
2405 | }
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 | function getRectSegList(path) {
|
2415 | |
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 | var _path$getBBox = path.getBBox(),
|
2423 | x = _path$getBBox.x,
|
2424 | y = _path$getBBox.y,
|
2425 | width = _path$getBBox.width,
|
2426 | height = _path$getBBox.height;
|
2427 |
|
2428 | return [{
|
2429 | x: x,
|
2430 | y: y + height
|
2431 | },
|
2432 | {
|
2433 | x: x,
|
2434 | y: y
|
2435 | },
|
2436 | {
|
2437 | x: x + width,
|
2438 | y: y
|
2439 | },
|
2440 | {
|
2441 | x: x + width,
|
2442 | y: y + height
|
2443 | }
|
2444 | ];
|
2445 | }
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 | function getPathBox(path) {
|
2455 | var _path$getBoundingClie = path.getBoundingClientRect(),
|
2456 | width = _path$getBoundingClie.width,
|
2457 | height = _path$getBoundingClie.height,
|
2458 | items = getRectSegList(path),
|
2459 | x = items[0].x,
|
2460 | y = Math.min(items[0].y, items[1].y);
|
2461 |
|
2462 | return {
|
2463 | x: x,
|
2464 | y: y,
|
2465 | width: width,
|
2466 | height: height
|
2467 | };
|
2468 | }
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 | function getPointer(event, element) {
|
2479 | var touches = event && (event.touches || event.sourceEvent && event.sourceEvent.touches),
|
2480 | pointer = event ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches ? touches[0] : event, element) : [0, 0];
|
2481 | return pointer;
|
2482 | }
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 | function getBrushSelection(ctx) {
|
2492 | var selection,
|
2493 | event = ctx.event,
|
2494 | $el = ctx.$el,
|
2495 | main = $el.subchart.main || $el.main;
|
2496 | return event && event.type === "brush" ? selection = event.selection : main && (selection = main.select("." + config_classes.brush).node()) && (selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection)), selection;
|
2497 | }
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 | function getBoundingRect(node) {
|
2508 | var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
2509 | return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
2510 | }
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 | function getRandom(asStr) {
|
2520 | asStr === void 0 && (asStr = !0);
|
2521 | var rand = Math.random();
|
2522 | return asStr ? rand + "" : rand;
|
2523 | }
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 | function findIndex(arr, v, start, end, isRotated) {
|
2537 | if (start > end) return -1;
|
2538 | var mid = Math.floor((start + end) / 2),
|
2539 | _arr$mid = arr[mid],
|
2540 | x = _arr$mid.x,
|
2541 | _arr$mid$w = _arr$mid.w,
|
2542 | w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
2543 | return isRotated && (x = arr[mid].y, w = arr[mid].h), v >= x && v <= x + w ? mid : v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
2544 | }
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 | function brushEmpty(ctx) {
|
2554 | var selection = getBrushSelection(ctx);
|
2555 | return !selection || selection[0] === selection[1];
|
2556 | }
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 | function deepClone() {
|
2566 | for (var clone = function (_clone) {
|
2567 | function clone() {
|
2568 | return _clone.apply(this, arguments);
|
2569 | }
|
2570 |
|
2571 | return clone.toString = function () {
|
2572 | return _clone.toString();
|
2573 | }, clone;
|
2574 | }(function (v) {
|
2575 | if (isObject(v) && v.constructor) {
|
2576 | var r = new v.constructor();
|
2577 |
|
2578 | for (var k in v) r[k] = clone(v[k]);
|
2579 |
|
2580 | return r;
|
2581 | }
|
2582 |
|
2583 | return v;
|
2584 | }), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) objectN[_key3] = arguments[_key3];
|
2585 |
|
2586 | return objectN.map(function (v) {
|
2587 | return clone(v);
|
2588 | }).reduce(function (a, c) {
|
2589 | return _objectSpread(_objectSpread({}, a), c);
|
2590 | });
|
2591 | }
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 | function extend(target, source) {
|
2602 |
|
2603 | for (var p in target === void 0 && (target = {}), isArray(source) && source.forEach(function (v) {
|
2604 | return extend(target, v);
|
2605 | }), source) /^\d+$/.test(p) || p in target || (target[p] = source[p]);
|
2606 |
|
2607 | return target;
|
2608 | }
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 | var capitalize = function (str) {
|
2618 | return str.charAt(0).toUpperCase() + str.slice(1);
|
2619 | },
|
2620 | toArray = function (v) {
|
2621 | return [].slice.call(v);
|
2622 | };
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 | function getCssRules(styleSheets) {
|
2638 | var rules = [];
|
2639 | return styleSheets.forEach(function (sheet) {
|
2640 | try {
|
2641 | sheet.cssRules && sheet.cssRules.length && (rules = rules.concat(toArray(sheet.cssRules)));
|
2642 | } catch (e) {
|
2643 | console.error("Error while reading rules from " + sheet.href + ": " + e.toString());
|
2644 | }
|
2645 | }), rules;
|
2646 | }
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 | var getTranslation = function (node) {
|
2656 | var transform = node ? node.transform : null,
|
2657 | baseVal = transform && transform.baseVal;
|
2658 | return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
2659 | a: 0,
|
2660 | b: 0,
|
2661 | c: 0,
|
2662 | d: 0,
|
2663 | e: 0,
|
2664 | f: 0
|
2665 | };
|
2666 | };
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 | function getUnique(data) {
|
2676 | var isDate = data[0] instanceof Date,
|
2677 | d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
2678 | return self.indexOf(v) === i;
|
2679 | });
|
2680 | return isDate ? d.map(function (v) {
|
2681 | return new Date(v);
|
2682 | }) : d;
|
2683 | }
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 | function mergeArray(arr) {
|
2693 | return arr && arr.length ? arr.reduce(function (p, c) {
|
2694 | return p.concat(c);
|
2695 | }) : [];
|
2696 | }
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 | function mergeObj(target) {
|
2707 | for (var _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) objectN[_key4 - 1] = arguments[_key4];
|
2708 |
|
2709 | if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
2710 | var source = objectN.shift();
|
2711 | return isObject(target) && isObject(source) && Object.keys(source).forEach(function (key) {
|
2712 | var value = source[key];
|
2713 | isObject(value) ? (!target[key] && (target[key] = {}), target[key] = mergeObj(target[key], value)) : target[key] = isArray(value) ? value.concat() : value;
|
2714 | }), mergeObj.apply(void 0, [target].concat(objectN));
|
2715 | }
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 | function sortValue(data, isAsc) {
|
2726 | isAsc === void 0 && (isAsc = !0);
|
2727 | var fn;
|
2728 | return data[0] instanceof Date ? fn = isAsc ? function (a, b) {
|
2729 | return a - b;
|
2730 | } : function (a, b) {
|
2731 | return b - a;
|
2732 | } : isAsc && !data.every(isNaN) ? fn = function (a, b) {
|
2733 | return a - b;
|
2734 | } : !isAsc && (fn = function (a, b) {
|
2735 | return a > b && -1 || a < b && 1 || a === b && 0;
|
2736 | }), data.concat().sort(fn);
|
2737 | }
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 | function getMinMax(type, data) {
|
2748 | var res = data.filter(function (v) {
|
2749 | return notEmpty(v);
|
2750 | });
|
2751 | return res.length ? isNumber(res[0]) ? res = Math[type].apply(Math, res) : res[0] instanceof Date && (res = sortValue(res, type === "min")[0]) : res = undefined, res;
|
2752 | }
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 | var getRange = function (start, end, step) {
|
2764 | step === void 0 && (step = 1);
|
2765 | var res = [],
|
2766 | n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
2767 |
|
2768 | for (var i = start; i < n; i++) res.push(start + i * step);
|
2769 |
|
2770 | return res;
|
2771 | },
|
2772 | emulateEvent = {
|
2773 | mouse: function () {
|
2774 | var getParams = function () {
|
2775 | return {
|
2776 | bubbles: !1,
|
2777 | cancelable: !1,
|
2778 | screenX: 0,
|
2779 | screenY: 0,
|
2780 | clientX: 0,
|
2781 | clientY: 0
|
2782 | };
|
2783 | };
|
2784 |
|
2785 | try {
|
2786 | return new MouseEvent("t"), function (el, eventType, params) {
|
2787 | params === void 0 && (params = getParams()), el.dispatchEvent(new MouseEvent(eventType, params));
|
2788 | };
|
2789 | } catch (e) {
|
2790 |
|
2791 | return function (el, eventType, params) {
|
2792 | params === void 0 && (params = getParams());
|
2793 | var mouseEvent = browser_doc.createEvent("MouseEvent");
|
2794 |
|
2795 | mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
2796 | params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
2797 | };
|
2798 | }
|
2799 | }(),
|
2800 | touch: function touch(el, eventType, params) {
|
2801 | var touchObj = new Touch(mergeObj({
|
2802 | identifier: Date.now(),
|
2803 | target: el,
|
2804 | radiusX: 2.5,
|
2805 | radiusY: 2.5,
|
2806 | rotationAngle: 10,
|
2807 | force: .5
|
2808 | }, params));
|
2809 | el.dispatchEvent(new TouchEvent(eventType, {
|
2810 | cancelable: !0,
|
2811 | bubbles: !0,
|
2812 | shiftKey: !0,
|
2813 | touches: [touchObj],
|
2814 | targetTouches: [],
|
2815 | changedTouches: [touchObj]
|
2816 | }));
|
2817 | }
|
2818 | };
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 | function tplProcess(tpl, data) {
|
2829 | var res = tpl;
|
2830 |
|
2831 | for (var x in data) res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
2832 |
|
2833 | return res;
|
2834 | }
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 | function parseDate(date) {
|
2845 | var parsedDate;
|
2846 | if (date instanceof Date) parsedDate = date;else if (isString(date)) {
|
2847 | var config = this.config,
|
2848 | format = this.format;
|
2849 | parsedDate = format.dataTime(config.data_xFormat)(date);
|
2850 | } else isNumber(date) && !isNaN(date) && (parsedDate = new Date(+date));
|
2851 | return (!parsedDate || isNaN(+parsedDate)) && console && console.error && console.error("Failed to parse x '" + date + "' to Date object"), parsedDate;
|
2852 | }
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 | function isTabVisible() {
|
2861 | return !browser_doc.hidden;
|
2862 | }
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 | function convertInputType(mouse, touch) {
|
2873 | var isMobile = !1;
|
2874 |
|
2875 | if (/Mobi/.test(win.navigator.userAgent) && touch) {
|
2876 |
|
2877 | var hasTouchPoints = win.navigator && "maxTouchPoints" in win.navigator && win.navigator.maxTouchPoints > 0,
|
2878 | hasTouch = "ontouchmove" in win || win.DocumentTouch && browser_doc instanceof win.DocumentTouch;
|
2879 |
|
2880 |
|
2881 | isMobile = hasTouchPoints || hasTouch;
|
2882 | }
|
2883 |
|
2884 | var hasMouse = !(!mouse || isMobile) && "onmouseover" in win;
|
2885 | return hasMouse && "mouse" || isMobile && "touch" || null;
|
2886 | }
|
2887 | ;
|
2888 |
|
2889 |
|
2890 | function Options_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2891 |
|
2892 | function Options_objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = arguments[i] == null ? {} : arguments[i], i % 2 ? Options_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Options_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 | var Options = function () {
|
2915 | function Options() {
|
2916 | return deepClone(main, data, color, interaction, legend, title, tooltip, Options.data);
|
2917 | }
|
2918 |
|
2919 | return Options.setOptions = function setOptions(options) {
|
2920 | this.data = options.reduce(function (a, c) {
|
2921 | return Options_objectSpread(Options_objectSpread({}, a), c);
|
2922 | }, this.data);
|
2923 | }, Options;
|
2924 | }();
|
2925 |
|
2926 | Options.data = {};
|
2927 |
|
2928 | ;
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 | var KEY = {
|
2941 | bubbleBaseLength: "$baseLength",
|
2942 | colorPattern: "__colorPattern__",
|
2943 | dataMinMax: "$dataMinMax",
|
2944 | dataTotalSum: "$dataTotalSum",
|
2945 | dataTotalPerIndex: "$totalPerIndex",
|
2946 | legendItemTextBox: "legendItemTextBox",
|
2947 | radarPoints: "$radarPoints",
|
2948 | setOverOut: "setOverOut",
|
2949 | callOverOutForTouch: "callOverOutForTouch",
|
2950 | textRect: "textRect"
|
2951 | };
|
2952 |
|
2953 | var Cache = function () {
|
2954 | function Cache() {
|
2955 | this.cache = {};
|
2956 | }
|
2957 |
|
2958 | var _proto = Cache.prototype;
|
2959 | return _proto.add =
|
2960 | |
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 | function add(key, value, isDataType) {
|
2969 | return isDataType === void 0 && (isDataType = !1), this.cache[key] = isDataType ? this.cloneTarget(value) : value, this.cache[key];
|
2970 | }
|
2971 | |
2972 |
|
2973 |
|
2974 |
|
2975 |
|
2976 | , _proto.remove = function remove(key) {
|
2977 | var _this = this;
|
2978 |
|
2979 | toArray(key).forEach(function (v) {
|
2980 | return delete _this.cache[v];
|
2981 | });
|
2982 | }
|
2983 | |
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 |
|
2990 | , _proto.get = function get(key, isDataType) {
|
2991 | if (isDataType === void 0 && (isDataType = !1), isDataType) {
|
2992 | for (var id, targets = [], i = 0; id = key[i]; i++) id in this.cache && targets.push(this.cloneTarget(this.cache[id]));
|
2993 |
|
2994 | return targets;
|
2995 | }
|
2996 |
|
2997 | var value = this.cache[key];
|
2998 | return isValue(value) ? value : null;
|
2999 | }
|
3000 | |
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 | , _proto.reset = function reset(all) {
|
3006 | var $$ = this;
|
3007 |
|
3008 | for (var x in $$.cache) (all || /^\$/.test(x)) && ($$.cache[x] = null);
|
3009 | }
|
3010 | |
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 |
|
3017 | , _proto.cloneTarget = function cloneTarget(target) {
|
3018 | return {
|
3019 | id: target.id,
|
3020 | id_org: target.id_org,
|
3021 | values: target.values.map(function (d) {
|
3022 | return {
|
3023 | x: d.x,
|
3024 | value: d.value,
|
3025 | id: d.id
|
3026 | };
|
3027 | })
|
3028 | };
|
3029 | }, Cache;
|
3030 | }();
|
3031 |
|
3032 |
|
3033 | ;
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 | var generator_setTimeout = win.setTimeout,
|
3041 | generator_clearTimeout = win.clearTimeout;
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 | function generateResize() {
|
3049 | var timeout,
|
3050 | fn = [],
|
3051 | callResizeFn = function () {
|
3052 | callResizeFn.clear(), timeout = generator_setTimeout(function () {
|
3053 | fn.forEach(function (f) {
|
3054 | return f();
|
3055 | });
|
3056 | }, 200);
|
3057 | };
|
3058 |
|
3059 | return callResizeFn.clear = function () {
|
3060 | timeout && (generator_clearTimeout(timeout), timeout = null);
|
3061 | }, callResizeFn.add = function (f) {
|
3062 | return fn.push(f);
|
3063 | }, callResizeFn.remove = function (f) {
|
3064 | return fn.splice(fn.indexOf(f), 1);
|
3065 | }, callResizeFn;
|
3066 | }
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 | function generateWait() {
|
3074 | var transitionsToWait = [],
|
3075 | f = function (t, callback) {
|
3076 |
|
3077 | function loop() {
|
3078 | for (var _t, done = 0, i = 0; _t = transitionsToWait[i]; i++) {
|
3079 | if (_t === !0 || _t.empty && _t.empty()) {
|
3080 | done++;
|
3081 | continue;
|
3082 | }
|
3083 |
|
3084 | try {
|
3085 | _t.transition();
|
3086 | } catch (e) {
|
3087 | done++;
|
3088 | }
|
3089 | }
|
3090 |
|
3091 | timer && generator_clearTimeout(timer), done === transitionsToWait.length ? callback && callback() : timer = generator_setTimeout(loop, 50);
|
3092 | }
|
3093 |
|
3094 | var timer;
|
3095 | loop();
|
3096 | };
|
3097 |
|
3098 | return f.add = function (t) {
|
3099 | isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
|
3100 | }, f;
|
3101 | }
|
3102 |
|
3103 | var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(5);
|
3104 | ;
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 | var convert = ({
|
3118 | |
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 | convertData: function convertData(args, callback) {
|
3126 | var data;
|
3127 | if (args.bindto ? (data = {}, ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) {
|
3128 | var key = "data_" + v;
|
3129 | key in args && (data[v] = args[key]);
|
3130 | })) : data = args, data.url && callback) this.convertUrlToData(data.url, data.mimeType, data.headers, data.keys, callback);else if (data.json) data = this.convertJsonToData(data.json, data.keys);else if (data.rows) data = this.convertRowsToData(data.rows);else if (data.columns) data = this.convertColumnsToData(data.columns);else if (args.bindto) throw Error("url or json or rows or columns is required.");
|
3131 | return isArray(data) && data;
|
3132 | },
|
3133 |
|
3134 | |
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 | convertUrlToData: function convertUrlToData(url, mimeType, headers, keys, done) {
|
3144 | var _this = this;
|
3145 |
|
3146 | mimeType === void 0 && (mimeType = "csv");
|
3147 | var req = new XMLHttpRequest();
|
3148 | req.open("GET", url), headers && Object.keys(headers).forEach(function (key) {
|
3149 | req.setRequestHeader(key, headers[key]);
|
3150 | }), req.onreadystatechange = function () {
|
3151 | if (req.readyState === 4) if (req.status === 200) {
|
3152 | var response = req.responseText;
|
3153 | response && done.call(_this, _this["convert" + capitalize(mimeType) + "ToData"](mimeType === "json" ? JSON.parse(response) : response, keys));
|
3154 | } else throw new Error(url + ": Something went wrong loading!");
|
3155 | }, req.send();
|
3156 | },
|
3157 |
|
3158 | |
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 | convertCsvTsvToData: function convertCsvTsvToData(parser, xsv) {
|
3166 | var d,
|
3167 | rows = parser.rows(xsv);
|
3168 | return rows.length === 1 ? (d = [{}], rows[0].forEach(function (id) {
|
3169 | d[0][id] = null;
|
3170 | })) : d = parser.parse(xsv), d;
|
3171 | },
|
3172 | convertCsvToData: function convertCsvToData(xsv) {
|
3173 | return this.convertCsvTsvToData({
|
3174 | rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParseRows,
|
3175 | parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParse
|
3176 | }, xsv);
|
3177 | },
|
3178 | convertTsvToData: function convertTsvToData(tsv) {
|
3179 | return this.convertCsvTsvToData({
|
3180 | rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParseRows,
|
3181 | parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParse
|
3182 | }, tsv);
|
3183 | },
|
3184 | convertJsonToData: function convertJsonToData(json, keysParam) {
|
3185 | var targetKeys,
|
3186 | data,
|
3187 | _this2 = this,
|
3188 | config = this.config,
|
3189 | newRows = [];
|
3190 |
|
3191 | if (isArray(json)) {
|
3192 | var keys = keysParam || config.data_keys;
|
3193 | keys.x ? (targetKeys = keys.value.concat(keys.x), config.data_x = keys.x) : targetKeys = keys.value, newRows.push(targetKeys), json.forEach(function (o) {
|
3194 | var newRow = targetKeys.map(function (key) {
|
3195 |
|
3196 | var v = _this2.findValueInJson(o, key);
|
3197 |
|
3198 | return isUndefined(v) && (v = null), v;
|
3199 | });
|
3200 | newRows.push(newRow);
|
3201 | }), data = this.convertRowsToData(newRows);
|
3202 | } else Object.keys(json).forEach(function (key) {
|
3203 | var tmp = json[key].concat();
|
3204 | tmp.unshift(key), newRows.push(tmp);
|
3205 | }), data = this.convertColumnsToData(newRows);
|
3206 |
|
3207 | return data;
|
3208 | },
|
3209 | findValueInJson: function findValueInJson(object, path) {
|
3210 | if (object[path] !== undefined) return object[path];
|
3211 | var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"),
|
3212 | pathArray = convertedPath.replace(/^\./, "").split("."),
|
3213 | target = object;
|
3214 |
|
3215 | return pathArray.some(function (k) {
|
3216 | return !(target = target && k in target ? target[k] : undefined);
|
3217 | }), target;
|
3218 | },
|
3219 | convertRowsToData: function convertRowsToData(rows) {
|
3220 | var keys = rows[0],
|
3221 | newRows = [];
|
3222 | return rows.forEach(function (row, i) {
|
3223 | if (i > 0) {
|
3224 | var newRow = {};
|
3225 | row.forEach(function (v, j) {
|
3226 | if (isUndefined(v)) throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
|
3227 | newRow[keys[j]] = v;
|
3228 | }), newRows.push(newRow);
|
3229 | }
|
3230 | }), newRows;
|
3231 | },
|
3232 | convertColumnsToData: function convertColumnsToData(columns) {
|
3233 | var newRows = [];
|
3234 | return columns.forEach(function (col, i) {
|
3235 | var key = col[0];
|
3236 | col.forEach(function (v, j) {
|
3237 | if (j > 0) {
|
3238 | if (isUndefined(newRows[j - 1]) && (newRows[j - 1] = {}), isUndefined(v)) throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
|
3239 | newRows[j - 1][key] = v;
|
3240 | }
|
3241 | });
|
3242 | }), newRows;
|
3243 | },
|
3244 | convertDataToTargets: function convertDataToTargets(data, appendXs) {
|
3245 | var _this3 = this,
|
3246 | $$ = this,
|
3247 | axis = $$.axis,
|
3248 | config = $$.config,
|
3249 | state = $$.state,
|
3250 | isCategorized = !1,
|
3251 | isTimeSeries = !1,
|
3252 | isCustomX = !1;
|
3253 |
|
3254 | axis && (isCategorized = axis.isCategorized(), isTimeSeries = axis.isTimeSeries(), isCustomX = axis.isCustomX());
|
3255 | var xsData,
|
3256 | dataKeys = Object.keys(data[0] || {}),
|
3257 | ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [],
|
3258 | xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : [];
|
3259 | ids.forEach(function (id) {
|
3260 | var xKey = _this3.getXKey(id);
|
3261 |
|
3262 | isCustomX || isTimeSeries ? xs.indexOf(xKey) >= 0 ? xsData = (appendXs && $$.data.xs[id] || []).concat(data.map(function (d) {
|
3263 | return d[xKey];
|
3264 | }).filter(isValue).map(function (rawX, i) {
|
3265 | return $$.generateTargetX(rawX, id, i);
|
3266 | })) : config.data_x ? xsData = _this3.getOtherTargetXs() : notEmpty(config.data_xs) && (xsData = $$.getXValuesOfXKey(xKey, $$.data.targets)) : xsData = data.map(function (d, i) {
|
3267 | return i;
|
3268 | }), xsData && (_this3.data.xs[id] = xsData);
|
3269 | }), ids.forEach(function (id) {
|
3270 | if (!_this3.data.xs[id]) throw new Error("x is not defined for id = \"" + id + "\".");
|
3271 | });
|
3272 |
|
3273 | var targets = ids.map(function (id, index) {
|
3274 | var convertedId = config.data_idConverter.bind($$.api)(id),
|
3275 | xKey = $$.getXKey(id),
|
3276 | isCategory = isCustomX && isCategorized,
|
3277 | hasCategory = isCategory && data.map(function (v) {
|
3278 | return v.x;
|
3279 | }).every(function (v) {
|
3280 | return config.axis_x_categories.indexOf(v) > -1;
|
3281 | });
|
3282 | return {
|
3283 | id: convertedId,
|
3284 | id_org: id,
|
3285 | values: data.map(function (d, i) {
|
3286 | var x,
|
3287 | rawX = d[xKey],
|
3288 | value = d[id];
|
3289 | return value = value === null || isNaN(value) || isObject(value) ? isArray(value) || isObject(value) ? value : null : +value, (isCategory || state.hasRadar) && 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(value) || $$.data.xs[id].length <= i) && (x = undefined), {
|
3290 | x: x,
|
3291 | value: value,
|
3292 | id: convertedId
|
3293 | };
|
3294 | }).filter(function (v) {
|
3295 | return isDefined(v.x);
|
3296 | })
|
3297 | };
|
3298 | });
|
3299 |
|
3300 | return targets.forEach(function (t) {
|
3301 | config.data_xSort && (t.values = t.values.sort(function (v1, v2) {
|
3302 | var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
|
3303 | x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
|
3304 | return x1 - x2;
|
3305 | })), t.values.forEach(function (v, i) {
|
3306 | return v.index = i;
|
3307 | }), $$.data.xs[t.id].sort(function (v1, v2) {
|
3308 | return v1 - v2;
|
3309 | });
|
3310 | }), state.hasNegativeValue = $$.hasNegativeValueInTargets(targets), state.hasPositiveValue = $$.hasPositiveValueInTargets(targets), config.data_type && $$.setTargetType($$.mapToIds(targets).filter(function (id) {
|
3311 | return !(id in config.data_types);
|
3312 | }), config.data_type), targets.forEach(function (d) {
|
3313 | return $$.cache.add(d.id_org, d, !0);
|
3314 | }), targets;
|
3315 | }
|
3316 | });
|
3317 | ;
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 | var data_data = ({
|
3326 | isX: function isX(key) {
|
3327 | var $$ = this,
|
3328 | config = $$.config,
|
3329 | dataKey = config.data_x && key === config.data_x,
|
3330 | existValue = notEmpty(config.data_xs) && hasValue(config.data_xs, key);
|
3331 | return dataKey || existValue;
|
3332 | },
|
3333 | isNotX: function isNotX(key) {
|
3334 | return !this.isX(key);
|
3335 | },
|
3336 | isStackNormalized: function isStackNormalized() {
|
3337 | var config = this.config;
|
3338 | return !!(config.data_stack_normalize && config.data_groups.length);
|
3339 | },
|
3340 | isGrouped: function isGrouped(id) {
|
3341 | var groups = this.config.data_groups;
|
3342 | return id ? groups.some(function (v) {
|
3343 | return v.indexOf(id) >= 0 && v.length > 1;
|
3344 | }) : groups.length > 0;
|
3345 | },
|
3346 | getXKey: function getXKey(id) {
|
3347 | var $$ = this,
|
3348 | config = $$.config;
|
3349 | return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;
|
3350 | },
|
3351 | getXValuesOfXKey: function getXValuesOfXKey(key, targets) {
|
3352 | var xValues,
|
3353 | $$ = this,
|
3354 | ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [];
|
3355 | return ids.forEach(function (id) {
|
3356 | $$.getXKey(id) === key && (xValues = $$.data.xs[id]);
|
3357 | }), xValues;
|
3358 | },
|
3359 |
|
3360 | |
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 | getIndexByX: function getIndexByX(x, basedX) {
|
3368 | var $$ = this;
|
3369 | return basedX ? basedX.indexOf(isString(x) ? x : +x) : ($$.filterByX($$.data.targets, x)[0] || {
|
3370 | index: null
|
3371 | }).index;
|
3372 | },
|
3373 | getXValue: function getXValue(id, i) {
|
3374 | var $$ = this;
|
3375 | return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;
|
3376 | },
|
3377 | getOtherTargetXs: function getOtherTargetXs() {
|
3378 | var $$ = this,
|
3379 | idsForX = Object.keys($$.data.xs);
|
3380 | return idsForX.length ? $$.data.xs[idsForX[0]] : null;
|
3381 | },
|
3382 | getOtherTargetX: function getOtherTargetX(index) {
|
3383 | var xs = this.getOtherTargetXs();
|
3384 | return xs && index < xs.length ? xs[index] : null;
|
3385 | },
|
3386 | addXs: function addXs(xs) {
|
3387 | var $$ = this,
|
3388 | config = $$.config;
|
3389 | Object.keys(xs).forEach(function (id) {
|
3390 | config.data_xs[id] = xs[id];
|
3391 | });
|
3392 | },
|
3393 | isMultipleX: function isMultipleX() {
|
3394 | return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType("bubble") || this.hasType("scatter");
|
3395 | },
|
3396 | addName: function addName(data) {
|
3397 | var name,
|
3398 | $$ = this,
|
3399 | config = $$.config;
|
3400 | return data && (name = config.data_names[data.id], data.name = name === undefined ? data.id : name), data;
|
3401 | },
|
3402 |
|
3403 | |
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 | getAllValuesOnIndex: function getAllValuesOnIndex(index, filterNull) {
|
3411 | filterNull === void 0 && (filterNull = !1);
|
3412 | var $$ = this,
|
3413 | value = $$.filterTargetsToShow($$.data.targets).map(function (t) {
|
3414 | return $$.addName($$.getValueOnIndex(t.values, index));
|
3415 | });
|
3416 | return filterNull && (value = value.filter(function (v) {
|
3417 | return isValue(v.value);
|
3418 | })), value;
|
3419 | },
|
3420 | getValueOnIndex: function getValueOnIndex(values, index) {
|
3421 | var valueOnIndex = values.filter(function (v) {
|
3422 | return v.index === index;
|
3423 | });
|
3424 | return valueOnIndex.length ? valueOnIndex[0] : null;
|
3425 | },
|
3426 | updateTargetX: function updateTargetX(targets, x) {
|
3427 | var $$ = this;
|
3428 | targets.forEach(function (t) {
|
3429 | t.values.forEach(function (v, i) {
|
3430 | v.x = $$.generateTargetX(x[i], t.id, i);
|
3431 | }), $$.data.xs[t.id] = x;
|
3432 | });
|
3433 | },
|
3434 | updateTargetXs: function updateTargetXs(targets, xs) {
|
3435 | var $$ = this;
|
3436 | targets.forEach(function (t) {
|
3437 | xs[t.id] && $$.updateTargetX([t], xs[t.id]);
|
3438 | });
|
3439 | },
|
3440 | generateTargetX: function generateTargetX(rawX, id, index) {
|
3441 | var $$ = this,
|
3442 | axis = $$.axis,
|
3443 | x = axis && axis.isCategorized() ? index : rawX || index;
|
3444 |
|
3445 | if (axis && axis.isTimeSeries()) {
|
3446 | var fn = parseDate.bind($$);
|
3447 | x = rawX ? fn(rawX) : fn($$.getXValue(id, index));
|
3448 | } else axis && axis.isCustomX() && !axis.isCategorized() && (x = isValue(rawX) ? +rawX : $$.getXValue(id, index));
|
3449 |
|
3450 | return x;
|
3451 | },
|
3452 | updateXs: function updateXs(values) {
|
3453 | values.length && (this.axis.xs = values.map(function (v) {
|
3454 | return v.x;
|
3455 | }));
|
3456 | },
|
3457 | getPrevX: function getPrevX(i) {
|
3458 | var x = this.axis.xs[i - 1];
|
3459 | return isDefined(x) ? x : null;
|
3460 | },
|
3461 | getNextX: function getNextX(i) {
|
3462 | var x = this.axis.xs[i + 1];
|
3463 | return isDefined(x) ? x : null;
|
3464 | },
|
3465 |
|
3466 | |
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 | getBaseValue: function getBaseValue(data) {
|
3473 | var $$ = this,
|
3474 | hasAxis = $$.state.hasAxis,
|
3475 | value = data.value;
|
3476 | return value && hasAxis && ($$.isAreaRangeType(data) ? value = $$.getRangedData(data, "mid") : $$.isBubbleZType(data) && (value = $$.getBubbleZData(value, "y"))), value;
|
3477 | },
|
3478 |
|
3479 | |
3480 |
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 | getMinMaxValue: function getMinMaxValue(data) {
|
3486 | var min,
|
3487 | max,
|
3488 | getBaseValue = this.getBaseValue.bind(this);
|
3489 | return (data || this.data.targets.map(function (t) {
|
3490 | return t.values;
|
3491 | })).forEach(function (v, i) {
|
3492 | var value = v.map(getBaseValue).filter(isNumber);
|
3493 | min = Math.min.apply(Math, [i ? min : Infinity].concat(value)), max = Math.max.apply(Math, [i ? max : -Infinity].concat(value));
|
3494 | }), {
|
3495 | min: min,
|
3496 | max: max
|
3497 | };
|
3498 | },
|
3499 |
|
3500 | |
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 | getMinMaxData: function getMinMaxData() {
|
3506 | var $$ = this,
|
3507 | cacheKey = KEY.dataMinMax,
|
3508 | minMaxData = $$.cache.get(cacheKey);
|
3509 |
|
3510 | if (!minMaxData) {
|
3511 | var data = $$.data.targets.map(function (t) {
|
3512 | return t.values;
|
3513 | }),
|
3514 | minMax = $$.getMinMaxValue(data),
|
3515 | min = [],
|
3516 | max = [];
|
3517 |
|
3518 | data.forEach(function (v) {
|
3519 | var minData = $$.getFilteredDataByValue(v, minMax.min),
|
3520 | maxData = $$.getFilteredDataByValue(v, minMax.max);
|
3521 | minData.length && (min = min.concat(minData)), maxData.length && (max = max.concat(maxData));
|
3522 | }), $$.cache.add(cacheKey, minMaxData = {
|
3523 | min: min,
|
3524 | max: max
|
3525 | });
|
3526 | }
|
3527 |
|
3528 | return minMaxData;
|
3529 | },
|
3530 |
|
3531 | |
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 | getTotalPerIndex: function getTotalPerIndex() {
|
3537 | var $$ = this,
|
3538 | cacheKey = KEY.dataTotalPerIndex,
|
3539 | sum = $$.cache.get(cacheKey);
|
3540 | return $$.isStackNormalized() && !sum && (sum = [], $$.data.targets.forEach(function (row) {
|
3541 | row.values.forEach(function (v, i) {
|
3542 | sum[i] || (sum[i] = 0), sum[i] += isNumber(v.value) ? v.value : 0;
|
3543 | });
|
3544 | })), sum;
|
3545 | },
|
3546 |
|
3547 | |
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 | getTotalDataSum: function getTotalDataSum(subtractHidden) {
|
3554 | var $$ = this,
|
3555 | cacheKey = KEY.dataTotalSum,
|
3556 | total = $$.cache.get(cacheKey);
|
3557 |
|
3558 | if (!isNumber(total)) {
|
3559 | var sum = mergeArray($$.data.targets.map(function (t) {
|
3560 | return t.values;
|
3561 | })).map(function (v) {
|
3562 | return v.value;
|
3563 | }).reduce(function (p, c) {
|
3564 | return p + c;
|
3565 | });
|
3566 | $$.cache.add(cacheKey, total = sum);
|
3567 | }
|
3568 |
|
3569 | return subtractHidden && (total -= $$.getHiddenTotalDataSum()), total;
|
3570 | },
|
3571 |
|
3572 | |
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 | getHiddenTotalDataSum: function getHiddenTotalDataSum() {
|
3578 | var $$ = this,
|
3579 | api = $$.api,
|
3580 | hiddenTargetIds = $$.state.hiddenTargetIds,
|
3581 | total = 0;
|
3582 | return hiddenTargetIds.length && (total = api.data.values.bind(api)(hiddenTargetIds).reduce(function (p, c) {
|
3583 | return p + c;
|
3584 | })), total;
|
3585 | },
|
3586 |
|
3587 | |
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 | getFilteredDataByValue: function getFilteredDataByValue(data, value) {
|
3595 | var _this = this;
|
3596 |
|
3597 | return data.filter(function (t) {
|
3598 | return _this.getBaseValue(t) === value;
|
3599 | });
|
3600 | },
|
3601 |
|
3602 | |
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 | getMaxDataCount: function getMaxDataCount() {
|
3608 | return Math.max.apply(Math, this.data.targets.map(function (t) {
|
3609 | return t.values.length;
|
3610 | }));
|
3611 | },
|
3612 | getMaxDataCountTarget: function getMaxDataCountTarget() {
|
3613 | var target = this.filterTargetsToShow() || [],
|
3614 | length = target.length;
|
3615 | return length > 1 ? (target = target.map(function (t) {
|
3616 | return t.values;
|
3617 | }).reduce(function (a, b) {
|
3618 | return a.concat(b);
|
3619 | }).map(function (v) {
|
3620 | return v.x;
|
3621 | }), target = sortValue(getUnique(target)).map(function (x, index) {
|
3622 | return {
|
3623 | x: x,
|
3624 | index: index
|
3625 | };
|
3626 | })) : length && (target = target[0].values), target;
|
3627 | },
|
3628 | mapToIds: function mapToIds(targets) {
|
3629 | return targets.map(function (d) {
|
3630 | return d.id;
|
3631 | });
|
3632 | },
|
3633 | mapToTargetIds: function mapToTargetIds(ids) {
|
3634 | var $$ = this;
|
3635 | return ids ? isArray(ids) ? ids.concat() : [ids] : $$.mapToIds($$.data.targets);
|
3636 | },
|
3637 | hasTarget: function hasTarget(targets, id) {
|
3638 | var ids = this.mapToIds(targets);
|
3639 |
|
3640 | for (var val, i = 0; val = ids[i]; i++) if (val === id) return !0;
|
3641 |
|
3642 | return !1;
|
3643 | },
|
3644 | isTargetToShow: function isTargetToShow(targetId) {
|
3645 | return this.state.hiddenTargetIds.indexOf(targetId) < 0;
|
3646 | },
|
3647 | isLegendToShow: function isLegendToShow(targetId) {
|
3648 | return this.state.hiddenLegendIds.indexOf(targetId) < 0;
|
3649 | },
|
3650 | filterTargetsToShow: function filterTargetsToShow(targets) {
|
3651 | var $$ = this;
|
3652 | return (targets || $$.data.targets).filter(function (t) {
|
3653 | return $$.isTargetToShow(t.id);
|
3654 | });
|
3655 | },
|
3656 | mapTargetsToUniqueXs: function mapTargetsToUniqueXs(targets) {
|
3657 | var $$ = this,
|
3658 | axis = $$.axis,
|
3659 | xs = [];
|
3660 | return targets && targets.length && (xs = getUnique(mergeArray(targets.map(function (t) {
|
3661 | return t.values.map(function (v) {
|
3662 | return +v.x;
|
3663 | });
|
3664 | }))), xs = axis && axis.isTimeSeries() ? xs.map(function (x) {
|
3665 | return new Date(+x);
|
3666 | }) : xs.map(function (x) {
|
3667 | return +x;
|
3668 | })), sortValue(xs);
|
3669 | },
|
3670 | addHiddenTargetIds: function addHiddenTargetIds(targetIds) {
|
3671 | this.state.hiddenTargetIds = this.state.hiddenTargetIds.concat(targetIds);
|
3672 | },
|
3673 | removeHiddenTargetIds: function removeHiddenTargetIds(targetIds) {
|
3674 | this.state.hiddenTargetIds = this.state.hiddenTargetIds.filter(function (id) {
|
3675 | return targetIds.indexOf(id) < 0;
|
3676 | });
|
3677 | },
|
3678 | addHiddenLegendIds: function addHiddenLegendIds(targetIds) {
|
3679 | this.state.hiddenLegendIds = this.state.hiddenLegendIds.concat(targetIds);
|
3680 | },
|
3681 | removeHiddenLegendIds: function removeHiddenLegendIds(targetIds) {
|
3682 | this.state.hiddenLegendIds = this.state.hiddenLegendIds.filter(function (id) {
|
3683 | return targetIds.indexOf(id) < 0;
|
3684 | });
|
3685 | },
|
3686 | getValuesAsIdKeyed: function getValuesAsIdKeyed(targets) {
|
3687 | var $$ = this,
|
3688 | hasAxis = $$.state.hasAxis,
|
3689 | ys = {},
|
3690 | isMultipleX = $$.isMultipleX(),
|
3691 | xs = isMultipleX ? $$.mapTargetsToUniqueXs(targets).map(function (v) {
|
3692 | return isString(v) ? v : +v;
|
3693 | }) : null;
|
3694 | return targets.forEach(function (t) {
|
3695 | var data = [];
|
3696 | t.values.filter(function (v) {
|
3697 | return isValue(v.value);
|
3698 | }).forEach(function (v) {
|
3699 | var value = v.value;
|
3700 |
|
3701 | $$.isCandlestickType(v) && (value = isArray(value) ? value.slice(0, 4) : [value.open, value.high, value.low, value.close]), isArray(value) ? data.push.apply(data, value) : isObject(value) && "high" in value ? data.push.apply(data, Object.values(value)) : $$.isBubbleZType(v) ? data.push(hasAxis && $$.getBubbleZData(value, "y")) : isMultipleX ? data[$$.getIndexByX(v.x, xs)] = value : data.push(value);
|
3702 | }), ys[t.id] = data;
|
3703 | }), ys;
|
3704 | },
|
3705 | checkValueInTargets: function checkValueInTargets(targets, checker) {
|
3706 | var values,
|
3707 | ids = Object.keys(targets);
|
3708 |
|
3709 | for (var i = 0; i < ids.length; i++) {
|
3710 | values = targets[ids[i]].values;
|
3711 |
|
3712 | for (var j = 0; j < values.length; j++) if (checker(values[j].value)) return !0;
|
3713 | }
|
3714 |
|
3715 | return !1;
|
3716 | },
|
3717 | hasMultiTargets: function hasMultiTargets() {
|
3718 | return this.filterTargetsToShow().length > 1;
|
3719 | },
|
3720 | hasNegativeValueInTargets: function hasNegativeValueInTargets(targets) {
|
3721 | return this.checkValueInTargets(targets, function (v) {
|
3722 | return v < 0;
|
3723 | });
|
3724 | },
|
3725 | hasPositiveValueInTargets: function hasPositiveValueInTargets(targets) {
|
3726 | return this.checkValueInTargets(targets, function (v) {
|
3727 | return v > 0;
|
3728 | });
|
3729 | },
|
3730 | _checkOrder: function _checkOrder(type) {
|
3731 | var config = this.config,
|
3732 | order = config.data_order;
|
3733 | return isString(order) && order.toLowerCase() === type;
|
3734 | },
|
3735 | isOrderDesc: function isOrderDesc() {
|
3736 | return this._checkOrder("desc");
|
3737 | },
|
3738 | isOrderAsc: function isOrderAsc() {
|
3739 | return this._checkOrder("asc");
|
3740 | },
|
3741 |
|
3742 | |
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 | orderTargets: function orderTargets(targetsValue) {
|
3749 | var $$ = this,
|
3750 | targets = [].concat(targetsValue),
|
3751 | fn = $$.getSortCompareFn();
|
3752 | return fn && targets.sort(fn), targets;
|
3753 | },
|
3754 |
|
3755 | |
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 | getSortCompareFn: function getSortCompareFn(isArc) {
|
3762 | isArc === void 0 && (isArc = !1);
|
3763 | var fn,
|
3764 | $$ = this,
|
3765 | config = $$.config,
|
3766 | orderAsc = $$.isOrderAsc(),
|
3767 | orderDesc = $$.isOrderDesc();
|
3768 | return orderAsc || orderDesc ? fn = function (t1, t2) {
|
3769 | var reducer = function (p, c) {
|
3770 | return p + Math.abs(c.value);
|
3771 | },
|
3772 | t1Sum = t1.values.reduce(reducer, 0),
|
3773 | t2Sum = t2.values.reduce(reducer, 0);
|
3774 |
|
3775 | return isArc ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
3776 | } : isFunction(config.data_order) && (fn = config.data_order.bind($$.api)), fn || null;
|
3777 | },
|
3778 | filterByX: function filterByX(targets, x) {
|
3779 | return mergeArray(targets.map(function (t) {
|
3780 | return t.values;
|
3781 | })).filter(function (v) {
|
3782 | return v.x - x === 0;
|
3783 | });
|
3784 | },
|
3785 | filterRemoveNull: function filterRemoveNull(data) {
|
3786 | var _this2 = this;
|
3787 |
|
3788 | return data.filter(function (d) {
|
3789 | return isValue(_this2.getBaseValue(d));
|
3790 | });
|
3791 | },
|
3792 | filterByXDomain: function filterByXDomain(targets, xDomain) {
|
3793 | return targets.map(function (t) {
|
3794 | return {
|
3795 | id: t.id,
|
3796 | id_org: t.id_org,
|
3797 | values: t.values.filter(function (v) {
|
3798 | return xDomain[0] <= v.x && v.x <= xDomain[1];
|
3799 | })
|
3800 | };
|
3801 | });
|
3802 | },
|
3803 | hasDataLabel: function hasDataLabel() {
|
3804 | var dataLabels = this.config.data_labels;
|
3805 | return isboolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels);
|
3806 | },
|
3807 |
|
3808 | |
3809 |
|
3810 |
|
3811 |
|
3812 |
|
3813 | getDataIndexFromEvent: function getDataIndexFromEvent(event) {
|
3814 | var $$ = this,
|
3815 | config = $$.config,
|
3816 | _$$$state = $$.state,
|
3817 | inputType = _$$$state.inputType,
|
3818 | _$$$state$eventReceiv = _$$$state.eventReceiver,
|
3819 | coords = _$$$state$eventReceiv.coords,
|
3820 | rect = _$$$state$eventReceiv.rect,
|
3821 | isRotated = config.axis_rotated,
|
3822 | e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event,
|
3823 | index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
|
3824 | return index;
|
3825 | },
|
3826 | getDataLabelLength: function getDataLabelLength(min, max, key) {
|
3827 | var $$ = this,
|
3828 | lengths = [0, 0];
|
3829 | return $$.$el.chart.select("svg").selectAll(".dummy").data([min, max]).enter().append("text").text(function (d) {
|
3830 | return $$.dataLabelFormat(d.id)(d);
|
3831 | }).each(function (d, i) {
|
3832 | lengths[i] = this.getBoundingClientRect()[key] * 1.3;
|
3833 | }).remove(), lengths;
|
3834 | },
|
3835 | isNoneArc: function isNoneArc(d) {
|
3836 | return this.hasTarget(this.data.targets, d.id);
|
3837 | },
|
3838 | isArc: function isArc(d) {
|
3839 | return "data" in d && this.hasTarget(this.data.targets, d.data.id);
|
3840 | },
|
3841 | findSameXOfValues: function findSameXOfValues(values, index) {
|
3842 | var i,
|
3843 | targetX = values[index].x,
|
3844 | sames = [];
|
3845 |
|
3846 | for (i = index - 1; i >= 0 && !(targetX !== values[i].x); i--) sames.push(values[i]);
|
3847 |
|
3848 | for (i = index; i < values.length && !(targetX !== values[i].x); i++) sames.push(values[i]);
|
3849 |
|
3850 | return sames;
|
3851 | },
|
3852 | findClosestFromTargets: function findClosestFromTargets(targets, pos) {
|
3853 | var $$ = this,
|
3854 | candidates = targets.map(function (target) {
|
3855 | return $$.findClosest(target.values, pos);
|
3856 | });
|
3857 |
|
3858 |
|
3859 | return $$.findClosest(candidates, pos);
|
3860 | },
|
3861 | findClosest: function findClosest(values, pos) {
|
3862 | var closest,
|
3863 | $$ = this,
|
3864 | config = $$.config,
|
3865 | main = $$.$el.main,
|
3866 | data = values.filter(function (v) {
|
3867 | return v && isValue(v.value);
|
3868 | }),
|
3869 | minDist = config.point_sensitivity;
|
3870 | return data.filter(function (v) {
|
3871 | return $$.isBarType(v.id);
|
3872 | }).forEach(function (v) {
|
3873 | var shape = main.select("." + config_classes.bars + $$.getTargetSelectorSuffix(v.id) + " ." + config_classes.bar + "-" + v.index).node();
|
3874 | !closest && $$.isWithinBar(shape) && (closest = v);
|
3875 | }), data.filter(function (v) {
|
3876 | return !$$.isBarType(v.id);
|
3877 | }).forEach(function (v) {
|
3878 | var d = $$.dist(v, pos);
|
3879 | d < minDist && (minDist = d, closest = v);
|
3880 | }), closest;
|
3881 | },
|
3882 | dist: function dist(data, pos) {
|
3883 | var $$ = this,
|
3884 | isRotated = $$.config.axis_rotated,
|
3885 | scale = $$.scale,
|
3886 | xIndex = isRotated ? 1 : 0,
|
3887 | yIndex = isRotated ? 0 : 1,
|
3888 | y = $$.circleY(data, data.index),
|
3889 | x = (scale.zoom || scale.x)(data.x);
|
3890 | return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));
|
3891 | },
|
3892 |
|
3893 | |
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 | convertValuesToStep: function convertValuesToStep(values) {
|
3900 | var $$ = this,
|
3901 | axis = $$.axis,
|
3902 | config = $$.config,
|
3903 | stepType = config.line_step_type,
|
3904 | isCategorized = !!axis && axis.isCategorized(),
|
3905 | converted = isArray(values) ? values.concat() : [values];
|
3906 | if (!(isCategorized || /step\-(after|before)/.test(stepType))) return values;
|
3907 |
|
3908 | var head = converted[0],
|
3909 | tail = converted[converted.length - 1],
|
3910 | id = head.id,
|
3911 | x = head.x;
|
3912 | return converted.unshift({
|
3913 | x: --x,
|
3914 | value: head.value,
|
3915 | id: id
|
3916 | }), isCategorized && stepType === "step-after" && converted.unshift({
|
3917 | x: --x,
|
3918 | value: head.value,
|
3919 | id: id
|
3920 | }), x = tail.x, converted.push({
|
3921 | x: ++x,
|
3922 | value: tail.value,
|
3923 | id: id
|
3924 | }), isCategorized && stepType === "step-before" && converted.push({
|
3925 | x: ++x,
|
3926 | value: tail.value,
|
3927 | id: id
|
3928 | }), converted;
|
3929 | },
|
3930 | convertValuesToRange: function convertValuesToRange(values) {
|
3931 | var converted = isArray(values) ? values.concat() : [values],
|
3932 | ranges = [];
|
3933 | return converted.forEach(function (range) {
|
3934 | var x = range.x,
|
3935 | id = range.id;
|
3936 | ranges.push({
|
3937 | x: x,
|
3938 | id: id,
|
3939 | value: range.value[0]
|
3940 | }), ranges.push({
|
3941 | x: x,
|
3942 | id: id,
|
3943 | value: range.value[2]
|
3944 | });
|
3945 | }), ranges;
|
3946 | },
|
3947 | updateDataAttributes: function updateDataAttributes(name, attrs) {
|
3948 | var $$ = this,
|
3949 | config = $$.config,
|
3950 | current = config["data_" + name];
|
3951 | return isUndefined(attrs) ? current : (Object.keys(attrs).forEach(function (id) {
|
3952 | current[id] = attrs[id];
|
3953 | }), $$.redraw({
|
3954 | withLegend: !0
|
3955 | }), current);
|
3956 | },
|
3957 | getRangedData: function getRangedData(d, key, type) {
|
3958 | key === void 0 && (key = ""), type === void 0 && (type = "areaRange");
|
3959 | var value = d == null ? void 0 : d.value;
|
3960 |
|
3961 | if (isArray(value)) {
|
3962 |
|
3963 | var index = {
|
3964 | areaRange: ["high", "mid", "low"],
|
3965 | candlestick: ["open", "high", "low", "close", "volume"]
|
3966 | }[type].indexOf(key);
|
3967 | return index >= 0 && value ? value[index] : undefined;
|
3968 | }
|
3969 |
|
3970 | return value ? value[key] : value;
|
3971 | },
|
3972 |
|
3973 | |
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 | getRatio: function getRatio(type, d, asPercent) {
|
3982 | var $$ = this,
|
3983 | config = $$.config,
|
3984 | state = $$.state,
|
3985 | api = $$.api,
|
3986 | ratio = 0;
|
3987 | if (d && api.data.shown().length) if (ratio = d.ratio || d.value, type === "arc") {
|
3988 |
|
3989 | if ($$.pie.padAngle()()) ratio = d.value / $$.getTotalDataSum(!0);else {
|
3990 | var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getStartAngle() * -2,
|
3991 | arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
|
3992 | ratio = (d.endAngle - d.startAngle) / arcLength;
|
3993 | }
|
3994 | } else if (type === "index") {
|
3995 | var dataValues = api.data.values.bind(api),
|
3996 | total = this.getTotalPerIndex();
|
3997 |
|
3998 | if (state.hiddenTargetIds.length) {
|
3999 | var hiddenSum = dataValues(state.hiddenTargetIds, !1);
|
4000 | hiddenSum.length && (hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
4001 | return acc.map(function (v, i) {
|
4002 | return (isNumber(v) ? v : 0) + curr[i];
|
4003 | });
|
4004 | }), total = total.map(function (v, i) {
|
4005 | return v - hiddenSum[i];
|
4006 | }));
|
4007 | }
|
4008 |
|
4009 | d.ratio = isNumber(d.value) && total && total[d.index] > 0 ? d.value / total[d.index] : 0, ratio = d.ratio;
|
4010 | } else if (type === "radar") ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;else if (type === "bar") {
|
4011 | var yScale = $$.getYScaleById.bind($$)(d.id),
|
4012 | max = yScale.domain().reduce(function (a, c) {
|
4013 | return c - a;
|
4014 | });
|
4015 | ratio = Math.abs(d.value) / max;
|
4016 | }
|
4017 | return asPercent && ratio ? ratio * 100 : ratio;
|
4018 | },
|
4019 |
|
4020 | |
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 | updateDataIndexByX: function updateDataIndexByX(tickValues) {
|
4026 | var $$ = this,
|
4027 | tickValueMap = tickValues.reduce(function (out, tick, index) {
|
4028 | return out[+tick.x] = index, out;
|
4029 | }, {});
|
4030 | $$.data.targets.forEach(function (t) {
|
4031 | t.values.forEach(function (value, valueIndex) {
|
4032 | var index = tickValueMap[+value.x];
|
4033 | index === undefined && (index = valueIndex), value.index = index;
|
4034 | });
|
4035 | });
|
4036 | },
|
4037 |
|
4038 | |
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 | isBubbleZType: function isBubbleZType(d) {
|
4045 | var $$ = this;
|
4046 | return $$.isBubbleType(d) && (isObject(d.value) && ("z" in d.value || "y" in d.value) || isArray(d.value) && d.value.length === 2);
|
4047 | },
|
4048 |
|
4049 | |
4050 |
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 | getDataById: function getDataById(id) {
|
4056 | var d = this.cache.get(id) || this.api.data(id);
|
4057 | return isArray(d) ? d[0] : d;
|
4058 | }
|
4059 | });
|
4060 | ;
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 | var load = ({
|
4068 | load: function load(rawTargets, args) {
|
4069 | var $$ = this,
|
4070 | targets = rawTargets;
|
4071 |
|
4072 |
|
4073 |
|
4074 | targets && (args.filter && (targets = targets.filter(args.filter)), (args.type || args.types) && targets.forEach(function (t) {
|
4075 | var type = args.types && args.types[t.id] || args.type;
|
4076 | $$.setTargetType(t.id, type);
|
4077 | }), $$.data.targets.forEach(function (d) {
|
4078 | for (var i = 0; i < targets.length; i++) if (d.id === targets[i].id) {
|
4079 | d.values = targets[i].values, targets.splice(i, 1);
|
4080 | break;
|
4081 | }
|
4082 | }), $$.data.targets = $$.data.targets.concat(targets)), $$.updateTargets($$.data.targets), $$.redraw({
|
4083 | withUpdateOrgXDomain: !0,
|
4084 | withUpdateXDomain: !0,
|
4085 | withLegend: !0
|
4086 | }), $$.updateTypesElements(), args.done && args.done.call($$.api);
|
4087 | },
|
4088 | loadFromArgs: function loadFromArgs(args) {
|
4089 | var $$ = this;
|
4090 |
|
4091 | if ($$.config) {
|
4092 | $$.cache.reset();
|
4093 | var data = args.data || $$.convertData(args, function (d) {
|
4094 | return $$.load($$.convertDataToTargets(d), args);
|
4095 | });
|
4096 | data && $$.load($$.convertDataToTargets(data), args);
|
4097 | }
|
4098 |
|
4099 | },
|
4100 | unload: function unload(rawTargetIds, customDoneCb) {
|
4101 | var $$ = this,
|
4102 | state = $$.state,
|
4103 | $el = $$.$el,
|
4104 | done = customDoneCb,
|
4105 | targetIds = rawTargetIds;
|
4106 |
|
4107 | return $$.cache.reset(), done || (done = function () {}), targetIds = targetIds.filter(function (id) {
|
4108 | return $$.hasTarget($$.data.targets, id);
|
4109 | }), targetIds && targetIds.length !== 0 ? void (
|
4110 | $el.svg.selectAll(targetIds.map(function (id) {
|
4111 | return $$.selectorTarget(id);
|
4112 | })).transition().style("opacity", "0").remove().call(endall, done), targetIds.forEach(function (id) {
|
4113 | state.withoutFadeIn[id] = !1, $el.legend && $el.legend.selectAll("." + config_classes.legendItem + $$.getTargetSelectorSuffix(id)).remove(), $$.data.targets = $$.data.targets.filter(function (t) {
|
4114 | return t.id !== id;
|
4115 | });
|
4116 | }), $$.updateTypesElements()) : void done();
|
4117 | }
|
4118 | });
|
4119 |
|
4120 | var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack_require__(7);
|
4121 | ;
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 | var interactions_interaction = ({
|
4132 | selectRectForSingle: function selectRectForSingle(context, eventRect, index) {
|
4133 | var $$ = this,
|
4134 | config = $$.config,
|
4135 | main = $$.$el.main,
|
4136 | isSelectionEnabled = config.data_selection_enabled,
|
4137 | isSelectionGrouped = config.data_selection_grouped,
|
4138 | isSelectable = config.data_selection_isselectable,
|
4139 | isTooltipGrouped = config.tooltip_grouped,
|
4140 | selectedData = $$.getAllValuesOnIndex(index);
|
4141 | isTooltipGrouped && ($$.showTooltip(selectedData, context), $$.showGridFocus && $$.showGridFocus(selectedData), !isSelectionEnabled || isSelectionGrouped) || main.selectAll("." + config_classes.shape + "-" + index).each(function () {
|
4142 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.EXPANDED, !0), isSelectionEnabled && eventRect.style("cursor", isSelectionGrouped ? "pointer" : null), isTooltipGrouped || ($$.hideGridFocus && $$.hideGridFocus(), $$.hideTooltip(), !isSelectionGrouped && $$.expandCirclesBars(index));
|
4143 | }).filter(function (d) {
|
4144 | return $$.isWithinShape(this, d);
|
4145 | }).call(function (selected) {
|
4146 | var d = selected.data();
|
4147 | isSelectionEnabled && (isSelectionGrouped || isSelectable && isSelectable.bind($$.api)(d)) && eventRect.style("cursor", "pointer"), isTooltipGrouped || ($$.showTooltip(d, context), $$.showGridFocus && $$.showGridFocus(d), $$.unexpandCircles && $$.unexpandCircles(), selected.each(function (d) {
|
4148 | return $$.expandCirclesBars(index, d.id);
|
4149 | }));
|
4150 | });
|
4151 | },
|
4152 | expandCirclesBars: function expandCirclesBars(index, id, reset) {
|
4153 | var $$ = this,
|
4154 | config = $$.config,
|
4155 | _$$$$el = $$.$el,
|
4156 | bar = _$$$$el.bar,
|
4157 | circle = _$$$$el.circle;
|
4158 | circle && config.point_focus_expand_enabled && $$.expandCircles(index, id, reset), bar && $$.expandBars(index, id, reset);
|
4159 | },
|
4160 |
|
4161 | |
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 | setOverOut: function setOverOut(isOver, d) {
|
4168 | var $$ = this,
|
4169 | config = $$.config,
|
4170 | hasRadar = $$.state.hasRadar,
|
4171 | main = $$.$el.main,
|
4172 | isArc = isObject(d);
|
4173 |
|
4174 |
|
4175 | if (isArc || d !== -1) {
|
4176 | var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
4177 | if (config.color_onover && $$.setOverColor(isOver, d, isArc), isArc) callback(d, main.select("." + config_classes.arc + $$.getTargetSelectorSuffix(d.id)).node());else if (!config.tooltip_grouped) {
|
4178 | var last = $$.cache.get(KEY.setOverOut) || [],
|
4179 | shape = main.selectAll("." + config_classes.shape + "-" + d).filter(function (d) {
|
4180 | return $$.isWithinShape(this, d);
|
4181 | });
|
4182 | shape.each(function (d) {
|
4183 | var _this = this;
|
4184 |
|
4185 | (last.length === 0 || last.every(function (v) {
|
4186 | return v !== _this;
|
4187 | })) && (callback(d, this), last.push(this));
|
4188 | }), last.length > 0 && shape.empty() && (callback = config.data_onout.bind($$.api), last.forEach(function (v) {
|
4189 | return callback((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(v).datum(), v);
|
4190 | }), last = []), $$.cache.add(KEY.setOverOut, last);
|
4191 | } else isOver && (config.point_focus_only && hasRadar ? $$.showCircleFocus($$.getAllValuesOnIndex(d, !0)) : $$.expandCirclesBars(d, null, !0)), $$.isMultipleX() || main.selectAll("." + config_classes.shape + "-" + d).each(function (d) {
|
4192 | callback(d, this);
|
4193 | });
|
4194 | }
|
4195 | },
|
4196 |
|
4197 | |
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 | callOverOutForTouch: function callOverOutForTouch(d) {
|
4203 | var $$ = this,
|
4204 | last = $$.cache.get(KEY.callOverOutForTouch);
|
4205 | (isObject(d) && last ? d.id !== last.id : d !== last) && ((last || isNumber(last)) && $$.setOverOut(!1, last), (d || isNumber(d)) && $$.setOverOut(!0, d), $$.cache.add(KEY.callOverOutForTouch, d));
|
4206 | },
|
4207 |
|
4208 | |
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 | getDraggableSelection: function getDraggableSelection() {
|
4214 | var $$ = this,
|
4215 | config = $$.config,
|
4216 | state = $$.state;
|
4217 | return config.interaction_enabled && config.data_selection_draggable && $$.drag ? (0,external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_.drag)().on("drag", function (event) {
|
4218 | state.event = event, $$.drag(getPointer(event, this));
|
4219 | }).on("start", function (event) {
|
4220 | state.event = event, $$.dragstart(getPointer(event, this));
|
4221 | }).on("end", function (event) {
|
4222 | state.event = event, $$.dragend();
|
4223 | }) : function () {};
|
4224 | },
|
4225 |
|
4226 | |
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 | dispatchEvent: function dispatchEvent(type, index, mouse) {
|
4234 | var $$ = this,
|
4235 | config = $$.config,
|
4236 | _$$$state = $$.state,
|
4237 | eventReceiver = _$$$state.eventReceiver,
|
4238 | hasAxis = _$$$state.hasAxis,
|
4239 | hasRadar = _$$$state.hasRadar,
|
4240 | _$$$$el2 = $$.$el,
|
4241 | eventRect = _$$$$el2.eventRect,
|
4242 | arcs = _$$$$el2.arcs,
|
4243 | radar = _$$$$el2.radar,
|
4244 | isMultipleX = $$.isMultipleX(),
|
4245 | element = (hasRadar ? radar.axes.select("." + config_classes.axis + "-" + index + " text") : eventRect || arcs.selectAll("." + config_classes.target + " path").filter(function (d, i) {
|
4246 | return i === index;
|
4247 | })).node(),
|
4248 | _element$getBoundingC = element.getBoundingClientRect(),
|
4249 | width = _element$getBoundingC.width,
|
4250 | left = _element$getBoundingC.left,
|
4251 | top = _element$getBoundingC.top;
|
4252 |
|
4253 | if (hasAxis && !hasRadar && !isMultipleX) {
|
4254 | var coords = eventReceiver.coords[index];
|
4255 | width = coords.w, left += coords.x, top += coords.y;
|
4256 | }
|
4257 |
|
4258 | var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : width / 2),
|
4259 | y = top + (mouse ? mouse[1] : 0);
|
4260 | emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](element, type, {
|
4261 | screenX: x,
|
4262 | screenY: y,
|
4263 | clientX: x,
|
4264 | clientY: y
|
4265 | });
|
4266 | },
|
4267 | setDragStatus: function setDragStatus(isDragging) {
|
4268 | this.state.dragging = isDragging;
|
4269 | }
|
4270 | });
|
4271 | ;
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 | var internals_class = ({
|
4278 | generateClass: function generateClass(prefix, targetId) {
|
4279 | return " " + prefix + " " + (prefix + this.getTargetSelectorSuffix(targetId));
|
4280 | },
|
4281 |
|
4282 | |
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 | getClass: function getClass(type, withShape) {
|
4290 | var _this = this,
|
4291 | isPlural = /s$/.test(type),
|
4292 | useIdKey = /^(area|arc|line)s?$/.test(type),
|
4293 | key = isPlural ? "id" : "index";
|
4294 |
|
4295 | return function (d) {
|
4296 | var data = d.data || d,
|
4297 | result = (withShape ? _this.generateClass(config_classes[isPlural ? "shapes" : "shape"], data[key]) : "") + _this.generateClass(config_classes[type], data[useIdKey ? "id" : key]);
|
4298 |
|
4299 | return result.trim();
|
4300 | };
|
4301 | },
|
4302 |
|
4303 | |
4304 |
|
4305 |
|
4306 |
|
4307 |
|
4308 |
|
4309 | getChartClass: function getChartClass(type) {
|
4310 | var _this2 = this;
|
4311 |
|
4312 | return function (d) {
|
4313 | return config_classes["chart" + type] + _this2.classTarget((d.data ? d.data : d).id);
|
4314 | };
|
4315 | },
|
4316 | generateExtraLineClass: function generateExtraLineClass() {
|
4317 | var $$ = this,
|
4318 | classes = $$.config.line_classes || [],
|
4319 | ids = [];
|
4320 | return function (d) {
|
4321 | var id = d.id || d.data && d.data.id || d;
|
4322 | return ids.indexOf(id) < 0 && ids.push(id), classes[ids.indexOf(id) % classes.length];
|
4323 | };
|
4324 | },
|
4325 | classRegion: function classRegion(d, i) {
|
4326 | return this.generateClass(config_classes.region, i) + " " + ("class" in d ? d.class : "");
|
4327 | },
|
4328 | classTarget: function classTarget(id) {
|
4329 | var additionalClassSuffix = this.config.data_classes[id],
|
4330 | additionalClass = "";
|
4331 | return additionalClassSuffix && (additionalClass = " " + config_classes.target + "-" + additionalClassSuffix), this.generateClass(config_classes.target, id) + additionalClass;
|
4332 | },
|
4333 | classFocus: function classFocus(d) {
|
4334 | return this.classFocused(d) + this.classDefocused(d);
|
4335 | },
|
4336 | classFocused: function classFocused(d) {
|
4337 | return " " + (this.state.focusedTargetIds.indexOf(d.id) >= 0 ? config_classes.focused : "");
|
4338 | },
|
4339 | classDefocused: function classDefocused(d) {
|
4340 | return " " + (this.state.defocusedTargetIds.indexOf(d.id) >= 0 ? config_classes.defocused : "");
|
4341 | },
|
4342 | getTargetSelectorSuffix: function getTargetSelectorSuffix(targetId) {
|
4343 | return targetId || targetId === 0 ? ("-" + targetId).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, "-") : "";
|
4344 | },
|
4345 | selectorTarget: function selectorTarget(id, prefix) {
|
4346 | var pfx = prefix || "",
|
4347 | target = this.getTargetSelectorSuffix(id);
|
4348 |
|
4349 | return pfx + "." + (config_classes.target + target) + ", " + pfx + "." + (config_classes.circles + target);
|
4350 | },
|
4351 | selectorTargets: function selectorTargets(idsValue, prefix) {
|
4352 | var _this3 = this,
|
4353 | ids = idsValue || [];
|
4354 |
|
4355 | return ids.length ? ids.map(function (id) {
|
4356 | return _this3.selectorTarget(id, prefix);
|
4357 | }) : null;
|
4358 | },
|
4359 | selectorLegend: function selectorLegend(id) {
|
4360 | return "." + (config_classes.legendItem + this.getTargetSelectorSuffix(id));
|
4361 | },
|
4362 | selectorLegends: function selectorLegends(ids) {
|
4363 | var _this4 = this;
|
4364 |
|
4365 | return ids && ids.length ? ids.map(function (id) {
|
4366 | return _this4.selectorLegend(id);
|
4367 | }) : null;
|
4368 | }
|
4369 | });
|
4370 | ;
|
4371 |
|
4372 |
|
4373 |
|
4374 |
|
4375 | var category = ({
|
4376 | |
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 | categoryName: function categoryName(i) {
|
4383 | var categories = this.config.axis_x_categories;
|
4384 | return categories && i < categories.length ? categories[i] : i;
|
4385 | }
|
4386 | });
|
4387 |
|
4388 | var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(6);
|
4389 | ;
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 | var colorizePattern = function (pattern, color, id) {
|
4411 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(pattern.cloneNode(!0));
|
4412 | return node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color), {
|
4413 | id: id,
|
4414 | node: node.node()
|
4415 | };
|
4416 | },
|
4417 | schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
|
4418 |
|
4419 |
|
4420 |
|
4421 | var internals_color = ({
|
4422 | |
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 | getColorFromCss: function getColorFromCss() {
|
4429 | var cacheKey = KEY.colorPattern,
|
4430 | body = browser_doc.body,
|
4431 | pattern = body[cacheKey];
|
4432 |
|
4433 | if (!pattern) {
|
4434 | var span = browser_doc.createElement("span");
|
4435 | span.className = config_classes.colorPattern, span.style.display = "none", body.appendChild(span);
|
4436 | var content = win.getComputedStyle(span).backgroundImage;
|
4437 | span.parentNode.removeChild(span), content.indexOf(";") > -1 && (pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) {
|
4438 | return v.trim().replace(/[\"'\s]/g, "");
|
4439 | }).filter(Boolean), body[cacheKey] = pattern);
|
4440 | }
|
4441 |
|
4442 | return pattern;
|
4443 | },
|
4444 | generateColor: function generateColor() {
|
4445 | var $$ = this,
|
4446 | config = $$.config,
|
4447 | colors = config.data_colors,
|
4448 | callback = config.data_color,
|
4449 | ids = [],
|
4450 | pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)($$.getColorFromCss() || schemeCategory10).range(),
|
4451 | originalColorPattern = pattern;
|
4452 |
|
4453 | if (isFunction(config.color_tiles)) {
|
4454 | var tiles = config.color_tiles.bind($$.api)(),
|
4455 | colorizedPatterns = pattern.map(function (p, index) {
|
4456 | var color = p.replace(/[#\(\)\s,]/g, ""),
|
4457 | id = $$.state.datetimeId + "-pattern-" + color + "-" + index;
|
4458 | return colorizePattern(tiles[index % tiles.length], p, id);
|
4459 | });
|
4460 |
|
4461 | pattern = colorizedPatterns.map(function (p) {
|
4462 | return "url(#" + p.id + ")";
|
4463 | }), $$.patterns = colorizedPatterns;
|
4464 | }
|
4465 |
|
4466 | return function (d) {
|
4467 | var color,
|
4468 | id = d.id || d.data && d.data.id || d,
|
4469 | isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id];
|
4470 | return isFunction(colors[id]) ? color = colors[id].bind($$.api)(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.bind($$.api)(color, d) : color;
|
4471 | };
|
4472 | },
|
4473 | generateLevelColor: function generateLevelColor() {
|
4474 | var $$ = this,
|
4475 | config = $$.config,
|
4476 | colors = config.color_pattern,
|
4477 | threshold = config.color_threshold,
|
4478 | asValue = threshold.unit === "value",
|
4479 | max = threshold.max || 100,
|
4480 | values = threshold.values && threshold.values.length ? threshold.values : [];
|
4481 | return notEmpty(threshold) ? function (value) {
|
4482 | var v = asValue ? value : value * 100 / max,
|
4483 | color = colors[colors.length - 1];
|
4484 |
|
4485 | for (var i = 0, l = values.length; i < l; i++) if (v <= values[i]) {
|
4486 | color = colors[i];
|
4487 | break;
|
4488 | }
|
4489 |
|
4490 | return color;
|
4491 | } : null;
|
4492 | },
|
4493 |
|
4494 | |
4495 |
|
4496 |
|
4497 |
|
4498 |
|
4499 |
|
4500 |
|
4501 | setOverColor: function setOverColor(isOver, d) {
|
4502 | var $$ = this,
|
4503 | config = $$.config,
|
4504 | main = $$.$el.main,
|
4505 | onover = config.color_onover,
|
4506 | color = isOver ? onover : $$.color;
|
4507 | isObject(color) ? color = function (_ref) {
|
4508 | var id = _ref.id;
|
4509 | return id in onover ? onover[id] : $$.color(id);
|
4510 | } : isString(color) ? color = function () {
|
4511 | return onover;
|
4512 | } : isFunction(onover) && (color = color.bind($$.api)), main.selectAll(isObject(d) ?
|
4513 | "." + config_classes.arc + $$.getTargetSelectorSuffix(d.id) : "." + config_classes.shape + "-" + d).style("fill", color);
|
4514 | }
|
4515 | });
|
4516 | ;
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 | var TYPE = {
|
4527 | AREA: "area",
|
4528 | AREA_LINE_RANGE: "area-line-range",
|
4529 | AREA_SPLINE: "area-spline",
|
4530 | AREA_SPLINE_RANGE: "area-spline-range",
|
4531 | AREA_STEP: "area-step",
|
4532 | BAR: "bar",
|
4533 | BUBBLE: "bubble",
|
4534 | CANDLESTICK: "candlestick",
|
4535 | DONUT: "donut",
|
4536 | GAUGE: "gauge",
|
4537 | LINE: "line",
|
4538 | PIE: "pie",
|
4539 | RADAR: "radar",
|
4540 | SCATTER: "scatter",
|
4541 | SPLINE: "spline",
|
4542 | STEP: "step"
|
4543 | };
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 | var TYPE_BY_CATEGORY = {
|
4550 | Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP],
|
4551 | AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE],
|
4552 | Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.RADAR],
|
4553 | Line: [TYPE.LINE, TYPE.SPLINE, TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.STEP, TYPE.AREA_STEP],
|
4554 | Step: [TYPE.STEP, TYPE.AREA_STEP],
|
4555 | Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
|
4556 | };
|
4557 | ;
|
4558 |
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 | var domain = ({
|
4565 | getYDomainMinMax: function getYDomainMinMax(targets, type) {
|
4566 | var $$ = this,
|
4567 | axis = $$.axis,
|
4568 | config = $$.config,
|
4569 | isMin = type === "min",
|
4570 | dataGroups = config.data_groups,
|
4571 | ids = $$.mapToIds(targets),
|
4572 | ys = $$.getValuesAsIdKeyed(targets);
|
4573 | return dataGroups.length > 0 && function () {
|
4574 | for (var idsInGroup, _ret, hasValue = $$["has" + (isMin ? "Negative" : "Positive") + "ValueInTargets"](targets), _loop = function (j, _idsInGroup) {
|
4575 | if (_idsInGroup = _idsInGroup.filter(function (v) {
|
4576 | return ids.indexOf(v) >= 0;
|
4577 | }), _idsInGroup.length === 0) return idsInGroup = _idsInGroup, "continue";
|
4578 | var baseId = _idsInGroup[0],
|
4579 | baseAxisId = axis.getId(baseId);
|
4580 | hasValue && ys[baseId] && (ys[baseId] = ys[baseId].map(function (v) {
|
4581 | return (isMin ? v < 0 : v > 0) ? v : 0;
|
4582 | }));
|
4583 |
|
4584 | for (var id, _ret2, _loop2 = function (k, id) {
|
4585 | if (!ys[id]) return "continue";
|
4586 | var axisId = axis.getId(id);
|
4587 | ys[id].forEach(function (v, i) {
|
4588 | var val = +v,
|
4589 | meetCondition = isMin ? val > 0 : val < 0;
|
4590 | axisId !== baseAxisId || hasValue && meetCondition || (ys[baseId][i] += val);
|
4591 | });
|
4592 | }, k = 1; id = _idsInGroup[k]; k++) _ret2 = _loop2(k, id), _ret2 === "continue";
|
4593 |
|
4594 | idsInGroup = _idsInGroup;
|
4595 | }, j = 0; idsInGroup = dataGroups[j]; j++) _ret = _loop(j, idsInGroup), _ret === "continue";
|
4596 | }(), getMinMax(type, Object.keys(ys).map(function (key) {
|
4597 | return getMinMax(type, ys[key]);
|
4598 | }));
|
4599 | },
|
4600 | getYDomainMin: function getYDomainMin(targets) {
|
4601 | return this.getYDomainMinMax(targets, "min");
|
4602 | },
|
4603 | getYDomainMax: function getYDomainMax(targets) {
|
4604 | return this.getYDomainMinMax(targets, "max");
|
4605 | },
|
4606 |
|
4607 | |
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 | isHiddenTargetWithYDomain: function isHiddenTargetWithYDomain(id) {
|
4614 | var $$ = this;
|
4615 | return $$.state.hiddenTargetIds.some(function (v) {
|
4616 | return $$.axis.getId(v) === id;
|
4617 | });
|
4618 | },
|
4619 | getYDomain: function getYDomain(targets, axisId, xDomain) {
|
4620 | var $$ = this,
|
4621 | axis = $$.axis,
|
4622 | config = $$.config,
|
4623 | scale = $$.scale,
|
4624 | pfx = "axis_" + axisId;
|
4625 | if ($$.isStackNormalized()) return [0, 100];
|
4626 | var isLog = scale && scale[axisId] && scale[axisId].type === "log",
|
4627 | targetsByAxisId = targets.filter(function (t) {
|
4628 | return axis.getId(t.id) === axisId;
|
4629 | }),
|
4630 | yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId;
|
4631 | if (yTargets.length === 0)
|
4632 | return $$.isHiddenTargetWithYDomain(axisId) ? scale[axisId].domain() : axisId === "y2" ? scale.y.domain() :
|
4633 |
|
4634 | $$.getYDomain(targets, "y2", xDomain);
|
4635 | var yMin = config[pfx + "_min"],
|
4636 | yMax = config[pfx + "_max"],
|
4637 | yDomainMin = $$.getYDomainMin(yTargets),
|
4638 | yDomainMax = $$.getYDomainMax(yTargets),
|
4639 | center = config[pfx + "_center"],
|
4640 | isZeroBased = [TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER].concat(TYPE_BY_CATEGORY.Line).some(function (v) {
|
4641 | var type = v.indexOf("area") > -1 ? "area" : v;
|
4642 | return $$.hasType(v, yTargets) && config[type + "_zerobased"];
|
4643 | }),
|
4644 | isInverted = config[pfx + "_inverted"],
|
4645 | showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,
|
4646 | showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
4647 | yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin < yMax ? yDomainMin : yMax - 10 : yDomainMin, yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin < yDomainMax ? yDomainMax : yMin + 10 : yDomainMax, isNaN(yDomainMin) && (yDomainMin = 0), isNaN(yDomainMax) && (yDomainMax = yDomainMin), yDomainMin === yDomainMax && (yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0);
|
4648 | var isAllPositive = yDomainMin >= 0 && yDomainMax >= 0,
|
4649 | isAllNegative = yDomainMin <= 0 && yDomainMax <= 0;
|
4650 | (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) && (isZeroBased = !1), isZeroBased && (isAllPositive && (yDomainMin = 0), isAllNegative && (yDomainMax = 0));
|
4651 | var domainLength = Math.abs(yDomainMax - yDomainMin),
|
4652 | padding = {
|
4653 | top: domainLength * .1,
|
4654 | bottom: domainLength * .1
|
4655 | };
|
4656 |
|
4657 | if (isDefined(center)) {
|
4658 | var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
|
4659 | yDomainMax = center + yDomainAbs, yDomainMin = center - yDomainAbs;
|
4660 | }
|
4661 |
|
4662 |
|
4663 | if (showHorizontalDataLabel) {
|
4664 | var diff = diffDomain(scale.y.range()),
|
4665 | ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map(function (v) {
|
4666 | return v / diff;
|
4667 | });
|
4668 | ["bottom", "top"].forEach(function (v, i) {
|
4669 | padding[v] += domainLength * (ratio[i] / (1 - ratio[0] - ratio[1]));
|
4670 | });
|
4671 | } else if (showVerticalDataLabel) {
|
4672 | var lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height");
|
4673 | ["bottom", "top"].forEach(function (v, i) {
|
4674 | padding[v] += axis.convertPixelsToAxisPadding(lengths[i], domainLength);
|
4675 | });
|
4676 | }
|
4677 |
|
4678 |
|
4679 |
|
4680 | var p = config[pfx + "_padding"];
|
4681 | notEmpty(p) && ["bottom", "top"].forEach(function (v) {
|
4682 | padding[v] = axis.getPadding(p, v, padding[v], domainLength);
|
4683 | }), isZeroBased && (isAllPositive && (padding.bottom = yDomainMin), isAllNegative && (padding.top = -yDomainMax));
|
4684 | var domain = isLog ? [yDomainMin, yDomainMax].map(function (v) {
|
4685 | return v < 0 ? 0 : v;
|
4686 | }) : [yDomainMin - padding.bottom, yDomainMax + padding.top];
|
4687 | return isInverted ? domain.reverse() : domain;
|
4688 | },
|
4689 | getXDomainMinMax: function getXDomainMinMax(targets, type) {
|
4690 | var $$ = this,
|
4691 | configValue = $$.config["axis_x_" + type],
|
4692 | dataValue = getMinMax(type, targets.map(function (t) {
|
4693 | return getMinMax(type, t.values.map(function (v) {
|
4694 | return v.x;
|
4695 | }));
|
4696 | })),
|
4697 | value = isObject(configValue) ? configValue.value : configValue;
|
4698 | return value = isDefined(value) && $$.axis.isTimeSeries() ? parseDate.bind(this)(value) : value, isObject(configValue) && configValue.fit && (type === "min" && value < dataValue || type === "max" && value > dataValue) && (value = undefined), isDefined(value) ? value : dataValue;
|
4699 | },
|
4700 | getXDomainMin: function getXDomainMin(targets) {
|
4701 | return this.getXDomainMinMax(targets, "min");
|
4702 | },
|
4703 | getXDomainMax: function getXDomainMax(targets) {
|
4704 | return this.getXDomainMinMax(targets, "max");
|
4705 | },
|
4706 | getXDomainPadding: function getXDomainPadding(domain) {
|
4707 | var maxDataCount,
|
4708 | padding,
|
4709 | $$ = this,
|
4710 | axis = $$.axis,
|
4711 | config = $$.config,
|
4712 | diff = domain[1] - domain[0],
|
4713 | xPadding = config.axis_x_padding;
|
4714 | axis.isCategorized() ? padding = 0 : $$.hasType("bar") ? (maxDataCount = $$.getMaxDataCount(), padding = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5) : padding = diff * .01;
|
4715 | var left = padding,
|
4716 | right = padding;
|
4717 | 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), {
|
4718 | left: left,
|
4719 | right: right
|
4720 | };
|
4721 | },
|
4722 | getXDomain: function getXDomain(targets) {
|
4723 | var $$ = this,
|
4724 | isLog = $$.scale.x.type === "log",
|
4725 | xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)],
|
4726 | min = 0,
|
4727 | max = 0;
|
4728 | if (isLog) min = xDomain[0], max = xDomain[1];else {
|
4729 | var isCategorized = $$.axis.isCategorized(),
|
4730 | isTimeSeries = $$.axis.isTimeSeries(),
|
4731 | padding = $$.getXDomainPadding(xDomain),
|
4732 | _xDomain = xDomain,
|
4733 | firstX = _xDomain[0],
|
4734 | lastX = _xDomain[1];
|
4735 | 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);
|
4736 | }
|
4737 | return [min, max];
|
4738 | },
|
4739 | updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
|
4740 | var $$ = this,
|
4741 | config = $$.config,
|
4742 | org = $$.org,
|
4743 | _$$$scale = $$.scale,
|
4744 | x = _$$$scale.x,
|
4745 | subX = _$$$scale.subX,
|
4746 | zoomEnabled = config.zoom_enabled;
|
4747 |
|
4748 | if (withUpdateOrgXDomain && (x.domain(domain || sortValue($$.getXDomain(targets))), org.xDomain = x.domain(), zoomEnabled && $$.zoom.updateScaleExtent(), subX.domain(x.domain()), $$.brush && $$.brush.scale(subX)), withUpdateXDomain) {
|
4749 | var domainValue = domain || !$$.brush || brushEmpty($$) ? org.xDomain : getBrushSelection($$).map(subX.invert);
|
4750 | x.domain(domainValue), zoomEnabled && $$.zoom.updateScaleExtent();
|
4751 | }
|
4752 |
|
4753 |
|
4754 | return withTrim && x.domain($$.trimXDomain(x.orgDomain())), x.domain();
|
4755 | },
|
4756 | trimXDomain: function trimXDomain(domain) {
|
4757 | var zoomDomain = this.getZoomDomain(),
|
4758 | min = zoomDomain[0],
|
4759 | max = zoomDomain[1];
|
4760 | 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;
|
4761 | },
|
4762 |
|
4763 | |
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 | getZoomDomain: function getZoomDomain() {
|
4769 | var $$ = this,
|
4770 | config = $$.config,
|
4771 | org = $$.org,
|
4772 | _org$xDomain = org.xDomain,
|
4773 | min = _org$xDomain[0],
|
4774 | max = _org$xDomain[1];
|
4775 | 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];
|
4776 | }
|
4777 | });
|
4778 | ;
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 | function getFormat($$, typeValue, v) {
|
4794 | var config = $$.config,
|
4795 | type = "axis_" + typeValue + "_tick_format",
|
4796 | format = config[type] ? config[type] : $$.defaultValueFormat;
|
4797 | return format(v);
|
4798 | }
|
4799 |
|
4800 | var format = ({
|
4801 | getYFormat: function getYFormat(forArc) {
|
4802 | var $$ = this,
|
4803 | yFormat = $$.yFormat,
|
4804 | y2Format = $$.y2Format;
|
4805 | return forArc && !$$.hasType("gauge") && (yFormat = $$.defaultArcValueFormat, y2Format = $$.defaultArcValueFormat), function (v, ratio, id) {
|
4806 | var format = $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
|
4807 | return format.call($$, v, ratio);
|
4808 | };
|
4809 | },
|
4810 | yFormat: function yFormat(v) {
|
4811 | return getFormat(this, "y", v);
|
4812 | },
|
4813 | y2Format: function y2Format(v) {
|
4814 | return getFormat(this, "y2", v);
|
4815 | },
|
4816 | defaultValueFormat: function defaultValueFormat(v) {
|
4817 | return isValue(v) ? +v : "";
|
4818 | },
|
4819 | defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
4820 | return (ratio * 100).toFixed(1) + "%";
|
4821 | },
|
4822 | dataLabelFormat: function dataLabelFormat(targetId) {
|
4823 | var $$ = this,
|
4824 | dataLabels = $$.config.data_labels,
|
4825 | defaultFormat = function (v) {
|
4826 | return isValue(v) ? +v : "";
|
4827 | },
|
4828 | format = defaultFormat;
|
4829 |
|
4830 | return isFunction(dataLabels.format) ? format = dataLabels.format : isObjectType(dataLabels.format) && (dataLabels.format[targetId] ? format = dataLabels.format[targetId] === !0 ? defaultFormat : dataLabels.format[targetId] : format = function () {
|
4831 | return "";
|
4832 | }), format.bind($$.api);
|
4833 | }
|
4834 | });
|
4835 | ;
|
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 | var internals_legend = ({
|
4846 | |
4847 |
|
4848 |
|
4849 |
|
4850 | initLegend: function initLegend() {
|
4851 | var $$ = this,
|
4852 | config = $$.config,
|
4853 | $el = $$.$el;
|
4854 | $$.legendItemTextBox = {}, $$.state.legendHasRendered = !1, config.legend_show ? (!config.legend_contents_bindto && ($el.legend = $$.$el.svg.append("g").classed(config_classes.legend, !0).attr("transform", $$.getTranslate("legend"))), $$.updateLegend()) : $$.state.hiddenLegendIds = $$.mapToIds($$.data.targets);
|
4855 | },
|
4856 |
|
4857 | |
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 | updateLegend: function updateLegend(targetIds, options, transitions) {
|
4865 | var $$ = this,
|
4866 | config = $$.config,
|
4867 | state = $$.state,
|
4868 | scale = $$.scale,
|
4869 | $el = $$.$el,
|
4870 | optionz = options || {
|
4871 | withTransform: !1,
|
4872 | withTransitionForTransform: !1,
|
4873 | withTransition: !1
|
4874 | };
|
4875 |
|
4876 |
|
4877 |
|
4878 | 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), $el.legend.selectAll("." + config_classes.legendItem).classed(config_classes.legendItemHidden, function (id) {
|
4879 | var hide = !$$.isTargetToShow(id);
|
4880 | return hide && (this.style.opacity = null), hide;
|
4881 | }), $$.updateScales(!1, !scale.zoom), $$.updateSvgSize(), $$.transformAll(optionz.withTransitionForTransform, transitions), state.legendHasRendered = !0;
|
4882 | },
|
4883 |
|
4884 | |
4885 |
|
4886 |
|
4887 |
|
4888 | updateLegendTemplate: function updateLegendTemplate() {
|
4889 | var $$ = this,
|
4890 | config = $$.config,
|
4891 | $el = $$.$el,
|
4892 | wrapper = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(config.legend_contents_bindto),
|
4893 | template = config.legend_contents_template;
|
4894 |
|
4895 | if (!wrapper.empty()) {
|
4896 | var targets = $$.mapToIds($$.data.targets),
|
4897 | ids = [],
|
4898 | html = "";
|
4899 | targets.forEach(function (v) {
|
4900 | var content = isFunction(template) ? template.bind($$.api)(v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, {
|
4901 | COLOR: $$.color(v),
|
4902 | TITLE: v
|
4903 | });
|
4904 | content && (ids.push(v), html += content);
|
4905 | });
|
4906 | var legendItem = wrapper.html(html).selectAll(function () {
|
4907 | return this.childNodes;
|
4908 | }).data(ids);
|
4909 | $$.setLegendItem(legendItem), $el.legend = wrapper;
|
4910 | }
|
4911 | },
|
4912 |
|
4913 | |
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 | updateSizeForLegend: function updateSizeForLegend(size) {
|
4919 | var $$ = this,
|
4920 | config = $$.config,
|
4921 | _$$$state = $$.state,
|
4922 | isLegendTop = _$$$state.isLegendTop,
|
4923 | isLegendLeft = _$$$state.isLegendLeft,
|
4924 | isLegendRight = _$$$state.isLegendRight,
|
4925 | isLegendInset = _$$$state.isLegendInset,
|
4926 | current = _$$$state.current,
|
4927 | width = size.width,
|
4928 | height = size.height,
|
4929 | insetLegendPosition = {
|
4930 | top: isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : current.height - height - $$.getCurrentPaddingBottom() - config.legend_inset_y,
|
4931 | left: isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : current.width - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5
|
4932 | };
|
4933 | $$.state.margin3 = {
|
4934 | top: isLegendRight ? 0 : isLegendInset ? insetLegendPosition.top : current.height - height,
|
4935 | right: NaN,
|
4936 | bottom: 0,
|
4937 | left: isLegendRight ? current.width - width : isLegendInset ? insetLegendPosition.left : 0
|
4938 | };
|
4939 | },
|
4940 |
|
4941 | |
4942 |
|
4943 |
|
4944 |
|
4945 |
|
4946 | transformLegend: function transformLegend(withTransition) {
|
4947 | var $$ = this,
|
4948 | legend = $$.$el.legend;
|
4949 | (withTransition ? legend.transition() : legend).attr("transform", $$.getTranslate("legend"));
|
4950 | },
|
4951 |
|
4952 | |
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 | updateLegendStep: function updateLegendStep(step) {
|
4958 | this.state.legendStep = step;
|
4959 | },
|
4960 |
|
4961 | |
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 | updateLegendItemWidth: function updateLegendItemWidth(width) {
|
4967 | this.state.legendItemWidth = width;
|
4968 | },
|
4969 |
|
4970 | |
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 | updateLegendItemHeight: function updateLegendItemHeight(height) {
|
4976 | this.state.legendItemHeight = height;
|
4977 | },
|
4978 |
|
4979 | |
4980 |
|
4981 |
|
4982 |
|
4983 |
|
4984 |
|
4985 | updateLegendItemColor: function updateLegendItemColor(id, color) {
|
4986 | var legend = this.$el.legend;
|
4987 | legend && legend.select("." + config_classes.legendItem + "-" + id + " line").style("stroke", color);
|
4988 | },
|
4989 |
|
4990 | |
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 | getLegendWidth: function getLegendWidth() {
|
4996 | var $$ = this,
|
4997 | _$$$state2 = $$.state,
|
4998 | width = _$$$state2.current.width,
|
4999 | isLegendRight = _$$$state2.isLegendRight,
|
5000 | isLegendInset = _$$$state2.isLegendInset,
|
5001 | legendItemWidth = _$$$state2.legendItemWidth,
|
5002 | legendStep = _$$$state2.legendStep;
|
5003 | return $$.config.legend_show ? isLegendRight || isLegendInset ? legendItemWidth * (legendStep + 1) : width : 0;
|
5004 | },
|
5005 |
|
5006 | |
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 | getLegendHeight: function getLegendHeight() {
|
5012 | var $$ = this,
|
5013 | _$$$state3 = $$.state,
|
5014 | current = _$$$state3.current,
|
5015 | isLegendRight = _$$$state3.isLegendRight,
|
5016 | legendItemHeight = _$$$state3.legendItemHeight,
|
5017 | legendStep = _$$$state3.legendStep;
|
5018 | return $$.config.legend_show ? isLegendRight ? current.height : Math.max(20, legendItemHeight) * (legendStep + 1) : 0;
|
5019 | },
|
5020 |
|
5021 | |
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 | opacityForLegend: function opacityForLegend(legendItem) {
|
5028 | return legendItem.classed(config_classes.legendItemHidden) ? null : "1";
|
5029 | },
|
5030 |
|
5031 | |
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 | opacityForUnfocusedLegend: function opacityForUnfocusedLegend(legendItem) {
|
5038 | return legendItem.classed(config_classes.legendItemHidden) ? null : "0.3";
|
5039 | },
|
5040 |
|
5041 | |
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 | toggleFocusLegend: function toggleFocusLegend(targetIds, focus) {
|
5048 | var $$ = this,
|
5049 | legend = $$.$el.legend,
|
5050 | targetIdz = $$.mapToTargetIds(targetIds);
|
5051 | legend && legend.selectAll("." + config_classes.legendItem).filter(function (id) {
|
5052 | return targetIdz.indexOf(id) >= 0;
|
5053 | }).classed(config_classes.legendItemFocused, focus).transition().duration(100).style("opacity", function () {
|
5054 | return (focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend).call($$, (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this));
|
5055 | });
|
5056 | },
|
5057 |
|
5058 | |
5059 |
|
5060 |
|
5061 |
|
5062 | revertLegend: function revertLegend() {
|
5063 | var $$ = this,
|
5064 | legend = $$.$el.legend;
|
5065 | legend && legend.selectAll("." + config_classes.legendItem).classed(config_classes.legendItemFocused, !1).transition().duration(100).style("opacity", function () {
|
5066 | return $$.opacityForLegend((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this));
|
5067 | });
|
5068 | },
|
5069 |
|
5070 | |
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 | showLegend: function showLegend(targetIds) {
|
5076 | var $$ = this,
|
5077 | config = $$.config,
|
5078 | $el = $$.$el;
|
5079 | config.legend_show || (config.legend_show = !0, $el.legend ? $el.legend.style("visibility", "visible") : $$.initLegend(), !$$.state.legendHasRendered && $$.updateLegend()), $$.removeHiddenLegendIds(targetIds), $el.legend.selectAll($$.selectorLegends(targetIds)).style("visibility", "visible").transition().style("opacity", function () {
|
5080 | return $$.opacityForLegend((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this));
|
5081 | });
|
5082 | },
|
5083 |
|
5084 | |
5085 |
|
5086 |
|
5087 |
|
5088 |
|
5089 | hideLegend: function hideLegend(targetIds) {
|
5090 | var $$ = this,
|
5091 | config = $$.config,
|
5092 | legend = $$.$el.legend;
|
5093 | 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");
|
5094 | },
|
5095 |
|
5096 | |
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 |
|
5102 |
|
5103 | getLegendItemTextBox: function getLegendItemTextBox(id, textElement) {
|
5104 | var data,
|
5105 | $$ = this,
|
5106 | cache = $$.cache,
|
5107 | state = $$.state,
|
5108 | cacheKey = KEY.legendItemTextBox;
|
5109 | return id && (data = !state.redrawing && cache.get(cacheKey) || {}, !data[id] && (data[id] = $$.getTextRect(textElement, config_classes.legendItem), cache.add(cacheKey, data)), data = data[id]), data;
|
5110 | },
|
5111 |
|
5112 | |
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 | setLegendItem: function setLegendItem(item) {
|
5118 | var $$ = this,
|
5119 | api = $$.api,
|
5120 | config = $$.config,
|
5121 | state = $$.state,
|
5122 | isTouch = state.inputType === "touch",
|
5123 | hasGauge = $$.hasType("gauge");
|
5124 | item.attr("class", function (id) {
|
5125 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
5126 | itemClass = !node.empty() && node.attr("class") || "";
|
5127 | return itemClass + $$.generateClass(config_classes.legendItem, id);
|
5128 | }).style("visibility", function (id) {
|
5129 | return $$.isLegendToShow(id) ? "visible" : "hidden";
|
5130 | }), config.interaction_enabled && (item.style("cursor", "pointer").on("click", function (event, id) {
|
5131 | callFn(config.legend_item_onclick, api, id) || (event.altKey ? (api.hide(), api.show(id)) : (api.toggle(id), (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.legendItemFocused, !1).style("opacity", null))), isTouch && $$.hideTooltip();
|
5132 | }), !isTouch && item.on("mouseout", function (event, id) {
|
5133 | callFn(config.legend_item_onout, api, id) || ((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.legendItemFocused, !1), hasGauge && $$.undoMarkOverlapped($$, "." + config_classes.gaugeValue), $$.api.revert());
|
5134 | }).on("mouseover", function (event, id) {
|
5135 | callFn(config.legend_item_onover, api, id) || ((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.legendItemFocused, !0), hasGauge && $$.markOverlapped(id, $$, "." + config_classes.gaugeValue), !state.transiting && $$.isTargetToShow(id) && api.focus(id));
|
5136 | }));
|
5137 | },
|
5138 |
|
5139 | |
5140 |
|
5141 |
|
5142 |
|
5143 |
|
5144 |
|
5145 | updateLegendElement: function updateLegendElement(targetIds, options) {
|
5146 | var xForLegend,
|
5147 | yForLegend,
|
5148 | background,
|
5149 | $$ = this,
|
5150 | config = $$.config,
|
5151 | state = $$.state,
|
5152 | legend = $$.$el.legend,
|
5153 | posMin = 10,
|
5154 | tileWidth = config.legend_item_tile_width + 5,
|
5155 | maxWidth = 0,
|
5156 | maxHeight = 0,
|
5157 | totalLength = 0,
|
5158 | offsets = {},
|
5159 | widths = {},
|
5160 | heights = {},
|
5161 | margins = [0],
|
5162 | steps = {},
|
5163 | step = 0,
|
5164 | isLegendRightOrInset = state.isLegendRight || state.isLegendInset,
|
5165 | targetIdz = targetIds.filter(function (id) {
|
5166 | return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
|
5167 | }),
|
5168 | withTransition = options.withTransition,
|
5169 | updatePositions = function (textElement, id, index) {
|
5170 | var margin,
|
5171 | isLast = index === targetIdz.length - 1,
|
5172 | box = $$.getLegendItemTextBox(id, textElement),
|
5173 | itemWidth = box.width + tileWidth + (isLast && !isLegendRightOrInset ? 0 : 10) + config.legend_padding,
|
5174 | itemHeight = box.height + 4,
|
5175 | itemLength = isLegendRightOrInset ? itemHeight : itemWidth,
|
5176 | areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(),
|
5177 | updateValues = function (id2, withoutStep) {
|
5178 | withoutStep || (margin = (areaLength - totalLength - itemLength) / 2, margin < posMin && (margin = (areaLength - itemLength) / 2, totalLength = 0, step++)), steps[id2] = step, margins[step] = state.isLegendInset ? 10 : margin, offsets[id2] = totalLength, totalLength += itemLength;
|
5179 | };
|
5180 |
|
5181 | 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);
|
5182 | widths[id] = itemWidth, heights[id] = itemHeight, (!maxWidth || itemWidth >= maxWidth) && (maxWidth = itemWidth), (!maxHeight || itemHeight >= maxHeight) && (maxHeight = itemHeight);
|
5183 | var maxLength = isLegendRightOrInset ? maxHeight : maxWidth;
|
5184 | config.legend_equally ? (Object.keys(widths).forEach(function (id2) {
|
5185 | return widths[id2] = maxWidth;
|
5186 | }), Object.keys(heights).forEach(function (id2) {
|
5187 | return heights[id2] = maxHeight;
|
5188 | }), margin = (areaLength - maxLength * targetIdz.length) / 2, margin < posMin ? (totalLength = 0, step = 0, targetIdz.forEach(function (id2) {
|
5189 | return updateValues(id2);
|
5190 | })) : updateValues(id, !0)) : updateValues(id);
|
5191 | };
|
5192 |
|
5193 | state.isLegendInset && (step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length, $$.updateLegendStep(step)), state.isLegendRight ? (xForLegend = function (id) {
|
5194 | return maxWidth * steps[id];
|
5195 | }, yForLegend = function (id) {
|
5196 | return margins[steps[id]] + offsets[id];
|
5197 | }) : state.isLegendInset ? (xForLegend = function (id) {
|
5198 | return maxWidth * steps[id] + 10;
|
5199 | }, yForLegend = function (id) {
|
5200 | return margins[steps[id]] + offsets[id];
|
5201 | }) : (xForLegend = function (id) {
|
5202 | return margins[steps[id]] + offsets[id];
|
5203 | }, yForLegend = function (id) {
|
5204 | return maxHeight * steps[id];
|
5205 | });
|
5206 |
|
5207 | var xForLegendText = function (id, i) {
|
5208 | return xForLegend(id, i) + 4 + config.legend_item_tile_width;
|
5209 | },
|
5210 | xForLegendRect = function (id, i) {
|
5211 | return xForLegend(id, i);
|
5212 | },
|
5213 | x1ForLegendTile = function (id, i) {
|
5214 | return xForLegend(id, i) - 2;
|
5215 | },
|
5216 | x2ForLegendTile = function (id, i) {
|
5217 | return xForLegend(id, i) - 2 + config.legend_item_tile_width;
|
5218 | },
|
5219 | yForLegendText = function (id, i) {
|
5220 | return yForLegend(id, i) + 9;
|
5221 | },
|
5222 | yForLegendRect = function (id, i) {
|
5223 | return yForLegend(id, i) - 5;
|
5224 | },
|
5225 | yForLegendTile = function (id, i) {
|
5226 | return yForLegend(id, i) + 4;
|
5227 | },
|
5228 | pos = -200,
|
5229 | l = legend.selectAll("." + config_classes.legendItem).data(targetIdz).enter().append("g");
|
5230 |
|
5231 | $$.setLegendItem(l), l.append("text").text(function (id) {
|
5232 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
5233 | }).each(function (id, i) {
|
5234 | updatePositions(this, id, i);
|
5235 | }).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);
|
5236 |
|
5237 | var getColor = function (id) {
|
5238 | var data = $$.getDataById(id);
|
5239 | return $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
5240 | },
|
5241 | usePoint = config.legend_usePoint;
|
5242 |
|
5243 | if (usePoint) {
|
5244 | var ids = [];
|
5245 | l.append(function (d) {
|
5246 | var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
5247 | ids.indexOf(d) === -1 && ids.push(d);
|
5248 | var point = pattern[ids.indexOf(d) % pattern.length];
|
5249 | return point === "rectangle" && (point = "rect"), browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use");
|
5250 | }).attr("class", config_classes.legendItemPoint).style("fill", getColor).style("pointer-events", "none").attr("href", function (data, idx, selection) {
|
5251 | var node = selection[idx],
|
5252 | nodeName = node.nodeName.toLowerCase();
|
5253 | return nodeName === "use" ? "#" + state.datetimeId + "-point-" + data : undefined;
|
5254 | });
|
5255 | } else l.append("line").attr("class", config_classes.legendItemTile).style("stroke", getColor).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);
|
5256 |
|
5257 |
|
5258 | background = legend.select("." + config_classes.legendBackground + " rect"), state.isLegendInset && maxWidth > 0 && background.size() === 0 && (background = legend.insert("g", "." + config_classes.legendItem).attr("class", config_classes.legendBackground).append("rect"));
|
5259 | var texts = legend.selectAll("text").data(targetIdz).text(function (id) {
|
5260 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
5261 | })
|
5262 | .each(function (id, i) {
|
5263 | updatePositions(this, id, i);
|
5264 | });
|
5265 | (withTransition ? texts.transition() : texts).attr("x", xForLegendText).attr("y", yForLegendText);
|
5266 | var rects = legend.selectAll("rect." + config_classes.legendItemEvent).data(targetIdz);
|
5267 |
|
5268 | if ((withTransition ? rects.transition() : rects).attr("width", function (id) {
|
5269 | return widths[id];
|
5270 | }).attr("height", function (id) {
|
5271 | return heights[id];
|
5272 | }).attr("x", xForLegendRect).attr("y", yForLegendRect), usePoint) {
|
5273 | var tiles = legend.selectAll("." + config_classes.legendItemPoint).data(targetIdz);
|
5274 | (withTransition ? tiles.transition() : tiles).each(function () {
|
5275 | var radius,
|
5276 | width,
|
5277 | height,
|
5278 | nodeName = this.nodeName.toLowerCase(),
|
5279 | pointR = config.point_r,
|
5280 | x = "x",
|
5281 | y = "y",
|
5282 | xOffset = 2,
|
5283 | yOffset = 2.5;
|
5284 |
|
5285 | if (nodeName === "circle") {
|
5286 | var size = pointR * .2;
|
5287 | x = "cx", y = "cy", radius = pointR + size, xOffset = pointR * 2, yOffset = -size;
|
5288 | } else if (nodeName === "rect") {
|
5289 | var _size = pointR * 2.5;
|
5290 |
|
5291 | width = _size, height = _size, yOffset = 3;
|
5292 | }
|
5293 |
|
5294 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr(x, function (d) {
|
5295 | return x1ForLegendTile(d) + xOffset;
|
5296 | }).attr(y, function (d) {
|
5297 | return yForLegendTile(d) - yOffset;
|
5298 | }).attr("r", radius).attr("width", width).attr("height", height);
|
5299 | });
|
5300 | } else {
|
5301 | var _tiles = legend.selectAll("line." + config_classes.legendItemTile).data(targetIdz);
|
5302 |
|
5303 | (withTransition ? _tiles.transition() : _tiles).style("stroke", getColor).attr("x1", x1ForLegendTile).attr("y1", yForLegendTile).attr("x2", x2ForLegendTile).attr("y2", yForLegendTile);
|
5304 | }
|
5305 |
|
5306 | background && (withTransition ? background.transition() : background).attr("height", $$.getLegendHeight() - 12).attr("width", maxWidth * (step + 1) + 10), $$.updateLegendItemWidth(maxWidth), $$.updateLegendItemHeight(maxHeight), $$.updateLegendStep(step);
|
5307 | }
|
5308 | });
|
5309 |
|
5310 | var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_ = __webpack_require__(8);
|
5311 | ;
|
5312 |
|
5313 |
|
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 | var redraw = ({
|
5321 | redraw: function redraw(options) {
|
5322 | options === void 0 && (options = {});
|
5323 | var $$ = this,
|
5324 | config = $$.config,
|
5325 | state = $$.state,
|
5326 | $el = $$.$el,
|
5327 | main = $el.main;
|
5328 | state.redrawing = !0;
|
5329 | var targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
5330 | initializing = options.initializing,
|
5331 | flow = options.flow,
|
5332 | wth = $$.getWithOption(options),
|
5333 | duration = wth.Transition ? config.transition_duration : 0,
|
5334 | durationForExit = wth.TransitionForExit ? duration : 0,
|
5335 | durationForAxis = wth.TransitionForAxis ? duration : 0,
|
5336 | transitions = $$.axis && $$.axis.generateTransitions(durationForAxis);
|
5337 |
|
5338 |
|
5339 | $$.updateSizes(initializing), wth.Legend && config.legend_show ? (options.withTransition = !!duration, $$.updateLegend($$.mapToIds($$.data.targets), options, transitions)) : wth.Dimension && $$.updateDimension(!0), (!$$.hasArcType() || state.hasRadar) && $$.updateCircleY && ($$.circleY = $$.updateCircleY()), state.hasAxis ? ($$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing), config.data_empty_label_text && main.select("text." + config_classes.text + "." + config_classes.empty).attr("x", state.width / 2).attr("y", state.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null), $$.hasGrid() && $$.updateGrid(duration), config.regions.length && $$.updateRegion(duration), ["bar", "candlestick", "line", "area"].forEach(function (v) {
|
5340 | var name = capitalize(v);
|
5341 | (/^(line|area)$/.test(v) && $$.hasTypeOf(name) || $$.hasType(v)) && $$["update" + name](durationForExit);
|
5342 | }), $el.text && main.selectAll("." + config_classes.selectedCircles).filter($$.isBarType.bind($$)).selectAll("circle").remove(), config.interaction_enabled && !flow && wth.EventRect && ($$.redrawEventRect(), $$.bindZoomEvent && $$.bindZoomEvent())) : ($el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform), $el.radar && $$.redrawRadar(durationForExit)), !state.resizing && ($$.hasPointType() || state.hasRadar) && $$.updateCircle(), $$.hasDataLabel() && !$$.hasArcType(null, ["radar"]) && $$.updateText(durationForExit), $$.redrawTitle && $$.redrawTitle(), initializing && $$.updateTypesElements(), $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart), $$.callPluginHook("$redraw", options, duration);
|
5343 | },
|
5344 |
|
5345 | |
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 | generateRedrawList: function generateRedrawList(targets, flow, duration, withSubchart) {
|
5354 | var $$ = this,
|
5355 | config = $$.config,
|
5356 | state = $$.state,
|
5357 | shape = $$.getDrawShape();
|
5358 | state.hasAxis && config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape);
|
5359 |
|
5360 | var flowFn = flow && $$.generateFlow({
|
5361 | targets: targets,
|
5362 | flow: flow,
|
5363 | duration: flow.duration,
|
5364 | shape: shape,
|
5365 | xv: $$.xv.bind($$)
|
5366 | }),
|
5367 | isTransition = (duration || flowFn) && isTabVisible(),
|
5368 | redrawList = $$.getRedrawList(shape, flow, flowFn, isTransition),
|
5369 | afterRedraw = flow || config.onrendered ? function () {
|
5370 | flowFn && flowFn(), state.redrawing = !1, callFn(config.onrendered, $$.api);
|
5371 | } : null;
|
5372 | if (afterRedraw)
|
5373 | if (isTransition && redrawList.length) {
|
5374 |
|
5375 | var waitForDraw = generateWait();
|
5376 |
|
5377 | (0,external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_.transition)().duration(duration).each(function () {
|
5378 | redrawList.reduce(function (acc, t1) {
|
5379 | return acc.concat(t1);
|
5380 | }, []).forEach(function (t) {
|
5381 | return waitForDraw.add(t);
|
5382 | });
|
5383 | }).call(waitForDraw, afterRedraw);
|
5384 | } else state.transiting || afterRedraw();
|
5385 |
|
5386 | $$.mapToIds($$.data.targets).forEach(function (id) {
|
5387 | state.withoutFadeIn[id] = !0;
|
5388 | });
|
5389 | },
|
5390 | getRedrawList: function getRedrawList(shape, flow, flowFn, isTransition) {
|
5391 | var $$ = this,
|
5392 | config = $$.config,
|
5393 | _$$$state = $$.state,
|
5394 | hasAxis = _$$$state.hasAxis,
|
5395 | hasRadar = _$$$state.hasRadar,
|
5396 | grid = $$.$el.grid,
|
5397 | _shape$pos = shape.pos,
|
5398 | cx = _shape$pos.cx,
|
5399 | cy = _shape$pos.cy,
|
5400 | xForText = _shape$pos.xForText,
|
5401 | yForText = _shape$pos.yForText,
|
5402 | list = [];
|
5403 | return hasAxis && ((config.grid_x_lines.length || config.grid_y_lines.length) && list.push($$.redrawGrid(isTransition)), config.regions.length && list.push($$.redrawRegion(isTransition)), Object.keys(shape.type).forEach(function (v) {
|
5404 | var name = capitalize(v),
|
5405 | drawFn = shape.type[v];
|
5406 | (/^(area|line)$/.test(v) && $$.hasTypeOf(name) || $$.hasType(v)) && list.push($$["redraw" + name](drawFn, isTransition));
|
5407 | }), !flow && grid.main && list.push($$.updateGridFocus())), (!$$.hasArcType() || hasRadar) && notEmpty(config.data_labels) && config.data_labels !== !1 && list.push($$.redrawText(xForText, yForText, flow, isTransition)), ($$.hasPointType() || hasRadar) && !config.point_focus_only && $$.redrawCircle && list.push($$.redrawCircle(cx, cy, isTransition, flowFn)), list;
|
5408 | },
|
5409 | updateAndRedraw: function updateAndRedraw(options) {
|
5410 | options === void 0 && (options = {});
|
5411 | var transitions,
|
5412 | $$ = this,
|
5413 | config = $$.config,
|
5414 | state = $$.state;
|
5415 |
|
5416 |
|
5417 |
|
5418 | 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 || (state.hasAxis && (transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0)), $$.updateScales(), $$.updateSvgSize(), $$.transformAll(options.withTransitionForTransform, transitions)), $$.redraw(options, transitions);
|
5419 | },
|
5420 | redrawWithoutRescale: function redrawWithoutRescale() {
|
5421 | this.redraw({
|
5422 | withY: !1,
|
5423 | withSubchart: !1,
|
5424 | withEventRect: !1,
|
5425 | withTransitionForAxis: !1
|
5426 | });
|
5427 | }
|
5428 | });
|
5429 | ;
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 | function getScale(type, min, max) {
|
5446 | type === void 0 && (type = "linear"), min === void 0 && (min = 0), max === void 0 && (max = 1);
|
5447 | var scale = {
|
5448 | linear: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear,
|
5449 | log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSymlog,
|
5450 | _log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLog,
|
5451 | time: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleTime
|
5452 | }[type]();
|
5453 | return scale.type = type, /_?log/.test(type) && scale.clamp(!0), scale.range([min, max]);
|
5454 | }
|
5455 | var scale = ({
|
5456 | |
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 |
|
5463 |
|
5464 |
|
5465 | getXScale: function getXScale(min, max, domain, offset) {
|
5466 | var $$ = this,
|
5467 | scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
|
5468 | return $$.getCustomizedScale(domain ? scale.domain(domain) : scale, offset);
|
5469 | },
|
5470 |
|
5471 | |
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 |
|
5477 |
|
5478 |
|
5479 |
|
5480 | getYScale: function getYScale(id, min, max, domain) {
|
5481 | var $$ = this,
|
5482 | scale = getScale($$.axis.getAxisType(id), min, max);
|
5483 | return domain && scale.domain(domain), scale;
|
5484 | },
|
5485 |
|
5486 | |
5487 |
|
5488 |
|
5489 |
|
5490 |
|
5491 |
|
5492 |
|
5493 | getYScaleById: function getYScaleById(id, isSub) {
|
5494 | isSub === void 0 && (isSub = !1);
|
5495 | var isY2 = this.axis.getId(id) === "y2",
|
5496 | key = isSub ? isY2 ? "subY2" : "subY" : isY2 ? "y2" : "y";
|
5497 | return this.scale[key];
|
5498 | },
|
5499 |
|
5500 | |
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 |
|
5506 |
|
5507 | getCustomizedScale: function getCustomizedScale(scaleValue, offsetValue) {
|
5508 | var $$ = this,
|
5509 | offset = offsetValue || function () {
|
5510 | return $$.axis.x.tickOffset();
|
5511 | },
|
5512 | scale = function (d, raw) {
|
5513 | var v = scaleValue(d) + offset();
|
5514 | return raw ? v : Math.ceil(v);
|
5515 | };
|
5516 |
|
5517 |
|
5518 | for (var key in scaleValue) scale[key] = scaleValue[key];
|
5519 |
|
5520 | return scale.orgDomain = function () {
|
5521 | return scaleValue.domain();
|
5522 | }, scale.orgScale = function () {
|
5523 | return scaleValue;
|
5524 | }, $$.axis.isCategorized() && (scale.domain = function (domainValue) {
|
5525 | var domain = domainValue;
|
5526 | return arguments.length ? (scaleValue.domain(domain), scale) : (domain = this.orgDomain(), [domain[0], domain[1] + 1]);
|
5527 | }), scale;
|
5528 | },
|
5529 |
|
5530 | |
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 | updateScales: function updateScales(isInit, updateXDomain) {
|
5537 | updateXDomain === void 0 && (updateXDomain = !0);
|
5538 | var $$ = this,
|
5539 | axis = $$.axis,
|
5540 | config = $$.config,
|
5541 | format = $$.format,
|
5542 | org = $$.org,
|
5543 | scale = $$.scale,
|
5544 | _$$$state = $$.state,
|
5545 | width = _$$$state.width,
|
5546 | height = _$$$state.height,
|
5547 | width2 = _$$$state.width2,
|
5548 | height2 = _$$$state.height2,
|
5549 | hasAxis = _$$$state.hasAxis;
|
5550 |
|
5551 | if (hasAxis) {
|
5552 | var isRotated = config.axis_rotated,
|
5553 | min = {
|
5554 | x: isRotated ? 1 : 0,
|
5555 | y: isRotated ? 0 : height,
|
5556 | subX: isRotated ? 1 : 0,
|
5557 | subY: isRotated ? 0 : height2
|
5558 | },
|
5559 | max = {
|
5560 | x: isRotated ? height : width,
|
5561 | y: isRotated ? width : 1,
|
5562 | subX: isRotated ? height : width,
|
5563 | subY: isRotated ? width2 : 1
|
5564 | },
|
5565 | xDomain = updateXDomain && scale.x && scale.x.orgDomain(),
|
5566 | xSubDomain = updateXDomain && org.xDomain;
|
5567 |
|
5568 |
|
5569 | scale.x = $$.getXScale(min.x, max.x, xDomain, function () {
|
5570 | return axis.x.tickOffset();
|
5571 | }), scale.subX = $$.getXScale(min.x, max.x, xSubDomain, function (d) {
|
5572 | return d % 1 ? 0 : axis.subX.tickOffset();
|
5573 | }), format.xAxisTick = axis.getXAxisTickFormat(), axis.setAxis("x", scale.x, config.axis_x_tick_outer, isInit), config.subchart_show && axis.setAxis("subX", scale.subX, config.axis_x_tick_outer, isInit), scale.y = $$.getYScale("y", min.y, max.y, scale.y ? scale.y.domain() : config.axis_y_default), scale.subY = $$.getYScale("y", min.subY, max.subY, scale.subY ? scale.subY.domain() : config.axis_y_default), axis.setAxis("y", scale.y, config.axis_y_tick_outer, isInit), config.axis_y2_show && (scale.y2 = $$.getYScale("y2", min.y, max.y, scale.y2 ? scale.y2.domain() : config.axis_y2_default), scale.subY2 = $$.getYScale("y2", min.subY, max.subY, scale.subY2 ? scale.subY2.domain() : config.axis_y2_default), axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit));
|
5574 | } else
|
5575 | $$.updateArc && $$.updateArc();
|
5576 | },
|
5577 |
|
5578 | |
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 | xx: function xx(d) {
|
5585 | var $$ = this,
|
5586 | config = $$.config,
|
5587 | _$$$scale = $$.scale,
|
5588 | x = _$$$scale.x,
|
5589 | zoom = _$$$scale.zoom,
|
5590 | fn = config.zoom_enabled && zoom ? zoom : x;
|
5591 | return d ? fn(isValue(d.x) ? d.x : d) : null;
|
5592 | },
|
5593 | xv: function xv(d) {
|
5594 | var $$ = this,
|
5595 | axis = $$.axis,
|
5596 | config = $$.config,
|
5597 | x = $$.scale.x,
|
5598 | value = $$.getBaseValue(d);
|
5599 | return axis.isTimeSeries() ? value = parseDate.call($$, value) : axis.isCategorized() && isString(value) && (value = config.axis_x_categories.indexOf(value)), Math.ceil(x(value));
|
5600 | },
|
5601 | yv: function yv(d) {
|
5602 | var $$ = this,
|
5603 | _$$$scale2 = $$.scale,
|
5604 | y = _$$$scale2.y,
|
5605 | y2 = _$$$scale2.y2,
|
5606 | yScale = d.axis && d.axis === "y2" ? y2 : y;
|
5607 | return Math.ceil(yScale($$.getBaseValue(d)));
|
5608 | },
|
5609 | subxx: function subxx(d) {
|
5610 | return d ? this.scale.subX(d.x) : null;
|
5611 | }
|
5612 | });
|
5613 |
|
5614 | var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webpack_require__(9);
|
5615 | ;
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 | var shape = ({
|
5625 | |
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 | getDrawShape: function getDrawShape() {
|
5631 | var $$ = this,
|
5632 | isRotated = $$.config.axis_rotated,
|
5633 | hasRadar = $$.state.hasRadar,
|
5634 | shape = {
|
5635 | type: {},
|
5636 | indices: {},
|
5637 | pos: {}
|
5638 | };
|
5639 |
|
5640 | if (["bar", "candlestick", "line", "area"].forEach(function (v) {
|
5641 | var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
|
5642 |
|
5643 | if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
5644 | var indices = $$.getShapeIndices($$["is" + name + "Type"]),
|
5645 | drawFn = $$["generateDraw" + name];
|
5646 | shape.indices[v] = indices, shape.type[v] = drawFn ? drawFn.bind($$)(indices, !1) : undefined;
|
5647 | }
|
5648 | }), !$$.hasArcType() || hasRadar) {
|
5649 |
|
5650 | var cx = hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX,
|
5651 | cy = hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY;
|
5652 | shape.pos = {
|
5653 | xForText: $$.generateXYForText(shape.indices, !0),
|
5654 | yForText: $$.generateXYForText(shape.indices, !1),
|
5655 | cx: (cx || function () {}).bind($$),
|
5656 | cy: (cy || function () {}).bind($$)
|
5657 | };
|
5658 | }
|
5659 |
|
5660 | return shape;
|
5661 | },
|
5662 | getShapeIndices: function getShapeIndices(typeFilter) {
|
5663 | var $$ = this,
|
5664 | config = $$.config,
|
5665 | xs = config.data_xs,
|
5666 | hasXs = notEmpty(xs),
|
5667 | indices = {},
|
5668 | i = hasXs ? {} : 0;
|
5669 | return hasXs && getUnique(Object.keys(xs).map(function (v) {
|
5670 | return xs[v];
|
5671 | })).forEach(function (v) {
|
5672 | i[v] = 0, indices[v] = {};
|
5673 | }), $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) {
|
5674 | for (var groups, xKey = (d.id in xs) ? xs[d.id] : "", ind = xKey ? indices[xKey] : indices, 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 ind) {
|
5675 | ind[d.id] = ind[_row4];
|
5676 | break;
|
5677 | }
|
5678 |
|
5679 | isUndefined(ind[d.id]) && (ind[d.id] = xKey ? i[xKey]++ : i++, ind.__max__ = (xKey ? i[xKey] : i) - 1);
|
5680 | }), indices;
|
5681 | },
|
5682 |
|
5683 | |
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 | getIndices: function getIndices(indices, id) {
|
5691 | var xs = this.config.data_xs;
|
5692 | return notEmpty(xs) ? indices[xs[id]] : indices;
|
5693 | },
|
5694 |
|
5695 | |
5696 |
|
5697 |
|
5698 |
|
5699 |
|
5700 |
|
5701 | getIndicesMax: function getIndicesMax(indices) {
|
5702 | return notEmpty(this.config.data_xs) ?
|
5703 | Object.keys(indices).map(function (v) {
|
5704 | return indices[v].__max__ || 0;
|
5705 | }).reduce(function (acc, curr) {
|
5706 | return acc + curr;
|
5707 | }) : indices.__max__;
|
5708 | },
|
5709 | getShapeX: function getShapeX(offset, indices, isSub) {
|
5710 | var $$ = this,
|
5711 | config = $$.config,
|
5712 | scale = $$.scale,
|
5713 | currScale = isSub ? scale.subX : scale.zoom || scale.x,
|
5714 | barPadding = config.bar_padding,
|
5715 | sum = function (p, c) {
|
5716 | return p + c;
|
5717 | },
|
5718 | halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
|
5719 |
|
5720 | return function (d) {
|
5721 | var ind = $$.getIndices(indices, d.id),
|
5722 | index = d.id in ind ? ind[d.id] : 0,
|
5723 | targetsNum = (ind.__max__ || 0) + 1,
|
5724 | x = 0;
|
5725 |
|
5726 | if (notEmpty(d.x)) {
|
5727 | var xPos = currScale(d.x, !0);
|
5728 | 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);
|
5729 | }
|
5730 |
|
5731 |
|
5732 | return offset && x && targetsNum > 1 && barPadding && (index && (x += barPadding * index), targetsNum > 2 ? x -= (targetsNum - 1) * barPadding / 2 : targetsNum === 2 && (x -= barPadding / 2)), x;
|
5733 | };
|
5734 | },
|
5735 | getShapeY: function getShapeY(isSub) {
|
5736 | var $$ = this,
|
5737 | isStackNormalized = $$.isStackNormalized();
|
5738 | return function (d) {
|
5739 | var value = d.value;
|
5740 | return isNumber(d) ? value = d : isStackNormalized ? value = $$.getRatio("index", d, !0) : $$.isBubbleZType(d) && (value = $$.getBubbleZData(d.value, "y")), $$.getYScaleById(d.id, isSub)(value);
|
5741 | };
|
5742 | },
|
5743 |
|
5744 | |
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 | getShapeYMin: function getShapeYMin(id) {
|
5751 | var $$ = this,
|
5752 | scale = $$.scale[$$.axis.getId(id)],
|
5753 | _scale$domain = scale.domain(),
|
5754 | yMin = _scale$domain[0];
|
5755 |
|
5756 | return !$$.isGrouped(id) && yMin > 0 ? yMin : 0;
|
5757 | },
|
5758 |
|
5759 | |
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 | getShapeOffsetData: function getShapeOffsetData(typeFilter) {
|
5766 | var $$ = this,
|
5767 | targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),
|
5768 | isStackNormalized = $$.isStackNormalized(),
|
5769 | shapeOffsetTargets = targets.map(function (target) {
|
5770 | var rowValues = target.values,
|
5771 | values = {};
|
5772 | $$.isStepType(target) && (rowValues = $$.convertValuesToStep(rowValues));
|
5773 | var rowValueMapByXValue = rowValues.reduce(function (out, d) {
|
5774 | var key = +d.x;
|
5775 | return out[key] = d, values[key] = isStackNormalized ? $$.getRatio("index", d, !0) : d.value, out;
|
5776 | }, {});
|
5777 | return {
|
5778 | id: target.id,
|
5779 | rowValues: rowValues,
|
5780 | rowValueMapByXValue: rowValueMapByXValue,
|
5781 | values: values
|
5782 | };
|
5783 | }),
|
5784 | indexMapByTargetId = targets.reduce(function (out, _ref, index) {
|
5785 | var id = _ref.id;
|
5786 | return out[id] = index, out;
|
5787 | }, {});
|
5788 | return {
|
5789 | indexMapByTargetId: indexMapByTargetId,
|
5790 | shapeOffsetTargets: shapeOffsetTargets
|
5791 | };
|
5792 | },
|
5793 | getShapeOffset: function getShapeOffset(typeFilter, indices, isSub) {
|
5794 | var $$ = this,
|
5795 | _$$$getShapeOffsetDat = $$.getShapeOffsetData(typeFilter),
|
5796 | shapeOffsetTargets = _$$$getShapeOffsetDat.shapeOffsetTargets,
|
5797 | indexMapByTargetId = _$$$getShapeOffsetDat.indexMapByTargetId;
|
5798 |
|
5799 | return function (d, idx) {
|
5800 | var ind = $$.getIndices(indices, d.id),
|
5801 | scale = $$.getYScaleById(d.id, isSub),
|
5802 | y0 = scale($$.getShapeYMin(d.id)),
|
5803 | dataXAsNumber = +d.x,
|
5804 | offset = y0;
|
5805 | return shapeOffsetTargets.filter(function (t) {
|
5806 | return t.id !== d.id;
|
5807 | }).forEach(function (t) {
|
5808 | if (ind[t.id] === ind[d.id] && indexMapByTargetId[t.id] < indexMapByTargetId[d.id]) {
|
5809 | var row = t.rowValues[idx];
|
5810 |
|
5811 | row && +row.x === dataXAsNumber || (row = t.rowValueMapByXValue[dataXAsNumber]), row && row.value * d.value >= 0 && (offset += scale(t.values[dataXAsNumber]) - y0);
|
5812 | }
|
5813 | }), offset;
|
5814 | };
|
5815 | },
|
5816 | getBarW: function getBarW(type, axis, targetsNum) {
|
5817 | var $$ = this,
|
5818 | config = $$.config,
|
5819 | org = $$.org,
|
5820 | scale = $$.scale,
|
5821 | maxDataCount = $$.getMaxDataCount(),
|
5822 | isGrouped = type === "bar" && config.data_groups.length,
|
5823 | configName = type + "_width",
|
5824 | tickInterval = scale.zoom && !$$.axis.isCategorized() ? org.xDomain.map(function (v) {
|
5825 | return scale.zoom(v);
|
5826 | }).reduce(function (a, c) {
|
5827 | return Math.abs(a) + c;
|
5828 | }) / maxDataCount : axis.tickInterval(maxDataCount),
|
5829 | getWidth = function (id) {
|
5830 | var width = id ? config[configName][id] : config[configName],
|
5831 | ratio = id ? width.ratio : config[configName + "_ratio"],
|
5832 | max = id ? width.max : config[configName + "_max"],
|
5833 | w = isNumber(width) ? width : targetsNum ? tickInterval * ratio / targetsNum : 0;
|
5834 | return max && w > max ? max : w;
|
5835 | },
|
5836 | result = getWidth();
|
5837 |
|
5838 | return !isGrouped && isObjectType(config[configName]) && (result = {
|
5839 | _$width: result,
|
5840 | _$total: []
|
5841 | }, $$.filterTargetsToShow($$.data.targets).forEach(function (v) {
|
5842 | config[configName][v.id] && (result[v.id] = getWidth(v.id), result._$total.push(result[v.id] || result._$width));
|
5843 | })), result;
|
5844 | },
|
5845 | isWithinShape: function isWithinShape(that, d) {
|
5846 | var isWithin,
|
5847 | $$ = this,
|
5848 | shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that);
|
5849 | return $$.isTargetToShow(d.id) ? "hasValidPointType" in $$ && $$.hasValidPointType(that.nodeName) ? isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScaleById(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;
|
5850 | },
|
5851 | getInterpolate: function getInterpolate(d) {
|
5852 | var $$ = this,
|
5853 | interpolation = $$.getInterpolateType(d);
|
5854 | return {
|
5855 | "basis": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasis,
|
5856 | "basis-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasisClosed,
|
5857 | "basis-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasisOpen,
|
5858 | "bundle": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBundle,
|
5859 | "cardinal": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCardinal,
|
5860 | "cardinal-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCardinalClosed,
|
5861 | "cardinal-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCardinalOpen,
|
5862 | "catmull-rom": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCatmullRom,
|
5863 | "catmull-rom-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCatmullRomClosed,
|
5864 | "catmull-rom-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCatmullRomOpen,
|
5865 | "monotone-x": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveMonotoneX,
|
5866 | "monotone-y": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveMonotoneY,
|
5867 | "natural": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveNatural,
|
5868 | "linear-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveLinearClosed,
|
5869 | "linear": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveLinear,
|
5870 | "step": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveStep,
|
5871 | "step-after": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveStepAfter,
|
5872 | "step-before": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveStepBefore
|
5873 | }[interpolation];
|
5874 | },
|
5875 | getInterpolateType: function getInterpolateType(d) {
|
5876 | var $$ = this,
|
5877 | config = $$.config,
|
5878 | type = config.spline_interpolation_type,
|
5879 | interpolation = $$.isInterpolationType(type) ? type : "cardinal";
|
5880 | return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? config.line_step_type : "linear";
|
5881 | }
|
5882 | });
|
5883 | ;
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 | var size = ({
|
5892 | |
5893 |
|
5894 |
|
5895 |
|
5896 | setContainerSize: function setContainerSize() {
|
5897 | var $$ = this,
|
5898 | state = $$.state;
|
5899 | state.current.width = $$.getCurrentWidth(), state.current.height = $$.getCurrentHeight();
|
5900 | },
|
5901 | getCurrentWidth: function getCurrentWidth() {
|
5902 | var $$ = this;
|
5903 | return $$.config.size_width || $$.getParentWidth();
|
5904 | },
|
5905 | getCurrentHeight: function getCurrentHeight() {
|
5906 | var $$ = this,
|
5907 | config = $$.config,
|
5908 | h = config.size_height || $$.getParentHeight();
|
5909 | return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1);
|
5910 | },
|
5911 | getCurrentPaddingTop: function getCurrentPaddingTop() {
|
5912 | var $$ = this,
|
5913 | config = $$.config,
|
5914 | hasAxis = $$.state.hasAxis,
|
5915 | $el = $$.$el,
|
5916 | axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
5917 | padding = isValue(config.padding_top) ? config.padding_top : 0;
|
5918 | return $el.title && $el.title.node() && (padding += $$.getTitlePadding()), axesLen && config.axis_rotated && (padding += $$.getHorizontalAxisHeight("y2") * axesLen), padding;
|
5919 | },
|
5920 | getCurrentPaddingBottom: function getCurrentPaddingBottom() {
|
5921 | var $$ = this,
|
5922 | config = $$.config,
|
5923 | hasAxis = $$.state.hasAxis,
|
5924 | axisId = config.axis_rotated ? "y" : "x",
|
5925 | axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
5926 | padding = isValue(config.padding_bottom) ? config.padding_bottom : 0;
|
5927 | return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
5928 | },
|
5929 | getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
|
5930 | var padding,
|
5931 | $$ = this,
|
5932 | config = $$.config,
|
5933 | hasAxis = $$.state.hasAxis,
|
5934 | isRotated = config.axis_rotated,
|
5935 | axisId = isRotated ? "x" : "y",
|
5936 | axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
5937 | axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
|
5938 | return padding = isValue(config.padding_left) ? config.padding_left : hasAxis && isRotated ? config.axis_x_show ? Math.max(ceil10(axisWidth), 40) : 1 : hasAxis && (!config.axis_y_show || config.axis_y_inner) ? $$.axis.getAxisLabelPosition("y").isOuter ? 30 : 1 : ceil10(axisWidth), padding + axisWidth * axesLen;
|
5939 | },
|
5940 | getCurrentPaddingRight: function getCurrentPaddingRight(withXAxisTickTextOverflow) {
|
5941 | withXAxisTickTextOverflow === void 0 && (withXAxisTickTextOverflow = !1);
|
5942 | var padding,
|
5943 | $$ = this,
|
5944 | config = $$.config,
|
5945 | hasAxis = $$.state.hasAxis,
|
5946 | defaultPadding = 10,
|
5947 | legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
5948 | axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
5949 | axisWidth = hasAxis ? $$.getAxisWidthByAxisId("y2") : 0,
|
5950 | xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
|
5951 | return padding = isValue(config.padding_right) ? config.padding_right + 1 : $$.axis && config.axis_rotated ? defaultPadding + legendWidthOnRight : $$.axis && (!config.axis_y2_show || config.axis_y2_inner) ? Math.max(2 + legendWidthOnRight + ($$.axis.getAxisLabelPosition("y2").isOuter ? 20 : 0), xAxisTickTextOverflow) : Math.max(ceil10(axisWidth) + legendWidthOnRight, xAxisTickTextOverflow), padding + axisWidth * axesLen;
|
5952 | },
|
5953 |
|
5954 | |
5955 |
|
5956 |
|
5957 |
|
5958 |
|
5959 |
|
5960 | getParentRectValue: function getParentRectValue(key) {
|
5961 | for (var v, offsetName = "offset" + capitalize(key), parent = this.$el.chart.node(); !v && parent && parent.tagName !== "BODY";) {
|
5962 | try {
|
5963 | v = parent.getBoundingClientRect()[key];
|
5964 | } catch (e) {
|
5965 | offsetName in parent && (v = parent[offsetName]);
|
5966 | }
|
5967 |
|
5968 | parent = parent.parentNode;
|
5969 | }
|
5970 |
|
5971 | if (key === "width") {
|
5972 |
|
5973 |
|
5974 | var bodyWidth = browser_doc.body.offsetWidth;
|
5975 | v > bodyWidth && (v = bodyWidth);
|
5976 | }
|
5977 |
|
5978 | return v;
|
5979 | },
|
5980 | getParentWidth: function getParentWidth() {
|
5981 | return this.getParentRectValue("width");
|
5982 | },
|
5983 | getParentHeight: function getParentHeight() {
|
5984 | var h = this.$el.chart.style("height");
|
5985 | return h.indexOf("px") > 0 ? parseInt(h, 10) : 0;
|
5986 | },
|
5987 | getSvgLeft: function getSvgLeft(withoutRecompute) {
|
5988 | var $$ = this,
|
5989 | config = $$.config,
|
5990 | $el = $$.$el,
|
5991 | hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner,
|
5992 | leftAxisClass = config.axis_rotated ? config_classes.axisX : config_classes.axisY,
|
5993 | leftAxis = $el.main.select("." + leftAxisClass).node(),
|
5994 | svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {
|
5995 | right: 0
|
5996 | },
|
5997 | chartRect = $el.chart.node().getBoundingClientRect(),
|
5998 | hasArc = $$.hasArcType(),
|
5999 | svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));
|
6000 | return svgLeft > 0 ? svgLeft : 0;
|
6001 | },
|
6002 | updateDimension: function updateDimension(withoutAxis) {
|
6003 | var $$ = this,
|
6004 | config = $$.config,
|
6005 | hasAxis = $$.state.hasAxis,
|
6006 | $el = $$.$el;
|
6007 |
|
6008 | hasAxis && !withoutAxis && $$.axis.x && config.axis_rotated && $$.axis.subX && $$.axis.subX.create($el.axis.subX), $$.updateScales(withoutAxis), $$.updateSvgSize(), $$.transformAll(!1);
|
6009 | },
|
6010 | updateSvgSize: function updateSvgSize() {
|
6011 | var $$ = this,
|
6012 | _$$$state = $$.state,
|
6013 | clip = _$$$state.clip,
|
6014 | current = _$$$state.current,
|
6015 | hasAxis = _$$$state.hasAxis,
|
6016 | width = _$$$state.width,
|
6017 | height = _$$$state.height,
|
6018 | svg = $$.$el.svg;
|
6019 |
|
6020 | if (svg.attr("width", current.width).attr("height", current.height), hasAxis) {
|
6021 | var brush = svg.select("." + config_classes.brush + " .overlay"),
|
6022 | brushSize = {
|
6023 | width: 0,
|
6024 | height: 0
|
6025 | };
|
6026 | brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), svg.selectAll(["#" + clip.id, "#" + clip.idGrid]).select("rect").attr("width", width).attr("height", height), svg.select("#" + clip.idXAxis).select("rect").call($$.setXAxisClipPath.bind($$)), svg.select("#" + clip.idYAxis).select("rect").call($$.setYAxisClipPath.bind($$)), clip.idSubchart && svg.select("#" + clip.idSubchart).select("rect").attr("width", width).attr("height", brushSize.height);
|
6027 | }
|
6028 | },
|
6029 |
|
6030 | |
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 | updateSizes: function updateSizes(isInit) {
|
6036 | var $$ = this,
|
6037 | config = $$.config,
|
6038 | state = $$.state,
|
6039 | legend = $$.$el.legend,
|
6040 | isRotated = config.axis_rotated,
|
6041 | hasArc = $$.hasArcType();
|
6042 | isInit || $$.setContainerSize();
|
6043 | var currLegend = {
|
6044 | width: legend ? $$.getLegendWidth() : 0,
|
6045 | height: legend ? $$.getLegendHeight() : 0
|
6046 | };
|
6047 | !hasArc && config.axis_x_show && config.axis_x_tick_autorotate && $$.updateXAxisTickClip();
|
6048 | var legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height,
|
6049 | xAxisHeight = isRotated || hasArc ? 0 : $$.getHorizontalAxisHeight("x"),
|
6050 | subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
6051 | subchartHeight = config.subchart_show && !hasArc ? config.subchart_size_height + subchartXAxisHeight : 0;
|
6052 | state.margin = !hasArc && isRotated ? {
|
6053 | top: $$.getHorizontalAxisHeight("y2") + $$.getCurrentPaddingTop(),
|
6054 | right: hasArc ? 0 : $$.getCurrentPaddingRight(!0),
|
6055 | bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
6056 | left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
|
6057 | } : {
|
6058 | top: 4 + $$.getCurrentPaddingTop(),
|
6059 |
|
6060 | right: hasArc ? 0 : $$.getCurrentPaddingRight(!0),
|
6061 | bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
6062 | left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
6063 | }, state.margin2 = isRotated ? {
|
6064 | top: state.margin.top,
|
6065 | right: NaN,
|
6066 | bottom: 20 + legendHeightForBottom,
|
6067 | left: $$.state.rotatedPadding.left
|
6068 | } : {
|
6069 | top: state.current.height - subchartHeight - legendHeightForBottom,
|
6070 | right: NaN,
|
6071 | bottom: subchartXAxisHeight + legendHeightForBottom,
|
6072 | left: state.margin.left
|
6073 | }, state.margin3 = {
|
6074 | top: 0,
|
6075 | right: NaN,
|
6076 | bottom: 0,
|
6077 | left: 0
|
6078 | }, $$.updateSizeForLegend && $$.updateSizeForLegend(currLegend), state.width = state.current.width - state.margin.left - state.margin.right, state.height = state.current.height - state.margin.top - state.margin.bottom, state.width < 0 && (state.width = 0), state.height < 0 && (state.height = 0), state.width2 = isRotated ? state.margin.left - state.rotatedPadding.left - state.rotatedPadding.right : state.width, state.height2 = isRotated ? state.height : state.current.height - state.margin2.top - state.margin2.bottom, state.width2 < 0 && (state.width2 = 0), state.height2 < 0 && (state.height2 = 0);
|
6079 |
|
6080 | var hasGauge = $$.hasType("gauge"),
|
6081 | isLegendRight = config.legend_show && state.isLegendRight;
|
6082 | state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0), state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10), hasGauge && !config.gauge_fullCircle && (state.arcHeight += state.height - $$.getPaddingBottomForGauge()), $$.updateRadius && $$.updateRadius(), state.isLegendRight && hasArc && (state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1);
|
6083 | }
|
6084 | });
|
6085 | ;
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 | var internals_text = ({
|
6095 | opacityForText: function opacityForText(d) {
|
6096 | var $$ = this;
|
6097 | return $$.isBarType(d) && !$$.meetsLabelThreshold(Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel ? "1" : "0";
|
6098 | },
|
6099 |
|
6100 | |
6101 |
|
6102 |
|
6103 |
|
6104 | initText: function initText() {
|
6105 | var $el = this.$el;
|
6106 | $el.main.select("." + config_classes.chart).append("g").attr("class", config_classes.chartTexts);
|
6107 | },
|
6108 |
|
6109 | |
6110 |
|
6111 |
|
6112 |
|
6113 |
|
6114 | updateTargetsForText: function updateTargetsForText(targets) {
|
6115 | var $$ = this,
|
6116 | classChartText = $$.getChartClass("Text"),
|
6117 | classTexts = $$.getClass("texts", "id"),
|
6118 | classFocus = $$.classFocus.bind($$),
|
6119 | mainTextUpdate = $$.$el.main.select("." + config_classes.chartTexts).selectAll("." + config_classes.chartText).data(targets).attr("class", function (d) {
|
6120 | return classChartText(d) + classFocus(d);
|
6121 | }),
|
6122 | mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).style("pointer-events", "none");
|
6123 | mainTextEnter.append("g").attr("class", classTexts);
|
6124 | },
|
6125 |
|
6126 | |
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 | updateText: function updateText(durationForExit) {
|
6132 | var $$ = this,
|
6133 | config = $$.config,
|
6134 | $el = $$.$el,
|
6135 | classText = $$.getClass("text", "index"),
|
6136 | text = $el.main.selectAll("." + config_classes.texts).selectAll("." + config_classes.text).data($$.labelishData.bind($$));
|
6137 | text.exit().transition().duration(durationForExit).style("fill-opacity", "0").remove(), $el.text = text.enter().append("text").merge(text).attr("class", classText).attr("text-anchor", function (d) {
|
6138 |
|
6139 | var isEndAnchor = d.value < 0;
|
6140 |
|
6141 | if ($$.isCandlestickType(d)) {
|
6142 | var data = $$.getCandlestickData(d);
|
6143 | isEndAnchor = data && !data._isUp;
|
6144 | }
|
6145 |
|
6146 | return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle";
|
6147 | }).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", "0").each(function (d, i, j) {
|
6148 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
6149 | value = d.value;
|
6150 | if ($$.isBubbleZType(d)) value = $$.getBubbleZData(value, "z");else if ($$.isCandlestickType(d)) {
|
6151 | var data = $$.getCandlestickData(d);
|
6152 | data && (value = data.close);
|
6153 | }
|
6154 | value = $$.dataLabelFormat(d.id)(value, d.id, i, j), isNumber(value) ? this.textContent = value : setTextValue(node, value);
|
6155 | });
|
6156 | },
|
6157 | updateTextColor: function updateTextColor(d) {
|
6158 | var color,
|
6159 | $$ = this,
|
6160 | config = $$.config,
|
6161 | labelColors = config.data_labels_colors,
|
6162 | defaultColor = $$.isArcType(d) && !$$.isRadarType(d) ? null : $$.color(d);
|
6163 | if (isString(labelColors)) color = labelColors;else if (isObject(labelColors)) {
|
6164 | var _ref = d.data || d,
|
6165 | id = _ref.id;
|
6166 |
|
6167 | color = labelColors[id];
|
6168 | } else isFunction(labelColors) && (color = labelColors.bind($$.api)(defaultColor, d));
|
6169 |
|
6170 | if ($$.isCandlestickType(d) && !isFunction(labelColors)) {
|
6171 | var value = $$.getCandlestickData(d);
|
6172 |
|
6173 | if (value && !value._isUp) {
|
6174 | var downColor = config.candlestick_color_down;
|
6175 | color = isObject(downColor) ? downColor[d.id] : downColor;
|
6176 | }
|
6177 | }
|
6178 |
|
6179 | return color || defaultColor;
|
6180 | },
|
6181 |
|
6182 | |
6183 |
|
6184 |
|
6185 |
|
6186 |
|
6187 |
|
6188 |
|
6189 |
|
6190 |
|
6191 | redrawText: function redrawText(x, y, forFlow, withTransition) {
|
6192 | var $$ = this,
|
6193 | t = getRandom(!0);
|
6194 |
|
6195 |
|
6196 | return $$.$el.text.style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
|
6197 |
|
6198 | var node = withTransition && this.getAttribute("x") ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).transition(t) : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
6199 | posX = x.bind(this)(d, i),
|
6200 | posY = y.bind(this)(d, i);
|
6201 | this.childElementCount ? node.attr("transform", "translate(" + posX + " " + posY + ")") : node.attr("x", posX).attr("y", posY);
|
6202 | }), !0;
|
6203 | },
|
6204 |
|
6205 | |
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 |
|
6212 | getTextRect: function getTextRect(element, className) {
|
6213 | var $$ = this,
|
6214 | base = element.node ? element.node() : element;
|
6215 | /text/i.test(base.tagName) || (base = base.querySelector("text"));
|
6216 | var text = base.textContent,
|
6217 | cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_"),
|
6218 | rect = $$.cache.get(cacheKey);
|
6219 | return rect || ($$.$el.svg.append("text").style("visibility", "hidden").style("font", (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(base).style("font")).classed(className, !0).text(text).call(function (v) {
|
6220 | rect = getBoundingRect(v.node());
|
6221 | }).remove(), $$.cache.add(cacheKey, rect)), rect;
|
6222 | },
|
6223 |
|
6224 | |
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 | generateXYForText: function generateXYForText(indices, forX) {
|
6232 | var $$ = this,
|
6233 | types = Object.keys(indices),
|
6234 | points = {},
|
6235 | getter = forX ? $$.getXForText : $$.getYForText;
|
6236 | return $$.hasType("radar") && types.push("radar"), types.forEach(function (v) {
|
6237 | points[v] = $$["generateGet" + capitalize(v) + "Points"](indices[v], !1);
|
6238 | }), function (d, i) {
|
6239 | var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || "line";
|
6240 | return getter.call($$, points[type](d, i), d, this);
|
6241 | };
|
6242 | },
|
6243 |
|
6244 | |
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 | getCenteredTextPos: function getCenteredTextPos(d, points, textElement) {
|
6253 | var $$ = this,
|
6254 | config = $$.config,
|
6255 | isRotated = config.axis_rotated;
|
6256 |
|
6257 | if (config.data_labels.centered && $$.isBarType(d)) {
|
6258 | var rect = getBoundingRect(textElement),
|
6259 | isPositive = d.value >= 0;
|
6260 |
|
6261 | if (isRotated) {
|
6262 | var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
6263 | return isPositive ? -w - 3 : w + 2;
|
6264 | }
|
6265 |
|
6266 | var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
6267 | return isPositive ? h : -h - 2;
|
6268 | }
|
6269 |
|
6270 | return 0;
|
6271 | },
|
6272 |
|
6273 | |
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 | getTextPos: function getTextPos(id, type) {
|
6281 | var pos = this.config.data_labels_position;
|
6282 | return (id in pos ? pos[id] : pos)[type] || 0;
|
6283 | },
|
6284 |
|
6285 | |
6286 |
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 | getXForText: function getXForText(points, d, textElement) {
|
6294 | var $$ = this,
|
6295 | config = $$.config,
|
6296 | state = $$.state,
|
6297 | isRotated = config.axis_rotated,
|
6298 | xPos = points[0][0];
|
6299 | if ($$.hasType("candlestick")) isRotated ? xPos = $$.getCandlestickData(d)._isUp ? points[2][2] + 4 : points[2][1] - 4 : xPos += (points[1][0] - xPos) / 2;else if (isRotated) {
|
6300 | var padding = $$.isBarType(d) ? 4 : 6;
|
6301 | xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1);
|
6302 | } else xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : xPos;
|
6303 |
|
6304 | if (d.value === null) if (xPos > state.width) {
|
6305 | var _getBoundingRect = getBoundingRect(textElement),
|
6306 | width = _getBoundingRect.width;
|
6307 |
|
6308 | xPos = state.width - width;
|
6309 | } else xPos < 0 && (xPos = 4);
|
6310 | return isRotated && (xPos += $$.getCenteredTextPos(d, points, textElement)), xPos + $$.getTextPos(d.id, "x");
|
6311 | },
|
6312 |
|
6313 | |
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 | getYForText: function getYForText(points, d, textElement) {
|
6322 | var yPos,
|
6323 | $$ = this,
|
6324 | config = $$.config,
|
6325 | state = $$.state,
|
6326 | isRotated = config.axis_rotated,
|
6327 | r = config.point_r,
|
6328 | rect = getBoundingRect(textElement),
|
6329 | value = d.value,
|
6330 | baseY = 3;
|
6331 | if ($$.isCandlestickType(d)) value = $$.getCandlestickData(d), isRotated ? (yPos = points[0][0], yPos += (points[1][0] - yPos) / 2 + baseY) : yPos = value && value._isUp ? points[2][2] - baseY : points[2][1] + baseY * 4;else 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), value < 0 || value === 0 && !state.hasPositiveValue && state.hasNegativeValue) yPos += rect.height + ($$.isBarType(d) ? -baseY : baseY);else {
|
6332 | var diff = -baseY * 2;
|
6333 | $$.isBarType(d) ? diff = -baseY : $$.isBubbleType(d) && (diff = baseY), yPos += diff;
|
6334 | }
|
6335 |
|
6336 | if (d.value === null && !isRotated) {
|
6337 | var boxHeight = rect.height;
|
6338 | yPos < boxHeight ? yPos = boxHeight : yPos > state.height && (yPos = state.height - 4);
|
6339 | }
|
6340 |
|
6341 | return isRotated || (yPos += $$.getCenteredTextPos(d, points, textElement)), yPos + $$.getTextPos(d.id, "y");
|
6342 | },
|
6343 |
|
6344 | |
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 | markOverlapped: function markOverlapped(id, $$, selector) {
|
6353 | var textNodes = $$.$el.arcs.selectAll(selector),
|
6354 | filteredTextNodes = textNodes.filter(function (node) {
|
6355 | return node.data.id !== id;
|
6356 | }),
|
6357 | textNode = textNodes.filter(function (node) {
|
6358 | return node.data.id === id;
|
6359 | }),
|
6360 | translate = getTranslation(textNode.node()),
|
6361 | calcHypo = function (x, y) {
|
6362 | return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
6363 | };
|
6364 |
|
6365 | textNode.node() && filteredTextNodes.each(function () {
|
6366 | var coordinate = getTranslation(this),
|
6367 | filteredTextNode = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
6368 | nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode,
|
6369 | overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength()),
|
6370 | overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < parseInt(textNode.style("font-size"), 10);
|
6371 | filteredTextNode.classed(config_classes.TextOverlapping, overlapsX && overlapsY);
|
6372 | });
|
6373 | },
|
6374 |
|
6375 | |
6376 |
|
6377 |
|
6378 |
|
6379 |
|
6380 |
|
6381 |
|
6382 | undoMarkOverlapped: function undoMarkOverlapped($$, selector) {
|
6383 | $$.$el.arcs.selectAll(selector).each(function () {
|
6384 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.selectAll)([this, this.previousSibling]).classed(config_classes.TextOverlapping, !1);
|
6385 | });
|
6386 | },
|
6387 |
|
6388 | |
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 |
|
6395 | meetsLabelThreshold: function meetsLabelThreshold(ratio, type) {
|
6396 | ratio === void 0 && (ratio = 0);
|
6397 | var $$ = this,
|
6398 | config = $$.config,
|
6399 | threshold = config[type + "_label_threshold"] || 0;
|
6400 | return ratio >= threshold;
|
6401 | }
|
6402 | });
|
6403 | ;
|
6404 |
|
6405 |
|
6406 |
|
6407 |
|
6408 |
|
6409 |
|
6410 |
|
6411 |
|
6412 |
|
6413 |
|
6414 |
|
6415 |
|
6416 |
|
6417 |
|
6418 | function getTextPos(pos, width) {
|
6419 | pos === void 0 && (pos = "left");
|
6420 | var position,
|
6421 | isNum = isNumber(width);
|
6422 | return position = pos.indexOf("center") > -1 ? isNum ? width / 2 : "middle" : pos.indexOf("right") > -1 ? isNum ? width : "end" : isNum ? 0 : "start", position;
|
6423 | }
|
6424 |
|
6425 | var internals_title = ({
|
6426 | |
6427 |
|
6428 |
|
6429 |
|
6430 | initTitle: function initTitle() {
|
6431 | var $$ = this,
|
6432 | config = $$.config,
|
6433 | $el = $$.$el;
|
6434 |
|
6435 | if (config.title_text) {
|
6436 | $el.title = $el.svg.append("g");
|
6437 | var text = $el.title.append("text").style("text-anchor", getTextPos(config.title_position)).attr("class", config_classes.title);
|
6438 | setTextValue(text, config.title_text, [.3, 1.5]);
|
6439 | }
|
6440 | },
|
6441 |
|
6442 | |
6443 |
|
6444 |
|
6445 |
|
6446 | redrawTitle: function redrawTitle() {
|
6447 | var $$ = this,
|
6448 | config = $$.config,
|
6449 | current = $$.state.current,
|
6450 | title = $$.$el.title;
|
6451 |
|
6452 | if (title) {
|
6453 | var y = $$.yForTitle.call($$);
|
6454 | /g/i.test(title.node().tagName) ? title.attr("transform", "translate(" + getTextPos(config.title_position, current.width) + ", " + y + ")") : title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
6455 | }
|
6456 | },
|
6457 |
|
6458 | |
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 | xForTitle: function xForTitle() {
|
6464 | var x,
|
6465 | $$ = this,
|
6466 | config = $$.config,
|
6467 | current = $$.state.current,
|
6468 | position = config.title_position || "left",
|
6469 | textRectWidth = $$.getTextRect($$.$el.title, config_classes.title).width;
|
6470 | return /(right|center)/.test(position) ? (x = current.width - textRectWidth, position.indexOf("right") >= 0 ? x = current.width - textRectWidth - config.title_padding.right : position.indexOf("center") >= 0 && (x = (current.width - textRectWidth) / 2)) : x = config.title_padding.left || 0, x;
|
6471 | },
|
6472 |
|
6473 | |
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 | yForTitle: function yForTitle() {
|
6479 | var $$ = this;
|
6480 | return ($$.config.title_padding.top || 0) + $$.getTextRect($$.$el.title, config_classes.title).height;
|
6481 | },
|
6482 |
|
6483 | |
6484 |
|
6485 |
|
6486 |
|
6487 |
|
6488 | getTitlePadding: function getTitlePadding() {
|
6489 | var $$ = this;
|
6490 | return $$.yForTitle() + ($$.config.title_padding.bottom || 0);
|
6491 | }
|
6492 | });
|
6493 | ;
|
6494 |
|
6495 |
|
6496 |
|
6497 |
|
6498 |
|
6499 |
|
6500 |
|
6501 |
|
6502 | var internals_tooltip = ({
|
6503 | |
6504 |
|
6505 |
|
6506 |
|
6507 | initTooltip: function initTooltip() {
|
6508 | var $$ = this,
|
6509 | config = $$.config,
|
6510 | $el = $$.$el;
|
6511 | $el.tooltip = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(config.tooltip_contents.bindto), $el.tooltip.empty() && ($el.tooltip = $el.chart.style("position", "relative").append("div").attr("class", config_classes.tooltipContainer).style("position", "absolute").style("pointer-events", "none").style("display", "none")), $$.bindTooltipResizePos();
|
6512 | },
|
6513 | initShowTooltip: function initShowTooltip() {
|
6514 | var $$ = this,
|
6515 | config = $$.config,
|
6516 | $el = $$.$el,
|
6517 | _$$$state = $$.state,
|
6518 | hasAxis = _$$$state.hasAxis,
|
6519 | hasRadar = _$$$state.hasRadar;
|
6520 |
|
6521 |
|
6522 | if (config.tooltip_init_show) {
|
6523 | var isArc = !(hasAxis && hasRadar);
|
6524 |
|
6525 | if ($$.axis && $$.axis.isTimeSeries() && isString(config.tooltip_init_x)) {
|
6526 | var i,
|
6527 | val,
|
6528 | targets = $$.data.targets[0];
|
6529 |
|
6530 | for (config.tooltip_init_x = parseDate.call($$, config.tooltip_init_x), i = 0; (val = targets.values[i]) && !(val.x - config.tooltip_init_x === 0); i++);
|
6531 |
|
6532 | config.tooltip_init_x = i;
|
6533 | }
|
6534 |
|
6535 | var data = $$.data.targets.map(function (d) {
|
6536 | var x = isArc ? 0 : config.tooltip_init_x;
|
6537 | return $$.addName(d.values[x]);
|
6538 | });
|
6539 | isArc && (data = [data[config.tooltip_init_x]]), $el.tooltip.html($$.getTooltipHTML(data, $$.axis && $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType(null, ["radar"])), $$.color)), config.tooltip_contents.bindto || $el.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", "block");
|
6540 | }
|
6541 | },
|
6542 |
|
6543 | |
6544 |
|
6545 |
|
6546 |
|
6547 |
|
6548 |
|
6549 | getTooltipHTML: function getTooltipHTML() {
|
6550 | var $$ = this,
|
6551 | api = $$.api,
|
6552 | config = $$.config;
|
6553 | return isFunction(config.tooltip_contents) ? config.tooltip_contents.bind(api).apply(void 0, arguments) : $$.getTooltipContent.apply($$, arguments);
|
6554 | },
|
6555 |
|
6556 | |
6557 |
|
6558 |
|
6559 |
|
6560 |
|
6561 |
|
6562 |
|
6563 |
|
6564 |
|
6565 | getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) {
|
6566 | var $$ = this,
|
6567 | api = $$.api,
|
6568 | config = $$.config,
|
6569 | state = $$.state,
|
6570 | _map = ["title", "name", "value"].map(function (v) {
|
6571 | var fn = config["tooltip_format_" + v];
|
6572 | return isFunction(fn) ? fn.bind(api) : fn;
|
6573 | }),
|
6574 | titleFormat = _map[0],
|
6575 | nameFormat = _map[1],
|
6576 | valueFormat = _map[2];
|
6577 |
|
6578 | titleFormat = titleFormat || defaultTitleFormat, nameFormat = nameFormat || function (name) {
|
6579 | return name;
|
6580 | }, valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) {
|
6581 | return (ratio * 100).toFixed(2) + "%";
|
6582 | } : defaultValueFormat);
|
6583 |
|
6584 | var order = config.tooltip_order,
|
6585 | getRowValue = function (row) {
|
6586 | return $$.axis && $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row);
|
6587 | },
|
6588 | getBgColor = $$.levelColor ? function (row) {
|
6589 | return $$.levelColor(row.value);
|
6590 | } : function (row) {
|
6591 | return color(row);
|
6592 | },
|
6593 | contents = config.tooltip_contents,
|
6594 | tplStr = contents.template,
|
6595 | targetIds = $$.mapToTargetIds();
|
6596 |
|
6597 | if (order === null && config.data_groups.length) {
|
6598 |
|
6599 | var ids = $$.orderTargets($$.data.targets).map(function (i2) {
|
6600 | return i2.id;
|
6601 | }).reverse();
|
6602 | d.sort(function (a, b) {
|
6603 | var v1 = a ? a.value : null,
|
6604 | v2 = b ? b.value : null;
|
6605 | return v1 > 0 && v2 > 0 && (v1 = a.id ? ids.indexOf(a.id) : null, v2 = b.id ? ids.indexOf(b.id) : null), v1 - v2;
|
6606 | });
|
6607 | } else if (/^(asc|desc)$/.test(order)) {
|
6608 | d.sort(function (a, b) {
|
6609 | var v1 = a ? getRowValue(a) : null,
|
6610 | v2 = b ? getRowValue(b) : null;
|
6611 | return order === "asc" ? v1 - v2 : v2 - v1;
|
6612 | });
|
6613 | } else isFunction(order) && d.sort(order.bind(api));
|
6614 |
|
6615 | var text,
|
6616 | row,
|
6617 | param,
|
6618 | value,
|
6619 | i,
|
6620 | tpl = $$.getTooltipContentTemplate(tplStr),
|
6621 | len = d.length;
|
6622 |
|
6623 | for (i = 0; i < len; i++) if (row = d[i], row && (getRowValue(row) || getRowValue(row) === 0)) {
|
6624 | if (isUndefined(text)) {
|
6625 | var title = (state.hasAxis || state.hasRadar) && sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
6626 | text = tplProcess(tpl[0], {
|
6627 | CLASS_TOOLTIP: config_classes.tooltip,
|
6628 | TITLE: isValue(title) ? tplStr ? title : "<tr><th colspan=\"2\">" + title + "</th></tr>" : ""
|
6629 | });
|
6630 | }
|
6631 |
|
6632 | if (!row.ratio && $$.$el.arcs && (row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path." + config_classes.arc + "-" + row.id).data()[0])), param = [row.ratio, row.id, row.index, d], value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(param))), $$.isAreaRangeType(row)) {
|
6633 | var _map2 = ["high", "low"].map(function (v) {
|
6634 | return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v)].concat(param)));
|
6635 | }),
|
6636 | high = _map2[0],
|
6637 | low = _map2[1];
|
6638 |
|
6639 | value = "<b>Mid:</b> " + value + " <b>High:</b> " + high + " <b>Low:</b> " + low;
|
6640 | } else if ($$.isCandlestickType(row)) {
|
6641 | var _map3 = ["open", "high", "low", "close", "volume"].map(function (v) {
|
6642 | return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v, "candlestick")].concat(param)));
|
6643 | }),
|
6644 | open = _map3[0],
|
6645 | _high = _map3[1],
|
6646 | _low = _map3[2],
|
6647 | close = _map3[3],
|
6648 | volume = _map3[4];
|
6649 |
|
6650 | value = "<b>Open:</b> " + open + " <b>High:</b> " + _high + " <b>Low:</b> " + _low + " <b>Close:</b> " + close + (volume ? " <b>Volume:</b> " + volume : "");
|
6651 | }
|
6652 |
|
6653 | if (value !== undefined) {
|
6654 | var _ret = function () {
|
6655 |
|
6656 | if (row.name === null) return "continue";
|
6657 | var name = sanitise(nameFormat.apply(void 0, [row.name].concat(param))),
|
6658 | color = getBgColor(row),
|
6659 | contentValue = {
|
6660 | CLASS_TOOLTIP_NAME: config_classes.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
6661 | COLOR: tplStr || !$$.patterns ? color : "<svg><rect style=\"fill:" + color + "\" width=\"10\" height=\"10\"></rect></svg>",
|
6662 | NAME: name,
|
6663 | VALUE: value
|
6664 | };
|
6665 |
|
6666 | if (tplStr && isObject(contents.text)) {
|
6667 | var index = targetIds.indexOf(row.id);
|
6668 | Object.keys(contents.text).forEach(function (key) {
|
6669 | contentValue[key] = contents.text[key][index];
|
6670 | });
|
6671 | }
|
6672 |
|
6673 | text += tplProcess(tpl[1], contentValue);
|
6674 | }();
|
6675 |
|
6676 | if (_ret === "continue") continue;
|
6677 | }
|
6678 | }
|
6679 |
|
6680 | return text + "</table>";
|
6681 | },
|
6682 |
|
6683 | |
6684 |
|
6685 |
|
6686 |
|
6687 |
|
6688 |
|
6689 | getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) {
|
6690 | 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\">" + (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(/{{(.*)}}/);
|
6691 | },
|
6692 |
|
6693 | |
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 |
|
6702 | tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) {
|
6703 | var $$ = this,
|
6704 | config = $$.config,
|
6705 | scale = $$.scale,
|
6706 | state = $$.state,
|
6707 | _state = state,
|
6708 | width = _state.width,
|
6709 | height = _state.height,
|
6710 | current = _state.current,
|
6711 | isLegendRight = _state.isLegendRight,
|
6712 | inputType = _state.inputType,
|
6713 | event = _state.event,
|
6714 | hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
6715 | svgLeft = $$.getSvgLeft(!0),
|
6716 | chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
|
6717 | chartLeft = $$.getCurrentPaddingLeft(!0),
|
6718 | size = 20,
|
6719 | _getPointer = getPointer(event, element),
|
6720 | x = _getPointer[0],
|
6721 | y = _getPointer[1];
|
6722 |
|
6723 |
|
6724 | if ($$.hasArcType()) {
|
6725 | var raw = inputType === "touch" || $$.hasType("radar");
|
6726 | raw || (y += hasGauge ? height : height / 2, x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2);
|
6727 | } else {
|
6728 | var dataScale = scale.x(dataToShow[0].x);
|
6729 | config.axis_rotated ? (y = dataScale + size, x += svgLeft + 100, chartRight -= svgLeft) : (y -= 5, x = svgLeft + chartLeft + size + ($$.zoomScale ? x : dataScale));
|
6730 | }
|
6731 |
|
6732 |
|
6733 | x + tWidth + 15 > chartRight && (x -= tWidth + chartLeft), y + tHeight > current.height && (y -= hasGauge ? tHeight * 3 : tHeight + 30);
|
6734 | var pos = {
|
6735 | top: y,
|
6736 | left: x
|
6737 | };
|
6738 |
|
6739 | return Object.keys(pos).forEach(function (v) {
|
6740 | pos[v] < 0 && (pos[v] = 0);
|
6741 | }), pos;
|
6742 | },
|
6743 |
|
6744 | |
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 | showTooltip: function showTooltip(selectedData, element) {
|
6751 | var $$ = this,
|
6752 | config = $$.config,
|
6753 | state = $$.state,
|
6754 | tooltip = $$.$el.tooltip,
|
6755 | bindto = config.tooltip_contents.bindto,
|
6756 | forArc = $$.hasArcType(null, ["radar"]),
|
6757 | dataToShow = selectedData.filter(function (d) {
|
6758 | return d && isValue($$.getBaseValue(d));
|
6759 | });
|
6760 |
|
6761 | if (tooltip && dataToShow.length !== 0 && config.tooltip_show) {
|
6762 | var datum = tooltip.datum(),
|
6763 | _ref = datum || {},
|
6764 | _ref$width = _ref.width,
|
6765 | width = _ref$width === void 0 ? 0 : _ref$width,
|
6766 | _ref$height = _ref.height,
|
6767 | height = _ref$height === void 0 ? 0 : _ref$height,
|
6768 | dataStr = JSON.stringify(selectedData);
|
6769 |
|
6770 | if (!datum || datum.current !== dataStr) {
|
6771 | var index = selectedData.concat().sort()[0].index;
|
6772 | callFn(config.tooltip_onshow, $$.api, selectedData), tooltip.html($$.getTooltipHTML(selectedData,
|
6773 | $$.axis ? $$.axis.getXAxisTickFormat() : $$.categoryName.bind($$),
|
6774 | $$.getYFormat(forArc),
|
6775 | $$.color
|
6776 | )).style("display", null).style("visibility", null)
|
6777 | .datum(datum = {
|
6778 | index: index,
|
6779 | current: dataStr,
|
6780 | width: width = tooltip.property("offsetWidth"),
|
6781 | height: height = tooltip.property("offsetHeight")
|
6782 | }), callFn(config.tooltip_onshown, $$.api, selectedData), $$._handleLinkedCharts(!0, index);
|
6783 | }
|
6784 |
|
6785 | if (!bindto) {
|
6786 | var fnPos = config.tooltip_position || $$.tooltipPosition,
|
6787 | pos = fnPos.call(this, dataToShow, width, height, element);
|
6788 |
|
6789 | ["top", "left"].forEach(function (v) {
|
6790 | var value = pos[v];
|
6791 | tooltip.style(v, value + "px"), v !== "left" || datum.xPosInPercent || (datum.xPosInPercent = value / state.current.width * 100);
|
6792 | });
|
6793 | }
|
6794 | }
|
6795 | },
|
6796 |
|
6797 | |
6798 |
|
6799 |
|
6800 |
|
6801 | bindTooltipResizePos: function bindTooltipResizePos() {
|
6802 | var $$ = this,
|
6803 | resizeFunction = $$.resizeFunction,
|
6804 | state = $$.state,
|
6805 | tooltip = $$.$el.tooltip;
|
6806 | resizeFunction.add(function () {
|
6807 | if (tooltip.style("display") === "block") {
|
6808 | var current = state.current,
|
6809 | _tooltip$datum = tooltip.datum(),
|
6810 | width = _tooltip$datum.width,
|
6811 | xPosInPercent = _tooltip$datum.xPosInPercent,
|
6812 | _value = current.width / 100 * xPosInPercent,
|
6813 | diff = current.width - (_value + width);
|
6814 |
|
6815 | diff < 0 && (_value += diff), tooltip.style("left", _value + "px");
|
6816 | }
|
6817 | });
|
6818 | },
|
6819 |
|
6820 | |
6821 |
|
6822 |
|
6823 |
|
6824 |
|
6825 | hideTooltip: function hideTooltip(force) {
|
6826 | var $$ = this,
|
6827 | api = $$.api,
|
6828 | config = $$.config,
|
6829 | tooltip = $$.$el.tooltip;
|
6830 |
|
6831 | if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
6832 | var selectedData = JSON.parse(tooltip.datum().current);
|
6833 |
|
6834 | callFn(config.tooltip_onhide, api, selectedData), tooltip.style("display", "none").style("visibility", "hidden")
|
6835 | .datum(null), callFn(config.tooltip_onhidden, api, selectedData);
|
6836 | }
|
6837 | },
|
6838 |
|
6839 | |
6840 |
|
6841 |
|
6842 |
|
6843 |
|
6844 |
|
6845 | _handleLinkedCharts: function _handleLinkedCharts(show, index) {
|
6846 | var $$ = this,
|
6847 | charts = $$.charts,
|
6848 | config = $$.config,
|
6849 | event = $$.state.event;
|
6850 |
|
6851 |
|
6852 |
|
6853 | if (event && event.isTrusted && config.tooltip_linked && charts.length > 1) {
|
6854 | var linkedName = config.tooltip_linked_name;
|
6855 | charts.filter(function (c) {
|
6856 | return c !== $$.api;
|
6857 | }).forEach(function (c) {
|
6858 | var _c$internal = c.internal,
|
6859 | config = _c$internal.config,
|
6860 | $el = _c$internal.$el,
|
6861 | isLinked = config.tooltip_linked,
|
6862 | name = config.tooltip_linked_name,
|
6863 | isInDom = browser_doc.body.contains($el.chart.node());
|
6864 |
|
6865 | if (isLinked && linkedName === name && isInDom) {
|
6866 | var data = $el.tooltip.data()[0],
|
6867 | isNotSameIndex = index !== (data && data.index);
|
6868 |
|
6869 | try {
|
6870 | c.tooltip[show && isNotSameIndex ? "show" : "hide"]({
|
6871 | index: index
|
6872 | });
|
6873 | } catch (e) {}
|
6874 | }
|
6875 | });
|
6876 | }
|
6877 | }
|
6878 | });
|
6879 | ;
|
6880 |
|
6881 |
|
6882 |
|
6883 |
|
6884 |
|
6885 |
|
6886 | var transform = ({
|
6887 | getTranslate: function getTranslate(target, index) {
|
6888 | index === void 0 && (index = 0);
|
6889 | var x,
|
6890 | y,
|
6891 | $$ = this,
|
6892 | config = $$.config,
|
6893 | state = $$.state,
|
6894 | isRotated = config.axis_rotated,
|
6895 | padding = 0;
|
6896 | if (index && /^(x|y2?)$/.test(target) && (padding = $$.getAxisSize(target) * index), target === "main") x = asHalfPixel(state.margin.left), y = asHalfPixel(state.margin.top);else if (target === "context") x = asHalfPixel(state.margin2.left), y = asHalfPixel(state.margin2.top);else if (target === "legend") x = state.margin3.left, y = state.margin3.top;else if (target === "x") x = isRotated ? -padding : 0, y = isRotated ? 0 : state.height + padding;else if (target === "y") x = isRotated ? 0 : -padding, y = isRotated ? state.height + padding : 0;else if (target === "y2") x = isRotated ? 0 : state.width + padding, y = isRotated ? 1 - padding : 0;else if (target === "subX") x = 0, y = isRotated ? 0 : state.height2;else if (target === "arc") x = state.arcWidth / 2, y = state.arcHeight / 2;else if (target === "radar") {
|
6897 | var _$$$getRadarSize = $$.getRadarSize(),
|
6898 | width = _$$$getRadarSize[0];
|
6899 |
|
6900 | x = state.width / 2 - width, y = asHalfPixel(state.margin.top);
|
6901 | }
|
6902 | return "translate(" + x + ", " + y + ")";
|
6903 | },
|
6904 | transformMain: function transformMain(withTransition, transitions) {
|
6905 | var xAxis,
|
6906 | yAxis,
|
6907 | y2Axis,
|
6908 | $$ = this,
|
6909 | main = $$.$el.main;
|
6910 | transitions && transitions.axisX ? xAxis = transitions.axisX : (xAxis = main.select("." + config_classes.axisX), withTransition && (xAxis = xAxis.transition())), transitions && transitions.axisY ? yAxis = transitions.axisY : (yAxis = main.select("." + config_classes.axisY), withTransition && (yAxis = yAxis.transition())), transitions && transitions.axisY2 ? y2Axis = transitions.axisY2 : (y2Axis = main.select("." + 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("." + config_classes.chartArcs).attr("transform", $$.getTranslate("arc"));
|
6911 | },
|
6912 | transformAll: function transformAll(withTransition, transitions) {
|
6913 | var $$ = this,
|
6914 | config = $$.config,
|
6915 | hasAxis = $$.state.hasAxis,
|
6916 | $el = $$.$el;
|
6917 | $$.transformMain(withTransition, transitions), hasAxis && config.subchart_show && $$.transformContext(withTransition, transitions), $el.legend && $$.transformLegend(withTransition);
|
6918 | }
|
6919 | });
|
6920 | ;
|
6921 |
|
6922 |
|
6923 |
|
6924 |
|
6925 |
|
6926 |
|
6927 | var type = ({
|
6928 | setTargetType: function setTargetType(targetIds, type) {
|
6929 | var $$ = this,
|
6930 | config = $$.config,
|
6931 | withoutFadeIn = $$.state.withoutFadeIn;
|
6932 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
6933 | withoutFadeIn[id] = type === config.data_types[id], config.data_types[id] = type;
|
6934 | }), targetIds || (config.data_type = type);
|
6935 | },
|
6936 |
|
6937 | |
6938 |
|
6939 |
|
6940 |
|
6941 | updateTypesElements: function updateTypesElements() {
|
6942 | var $$ = this,
|
6943 | current = $$.state.current;
|
6944 |
|
6945 | Object.keys(TYPE).forEach(function (v) {
|
6946 | var t = TYPE[v],
|
6947 | has = $$.hasType(t, null, !0),
|
6948 | idx = current.types.indexOf(t);
|
6949 | idx === -1 && has ? current.types.push(t) : idx > -1 && !has && current.types.splice(idx, 1);
|
6950 | }), $$.setChartElements();
|
6951 | },
|
6952 |
|
6953 | |
6954 |
|
6955 |
|
6956 |
|
6957 |
|
6958 |
|
6959 |
|
6960 |
|
6961 | hasType: function hasType(type, targetsValue, checkFromData) {
|
6962 | checkFromData === void 0 && (checkFromData = !1);
|
6963 | var $$ = this,
|
6964 | config = $$.config,
|
6965 | current = $$.state.current,
|
6966 | types = config.data_types,
|
6967 | targets = targetsValue || $$.data.targets,
|
6968 | has = !1;
|
6969 | return !checkFromData && current.types.length && current.types.indexOf(type) > -1 ? has = !0 : targets && targets.length ? targets.forEach(function (target) {
|
6970 | var t = types[target.id];
|
6971 | t !== type && (t || type !== "line") || (has = !0);
|
6972 | }) : Object.keys(types).length ? Object.keys(types).forEach(function (id) {
|
6973 | types[id] === type && (has = !0);
|
6974 | }) : has = config.data_type === type, has;
|
6975 | },
|
6976 |
|
6977 | |
6978 |
|
6979 |
|
6980 |
|
6981 |
|
6982 |
|
6983 |
|
6984 |
|
6985 | hasTypeOf: function hasTypeOf(type, targets, exclude) {
|
6986 | var _this = this;
|
6987 |
|
6988 | return exclude === void 0 && (exclude = []), !!(type in TYPE_BY_CATEGORY) && !TYPE_BY_CATEGORY[type].filter(function (v) {
|
6989 | return exclude.indexOf(v) === -1;
|
6990 | }).every(function (v) {
|
6991 | return !_this.hasType(v, targets);
|
6992 | });
|
6993 | },
|
6994 |
|
6995 | |
6996 |
|
6997 |
|
6998 |
|
6999 |
|
7000 |
|
7001 |
|
7002 | isTypeOf: function isTypeOf(d, type) {
|
7003 | var id = isString(d) ? d : d.id,
|
7004 | dataType = this.config.data_types[id] || this.config.data_type;
|
7005 | return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
7006 | },
|
7007 | hasPointType: function hasPointType() {
|
7008 | var $$ = this;
|
7009 | return $$.hasTypeOf("Line") || $$.hasType("bubble") || $$.hasType("scatter");
|
7010 | },
|
7011 |
|
7012 | |
7013 |
|
7014 |
|
7015 |
|
7016 |
|
7017 |
|
7018 |
|
7019 | hasArcType: function hasArcType(targets, exclude) {
|
7020 | return this.hasTypeOf("Arc", targets, exclude);
|
7021 | },
|
7022 | hasMultiArcGauge: function hasMultiArcGauge() {
|
7023 | return this.hasType("gauge") && this.config.gauge_type === "multi";
|
7024 | },
|
7025 | isLineType: function isLineType(d) {
|
7026 | var id = isString(d) ? d : d.id;
|
7027 | return !this.config.data_types[id] || this.isTypeOf(id, TYPE_BY_CATEGORY.Line);
|
7028 | },
|
7029 | isStepType: function isStepType(d) {
|
7030 | return this.isTypeOf(d, TYPE_BY_CATEGORY.Step);
|
7031 | },
|
7032 | isSplineType: function isSplineType(d) {
|
7033 | return this.isTypeOf(d, TYPE_BY_CATEGORY.Spline);
|
7034 | },
|
7035 | isAreaType: function isAreaType(d) {
|
7036 | return this.isTypeOf(d, TYPE_BY_CATEGORY.Area);
|
7037 | },
|
7038 | isAreaRangeType: function isAreaRangeType(d) {
|
7039 | return this.isTypeOf(d, TYPE_BY_CATEGORY.AreaRange);
|
7040 | },
|
7041 | isBarType: function isBarType(d) {
|
7042 | return this.isTypeOf(d, "bar");
|
7043 | },
|
7044 | isBubbleType: function isBubbleType(d) {
|
7045 | return this.isTypeOf(d, "bubble");
|
7046 | },
|
7047 | isCandlestickType: function isCandlestickType(d) {
|
7048 | return this.isTypeOf(d, "candlestick");
|
7049 | },
|
7050 | isScatterType: function isScatterType(d) {
|
7051 | return this.isTypeOf(d, "scatter");
|
7052 | },
|
7053 | isPieType: function isPieType(d) {
|
7054 | return this.isTypeOf(d, "pie");
|
7055 | },
|
7056 | isGaugeType: function isGaugeType(d) {
|
7057 | return this.isTypeOf(d, "gauge");
|
7058 | },
|
7059 | isDonutType: function isDonutType(d) {
|
7060 | return this.isTypeOf(d, "donut");
|
7061 | },
|
7062 | isRadarType: function isRadarType(d) {
|
7063 | return this.isTypeOf(d, "radar");
|
7064 | },
|
7065 | isArcType: function isArcType(d) {
|
7066 | return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
|
7067 | },
|
7068 |
|
7069 | isCirclePoint: function isCirclePoint(node) {
|
7070 | var config = this.config,
|
7071 | pattern = config.point_pattern,
|
7072 | isCircle = !1;
|
7073 | return isCircle = !!(node && node.tagName === "circle") || config.point_type === "circle" && (!pattern || isArray(pattern) && pattern.length === 0), isCircle;
|
7074 | },
|
7075 | lineData: function lineData(d) {
|
7076 | return this.isLineType(d) ? [d] : [];
|
7077 | },
|
7078 | arcData: function arcData(d) {
|
7079 | return this.isArcType(d.data) ? [d] : [];
|
7080 | },
|
7081 |
|
7082 | |
7083 |
|
7084 |
|
7085 |
|
7086 |
|
7087 |
|
7088 | labelishData: function labelishData(d) {
|
7089 | return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isCandlestickType(d) || this.isRadarType(d) ? d.values.filter(function (v) {
|
7090 | return isNumber(v.value) || !!v.value;
|
7091 | }) : [];
|
7092 | },
|
7093 | barLineBubbleData: function barLineBubbleData(d) {
|
7094 | return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
|
7095 | },
|
7096 |
|
7097 | isInterpolationType: function isInterpolationType(type) {
|
7098 | 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;
|
7099 | }
|
7100 | });
|
7101 | ;
|
7102 |
|
7103 |
|
7104 |
|
7105 |
|
7106 |
|
7107 |
|
7108 |
|
7109 |
|
7110 |
|
7111 |
|
7112 |
|
7113 |
|
7114 |
|
7115 |
|
7116 |
|
7117 |
|
7118 |
|
7119 |
|
7120 |
|
7121 |
|
7122 |
|
7123 |
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 |
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 |
|
7137 |
|
7138 |
|
7139 |
|
7140 |
|
7141 |
|
7142 |
|
7143 |
|
7144 |
|
7145 |
|
7146 |
|
7147 | var ChartInternal = function () {
|
7148 |
|
7149 |
|
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 |
|
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 |
|
7161 | function ChartInternal(api) {
|
7162 | this.api = void 0, this.config = void 0, this.cache = void 0, this.$el = void 0, this.state = void 0, this.charts = void 0, this.data = {
|
7163 | xs: {},
|
7164 | targets: []
|
7165 | }, this.axis = void 0, this.scale = {
|
7166 | x: null,
|
7167 | y: null,
|
7168 | y2: null,
|
7169 | subX: null,
|
7170 | subY: null,
|
7171 | subY2: null,
|
7172 | zoom: null
|
7173 | }, this.org = {
|
7174 | xScale: null,
|
7175 | xDomain: null
|
7176 | }, this.color = void 0, this.patterns = void 0, this.levelColor = void 0, this.point = void 0, this.brush = void 0, this.format = {
|
7177 | extraLineClasses: null,
|
7178 | xAxisTick: null,
|
7179 | dataTime: null,
|
7180 |
|
7181 | defaultAxisTime: null,
|
7182 |
|
7183 | axisTime: null
|
7184 |
|
7185 | };
|
7186 | var $$ = this;
|
7187 | $$.api = api, $$.config = new Options(), $$.cache = new Cache();
|
7188 | var store = new Store();
|
7189 | $$.$el = store.getStore("element"), $$.state = store.getStore("state");
|
7190 | }
|
7191 |
|
7192 | var _proto = ChartInternal.prototype;
|
7193 | return _proto.beforeInit = function beforeInit() {
|
7194 | var $$ = this;
|
7195 | $$.callPluginHook("$beforeInit"), callFn($$.config.onbeforeinit, $$.api);
|
7196 | }, _proto.afterInit = function afterInit() {
|
7197 | var $$ = this;
|
7198 | $$.callPluginHook("$afterInit"), callFn($$.config.onafterinit, $$.api);
|
7199 | }, _proto.init = function init() {
|
7200 | var $$ = this,
|
7201 | config = $$.config,
|
7202 | state = $$.state,
|
7203 | $el = $$.$el;
|
7204 | state.hasAxis = !$$.hasArcType(), state.hasRadar = !state.hasAxis && $$.hasType("radar"), $$.initParams();
|
7205 | var bindto = {
|
7206 | element: config.bindto,
|
7207 | classname: "bb"
|
7208 | };
|
7209 | isObject(config.bindto) && (bindto.element = config.bindto.element || "#chart", bindto.classname = config.bindto.classname || bindto.classname), $el.chart = isFunction(bindto.element.node) ? config.bindto.element : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(bindto.element || []), $el.chart.empty() && ($el.chart = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.body.appendChild(browser_doc.createElement("div")))), $el.chart.html("").classed(bindto.classname, !0), $$.initToRender();
|
7210 | }
|
7211 | |
7212 |
|
7213 |
|
7214 |
|
7215 |
|
7216 | , _proto.initToRender = function initToRender(forced) {
|
7217 | var $$ = this,
|
7218 | config = $$.config,
|
7219 | state = $$.state,
|
7220 | chart = $$.$el.chart,
|
7221 | isHidden = function () {
|
7222 | return chart.style("display") === "none" || chart.style("visibility") === "hidden";
|
7223 | },
|
7224 | isLazy = config.render.lazy || isHidden(),
|
7225 | MutationObserver = win.MutationObserver;
|
7226 |
|
7227 | if (isLazy && MutationObserver && config.render.observe !== !1 && !forced && new MutationObserver(function (mutation, observer) {
|
7228 | isHidden() || (observer.disconnect(), !state.rendered && $$.initToRender(!0));
|
7229 | }).observe(chart.node(), {
|
7230 | attributes: !0,
|
7231 | attributeFilter: ["class", "style"]
|
7232 | }), !isLazy || forced) {
|
7233 | var convertedData = $$.convertData(config, $$.initWithData);
|
7234 | convertedData && $$.initWithData(convertedData), $$.afterInit();
|
7235 | }
|
7236 | }, _proto.initParams = function initParams() {
|
7237 | var $$ = this,
|
7238 | _ref = $$,
|
7239 | config = _ref.config,
|
7240 | format = _ref.format,
|
7241 | state = _ref.state,
|
7242 | isRotated = config.axis_rotated;
|
7243 |
|
7244 | if (state.datetimeId = "bb-" + +new Date(), $$.color = $$.generateColor(), $$.levelColor = $$.generateLevelColor(), $$.hasPointType() && ($$.point = $$.generatePoint()), state.hasAxis) {
|
7245 | $$.initClip(), format.extraLineClasses = $$.generateExtraLineClass(), format.dataTime = config.data_xLocaltime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeParse : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcParse, format.axisTime = config.axis_x_localtime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeFormat : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcFormat;
|
7246 | var isDragZoom = $$.config.zoom_enabled && $$.config.zoom_type === "drag";
|
7247 |
|
7248 | format.defaultAxisTime = function (d) {
|
7249 | var _$$$scale = $$.scale,
|
7250 | x = _$$$scale.x,
|
7251 | zoom = _$$$scale.zoom,
|
7252 | isZoomed = isDragZoom ? zoom : zoom && x.orgDomain().toString() !== zoom.domain().toString(),
|
7253 | 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";
|
7254 | return format.axisTime(specifier)(d);
|
7255 | };
|
7256 | }
|
7257 |
|
7258 | state.isLegendRight = config.legend_position === "right", state.isLegendInset = config.legend_position === "inset", state.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right", state.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left", state.rotatedPaddingRight = isRotated && !config.axis_x_show ? 0 : 30, state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
|
7259 | }, _proto.initWithData = function initWithData(data) {
|
7260 | var $$ = this,
|
7261 | config = $$.config,
|
7262 | scale = $$.scale,
|
7263 | state = $$.state,
|
7264 | $el = $$.$el,
|
7265 | org = $$.org,
|
7266 | hasAxis = state.hasAxis,
|
7267 | hasInteraction = config.interaction_enabled;
|
7268 | hasAxis && ($$.axis = $$.getAxisInstance(), config.zoom_enabled && $$.initZoom()), $$.data.xs = {}, $$.data.targets = $$.convertDataToTargets(data), config.data_filter && ($$.data.targets = $$.data.targets.filter(config.data_filter.bind($$.api))), 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), $$.updateSizes(), $$.updateScales(!0);
|
7269 |
|
7270 | var x = scale.x,
|
7271 | y = scale.y,
|
7272 | y2 = scale.y2,
|
7273 | subX = scale.subX,
|
7274 | subY = scale.subY,
|
7275 | subY2 = scale.subY2;
|
7276 |
|
7277 | if (x && (x.domain(sortValue($$.getXDomain($$.data.targets))), subX.domain(x.domain()), org.xDomain = 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())), $el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block"), hasInteraction && state.inputType) {
|
7278 | var isTouch = state.inputType === "touch";
|
7279 | $el.svg.on(isTouch ? "touchstart" : "mouseenter", function () {
|
7280 | return callFn(config.onover, $$.api);
|
7281 | }).on(isTouch ? "touchend" : "mouseleave", function () {
|
7282 | return callFn(config.onout, $$.api);
|
7283 | });
|
7284 | }
|
7285 |
|
7286 | config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
7287 |
|
7288 | var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
7289 | (hasAxis || hasColorPatterns) && ($el.defs = $el.svg.append("defs"), hasAxis && ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
7290 | $$.appendClip($el.defs, state.clip[v]);
|
7291 | }), hasColorPatterns && $$.patterns.forEach(function (p) {
|
7292 | return $el.defs.append(function () {
|
7293 | return p.node;
|
7294 | });
|
7295 | })), $$.updateSvgSize(), $$.bindResize();
|
7296 |
|
7297 | var main = $el.svg.append("g").classed(config_classes.main, !0).attr("transform", $$.getTranslate("main"));
|
7298 |
|
7299 |
|
7300 | if ($el.main = main, config.subchart_show && $$.initSubchart(), config.tooltip_show && $$.initTooltip(), config.title_text && $$.initTitle(), config.legend_show && $$.initLegend(), config.data_empty_label_text && main.append("text").attr("class", config_classes.text + " " + config_classes.empty).attr("text-anchor", "middle")
|
7301 | .attr("dominant-baseline", "middle"), hasAxis && (config.regions.length && $$.initRegion(), !config.clipPath && $$.axis.init()), main.append("g").attr("class", config_classes.chart).attr("clip-path", state.clip.path), $$.callPluginHook("$init"), hasAxis && (hasInteraction && $$.initEventRect && $$.initEventRect(), $$.initGrid(), config.clipPath && $$.axis && $$.axis.init()), $$.initChartElements(), $$.updateTargets($$.data.targets), $$.updateDimension(), callFn(config.oninit, $$.api), $$.setBackground(), $$.redraw({
|
7302 | withTransition: !1,
|
7303 | withTransform: !0,
|
7304 | withUpdateXDomain: !0,
|
7305 | withUpdateOrgXDomain: !0,
|
7306 | withTransitionForAxis: !1,
|
7307 | initializing: !0
|
7308 | }), config.data_onmin || config.data_onmax) {
|
7309 | var minMax = $$.getMinMaxData();
|
7310 | callFn(config.data_onmin, $$.api, minMax.min), callFn(config.data_onmax, $$.api, minMax.max);
|
7311 | }
|
7312 |
|
7313 | config.tooltip_show && $$.initShowTooltip(), state.rendered = !0;
|
7314 | }, _proto.initChartElements = function initChartElements() {
|
7315 | var $$ = this,
|
7316 | _$$$state = $$.state,
|
7317 | hasAxis = _$$$state.hasAxis,
|
7318 | hasRadar = _$$$state.hasRadar,
|
7319 | types = [];
|
7320 | hasAxis ? ["bar", "bubble", "candlestick", "line"].forEach(function (v) {
|
7321 | var name = capitalize(v);
|
7322 | (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) && types.push(name);
|
7323 | }) : (!hasRadar && types.push("Arc", "Pie"), $$.hasType("gauge") ? types.push("Gauge") : hasRadar && types.push("Radar")), types.forEach(function (v) {
|
7324 | $$["init" + v]();
|
7325 | }), notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"]) && $$.initText();
|
7326 | }, _proto.setChartElements = function setChartElements() {
|
7327 | var $$ = this,
|
7328 | _$$$$el = $$.$el,
|
7329 | chart = _$$$$el.chart,
|
7330 | svg = _$$$$el.svg,
|
7331 | defs = _$$$$el.defs,
|
7332 | main = _$$$$el.main,
|
7333 | tooltip = _$$$$el.tooltip,
|
7334 | legend = _$$$$el.legend,
|
7335 | title = _$$$$el.title,
|
7336 | grid = _$$$$el.grid,
|
7337 | arc = _$$$$el.arcs,
|
7338 | circles = _$$$$el.circle,
|
7339 | bars = _$$$$el.bar,
|
7340 | candlestick = _$$$$el.candlestick,
|
7341 | lines = _$$$$el.line,
|
7342 | areas = _$$$$el.area,
|
7343 | texts = _$$$$el.text;
|
7344 | $$.api.$ = {
|
7345 | chart: chart,
|
7346 | svg: svg,
|
7347 | defs: defs,
|
7348 | main: main,
|
7349 | tooltip: tooltip,
|
7350 | legend: legend,
|
7351 | title: title,
|
7352 | grid: grid,
|
7353 | arc: arc,
|
7354 | circles: circles,
|
7355 | bar: {
|
7356 | bars: bars
|
7357 | },
|
7358 | candlestick: candlestick,
|
7359 | line: {
|
7360 | lines: lines,
|
7361 | areas: areas
|
7362 | },
|
7363 | text: {
|
7364 | texts: texts
|
7365 | }
|
7366 | };
|
7367 | }
|
7368 | |
7369 |
|
7370 |
|
7371 |
|
7372 | , _proto.setBackground = function setBackground() {
|
7373 | var $$ = this,
|
7374 | bg = $$.config.background,
|
7375 | state = $$.state,
|
7376 | svg = $$.$el.svg;
|
7377 |
|
7378 | if (notEmpty(bg)) {
|
7379 | var element = svg.select("g").insert(bg.imgUrl ? "image" : "rect", ":first-child");
|
7380 | bg.imgUrl ? element.attr("href", bg.imgUrl) : bg.color && element.style("fill", bg.color).attr("clip-path", state.clip.path), element.attr("class", bg.class || null).attr("width", "100%").attr("height", "100%");
|
7381 | }
|
7382 | }
|
7383 | |
7384 |
|
7385 |
|
7386 |
|
7387 |
|
7388 | , _proto.updateTargets = function updateTargets(targets) {
|
7389 | var $$ = this,
|
7390 | _$$$state2 = $$.state,
|
7391 | hasAxis = _$$$state2.hasAxis,
|
7392 | hasRadar = _$$$state2.hasRadar;
|
7393 | $$.updateTargetsForText(targets), hasAxis ? (["bar", "candlestick", "line"].forEach(function (v) {
|
7394 | var name = capitalize(v);
|
7395 | (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) && $$["updateTargetsFor" + name](targets.filter($$["is" + name + "Type"].bind($$)));
|
7396 | }), $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets)) : $$.hasArcType(targets) && (hasRadar ? $$.updateTargetsForRadar(targets.filter($$.isRadarType.bind($$))) : $$.updateTargetsForArc(targets.filter($$.isArcType.bind($$)))), ($$.hasType("bubble") || $$.hasType("scatter")) && $$.updateTargetForCircle && $$.updateTargetForCircle(), $$.showTargets();
|
7397 | }
|
7398 | |
7399 |
|
7400 |
|
7401 |
|
7402 | , _proto.showTargets = function showTargets() {
|
7403 | var $$ = this,
|
7404 | config = $$.config,
|
7405 | svg = $$.$el.svg;
|
7406 | svg.selectAll("." + config_classes.target).filter(function (d) {
|
7407 | return $$.isTargetToShow(d.id);
|
7408 | }).transition().duration(config.transition_duration).style("opacity", "1");
|
7409 | }, _proto.getWithOption = function getWithOption(options) {
|
7410 | var withOptions = {
|
7411 | Y: !0,
|
7412 | Subchart: !0,
|
7413 | Transition: !0,
|
7414 | EventRect: !0,
|
7415 | Dimension: !0,
|
7416 | TrimXDomain: !0,
|
7417 | Transform: !1,
|
7418 | UpdateXDomain: !1,
|
7419 | UpdateOrgXDomain: !1,
|
7420 | Legend: !1,
|
7421 | UpdateXAxis: "UpdateXDomain",
|
7422 | TransitionForExit: "Transition",
|
7423 | TransitionForAxis: "Transition"
|
7424 | };
|
7425 | return Object.keys(withOptions).forEach(function (key) {
|
7426 | var defVal = withOptions[key];
|
7427 | isString(defVal) && (defVal = withOptions[defVal]), withOptions[key] = getOption(options, "with" + key, defVal);
|
7428 | }), withOptions;
|
7429 | }, _proto.initialOpacity = function initialOpacity(d) {
|
7430 | var $$ = this,
|
7431 | withoutFadeIn = $$.state.withoutFadeIn;
|
7432 | return $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? "1" : "0";
|
7433 | }, _proto.bindResize = function bindResize() {
|
7434 | var $$ = this,
|
7435 | config = $$.config,
|
7436 | state = $$.state,
|
7437 | resizeFunction = generateResize(),
|
7438 | list = [];
|
7439 | list.push(function () {
|
7440 | return callFn(config.onresize, $$, $$.api);
|
7441 | }), config.resize_auto && list.push(function () {
|
7442 | state.resizing = !0, $$.api.flush(!1);
|
7443 | }), list.push(function () {
|
7444 | callFn(config.onresized, $$, $$.api), state.resizing = !1;
|
7445 | }), list.forEach(function (v) {
|
7446 | return resizeFunction.add(v);
|
7447 | }), $$.resizeFunction = resizeFunction, win.addEventListener("resize", $$.resizeFunction = resizeFunction);
|
7448 | }
|
7449 | |
7450 |
|
7451 |
|
7452 |
|
7453 |
|
7454 |
|
7455 | , _proto.callPluginHook = function callPluginHook(phase) {
|
7456 | for (var _this = this, _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
7457 |
|
7458 | this.config.plugins.forEach(function (v) {
|
7459 | phase === "$beforeInit" && (v.$$ = _this, _this.api.plugins.push(v)), v[phase].apply(v, args);
|
7460 | });
|
7461 | }, ChartInternal;
|
7462 | }();
|
7463 |
|
7464 |
|
7465 | extend(ChartInternal.prototype, [
|
7466 | convert, data_data, load, category, internals_class, internals_color, domain, interactions_interaction, format, internals_legend, redraw, scale, shape, size, internals_text, internals_title, internals_tooltip, transform, type]);
|
7467 | ;
|
7468 |
|
7469 |
|
7470 |
|
7471 |
|
7472 |
|
7473 |
|
7474 |
|
7475 |
|
7476 |
|
7477 |
|
7478 |
|
7479 | function loadConfig(config) {
|
7480 | var target,
|
7481 | keys,
|
7482 | read,
|
7483 | thisConfig = this.config,
|
7484 | find = function () {
|
7485 | var key = keys.shift();
|
7486 | return key && target && isObjectType(target) && key in target ? (target = target[key], find()) : key ? undefined : target;
|
7487 | };
|
7488 |
|
7489 | Object.keys(thisConfig).forEach(function (key) {
|
7490 | target = config, keys = key.split("_"), read = find(), isDefined(read) && (thisConfig[key] = read);
|
7491 | });
|
7492 | }
|
7493 | ;
|
7494 |
|
7495 |
|
7496 |
|
7497 |
|
7498 |
|
7499 |
|
7500 | var chart = ({
|
7501 | |
7502 |
|
7503 |
|
7504 |
|
7505 |
|
7506 |
|
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 | resize: function resize(size) {
|
7517 | var $$ = this.internal,
|
7518 | config = $$.config,
|
7519 | state = $$.state;
|
7520 | state.rendered && (config.size_width = size ? size.width : null, config.size_height = size ? size.height : null, state.resizing = !0, this.flush(!1, !0), $$.resizeFunction());
|
7521 | },
|
7522 |
|
7523 | |
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 |
|
7533 |
|
7534 |
|
7535 |
|
7536 | flush: function flush(soft) {
|
7537 | var $$ = this.internal,
|
7538 | state = $$.state;
|
7539 | state.rendered ? (state.resizing ? $$.brush && $$.brush.updateResize() : $$.axis && $$.axis.setOrient(), $$.scale.zoom = null, soft ? $$.redraw({
|
7540 | withTransform: !0,
|
7541 | withUpdateXDomain: !0,
|
7542 | withUpdateOrgXDomain: !0,
|
7543 | withLegend: !0
|
7544 | }) : $$.updateAndRedraw({
|
7545 | withLegend: !0,
|
7546 | withTransition: !1,
|
7547 | withTransitionForTransform: !1
|
7548 | }), !state.resizing && $$.brush && ($$.brush.getSelection().call($$.brush.move), $$.unselectRect())) : $$.initToRender(!0);
|
7549 | },
|
7550 |
|
7551 | |
7552 |
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 |
|
7558 |
|
7559 |
|
7560 | destroy: function destroy() {
|
7561 | var _this = this,
|
7562 | $$ = this.internal,
|
7563 | _$$$$el = $$.$el,
|
7564 | chart = _$$$$el.chart,
|
7565 | svg = _$$$$el.svg;
|
7566 |
|
7567 | if (notEmpty($$))
|
7568 | for (var _key in $$.callPluginHook("$willDestroy"), $$.charts.splice($$.charts.indexOf(this), 1), svg.select("*").interrupt(), $$.resizeFunction.clear(), win.removeEventListener("resize", $$.resizeFunction), chart.classed("bb", !1).html(""), Object.keys(this).forEach(function (key) {
|
7569 | key === "internal" && Object.keys($$).forEach(function (k) {
|
7570 | $$[k] = null;
|
7571 | }), _this[key] = null, delete _this[key];
|
7572 | }), this) this[_key] = function () {};
|
7573 | return null;
|
7574 | },
|
7575 |
|
7576 | |
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 |
|
7583 |
|
7584 |
|
7585 |
|
7586 |
|
7587 |
|
7588 |
|
7589 |
|
7590 |
|
7591 |
|
7592 |
|
7593 |
|
7594 |
|
7595 |
|
7596 | config: function (name, value, redraw) {
|
7597 | var res,
|
7598 | $$ = this.internal,
|
7599 | config = $$.config,
|
7600 | key = name && name.replace(/\./g, "_");
|
7601 | return key in config && (isDefined(value) ? (config[key] = value, res = value, redraw && this.flush()) : res = config[key]), res;
|
7602 | }
|
7603 | });
|
7604 | ;
|
7605 |
|
7606 |
|
7607 |
|
7608 |
|
7609 | var api_color = ({
|
7610 | |
7611 |
|
7612 |
|
7613 |
|
7614 |
|
7615 |
|
7616 |
|
7617 |
|
7618 |
|
7619 |
|
7620 | color: function color(id) {
|
7621 | return this.internal.color(id);
|
7622 | }
|
7623 | });
|
7624 | ;
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 |
|
7630 |
|
7631 |
|
7632 |
|
7633 |
|
7634 |
|
7635 |
|
7636 |
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 |
|
7644 |
|
7645 |
|
7646 |
|
7647 |
|
7648 |
|
7649 | function api_data_data(targetIds) {
|
7650 | var targets = this.internal.data.targets;
|
7651 |
|
7652 | if (!isUndefined(targetIds)) {
|
7653 | var ids = isArray(targetIds) ? targetIds : [targetIds];
|
7654 | return targets.filter(function (t) {
|
7655 | return ids.some(function (v) {
|
7656 | return v === t.id;
|
7657 | });
|
7658 | });
|
7659 | }
|
7660 |
|
7661 | return targets;
|
7662 | }
|
7663 |
|
7664 | extend(api_data_data, {
|
7665 | |
7666 |
|
7667 |
|
7668 |
|
7669 |
|
7670 |
|
7671 |
|
7672 |
|
7673 |
|
7674 |
|
7675 |
|
7676 |
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 |
|
7682 |
|
7683 | shown: function shown(targetIds) {
|
7684 | return this.internal.filterTargetsToShow(this.data(targetIds));
|
7685 | },
|
7686 |
|
7687 | |
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 |
|
7693 |
|
7694 |
|
7695 |
|
7696 |
|
7697 |
|
7698 |
|
7699 |
|
7700 | values: function (targetIds, flat) {
|
7701 | flat === void 0 && (flat = !0);
|
7702 | var values = null;
|
7703 |
|
7704 | if (targetIds) {
|
7705 | var targets = this.data(targetIds);
|
7706 | targets && isArray(targets) && (values = [], targets.forEach(function (v) {
|
7707 | var dataValue = v.values.map(function (d) {
|
7708 | return d.value;
|
7709 | });
|
7710 | flat ? values = values.concat(dataValue) : values.push(dataValue);
|
7711 | }));
|
7712 | }
|
7713 |
|
7714 | return values;
|
7715 | },
|
7716 |
|
7717 | |
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 |
|
7724 |
|
7725 |
|
7726 |
|
7727 |
|
7728 |
|
7729 |
|
7730 |
|
7731 |
|
7732 |
|
7733 |
|
7734 |
|
7735 | names: function names(_names) {
|
7736 | var $$ = this.internal;
|
7737 | return $$.updateDataAttributes("names", _names);
|
7738 | },
|
7739 |
|
7740 | |
7741 |
|
7742 |
|
7743 |
|
7744 |
|
7745 |
|
7746 |
|
7747 |
|
7748 |
|
7749 |
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 |
|
7758 | colors: function colors(_colors) {
|
7759 | return this.internal.updateDataAttributes("colors", _colors);
|
7760 | },
|
7761 |
|
7762 | |
7763 |
|
7764 |
|
7765 |
|
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 |
|
7776 |
|
7777 |
|
7778 |
|
7779 |
|
7780 |
|
7781 | axes: function axes(_axes) {
|
7782 | return this.internal.updateDataAttributes("axes", _axes);
|
7783 | },
|
7784 |
|
7785 | |
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 |
|
7791 |
|
7792 |
|
7793 |
|
7794 |
|
7795 |
|
7796 | min: function min() {
|
7797 | return this.internal.getMinMaxData().min;
|
7798 | },
|
7799 |
|
7800 | |
7801 |
|
7802 |
|
7803 |
|
7804 |
|
7805 |
|
7806 |
|
7807 |
|
7808 |
|
7809 |
|
7810 |
|
7811 | max: function max() {
|
7812 | return this.internal.getMinMaxData().max;
|
7813 | }
|
7814 | });
|
7815 | var api_data = ({
|
7816 | data: api_data_data
|
7817 | });
|
7818 | ;
|
7819 |
|
7820 |
|
7821 |
|
7822 |
|
7823 |
|
7824 |
|
7825 |
|
7826 |
|
7827 |
|
7828 |
|
7829 |
|
7830 |
|
7831 |
|
7832 |
|
7833 |
|
7834 | var b64EncodeUnicode = function (str) {
|
7835 | return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) {
|
7836 | return String.fromCharCode(+("0x" + p));
|
7837 | }));
|
7838 | };
|
7839 |
|
7840 |
|
7841 |
|
7842 |
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 | function nodeToSvgDataUrl(node, option, orgSize) {
|
7850 | var _ref = option || orgSize,
|
7851 | width = _ref.width,
|
7852 | height = _ref.height,
|
7853 | serializer = new XMLSerializer(),
|
7854 | clone = node.cloneNode(!0),
|
7855 | cssText = getCssRules(toArray(browser_doc.styleSheets)).filter(function (r) {
|
7856 | return r.cssText;
|
7857 | }).map(function (r) {
|
7858 | return r.cssText;
|
7859 | });
|
7860 |
|
7861 | clone.setAttribute("xmlns", external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.xhtml);
|
7862 | var nodeXml = serializer.serializeToString(clone),
|
7863 | style = browser_doc.createElement("style");
|
7864 |
|
7865 | style.appendChild(browser_doc.createTextNode(cssText.join("\n")));
|
7866 | var styleXml = serializer.serializeToString(style),
|
7867 | dataStr = ("<svg xmlns=\"" + external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg + "\" width=\"" + width + "\" height=\"" + height + "\" \n\t\tviewBox=\"0 0 " + orgSize.width + " " + orgSize.height + "\" \n\t\tpreserveAspectRatio=\"" + (option && option.preserveAspectRatio === !1 ? "none" : "xMinYMid meet") + "\">\n\t\t\t<foreignObject width=\"100%\" height=\"100%\">\n\t\t\t\t" + styleXml + "\n\t\t\t\t" + nodeXml.replace(/(url\()[^#]+/g, "$1") + "\n\t\t\t</foreignObject></svg>").replace("/\n/g", "%0A");
|
7868 |
|
7869 |
|
7870 | return "data:image/svg+xml;base64," + b64EncodeUnicode(dataStr);
|
7871 | }
|
7872 |
|
7873 | var api_export = ({
|
7874 | |
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 |
|
7881 |
|
7882 |
|
7883 |
|
7884 |
|
7885 |
|
7886 |
|
7887 |
|
7888 |
|
7889 |
|
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 |
|
7898 |
|
7899 |
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 |
|
7905 |
|
7906 |
|
7907 |
|
7908 |
|
7909 |
|
7910 |
|
7911 |
|
7912 |
|
7913 |
|
7914 |
|
7915 | export: function _export(option, callback) {
|
7916 | var _this = this,
|
7917 | $$ = this.internal,
|
7918 | state = $$.state,
|
7919 | chart = $$.$el.chart,
|
7920 | _state$current = state.current,
|
7921 | width = _state$current.width,
|
7922 | height = _state$current.height,
|
7923 | opt = mergeObj({
|
7924 | width: width,
|
7925 | height: height,
|
7926 | preserveAspectRatio: !0,
|
7927 | mimeType: "image/png"
|
7928 | }, option),
|
7929 | svgDataUrl = nodeToSvgDataUrl(chart.node(), opt, {
|
7930 | width: width,
|
7931 | height: height
|
7932 | });
|
7933 |
|
7934 | if (callback && isFunction(callback)) {
|
7935 | var img = new Image();
|
7936 | img.crossOrigin = "Anonymous", img.onload = function () {
|
7937 | var canvas = browser_doc.createElement("canvas"),
|
7938 | ctx = canvas.getContext("2d");
|
7939 | canvas.width = opt.width || width, canvas.height = opt.height || height, ctx.drawImage(img, 0, 0), callback.bind(_this)(canvas.toDataURL(opt.mimeType));
|
7940 | }, img.src = svgDataUrl;
|
7941 | }
|
7942 |
|
7943 | return svgDataUrl;
|
7944 | }
|
7945 | });
|
7946 | ;
|
7947 |
|
7948 |
|
7949 |
|
7950 |
|
7951 |
|
7952 |
|
7953 | var api_focus = ({
|
7954 | |
7955 |
|
7956 |
|
7957 |
|
7958 |
|
7959 |
|
7960 |
|
7961 |
|
7962 |
|
7963 |
|
7964 |
|
7965 |
|
7966 |
|
7967 |
|
7968 |
|
7969 |
|
7970 |
|
7971 | focus: function focus(targetIdsValue) {
|
7972 | var $$ = this.internal,
|
7973 | state = $$.state,
|
7974 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
7975 | candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
7976 | this.revert(), this.defocus(), candidates.classed(config_classes.focused, !0).classed(config_classes.defocused, !1), $$.hasArcType() && !state.hasRadar && ($$.expandArc(targetIds), $$.hasType("gauge") && $$.markOverlapped(targetIdsValue, $$, "." + config_classes.gaugeValue)), $$.toggleFocusLegend(targetIds, !0), state.focusedTargetIds = targetIds, state.defocusedTargetIds = state.defocusedTargetIds.filter(function (id) {
|
7977 | return targetIds.indexOf(id) < 0;
|
7978 | });
|
7979 | },
|
7980 |
|
7981 | |
7982 |
|
7983 |
|
7984 |
|
7985 |
|
7986 |
|
7987 |
|
7988 |
|
7989 |
|
7990 |
|
7991 |
|
7992 |
|
7993 |
|
7994 |
|
7995 |
|
7996 |
|
7997 |
|
7998 | defocus: function defocus(targetIdsValue) {
|
7999 | var $$ = this.internal,
|
8000 | state = $$.state,
|
8001 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
8002 | candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
8003 | candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !0), $$.hasArcType() && ($$.unexpandArc(targetIds), $$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + config_classes.gaugeValue)), $$.toggleFocusLegend(targetIds, !1), state.focusedTargetIds = state.focusedTargetIds.filter(function (id) {
|
8004 | return targetIds.indexOf(id) < 0;
|
8005 | }), state.defocusedTargetIds = targetIds;
|
8006 | },
|
8007 |
|
8008 | |
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 |
|
8016 |
|
8017 |
|
8018 |
|
8019 |
|
8020 |
|
8021 |
|
8022 |
|
8023 |
|
8024 |
|
8025 | revert: function revert(targetIdsValue) {
|
8026 | var $$ = this.internal,
|
8027 | config = $$.config,
|
8028 | state = $$.state,
|
8029 | $el = $$.$el,
|
8030 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
8031 | candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
8032 |
|
8033 | candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !1), $$.hasArcType() && $$.unexpandArc(targetIds), config.legend_show && ($$.showLegend(targetIds.filter($$.isLegendToShow.bind($$))), $el.legend.selectAll($$.selectorLegends(targetIds)).filter(function () {
|
8034 | return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.legendItemFocused);
|
8035 | }).classed(config_classes.legendItemFocused, !1)), state.focusedTargetIds = [], state.defocusedTargetIds = [];
|
8036 | }
|
8037 | });
|
8038 | ;
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 |
|
8045 |
|
8046 |
|
8047 |
|
8048 | var legend_legend = {
|
8049 | |
8050 |
|
8051 |
|
8052 |
|
8053 |
|
8054 |
|
8055 |
|
8056 |
|
8057 |
|
8058 |
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 | show: function show(targetIds) {
|
8069 | var $$ = this.internal;
|
8070 | $$.showLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({
|
8071 | withLegend: !0
|
8072 | });
|
8073 | },
|
8074 |
|
8075 | |
8076 |
|
8077 |
|
8078 |
|
8079 |
|
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 | hide: function hide(targetIds) {
|
8095 | var $$ = this.internal;
|
8096 | $$.hideLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({
|
8097 | withLegend: !0
|
8098 | });
|
8099 | }
|
8100 | };
|
8101 | var api_legend = ({
|
8102 | legend: legend_legend
|
8103 | });
|
8104 | ;
|
8105 |
|
8106 |
|
8107 |
|
8108 |
|
8109 |
|
8110 | var api_load = ({
|
8111 | |
8112 |
|
8113 |
|
8114 |
|
8115 |
|
8116 |
|
8117 |
|
8118 |
|
8119 |
|
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 |
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 |
|
8144 |
|
8145 |
|
8146 |
|
8147 |
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 |
|
8154 |
|
8155 |
|
8156 |
|
8157 |
|
8158 |
|
8159 |
|
8160 |
|
8161 |
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 |
|
8171 |
|
8172 |
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 |
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 |
|
8186 |
|
8187 |
|
8188 |
|
8189 |
|
8190 | load: function load(args) {
|
8191 | var $$ = this.internal,
|
8192 | config = $$.config;
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 |
|
8198 | args.xs && $$.addXs(args.xs), "names" in args && this.data.names(args.names), "classes" in args && Object.keys(args.classes).forEach(function (id) {
|
8199 | config.data_classes[id] = args.classes[id];
|
8200 | }), "categories" in args && $$.axis.isCategorized() && (config.axis_x_categories = args.categories), "axes" in args && Object.keys(args.axes).forEach(function (id) {
|
8201 | config.data_axes[id] = args.axes[id];
|
8202 | }), "colors" in args && Object.keys(args.colors).forEach(function (id) {
|
8203 | config.data_colors[id] = args.colors[id];
|
8204 | }), "unload" in args && args.unload !== !1 ? $$.unload($$.mapToTargetIds(args.unload === !0 ? null : args.unload), function () {
|
8205 | return $$.loadFromArgs(args);
|
8206 | }) : $$.loadFromArgs(args);
|
8207 | },
|
8208 |
|
8209 | |
8210 |
|
8211 |
|
8212 |
|
8213 |
|
8214 |
|
8215 |
|
8216 |
|
8217 |
|
8218 |
|
8219 |
|
8220 |
|
8221 |
|
8222 |
|
8223 |
|
8224 |
|
8225 |
|
8226 |
|
8227 |
|
8228 |
|
8229 |
|
8230 |
|
8231 |
|
8232 | unload: function unload(argsValue) {
|
8233 | var _this = this,
|
8234 | $$ = this.internal,
|
8235 | args = argsValue || {};
|
8236 |
|
8237 | isArray(args) ? args = {
|
8238 | ids: args
|
8239 | } : isString(args) && (args = {
|
8240 | ids: [args]
|
8241 | });
|
8242 | var ids = $$.mapToTargetIds(args.ids);
|
8243 | $$.unload(ids, function () {
|
8244 | $$.redraw({
|
8245 | withUpdateOrgXDomain: !0,
|
8246 | withUpdateXDomain: !0,
|
8247 | withLegend: !0
|
8248 | }), $$.cache.remove(ids), args.done && args.done.call(_this);
|
8249 | });
|
8250 | }
|
8251 | });
|
8252 | ;
|
8253 |
|
8254 |
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 |
|
8261 |
|
8262 |
|
8263 |
|
8264 |
|
8265 |
|
8266 | function showHide(show, targetIdsValue, options) {
|
8267 | var $$ = this.internal,
|
8268 | targetIds = $$.mapToTargetIds(targetIdsValue);
|
8269 | $$.state.toggling = !0, $$[(show ? "remove" : "add") + "HiddenTargetIds"](targetIds);
|
8270 | var targets = $$.$el.svg.selectAll($$.selectorTargets(targetIds)),
|
8271 | opacity = show ? "1" : "0";
|
8272 | show && targets.style("display", null), targets.transition().style("opacity", opacity, "important").call(endall, function () {
|
8273 |
|
8274 | show || targets.style("display", "none"), targets.style("opacity", opacity);
|
8275 | }), options.withLegend && $$[(show ? "show" : "hide") + "Legend"](targetIds), $$.redraw({
|
8276 | withUpdateOrgXDomain: !0,
|
8277 | withUpdateXDomain: !0,
|
8278 | withLegend: !0
|
8279 | }), $$.state.toggling = !1;
|
8280 | }
|
8281 |
|
8282 | var show = ({
|
8283 | |
8284 |
|
8285 |
|
8286 |
|
8287 |
|
8288 |
|
8289 |
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 |
|
8299 |
|
8300 |
|
8301 |
|
8302 | show: function show(targetIdsValue, options) {
|
8303 | options === void 0 && (options = {}), showHide.call(this, !0, targetIdsValue, options);
|
8304 | },
|
8305 |
|
8306 | |
8307 |
|
8308 |
|
8309 |
|
8310 |
|
8311 |
|
8312 |
|
8313 |
|
8314 |
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 |
|
8321 |
|
8322 |
|
8323 |
|
8324 |
|
8325 | hide: function hide(targetIdsValue, options) {
|
8326 | options === void 0 && (options = {}), showHide.call(this, !1, targetIdsValue, options);
|
8327 | },
|
8328 |
|
8329 | |
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 |
|
8343 |
|
8344 |
|
8345 |
|
8346 |
|
8347 |
|
8348 | toggle: function toggle(targetIds, options) {
|
8349 | var _this = this;
|
8350 |
|
8351 | options === void 0 && (options = {});
|
8352 | var $$ = this.internal,
|
8353 | targets = {
|
8354 | show: [],
|
8355 | hide: []
|
8356 | };
|
8357 |
|
8358 |
|
8359 |
|
8360 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
8361 | return targets[$$.isTargetToShow(id) ? "hide" : "show"].push(id);
|
8362 | }), targets.show.length && this.show(targets.show, options), targets.hide.length && setTimeout(function () {
|
8363 | return _this.hide(targets.hide, options);
|
8364 | }, 0);
|
8365 | }
|
8366 | });
|
8367 | ;
|
8368 |
|
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 | var tooltip_tooltip = {
|
8379 | |
8380 |
|
8381 |
|
8382 |
|
8383 |
|
8384 |
|
8385 |
|
8386 |
|
8387 |
|
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 |
|
8399 |
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 |
|
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 |
|
8423 |
|
8424 |
|
8425 |
|
8426 |
|
8427 |
|
8428 |
|
8429 | show: function show(args) {
|
8430 | var index,
|
8431 | mouse,
|
8432 | $$ = this.internal,
|
8433 | config = $$.config,
|
8434 | inputType = $$.state.inputType;
|
8435 |
|
8436 |
|
8437 | if (args.mouse && (mouse = args.mouse), args.data) {
|
8438 | var data = args.data,
|
8439 | y = $$.getYScaleById(data.id)(data.value);
|
8440 | $$.isMultipleX() ? mouse = [$$.scale.x(data.x), y] : (!config.tooltip_grouped && (mouse = [0, y]), index = isValue(data.index) ? data.index : $$.getIndexByX(data.x));
|
8441 | } else isDefined(args.x) ? index = $$.getIndexByX(args.x) : isDefined(args.index) && (index = args.index);
|
8442 |
|
8443 | (inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach(function (eventName) {
|
8444 | $$.dispatchEvent(eventName, index, mouse);
|
8445 | });
|
8446 | },
|
8447 |
|
8448 | |
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 | hide: function hide() {
|
8455 | var $$ = this.internal,
|
8456 | inputType = $$.state.inputType,
|
8457 | tooltip = $$.$el.tooltip,
|
8458 | data = tooltip && tooltip.datum();
|
8459 |
|
8460 | if (data) {
|
8461 | var index = JSON.parse(data.current)[0].index;
|
8462 |
|
8463 | (inputType === "mouse" ? ["mouseout"] : ["touchend"]).forEach(function (eventName) {
|
8464 | $$.dispatchEvent(eventName, index);
|
8465 | });
|
8466 | }
|
8467 |
|
8468 |
|
8469 | inputType === "touch" && $$.callOverOutForTouch(), $$.hideTooltip(!0), $$.hideGridFocus(), $$.unexpandCircles && $$.unexpandCircles(), $$.unexpandBars && $$.unexpandBars();
|
8470 | }
|
8471 | };
|
8472 | var api_tooltip = ({
|
8473 | tooltip: tooltip_tooltip
|
8474 | });
|
8475 | ;
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 |
|
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 |
|
8494 |
|
8495 |
|
8496 |
|
8497 |
|
8498 |
|
8499 |
|
8500 |
|
8501 |
|
8502 |
|
8503 |
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 |
|
8509 |
|
8510 |
|
8511 |
|
8512 |
|
8513 |
|
8514 |
|
8515 |
|
8516 |
|
8517 |
|
8518 |
|
8519 |
|
8520 |
|
8521 |
|
8522 |
|
8523 |
|
8524 |
|
8525 |
|
8526 |
|
8527 |
|
8528 |
|
8529 |
|
8530 |
|
8531 |
|
8532 |
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 |
|
8549 |
|
8550 |
|
8551 |
|
8552 |
|
8553 |
|
8554 | var Chart = function Chart(options) {
|
8555 | this.plugins = [], this.internal = void 0;
|
8556 | var $$ = new ChartInternal(this);
|
8557 |
|
8558 | this.internal = $$, function bindThis(fn, target, argThis) {
|
8559 | Object.keys(fn).forEach(function (key) {
|
8560 | var isFunc = isFunction(fn[key]),
|
8561 | isChild = target !== argThis,
|
8562 | hasChild = Object.keys(fn[key]).length > 0;
|
8563 | isFunc && (!isChild && hasChild || isChild) ? target[key] = fn[key].bind(argThis) : !isFunc && (target[key] = {}), hasChild && bindThis(fn[key], target[key], argThis);
|
8564 | });
|
8565 | }(Chart.prototype, this, this), loadConfig.call($$, options), $$.beforeInit(), $$.init();
|
8566 | };
|
8567 |
|
8568 |
|
8569 |
|
8570 | extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_legend, api_load, show, api_tooltip]);
|
8571 | ;
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 |
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 | function setMinMax($$, type, value) {
|
8586 | var config = $$.config,
|
8587 | axisY = "axis_y_" + type,
|
8588 | axisY2 = "axis_y2_" + type;
|
8589 | isDefined(value) && (isObjectType(value) ? (isValue(value.x) && (config["axis_x_" + type] = value.x), isValue(value.y) && (config[axisY] = value.y), isValue(value.y2) && (config[axisY2] = value.y2)) : (config[axisY] = value, config[axisY2] = value), $$.redraw({
|
8590 | withUpdateOrgXDomain: !0,
|
8591 | withUpdateXDomain: !0
|
8592 | }));
|
8593 | }
|
8594 |
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 |
|
8602 |
|
8603 | function axis_getMinMax($$, type) {
|
8604 | var config = $$.config;
|
8605 | return {
|
8606 | x: config["axis_x_" + type],
|
8607 | y: config["axis_y_" + type],
|
8608 | y2: config["axis_y2_" + type]
|
8609 | };
|
8610 | }
|
8611 |
|
8612 |
|
8613 |
|
8614 |
|
8615 |
|
8616 |
|
8617 | var axis = {
|
8618 | |
8619 |
|
8620 |
|
8621 |
|
8622 |
|
8623 |
|
8624 |
|
8625 |
|
8626 |
|
8627 |
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 |
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 | labels: function labels(_labels) {
|
8644 | var labelText,
|
8645 | $$ = this.internal;
|
8646 | return _labels && (Object.keys(_labels).forEach(function (axisId) {
|
8647 | $$.axis.setLabelText(axisId, _labels[axisId]);
|
8648 | }), $$.axis.updateLabels()), ["x", "y", "y2"].forEach(function (v) {
|
8649 | var text = $$.axis.getLabelText(v);
|
8650 | text && (!labelText && (labelText = {}), labelText[v] = text);
|
8651 | }), labelText;
|
8652 | },
|
8653 |
|
8654 | |
8655 |
|
8656 |
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 |
|
8671 | min: function min(_min) {
|
8672 | var $$ = this.internal;
|
8673 | return isValue(_min) ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
|
8674 | },
|
8675 |
|
8676 | |
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 |
|
8682 |
|
8683 |
|
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 | max: function max(_max) {
|
8694 | var $$ = this.internal;
|
8695 | return arguments.length ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
|
8696 | },
|
8697 |
|
8698 | |
8699 |
|
8700 |
|
8701 |
|
8702 |
|
8703 |
|
8704 |
|
8705 |
|
8706 |
|
8707 |
|
8708 |
|
8709 |
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 |
|
8717 |
|
8718 |
|
8719 |
|
8720 | range: function range(_range) {
|
8721 | var axis = this.axis;
|
8722 | if (arguments.length) isDefined(_range.max) && axis.max(_range.max), isDefined(_range.min) && axis.min(_range.min);else return {
|
8723 | max: axis.max(),
|
8724 | min: axis.min()
|
8725 | };
|
8726 | return undefined;
|
8727 | }
|
8728 | };
|
8729 | var api_axis = ({
|
8730 | axis: axis
|
8731 | });
|
8732 | ;
|
8733 |
|
8734 |
|
8735 |
|
8736 |
|
8737 | var api_category = ({
|
8738 | |
8739 |
|
8740 |
|
8741 |
|
8742 |
|
8743 |
|
8744 |
|
8745 |
|
8746 |
|
8747 |
|
8748 |
|
8749 | category: function category(i, _category) {
|
8750 | var $$ = this.internal,
|
8751 | config = $$.config;
|
8752 | return arguments.length > 1 && (config.axis_x_categories[i] = _category, $$.redraw()), config.axis_x_categories[i];
|
8753 | },
|
8754 |
|
8755 | |
8756 |
|
8757 |
|
8758 |
|
8759 |
|
8760 |
|
8761 |
|
8762 |
|
8763 |
|
8764 |
|
8765 |
|
8766 |
|
8767 | categories: function categories(_categories) {
|
8768 | var $$ = this.internal,
|
8769 | config = $$.config;
|
8770 | return arguments.length ? (config.axis_x_categories = _categories, $$.redraw(), config.axis_x_categories) : config.axis_x_categories;
|
8771 | }
|
8772 | });
|
8773 | ;
|
8774 |
|
8775 |
|
8776 |
|
8777 |
|
8778 |
|
8779 |
|
8780 |
|
8781 |
|
8782 |
|
8783 |
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 |
|
8789 |
|
8790 |
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 | function xgrids(grids) {
|
8796 | var $$ = this.internal,
|
8797 | config = $$.config;
|
8798 | return grids ? (config.grid_x_lines = grids, $$.redrawWithoutRescale(), config.grid_x_lines) : config.grid_x_lines;
|
8799 | }
|
8800 |
|
8801 | extend(xgrids, {
|
8802 | |
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 |
|
8808 |
|
8809 |
|
8810 |
|
8811 |
|
8812 |
|
8813 |
|
8814 |
|
8815 |
|
8816 |
|
8817 |
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 | add: function add(grids) {
|
8823 | return this.xgrids(this.internal.config.grid_x_lines.concat(grids || []));
|
8824 | },
|
8825 |
|
8826 | |
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 |
|
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 | remove: function remove(params) {
|
8846 |
|
8847 | this.internal.removeGridLines(params, !0);
|
8848 | }
|
8849 | });
|
8850 | var grid_x = ({
|
8851 | xgrids: xgrids
|
8852 | });
|
8853 | ;
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 |
|
8862 |
|
8863 |
|
8864 |
|
8865 |
|
8866 |
|
8867 |
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 |
|
8874 |
|
8875 | function ygrids(grids) {
|
8876 | var $$ = this.internal,
|
8877 | config = $$.config;
|
8878 | return grids ? (config.grid_y_lines = grids, $$.redrawWithoutRescale(), config.grid_y_lines) : config.grid_y_lines;
|
8879 | }
|
8880 |
|
8881 | extend(ygrids, {
|
8882 | |
8883 |
|
8884 |
|
8885 |
|
8886 |
|
8887 |
|
8888 |
|
8889 |
|
8890 |
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 | add: function add(grids) {
|
8903 | return this.ygrids(this.internal.config.grid_y_lines.concat(grids || []));
|
8904 | },
|
8905 |
|
8906 | |
8907 |
|
8908 |
|
8909 |
|
8910 |
|
8911 |
|
8912 |
|
8913 |
|
8914 |
|
8915 |
|
8916 |
|
8917 |
|
8918 |
|
8919 |
|
8920 |
|
8921 |
|
8922 |
|
8923 |
|
8924 |
|
8925 |
|
8926 |
|
8927 | remove: function remove(params) {
|
8928 |
|
8929 | this.internal.removeGridLines(params, !1);
|
8930 | }
|
8931 | });
|
8932 | var grid_y = ({
|
8933 | ygrids: ygrids
|
8934 | });
|
8935 | ;
|
8936 |
|
8937 |
|
8938 |
|
8939 |
|
8940 |
|
8941 | var group = ({
|
8942 | |
8943 |
|
8944 |
|
8945 |
|
8946 |
|
8947 |
|
8948 |
|
8949 |
|
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 |
|
8955 | groups: function groups(_groups) {
|
8956 | var $$ = this.internal,
|
8957 | config = $$.config;
|
8958 | return isUndefined(_groups) ? config.data_groups : (config.data_groups = _groups, $$.redraw(), config.data_groups);
|
8959 | }
|
8960 | });
|
8961 | ;
|
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 |
|
8983 | function regions(regions) {
|
8984 | var $$ = this.internal,
|
8985 | config = $$.config;
|
8986 | return regions ? (config.regions = regions, $$.redrawWithoutRescale(), regions) : config.regions;
|
8987 | }
|
8988 |
|
8989 | extend(regions, {
|
8990 | |
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 |
|
8999 |
|
9000 |
|
9001 |
|
9002 |
|
9003 |
|
9004 |
|
9005 |
|
9006 |
|
9007 |
|
9008 |
|
9009 |
|
9010 | add: function add(regions) {
|
9011 | var $$ = this.internal,
|
9012 | config = $$.config;
|
9013 | return regions ? (config.regions = config.regions.concat(regions), $$.redrawWithoutRescale(), config.regions) : config.regions;
|
9014 | },
|
9015 |
|
9016 | |
9017 |
|
9018 |
|
9019 |
|
9020 |
|
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 |
|
9033 |
|
9034 |
|
9035 | remove: function remove(optionsValue) {
|
9036 | var $$ = this.internal,
|
9037 | config = $$.config,
|
9038 | options = optionsValue || {},
|
9039 | duration = getOption(options, "duration", config.transition_duration),
|
9040 | classes = getOption(options, "classes", [config_classes.region]),
|
9041 | regions = $$.$el.main.select("." + config_classes.regions).selectAll(classes.map(function (c) {
|
9042 | return "." + c;
|
9043 | }));
|
9044 | return (duration ? regions.transition().duration(duration) : regions).style("opacity", "0").remove(), regions = config.regions, Object.keys(options).length ? (regions = regions.filter(function (region) {
|
9045 | var found = !1;
|
9046 | return !region.class || (region.class.split(" ").forEach(function (c) {
|
9047 | classes.indexOf(c) >= 0 && (found = !0);
|
9048 | }), !found);
|
9049 | }), config.regions = regions) : config.regions = [], regions;
|
9050 | }
|
9051 | });
|
9052 | var api_regions = ({
|
9053 | regions: regions
|
9054 | });
|
9055 | ;
|
9056 |
|
9057 |
|
9058 |
|
9059 |
|
9060 |
|
9061 | var x = ({
|
9062 | |
9063 |
|
9064 |
|
9065 |
|
9066 |
|
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 |
|
9076 | x: function x(_x) {
|
9077 | var $$ = this.internal,
|
9078 | axis = $$.axis,
|
9079 | data = $$.data,
|
9080 | isCategorized = axis.isCustomX() && axis.isCategorized();
|
9081 | return isArray(_x) && (isCategorized ? this.categories(_x) : ($$.updateTargetX(data.targets, _x), $$.redraw({
|
9082 | withUpdateOrgXDomain: !0,
|
9083 | withUpdateXDomain: !0
|
9084 | }))), isCategorized ? this.categories() : data.xs;
|
9085 | },
|
9086 |
|
9087 | |
9088 |
|
9089 |
|
9090 |
|
9091 |
|
9092 |
|
9093 |
|
9094 |
|
9095 |
|
9096 |
|
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 | xs: function xs(_xs) {
|
9105 | var $$ = this.internal;
|
9106 | return isObject(_xs) && ($$.updateTargetXs($$.data.targets, _xs), $$.redraw({
|
9107 | withUpdateOrgXDomain: !0,
|
9108 | withUpdateXDomain: !0
|
9109 | })), $$.data.xs;
|
9110 | }
|
9111 | });
|
9112 | ;
|
9113 |
|
9114 |
|
9115 |
|
9116 |
|
9117 |
|
9118 | var flow = ({
|
9119 | |
9120 |
|
9121 |
|
9122 |
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 |
|
9128 |
|
9129 |
|
9130 |
|
9131 |
|
9132 |
|
9133 |
|
9134 |
|
9135 |
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 |
|
9143 |
|
9144 |
|
9145 |
|
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 |
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 |
|
9167 |
|
9168 | flow: function flow(args) {
|
9169 | var data,
|
9170 | domain,
|
9171 | diff,
|
9172 | to,
|
9173 | $$ = this.internal,
|
9174 | length = 0,
|
9175 | tail = 0;
|
9176 |
|
9177 | if ((args.json || args.rows || args.columns) && (data = $$.convertData(args)), data && isTabVisible()) {
|
9178 | var notfoundIds = [],
|
9179 | orgDataCount = $$.getMaxDataCount(),
|
9180 | targets = $$.convertDataToTargets(data, !0),
|
9181 | isTimeSeries = $$.axis.isTimeSeries();
|
9182 | $$.data.targets.forEach(function (t) {
|
9183 | for (var found = !1, i = 0; i < targets.length; i++) if (t.id === targets[i].id) {
|
9184 | found = !0, t.values[t.values.length - 1] && (tail = t.values[t.values.length - 1].index + 1), length = targets[i].values.length;
|
9185 |
|
9186 | for (var _j3 = 0; _j3 < length; _j3++) targets[i].values[_j3].index = tail + _j3, isTimeSeries || (targets[i].values[_j3].x = tail + _j3);
|
9187 |
|
9188 | t.values = t.values.concat(targets[i].values), targets.splice(i, 1);
|
9189 | break;
|
9190 | }
|
9191 |
|
9192 | found || notfoundIds.push(t.id);
|
9193 | }), $$.data.targets.forEach(function (t) {
|
9194 | for (var _i = 0; _i < notfoundIds.length; _i++) if (t.id === notfoundIds[_i]) {
|
9195 | tail = t.values[t.values.length - 1].index + 1;
|
9196 |
|
9197 | for (var _j4 = 0; _j4 < length; _j4++) t.values.push({
|
9198 | id: t.id,
|
9199 | index: tail + _j4,
|
9200 | x: isTimeSeries ? $$.getOtherTargetX(tail + _j4) : tail + _j4,
|
9201 | value: null
|
9202 | });
|
9203 | }
|
9204 | }), $$.data.targets.length && targets.forEach(function (t) {
|
9205 | for (var missing = [], i = $$.data.targets[0].values[0].index; i < tail; i++) missing.push({
|
9206 | id: t.id,
|
9207 | index: i,
|
9208 | x: isTimeSeries ? $$.getOtherTargetX(i) : i,
|
9209 | value: null
|
9210 | });
|
9211 |
|
9212 | t.values.forEach(function (v) {
|
9213 | v.index += tail, isTimeSeries || (v.x += tail);
|
9214 | }), t.values = missing.concat(t.values);
|
9215 | }), $$.data.targets = $$.data.targets.concat(targets);
|
9216 |
|
9217 |
|
9218 |
|
9219 | var baseTarget = $$.data.targets[0],
|
9220 | baseValue = baseTarget.values[0];
|
9221 | isDefined(args.to) ? (length = 0, to = isTimeSeries ? parseDate.call($$, args.to) : args.to, baseTarget.values.forEach(function (v) {
|
9222 | v.x < to && length++;
|
9223 | })) : 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({
|
9224 | flow: {
|
9225 | index: baseValue.index,
|
9226 | length: length,
|
9227 | duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,
|
9228 | done: args.done,
|
9229 | orgDataCount: orgDataCount
|
9230 | },
|
9231 | withLegend: !0,
|
9232 | withTransition: orgDataCount > 1,
|
9233 | withTrimXDomain: !1,
|
9234 | withUpdateXAxis: !0
|
9235 | });
|
9236 | }
|
9237 | }
|
9238 | });
|
9239 |
|
9240 | var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(10);
|
9241 | ;
|
9242 |
|
9243 |
|
9244 |
|
9245 |
|
9246 |
|
9247 |
|
9248 |
|
9249 |
|
9250 | var AxisRendererHelper = function () {
|
9251 | function AxisRendererHelper(owner) {
|
9252 | this.owner = void 0, this.config = void 0, this.scale = void 0;
|
9253 | var scale = getScale(),
|
9254 | config = owner.config,
|
9255 | params = owner.params;
|
9256 | this.owner = owner, this.config = config, this.scale = scale, (config.noTransition || !params.config.transition_duration) && (config.withoutTransition = !0), config.range = this.scaleExtent((params.orgXScale || scale).range());
|
9257 | }
|
9258 | |
9259 |
|
9260 |
|
9261 |
|
9262 |
|
9263 |
|
9264 |
|
9265 |
|
9266 | AxisRendererHelper.getSizeFor1Char = function getSizeFor1Char(node) {
|
9267 |
|
9268 | var size = {
|
9269 | w: 5.5,
|
9270 | h: 11.5
|
9271 | };
|
9272 | return node.empty() || node.select("text").text("0").call(function (el) {
|
9273 | try {
|
9274 | var _el$node$getBBox = el.node().getBBox(),
|
9275 | width = _el$node$getBBox.width,
|
9276 | height = _el$node$getBBox.height;
|
9277 |
|
9278 | width && height && (size.w = width, size.h = height);
|
9279 | } catch (e) {} finally {
|
9280 | el.text("");
|
9281 | }
|
9282 | }), this.getSizeFor1Char = function () {
|
9283 | return size;
|
9284 | }, size;
|
9285 | }
|
9286 | |
9287 |
|
9288 |
|
9289 |
|
9290 |
|
9291 |
|
9292 | ;
|
9293 |
|
9294 | var _proto = AxisRendererHelper.prototype;
|
9295 | return _proto.getTickTransformSetter = function getTickTransformSetter(id) {
|
9296 | var config = this.config,
|
9297 | fn = id === "x" ? function (value) {
|
9298 | return "translate(" + (value + config.tickOffset) + ",0)";
|
9299 | } : function (value) {
|
9300 | return "translate(0," + value + ")";
|
9301 | };
|
9302 | return function (selection, scale) {
|
9303 | selection.attr("transform", function (d) {
|
9304 | return fn(Math.ceil(scale(d)));
|
9305 | });
|
9306 | };
|
9307 | }, _proto.scaleExtent = function scaleExtent(domain) {
|
9308 | var start = domain[0],
|
9309 | stop = domain[domain.length - 1];
|
9310 | return start < stop ? [start, stop] : [stop, start];
|
9311 | }, _proto.generateTicks = function generateTicks(scale, isYAxes) {
|
9312 | var tickStepSize = this.owner.params.tickStepSize,
|
9313 | _scale$domain = scale.domain(),
|
9314 | start = _scale$domain[0],
|
9315 | end = _scale$domain[1],
|
9316 | ticks = [];
|
9317 |
|
9318 |
|
9319 | if (isYAxes && tickStepSize) for (var interval = start; interval <= end;) ticks.push(interval), interval += tickStepSize;else if (scale.ticks) {
|
9320 | var tickArguments = this.config.tickArguments;
|
9321 |
|
9322 | if (scale.type === "log" && !tickArguments) {
|
9323 |
|
9324 |
|
9325 | var s = getScale("_log").domain([start > 0 ? start : 1, end]).range(scale.range());
|
9326 | ticks = s.ticks();
|
9327 |
|
9328 | for (var cnt = end.toFixed().length; ticks.length > 15; cnt--) ticks = s.ticks(cnt);
|
9329 |
|
9330 | ticks.splice(0, 1, start), ticks.splice(ticks.length - 1, 1, end);
|
9331 | } else ticks = scale.ticks.apply(scale, this.config.tickArguments || []);
|
9332 |
|
9333 | ticks = ticks.map(function (v) {
|
9334 |
|
9335 | var r = isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v;
|
9336 | return r;
|
9337 | });
|
9338 | } else {
|
9339 | for (var i = Math.ceil(start); i < end; i++) ticks.push(i);
|
9340 |
|
9341 | ticks.length > 0 && ticks[0] > 0 && ticks.unshift(ticks[0] - (ticks[1] - ticks[0]));
|
9342 | }
|
9343 | return ticks;
|
9344 | }, _proto.copyScale = function copyScale() {
|
9345 | var newScale = this.scale.copy();
|
9346 | return newScale.domain().length || newScale.domain(this.scale.domain()), newScale.type = this.scale.type, newScale;
|
9347 | }, _proto.textFormatted = function textFormatted(v) {
|
9348 | var tickFormat = this.config.tickFormat,
|
9349 | value = /\d+\.\d+0{5,}\d$/.test(v) ? +(v + "").replace(/0+\d$/, "") : v,
|
9350 | formatted = tickFormat ? tickFormat(value) : value;
|
9351 |
|
9352 |
|
9353 |
|
9354 | return isDefined(formatted) ? formatted : "";
|
9355 | }, _proto.transitionise = function transitionise(selection) {
|
9356 | var config = this.config;
|
9357 | return config.withoutTransition ? selection.interrupt() : selection.transition(config.transition);
|
9358 | }, AxisRendererHelper;
|
9359 | }();
|
9360 |
|
9361 |
|
9362 | ;
|
9363 |
|
9364 |
|
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 | var AxisRenderer = function () {
|
9373 | function AxisRenderer(params) {
|
9374 | params === void 0 && (params = {}), this.helper = void 0, this.config = void 0, this.params = void 0, this.g = void 0;
|
9375 | var config = {
|
9376 | innerTickSize: 6,
|
9377 | outerTickSize: params.outerTick ? 6 : 0,
|
9378 | orient: "bottom",
|
9379 | range: [],
|
9380 | tickArguments: null,
|
9381 | tickCentered: null,
|
9382 | tickCulling: !0,
|
9383 | tickFormat: null,
|
9384 | tickLength: 9,
|
9385 | tickOffset: 0,
|
9386 | tickPadding: 3,
|
9387 | tickValues: null,
|
9388 | transition: null,
|
9389 | noTransition: params.noTransition
|
9390 | };
|
9391 | config.tickLength = Math.max(config.innerTickSize, 0) + config.tickPadding, this.config = config, this.params = params, this.helper = new AxisRendererHelper(this);
|
9392 | }
|
9393 | |
9394 |
|
9395 |
|
9396 |
|
9397 |
|
9398 |
|
9399 |
|
9400 | var _proto = AxisRenderer.prototype;
|
9401 | return _proto.create = function create(g) {
|
9402 | var ctx = this,
|
9403 | config = this.config,
|
9404 | helper = this.helper,
|
9405 | params = this.params,
|
9406 | scale = helper.scale,
|
9407 | orient = config.orient,
|
9408 | splitTickText = this.splitTickText.bind(this),
|
9409 | isLeftRight = /^(left|right)$/.test(orient),
|
9410 | isTopBottom = /^(top|bottom)$/.test(orient),
|
9411 | tickTransform = helper.getTickTransformSetter(isTopBottom ? "x" : "y"),
|
9412 | axisPx = tickTransform === helper.axisX ? "y" : "x",
|
9413 | sign = /^(top|left)$/.test(orient) ? -1 : 1,
|
9414 | rotate = params.tickTextRotate;
|
9415 | this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range());
|
9416 | var $g,
|
9417 | _config2 = config,
|
9418 | innerTickSize = _config2.innerTickSize,
|
9419 | tickLength = _config2.tickLength,
|
9420 | range = _config2.range,
|
9421 | id = params.id,
|
9422 | tickTextPos = id && /^(x|y|y2)$/.test(id) ? params.config["axis_" + id + "_tick_text_position"] : {
|
9423 | x: 0,
|
9424 | y: 0
|
9425 | },
|
9426 | prefix = id === "subX" ? "subchart_axis_x" : "axis_" + id,
|
9427 | axisShow = params.config[prefix + "_show"],
|
9428 | tickShow = {
|
9429 | tick: !!axisShow && params.config[prefix + "_tick_show"],
|
9430 | text: !!axisShow && params.config[prefix + "_tick_text_show"]
|
9431 | };
|
9432 |
|
9433 | g.each(function () {
|
9434 | var g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
9435 | scale0 = this.__chart__ || scale,
|
9436 | scale1 = helper.copyScale();
|
9437 | $g = g, this.__chart__ = scale1, config.tickOffset = params.isCategory ? Math.ceil((scale1(1) - scale1(0)) / 2) : 0;
|
9438 |
|
9439 | var path = g.selectAll(".domain").data([0]);
|
9440 |
|
9441 | if (path.enter().append("path").attr("class", "domain")
|
9442 | .merge(helper.transitionise(path).selection()).attr("d", function () {
|
9443 | var outerTickSized = config.outerTickSize * sign;
|
9444 | return isTopBottom ? "M" + range[0] + "," + outerTickSized + "V0H" + range[1] + "V" + outerTickSized : "M" + outerTickSized + "," + range[0] + "H0V" + range[1] + "H" + outerTickSized;
|
9445 | }), tickShow.tick || tickShow.text) {
|
9446 |
|
9447 | var ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight),
|
9448 | tick = g.selectAll(".tick").data(ticks, scale1),
|
9449 | tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", "1"),
|
9450 | tickExit = tick.exit().remove();
|
9451 |
|
9452 | tick = tickEnter.merge(tick), tickShow.tick && tickEnter.append("line"), tickShow.text && tickEnter.append("text");
|
9453 | var sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tick),
|
9454 | counts = [],
|
9455 | tspan = tick.select("text").selectAll("tspan").data(function (d, index) {
|
9456 | var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)];
|
9457 | return counts[index] = split.length, split.map(function (splitted) {
|
9458 | return {
|
9459 | index: index,
|
9460 | splitted: splitted
|
9461 | };
|
9462 | });
|
9463 | });
|
9464 | tspan.exit().remove(), tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) {
|
9465 | return d.splitted;
|
9466 | }), tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", function () {
|
9467 | var dx = 0;
|
9468 | return /(top|bottom)/.test(orient) && rotate && (dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1)), dx + (tickTextPos.x || 0);
|
9469 | }()).attr("dy", function (d, i) {
|
9470 | var dy = 0;
|
9471 | 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";
|
9472 | });
|
9473 | var lineUpdate = tick.select("line"),
|
9474 | textUpdate = tick.select("text");
|
9475 |
|
9476 |
|
9477 | if (tickEnter.select("line").attr(axisPx + "2", innerTickSize * sign), tickEnter.select("text").attr(axisPx, tickLength * sign), ctx.setTickLineTextPosition(lineUpdate, textUpdate), params.tickTitle) {
|
9478 | var title = textUpdate.select("title");
|
9479 | (title.empty() ? textUpdate.append("title") : title).text(function (index) {
|
9480 | return params.tickTitle[index];
|
9481 | });
|
9482 | }
|
9483 |
|
9484 | if (scale1.bandwidth) {
|
9485 | var x = scale1,
|
9486 | dx = x.bandwidth() / 2;
|
9487 | scale0 = function (d) {
|
9488 | return x(d) + dx;
|
9489 | }, scale1 = scale0;
|
9490 | } else scale0.bandwidth ? scale0 = scale1 : tickTransform(tickExit, scale1);
|
9491 |
|
9492 | tickTransform(tickEnter, scale0), tickTransform(helper.transitionise(tick).style("opacity", "1"), scale1);
|
9493 | }
|
9494 | }), this.g = $g;
|
9495 | }
|
9496 | |
9497 |
|
9498 |
|
9499 |
|
9500 |
|
9501 | , _proto.getTickXY = function getTickXY() {
|
9502 | var config = this.config,
|
9503 | pos = {
|
9504 | x: 0,
|
9505 | y: 0
|
9506 | };
|
9507 | return this.params.isCategory && (pos.x = config.tickCentered ? 0 : config.tickOffset, pos.y = config.tickCentered ? config.tickOffset : 0), pos;
|
9508 | }
|
9509 | |
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 |
|
9515 | , _proto.getTickSize = function getTickSize(d) {
|
9516 | var scale = this.helper.scale,
|
9517 | config = this.config,
|
9518 | _config3 = config,
|
9519 | innerTickSize = _config3.innerTickSize,
|
9520 | range = _config3.range,
|
9521 | tickPosition = scale(d) + (config.tickCentered ? 0 : config.tickOffset);
|
9522 | return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;
|
9523 | }
|
9524 | |
9525 |
|
9526 |
|
9527 |
|
9528 |
|
9529 |
|
9530 | , _proto.setTickLineTextPosition = function setTickLineTextPosition(lineUpdate, textUpdate) {
|
9531 | var tickPos = this.getTickXY(),
|
9532 | _this$config = this.config,
|
9533 | innerTickSize = _this$config.innerTickSize,
|
9534 | orient = _this$config.orient,
|
9535 | tickLength = _this$config.tickLength,
|
9536 | tickOffset = _this$config.tickOffset,
|
9537 | rotate = this.params.tickTextRotate,
|
9538 | textAnchorForText = function (r) {
|
9539 | var value = ["start", "end"];
|
9540 | return orient === "top" && value.reverse(), r ? r > 0 ? value[0] : value[1] : "middle";
|
9541 | },
|
9542 | textTransform = function (r) {
|
9543 | return r ? "rotate(" + r + ")" : null;
|
9544 | },
|
9545 | yForText = function (r) {
|
9546 | var r2 = r / (orient === "bottom" ? 15 : 23);
|
9547 | return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
|
9548 | };
|
9549 |
|
9550 | orient === "bottom" ? (lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", this.getTickSize.bind(this)), textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).attr("transform", textTransform(rotate))) : orient === "top" ? (lineUpdate.attr("x2", 0).attr("y2", -innerTickSize), textUpdate.attr("x", 0).attr("y", -yForText(rotate) * 2).style("text-anchor", textAnchorForText(rotate)).attr("transform", textTransform(rotate))) : 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;
|
9551 | }
|
9552 | , _proto.splitTickText = function splitTickText(d, scale, ticks, isLeftRight, charWidth) {
|
9553 |
|
9554 |
|
9555 | function split(splitted, text) {
|
9556 | for (var subtext, spaceIndex, textWidth, i = 1; i < text.length; i++)
|
9557 | 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));
|
9558 |
|
9559 | return splitted.concat(text);
|
9560 | }
|
9561 |
|
9562 | var params = this.params,
|
9563 | tickText = this.helper.textFormatted(d),
|
9564 | splitted = isString(tickText) && tickText.indexOf("\n") > -1 ? tickText.split("\n") : [];
|
9565 | if (splitted.length) return splitted;
|
9566 | if (isArray(tickText)) return tickText;
|
9567 | var tickWidth = params.tickWidth;
|
9568 | return (!tickWidth || tickWidth <= 0) && (tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110), split(splitted, tickText + "");
|
9569 | }, _proto.scale = function scale(x) {
|
9570 | return arguments.length ? (this.helper.scale = x, this) : this.helper.scale;
|
9571 | }, _proto.orient = function orient(x) {
|
9572 | return arguments.length ? (this.config.orient = x in {
|
9573 | top: 1,
|
9574 | right: 1,
|
9575 | bottom: 1,
|
9576 | left: 1
|
9577 | } ? x + "" : "bottom", this) : this.config.orient;
|
9578 | }, _proto.tickFormat = function tickFormat(format) {
|
9579 | var config = this.config;
|
9580 | return arguments.length ? (config.tickFormat = format, this) : config.tickFormat;
|
9581 | }, _proto.tickCentered = function tickCentered(isCentered) {
|
9582 | var config = this.config;
|
9583 | return arguments.length ? (config.tickCentered = isCentered, this) : config.tickCentered;
|
9584 | }
|
9585 | |
9586 |
|
9587 |
|
9588 |
|
9589 |
|
9590 |
|
9591 | , _proto.tickOffset = function tickOffset() {
|
9592 | return this.config.tickOffset;
|
9593 | }
|
9594 | |
9595 |
|
9596 |
|
9597 |
|
9598 |
|
9599 |
|
9600 | , _proto.tickInterval = function tickInterval(size) {
|
9601 | var interval,
|
9602 | _this = this;
|
9603 |
|
9604 | if (this.params.isCategory) interval = this.config.tickOffset * 2;else {
|
9605 | var length = this.g.select("path.domain").node().getTotalLength() - this.config.outerTickSize * 2;
|
9606 | interval = length / (size || this.g.selectAll("line").size());
|
9607 |
|
9608 | var intervalByValue = this.config.tickValues.map(function (v, i, arr) {
|
9609 | var next = i + 1;
|
9610 | return next < arr.length ? _this.helper.scale(arr[next]) - _this.helper.scale(v) : null;
|
9611 | }).filter(Boolean);
|
9612 | interval = Math.min.apply(Math, intervalByValue.concat([interval]));
|
9613 | }
|
9614 | return interval === Infinity ? 0 : interval;
|
9615 | }, _proto.ticks = function ticks() {
|
9616 | for (var config = this.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
9617 |
|
9618 | return args.length ? (config.tickArguments = toArray(args), this) : config.tickArguments;
|
9619 | }, _proto.tickCulling = function tickCulling(culling) {
|
9620 | var config = this.config;
|
9621 | return arguments.length ? (config.tickCulling = culling, this) : config.tickCulling;
|
9622 | }, _proto.tickValues = function tickValues(x) {
|
9623 | var _this2 = this,
|
9624 | config = this.config;
|
9625 |
|
9626 | if (isFunction(x)) config.tickValues = function () {
|
9627 | return x(_this2.helper.scale.domain());
|
9628 | };else {
|
9629 | if (!arguments.length) return config.tickValues;
|
9630 | config.tickValues = x;
|
9631 | }
|
9632 | return this;
|
9633 | }, _proto.setTransition = function setTransition(t) {
|
9634 | return this.config.transition = t, this;
|
9635 | }, AxisRenderer;
|
9636 | }();
|
9637 |
|
9638 |
|
9639 | ;
|
9640 |
|
9641 |
|
9642 |
|
9643 |
|
9644 |
|
9645 |
|
9646 |
|
9647 |
|
9648 |
|
9649 | var Axis = ({
|
9650 | getAxisInstance: function getAxisInstance() {
|
9651 | return this.axis || new Axis_Axis(this);
|
9652 | }
|
9653 | });
|
9654 |
|
9655 | var Axis_Axis = function () {
|
9656 | function Axis(owner) {
|
9657 | this.owner = void 0, this.x = void 0, this.subX = void 0, this.y = void 0, this.y2 = void 0, this.axesList = {}, this.tick = {
|
9658 | x: null,
|
9659 | y: null,
|
9660 | y2: null
|
9661 | }, this.xs = [], this.orient = {
|
9662 | x: "bottom",
|
9663 | y: "left",
|
9664 | y2: "right",
|
9665 | subX: "bottom"
|
9666 | }, this.owner = owner, this.setOrient();
|
9667 | }
|
9668 |
|
9669 | var _proto = Axis.prototype;
|
9670 | return _proto.getAxisClassName = function getAxisClassName(id) {
|
9671 | return config_classes.axis + " " + config_classes["axis" + capitalize(id)];
|
9672 | }, _proto.isHorizontal = function isHorizontal($$, forHorizontal) {
|
9673 | var isRotated = $$.config.axis_rotated;
|
9674 | return forHorizontal ? isRotated : !isRotated;
|
9675 | }, _proto.isCategorized = function isCategorized() {
|
9676 | var _this$owner = this.owner,
|
9677 | config = _this$owner.config,
|
9678 | state = _this$owner.state;
|
9679 | return config.axis_x_type.indexOf("category") >= 0 || state.hasRadar;
|
9680 | }, _proto.isCustomX = function isCustomX() {
|
9681 | var config = this.owner.config;
|
9682 | return !this.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));
|
9683 | }, _proto.isTimeSeries = function isTimeSeries(id) {
|
9684 | return id === void 0 && (id = "x"), this.owner.config["axis_" + id + "_type"] === "timeseries";
|
9685 | }, _proto.isLog = function isLog(id) {
|
9686 | return id === void 0 && (id = "x"), this.owner.config["axis_" + id + "_type"] === "log";
|
9687 | }, _proto.isTimeSeriesY = function isTimeSeriesY() {
|
9688 | return this.isTimeSeries("y");
|
9689 | }, _proto.getAxisType = function getAxisType(id) {
|
9690 | id === void 0 && (id = "x");
|
9691 | var type = "linear";
|
9692 | return this.isTimeSeries(id) ? type = "time" : this.isLog(id) && (type = "log"), type;
|
9693 | }, _proto.init = function init() {
|
9694 | var _this = this,
|
9695 | $$ = this.owner,
|
9696 | config = $$.config,
|
9697 | _$$$$el = $$.$el,
|
9698 | main = _$$$$el.main,
|
9699 | axis = _$$$$el.axis,
|
9700 | clip = $$.state.clip,
|
9701 | isRotated = config.axis_rotated,
|
9702 | target = ["x", "y"];
|
9703 |
|
9704 | config.axis_y2_show && target.push("y2"), target.forEach(function (v) {
|
9705 | var classAxis = _this.getAxisClassName(v),
|
9706 | classLabel = config_classes["axis" + v.toUpperCase() + "Label"];
|
9707 |
|
9708 | axis[v] = main.append("g").attr("class", classAxis).attr("clip-path", function () {
|
9709 | var res = null;
|
9710 | return v === "x" ? res = clip.pathXAxis : v === "y" && (res = clip.pathYAxis), res;
|
9711 | }).attr("transform", $$.getTranslate(v)).style("visibility", config["axis_" + v + "_show"] ? "visible" : "hidden"), axis[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", function () {
|
9712 | return _this.textAnchorForAxisLabel(v);
|
9713 | }), _this.generateAxes(v);
|
9714 | });
|
9715 | }
|
9716 | |
9717 |
|
9718 |
|
9719 |
|
9720 | , _proto.setOrient = function setOrient() {
|
9721 | var $$ = this.owner,
|
9722 | _$$$config = $$.config,
|
9723 | isRotated = _$$$config.axis_rotated,
|
9724 | yInner = _$$$config.axis_y_inner,
|
9725 | y2Inner = _$$$config.axis_y2_inner;
|
9726 | this.orient = {
|
9727 | x: isRotated ? "left" : "bottom",
|
9728 | y: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
|
9729 | y2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right",
|
9730 | subX: isRotated ? "left" : "bottom"
|
9731 | };
|
9732 | }
|
9733 | |
9734 |
|
9735 |
|
9736 |
|
9737 |
|
9738 |
|
9739 | , _proto.generateAxes = function generateAxes(id) {
|
9740 | var d3Axis,
|
9741 | $$ = this.owner,
|
9742 | config = $$.config,
|
9743 | axes = [],
|
9744 | axesConfig = config["axis_" + id + "_axes"],
|
9745 | isRotated = config.axis_rotated;
|
9746 | id === "x" ? d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisLeft : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisBottom : id === "y" ? d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisBottom : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisLeft : id === "y2" && (d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisTop : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight), axesConfig.length && axesConfig.forEach(function (v) {
|
9747 | var tick = v.tick || {},
|
9748 | scale = $$.scale[id].copy();
|
9749 | v.domain && scale.domain(v.domain), axes.push(d3Axis(scale).ticks(tick.count).tickFormat(isFunction(tick.format) ? tick.format.bind($$.api) : function (x) {
|
9750 | return x;
|
9751 | }).tickValues(tick.values).tickSizeOuter(tick.outer === !1 ? 0 : 6));
|
9752 | }), this.axesList[id] = axes;
|
9753 | }
|
9754 | |
9755 |
|
9756 |
|
9757 |
|
9758 | , _proto.updateAxes = function updateAxes() {
|
9759 | var _this2 = this,
|
9760 | $$ = this.owner,
|
9761 | config = $$.config,
|
9762 | main = $$.$el.main;
|
9763 |
|
9764 | Object.keys(this.axesList).forEach(function (id) {
|
9765 | var axesConfig = config["axis_" + id + "_axes"],
|
9766 | scale = $$.scale[id].copy(),
|
9767 | range = scale.range();
|
9768 |
|
9769 | _this2.axesList[id].forEach(function (v, i) {
|
9770 | var axisRange = v.scale().range();
|
9771 |
|
9772 |
|
9773 | range.every(function (v, i) {
|
9774 | return v === axisRange[i];
|
9775 | }) || v.scale().range(range);
|
9776 | var className = _this2.getAxisClassName(id) + "-" + (i + 1),
|
9777 | g = main.select("." + className.replace(/\s/, "."));
|
9778 | g.empty() ? g = main.append("g").attr("class", className).style("visibility", config["axis_" + id + "_show"] ? "visible" : "hidden").call(v) : (axesConfig[i].domain && scale.domain(axesConfig[i].domain), _this2.x.helper.transitionise(g).call(v.scale(scale))), g.attr("transform", $$.getTranslate(id, i + 1));
|
9779 | });
|
9780 | });
|
9781 | }
|
9782 | |
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 |
|
9791 | , _proto.setAxis = function setAxis(id, scale, outerTick, noTransition) {
|
9792 | var $$ = this.owner;
|
9793 | id !== "subX" && (this.tick[id] = this.getTickValues(id)), this[id] = this.getAxis(id, scale, outerTick,
|
9794 |
|
9795 | !!(id === "x" && ($$.scale.zoom || $$.config.subchart_show || $$.state.resizing)) || noTransition);
|
9796 | }
|
9797 | , _proto.getAxis = function getAxis(id, scale, outerTick, noTransition, noTickTextRotate) {
|
9798 | var tickFormat,
|
9799 | $$ = this.owner,
|
9800 | config = $$.config,
|
9801 | isX = /^(x|subX)$/.test(id),
|
9802 | type = isX ? "x" : id,
|
9803 | isCategory = isX && this.isCategorized(),
|
9804 | orient = this.orient[id],
|
9805 | tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type);
|
9806 | if (isX) tickFormat = $$.format.xAxisTick;else {
|
9807 | var fn = config["axis_" + id + "_tick_format"];
|
9808 | isFunction(fn) && (tickFormat = fn.bind($$.api));
|
9809 | }
|
9810 | var tickValues = this.tick[type],
|
9811 | axisParams = mergeObj({
|
9812 | outerTick: outerTick,
|
9813 | noTransition: noTransition,
|
9814 | config: config,
|
9815 | id: id,
|
9816 | tickTextRotate: tickTextRotate
|
9817 | }, isX && {
|
9818 | isCategory: isCategory,
|
9819 | tickMultiline: config.axis_x_tick_multiline,
|
9820 | tickWidth: config.axis_x_tick_width,
|
9821 | tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
9822 | orgXScale: $$.scale.x
|
9823 | });
|
9824 | isX || (axisParams.tickStepSize = config["axis_" + type + "_tick_stepSize"]);
|
9825 | var axis = new AxisRenderer(axisParams).scale(isX && $$.scale.zoom || scale).orient(orient);
|
9826 |
|
9827 | if (isX && this.isTimeSeries() && tickValues && !isFunction(tickValues)) {
|
9828 | var _fn = parseDate.bind($$);
|
9829 |
|
9830 | tickValues = tickValues.map(function (v) {
|
9831 | return _fn(v);
|
9832 | });
|
9833 | } else !isX && this.isTimeSeriesY() && (
|
9834 | axis.ticks(config.axis_y_tick_time_value), tickValues = null);
|
9835 |
|
9836 | tickValues && axis.tickValues(tickValues), axis.tickFormat(tickFormat || !isX && $$.isStackNormalized() && function (x) {
|
9837 | return x + "%";
|
9838 | }), isCategory && (axis.tickCentered(config.axis_x_tick_centered), isEmpty(config.axis_x_tick_culling) && (config.axis_x_tick_culling = !1));
|
9839 | var tickCount = config["axis_" + type + "_tick_count"];
|
9840 | return tickCount && axis.ticks(tickCount), axis;
|
9841 | }, _proto.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {
|
9842 | var values,
|
9843 | $$ = this.owner,
|
9844 | config = $$.config,
|
9845 | fit = config.axis_x_tick_fit,
|
9846 | count = config.axis_x_tick_count;
|
9847 | return (fit || count && fit) && (values = $$.mapTargetsToUniqueXs(targets), this.isCategorized() && count > values.length && (count = values.length), values = this.generateTickValues(values, count, this.isTimeSeries())), axis ? axis.tickValues(values) : this.x && (this.x.tickValues(values), this.subX && this.subX.tickValues(values)), values;
|
9848 | }, _proto.getId = function getId(id) {
|
9849 | var _this$owner2 = this.owner,
|
9850 | config = _this$owner2.config,
|
9851 | scale = _this$owner2.scale,
|
9852 | axis = config.data_axes[id];
|
9853 | return axis && scale[axis] || (axis = "y"), axis;
|
9854 | }, _proto.getXAxisTickFormat = function getXAxisTickFormat() {
|
9855 | var currFormat,
|
9856 | $$ = this.owner,
|
9857 | config = $$.config,
|
9858 | format = $$.format,
|
9859 | tickFormat = config.axis_x_tick_format,
|
9860 | isTimeSeries = this.isTimeSeries(),
|
9861 | isCategorized = this.isCategorized();
|
9862 | return tickFormat ? isFunction(tickFormat) ? currFormat = tickFormat.bind($$.api) : isTimeSeries && (currFormat = function (date) {
|
9863 | return date ? format.axisTime(tickFormat)(date) : "";
|
9864 | }) : currFormat = isTimeSeries ? format.defaultAxisTime : isCategorized ? $$.categoryName : function (v) {
|
9865 | return v < 0 ? v.toFixed(0) : v;
|
9866 | }, isFunction(currFormat) ? function (v) {
|
9867 | return currFormat.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]);
|
9868 | } : currFormat;
|
9869 | }, _proto.getTickValues = function getTickValues(id) {
|
9870 | var $$ = this.owner,
|
9871 | tickValues = $$.config["axis_" + id + "_tick_values"],
|
9872 | axis = $$[id + "Axis"];
|
9873 | return (isFunction(tickValues) ? tickValues.call($$.api) : tickValues) || (axis ? axis.tickValues() : undefined);
|
9874 | }, _proto.getLabelOptionByAxisId = function getLabelOptionByAxisId(id) {
|
9875 | return this.owner.config["axis_" + id + "_label"];
|
9876 | }, _proto.getLabelText = function getLabelText(id) {
|
9877 | var option = this.getLabelOptionByAxisId(id);
|
9878 | return isString(option) ? option : option ? option.text : null;
|
9879 | }, _proto.setLabelText = function setLabelText(id, text) {
|
9880 | var $$ = this.owner,
|
9881 | config = $$.config,
|
9882 | option = this.getLabelOptionByAxisId(id);
|
9883 | isString(option) ? config["axis_" + id + "_label"] = text : option && (option.text = text);
|
9884 | }, _proto.getLabelPosition = function getLabelPosition(id, defaultPosition) {
|
9885 | var isRotated = this.owner.config.axis_rotated,
|
9886 | option = this.getLabelOptionByAxisId(id),
|
9887 | position = isObjectType(option) && option.position ? option.position : defaultPosition[+!isRotated],
|
9888 | has = function (v) {
|
9889 | return !!~position.indexOf(v);
|
9890 | };
|
9891 |
|
9892 | return {
|
9893 | isInner: has("inner"),
|
9894 | isOuter: has("outer"),
|
9895 | isLeft: has("left"),
|
9896 | isCenter: has("center"),
|
9897 | isRight: has("right"),
|
9898 | isTop: has("top"),
|
9899 | isMiddle: has("middle"),
|
9900 | isBottom: has("bottom")
|
9901 | };
|
9902 | }, _proto.getAxisLabelPosition = function getAxisLabelPosition(id) {
|
9903 | return this.getLabelPosition(id, id === "x" ? ["inner-top", "inner-right"] : ["inner-right", "inner-top"]);
|
9904 | }, _proto.getLabelPositionById = function getLabelPositionById(id) {
|
9905 | return this.getAxisLabelPosition(id);
|
9906 | }, _proto.xForAxisLabel = function xForAxisLabel(id) {
|
9907 | var $$ = this.owner,
|
9908 | _$$$state = $$.state,
|
9909 | width = _$$$state.width,
|
9910 | height = _$$$state.height,
|
9911 | position = this.getAxisLabelPosition(id),
|
9912 | x = position.isMiddle ? -height / 2 : 0;
|
9913 | return this.isHorizontal($$, id !== "x") ? x = position.isLeft ? 0 : position.isCenter ? width / 2 : width : position.isBottom && (x = -height), x;
|
9914 | }, _proto.dxForAxisLabel = function dxForAxisLabel(id) {
|
9915 | var $$ = this.owner,
|
9916 | position = this.getAxisLabelPosition(id),
|
9917 | dx = position.isBottom ? "0.5em" : "0";
|
9918 | return this.isHorizontal($$, id !== "x") ? dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0" : position.isTop && (dx = "-0.5em"), dx;
|
9919 | }, _proto.textAnchorForAxisLabel = function textAnchorForAxisLabel(id) {
|
9920 | var $$ = this.owner,
|
9921 | position = this.getAxisLabelPosition(id),
|
9922 | anchor = position.isMiddle ? "middle" : "end";
|
9923 | return this.isHorizontal($$, id !== "x") ? anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end" : position.isBottom && (anchor = "start"), anchor;
|
9924 | }, _proto.dyForAxisLabel = function dyForAxisLabel(id) {
|
9925 | var dy,
|
9926 | $$ = this.owner,
|
9927 | config = $$.config,
|
9928 | isRotated = config.axis_rotated,
|
9929 | isInner = this.getAxisLabelPosition(id).isInner,
|
9930 | tickRotate = config["axis_" + id + "_tick_rotate"] ? $$.getHorizontalAxisHeight(id) : 0,
|
9931 | maxTickWidth = this.getMaxTickWidth(id);
|
9932 |
|
9933 | if (id === "x") {
|
9934 | var xHeight = config.axis_x_height;
|
9935 | dy = isRotated ? isInner ? "1.2em" : -25 - maxTickWidth : isInner ? "-0.5em" : xHeight ? xHeight - 10 : tickRotate ? tickRotate - 10 : "3em";
|
9936 | } else dy = {
|
9937 | y: ["-0.5em", 10, "3em", "1.2em", 10],
|
9938 | y2: ["1.2em", -20, "-2.2em", "-0.5em", 15]
|
9939 | }[id], dy = isRotated ? isInner ? dy[0] : tickRotate ? tickRotate * (id === "y2" ? -1 : 1) - dy[1] : dy[2] : isInner ? dy[3] : (dy[4] + (config["axis_" + id + "_inner"] ? 0 : maxTickWidth + dy[4])) * (id === "y" ? -1 : 1);
|
9940 |
|
9941 | return dy;
|
9942 | }, _proto.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) {
|
9943 | var $$ = this.owner,
|
9944 | config = $$.config,
|
9945 | current = $$.state.current,
|
9946 | _$$$$el2 = $$.$el,
|
9947 | svg = _$$$$el2.svg,
|
9948 | chart = _$$$$el2.chart,
|
9949 | currentTickMax = current.maxTickWidths[id],
|
9950 | maxWidth = 0;
|
9951 | if (withoutRecompute || !config["axis_" + id + "_show"] || $$.filterTargetsToShow().length === 0) return currentTickMax.size;
|
9952 |
|
9953 | if (svg) {
|
9954 | var isYAxis = /^y2?$/.test(id),
|
9955 | targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
9956 | scale = $$.scale[id].copy().domain($$["get" + (isYAxis ? "Y" : "X") + "Domain"](targetsToShow, id)),
|
9957 | domain = scale.domain(),
|
9958 | isDomainSame = domain[0] === domain[1] && domain.every(function (v) {
|
9959 | return v > 0;
|
9960 | }),
|
9961 | isCurrentMaxTickDomainSame = isArray(currentTickMax.domain) && currentTickMax.domain[0] === currentTickMax.domain[1] && currentTickMax.domain.every(function (v) {
|
9962 | return v > 0;
|
9963 | });
|
9964 |
|
9965 | if (isDomainSame || isCurrentMaxTickDomainSame) return currentTickMax.size;
|
9966 |
|
9967 | currentTickMax.domain = domain, isYAxis || currentTickMax.ticks.splice(0);
|
9968 | var axis = this.getAxis(id, scale, !1, !1, !0),
|
9969 | tickCount = config["axis_" + id + "_tick_count"],
|
9970 | tickValues = config["axis_" + id + "_tick_values"];
|
9971 | !tickValues && tickCount && axis.tickValues(this.generateTickValues(domain, tickCount, isYAxis ? this.isTimeSeriesY() : this.isTimeSeries())), isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
|
9972 | var dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0px").style("left", "0px");
|
9973 | axis.create(dummy), dummy.selectAll("text").each(function (d, i) {
|
9974 | var currentTextWidth = this.getBoundingClientRect().width;
|
9975 | maxWidth = Math.max(maxWidth, currentTextWidth), isYAxis || (currentTickMax.ticks[i] = currentTextWidth);
|
9976 | }), dummy.remove();
|
9977 | }
|
9978 |
|
9979 | return maxWidth > 0 && (currentTickMax.size = maxWidth), currentTickMax.size;
|
9980 | }, _proto.getXAxisTickTextY2Overflow = function getXAxisTickTextY2Overflow(defaultPadding) {
|
9981 | var $$ = this.owner,
|
9982 | axis = $$.axis,
|
9983 | config = $$.config,
|
9984 | state = $$.state,
|
9985 | xAxisTickRotate = $$.getAxisTickRotate("x");
|
9986 |
|
9987 | if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
|
9988 | var widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingLeft(),
|
9989 | maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding),
|
9990 | xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
|
9991 |
|
9992 | return Math.min(xAxisTickTextY2Overflow, widthWithoutCurrentPaddingLeft / 2);
|
9993 | }
|
9994 |
|
9995 | return 0;
|
9996 | }, _proto.getXAxisTickMaxOverflow = function getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft) {
|
9997 | for (var $$ = this.owner, axis = $$.axis, config = $$.config, state = $$.state, isTimeSeries = axis.isTimeSeries(), tickTextWidths = state.current.maxTickWidths.x.ticks, tickCount = tickTextWidths.length, _state$axis$x$padding = state.axis.x.padding, left = _state$axis$x$padding.left, right = _state$axis$x$padding.right, maxOverflow = 0, remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0), i = 0; i < tickCount; i++) {
|
9998 | var tickIndex = i + 1,
|
9999 | rotatedTickTextWidth = Math.cos(Math.PI * xAxisTickRotate / 180) * tickTextWidths[i],
|
10000 | ticksBeforeTickText = tickIndex - (isTimeSeries ? 1 : .5) + left;
|
10001 |
|
10002 |
|
10003 | if (!(ticksBeforeTickText <= 0)) {
|
10004 | var tickLength = (widthWithoutCurrentPaddingLeft - rotatedTickTextWidth) / ticksBeforeTickText;
|
10005 | maxOverflow = Math.max(maxOverflow, rotatedTickTextWidth - tickLength / 2 - ((remaining - tickIndex) * tickLength + right * tickLength));
|
10006 | }
|
10007 | }
|
10008 |
|
10009 | var filteredTargets = $$.filterTargetsToShow($$.data.targets),
|
10010 | tickOffset = 0;
|
10011 |
|
10012 | if (!isTimeSeries && config.axis_x_tick_count <= filteredTargets.length && filteredTargets[0].values.length) {
|
10013 | var scale = getScale($$.axis.getAxisType("x"), 0, widthWithoutCurrentPaddingLeft - maxOverflow).domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]);
|
10014 | tickOffset = Math.ceil((scale(1) - scale(0)) / 2);
|
10015 | }
|
10016 |
|
10017 | return maxOverflow + tickOffset;
|
10018 | }
|
10019 | |
10020 |
|
10021 |
|
10022 |
|
10023 |
|
10024 |
|
10025 | , _proto.getXAxisPadding = function getXAxisPadding(tickCount) {
|
10026 | var $$ = this.owner,
|
10027 | padding = $$.config.axis_x_padding;
|
10028 |
|
10029 | if (isEmpty(padding) ? padding = {
|
10030 | left: 0,
|
10031 | right: 0
|
10032 | } : (padding.left = padding.left || 0, padding.right = padding.right || 0), $$.axis.isTimeSeries()) {
|
10033 | var firstX = +$$.getXDomainMin($$.data.targets),
|
10034 | lastX = +$$.getXDomainMax($$.data.targets),
|
10035 | timeDiff = lastX - firstX,
|
10036 | range = timeDiff + padding.left + padding.right,
|
10037 | left = 0,
|
10038 | _right = 0;
|
10039 |
|
10040 | if (tickCount && range) {
|
10041 | var relativeTickWidth = timeDiff / tickCount / range;
|
10042 | left = padding.left / range / relativeTickWidth, _right = padding.right / range / relativeTickWidth;
|
10043 | }
|
10044 |
|
10045 | padding = {
|
10046 | left: left,
|
10047 | right: _right
|
10048 | };
|
10049 | }
|
10050 |
|
10051 | return padding;
|
10052 | }, _proto.updateLabels = function updateLabels(withTransition) {
|
10053 | var _this3 = this,
|
10054 | $$ = this.owner,
|
10055 | main = $$.$el.main,
|
10056 | labels = {
|
10057 | x: main.select("." + config_classes.axisX + " ." + config_classes.axisXLabel),
|
10058 | y: main.select("." + config_classes.axisY + " ." + config_classes.axisYLabel),
|
10059 | y2: main.select("." + config_classes.axisY2 + " ." + config_classes.axisY2Label)
|
10060 | };
|
10061 |
|
10062 | Object.keys(labels).filter(function (id) {
|
10063 | return !labels[id].empty();
|
10064 | }).forEach(function (v) {
|
10065 | var node = labels[v];
|
10066 | (withTransition ? node.transition() : node).attr("x", function () {
|
10067 | return _this3.xForAxisLabel(v);
|
10068 | }).attr("dx", function () {
|
10069 | return _this3.dxForAxisLabel(v);
|
10070 | }).attr("dy", function () {
|
10071 | return _this3.dyForAxisLabel(v);
|
10072 | }).text(function () {
|
10073 | return _this3.getLabelText(v);
|
10074 | });
|
10075 | });
|
10076 | }, _proto.getPadding = function getPadding(padding, key, defaultValue, domainLength) {
|
10077 | var p = isNumber(padding) ? padding : padding[key];
|
10078 | return isValue(p) ? this.convertPixelsToAxisPadding(p, domainLength) : defaultValue;
|
10079 | }, _proto.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) {
|
10080 | var $$ = this.owner,
|
10081 | config = $$.config,
|
10082 | _$$$state2 = $$.state,
|
10083 | width = _$$$state2.width,
|
10084 | height = _$$$state2.height,
|
10085 | length = config.axis_rotated ? width : height;
|
10086 | return domainLength * (pixels / length);
|
10087 | }, _proto.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) {
|
10088 | var tickValues = values;
|
10089 |
|
10090 | if (tickCount) {
|
10091 | var targetCount = isFunction(tickCount) ? tickCount() : tickCount;
|
10092 |
|
10093 | if (targetCount === 1) tickValues = [values[0]];else if (targetCount === 2) tickValues = [values[0], values[values.length - 1]];else if (targetCount > 2) {
|
10094 | var tickValue,
|
10095 | isCategorized = this.isCategorized(),
|
10096 | count = targetCount - 2,
|
10097 | start = values[0],
|
10098 | end = values[values.length - 1];
|
10099 | tickValues = [start];
|
10100 |
|
10101 | for (var i = 0; i < count; i++) tickValue = +start + (end - start) / (count + 1) * (i + 1), tickValues.push(forTimeSeries ? new Date(tickValue) : isCategorized ? Math.round(tickValue) : tickValue);
|
10102 |
|
10103 | tickValues.push(end);
|
10104 | }
|
10105 | }
|
10106 |
|
10107 | return forTimeSeries || (tickValues = tickValues.sort(function (a, b) {
|
10108 | return a - b;
|
10109 | })), tickValues;
|
10110 | }, _proto.generateTransitions = function generateTransitions(duration) {
|
10111 | var $$ = this.owner,
|
10112 | axis = $$.$el.axis,
|
10113 | _map = ["x", "y", "y2", "subX"].map(function (v) {
|
10114 | var ax = axis[v];
|
10115 | return ax && duration && (ax = ax.transition().duration(duration)), ax;
|
10116 | }),
|
10117 | axisX = _map[0],
|
10118 | axisY = _map[1],
|
10119 | axisY2 = _map[2],
|
10120 | axisSubX = _map[3];
|
10121 |
|
10122 | return {
|
10123 | axisX: axisX,
|
10124 | axisY: axisY,
|
10125 | axisY2: axisY2,
|
10126 | axisSubX: axisSubX
|
10127 | };
|
10128 | }, _proto.redraw = function redraw(transitions, isHidden, isInit) {
|
10129 | var _this4 = this,
|
10130 | $$ = this.owner,
|
10131 | config = $$.config,
|
10132 | $el = $$.$el,
|
10133 | opacity = isHidden ? "0" : "1";
|
10134 |
|
10135 | ["x", "y", "y2", "subX"].forEach(function (id) {
|
10136 | var axis = _this4[id],
|
10137 | $axis = $el.axis[id];
|
10138 | axis && $axis && (!isInit && !config.transition_duration && (axis.config.withoutTransition = !0), $axis.style("opacity", opacity), axis.create(transitions["axis" + capitalize(id)]));
|
10139 | }), this.updateAxes();
|
10140 | }
|
10141 | |
10142 |
|
10143 |
|
10144 |
|
10145 |
|
10146 |
|
10147 |
|
10148 |
|
10149 |
|
10150 | , _proto.redrawAxis = function redrawAxis(targetsToShow, wth, transitions, flow, isInit) {
|
10151 | var xDomainForZoom,
|
10152 | _this5 = this,
|
10153 | $$ = this.owner,
|
10154 | config = $$.config,
|
10155 | scale = $$.scale,
|
10156 | $el = $$.$el,
|
10157 | hasZoom = !!scale.zoom;
|
10158 |
|
10159 | !hasZoom && this.isCategorized() && targetsToShow.length === 0 && scale.x.domain([0, $el.axis.x.selectAll(".tick").size()]), scale.x && targetsToShow.length ? (!hasZoom && $$.updateXDomain(targetsToShow, wth.UpdateXDomain, wth.UpdateOrgXDomain, wth.TrimXDomain), !config.axis_x_tick_values && this.updateXAxisTickValues(targetsToShow)) : this.x && (this.x.tickValues([]), this.subX && this.subX.tickValues([])), config.zoom_rescale && !flow && (xDomainForZoom = scale.x.orgDomain()), ["y", "y2"].forEach(function (key) {
|
10160 | var axisScale = scale[key];
|
10161 |
|
10162 | if (axisScale) {
|
10163 | var tickValues = config["axis_" + key + "_tick_values"],
|
10164 | tickCount = config["axis_" + key + "_tick_count"];
|
10165 |
|
10166 | if (axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom)), !tickValues && tickCount) {
|
10167 | var _axis = $$.axis[key],
|
10168 | domain = axisScale.domain();
|
10169 |
|
10170 | _axis.tickValues(_this5.generateTickValues(domain, domain.every(function (v) {
|
10171 | return v === 0;
|
10172 | }) ? 1 : tickCount, _this5.isTimeSeriesY()));
|
10173 | }
|
10174 | }
|
10175 | }), this.redraw(transitions, $$.hasArcType(), isInit), this.updateLabels(wth.Transition), (wth.UpdateXDomain || wth.UpdateXAxis || wth.Y) && targetsToShow.length && this.setCulling(), wth.Y && (scale.subY && scale.subY.domain($$.getYDomain(targetsToShow, "y")), scale.subY2 && scale.subY2.domain($$.getYDomain(targetsToShow, "y2")));
|
10176 | }
|
10177 | |
10178 |
|
10179 |
|
10180 |
|
10181 | , _proto.setCulling = function setCulling() {
|
10182 | var $$ = this.owner,
|
10183 | config = $$.config,
|
10184 | _$$$state3 = $$.state,
|
10185 | clip = _$$$state3.clip,
|
10186 | current = _$$$state3.current,
|
10187 | $el = $$.$el;
|
10188 | ["subX", "x", "y", "y2"].forEach(function (type) {
|
10189 | var axis = $el.axis[type],
|
10190 | id = type === "subX" ? "x" : type,
|
10191 | toCull = config["axis_" + id + "_tick_culling"];
|
10192 |
|
10193 | if (axis && toCull) {
|
10194 | var intervalForCulling,
|
10195 | tickText = axis.selectAll(".tick text"),
|
10196 | tickValues = sortValue(tickText.data()),
|
10197 | tickSize = tickValues.length,
|
10198 | cullingMax = config["axis_" + id + "_tick_culling_max"];
|
10199 |
|
10200 | if (tickSize) {
|
10201 | for (var i = 1; i < tickSize; i++) if (tickSize / i < cullingMax) {
|
10202 | intervalForCulling = i;
|
10203 | break;
|
10204 | }
|
10205 |
|
10206 | tickText.each(function (d) {
|
10207 | this.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : "block";
|
10208 | });
|
10209 | } else tickText.style("display", "block");
|
10210 |
|
10211 |
|
10212 | if (type === "x") {
|
10213 | var clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null;
|
10214 | $el.svg.selectAll("." + config_classes.axisX + " .tick text").attr("clip-path", clipPath);
|
10215 | }
|
10216 | }
|
10217 | });
|
10218 | }, Axis;
|
10219 | }();
|
10220 | ;
|
10221 |
|
10222 |
|
10223 |
|
10224 |
|
10225 |
|
10226 |
|
10227 | var eventrect = ({
|
10228 | |
10229 |
|
10230 |
|
10231 |
|
10232 |
|
10233 | initEventRect: function initEventRect() {
|
10234 | var $$ = this;
|
10235 | $$.$el.main.select("." + config_classes.chart).append("g").attr("class", config_classes.eventRects).style("fill-opacity", "0");
|
10236 | },
|
10237 |
|
10238 | |
10239 |
|
10240 |
|
10241 |
|
10242 | redrawEventRect: function redrawEventRect() {
|
10243 | var $$ = this,
|
10244 | config = $$.config,
|
10245 | state = $$.state,
|
10246 | $el = $$.$el,
|
10247 | isMultipleX = $$.isMultipleX();
|
10248 | if ($el.eventRect) $$.updateEventRect($el.eventRect, !0);else {
|
10249 | var eventRects = $$.$el.main.select("." + config_classes.eventRects).style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? config.axis_rotated ? "ns-resize" : "ew-resize" : null).classed(config_classes.eventRectsMultiple, isMultipleX).classed(config_classes.eventRectsSingle, !isMultipleX),
|
10250 | eventRectUpdate = eventRects.selectAll("." + config_classes.eventRect).data([0]).enter().append("rect");
|
10251 |
|
10252 |
|
10253 |
|
10254 | $$.updateEventRect(eventRectUpdate), isMultipleX ? $$.generateEventRectsForMultipleXs(eventRectUpdate) : $$.generateEventRectsForSingleX(eventRectUpdate), eventRectUpdate.call($$.getDraggableSelection()), $el.eventRect = eventRectUpdate, $$.state.inputType !== "touch" || $el.svg.on("touchstart.eventRect") || $$.hasArcType() || $$.bindTouchOnEventRect(isMultipleX);
|
10255 | }
|
10256 |
|
10257 | if (!isMultipleX) {
|
10258 |
|
10259 | var xAxisTickValues = $$.getMaxDataCountTarget();
|
10260 |
|
10261 | $$.updateDataIndexByX(xAxisTickValues), $$.updateXs(xAxisTickValues), $$.updatePointClass && $$.updatePointClass(!0), state.eventReceiver.data = xAxisTickValues;
|
10262 | }
|
10263 |
|
10264 | $$.updateEventRectData();
|
10265 | },
|
10266 | bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) {
|
10267 | var startPx,
|
10268 | $$ = this,
|
10269 | config = $$.config,
|
10270 | state = $$.state,
|
10271 | _$$$$el = $$.$el,
|
10272 | eventRect = _$$$$el.eventRect,
|
10273 | svg = _$$$$el.svg,
|
10274 | selectRect = function (context) {
|
10275 | if (isMultipleX) $$.selectRectForMultipleXs(context);else {
|
10276 | var index = $$.getDataIndexFromEvent(state.event);
|
10277 | $$.callOverOutForTouch(index), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index);
|
10278 | }
|
10279 | },
|
10280 | unselectRect = function () {
|
10281 | $$.unselectRect(), $$.callOverOutForTouch();
|
10282 | },
|
10283 | preventDefault = config.interaction_inputType_touch.preventDefault,
|
10284 | isPrevented = isboolean(preventDefault) && preventDefault || !1,
|
10285 | preventThreshold = !isNaN(preventDefault) && preventDefault || null,
|
10286 | preventEvent = function (event) {
|
10287 | var eventType = event.type,
|
10288 | touch = event.changedTouches[0],
|
10289 | currentXY = touch["client" + (config.axis_rotated ? "Y" : "X")];
|
10290 | 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());
|
10291 | };
|
10292 |
|
10293 |
|
10294 | eventRect.on("touchstart", function (event) {
|
10295 | state.event = event, $$.updateEventRect();
|
10296 | }).on("touchstart.eventRect touchmove.eventRect", function (event) {
|
10297 | if (state.event = event, !eventRect.empty() && eventRect.classed(config_classes.eventRect)) {
|
10298 |
|
10299 | if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) return;
|
10300 | preventEvent(event), selectRect(eventRect.node());
|
10301 | } else unselectRect();
|
10302 | }, !0).on("touchend.eventRect", function (event) {
|
10303 | state.event = event, !eventRect.empty() && eventRect.classed(config_classes.eventRect) && ($$.hasArcType() || !$$.toggleShape || state.cancelClick) && state.cancelClick && (state.cancelClick = !1);
|
10304 | }, !0), svg.on("touchstart", function (event) {
|
10305 | state.event = event;
|
10306 | var target = event.target;
|
10307 | target && target !== eventRect.node() && unselectRect();
|
10308 | });
|
10309 | },
|
10310 |
|
10311 | |
10312 |
|
10313 |
|
10314 |
|
10315 |
|
10316 |
|
10317 | updateEventRect: function updateEventRect(eventRect, force) {
|
10318 | force === void 0 && (force = !1);
|
10319 | var $$ = this,
|
10320 | state = $$.state,
|
10321 | $el = $$.$el,
|
10322 | _state = state,
|
10323 | eventReceiver = _state.eventReceiver,
|
10324 | width = _state.width,
|
10325 | height = _state.height,
|
10326 | rendered = _state.rendered,
|
10327 | resizing = _state.resizing,
|
10328 | rectElement = eventRect || $el.eventRect;
|
10329 | (!rendered || resizing || force) && (rectElement.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height), !rendered && rectElement.attr("class", config_classes.eventRect)), function updateClientRect() {
|
10330 | eventReceiver && (eventReceiver.rect = rectElement.node().getBoundingClientRect());
|
10331 | }();
|
10332 | },
|
10333 |
|
10334 | |
10335 |
|
10336 |
|
10337 |
|
10338 | updateEventRectData: function updateEventRectData() {
|
10339 | var x,
|
10340 | y,
|
10341 | w,
|
10342 | h,
|
10343 | $$ = this,
|
10344 | config = $$.config,
|
10345 | scale = $$.scale,
|
10346 | state = $$.state,
|
10347 | xScale = scale.zoom || scale.x,
|
10348 | isRotated = config.axis_rotated;
|
10349 | if ($$.isMultipleX())
|
10350 | x = 0, y = 0, w = state.width, h = state.height;else {
|
10351 | var rectW, rectX;
|
10352 | if ($$.axis.isCategorized()) rectW = $$.getEventRectWidth(), rectX = function (d) {
|
10353 | return xScale(d.x) - rectW / 2;
|
10354 | };else {
|
10355 | var getPrevNextX = function (_ref) {
|
10356 | var index = _ref.index;
|
10357 | return {
|
10358 | prev: $$.getPrevX(index),
|
10359 | next: $$.getNextX(index)
|
10360 | };
|
10361 | };
|
10362 |
|
10363 | rectW = function (d) {
|
10364 | var x = getPrevNextX(d);
|
10365 |
|
10366 | return x.prev === null && x.next === null ? isRotated ? state.height : state.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));
|
10367 | }, rectX = function (d) {
|
10368 | var x = getPrevNextX(d),
|
10369 | thisX = d.x;
|
10370 |
|
10371 | return x.prev === null && x.next === null ? 0 : (x.prev === null && (x.prev = xScale.domain()[0]), (xScale(thisX) + xScale(x.prev)) / 2);
|
10372 | };
|
10373 | }
|
10374 | x = isRotated ? 0 : rectX, y = isRotated ? rectX : 0, w = isRotated ? state.width : rectW, h = isRotated ? rectW : state.height;
|
10375 | }
|
10376 |
|
10377 | var eventReceiver = state.eventReceiver,
|
10378 | call = function (fn, v) {
|
10379 | return isFunction(fn) ? fn(v) : fn;
|
10380 | };
|
10381 |
|
10382 |
|
10383 | eventReceiver.coords.splice(eventReceiver.data.length), eventReceiver.data.forEach(function (d, i) {
|
10384 | eventReceiver.coords[i] = {
|
10385 | x: call(x, d),
|
10386 | y: call(y, d),
|
10387 | w: call(w, d),
|
10388 | h: call(h, d)
|
10389 | };
|
10390 | });
|
10391 | },
|
10392 | selectRectForMultipleXs: function selectRectForMultipleXs(context) {
|
10393 | var $$ = this,
|
10394 | config = $$.config,
|
10395 | state = $$.state,
|
10396 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
10397 |
|
10398 |
|
10399 | if (!(state.dragging || $$.hasArcType(targetsToShow))) {
|
10400 | var mouse = getPointer(state.event, context),
|
10401 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
10402 | if (state.mouseover && (!closest || closest.id !== state.mouseover.id) && (config.data_onout.call($$.api, state.mouseover), state.mouseover = undefined), !closest) return void $$.unselectRect();
|
10403 | var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x),
|
10404 | selectedData = sameXData.map(function (d) {
|
10405 | return $$.addName(d);
|
10406 | });
|
10407 |
|
10408 | $$.showTooltip(selectedData, context), $$.expandCirclesBars(closest.index, closest.id, !0), $$.showGridFocus(selectedData), ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && ($$.$el.svg.select("." + config_classes.eventRect).style("cursor", "pointer"), !state.mouseover && (config.data_onover.call($$.api, closest), state.mouseover = closest));
|
10409 | }
|
10410 | },
|
10411 |
|
10412 | |
10413 |
|
10414 |
|
10415 |
|
10416 | unselectRect: function unselectRect() {
|
10417 | var $$ = this,
|
10418 | config = $$.config,
|
10419 | _$$$$el2 = $$.$el,
|
10420 | bar = _$$$$el2.bar,
|
10421 | circle = _$$$$el2.circle,
|
10422 | tooltip = _$$$$el2.tooltip;
|
10423 | $$.$el.svg.select("." + config_classes.eventRect).style("cursor", null), $$.hideGridFocus(), tooltip && ($$.hideTooltip(), $$._handleLinkedCharts(!1)), circle && !config.point_focus_only && $$.unexpandCircles(), bar && $$.unexpandBars();
|
10424 | },
|
10425 |
|
10426 | |
10427 |
|
10428 |
|
10429 |
|
10430 |
|
10431 |
|
10432 |
|
10433 | generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) {
|
10434 | var $$ = this,
|
10435 | config = $$.config,
|
10436 | state = $$.state,
|
10437 | eventReceiver = state.eventReceiver,
|
10438 | rect = eventRectEnter.style("cursor", config.data_selection_enabled && config.data_selection_grouped ? "pointer" : null).on("click", function (event) {
|
10439 | state.event = event;
|
10440 | var _eventReceiver = eventReceiver,
|
10441 | currentIdx = _eventReceiver.currentIdx,
|
10442 | data = _eventReceiver.data,
|
10443 | d = data[currentIdx === -1 ? $$.getDataIndexFromEvent(event) : currentIdx];
|
10444 | $$.clickHandlerForSingleX.bind(this)(d, $$);
|
10445 | });
|
10446 |
|
10447 | if (state.inputType === "mouse") {
|
10448 | var getData = function (event) {
|
10449 | var index = event ? $$.getDataIndexFromEvent(event) : eventReceiver.currentIdx;
|
10450 | return index > -1 ? eventReceiver.data[index] : null;
|
10451 | };
|
10452 |
|
10453 | rect.on("mouseover", function (event) {
|
10454 | state.event = event, $$.updateEventRect();
|
10455 | }).on("mousemove", function (event) {
|
10456 | var d = getData(event);
|
10457 |
|
10458 |
|
10459 | if (state.event = event, !(state.dragging || state.flowing || $$.hasArcType() || !d || config.tooltip_grouped && d && d.index === eventReceiver.currentIdx)) {
|
10460 | var index = d.index;
|
10461 | $$.isStepType(d) && config.line_step_type === "step-after" && getPointer(event, this)[0] < $$.scale.x($$.getXValue(d.id, index)) && (index -= 1), index !== eventReceiver.currentIdx && ($$.setOverOut(!1, eventReceiver.currentIdx), eventReceiver.currentIdx = index), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, rect, index), $$.setOverOut(index !== -1, index);
|
10462 | }
|
10463 | }).on("mouseout", function (event) {
|
10464 | state.event = event;
|
10465 |
|
10466 | !config || $$.hasArcType() || eventReceiver.currentIdx === -1 || (
|
10467 | $$.unselectRect(), $$.setOverOut(!1, eventReceiver.currentIdx), eventReceiver.currentIdx = -1);
|
10468 | });
|
10469 | }
|
10470 |
|
10471 | return rect;
|
10472 | },
|
10473 | clickHandlerForSingleX: function clickHandlerForSingleX(d, ctx) {
|
10474 | var $$ = ctx,
|
10475 | config = $$.config,
|
10476 | state = $$.state,
|
10477 | main = $$.$el.main;
|
10478 | if (!d || $$.hasArcType() || state.cancelClick) return void (state.cancelClick && (state.cancelClick = !1));
|
10479 | var index = d.index;
|
10480 | main.selectAll("." + config_classes.shape + "-" + index).each(function (d2) {
|
10481 | (config.data_selection_grouped || $$.isWithinShape(this, d2)) && ($$.toggleShape && $$.toggleShape(this, d2, index), config.data_onclick.bind($$.api)(d2, this));
|
10482 | });
|
10483 | },
|
10484 |
|
10485 | |
10486 |
|
10487 |
|
10488 |
|
10489 |
|
10490 |
|
10491 | generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) {
|
10492 | var $$ = this,
|
10493 | state = $$.state;
|
10494 | eventRectEnter.on("click", function (event) {
|
10495 | state.event = event, $$.clickHandlerForMultipleXS.bind(this)($$);
|
10496 | }), state.inputType === "mouse" && eventRectEnter.on("mouseover mousemove", function (event) {
|
10497 | state.event = event, $$.selectRectForMultipleXs(this);
|
10498 | }).on("mouseout", function (event) {
|
10499 | state.event = event;
|
10500 |
|
10501 | !$$.config || $$.hasArcType() || $$.unselectRect();
|
10502 | });
|
10503 | },
|
10504 | clickHandlerForMultipleXS: function clickHandlerForMultipleXS(ctx) {
|
10505 | var $$ = ctx,
|
10506 | config = $$.config,
|
10507 | state = $$.state,
|
10508 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
10509 |
|
10510 | if (!$$.hasArcType(targetsToShow)) {
|
10511 | var mouse = getPointer(state.event, this),
|
10512 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
10513 | !closest || ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && $$.$el.main.selectAll("." + config_classes.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll("." + config_classes.shape + "-" + closest.index).each(function () {
|
10514 | (config.data_selection_grouped || $$.isWithinShape(this, closest)) && ($$.toggleShape && $$.toggleShape(this, closest, closest.index), config.data_onclick.bind($$.api)(closest, this));
|
10515 | });
|
10516 | }
|
10517 |
|
10518 | }
|
10519 | });
|
10520 |
|
10521 | var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack_require__(11);
|
10522 | ;
|
10523 |
|
10524 |
|
10525 |
|
10526 |
|
10527 |
|
10528 |
|
10529 |
|
10530 |
|
10531 | var interactions_flow = ({
|
10532 | |
10533 |
|
10534 |
|
10535 |
|
10536 |
|
10537 |
|
10538 | generateFlow: function generateFlow(args) {
|
10539 | var $$ = this,
|
10540 | data = $$.data,
|
10541 | state = $$.state,
|
10542 | $el = $$.$el;
|
10543 | return function () {
|
10544 | var flowLength = args.flow.length;
|
10545 |
|
10546 | state.flowing = !0, data.targets.forEach(function (d) {
|
10547 | d.values.splice(0, flowLength);
|
10548 | }), $$.updateXGrid && $$.updateXGrid(!0);
|
10549 |
|
10550 | var elements = {};
|
10551 | ["axis.x", "grid.x", "gridLines.x", "region.list", "text", "bar", "line", "area", "circle"].forEach(function (v) {
|
10552 | var name = v.split("."),
|
10553 | node = $el[name[0]];
|
10554 | node && name.length > 1 && (node = node[name[1]]), node && node.size() && (elements[v] = node);
|
10555 | }), $$.hideGridFocus(), $$.setFlowList(elements, args);
|
10556 | };
|
10557 | },
|
10558 |
|
10559 | |
10560 |
|
10561 |
|
10562 |
|
10563 |
|
10564 |
|
10565 | setFlowList: function setFlowList(elements, args) {
|
10566 | var n,
|
10567 | $$ = this,
|
10568 | flow = args.flow,
|
10569 | targets = args.targets,
|
10570 | _flow = flow,
|
10571 | _flow$duration = _flow.duration,
|
10572 | duration = _flow$duration === void 0 ? args.duration : _flow$duration,
|
10573 | flowIndex = _flow.index,
|
10574 | flowLength = _flow.length,
|
10575 | orgDataCount = _flow.orgDataCount,
|
10576 | transform = $$.getFlowTransform(targets, orgDataCount, flowIndex, flowLength),
|
10577 | wait = generateWait();
|
10578 | wait.add(Object.keys(elements).map(function (v) {
|
10579 | return n = elements[v].transition().ease(external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_.easeLinear).duration(duration), n = v === "axis.x" ? n.call(function (g) {
|
10580 | $$.axis.x.setTransition(g).create(g);
|
10581 | }) : v === "region.list" ? n.filter($$.isRegionOnX).attr("transform", transform) : n.attr("transform", transform), n;
|
10582 | })), n.call(wait, function () {
|
10583 | $$.cleanUpFlow(elements, args);
|
10584 | });
|
10585 | },
|
10586 |
|
10587 | |
10588 |
|
10589 |
|
10590 |
|
10591 |
|
10592 |
|
10593 | cleanUpFlow: function cleanUpFlow(elements, args) {
|
10594 | var $$ = this,
|
10595 | config = $$.config,
|
10596 | state = $$.state,
|
10597 | svg = $$.$el.svg,
|
10598 | isRotated = config.axis_rotated,
|
10599 | flow = args.flow,
|
10600 | shape = args.shape,
|
10601 | xv = args.xv,
|
10602 | _shape$pos = shape.pos,
|
10603 | cx = _shape$pos.cx,
|
10604 | cy = _shape$pos.cy,
|
10605 | xForText = _shape$pos.xForText,
|
10606 | yForText = _shape$pos.yForText,
|
10607 | _flow2 = flow,
|
10608 | _flow2$done = _flow2.done,
|
10609 | done = _flow2$done === void 0 ? function () {} : _flow2$done,
|
10610 | flowLength = _flow2.length;
|
10611 |
|
10612 |
|
10613 | flowLength && (["circle", "text", "shape", "eventRect"].forEach(function (v) {
|
10614 | var target = [];
|
10615 |
|
10616 | for (var i = 0; i < flowLength; i++) target.push("." + config_classes[v] + "-" + i);
|
10617 |
|
10618 | svg.selectAll("." + config_classes[v + "s"])
|
10619 | .selectAll(target).remove();
|
10620 | }), svg.select("." + config_classes.xgrid).remove()), Object.keys(elements).forEach(function (v) {
|
10621 | var n = elements[v];
|
10622 | if (v !== "axis.x" && n.attr("transform", null), v === "grid.x") n.attr(state.xgridAttr);else if (v === "gridLines.x") n.attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? state.width : xv);else if (v === "gridLines.x") n.select("line").attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? state.width : xv), n.select("text").attr("x", isRotated ? state.width : 0).attr("y", xv);else if (/^(area|bar|line)$/.test(v)) n.attr("d", shape.type[v]);else if (v === "text") n.attr("x", xForText).attr("y", yForText).style("fill-opacity", $$.opacityForText.bind($$));else if (v !== "circle") v === "region.list" && n.select("rect").filter($$.isRegionOnX).attr("x", $$.regionX.bind($$)).attr("width", $$.regionWidth.bind($$));else if ($$.isCirclePoint()) n.attr("cx", cx).attr("cy", cy);else {
|
10623 | var xFunc = function (d) {
|
10624 | return cx(d) - config.point_r;
|
10625 | },
|
10626 | yFunc = function (d) {
|
10627 | return cy(d) - config.point_r;
|
10628 | };
|
10629 |
|
10630 | n.attr("x", xFunc).attr("y", yFunc).attr("cx", cx)
|
10631 | .attr("cy", cy);
|
10632 | }
|
10633 | }), config.interaction_enabled && $$.redrawEventRect(), done.call($$.api), state.flowing = !1;
|
10634 | },
|
10635 |
|
10636 | |
10637 |
|
10638 |
|
10639 |
|
10640 |
|
10641 |
|
10642 |
|
10643 |
|
10644 |
|
10645 | getFlowTransform: function getFlowTransform(targets, orgDataCount, flowIndex, flowLength) {
|
10646 | var translateX,
|
10647 | $$ = this,
|
10648 | data = $$.data,
|
10649 | x = $$.scale.x,
|
10650 | dataValues = data.targets[0].values,
|
10651 | flowStart = $$.getValueOnIndex(dataValues, flowIndex),
|
10652 | flowEnd = $$.getValueOnIndex(dataValues, flowIndex + flowLength),
|
10653 | orgDomain = x.domain(),
|
10654 | domain = $$.updateXDomain(targets, !0, !0);
|
10655 | orgDataCount ? orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x) ? translateX = x(orgDomain[0]) - x(domain[0]) : translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(flowStart.x) - x(flowEnd.x) : dataValues.length === 1 ? $$.axis.isTimeSeries() ? (flowStart = $$.getValueOnIndex(dataValues, 0), flowEnd = $$.getValueOnIndex(dataValues, dataValues.length - 1), translateX = x(flowStart.x) - x(flowEnd.x)) : translateX = diffDomain(domain) / 2 : translateX = x(orgDomain[0]) - x(domain[0]);
|
10656 | var scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
10657 | return "translate(" + translateX + ",0) scale(" + scaleX + ",1)";
|
10658 | }
|
10659 | });
|
10660 | ;
|
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 |
|
10666 | var clip = ({
|
10667 | initClip: function initClip() {
|
10668 | var $$ = this,
|
10669 | clip = $$.state.clip;
|
10670 |
|
10671 |
|
10672 | clip.id = $$.state.datetimeId + "-clip", clip.idXAxis = clip.id + "-xaxis", clip.idYAxis = clip.id + "-yaxis", clip.idGrid = clip.id + "-grid", clip.path = $$.getClipPath(clip.id), clip.pathXAxis = $$.getClipPath(clip.idXAxis), clip.pathYAxis = $$.getClipPath(clip.idYAxis), clip.pathGrid = $$.getClipPath(clip.idGrid);
|
10673 | },
|
10674 | getClipPath: function getClipPath(id) {
|
10675 | var $$ = this,
|
10676 | config = $$.config;
|
10677 | if (!config.clipPath && /-clip$/.test(id) || !config.axis_x_clipPath && /-clip-xaxis$/.test(id) || !config.axis_y_clipPath && /-clip-yaxis$/.test(id)) return null;
|
10678 | var isIE9 = !!win.navigator && win.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0;
|
10679 | return "url(" + (isIE9 ? "" : browser_doc.URL.split("#")[0]) + "#" + id + ")";
|
10680 | },
|
10681 | appendClip: function appendClip(parent, id) {
|
10682 | id && parent.append("clipPath").attr("id", id).append("rect");
|
10683 | },
|
10684 |
|
10685 | |
10686 |
|
10687 |
|
10688 |
|
10689 |
|
10690 | setXAxisClipPath: function setXAxisClipPath(node) {
|
10691 | var $$ = this,
|
10692 | config = $$.config,
|
10693 | _$$$state = $$.state,
|
10694 | margin = _$$$state.margin,
|
10695 | width = _$$$state.width,
|
10696 | height = _$$$state.height,
|
10697 | isRotated = config.axis_rotated,
|
10698 | left = Math.max(30, margin.left) - (isRotated ? 0 : 20),
|
10699 | x = isRotated ? -(1 + left) : -(left - 1),
|
10700 | y = -Math.max(15, margin.top),
|
10701 | w = isRotated ? margin.left + 20 : width + 10 + left,
|
10702 | h = (isRotated ? margin.top + height + 10 : margin.bottom) + 20;
|
10703 | node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
10704 | },
|
10705 |
|
10706 | |
10707 |
|
10708 |
|
10709 |
|
10710 |
|
10711 | setYAxisClipPath: function setYAxisClipPath(node) {
|
10712 | var $$ = this,
|
10713 | config = $$.config,
|
10714 | _$$$state2 = $$.state,
|
10715 | margin = _$$$state2.margin,
|
10716 | width = _$$$state2.width,
|
10717 | height = _$$$state2.height,
|
10718 | isRotated = config.axis_rotated,
|
10719 | left = Math.max(30, margin.left) - (isRotated ? 20 : 0),
|
10720 | isInner = config.axis_y_inner,
|
10721 | x = isInner ? -1 : isRotated ? -(1 + left) : -(left - 1),
|
10722 | y = -(isRotated ? 20 : margin.top),
|
10723 | w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0),
|
10724 | h = (isRotated ? margin.bottom : margin.top + height) + 10;
|
10725 | node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
10726 | },
|
10727 | updateXAxisTickClip: function updateXAxisTickClip() {
|
10728 | var $$ = this,
|
10729 | config = $$.config,
|
10730 | _$$$state3 = $$.state,
|
10731 | clip = _$$$state3.clip,
|
10732 | xAxisHeight = _$$$state3.xAxisHeight,
|
10733 | defs = $$.$el.defs,
|
10734 | newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
10735 |
|
10736 | if (defs && !clip.idXAxisTickTexts) {
|
10737 | var clipId = clip.id + "-xaxisticktexts";
|
10738 | $$.appendClip(defs, clipId), clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts), clip.idXAxisTickTexts = clipId;
|
10739 | }
|
10740 |
|
10741 | !config.axis_x_tick_multiline && $$.getAxisTickRotate("x") && newXAxisHeight !== xAxisHeight && ($$.setXAxisTickClipWidth(), $$.setXAxisTickTextClipPathWidth()), $$.state.xAxisHeight = newXAxisHeight;
|
10742 | },
|
10743 | setXAxisTickClipWidth: function setXAxisTickClipWidth() {
|
10744 | var $$ = this,
|
10745 | config = $$.config,
|
10746 | maxTickWidths = $$.state.current.maxTickWidths,
|
10747 | xAxisTickRotate = $$.getAxisTickRotate("x");
|
10748 |
|
10749 | if (!config.axis_x_tick_multiline && xAxisTickRotate) {
|
10750 | var sinRotation = Math.sin(Math.PI / 180 * Math.abs(xAxisTickRotate));
|
10751 | maxTickWidths.x.clipPath = ($$.getHorizontalAxisHeight("x") - 20) / sinRotation;
|
10752 | } else maxTickWidths.x.clipPath = null;
|
10753 | },
|
10754 | setXAxisTickTextClipPathWidth: function setXAxisTickTextClipPathWidth() {
|
10755 | var $$ = this,
|
10756 | _$$$state4 = $$.state,
|
10757 | clip = _$$$state4.clip,
|
10758 | current = _$$$state4.current,
|
10759 | svg = $$.$el.svg;
|
10760 | svg && svg.select("#" + clip.idXAxisTickTexts + " rect").attr("width", current.maxTickWidths.x.clipPath).attr("height", 30);
|
10761 | }
|
10762 | });
|
10763 | ;
|
10764 |
|
10765 |
|
10766 |
|
10767 |
|
10768 |
|
10769 |
|
10770 |
|
10771 |
|
10772 | var getGridTextAnchor = function (d) {
|
10773 | return isValue(d.position) || "end";
|
10774 | },
|
10775 | getGridTextDx = function (d) {
|
10776 | return d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
10777 | };
|
10778 |
|
10779 |
|
10780 |
|
10781 |
|
10782 |
|
10783 |
|
10784 |
|
10785 |
|
10786 |
|
10787 | function getGridTextX(isX, width, height) {
|
10788 | return function (d) {
|
10789 | var x = isX ? 0 : width;
|
10790 | return d.position === "start" ? x = isX ? -height : 0 : d.position === "middle" && (x = (isX ? -height : width) / 2), x;
|
10791 | };
|
10792 | }
|
10793 |
|
10794 |
|
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 |
|
10801 | function smoothLines(el, type) {
|
10802 | type === "grid" && el.each(function () {
|
10803 | var g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
10804 | ["x1", "x2", "y1", "y2"].forEach(function (v) {
|
10805 | return g.attr(v, Math.ceil(+g.attr(v)));
|
10806 | });
|
10807 | });
|
10808 | }
|
10809 |
|
10810 | var grid = ({
|
10811 | hasGrid: function hasGrid() {
|
10812 | var config = this.config;
|
10813 | return ["x", "y"].some(function (v) {
|
10814 | return config["grid_" + v + "_show"] || config["grid_" + v + "_lines"].length;
|
10815 | });
|
10816 | },
|
10817 | initGrid: function initGrid() {
|
10818 | var $$ = this;
|
10819 | $$.hasGrid() && $$.initGridLines(), $$.initFocusGrid();
|
10820 | },
|
10821 | initGridLines: function initGridLines() {
|
10822 | var $$ = this,
|
10823 | config = $$.config,
|
10824 | clip = $$.state.clip,
|
10825 | $el = $$.$el;
|
10826 | (config.grid_x_lines.length || config.grid_y_lines.length) && ($el.gridLines.main = $el.main.insert("g", "." + config_classes.chart + (config.grid_lines_front ? " + *" : "")).attr("clip-path", clip.pathGrid).attr("class", config_classes.grid + " " + config_classes.gridLines), $el.gridLines.main.append("g").attr("class", config_classes.xgridLines), $el.gridLines.main.append("g").attr("class", config_classes.ygridLines), $el.gridLines.x = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.selectAll)([]));
|
10827 | },
|
10828 | updateXGrid: function updateXGrid(withoutUpdate) {
|
10829 | var $$ = this,
|
10830 | config = $$.config,
|
10831 | scale = $$.scale,
|
10832 | state = $$.state,
|
10833 | _$$$$el = $$.$el,
|
10834 | main = _$$$$el.main,
|
10835 | grid = _$$$$el.grid,
|
10836 | isRotated = config.axis_rotated,
|
10837 | xgridData = $$.generateGridData(config.grid_x_type, scale.x),
|
10838 | tickOffset = $$.axis.isCategorized() ? $$.axis.x.tickOffset() : 0,
|
10839 | pos = function (d) {
|
10840 | return (scale.zoom || scale.x)(d) + tickOffset * (isRotated ? -1 : 1);
|
10841 | };
|
10842 |
|
10843 | state.xgridAttr = isRotated ? {
|
10844 | "x1": 0,
|
10845 | "x2": state.width,
|
10846 | "y1": pos,
|
10847 | "y2": pos
|
10848 | } : {
|
10849 | "x1": pos,
|
10850 | "x2": pos,
|
10851 | "y1": 0,
|
10852 | "y2": state.height
|
10853 | }, grid.x = main.select("." + config_classes.xgrids).selectAll("." + config_classes.xgrid).data(xgridData), grid.x.exit().remove(), grid.x = grid.x.enter().append("line").attr("class", config_classes.xgrid).merge(grid.x), withoutUpdate || grid.x.each(function () {
|
10854 | var grid = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
10855 | Object.keys(state.xgridAttr).forEach(function (id) {
|
10856 | grid.attr(id, state.xgridAttr[id]).style("opacity", function () {
|
10857 | return grid.attr(isRotated ? "y1" : "x1") === (isRotated ? state.height : 0) ? "0" : "1";
|
10858 | });
|
10859 | });
|
10860 | });
|
10861 | },
|
10862 | updateYGrid: function updateYGrid() {
|
10863 | var $$ = this,
|
10864 | config = $$.config,
|
10865 | state = $$.state,
|
10866 | _$$$$el2 = $$.$el,
|
10867 | grid = _$$$$el2.grid,
|
10868 | main = _$$$$el2.main,
|
10869 | isRotated = config.axis_rotated,
|
10870 | gridValues = $$.axis.y.tickValues() || $$.scale.y.ticks(config.grid_y_ticks),
|
10871 | pos = function (d) {
|
10872 | return Math.ceil($$.scale.y(d));
|
10873 | };
|
10874 |
|
10875 | grid.y = main.select("." + config_classes.ygrids).selectAll("." + config_classes.ygrid).data(gridValues), grid.y.exit().remove(), grid.y = grid.y.enter().append("line").attr("class", config_classes.ygrid).merge(grid.y), grid.y.attr("x1", isRotated ? pos : 0).attr("x2", isRotated ? pos : state.width).attr("y1", isRotated ? 0 : pos).attr("y2", isRotated ? state.height : pos), smoothLines(grid.y, "grid");
|
10876 | },
|
10877 | updateGrid: function updateGrid(duration) {
|
10878 | var $$ = this,
|
10879 | _$$$$el3 = $$.$el,
|
10880 | grid = _$$$$el3.grid,
|
10881 | gridLines = _$$$$el3.gridLines;
|
10882 |
|
10883 | gridLines.main || $$.initGridLines(), grid.main.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.hideGridFocus(), $$.updateXGridLines(duration), $$.updateYGridLines(duration);
|
10884 | },
|
10885 |
|
10886 | |
10887 |
|
10888 |
|
10889 |
|
10890 |
|
10891 | updateXGridLines: function updateXGridLines(duration) {
|
10892 | var $$ = this,
|
10893 | config = $$.config,
|
10894 | _$$$$el4 = $$.$el,
|
10895 | gridLines = _$$$$el4.gridLines,
|
10896 | main = _$$$$el4.main,
|
10897 | isRotated = config.axis_rotated;
|
10898 | config.grid_x_show && $$.updateXGrid();
|
10899 | var xLines = main.select("." + config_classes.xgridLines).selectAll("." + config_classes.xgridLine).data(config.grid_x_lines);
|
10900 |
|
10901 | xLines.exit().transition().duration(duration).style("opacity", "0").remove();
|
10902 |
|
10903 | var xgridLine = xLines.enter().append("g");
|
10904 | xgridLine.append("line").style("opacity", "0"), xgridLine.append("text").attr("transform", isRotated ? "" : "rotate(-90)").attr("dy", -5).style("opacity", "0"), xLines = xgridLine.merge(xLines), xLines.attr("class", function (d) {
|
10905 | return (config_classes.xgridLine + " " + (d.class || "")).trim();
|
10906 | }).select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx).transition().duration(duration).text(function (d) {
|
10907 | return d.text;
|
10908 | }).transition().style("opacity", "1"), gridLines.x = xLines;
|
10909 | },
|
10910 |
|
10911 | |
10912 |
|
10913 |
|
10914 |
|
10915 |
|
10916 | updateYGridLines: function updateYGridLines(duration) {
|
10917 | var $$ = this,
|
10918 | config = $$.config,
|
10919 | _$$$state = $$.state,
|
10920 | width = _$$$state.width,
|
10921 | height = _$$$state.height,
|
10922 | $el = $$.$el,
|
10923 | isRotated = config.axis_rotated;
|
10924 | config.grid_y_show && $$.updateYGrid();
|
10925 | var ygridLines = $el.main.select("." + config_classes.ygridLines).selectAll("." + config_classes.ygridLine).data(config.grid_y_lines);
|
10926 |
|
10927 | ygridLines.exit().transition().duration(duration).style("opacity", "0").remove();
|
10928 |
|
10929 | var ygridLine = ygridLines.enter().append("g");
|
10930 | ygridLine.append("line").style("opacity", "0"), ygridLine.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0"), ygridLines = ygridLine.merge(ygridLines);
|
10931 |
|
10932 | var yv = $$.yv.bind($$);
|
10933 | ygridLines.attr("class", function (d) {
|
10934 | return (config_classes.ygridLine + " " + (d.class || "")).trim();
|
10935 | }).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) {
|
10936 | return d.text;
|
10937 | }).transition().style("opacity", "1"), $el.gridLines.y = ygridLines;
|
10938 | },
|
10939 | redrawGrid: function redrawGrid(withTransition) {
|
10940 | var $$ = this,
|
10941 | isRotated = $$.config.axis_rotated,
|
10942 | _$$$state2 = $$.state,
|
10943 | width = _$$$state2.width,
|
10944 | height = _$$$state2.height,
|
10945 | gridLines = $$.$el.gridLines,
|
10946 | xv = $$.xv.bind($$),
|
10947 | lines = gridLines.x.select("line"),
|
10948 | texts = gridLines.x.select("text");
|
10949 | 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) {
|
10950 | return d.text;
|
10951 | }), [lines.style("opacity", "1"), texts.style("opacity", "1")];
|
10952 | },
|
10953 | initFocusGrid: function initFocusGrid() {
|
10954 | var $$ = this,
|
10955 | config = $$.config,
|
10956 | clip = $$.state.clip,
|
10957 | $el = $$.$el,
|
10958 | isFront = config.grid_front,
|
10959 | className = "." + config_classes[isFront && $el.gridLines.main ? "gridLines" : "chart"] + (isFront ? " + *" : ""),
|
10960 | grid = $el.main.insert("g", className).attr("clip-path", clip.pathGrid).attr("class", config_classes.grid);
|
10961 | $el.grid.main = 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.interaction_enabled && config.grid_focus_show && (grid.append("g").attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus), config.grid_focus_y && !config.tooltip_grouped && grid.append("g").attr("class", config_classes.ygridFocus).append("line").attr("class", config_classes.ygridFocus));
|
10962 | },
|
10963 |
|
10964 | |
10965 |
|
10966 |
|
10967 |
|
10968 |
|
10969 | showGridFocus: function showGridFocus(data) {
|
10970 | var $$ = this,
|
10971 | config = $$.config,
|
10972 | _$$$state3 = $$.state,
|
10973 | width = _$$$state3.width,
|
10974 | height = _$$$state3.height,
|
10975 | isRotated = config.axis_rotated,
|
10976 | focusEl = $$.$el.main.selectAll("line." + config_classes.xgridFocus + ", line." + config_classes.ygridFocus),
|
10977 | dataToShow = (data || [focusEl.datum()]).filter(function (d) {
|
10978 | return d && isValue($$.getBaseValue(d));
|
10979 | });
|
10980 |
|
10981 |
|
10982 | if (!(!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType())) {
|
10983 | var isEdge = config.grid_focus_edge && !config.tooltip_grouped,
|
10984 | xx = $$.xx.bind($$);
|
10985 | focusEl.style("visibility", "visible").data(dataToShow.concat(dataToShow)).each(function (d) {
|
10986 | var xy,
|
10987 | el = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
10988 | pos = {
|
10989 | x: xx(d),
|
10990 | y: $$.getYScaleById(d.id)(d.value)
|
10991 | };
|
10992 | if (el.classed(config_classes.xgridFocus)) xy = isRotated ? [null,
|
10993 | pos.x,
|
10994 | isEdge ? pos.y : width,
|
10995 | pos.x
|
10996 | ] : [pos.x, isEdge ? pos.y : null, pos.x, height];else {
|
10997 | var isY2 = $$.axis.getId(d.id) === "y2";
|
10998 | xy = isRotated ? [pos.y,
|
10999 | isEdge && !isY2 ? pos.x : null,
|
11000 | pos.y,
|
11001 | isEdge && isY2 ? pos.x : height
|
11002 | ] : [isEdge && isY2 ? pos.x : null, pos.y, isEdge && !isY2 ? pos.x : width, pos.y];
|
11003 | }
|
11004 | ["x1", "y1", "x2", "y2"].forEach(function (v, i) {
|
11005 | return el.attr(v, xy[i]);
|
11006 | });
|
11007 | }), smoothLines(focusEl, "grid"), $$.showCircleFocus && $$.showCircleFocus(data);
|
11008 | }
|
11009 | },
|
11010 | hideGridFocus: function hideGridFocus() {
|
11011 | var $$ = this,
|
11012 | _$$$state4 = $$.state,
|
11013 | inputType = _$$$state4.inputType,
|
11014 | resizing = _$$$state4.resizing,
|
11015 | main = $$.$el.main;
|
11016 | inputType !== "mouse" && resizing || (main.selectAll("line." + config_classes.xgridFocus + ", line." + config_classes.ygridFocus).style("visibility", "hidden"), $$.hideCircleFocus && $$.hideCircleFocus());
|
11017 | },
|
11018 | updateGridFocus: function updateGridFocus() {
|
11019 | var $$ = this,
|
11020 | _$$$state5 = $$.state,
|
11021 | inputType = _$$$state5.inputType,
|
11022 | width = _$$$state5.width,
|
11023 | height = _$$$state5.height,
|
11024 | resizing = _$$$state5.resizing,
|
11025 | grid = $$.$el.grid,
|
11026 | xgridFocus = grid.main.select("line." + config_classes.xgridFocus);
|
11027 | if (inputType === "touch") xgridFocus.empty() ? resizing && $$.showCircleFocus() : $$.showGridFocus();else {
|
11028 | var _isRotated = $$.config.axis_rotated;
|
11029 | xgridFocus.attr("x1", _isRotated ? 0 : -10).attr("x2", _isRotated ? width : -10).attr("y1", _isRotated ? -10 : 0).attr("y2", _isRotated ? -10 : height);
|
11030 | }
|
11031 |
|
11032 |
|
11033 | return !0;
|
11034 | },
|
11035 | generateGridData: function generateGridData(type, scale) {
|
11036 | var $$ = this,
|
11037 | tickNum = $$.$el.main.select("." + config_classes.axisX).selectAll(".tick").size(),
|
11038 | gridData = [];
|
11039 |
|
11040 | if (type === "year") {
|
11041 | var xDomain = $$.getXDomain(),
|
11042 | firstYear = xDomain[0].getFullYear(),
|
11043 | lastYear = xDomain[1].getFullYear();
|
11044 |
|
11045 | for (var i = firstYear; i <= lastYear; i++) gridData.push(new Date(i + "-01-01 00:00:00"));
|
11046 | } else gridData = scale.ticks(10), gridData.length > tickNum && (gridData = gridData.filter(function (d) {
|
11047 | return (d + "").indexOf(".") < 0;
|
11048 | }));
|
11049 |
|
11050 | return gridData;
|
11051 | },
|
11052 | getGridFilterToRemove: function getGridFilterToRemove(params) {
|
11053 | return params ? function (line) {
|
11054 | var found = !1;
|
11055 | return (isArray(params) ? params.concat() : [params]).forEach(function (param) {
|
11056 | ("value" in param && line.value === param.value || "class" in param && line.class === param.class) && (found = !0);
|
11057 | }), found;
|
11058 | } : function () {
|
11059 | return !0;
|
11060 | };
|
11061 | },
|
11062 | removeGridLines: function removeGridLines(params, forX) {
|
11063 | var $$ = this,
|
11064 | config = $$.config,
|
11065 | toRemove = $$.getGridFilterToRemove(params),
|
11066 | classLines = forX ? config_classes.xgridLines : config_classes.ygridLines,
|
11067 | classLine = forX ? config_classes.xgridLine : config_classes.ygridLine;
|
11068 | $$.$el.main.select("." + classLines).selectAll("." + classLine).filter(toRemove).transition().duration(config.transition_duration).style("opacity", "0").remove();
|
11069 | var gridLines = "grid_" + (forX ? "x" : "y") + "_lines";
|
11070 | config[gridLines] = config[gridLines].filter(function toShow(line) {
|
11071 | return !toRemove(line);
|
11072 | });
|
11073 | }
|
11074 | });
|
11075 | ;
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 |
|
11081 |
|
11082 |
|
11083 |
|
11084 | var region = ({
|
11085 | initRegion: function initRegion() {
|
11086 | var $$ = this,
|
11087 | $el = $$.$el;
|
11088 | $el.region.main = $el.main.append("g").attr("clip-path", $$.state.clip.path).attr("class", config_classes.regions);
|
11089 | },
|
11090 | updateRegion: function updateRegion(duration) {
|
11091 | var $$ = this,
|
11092 | config = $$.config,
|
11093 | $el = $$.$el;
|
11094 | $el.region.main || $$.initRegion(), $el.region.main.style("visibility", $$.hasArcType() ? "hidden" : "visible");
|
11095 |
|
11096 | var list = $el.main.select("." + config_classes.regions).selectAll("." + config_classes.region).data(config.regions);
|
11097 | list.exit().transition().duration(duration).style("opacity", "0").remove(), list = list.enter().append("g").merge(list).attr("class", $$.classRegion.bind($$)), list.append("rect").style("fill-opacity", "0"), $el.region.list = list;
|
11098 | },
|
11099 | redrawRegion: function redrawRegion(withTransition) {
|
11100 | var $$ = this,
|
11101 | regions = $$.$el.region.list.select("rect");
|
11102 | 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) {
|
11103 | return isValue(d.opacity) ? d.opacity : "0.1";
|
11104 | }).on("end", function () {
|
11105 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode).selectAll("rect:not([x])").remove();
|
11106 | })];
|
11107 | },
|
11108 | getRegionXY: function getRegionXY(type, d) {
|
11109 | var currScale,
|
11110 | $$ = this,
|
11111 | config = $$.config,
|
11112 | scale = $$.scale,
|
11113 | isRotated = config.axis_rotated,
|
11114 | isX = type === "x",
|
11115 | key = "start",
|
11116 | pos = 0;
|
11117 | return d.axis === "y" || d.axis === "y2" ? (!isX && (key = "end"), (isX ? isRotated : !isRotated) && key in d && (currScale = scale[d.axis], pos = currScale(d[key]))) : (isX ? !isRotated : isRotated) && key in d && (currScale = scale.zoom || scale.x, pos = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key])), pos;
|
11118 | },
|
11119 | regionX: function regionX(d) {
|
11120 | return this.getRegionXY("x", d);
|
11121 | },
|
11122 | regionY: function regionY(d) {
|
11123 | return this.getRegionXY("y", d);
|
11124 | },
|
11125 | getRegionSize: function getRegionSize(type, d) {
|
11126 | var currScale,
|
11127 | $$ = this,
|
11128 | config = $$.config,
|
11129 | scale = $$.scale,
|
11130 | state = $$.state,
|
11131 | isRotated = config.axis_rotated,
|
11132 | isWidth = type === "width",
|
11133 | start = $$[isWidth ? "regionX" : "regionY"](d),
|
11134 | key = "end",
|
11135 | end = state[type];
|
11136 | return d.axis === "y" || d.axis === "y2" ? (!isWidth && (key = "start"), (isWidth ? isRotated : !isRotated) && key in d && (currScale = scale[d.axis], end = currScale(d[key]))) : (isWidth ? !isRotated : isRotated) && key in d && (currScale = scale.zoom || scale.x, end = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key])), end < start ? 0 : end - start;
|
11137 | },
|
11138 | regionWidth: function regionWidth(d) {
|
11139 | return this.getRegionSize("width", d);
|
11140 | },
|
11141 | regionHeight: function regionHeight(d) {
|
11142 | return this.getRegionSize("height", d);
|
11143 | },
|
11144 | isRegionOnX: function isRegionOnX(d) {
|
11145 | return !d.axis || d.axis === "x";
|
11146 | }
|
11147 | });
|
11148 | ;
|
11149 |
|
11150 |
|
11151 |
|
11152 |
|
11153 | var size_axis = ({
|
11154 | |
11155 |
|
11156 |
|
11157 |
|
11158 |
|
11159 |
|
11160 | getAxisSize: function getAxisSize(id) {
|
11161 | var $$ = this,
|
11162 | isRotated = $$.config.axis_rotated;
|
11163 | return isRotated && id === "x" || !isRotated && /y2?/.test(id) ? $$.getAxisWidthByAxisId(id, !0) : $$.getHorizontalAxisHeight(id);
|
11164 | },
|
11165 | getAxisWidthByAxisId: function getAxisWidthByAxisId(id, withoutRecompute) {
|
11166 | var $$ = this;
|
11167 |
|
11168 | if ($$.axis) {
|
11169 | var position = $$.axis && $$.axis.getLabelPositionById(id);
|
11170 | return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40);
|
11171 | }
|
11172 |
|
11173 | return 40;
|
11174 | },
|
11175 | getHorizontalAxisHeight: function getHorizontalAxisHeight(id) {
|
11176 | var $$ = this,
|
11177 | config = $$.config,
|
11178 | state = $$.state,
|
11179 | _state = state,
|
11180 | current = _state.current,
|
11181 | rotatedPadding = _state.rotatedPadding,
|
11182 | isLegendRight = _state.isLegendRight,
|
11183 | isLegendInset = _state.isLegendInset,
|
11184 | isRotated = config.axis_rotated,
|
11185 | h = 30;
|
11186 | if (id === "x" && !config.axis_x_show) return 8;
|
11187 | if (id === "x" && config.axis_x_height) return config.axis_x_height;
|
11188 | if (id === "y" && !config.axis_y_show) return !config.legend_show || isLegendRight || isLegendInset ? 1 : 10;
|
11189 | if (id === "y2" && !config.axis_y2_show) return rotatedPadding.top;
|
11190 | var rotate = $$.getAxisTickRotate(id);
|
11191 |
|
11192 | return (id === "x" && !isRotated || /y2?/.test(id) && isRotated) && rotate && (h = 30 + $$.axis.getMaxTickWidth(id) * Math.cos(Math.PI * (90 - Math.abs(rotate)) / 180), !config.axis_x_tick_multiline && current.height && h > current.height / 2 && (h = current.height / 2)), h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id !== "y2" || isRotated ? 0 : -10);
|
11193 | },
|
11194 | getEventRectWidth: function getEventRectWidth() {
|
11195 | return Math.max(0, this.axis.x.tickInterval());
|
11196 | },
|
11197 |
|
11198 | |
11199 |
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 | getAxisTickRotate: function getAxisTickRotate(id) {
|
11205 | var $$ = this,
|
11206 | axis = $$.axis,
|
11207 | config = $$.config,
|
11208 | state = $$.state,
|
11209 | $el = $$.$el,
|
11210 | rotate = config["axis_" + id + "_tick_rotate"];
|
11211 |
|
11212 | if (id === "x") {
|
11213 | var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries();
|
11214 |
|
11215 | if (config.axis_x_tick_fit && allowedXAxisTypes) {
|
11216 | var xTickCount = config.axis_x_tick_count,
|
11217 | currentXTicksLength = state.current.maxTickWidths.x.ticks.length,
|
11218 | tickCount = 0;
|
11219 | xTickCount ? tickCount = xTickCount > currentXTicksLength ? currentXTicksLength : xTickCount : currentXTicksLength && (tickCount = currentXTicksLength), tickCount !== state.axis.x.tickCount && (state.axis.x.padding = $$.axis.getXAxisPadding(tickCount)), state.axis.x.tickCount = tickCount;
|
11220 | }
|
11221 |
|
11222 | $el.svg && config.axis_x_tick_fit && !config.axis_x_tick_multiline && !config.axis_x_tick_culling && config.axis_x_tick_autorotate && allowedXAxisTypes && (rotate = $$.needToRotateXAxisTickTexts() ? config.axis_x_tick_rotate : 0);
|
11223 | }
|
11224 |
|
11225 | return rotate;
|
11226 | },
|
11227 |
|
11228 | |
11229 |
|
11230 |
|
11231 |
|
11232 |
|
11233 | needToRotateXAxisTickTexts: function needToRotateXAxisTickTexts() {
|
11234 | var $$ = this,
|
11235 | _$$$state = $$.state,
|
11236 | axis = _$$$state.axis,
|
11237 | current = _$$$state.current,
|
11238 | xAxisLength = current.width - $$.getCurrentPaddingLeft(!1) - $$.getCurrentPaddingRight(),
|
11239 | tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right,
|
11240 | maxTickWidth = $$.axis.getMaxTickWidth("x"),
|
11241 | tickLength = tickCountWithPadding ? xAxisLength / tickCountWithPadding : 0;
|
11242 | return maxTickWidth > tickLength;
|
11243 | }
|
11244 | });
|
11245 | ;
|
11246 |
|
11247 |
|
11248 |
|
11249 |
|
11250 |
|
11251 |
|
11252 |
|
11253 |
|
11254 | var data_axis = ({
|
11255 | |
11256 |
|
11257 |
|
11258 |
|
11259 |
|
11260 |
|
11261 |
|
11262 |
|
11263 |
|
11264 |
|
11265 |
|
11266 |
|
11267 |
|
11268 |
|
11269 |
|
11270 | data_xs: {},
|
11271 |
|
11272 | |
11273 |
|
11274 |
|
11275 |
|
11276 |
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 |
|
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 |
|
11295 | data_xFormat: "%Y-%m-%d",
|
11296 |
|
11297 | |
11298 |
|
11299 |
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 |
|
11305 |
|
11306 |
|
11307 |
|
11308 | data_xLocaltime: !0,
|
11309 |
|
11310 | |
11311 |
|
11312 |
|
11313 |
|
11314 |
|
11315 |
|
11316 |
|
11317 |
|
11318 |
|
11319 |
|
11320 |
|
11321 | data_xSort: !0,
|
11322 |
|
11323 | |
11324 |
|
11325 |
|
11326 |
|
11327 |
|
11328 |
|
11329 |
|
11330 |
|
11331 |
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 | data_axes: {},
|
11339 |
|
11340 | |
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 |
|
11346 |
|
11347 |
|
11348 |
|
11349 |
|
11350 |
|
11351 |
|
11352 |
|
11353 |
|
11354 |
|
11355 |
|
11356 |
|
11357 |
|
11358 |
|
11359 |
|
11360 |
|
11361 |
|
11362 |
|
11363 |
|
11364 |
|
11365 |
|
11366 |
|
11367 |
|
11368 | data_regions: {},
|
11369 |
|
11370 | |
11371 |
|
11372 |
|
11373 |
|
11374 |
|
11375 |
|
11376 |
|
11377 |
|
11378 |
|
11379 |
|
11380 |
|
11381 |
|
11382 |
|
11383 |
|
11384 |
|
11385 |
|
11386 |
|
11387 |
|
11388 | data_stack_normalize: !1
|
11389 | });
|
11390 | ;
|
11391 |
|
11392 |
|
11393 |
|
11394 |
|
11395 |
|
11396 |
|
11397 |
|
11398 |
|
11399 | var axis_x = ({
|
11400 | |
11401 |
|
11402 |
|
11403 |
|
11404 |
|
11405 |
|
11406 |
|
11407 |
|
11408 |
|
11409 |
|
11410 |
|
11411 | axis_x_clipPath: !0,
|
11412 |
|
11413 | |
11414 |
|
11415 |
|
11416 |
|
11417 |
|
11418 |
|
11419 |
|
11420 |
|
11421 |
|
11422 |
|
11423 |
|
11424 |
|
11425 |
|
11426 | axis_x_show: !0,
|
11427 |
|
11428 | |
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 | axis_x_type: "indexed",
|
11457 |
|
11458 | |
11459 |
|
11460 |
|
11461 |
|
11462 |
|
11463 |
|
11464 |
|
11465 |
|
11466 |
|
11467 |
|
11468 |
|
11469 |
|
11470 |
|
11471 |
|
11472 | axis_x_localtime: !0,
|
11473 |
|
11474 | |
11475 |
|
11476 |
|
11477 |
|
11478 |
|
11479 |
|
11480 |
|
11481 |
|
11482 |
|
11483 |
|
11484 |
|
11485 |
|
11486 |
|
11487 |
|
11488 | axis_x_categories: [],
|
11489 |
|
11490 | |
11491 |
|
11492 |
|
11493 |
|
11494 |
|
11495 |
|
11496 |
|
11497 |
|
11498 |
|
11499 |
|
11500 |
|
11501 |
|
11502 |
|
11503 |
|
11504 |
|
11505 | axis_x_tick_centered: !1,
|
11506 |
|
11507 | |
11508 |
|
11509 |
|
11510 |
|
11511 |
|
11512 |
|
11513 |
|
11514 |
|
11515 |
|
11516 |
|
11517 |
|
11518 |
|
11519 |
|
11520 |
|
11521 |
|
11522 |
|
11523 |
|
11524 |
|
11525 |
|
11526 |
|
11527 |
|
11528 |
|
11529 |
|
11530 |
|
11531 |
|
11532 |
|
11533 |
|
11534 | axis_x_tick_format: undefined,
|
11535 |
|
11536 | |
11537 |
|
11538 |
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 |
|
11544 |
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 |
|
11550 |
|
11551 |
|
11552 |
|
11553 |
|
11554 |
|
11555 | axis_x_tick_culling: {},
|
11556 |
|
11557 | |
11558 |
|
11559 |
|
11560 |
|
11561 |
|
11562 |
|
11563 |
|
11564 |
|
11565 |
|
11566 |
|
11567 |
|
11568 |
|
11569 |
|
11570 |
|
11571 |
|
11572 |
|
11573 |
|
11574 | axis_x_tick_culling_max: 10,
|
11575 |
|
11576 | |
11577 |
|
11578 |
|
11579 |
|
11580 |
|
11581 |
|
11582 |
|
11583 |
|
11584 |
|
11585 |
|
11586 |
|
11587 |
|
11588 |
|
11589 |
|
11590 |
|
11591 |
|
11592 | axis_x_tick_count: undefined,
|
11593 |
|
11594 | |
11595 |
|
11596 |
|
11597 |
|
11598 |
|
11599 |
|
11600 |
|
11601 |
|
11602 |
|
11603 |
|
11604 |
|
11605 |
|
11606 |
|
11607 |
|
11608 |
|
11609 |
|
11610 | axis_x_tick_show: !0,
|
11611 |
|
11612 | |
11613 |
|
11614 |
|
11615 |
|
11616 |
|
11617 |
|
11618 |
|
11619 |
|
11620 |
|
11621 |
|
11622 |
|
11623 |
|
11624 |
|
11625 |
|
11626 |
|
11627 |
|
11628 |
|
11629 |
|
11630 | axis_x_tick_text_show: !0,
|
11631 |
|
11632 | |
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 |
|
11642 |
|
11643 |
|
11644 |
|
11645 |
|
11646 |
|
11647 |
|
11648 |
|
11649 |
|
11650 |
|
11651 |
|
11652 | axis_x_tick_text_position: {
|
11653 | x: 0,
|
11654 | y: 0
|
11655 | },
|
11656 |
|
11657 | |
11658 |
|
11659 |
|
11660 |
|
11661 |
|
11662 |
|
11663 |
|
11664 |
|
11665 |
|
11666 |
|
11667 |
|
11668 |
|
11669 |
|
11670 |
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 |
|
11676 | axis_x_tick_fit: !0,
|
11677 |
|
11678 | |
11679 |
|
11680 |
|
11681 |
|
11682 |
|
11683 |
|
11684 |
|
11685 |
|
11686 |
|
11687 |
|
11688 |
|
11689 |
|
11690 |
|
11691 |
|
11692 |
|
11693 |
|
11694 |
|
11695 |
|
11696 |
|
11697 |
|
11698 |
|
11699 |
|
11700 | axis_x_tick_values: null,
|
11701 |
|
11702 | |
11703 |
|
11704 |
|
11705 |
|
11706 |
|
11707 |
|
11708 |
|
11709 |
|
11710 |
|
11711 |
|
11712 |
|
11713 |
|
11714 |
|
11715 |
|
11716 |
|
11717 |
|
11718 |
|
11719 |
|
11720 |
|
11721 |
|
11722 |
|
11723 |
|
11724 |
|
11725 |
|
11726 |
|
11727 |
|
11728 |
|
11729 | axis_x_tick_autorotate: !1,
|
11730 |
|
11731 | |
11732 |
|
11733 |
|
11734 |
|
11735 |
|
11736 |
|
11737 |
|
11738 |
|
11739 |
|
11740 |
|
11741 |
|
11742 |
|
11743 |
|
11744 |
|
11745 |
|
11746 |
|
11747 |
|
11748 |
|
11749 |
|
11750 | axis_x_tick_rotate: 0,
|
11751 |
|
11752 | |
11753 |
|
11754 |
|
11755 |
|
11756 |
|
11757 |
|
11758 |
|
11759 |
|
11760 |
|
11761 |
|
11762 |
|
11763 |
|
11764 |
|
11765 |
|
11766 |
|
11767 | axis_x_tick_outer: !0,
|
11768 |
|
11769 | |
11770 |
|
11771 |
|
11772 |
|
11773 |
|
11774 |
|
11775 |
|
11776 |
|
11777 |
|
11778 |
|
11779 |
|
11780 |
|
11781 |
|
11782 |
|
11783 |
|
11784 |
|
11785 |
|
11786 |
|
11787 |
|
11788 |
|
11789 |
|
11790 |
|
11791 |
|
11792 |
|
11793 |
|
11794 |
|
11795 |
|
11796 |
|
11797 | axis_x_tick_multiline: !0,
|
11798 |
|
11799 | |
11800 |
|
11801 |
|
11802 |
|
11803 |
|
11804 |
|
11805 |
|
11806 |
|
11807 |
|
11808 |
|
11809 |
|
11810 |
|
11811 |
|
11812 |
|
11813 |
|
11814 |
|
11815 |
|
11816 | axis_x_tick_width: null,
|
11817 |
|
11818 | |
11819 |
|
11820 |
|
11821 |
|
11822 |
|
11823 |
|
11824 |
|
11825 |
|
11826 |
|
11827 |
|
11828 |
|
11829 |
|
11830 |
|
11831 |
|
11832 |
|
11833 |
|
11834 | axis_x_tick_tooltip: !1,
|
11835 |
|
11836 | |
11837 |
|
11838 |
|
11839 |
|
11840 |
|
11841 |
|
11842 |
|
11843 |
|
11844 |
|
11845 |
|
11846 |
|
11847 |
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 | axis_x_max: undefined,
|
11860 |
|
11861 | |
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 |
|
11869 |
|
11870 |
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 |
|
11876 |
|
11877 |
|
11878 |
|
11879 |
|
11880 |
|
11881 |
|
11882 |
|
11883 |
|
11884 | axis_x_min: undefined,
|
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 |
|
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 | axis_x_padding: {},
|
11919 |
|
11920 | |
11921 |
|
11922 |
|
11923 |
|
11924 |
|
11925 |
|
11926 |
|
11927 |
|
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 | axis_x_height: undefined,
|
11935 |
|
11936 | |
11937 |
|
11938 |
|
11939 |
|
11940 |
|
11941 |
|
11942 |
|
11943 |
|
11944 |
|
11945 |
|
11946 |
|
11947 |
|
11948 |
|
11949 |
|
11950 |
|
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 |
|
11963 |
|
11964 | axis_x_extent: undefined,
|
11965 |
|
11966 | |
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 |
|
12002 |
|
12003 |
|
12004 |
|
12005 |
|
12006 |
|
12007 | axis_x_label: {},
|
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 | axis_x_axes: []
|
12047 | });
|
12048 | ;
|
12049 |
|
12050 |
|
12051 |
|
12052 |
|
12053 |
|
12054 |
|
12055 |
|
12056 |
|
12057 | var y = ({
|
12058 | |
12059 |
|
12060 |
|
12061 |
|
12062 |
|
12063 |
|
12064 |
|
12065 |
|
12066 |
|
12067 |
|
12068 |
|
12069 | axis_y_clipPath: !0,
|
12070 |
|
12071 | |
12072 |
|
12073 |
|
12074 |
|
12075 |
|
12076 |
|
12077 |
|
12078 |
|
12079 |
|
12080 |
|
12081 |
|
12082 |
|
12083 |
|
12084 | axis_y_show: !0,
|
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 | axis_y_type: "indexed",
|
12112 |
|
12113 | |
12114 |
|
12115 |
|
12116 |
|
12117 |
|
12118 |
|
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 | axis_y_max: undefined,
|
12128 |
|
12129 | |
12130 |
|
12131 |
|
12132 |
|
12133 |
|
12134 |
|
12135 |
|
12136 |
|
12137 |
|
12138 |
|
12139 |
|
12140 |
|
12141 |
|
12142 |
|
12143 |
|
12144 | axis_y_min: undefined,
|
12145 |
|
12146 | |
12147 |
|
12148 |
|
12149 |
|
12150 |
|
12151 |
|
12152 |
|
12153 |
|
12154 |
|
12155 |
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 | axis_y_inverted: !1,
|
12161 |
|
12162 | |
12163 |
|
12164 |
|
12165 |
|
12166 |
|
12167 |
|
12168 |
|
12169 |
|
12170 |
|
12171 |
|
12172 |
|
12173 |
|
12174 |
|
12175 | axis_y_center: undefined,
|
12176 |
|
12177 | |
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 |
|
12184 |
|
12185 |
|
12186 |
|
12187 |
|
12188 |
|
12189 |
|
12190 | axis_y_inner: !1,
|
12191 |
|
12192 | |
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 |
|
12200 |
|
12201 |
|
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 |
|
12215 |
|
12216 | axis_y_label: {},
|
12217 |
|
12218 | |
12219 |
|
12220 |
|
12221 |
|
12222 |
|
12223 |
|
12224 |
|
12225 |
|
12226 |
|
12227 |
|
12228 |
|
12229 |
|
12230 |
|
12231 |
|
12232 |
|
12233 |
|
12234 |
|
12235 |
|
12236 | axis_y_tick_format: undefined,
|
12237 |
|
12238 | |
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 |
|
12251 |
|
12252 |
|
12253 |
|
12254 |
|
12255 | axis_y_tick_culling: !1,
|
12256 |
|
12257 | |
12258 |
|
12259 |
|
12260 |
|
12261 |
|
12262 |
|
12263 |
|
12264 |
|
12265 |
|
12266 |
|
12267 |
|
12268 |
|
12269 |
|
12270 |
|
12271 |
|
12272 |
|
12273 |
|
12274 | axis_y_tick_culling_max: 5,
|
12275 |
|
12276 | |
12277 |
|
12278 |
|
12279 |
|
12280 |
|
12281 |
|
12282 |
|
12283 |
|
12284 |
|
12285 |
|
12286 |
|
12287 |
|
12288 |
|
12289 |
|
12290 |
|
12291 | axis_y_tick_outer: !0,
|
12292 |
|
12293 | |
12294 |
|
12295 |
|
12296 |
|
12297 |
|
12298 |
|
12299 |
|
12300 |
|
12301 |
|
12302 |
|
12303 |
|
12304 |
|
12305 |
|
12306 |
|
12307 |
|
12308 |
|
12309 |
|
12310 |
|
12311 |
|
12312 |
|
12313 | axis_y_tick_values: null,
|
12314 |
|
12315 | |
12316 |
|
12317 |
|
12318 |
|
12319 |
|
12320 |
|
12321 |
|
12322 |
|
12323 |
|
12324 |
|
12325 |
|
12326 |
|
12327 |
|
12328 |
|
12329 |
|
12330 |
|
12331 |
|
12332 | axis_y_tick_rotate: 0,
|
12333 |
|
12334 | |
12335 |
|
12336 |
|
12337 |
|
12338 |
|
12339 |
|
12340 |
|
12341 |
|
12342 |
|
12343 |
|
12344 |
|
12345 |
|
12346 |
|
12347 |
|
12348 |
|
12349 |
|
12350 | axis_y_tick_count: undefined,
|
12351 |
|
12352 | |
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 |
|
12362 |
|
12363 |
|
12364 |
|
12365 |
|
12366 |
|
12367 |
|
12368 | axis_y_tick_show: !0,
|
12369 |
|
12370 | |
12371 |
|
12372 |
|
12373 |
|
12374 |
|
12375 |
|
12376 |
|
12377 |
|
12378 |
|
12379 |
|
12380 |
|
12381 |
|
12382 |
|
12383 |
|
12384 |
|
12385 |
|
12386 |
|
12387 |
|
12388 | axis_y_tick_stepSize: null,
|
12389 |
|
12390 | |
12391 |
|
12392 |
|
12393 |
|
12394 |
|
12395 |
|
12396 |
|
12397 |
|
12398 |
|
12399 |
|
12400 |
|
12401 |
|
12402 |
|
12403 |
|
12404 |
|
12405 |
|
12406 |
|
12407 |
|
12408 | axis_y_tick_text_show: !0,
|
12409 |
|
12410 | |
12411 |
|
12412 |
|
12413 |
|
12414 |
|
12415 |
|
12416 |
|
12417 |
|
12418 |
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 |
|
12424 |
|
12425 |
|
12426 |
|
12427 |
|
12428 |
|
12429 |
|
12430 | axis_y_tick_text_position: {
|
12431 | x: 0,
|
12432 | y: 0
|
12433 | },
|
12434 |
|
12435 | |
12436 |
|
12437 |
|
12438 |
|
12439 |
|
12440 |
|
12441 |
|
12442 |
|
12443 |
|
12444 |
|
12445 |
|
12446 |
|
12447 |
|
12448 |
|
12449 |
|
12450 |
|
12451 |
|
12452 |
|
12453 |
|
12454 |
|
12455 |
|
12456 |
|
12457 |
|
12458 | axis_y_tick_time_value: undefined,
|
12459 |
|
12460 | |
12461 |
|
12462 |
|
12463 |
|
12464 |
|
12465 |
|
12466 |
|
12467 |
|
12468 |
|
12469 |
|
12470 |
|
12471 |
|
12472 |
|
12473 |
|
12474 |
|
12475 |
|
12476 |
|
12477 |
|
12478 |
|
12479 |
|
12480 |
|
12481 |
|
12482 |
|
12483 |
|
12484 |
|
12485 | axis_y_padding: {},
|
12486 |
|
12487 | |
12488 |
|
12489 |
|
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 |
|
12497 |
|
12498 |
|
12499 |
|
12500 |
|
12501 | axis_y_default: undefined,
|
12502 |
|
12503 | |
12504 |
|
12505 |
|
12506 |
|
12507 |
|
12508 |
|
12509 |
|
12510 |
|
12511 |
|
12512 |
|
12513 |
|
12514 |
|
12515 |
|
12516 |
|
12517 |
|
12518 |
|
12519 |
|
12520 |
|
12521 |
|
12522 |
|
12523 |
|
12524 |
|
12525 |
|
12526 |
|
12527 |
|
12528 |
|
12529 |
|
12530 |
|
12531 |
|
12532 |
|
12533 |
|
12534 |
|
12535 |
|
12536 |
|
12537 |
|
12538 |
|
12539 |
|
12540 | axis_y_axes: []
|
12541 | });
|
12542 | ;
|
12543 |
|
12544 |
|
12545 |
|
12546 |
|
12547 |
|
12548 |
|
12549 |
|
12550 |
|
12551 | var y2 = ({
|
12552 | |
12553 |
|
12554 |
|
12555 |
|
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 |
|
12561 |
|
12562 |
|
12563 |
|
12564 |
|
12565 |
|
12566 |
|
12567 |
|
12568 | axis_y2_show: !1,
|
12569 |
|
12570 | |
12571 |
|
12572 |
|
12573 |
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 |
|
12585 |
|
12586 |
|
12587 |
|
12588 |
|
12589 |
|
12590 |
|
12591 |
|
12592 |
|
12593 |
|
12594 |
|
12595 | axis_y2_type: "indexed",
|
12596 |
|
12597 | |
12598 |
|
12599 |
|
12600 |
|
12601 |
|
12602 |
|
12603 |
|
12604 |
|
12605 |
|
12606 |
|
12607 |
|
12608 |
|
12609 |
|
12610 | axis_y2_max: undefined,
|
12611 |
|
12612 | |
12613 |
|
12614 |
|
12615 |
|
12616 |
|
12617 |
|
12618 |
|
12619 |
|
12620 |
|
12621 |
|
12622 |
|
12623 |
|
12624 |
|
12625 | axis_y2_min: undefined,
|
12626 |
|
12627 | |
12628 |
|
12629 |
|
12630 |
|
12631 |
|
12632 |
|
12633 |
|
12634 |
|
12635 |
|
12636 |
|
12637 |
|
12638 |
|
12639 |
|
12640 |
|
12641 | axis_y2_inverted: !1,
|
12642 |
|
12643 | |
12644 |
|
12645 |
|
12646 |
|
12647 |
|
12648 |
|
12649 |
|
12650 |
|
12651 |
|
12652 |
|
12653 |
|
12654 |
|
12655 |
|
12656 | axis_y2_center: undefined,
|
12657 |
|
12658 | |
12659 |
|
12660 |
|
12661 |
|
12662 |
|
12663 |
|
12664 |
|
12665 |
|
12666 |
|
12667 |
|
12668 |
|
12669 |
|
12670 |
|
12671 | axis_y2_inner: !1,
|
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_y2_label: {},
|
12698 |
|
12699 | |
12700 |
|
12701 |
|
12702 |
|
12703 |
|
12704 |
|
12705 |
|
12706 |
|
12707 |
|
12708 |
|
12709 |
|
12710 |
|
12711 |
|
12712 |
|
12713 |
|
12714 |
|
12715 |
|
12716 | axis_y2_tick_format: undefined,
|
12717 |
|
12718 | |
12719 |
|
12720 |
|
12721 |
|
12722 |
|
12723 |
|
12724 |
|
12725 |
|
12726 |
|
12727 |
|
12728 |
|
12729 |
|
12730 |
|
12731 |
|
12732 |
|
12733 |
|
12734 |
|
12735 | axis_y2_tick_culling: !1,
|
12736 |
|
12737 | |
12738 |
|
12739 |
|
12740 |
|
12741 |
|
12742 |
|
12743 |
|
12744 |
|
12745 |
|
12746 |
|
12747 |
|
12748 |
|
12749 |
|
12750 |
|
12751 |
|
12752 |
|
12753 |
|
12754 | axis_y2_tick_culling_max: 5,
|
12755 |
|
12756 | |
12757 |
|
12758 |
|
12759 |
|
12760 |
|
12761 |
|
12762 |
|
12763 |
|
12764 |
|
12765 |
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 | axis_y2_tick_outer: !0,
|
12772 |
|
12773 | |
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 |
|
12785 |
|
12786 |
|
12787 |
|
12788 |
|
12789 |
|
12790 |
|
12791 |
|
12792 |
|
12793 | axis_y2_tick_values: null,
|
12794 |
|
12795 | |
12796 |
|
12797 |
|
12798 |
|
12799 |
|
12800 |
|
12801 |
|
12802 |
|
12803 |
|
12804 |
|
12805 |
|
12806 |
|
12807 |
|
12808 |
|
12809 |
|
12810 |
|
12811 |
|
12812 | axis_y2_tick_rotate: 0,
|
12813 |
|
12814 | |
12815 |
|
12816 |
|
12817 |
|
12818 |
|
12819 |
|
12820 |
|
12821 |
|
12822 |
|
12823 |
|
12824 |
|
12825 |
|
12826 |
|
12827 |
|
12828 |
|
12829 |
|
12830 | axis_y2_tick_count: undefined,
|
12831 |
|
12832 | |
12833 |
|
12834 |
|
12835 |
|
12836 |
|
12837 |
|
12838 |
|
12839 |
|
12840 |
|
12841 |
|
12842 |
|
12843 |
|
12844 |
|
12845 |
|
12846 |
|
12847 |
|
12848 | axis_y2_tick_show: !0,
|
12849 |
|
12850 | |
12851 |
|
12852 |
|
12853 |
|
12854 |
|
12855 |
|
12856 |
|
12857 |
|
12858 |
|
12859 |
|
12860 |
|
12861 |
|
12862 |
|
12863 |
|
12864 |
|
12865 |
|
12866 |
|
12867 |
|
12868 | axis_y2_tick_stepSize: null,
|
12869 |
|
12870 | |
12871 |
|
12872 |
|
12873 |
|
12874 |
|
12875 |
|
12876 |
|
12877 |
|
12878 |
|
12879 |
|
12880 |
|
12881 |
|
12882 |
|
12883 |
|
12884 |
|
12885 |
|
12886 |
|
12887 |
|
12888 | axis_y2_tick_text_show: !0,
|
12889 |
|
12890 | |
12891 |
|
12892 |
|
12893 |
|
12894 |
|
12895 |
|
12896 |
|
12897 |
|
12898 |
|
12899 |
|
12900 |
|
12901 |
|
12902 |
|
12903 |
|
12904 |
|
12905 |
|
12906 |
|
12907 |
|
12908 |
|
12909 |
|
12910 | axis_y2_tick_text_position: {
|
12911 | x: 0,
|
12912 | y: 0
|
12913 | },
|
12914 |
|
12915 | |
12916 |
|
12917 |
|
12918 |
|
12919 |
|
12920 |
|
12921 |
|
12922 |
|
12923 |
|
12924 |
|
12925 |
|
12926 |
|
12927 |
|
12928 |
|
12929 |
|
12930 |
|
12931 |
|
12932 |
|
12933 |
|
12934 |
|
12935 |
|
12936 |
|
12937 |
|
12938 |
|
12939 | axis_y2_padding: {},
|
12940 |
|
12941 | |
12942 |
|
12943 |
|
12944 |
|
12945 |
|
12946 |
|
12947 |
|
12948 |
|
12949 |
|
12950 |
|
12951 |
|
12952 |
|
12953 |
|
12954 |
|
12955 | axis_y2_default: undefined,
|
12956 |
|
12957 | |
12958 |
|
12959 |
|
12960 |
|
12961 |
|
12962 |
|
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 |
|
12970 |
|
12971 |
|
12972 |
|
12973 |
|
12974 |
|
12975 |
|
12976 |
|
12977 |
|
12978 |
|
12979 |
|
12980 |
|
12981 |
|
12982 |
|
12983 |
|
12984 |
|
12985 |
|
12986 |
|
12987 |
|
12988 |
|
12989 |
|
12990 |
|
12991 |
|
12992 |
|
12993 |
|
12994 | axis_y2_axes: []
|
12995 | });
|
12996 | ;
|
12997 |
|
12998 |
|
12999 | function axis_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13000 |
|
13001 | function axis_objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = arguments[i] == null ? {} : arguments[i], i % 2 ? axis_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : axis_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
13002 |
|
13003 |
|
13004 |
|
13005 |
|
13006 |
|
13007 |
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 | var axis_axis = (axis_objectSpread(axis_objectSpread(axis_objectSpread({
|
13015 | |
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 | axis_rotated: !1
|
13027 | }, axis_x), y), y2));
|
13028 | ;
|
13029 |
|
13030 |
|
13031 |
|
13032 |
|
13033 |
|
13034 |
|
13035 |
|
13036 |
|
13037 | var common_grid = ({
|
13038 | |
13039 |
|
13040 |
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 |
|
13049 |
|
13050 |
|
13051 |
|
13052 |
|
13053 |
|
13054 |
|
13055 |
|
13056 |
|
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 |
|
13082 |
|
13083 |
|
13084 |
|
13085 |
|
13086 |
|
13087 |
|
13088 |
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 |
|
13096 | grid_x_show: !1,
|
13097 | grid_x_type: "tick",
|
13098 | grid_x_lines: [],
|
13099 | grid_y_show: !1,
|
13100 | grid_y_lines: [],
|
13101 | grid_y_ticks: 10,
|
13102 | grid_focus_edge: !1,
|
13103 | grid_focus_show: !0,
|
13104 | grid_focus_y: !1,
|
13105 | grid_front: !1,
|
13106 | grid_lines_front: !0
|
13107 | });
|
13108 | ;
|
13109 |
|
13110 |
|
13111 |
|
13112 |
|
13113 |
|
13114 |
|
13115 |
|
13116 |
|
13117 |
|
13118 |
|
13119 |
|
13120 |
|
13121 |
|
13122 |
|
13123 |
|
13124 |
|
13125 |
|
13126 |
|
13127 |
|
13128 |
|
13129 |
|
13130 |
|
13131 |
|
13132 |
|
13133 |
|
13134 |
|
13135 |
|
13136 |
|
13137 |
|
13138 | var api = [api_axis, api_category, grid_x, grid_y, flow, group, api_regions, x];
|
13139 | var internal = [Axis, clip, eventrect, interactions_flow, grid, region, size_axis];
|
13140 | var options = [data_axis, axis_axis, common_grid];
|
13141 |
|
13142 | var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(12);
|
13143 | ;
|
13144 |
|
13145 |
|
13146 |
|
13147 |
|
13148 |
|
13149 |
|
13150 |
|
13151 |
|
13152 |
|
13153 |
|
13154 | var arc = ({
|
13155 | initPie: function initPie() {
|
13156 | var $$ = this,
|
13157 | config = $$.config,
|
13158 | dataType = config.data_type,
|
13159 | padding = config.pie_padding,
|
13160 | startingAngle = config[dataType + "_startingAngle"] || 0,
|
13161 | padAngle = ($$.hasType("pie") && padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
|
13162 | $$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
|
13163 | return d.values.reduce(function (a, b) {
|
13164 | return a + b.value;
|
13165 | }, 0);
|
13166 | }).sort($$.getSortCompareFn.bind($$)(!0));
|
13167 | },
|
13168 | updateRadius: function updateRadius() {
|
13169 | var $$ = this,
|
13170 | config = $$.config,
|
13171 | state = $$.state,
|
13172 | padding = config.pie_padding,
|
13173 | w = config.gauge_width || config.donut_width,
|
13174 | gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
13175 | state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() ? .85 : 1), state.radius = state.radiusExpanded * .95, state.innerRadiusRatio = w ? (state.radius - w) / state.radius : .6, state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
|
13176 | var innerRadius = config.pie_innerRadius || (padding ? padding * (state.innerRadiusRatio + .1) : 0);
|
13177 |
|
13178 | state.outerRadius = config.pie_outerRadius, state.innerRadius = $$.hasType("donut") || $$.hasType("gauge") ? state.radius * state.innerRadiusRatio : innerRadius;
|
13179 | },
|
13180 |
|
13181 | |
13182 |
|
13183 |
|
13184 |
|
13185 |
|
13186 |
|
13187 | getRadius: function getRadius(d) {
|
13188 | var $$ = this,
|
13189 | data = d && d.data,
|
13190 | _$$$state = $$.state,
|
13191 | innerRadius = _$$$state.innerRadius,
|
13192 | outerRadius = _$$$state.outerRadius;
|
13193 | return !isNumber(innerRadius) && data && (innerRadius = innerRadius[data.id] || 0), isObject(outerRadius) && data && data.id in outerRadius ? outerRadius = outerRadius[data.id] : !isNumber(outerRadius) && (outerRadius = $$.state.radius), {
|
13194 | innerRadius: innerRadius,
|
13195 | outerRadius: outerRadius
|
13196 | };
|
13197 | },
|
13198 | updateArc: function updateArc() {
|
13199 | var $$ = this;
|
13200 | $$.updateRadius(), $$.svgArc = $$.getSvgArc(), $$.svgArcExpanded = $$.getSvgArcExpanded();
|
13201 | },
|
13202 | getArcLength: function getArcLength() {
|
13203 | var $$ = this,
|
13204 | config = $$.config,
|
13205 | arcLengthInPercent = config.gauge_arcLength * 3.6,
|
13206 | len = 2 * (arcLengthInPercent / 360);
|
13207 | return arcLengthInPercent < -360 ? len = -2 : arcLengthInPercent > 360 && (len = 2), len * Math.PI;
|
13208 | },
|
13209 | getStartAngle: function getStartAngle() {
|
13210 | var $$ = this,
|
13211 | config = $$.config,
|
13212 | isFullCircle = config.gauge_fullCircle,
|
13213 | defaultStartAngle = -1 * Math.PI / 2,
|
13214 | defaultEndAngle = Math.PI / 2,
|
13215 | startAngle = config.gauge_startingAngle;
|
13216 | return !isFullCircle && startAngle <= defaultStartAngle ? startAngle = defaultStartAngle : !isFullCircle && startAngle >= defaultEndAngle ? startAngle = defaultEndAngle : (startAngle > Math.PI || startAngle < -1 * Math.PI) && (startAngle = Math.PI), startAngle;
|
13217 | },
|
13218 | updateAngle: function updateAngle(dValue) {
|
13219 | var $$ = this,
|
13220 | config = $$.config,
|
13221 | state = $$.state,
|
13222 | pie = $$.pie,
|
13223 | d = dValue,
|
13224 | found = !1;
|
13225 | if (!config) return null;
|
13226 | var gStart = $$.getStartAngle(),
|
13227 | radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2;
|
13228 |
|
13229 | if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
|
13230 |
|
13231 | var totalSum = $$.getTotalDataSum(state.rendered),
|
13232 | gEnd = radius * (totalSum / (config.gauge_max - config.gauge_min));
|
13233 | pie = pie.startAngle(gStart).endAngle(gEnd + gStart);
|
13234 | }
|
13235 |
|
13236 | if (pie($$.filterTargetsToShow()).forEach(function (t, i) {
|
13237 | found || t.data.id !== d.data.id || (found = !0, d = t, d.index = i);
|
13238 | }), isNaN(d.startAngle) && (d.startAngle = 0), isNaN(d.endAngle) && (d.endAngle = d.startAngle), d.data && $$.hasMultiArcGauge()) {
|
13239 | var gMin = config.gauge_min,
|
13240 | gMax = config.gauge_max,
|
13241 | gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : gMax - gMin;
|
13242 | d.startAngle = gStart, d.endAngle = gStart + radius / (gMax - gMin) * gValue;
|
13243 | }
|
13244 |
|
13245 | return found ? d : null;
|
13246 | },
|
13247 | getSvgArc: function getSvgArc() {
|
13248 | var $$ = this,
|
13249 | state = $$.state,
|
13250 | singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
13251 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
13252 | arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
13253 | var _$$$getRadius = $$.getRadius(d),
|
13254 | innerRadius = _$$$getRadius.innerRadius;
|
13255 |
|
13256 | return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
13257 | }).outerRadius(function (d) {
|
13258 | var _$$$getRadius2 = $$.getRadius(d),
|
13259 | outerRadius = _$$$getRadius2.outerRadius;
|
13260 |
|
13261 | return hasMultiArcGauge ? state.radius - singleArcWidth * d.index : outerRadius;
|
13262 | }),
|
13263 | newArc = function (d, withoutUpdate) {
|
13264 | var path = "M 0 0";
|
13265 |
|
13266 | if (d.value || d.data) {
|
13267 | var updated = !withoutUpdate && $$.updateAngle(d);
|
13268 | withoutUpdate ? path = arc(d) : updated && (path = arc(updated));
|
13269 | }
|
13270 |
|
13271 | return path;
|
13272 | };
|
13273 |
|
13274 | return newArc.centroid = arc.centroid, newArc;
|
13275 | },
|
13276 | getSvgArcExpanded: function getSvgArcExpanded(rate) {
|
13277 | var $$ = this,
|
13278 | state = $$.state,
|
13279 | newRate = rate || 1,
|
13280 | singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
13281 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
13282 | expandWidth = Math.min(state.radiusExpanded * newRate - state.radius, singleArcWidth * .8 - (1 - newRate) * 100),
|
13283 | arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
13284 | return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : $$.getRadius(d).innerRadius;
|
13285 | }).outerRadius(function (d) {
|
13286 | var radius;
|
13287 | if (hasMultiArcGauge) radius = state.radius - singleArcWidth * d.index + expandWidth;else {
|
13288 | var _$$$getRadius3 = $$.getRadius(d),
|
13289 | outerRadius = _$$$getRadius3.outerRadius,
|
13290 | radiusExpanded = state.radiusExpanded;
|
13291 |
|
13292 | state.radius !== outerRadius && (radiusExpanded -= Math.abs(state.radius - outerRadius)), radius = radiusExpanded * newRate;
|
13293 | }
|
13294 | return radius;
|
13295 | });
|
13296 | return function (d) {
|
13297 | var updated = $$.updateAngle(d);
|
13298 | return updated ? arc(updated) : "M 0 0";
|
13299 | };
|
13300 | },
|
13301 | getArc: function getArc(d, withoutUpdate, force) {
|
13302 | return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
13303 | },
|
13304 | transformForArcLabel: function transformForArcLabel(d) {
|
13305 | var $$ = this,
|
13306 | config = $$.config,
|
13307 | radiusExpanded = $$.state.radiusExpanded,
|
13308 | updated = $$.updateAngle(d),
|
13309 | translate = "";
|
13310 | if (updated) if ($$.hasMultiArcGauge()) {
|
13311 | var y1 = Math.sin(updated.endAngle - Math.PI / 2),
|
13312 | x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + 25),
|
13313 | y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
13314 | translate = "translate(" + x + "," + y + ")";
|
13315 | } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
13316 | var _$$$getRadius4 = $$.getRadius(d),
|
13317 | outerRadius = _$$$getRadius4.outerRadius,
|
13318 | c = this.svgArc.centroid(updated),
|
13319 | x = isNaN(c[0]) ? 0 : c[0],
|
13320 | y = isNaN(c[1]) ? 0 : c[1],
|
13321 | h = Math.sqrt(x * x + y * y),
|
13322 | ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio;
|
13323 |
|
13324 | ratio = ratio ? isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio : outerRadius && (h ? (36 / outerRadius > .375 ? 1.175 - 36 / outerRadius : .8) * outerRadius / h : 0), translate = "translate(" + x * ratio + "," + y * ratio + ")";
|
13325 | }
|
13326 | return translate;
|
13327 | },
|
13328 | convertToArcData: function convertToArcData(d) {
|
13329 | return this.addName({
|
13330 | id: d.data ? d.data.id : d.id,
|
13331 | value: d.value,
|
13332 | ratio: this.getRatio("arc", d),
|
13333 | index: d.index
|
13334 | });
|
13335 | },
|
13336 | textForArcLabel: function textForArcLabel(selection) {
|
13337 | var $$ = this,
|
13338 | hasGauge = $$.hasType("gauge");
|
13339 | $$.shouldShowArcLabel() && selection.style("fill", $$.updateTextColor.bind($$)).each(function (d) {
|
13340 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
13341 | updated = $$.updateAngle(d),
|
13342 | ratio = $$.getRatio("arc", updated),
|
13343 | isUnderThreshold = $$.meetsLabelThreshold(ratio, $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge" || $$.hasType("pie") && "pie");
|
13344 |
|
13345 | if (isUnderThreshold) {
|
13346 | var value = (updated || d).value,
|
13347 | text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
13348 | setTextValue(node, text, [-1, 1], hasGauge);
|
13349 | } else node.text("");
|
13350 | });
|
13351 | },
|
13352 | expandArc: function expandArc(targetIds) {
|
13353 | var $$ = this,
|
13354 | transiting = $$.state.transiting,
|
13355 | $el = $$.$el;
|
13356 |
|
13357 |
|
13358 | if (transiting) {
|
13359 | var interval = setInterval(function () {
|
13360 | transiting || (clearInterval(interval), $el.legend.selectAll("." + config_classes.legendItemFocused).size() > 0 && $$.expandArc(targetIds));
|
13361 | }, 10);
|
13362 | return;
|
13363 | }
|
13364 |
|
13365 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
13366 | $el.svg.selectAll($$.selectorTargets(newTargetIds, "." + config_classes.chartArc)).each(function (d) {
|
13367 | if ($$.shouldExpand(d.data.id)) {
|
13368 | var expandDuration = $$.getExpandConfig(d.data.id, "duration"),
|
13369 | svgArcExpandedSub = $$.getSvgArcExpanded($$.getExpandConfig(d.data.id, "rate"));
|
13370 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).selectAll("path").transition().duration(expandDuration).attr("d", $$.svgArcExpanded).transition().duration(expandDuration * 2).attr("d", svgArcExpandedSub);
|
13371 | }
|
13372 | });
|
13373 | },
|
13374 | unexpandArc: function unexpandArc(targetIds) {
|
13375 | var $$ = this,
|
13376 | transiting = $$.state.transiting,
|
13377 | svg = $$.$el.svg;
|
13378 |
|
13379 | if (!transiting) {
|
13380 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
13381 | svg.selectAll($$.selectorTargets(newTargetIds, "." + config_classes.chartArc)).selectAll("path").transition().duration(function (d) {
|
13382 | return $$.getExpandConfig(d.data.id, "duration");
|
13383 | }).attr("d", $$.svgArc), svg.selectAll("" + config_classes.arc).style("opacity", "1");
|
13384 | }
|
13385 | },
|
13386 |
|
13387 | |
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 |
|
13393 |
|
13394 | getExpandConfig: function getExpandConfig(id, key) {
|
13395 | var type,
|
13396 | $$ = this,
|
13397 | config = $$.config;
|
13398 | return $$.isDonutType(id) ? type = "donut" : $$.isGaugeType(id) ? type = "gauge" : $$.isPieType(id) && (type = "pie"), type ? config[type + "_expand_" + key] : {
|
13399 | duration: 50,
|
13400 | rate: .98
|
13401 | }[key];
|
13402 | },
|
13403 | shouldExpand: function shouldExpand(id) {
|
13404 | var $$ = this,
|
13405 | config = $$.config;
|
13406 | return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
|
13407 | },
|
13408 | shouldShowArcLabel: function shouldShowArcLabel() {
|
13409 | var $$ = this,
|
13410 | config = $$.config;
|
13411 | return ["pie", "donut", "gauge"].some(function (v) {
|
13412 | return $$.hasType(v) && config[v + "_label_show"];
|
13413 | });
|
13414 | },
|
13415 | getArcLabelFormat: function getArcLabelFormat() {
|
13416 | var $$ = this,
|
13417 | config = $$.config,
|
13418 | format = config.pie_label_format;
|
13419 | return $$.hasType("gauge") ? format = config.gauge_label_format : $$.hasType("donut") && (format = config.donut_label_format), isFunction(format) ? format.bind($$.api) : format;
|
13420 | },
|
13421 | getArcTitle: function getArcTitle() {
|
13422 | var $$ = this,
|
13423 | type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
|
13424 | return type ? $$.config[type + "_title"] : "";
|
13425 | },
|
13426 | updateTargetsForArc: function updateTargetsForArc(targets) {
|
13427 | var $$ = this,
|
13428 | $el = $$.$el,
|
13429 | hasGauge = $$.hasType("gauge"),
|
13430 | classChartArc = $$.getChartClass("Arc"),
|
13431 | classArcs = $$.getClass("arcs", !0),
|
13432 | classFocus = $$.classFocus.bind($$),
|
13433 | chartArcs = $el.main.select("." + config_classes.chartArcs),
|
13434 | mainPieUpdate = chartArcs.selectAll("." + config_classes.chartArc).data($$.pie(targets)).attr("class", function (d) {
|
13435 | return classChartArc(d) + classFocus(d.data);
|
13436 | }),
|
13437 | mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc);
|
13438 | 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"), $el.text = chartArcs.selectAll("." + config_classes.target + " text");
|
13439 | },
|
13440 | initArc: function initArc() {
|
13441 | var $$ = this,
|
13442 | $el = $$.$el;
|
13443 | $el.arcs = $el.main.select("." + config_classes.chart).append("g").attr("class", config_classes.chartArcs).attr("transform", $$.getTranslate("arc")), $$.setArcTitle();
|
13444 | },
|
13445 |
|
13446 | |
13447 |
|
13448 |
|
13449 |
|
13450 | setArcTitle: function setArcTitle() {
|
13451 | var $$ = this,
|
13452 | title = $$.getArcTitle(),
|
13453 | hasGauge = $$.hasType("gauge");
|
13454 |
|
13455 | if (title) {
|
13456 | var text = $$.$el.arcs.append("text").attr("class", config_classes[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"]).style("text-anchor", "middle");
|
13457 | hasGauge && text.attr("dy", "-0.3em").style("font-size", "27px"), setTextValue(text, title, hasGauge ? undefined : [-.6, 1.35], !0);
|
13458 | }
|
13459 | },
|
13460 | redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
13461 | var $$ = this,
|
13462 | config = $$.config,
|
13463 | state = $$.state,
|
13464 | main = $$.$el.main,
|
13465 | hasInteraction = config.interaction_enabled,
|
13466 | isSelectable = hasInteraction && config.data_selection_isselectable,
|
13467 | mainArc = main.selectAll("." + config_classes.arcs).selectAll("." + config_classes.arc).data($$.arcData.bind($$));
|
13468 |
|
13469 | mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove(), mainArc = mainArc.enter().append("path").attr("class", $$.getClass("arc", !0)).style("fill", function (d) {
|
13470 | return $$.color(d.data);
|
13471 | }).style("cursor", function (d) {
|
13472 | return isSelectable && isSelectable.bind($$.api)(d) ? "pointer" : null;
|
13473 | }).style("opacity", "0").each(function (d) {
|
13474 | $$.isGaugeType(d.data) && (d.startAngle = config.gauge_startingAngle, d.endAngle = config.gauge_startingAngle), this._current = d;
|
13475 | }).merge(mainArc), $$.hasType("gauge") && ($$.updateGaugeMax(), $$.hasMultiArcGauge() && $$.redrawMultiArcGauge()), mainArc.attr("transform", function (d) {
|
13476 | return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
|
13477 | }).style("opacity", function (d) {
|
13478 | return d === this._current ? "0" : "1";
|
13479 | }).each(function () {
|
13480 | state.transiting = !0;
|
13481 | }).transition().duration(duration).attrTween("d", function (d) {
|
13482 | var updated = $$.updateAngle(d);
|
13483 | if (!updated) return function () {
|
13484 | return "M 0 0";
|
13485 | };
|
13486 | isNaN(this._current.startAngle) && (this._current.startAngle = 0), isNaN(this._current.endAngle) && (this._current.endAngle = this._current.startAngle);
|
13487 | var interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(this._current, updated);
|
13488 | return this._current = interpolate(0), function (t) {
|
13489 | var interpolated = interpolate(t);
|
13490 |
|
13491 | return interpolated.data = d.data, $$.getArc(interpolated, !0);
|
13492 | };
|
13493 | }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
|
13494 | var color;
|
13495 | return $$.levelColor ? (color = $$.levelColor(d.data.values[0].value), config.data_colors[d.data.id] = color) : color = $$.color(d.data), color;
|
13496 | })
|
13497 | .style("opacity", "1").call(endall, function () {
|
13498 | if ($$.levelColor) {
|
13499 | var path = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
13500 | d = path.datum();
|
13501 | $$.updateLegendItemColor(d.data.id, path.style("fill"));
|
13502 | }
|
13503 |
|
13504 | state.transiting = !1, callFn(config.onrendered, $$.api);
|
13505 | }), hasInteraction && $$.bindArcEvent(mainArc), $$.hasType("gauge") && $$.redrawBackgroundArcs(), $$.redrawArcText(duration);
|
13506 | },
|
13507 | redrawBackgroundArcs: function redrawBackgroundArcs() {
|
13508 | var $$ = this,
|
13509 | config = $$.config,
|
13510 | state = $$.state,
|
13511 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
13512 | isFullCircle = config.gauge_fullCircle,
|
13513 | startAngle = $$.getStartAngle(),
|
13514 | endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1,
|
13515 | backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + config_classes.chartArcsBackground);
|
13516 |
|
13517 | if (hasMultiArcGauge) {
|
13518 | var index = 0;
|
13519 | backgroundArc = backgroundArc.selectAll("path." + config_classes.chartArcsBackground).data($$.data.targets), backgroundArc.enter().append("path").attr("class", function (d, i) {
|
13520 | return config_classes.chartArcsBackground + " " + config_classes.chartArcsBackground + "-" + i;
|
13521 | }).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
|
13522 | var id = _ref2.id;
|
13523 | if (state.hiddenTargetIds.indexOf(id) >= 0) return "M 0 0";
|
13524 | var d = {
|
13525 | data: [{
|
13526 | value: config.gauge_max
|
13527 | }],
|
13528 | startAngle: startAngle,
|
13529 | endAngle: endAngle,
|
13530 | index: index++
|
13531 | };
|
13532 | return $$.getArc(d, !0, !0);
|
13533 | }), backgroundArc.exit().remove();
|
13534 | } else backgroundArc.attr("d", function () {
|
13535 | var d = {
|
13536 | data: [{
|
13537 | value: config.gauge_max
|
13538 | }],
|
13539 | startAngle: startAngle,
|
13540 | endAngle: endAngle
|
13541 | };
|
13542 | return $$.getArc(d, !0, !0);
|
13543 | });
|
13544 | },
|
13545 | bindArcEvent: function bindArcEvent(arc) {
|
13546 |
|
13547 | function selectArc(_this, arcData, id) {
|
13548 | $$.expandArc(id), $$.api.focus(id), $$.toggleFocusLegend(id, !0), $$.showTooltip([arcData], _this);
|
13549 | }
|
13550 |
|
13551 |
|
13552 | function unselectArc(arcData) {
|
13553 | var id = arcData && arcData.id || undefined;
|
13554 | $$.unexpandArc(id), $$.api.revert(), $$.revertLegend(), $$.hideTooltip();
|
13555 | }
|
13556 |
|
13557 | var $$ = this,
|
13558 | config = $$.config,
|
13559 | state = $$.state,
|
13560 | isTouch = state.inputType === "touch",
|
13561 | isMouse = state.inputType === "mouse";
|
13562 |
|
13563 |
|
13564 | if (arc.on("click", function (event, d, i) {
|
13565 | var arcData,
|
13566 | updated = $$.updateAngle(d);
|
13567 | updated && (arcData = $$.convertToArcData(updated), $$.toggleShape && $$.toggleShape(this, arcData, i), config.data_onclick.bind($$.api)(arcData, this));
|
13568 | }), isMouse && arc.on("mouseover", function (event, d) {
|
13569 | if (!state.transiting)
|
13570 | {
|
13571 | state.event = event;
|
13572 | var updated = $$.updateAngle(d),
|
13573 | arcData = updated ? $$.convertToArcData(updated) : null,
|
13574 | id = arcData && arcData.id || undefined;
|
13575 | selectArc(this, arcData, id), $$.setOverOut(!0, arcData);
|
13576 | }
|
13577 | }).on("mouseout", function (event, d) {
|
13578 | if (!state.transiting)
|
13579 | {
|
13580 | state.event = event;
|
13581 | var updated = $$.updateAngle(d),
|
13582 | arcData = updated ? $$.convertToArcData(updated) : null;
|
13583 | unselectArc(), $$.setOverOut(!1, arcData);
|
13584 | }
|
13585 | }).on("mousemove", function (event, d) {
|
13586 | var updated = $$.updateAngle(d),
|
13587 | arcData = updated ? $$.convertToArcData(updated) : null;
|
13588 | state.event = event, $$.showTooltip([arcData], this);
|
13589 | }), isTouch && $$.hasArcType() && !$$.radars) {
|
13590 | var getEventArc = function (event) {
|
13591 | var touch = event.changedTouches[0],
|
13592 | eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
|
13593 | return eventArc;
|
13594 | };
|
13595 |
|
13596 | $$.$el.svg.on("touchstart touchmove", function (event) {
|
13597 | if (!state.transiting)
|
13598 | {
|
13599 | var eventArc = getEventArc(event),
|
13600 | datum = eventArc.datum(),
|
13601 | updated = datum && datum.data && datum.data.id ? $$.updateAngle(datum) : null,
|
13602 | arcData = updated ? $$.convertToArcData(updated) : null,
|
13603 | id = arcData && arcData.id || undefined;
|
13604 | $$.callOverOutForTouch(arcData), isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
13605 | }
|
13606 | });
|
13607 | }
|
13608 | },
|
13609 | redrawArcText: function redrawArcText(duration) {
|
13610 | var text,
|
13611 | $$ = this,
|
13612 | config = $$.config,
|
13613 | state = $$.state,
|
13614 | _$$$$el = $$.$el,
|
13615 | main = _$$$$el.main,
|
13616 | arcs = _$$$$el.arcs,
|
13617 | hasGauge = $$.hasType("gauge"),
|
13618 | hasMultiArcGauge = $$.hasMultiArcGauge();
|
13619 |
|
13620 | if (hasGauge && $$.data.targets.length === 1 && config.gauge_title || (text = main.selectAll("." + config_classes.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
|
13621 | return $$.isGaugeType(d.data) ? config_classes.gaugeValue : null;
|
13622 | }).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
|
13623 | return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
|
13624 | }).transition().duration(duration).style("opacity", function (d) {
|
13625 | return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? "1" : "0";
|
13626 | }), hasMultiArcGauge && text.attr("dy", "-.1em")), main.select("." + config_classes.chartArcsTitle).style("opacity", $$.hasType("donut") || hasGauge ? "1" : "0"), hasGauge) {
|
13627 | var isFullCircle = config.gauge_fullCircle;
|
13628 | isFullCircle && text && text.attr("dy", "" + (hasMultiArcGauge ? 0 : Math.round(state.radius / 14))), config.gauge_label_show && (arcs.select("." + config_classes.chartArcsGaugeUnit).attr("dy", (isFullCircle ? 1.5 : .75) + "em").text(config.gauge_units), arcs.select("." + config_classes.chartArcsGaugeMin).attr("dx", -1 * (state.innerRadius + (state.radius - state.innerRadius) / (isFullCircle ? 1 : 2)) + "px").attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_min, !1)), !isFullCircle && arcs.select("." + config_classes.chartArcsGaugeMax).attr("dx", state.innerRadius + (state.radius - state.innerRadius) / 2 + "px").attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0)));
|
13629 | }
|
13630 | }
|
13631 | });
|
13632 | ;
|
13633 |
|
13634 |
|
13635 |
|
13636 |
|
13637 |
|
13638 |
|
13639 |
|
13640 |
|
13641 | var shape_area = ({
|
13642 | initArea: function initArea(mainLine) {
|
13643 | var $$ = this,
|
13644 | config = $$.config;
|
13645 | mainLine.insert("g", "." + config_classes[config.area_front ? "circles" : "lines"]).attr("class", $$.getClass("areas", !0));
|
13646 | },
|
13647 | updateAreaGradient: function updateAreaGradient() {
|
13648 | var $$ = this,
|
13649 | config = $$.config,
|
13650 | datetimeId = $$.state.datetimeId,
|
13651 | defs = $$.$el.defs;
|
13652 | $$.data.targets.forEach(function (d) {
|
13653 | var id = datetimeId + "-areaGradient" + $$.getTargetSelectorSuffix(d.id);
|
13654 |
|
13655 | if ($$.isAreaType(d) && defs.select("#" + id).empty()) {
|
13656 | var color = $$.color(d),
|
13657 | _config$area_linearGr = config.area_linearGradient,
|
13658 | _config$area_linearGr2 = _config$area_linearGr.x,
|
13659 | x = _config$area_linearGr2 === void 0 ? [0, 0] : _config$area_linearGr2,
|
13660 | _config$area_linearGr3 = _config$area_linearGr.y,
|
13661 | y = _config$area_linearGr3 === void 0 ? [0, 1] : _config$area_linearGr3,
|
13662 | _config$area_linearGr4 = _config$area_linearGr.stops,
|
13663 | stops = _config$area_linearGr4 === void 0 ? [[0, color, 1], [1, color, 0]] : _config$area_linearGr4,
|
13664 | linearGradient = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
13665 | stops.forEach(function (v) {
|
13666 | var stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
|
13667 | linearGradient.append("stop").attr("offset", v[0]).attr("stop-color", stopColor || color).attr("stop-opacity", v[2]);
|
13668 | });
|
13669 | }
|
13670 | });
|
13671 | },
|
13672 | updateAreaColor: function updateAreaColor(d) {
|
13673 | var $$ = this;
|
13674 | return $$.config.area_linearGradient ? "url(#" + $$.state.datetimeId + "-areaGradient" + $$.getTargetSelectorSuffix(d.id) + ")" : $$.color(d);
|
13675 | },
|
13676 |
|
13677 | |
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 | updateArea: function updateArea(durationForExit, isSub) {
|
13684 | isSub === void 0 && (isSub = !1);
|
13685 | var $$ = this,
|
13686 | config = $$.config,
|
13687 | state = $$.state,
|
13688 | $el = $$.$el,
|
13689 | $root = isSub ? $el.subchart : $el;
|
13690 | config.area_linearGradient && $$.updateAreaGradient();
|
13691 | var area = $root.main.selectAll("." + config_classes.areas).selectAll("." + config_classes.area).data($$.lineData.bind($$));
|
13692 | area.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $root.area = area.enter().append("path").attr("class", $$.getClass("area", !0)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () {
|
13693 | return state.orgAreaOpacity = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).style("opacity"), "0";
|
13694 | }).merge(area), area.style("opacity", state.orgAreaOpacity);
|
13695 | },
|
13696 |
|
13697 | |
13698 |
|
13699 |
|
13700 |
|
13701 |
|
13702 |
|
13703 |
|
13704 | redrawArea: function redrawArea(drawFn, withTransition, isSub) {
|
13705 | isSub === void 0 && (isSub = !1);
|
13706 |
|
13707 | var $$ = this,
|
13708 | _ref = isSub ? this.$el.subchart : this.$el,
|
13709 | area = _ref.area,
|
13710 | orgAreaOpacity = $$.state.orgAreaOpacity;
|
13711 |
|
13712 | return [(withTransition ? area.transition(getRandom()) : area).attr("d", drawFn).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function (d) {
|
13713 | return ($$.isAreaRangeType(d) ? orgAreaOpacity / 1.75 : orgAreaOpacity) + "";
|
13714 | })];
|
13715 | },
|
13716 |
|
13717 | |
13718 |
|
13719 |
|
13720 |
|
13721 |
|
13722 |
|
13723 |
|
13724 | generateDrawArea: function generateDrawArea(areaIndices, isSub) {
|
13725 | var $$ = this,
|
13726 | config = $$.config,
|
13727 | lineConnectNull = config.line_connectNull,
|
13728 | isRotated = config.axis_rotated,
|
13729 | getPoints = $$.generateGetAreaPoints(areaIndices, isSub),
|
13730 | yScale = $$.getYScaleById.bind($$),
|
13731 | xValue = function (d) {
|
13732 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
13733 | },
|
13734 | value0 = function (d, i) {
|
13735 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : $$.getShapeYMin(d.id));
|
13736 | },
|
13737 | value1 = function (d, i) {
|
13738 | return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d.value);
|
13739 | };
|
13740 |
|
13741 | return function (d) {
|
13742 | var path,
|
13743 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
13744 | x0 = 0,
|
13745 | y0 = 0;
|
13746 |
|
13747 | if ($$.isAreaType(d)) {
|
13748 | var area = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.area)();
|
13749 | area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue)
|
13750 | .y0(config.area_above ? 0 : value0).y1(value1), lineConnectNull || (area = area.defined(function (d) {
|
13751 | return $$.getBaseValue(d) !== null;
|
13752 | })), $$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = area.curve($$.getCurve(d))(values);
|
13753 | } else values[0] && (x0 = $$.scale.x(values[0].x), y0 = $$.getYScaleById(d.id)(values[0].value)), path = isRotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0;
|
13754 |
|
13755 | return path || "M 0 0";
|
13756 | };
|
13757 | },
|
13758 | generateGetAreaPoints: function generateGetAreaPoints(areaIndices, isSub) {
|
13759 |
|
13760 | var $$ = this,
|
13761 | config = $$.config,
|
13762 | x = $$.getShapeX(0, areaIndices, isSub),
|
13763 | y = $$.getShapeY(!!isSub),
|
13764 | areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, isSub),
|
13765 | yScale = $$.getYScaleById.bind($$);
|
13766 | return function (d, i) {
|
13767 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
13768 | offset = areaOffset(d, i) || y0,
|
13769 | posX = x(d),
|
13770 | posY = y(d);
|
13771 |
|
13772 | 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)],
|
13773 | [posX, offset]
|
13774 | ];
|
13775 | };
|
13776 | }
|
13777 | });
|
13778 | ;
|
13779 |
|
13780 |
|
13781 |
|
13782 |
|
13783 |
|
13784 |
|
13785 | var bar = ({
|
13786 | initBar: function initBar() {
|
13787 | var $el = this.$el;
|
13788 | $el.bar = $el.main.select("." + config_classes.chart)
|
13789 | .insert("g", ":first-child").attr("class", config_classes.chartBars);
|
13790 | },
|
13791 | updateTargetsForBar: function updateTargetsForBar(targets) {
|
13792 | var $$ = this,
|
13793 | config = $$.config,
|
13794 | $el = $$.$el,
|
13795 | classChartBar = $$.getChartClass("Bar"),
|
13796 | classBars = $$.getClass("bars", !0),
|
13797 | classFocus = $$.classFocus.bind($$),
|
13798 | isSelectable = config.interaction_enabled && config.data_selection_isselectable;
|
13799 | $el.bar || $$.initBar();
|
13800 | var mainBarUpdate = $$.$el.main.select("." + config_classes.chartBars).selectAll("." + config_classes.chartBar).data(targets).attr("class", function (d) {
|
13801 | return classChartBar(d) + classFocus(d);
|
13802 | }),
|
13803 | mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", "none");
|
13804 |
|
13805 | mainBarEnter.append("g").attr("class", classBars).style("cursor", function (d) {
|
13806 | return isSelectable && isSelectable.bind($$.api)(d) ? "pointer" : null;
|
13807 | });
|
13808 | },
|
13809 |
|
13810 | |
13811 |
|
13812 |
|
13813 |
|
13814 |
|
13815 |
|
13816 | updateBar: function updateBar(durationForExit, isSub) {
|
13817 | isSub === void 0 && (isSub = !1);
|
13818 | var $$ = this,
|
13819 | $root = isSub ? $$.$el.subchart : $$.$el,
|
13820 | classBar = $$.getClass("bar", !0),
|
13821 | initialOpacity = $$.initialOpacity.bind($$),
|
13822 | bar = $root.main.selectAll("." + config_classes.bars).selectAll("." + config_classes.bar).data($$.labelishData.bind($$));
|
13823 | bar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.color).merge(bar).style("opacity", initialOpacity);
|
13824 | },
|
13825 |
|
13826 | |
13827 |
|
13828 |
|
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 | redrawBar: function redrawBar(drawFn, withTransition, isSub) {
|
13834 | isSub === void 0 && (isSub = !1);
|
13835 |
|
13836 | var _ref = isSub ? this.$el.subchart : this.$el,
|
13837 | bar = _ref.bar;
|
13838 |
|
13839 | return [(withTransition ? bar.transition(getRandom()) : bar).attr("d", drawFn).style("fill", this.color).style("opacity", "1")];
|
13840 | },
|
13841 | getBars: function getBars(i, id) {
|
13842 | var $$ = this,
|
13843 | main = $$.$el.main,
|
13844 | suffix = isValue(i) ? "-" + i : "";
|
13845 | return (id ? main.selectAll("." + config_classes.bars + $$.getTargetSelectorSuffix(id)) : main).selectAll("." + config_classes.bar + suffix);
|
13846 | },
|
13847 | expandBars: function expandBars(i, id, reset) {
|
13848 | var $$ = this;
|
13849 | reset && $$.unexpandBars(), $$.getBars(i, id).classed(config_classes.EXPANDED, !0);
|
13850 | },
|
13851 | unexpandBars: function unexpandBars(i) {
|
13852 | this.getBars(i).classed(config_classes.EXPANDED, !1);
|
13853 | },
|
13854 | generateDrawBar: function generateDrawBar(barIndices, isSub) {
|
13855 | var $$ = this,
|
13856 | config = $$.config,
|
13857 | getPoints = $$.generateGetBarPoints(barIndices, isSub),
|
13858 | isRotated = config.axis_rotated,
|
13859 | isGrouped = config.data_groups.length,
|
13860 | barRadius = config.bar_radius,
|
13861 | barRadiusRatio = config.bar_radius_ratio,
|
13862 | getRadius = isNumber(barRadius) && barRadius > 0 ? function () {
|
13863 | return barRadius;
|
13864 | } : isNumber(barRadiusRatio) ? function (w) {
|
13865 | return w * barRadiusRatio;
|
13866 | } : null;
|
13867 | return function (d, i) {
|
13868 |
|
13869 | var points = getPoints(d, i),
|
13870 | indexX = +isRotated,
|
13871 | indexY = +!indexX,
|
13872 | isNegative = d.value < 0,
|
13873 | pathRadius = ["", ""],
|
13874 | radius = 0;
|
13875 |
|
13876 | if (getRadius && !isGrouped) {
|
13877 | var index = isRotated ? indexY : indexX,
|
13878 | barW = points[2][index] - points[0][index];
|
13879 | radius = getRadius(barW);
|
13880 | var arc = "a" + radius + "," + radius + " " + (isNegative ? "1 0 0" : "0 0 1") + " ";
|
13881 | pathRadius[+!isRotated] = "" + arc + radius + "," + radius, pathRadius[+isRotated] = "" + arc + [-radius, radius][isRotated ? "sort" : "reverse"](), isNegative && pathRadius.reverse();
|
13882 | }
|
13883 |
|
13884 |
|
13885 |
|
13886 | var path = isRotated ? "H" + (points[1][indexX] - radius) + " " + pathRadius[0] + "V" + (points[2][indexY] - radius) + " " + pathRadius[1] + "H" + points[3][indexX] : "V" + (points[1][indexY] + (isNegative ? -radius : radius)) + " " + pathRadius[0] + "H" + (points[2][indexX] - radius) + " " + pathRadius[1] + "V" + points[3][indexY];
|
13887 | return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
|
13888 | };
|
13889 | },
|
13890 | generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) {
|
13891 | var $$ = this,
|
13892 | config = $$.config,
|
13893 | axis = isSub ? $$.axis.subX : $$.axis.x,
|
13894 | barTargetsNum = $$.getIndicesMax(barIndices) + 1,
|
13895 | barW = $$.getBarW("bar", axis, barTargetsNum),
|
13896 | barX = $$.getShapeX(barW, barIndices, !!isSub),
|
13897 | barY = $$.getShapeY(!!isSub),
|
13898 | barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),
|
13899 | yScale = $$.getYScaleById.bind($$);
|
13900 | return function (d, i) {
|
13901 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
13902 | offset = barOffset(d, i) || y0,
|
13903 | width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
13904 | posX = barX(d),
|
13905 | posY = barY(d);
|
13906 | config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0), posY -= y0 - offset;
|
13907 | var startPosX = posX + width;
|
13908 |
|
13909 | return [[posX, offset], [posX, posY], [startPosX, posY], [startPosX, offset]];
|
13910 | };
|
13911 | },
|
13912 | isWithinBar: function isWithinBar(that) {
|
13913 | var mouse = getPointer(this.state.event, that),
|
13914 | list = getRectSegList(that),
|
13915 | _list = list,
|
13916 | seg0 = _list[0],
|
13917 | seg1 = _list[1],
|
13918 | x = Math.min(seg0.x, seg1.x),
|
13919 | y = Math.min(seg0.y, seg1.y),
|
13920 | offset = this.config.bar_sensitivity,
|
13921 | _that$getBBox = that.getBBox(),
|
13922 | width = _that$getBBox.width,
|
13923 | height = _that$getBBox.height,
|
13924 | isWithin = x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
|
13925 |
|
13926 | return isWithin;
|
13927 | }
|
13928 | });
|
13929 | ;
|
13930 |
|
13931 |
|
13932 | function candlestick_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13933 |
|
13934 | function candlestick_objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = arguments[i] == null ? {} : arguments[i], i % 2 ? candlestick_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : candlestick_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
13935 |
|
13936 |
|
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 |
|
13942 |
|
13943 | var candlestick = ({
|
13944 | initCandlestick: function initCandlestick() {
|
13945 | var $el = this.$el;
|
13946 | $el.candlestick = $el.main.select("." + config_classes.chart)
|
13947 | .append("g").attr("class", config_classes.chartCandlesticks);
|
13948 | },
|
13949 |
|
13950 | |
13951 |
|
13952 |
|
13953 |
|
13954 |
|
13955 |
|
13956 | updateTargetsForCandlestick: function updateTargetsForCandlestick(targets) {
|
13957 | var $$ = this,
|
13958 | $el = $$.$el,
|
13959 | classChart = $$.getChartClass("Candlestick"),
|
13960 | classFocus = $$.classFocus.bind($$);
|
13961 | $el.candlestick || $$.initCandlestick();
|
13962 | var mainUpdate = $$.$el.main.select("." + config_classes.chartCandlesticks).selectAll("." + config_classes.chartCandlestick).data(targets).attr("class", function (d) {
|
13963 | return classChart(d) + classFocus(d);
|
13964 | });
|
13965 | mainUpdate.enter().append("g").attr("class", classChart).style("pointer-events", "none");
|
13966 | },
|
13967 |
|
13968 | |
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 |
|
13974 | updateCandlestick: function updateCandlestick(durationForExit, isSub) {
|
13975 | isSub === void 0 && (isSub = !1);
|
13976 | var $$ = this,
|
13977 | $el = $$.$el,
|
13978 | $root = isSub ? $el.subchart : $el,
|
13979 | classSetter = $$.getClass("candlestick", !0),
|
13980 | initialOpacity = $$.initialOpacity.bind($$),
|
13981 | candlestick = $root.main.selectAll("." + config_classes.chartCandlestick).selectAll("." + config_classes.candlestick).data($$.labelishData.bind($$));
|
13982 | candlestick.exit().transition().duration(durationForExit).style("opacity", "0").remove();
|
13983 | var candlestickEnter = candlestick.enter().filter(function (d) {
|
13984 | return d.value;
|
13985 | }).append("g").attr("class", classSetter);
|
13986 | candlestickEnter.append("line"), candlestickEnter.append("path"), $root.candlestick || ($root.candlestick = {}), $root.candlestick = candlestick.merge(candlestickEnter).style("opacity", initialOpacity);
|
13987 | },
|
13988 |
|
13989 | |
13990 |
|
13991 |
|
13992 |
|
13993 |
|
13994 |
|
13995 |
|
13996 | generateDrawCandlestick: function generateDrawCandlestick(indices, isSub) {
|
13997 | var $$ = this,
|
13998 | config = $$.config,
|
13999 | getPoints = $$.generateGetCandlestickPoints(indices, isSub),
|
14000 | isRotated = config.axis_rotated,
|
14001 | downColor = config.candlestick_color_down;
|
14002 | return function (d, i, g) {
|
14003 | var _value,
|
14004 | points = getPoints(d, i),
|
14005 | value = $$.getCandlestickData(d),
|
14006 | isUp = (_value = value) == null ? void 0 : _value._isUp,
|
14007 | indexX = +isRotated;
|
14008 |
|
14009 | g.classed && g.classed(config_classes[isUp ? "valueUp" : "valueDown"], !0);
|
14010 | var path = isRotated ? "H" + points[1][1] + " V" + points[1][0] + " H" + points[0][1] : "V" + points[1][1] + " H" + points[1][0] + " V" + points[0][1];
|
14011 | g.select("path").attr("d", "M" + points[0][indexX] + "," + points[0][+!indexX] + path + "z").style("fill", function (d) {
|
14012 | var color = isUp ? $$.color(d) : isObject(downColor) ? downColor[d.id] : downColor;
|
14013 | return color || $$.color(d);
|
14014 | });
|
14015 |
|
14016 | var line = g.select("line"),
|
14017 | pos = isRotated ? {
|
14018 | x1: points[2][1],
|
14019 | x2: points[2][2],
|
14020 | y1: points[2][0],
|
14021 | y2: points[2][0]
|
14022 | } : {
|
14023 | x1: points[2][0],
|
14024 | x2: points[2][0],
|
14025 | y1: points[2][1],
|
14026 | y2: points[2][2]
|
14027 | };
|
14028 |
|
14029 | for (var x in pos) line.attr(x, pos[x]);
|
14030 | };
|
14031 | },
|
14032 |
|
14033 | |
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 | generateGetCandlestickPoints: function generateGetCandlestickPoints(indices, isSub) {
|
14040 | isSub === void 0 && (isSub = !1);
|
14041 | var $$ = this,
|
14042 | config = $$.config,
|
14043 | axis = isSub ? $$.axis.subX : $$.axis.x,
|
14044 | targetsNum = $$.getIndicesMax(indices) + 1,
|
14045 | barW = $$.getBarW("candlestick", axis, targetsNum),
|
14046 | x = $$.getShapeX(barW, indices, !!isSub),
|
14047 | y = $$.getShapeY(!!isSub),
|
14048 | shapeOffset = $$.getShapeOffset($$.isBarType, indices, !!isSub),
|
14049 | yScale = $$.getYScaleById.bind($$);
|
14050 | return function (d, i) {
|
14051 | var points,
|
14052 | y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
14053 | offset = shapeOffset(d, i) || y0,
|
14054 | width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
14055 | value = $$.getCandlestickData(d);
|
14056 |
|
14057 | if (value) {
|
14058 | var posX = {
|
14059 | start: x(d),
|
14060 | end: 0
|
14061 | };
|
14062 | posX.end = posX.start + width;
|
14063 | var posY = {
|
14064 | start: y(value.open),
|
14065 | end: y(value.close)
|
14066 | },
|
14067 | posLine = {
|
14068 | x: posX.start + width / 2,
|
14069 | high: y(value.high),
|
14070 | low: y(value.low)
|
14071 | };
|
14072 | config.axis_rotated && (d.value > 0 && posY.start < y0 || d.value < 0 && y0 < posY.start) && (posY.start = y0), posY.start -= y0 - offset, points = [[posX.start, posY.start], [posX.end, posY.end], [posLine.x, posLine.low, posLine.high]];
|
14073 | } else points = [[0, 0], [0, 0], [0, 0, 0]];
|
14074 |
|
14075 | return points;
|
14076 | };
|
14077 | },
|
14078 |
|
14079 | |
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 | redrawCandlestick: function redrawCandlestick(drawFn, withTransition, isSub) {
|
14087 | isSub === void 0 && (isSub = !1);
|
14088 |
|
14089 | var _ref = isSub ? this.$el.subchart : this.$el,
|
14090 | candlestick = _ref.candlestick,
|
14091 | rand = getRandom(!0);
|
14092 |
|
14093 | return [candlestick.each(function (d, i) {
|
14094 | var g = withTransition ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).transition(rand) : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
14095 | drawFn(d, i, g);
|
14096 | }).style("opacity", "1")];
|
14097 | },
|
14098 |
|
14099 | |
14100 |
|
14101 |
|
14102 |
|
14103 |
|
14104 |
|
14105 |
|
14106 | getCandlestickData: function getCandlestickData(_ref2) {
|
14107 | var d,
|
14108 | value = _ref2.value;
|
14109 |
|
14110 | if (isArray(value)) {
|
14111 | var open = value[0],
|
14112 | high = value[1],
|
14113 | low = value[2],
|
14114 | close = value[3],
|
14115 | _value$ = value[4],
|
14116 | volume = _value$ !== void 0 && _value$;
|
14117 | d = {
|
14118 | open: open,
|
14119 | high: high,
|
14120 | low: low,
|
14121 | close: close
|
14122 | }, volume !== !1 && (d.volume = volume);
|
14123 | } else isObject(value) && (d = candlestick_objectSpread({}, value));
|
14124 |
|
14125 | return d && (d._isUp = d.close >= d.open), d || null;
|
14126 | }
|
14127 | });
|
14128 | ;
|
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 | var gauge = ({
|
14137 | initGauge: function initGauge() {
|
14138 | var $$ = this,
|
14139 | config = $$.config,
|
14140 | arcs = $$.$el.arcs,
|
14141 | appendText = function (className) {
|
14142 | arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none");
|
14143 | };
|
14144 |
|
14145 | if ($$.hasType("gauge")) {
|
14146 | var hasMulti = $$.hasMultiArcGauge();
|
14147 | arcs.append(hasMulti ? "g" : "path").attr("class", config_classes.chartArcsBackground).style("fill", !hasMulti && config.gauge_background || null), config.gauge_units && appendText(config_classes.chartArcsGaugeUnit), config.gauge_label_show && (appendText(config_classes.chartArcsGaugeMin), !config.gauge_fullCircle && appendText(config_classes.chartArcsGaugeMax));
|
14148 | }
|
14149 | },
|
14150 | updateGaugeMax: function updateGaugeMax() {
|
14151 | var $$ = this,
|
14152 | config = $$.config,
|
14153 | state = $$.state,
|
14154 | hasMultiGauge = $$.hasMultiArcGauge(),
|
14155 | max = hasMultiGauge ? $$.getMinMaxData().max[0].value : $$.getTotalDataSum(state.rendered);
|
14156 | max > config.gauge_max && (config.gauge_max = max);
|
14157 | },
|
14158 | redrawMultiArcGauge: function redrawMultiArcGauge() {
|
14159 | var $$ = this,
|
14160 | config = $$.config,
|
14161 | state = $$.state,
|
14162 | $el = $$.$el,
|
14163 | hiddenTargetIds = $$.state.hiddenTargetIds,
|
14164 | arcLabelLines = $el.main.selectAll("." + config_classes.arcs).selectAll("." + config_classes.arcLabelLine).data($$.arcData.bind($$)),
|
14165 | mainArcLabelLine = arcLabelLines.enter().append("rect").attr("class", function (d) {
|
14166 | return config_classes.arcLabelLine + " " + config_classes.target + " " + config_classes.target + "-" + d.data.id;
|
14167 | }).merge(arcLabelLines);
|
14168 | mainArcLabelLine.style("fill", function (d) {
|
14169 | return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data);
|
14170 | }).style("display", config.gauge_label_show ? "" : "none").each(function (d) {
|
14171 | var lineLength = 0,
|
14172 | lineThickness = 2,
|
14173 | x = 0,
|
14174 | y = 0,
|
14175 | transform = "";
|
14176 |
|
14177 | if (hiddenTargetIds.indexOf(d.data.id) < 0) {
|
14178 | var updated = $$.updateAngle(d),
|
14179 | innerLineLength = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length * (updated.index + 1),
|
14180 | lineAngle = updated.endAngle - Math.PI / 2,
|
14181 | arcInnerRadius = state.radius - innerLineLength,
|
14182 | linePositioningAngle = lineAngle - (arcInnerRadius === 0 ? 0 : 1 / arcInnerRadius);
|
14183 | lineLength = state.radiusExpanded - state.radius + innerLineLength, x = Math.cos(linePositioningAngle) * arcInnerRadius, y = Math.sin(linePositioningAngle) * arcInnerRadius, transform = "rotate(" + lineAngle * 180 / Math.PI + ", " + x + ", " + y + ")";
|
14184 | }
|
14185 |
|
14186 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr("x", x).attr("y", y).attr("width", lineLength).attr("height", lineThickness).attr("transform", transform).style("stroke-dasharray", "0, " + (lineLength + lineThickness) + ", 0");
|
14187 | });
|
14188 | },
|
14189 | textForGaugeMinMax: function textForGaugeMinMax(value, isMax) {
|
14190 | var $$ = this,
|
14191 | config = $$.config,
|
14192 | format = config.gauge_label_extents;
|
14193 | return isFunction(format) ? format.bind($$.api)(value, isMax) : value;
|
14194 | },
|
14195 | getGaugeLabelHeight: function getGaugeLabelHeight() {
|
14196 | var config = this.config;
|
14197 | return this.config.gauge_label_show && !config.gauge_fullCircle ? 20 : 0;
|
14198 | },
|
14199 | getPaddingBottomForGauge: function getPaddingBottomForGauge() {
|
14200 | var $$ = this;
|
14201 | return $$.getGaugeLabelHeight() * ($$.config.gauge_label_show ? 2 : 2.5);
|
14202 | }
|
14203 | });
|
14204 | ;
|
14205 |
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 |
|
14211 | var bubble = ({
|
14212 | |
14213 |
|
14214 |
|
14215 |
|
14216 | initBubble: function initBubble() {
|
14217 | var $$ = this,
|
14218 | config = $$.config;
|
14219 | $$.hasType("bubble") && (config.point_show = !0, config.point_type = "circle", config.point_sensitivity = 25);
|
14220 | },
|
14221 |
|
14222 | |
14223 |
|
14224 |
|
14225 |
|
14226 |
|
14227 | getBaseLength: function getBaseLength() {
|
14228 | var $$ = this,
|
14229 | _$$$state = $$.state,
|
14230 | width = _$$$state.width,
|
14231 | height = _$$$state.height,
|
14232 | cacheKey = KEY.bubbleBaseLength,
|
14233 | baseLength = $$.cache.get(cacheKey);
|
14234 | return baseLength || $$.cache.add(cacheKey, baseLength = getMinMax("min", [width, height])), baseLength;
|
14235 | },
|
14236 |
|
14237 | |
14238 |
|
14239 |
|
14240 |
|
14241 |
|
14242 |
|
14243 | getBubbleR: function getBubbleR(d) {
|
14244 | var $$ = this,
|
14245 | maxR = $$.config.bubble_maxR;
|
14246 | isFunction(maxR) ? maxR = maxR.bind($$.api)(d) : !isNumber(maxR) && (maxR = $$.getBaseLength() / ($$.getMaxDataCount() * 2) + 12);
|
14247 | var max = getMinMax("max", $$.getMinMaxData().max.map(function (d) {
|
14248 | return $$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "y") : isObject(d.value) ? d.value.mid : d.value;
|
14249 | })),
|
14250 | maxArea = maxR * maxR * Math.PI,
|
14251 | area = ($$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "z") : d.value) * (maxArea / max);
|
14252 | return Math.sqrt(area / Math.PI);
|
14253 | },
|
14254 |
|
14255 | |
14256 |
|
14257 |
|
14258 |
|
14259 |
|
14260 |
|
14261 |
|
14262 | getBubbleZData: function getBubbleZData(d, type) {
|
14263 | return isObject(d) ? d[type] : d[type === "y" ? 0 : 1];
|
14264 | }
|
14265 | });
|
14266 | ;
|
14267 |
|
14268 |
|
14269 |
|
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 |
|
14275 | var line = ({
|
14276 | initLine: function initLine() {
|
14277 | var $el = this.$el;
|
14278 | $el.line = $el.main.select("." + config_classes.chart).append("g").attr("class", config_classes.chartLines);
|
14279 | },
|
14280 | updateTargetsForLine: function updateTargetsForLine(t) {
|
14281 | var $$ = this,
|
14282 | _$$$$el = $$.$el,
|
14283 | area = _$$$$el.area,
|
14284 | line = _$$$$el.line,
|
14285 | main = _$$$$el.main,
|
14286 | classChartLine = $$.getChartClass("Line"),
|
14287 | classLines = $$.getClass("lines", !0),
|
14288 | classFocus = $$.classFocus.bind($$);
|
14289 | line || $$.initLine();
|
14290 | var targets = t.filter(function (d) {
|
14291 | return !($$.isScatterType(d) || $$.isBubbleType(d));
|
14292 | }),
|
14293 | mainLineUpdate = main.select("." + config_classes.chartLines).selectAll("." + config_classes.chartLine).data(targets).attr("class", function (d) {
|
14294 | return classChartLine(d) + classFocus(d);
|
14295 | }),
|
14296 | mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", "none");
|
14297 |
|
14298 | mainLineEnter.append("g").attr("class", classLines), $$.hasTypeOf("Area") && $$.initArea(!area && mainLineEnter.empty() ? mainLineUpdate : mainLineEnter), $$.updateTargetForCircle(targets, mainLineEnter);
|
14299 | },
|
14300 |
|
14301 | |
14302 |
|
14303 |
|
14304 |
|
14305 |
|
14306 |
|
14307 | updateLine: function updateLine(durationForExit, isSub) {
|
14308 | isSub === void 0 && (isSub = !1);
|
14309 | var $$ = this,
|
14310 | extraLineClasses = $$.format.extraLineClasses,
|
14311 | $el = $$.$el,
|
14312 | $root = isSub ? $el.subchart : $el,
|
14313 | line = $root.main.selectAll("." + config_classes.lines).selectAll("." + config_classes.line).data($$.lineData.bind($$));
|
14314 | line.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $root.line = line.enter().append("path").attr("class", function (d) {
|
14315 | return $$.getClass("line", !0)(d) + " " + (extraLineClasses(d) || "");
|
14316 | }).style("stroke", $$.color).merge(line).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) {
|
14317 | return $$.isStepType(d) ? "crispEdges" : "";
|
14318 | }).attr("transform", null);
|
14319 | },
|
14320 |
|
14321 | |
14322 |
|
14323 |
|
14324 |
|
14325 |
|
14326 |
|
14327 |
|
14328 | redrawLine: function redrawLine(drawFn, withTransition, isSub) {
|
14329 | isSub === void 0 && (isSub = !1);
|
14330 |
|
14331 | var _ref = isSub ? this.$el.subchart : this.$el,
|
14332 | line = _ref.line;
|
14333 |
|
14334 | return [(withTransition ? line.transition(getRandom()) : line).attr("d", drawFn).style("stroke", this.color).style("opacity", "1")];
|
14335 | },
|
14336 |
|
14337 | |
14338 |
|
14339 |
|
14340 |
|
14341 |
|
14342 |
|
14343 | getCurve: function getCurve(d) {
|
14344 | var $$ = this,
|
14345 | isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d);
|
14346 |
|
14347 |
|
14348 | return isRotatedStepType ? function (context) {
|
14349 | var step = $$.getInterpolate(d)(context);
|
14350 |
|
14351 | return step.orgPoint = step.point, step.pointRotated = function (x, y) {
|
14352 | this._point === 1 && (this._point = 2);
|
14353 | var y1 = this._y * (1 - this._t) + y * this._t;
|
14354 | this._context.lineTo(this._x, y1), this._context.lineTo(x, y1), this._x = x, this._y = y;
|
14355 | }, step.point = function (x, y) {
|
14356 | this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
|
14357 | }, step;
|
14358 | } : $$.getInterpolate(d);
|
14359 | },
|
14360 | generateDrawLine: function generateDrawLine(lineIndices, isSub) {
|
14361 | var $$ = this,
|
14362 | config = $$.config,
|
14363 | scale = $$.scale,
|
14364 | lineConnectNull = config.line_connectNull,
|
14365 | isRotated = config.axis_rotated,
|
14366 | getPoints = $$.generateGetLinePoints(lineIndices, isSub),
|
14367 | yScale = $$.getYScaleById.bind($$),
|
14368 | xValue = function (d) {
|
14369 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
14370 | },
|
14371 | yValue = function (d, i) {
|
14372 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.getBaseValue(d));
|
14373 | },
|
14374 | line = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.line)();
|
14375 |
|
14376 | line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue), lineConnectNull || (line = line.defined(function (d) {
|
14377 | return $$.getBaseValue(d) !== null;
|
14378 | }));
|
14379 | var x = isSub ? scale.subX : scale.x;
|
14380 | return function (d) {
|
14381 | var path,
|
14382 | y = yScale(d.id, isSub),
|
14383 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
14384 | x0 = 0,
|
14385 | y0 = 0;
|
14386 |
|
14387 | if ($$.isLineType(d)) {
|
14388 | var regions = config.data_regions[d.id];
|
14389 | regions ? path = $$.lineWithRegions(values, x, y, regions) : ($$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = line.curve($$.getCurve(d))(values));
|
14390 | } else values[0] && (x0 = x(values[0].x), y0 = y(values[0].value)), path = isRotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0;
|
14391 |
|
14392 | return path || "M 0 0";
|
14393 | };
|
14394 | },
|
14395 | lineWithRegions: function lineWithRegions(d, x, y, _regions) {
|
14396 | var xp,
|
14397 | yp,
|
14398 | diff,
|
14399 | diffx2,
|
14400 | $$ = this,
|
14401 | config = $$.config,
|
14402 | isRotated = config.axis_rotated,
|
14403 | isTimeSeries = $$.axis.isTimeSeries(),
|
14404 | xOffset = $$.axis.isCategorized() ? .5 : 0,
|
14405 | regions = [],
|
14406 | dasharray = "2 2",
|
14407 | isWithinRegions = function (withinX, withinRegions) {
|
14408 | for (var reg, i = 0; reg = withinRegions[i]; i++) if (reg.start < withinX && withinX <= reg.end) return reg.style;
|
14409 |
|
14410 | return !1;
|
14411 | };
|
14412 |
|
14413 |
|
14414 | if (isDefined(_regions)) {
|
14415 | var getValue = function (v, def) {
|
14416 | return isUndefined(v) ? def : isTimeSeries ? parseDate.call($$, v) : v;
|
14417 | };
|
14418 |
|
14419 | for (var reg, i = 0; reg = _regions[i]; i++) {
|
14420 | var start = getValue(reg.start, d[0].x),
|
14421 | end = getValue(reg.end, d[d.length - 1].x),
|
14422 | style = reg.style || {
|
14423 | dasharray: dasharray
|
14424 | };
|
14425 | regions[i] = {
|
14426 | start: start,
|
14427 | end: end,
|
14428 | style: style
|
14429 | };
|
14430 | }
|
14431 | }
|
14432 |
|
14433 |
|
14434 | var xValue = isRotated ? function (dt) {
|
14435 | return y(dt.value);
|
14436 | } : function (dt) {
|
14437 | return x(dt.x);
|
14438 | },
|
14439 | yValue = isRotated ? function (dt) {
|
14440 | return x(dt.x);
|
14441 | } : function (dt) {
|
14442 | return y(dt.value);
|
14443 | },
|
14444 | generateM = function (points) {
|
14445 | return "M" + points[0][0] + "," + points[0][1] + "L" + points[1][0] + "," + points[1][1];
|
14446 | },
|
14447 | sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) {
|
14448 | var x0 = d0.x.getTime(),
|
14449 | xDiff = d1.x - d0.x,
|
14450 | xv0 = new Date(x0 + xDiff * k),
|
14451 | xv1 = new Date(x0 + xDiff * (k + timeseriesDiff)),
|
14452 | points = isRotated ? [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] : [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
|
14453 | return generateM(points);
|
14454 | } : function (d0, d1, k, otherDiff) {
|
14455 | 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))]];
|
14456 | return generateM(points);
|
14457 | },
|
14458 | axisType = {
|
14459 | x: $$.axis.getAxisType("x"),
|
14460 | y: $$.axis.getAxisType("y")
|
14461 | },
|
14462 | path = "";
|
14463 |
|
14464 | for (var data, _i = 0; data = d[_i]; _i++) {
|
14465 | var prevData = d[_i - 1],
|
14466 | hasPrevData = prevData && isValue(prevData.value),
|
14467 | style = isWithinRegions(data.x, regions);
|
14468 |
|
14469 | if (isValue(data.value))
|
14470 | if (isUndefined(regions) || !style || !hasPrevData) path += "" + (_i && hasPrevData ? "L" : "M") + xValue(data) + "," + yValue(data);else if (hasPrevData) {
|
14471 | try {
|
14472 | style = style.dasharray.split(" ");
|
14473 | } catch (e) {
|
14474 | style = dasharray.split(" ");
|
14475 | }
|
14476 |
|
14477 |
|
14478 | xp = getScale(axisType.x, prevData.x + xOffset, data.x + xOffset), yp = getScale(axisType.y, prevData.value, data.value);
|
14479 | var dx = x(data.x) - x(prevData.x),
|
14480 | dy = y(data.value) - y(prevData.value),
|
14481 | dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
|
14482 | diff = style[0] / dd, diffx2 = diff * style[1];
|
14483 |
|
14484 | for (var _j = diff; _j <= 1; _j += diffx2) path += sWithRegion(prevData, data, _j, diff), _j + diffx2 >= 1 && (path += sWithRegion(prevData, data, 1, 0));
|
14485 | }
|
14486 | }
|
14487 |
|
14488 | return path;
|
14489 | },
|
14490 | isWithinStep: function isWithinStep(that, y) {
|
14491 | return Math.abs(y - getPointer(this.state.event, that)[1]) < 30;
|
14492 | },
|
14493 | shouldDrawPointsForLine: function shouldDrawPointsForLine(d) {
|
14494 | var linePoint = this.config.line_point;
|
14495 | return linePoint === !0 || isArray(linePoint) && linePoint.indexOf(d.id) !== -1;
|
14496 | }
|
14497 | });
|
14498 | ;
|
14499 |
|
14500 |
|
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 |
|
14506 |
|
14507 |
|
14508 | var getTransitionName = function () {
|
14509 | return getRandom();
|
14510 | };
|
14511 |
|
14512 | var point = ({
|
14513 | hasValidPointType: function hasValidPointType(type) {
|
14514 | return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type);
|
14515 | },
|
14516 | hasValidPointDrawMethods: function hasValidPointDrawMethods(type) {
|
14517 | var pointType = type || this.config.point_type;
|
14518 | return isObjectType(pointType) && isFunction(pointType.create) && isFunction(pointType.update);
|
14519 | },
|
14520 | initialOpacityForCircle: function initialOpacityForCircle(d) {
|
14521 | var config = this.config,
|
14522 | withoutFadeIn = this.state.withoutFadeIn,
|
14523 | opacity = config.point_opacity;
|
14524 | return isUndefined(opacity) && (opacity = this.getBaseValue(d) !== null && withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0"), opacity;
|
14525 | },
|
14526 | opacityForCircle: function opacityForCircle(d) {
|
14527 | var config = this.config,
|
14528 | opacity = config.point_opacity;
|
14529 | return isUndefined(opacity) && (opacity = config.point_show && !config.point_focus_only ? "1" : "0", opacity = isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0"), opacity;
|
14530 | },
|
14531 | initCircle: function initCircle() {
|
14532 | var $$ = this,
|
14533 | main = $$.$el.main;
|
14534 | $$.point = $$.generatePoint(), ($$.hasType("bubble") || $$.hasType("scatter")) && main.select("." + config_classes.chartCircles).empty() && main.select("." + config_classes.chart).append("g").attr("class", config_classes.chartCircles);
|
14535 | },
|
14536 | updateTargetForCircle: function updateTargetForCircle(targetsValue, enterNodeValue) {
|
14537 | var _this = this,
|
14538 | $$ = this,
|
14539 | config = $$.config,
|
14540 | data = $$.data,
|
14541 | $el = $$.$el,
|
14542 | selectionEnabled = config.interaction_enabled && config.data_selection_enabled,
|
14543 | isSelectable = selectionEnabled && config.data_selection_isselectable,
|
14544 | classCircles = $$.getClass("circles", !0);
|
14545 |
|
14546 | if (config.point_show) {
|
14547 | $el.circle || $$.initCircle();
|
14548 | var targets = targetsValue,
|
14549 | enterNode = enterNodeValue;
|
14550 |
|
14551 |
|
14552 | if (!targets) {
|
14553 | targets = data.targets.filter(function (d) {
|
14554 | return _this.isScatterType(d) || _this.isBubbleType(d);
|
14555 | });
|
14556 | var mainCircle = $el.main.select("." + config_classes.chartCircles).style("pointer-events", "none").selectAll("." + config_classes.circles).data(targets).attr("class", classCircles);
|
14557 | mainCircle.exit().remove(), enterNode = mainCircle.enter();
|
14558 | }
|
14559 |
|
14560 |
|
14561 | selectionEnabled && enterNode.append("g").attr("class", function (d) {
|
14562 | return $$.generateClass(config_classes.selectedCircles, d.id);
|
14563 | }), enterNode.append("g").attr("class", classCircles).style("cursor", function (d) {
|
14564 | return isSelectable && isSelectable(d) ? "pointer" : null;
|
14565 | }), selectionEnabled && targets.forEach(function (t) {
|
14566 | $el.main.selectAll("." + config_classes.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll("" + config_classes.selectedCircle).each(function (d) {
|
14567 | d.value = t.values[d.index].value;
|
14568 | });
|
14569 | });
|
14570 | }
|
14571 | },
|
14572 | updateCircle: function updateCircle(isSub) {
|
14573 | isSub === void 0 && (isSub = !1);
|
14574 | var $$ = this,
|
14575 | config = $$.config,
|
14576 | state = $$.state,
|
14577 | $el = $$.$el,
|
14578 | focusOnly = config.point_focus_only,
|
14579 | $root = isSub ? $el.subchart : $el;
|
14580 |
|
14581 | if (config.point_show && !state.toggling) {
|
14582 | var circles = $root.main.selectAll("." + config_classes.circles).selectAll("." + config_classes.circle).data(function (d) {
|
14583 | return $$.isLineType(d) && $$.shouldDrawPointsForLine(d) || $$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ? focusOnly ? [d.values[0]] : d.values : [];
|
14584 | });
|
14585 | circles.exit().remove(), circles.enter().filter(Boolean).append($$.point("create", this, $$.pointR.bind($$), $$.color)), $root.circle = $root.main.selectAll("." + config_classes.circles + " ." + config_classes.circle).style("stroke", $$.color).style("opacity", $$.initialOpacityForCircle.bind($$));
|
14586 | }
|
14587 | },
|
14588 | redrawCircle: function redrawCircle(cx, cy, withTransition, flow, isSub) {
|
14589 | isSub === void 0 && (isSub = !1);
|
14590 | var $$ = this,
|
14591 | rendered = $$.state.rendered,
|
14592 | $el = $$.$el,
|
14593 | $root = isSub ? $el.subchart : $el,
|
14594 | selectedCircles = $root.main.selectAll("." + config_classes.selectedCircle);
|
14595 | if (!$$.config.point_show) return [];
|
14596 | var fn = $$.point("update", $$, cx, cy, $$.color, withTransition, flow, selectedCircles),
|
14597 | posAttr = $$.isCirclePoint() ? "c" : "",
|
14598 | t = getRandom(),
|
14599 | opacityStyleFn = $$.opacityForCircle.bind($$),
|
14600 | mainCircles = [];
|
14601 | return $root.circle.each(function (d) {
|
14602 | var result = fn.bind(this)(d);
|
14603 | result = (withTransition || !rendered ? result.transition(t) : result).style("opacity", opacityStyleFn), mainCircles.push(result);
|
14604 | }), [mainCircles, (withTransition ? selectedCircles.transition() : selectedCircles).attr(posAttr + "x", cx).attr(posAttr + "y", cy)];
|
14605 | },
|
14606 |
|
14607 | |
14608 |
|
14609 |
|
14610 |
|
14611 |
|
14612 | showCircleFocus: function showCircleFocus(d) {
|
14613 | var $$ = this,
|
14614 | config = $$.config,
|
14615 | _$$$state = $$.state,
|
14616 | hasRadar = _$$$state.hasRadar,
|
14617 | resizing = _$$$state.resizing,
|
14618 | toggling = _$$$state.toggling,
|
14619 | transiting = _$$$state.transiting,
|
14620 | $el = $$.$el,
|
14621 | circle = $el.circle;
|
14622 |
|
14623 | if (transiting === !1 && config.point_focus_only && circle) {
|
14624 | var cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$),
|
14625 | cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$),
|
14626 | withTransition = toggling || isUndefined(d),
|
14627 | fn = $$.point("update", $$, cx, cy, $$.color, !resizing && withTransition);
|
14628 | d && (circle = circle.filter(function (t) {
|
14629 | var data = d.filter(function (v) {
|
14630 | return v.id === t.id;
|
14631 | });
|
14632 | return !!data.length && (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).datum(data[0]);
|
14633 | })), circle.attr("class", this.updatePointClass.bind(this)).style("opacity", "1").each(function (d) {
|
14634 | var id = d.id,
|
14635 | index = d.index,
|
14636 | value = d.value,
|
14637 | visibility = "hidden";
|
14638 | isValue(value) && (fn.bind(this)(d), $$.expandCircles(index, id), visibility = ""), this.style.visibility = visibility;
|
14639 | });
|
14640 | }
|
14641 | },
|
14642 |
|
14643 | |
14644 |
|
14645 |
|
14646 |
|
14647 | hideCircleFocus: function hideCircleFocus() {
|
14648 | var $$ = this,
|
14649 | config = $$.config,
|
14650 | circle = $$.$el.circle;
|
14651 | config.point_focus_only && circle && ($$.unexpandCircles(), circle.style("visibility", "hidden"));
|
14652 | },
|
14653 | circleX: function circleX(d) {
|
14654 | return this.xx(d);
|
14655 | },
|
14656 | updateCircleY: function updateCircleY(isSub) {
|
14657 | isSub === void 0 && (isSub = !1);
|
14658 | var $$ = this,
|
14659 | getPoints = $$.generateGetLinePoints($$.getShapeIndices($$.isLineType), isSub);
|
14660 | return function (d, i) {
|
14661 | var id = d.id;
|
14662 | return $$.isGrouped(id) ? getPoints(d, i)[0][1] : $$.getYScaleById(id, isSub)($$.getBaseValue(d));
|
14663 | };
|
14664 | },
|
14665 | getCircles: function getCircles(i, id) {
|
14666 | var $$ = this,
|
14667 | suffix = isValue(i) ? "-" + i : "";
|
14668 | return (id ? $$.$el.main.selectAll("." + config_classes.circles + $$.getTargetSelectorSuffix(id)) : $$.$el.main).selectAll("." + config_classes.circle + suffix);
|
14669 | },
|
14670 | expandCircles: function expandCircles(i, id, reset) {
|
14671 | var $$ = this,
|
14672 | r = $$.pointExpandedR.bind($$);
|
14673 | reset && $$.unexpandCircles();
|
14674 | var circles = $$.getCircles(i, id).classed(config_classes.EXPANDED, !0),
|
14675 | scale = r(circles) / $$.config.point_r,
|
14676 | ratio = 1 - scale;
|
14677 | $$.isCirclePoint() ? circles.attr("r", r) : circles.each(function () {
|
14678 | var point = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
14679 | if (this.tagName === "circle") point.attr("r", r);else {
|
14680 | var _this$getBBox = this.getBBox(),
|
14681 | width = _this$getBBox.width,
|
14682 | height = _this$getBBox.height,
|
14683 | x = ratio * (+point.attr("x") + width / 2),
|
14684 | y = ratio * (+point.attr("y") + height / 2);
|
14685 |
|
14686 | point.attr("transform", "translate(" + x + " " + y + ") scale(" + scale + ")");
|
14687 | }
|
14688 | });
|
14689 | },
|
14690 | unexpandCircles: function unexpandCircles(i) {
|
14691 | var $$ = this,
|
14692 | r = $$.pointR.bind($$),
|
14693 | circles = $$.getCircles(i).filter(function () {
|
14694 | return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.EXPANDED);
|
14695 | }).classed(config_classes.EXPANDED, !1);
|
14696 | circles.attr("r", r), $$.isCirclePoint() || circles.attr("transform", "scale(" + r(circles) / $$.config.point_r + ")");
|
14697 | },
|
14698 | pointR: function (d) {
|
14699 | var $$ = this,
|
14700 | config = $$.config,
|
14701 | pointR = config.point_r,
|
14702 | r = pointR;
|
14703 | return $$.isBubbleType(d) ? r = $$.getBubbleR(d) : isFunction(pointR) && (r = pointR.bind($$.api)(d)), r;
|
14704 | },
|
14705 | pointExpandedR: function pointExpandedR(d) {
|
14706 | var $$ = this,
|
14707 | config = $$.config,
|
14708 | scale = $$.isBubbleType(d) ? 1.15 : 1.75;
|
14709 | return config.point_focus_expand_enabled ? config.point_focus_expand_r || $$.pointR(d) * scale : $$.pointR(d);
|
14710 | },
|
14711 | pointSelectR: function pointSelectR(d) {
|
14712 | var $$ = this,
|
14713 | selectR = $$.config.point_select_r;
|
14714 | return isFunction(selectR) ? selectR(d) : selectR || $$.pointR(d) * 4;
|
14715 | },
|
14716 | isWithinCircle: function isWithinCircle(node, r) {
|
14717 | var mouse = getPointer(this.state.event, node),
|
14718 | element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node),
|
14719 | prefix = this.isCirclePoint(node) ? "c" : "",
|
14720 | cx = +element.attr(prefix + "x"),
|
14721 | cy = +element.attr(prefix + "y");
|
14722 |
|
14723 |
|
14724 | if (!(cx || cy) && node.nodeType === 1) {
|
14725 | var _getBoundingRect = getBoundingRect(node),
|
14726 | x = _getBoundingRect.x,
|
14727 | y = _getBoundingRect.y;
|
14728 |
|
14729 | cx = x, cy = y;
|
14730 | }
|
14731 |
|
14732 | return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
|
14733 | },
|
14734 | insertPointInfoDefs: function insertPointInfoDefs(point, id) {
|
14735 | var $$ = this,
|
14736 | copyAttr = function (from, target) {
|
14737 | for (var name, attribs = from.attributes, i = 0; name = attribs[i]; i++) name = name.name, target.setAttribute(name, from.getAttribute(name));
|
14738 | },
|
14739 | doc = new DOMParser().parseFromString(point, "image/svg+xml"),
|
14740 | node = doc.documentElement,
|
14741 | clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, node.nodeName.toLowerCase());
|
14742 |
|
14743 | if (clone.id = id, clone.style.fill = "inherit", clone.style.stroke = "inherit", copyAttr(node, clone), node.childNodes && node.childNodes.length) {
|
14744 | var parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(clone);
|
14745 | "innerHTML" in clone ? parent.html(node.innerHTML) : toArray(node.childNodes).forEach(function (v) {
|
14746 | copyAttr(v, parent.append(v.tagName).node());
|
14747 | });
|
14748 | }
|
14749 |
|
14750 | $$.$el.defs.node().appendChild(clone);
|
14751 | },
|
14752 | pointFromDefs: function pointFromDefs(id) {
|
14753 | return this.$el.defs.select("#" + id);
|
14754 | },
|
14755 | updatePointClass: function updatePointClass(d) {
|
14756 | var $$ = this,
|
14757 | circle = $$.$el.circle,
|
14758 | pointClass = !1;
|
14759 | return (isObject(d) || circle) && (pointClass = d === !0 ? circle.each(function (d) {
|
14760 | var className = $$.getClass("circle", !0)(d);
|
14761 | this.getAttribute("class").indexOf(config_classes.EXPANDED) > -1 && (className += " " + config_classes.EXPANDED), this.setAttribute("class", className);
|
14762 | }) : $$.getClass("circle", !0)(d)), pointClass;
|
14763 | },
|
14764 | generateGetLinePoints: function generateGetLinePoints(lineIndices, isSub) {
|
14765 |
|
14766 | var $$ = this,
|
14767 | config = $$.config,
|
14768 | x = $$.getShapeX(0, lineIndices, isSub),
|
14769 | y = $$.getShapeY(isSub),
|
14770 | lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub),
|
14771 | yScale = $$.getYScaleById.bind($$);
|
14772 | return function (d, i) {
|
14773 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
14774 | offset = lineOffset(d, i) || y0,
|
14775 | posX = x(d),
|
14776 | posY = y(d);
|
14777 | config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0);
|
14778 |
|
14779 | var point = [posX, posY - (y0 - offset)];
|
14780 | return [point, point,
|
14781 | point, point];
|
14782 | };
|
14783 | },
|
14784 | generatePoint: function generatePoint() {
|
14785 | var $$ = this,
|
14786 | config = $$.config,
|
14787 | datetimeId = $$.state.datetimeId,
|
14788 | ids = [],
|
14789 | pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
14790 | return function (method, context) {
|
14791 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
14792 |
|
14793 | return function (d) {
|
14794 | var id = $$.getTargetSelectorSuffix(d.id || d.data && d.data.id || d),
|
14795 | element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
14796 | ids.indexOf(id) < 0 && ids.push(id);
|
14797 | var point = pattern[ids.indexOf(id) % pattern.length];
|
14798 | if ($$.hasValidPointType(point)) point = $$[point];else if (!$$.hasValidPointDrawMethods(point)) {
|
14799 | var pointId = datetimeId + "-point" + id,
|
14800 | pointFromDefs = $$.pointFromDefs(pointId);
|
14801 | if (pointFromDefs.size() < 1 && $$.insertPointInfoDefs(point, pointId), method === "create") return $$.custom.create.bind(context).apply(void 0, [element, pointId].concat(args));
|
14802 | if (method === "update") return $$.custom.update.bind(context).apply(void 0, [element].concat(args));
|
14803 | }
|
14804 | return point[method].bind(context).apply(void 0, [element].concat(args));
|
14805 | };
|
14806 | };
|
14807 | },
|
14808 | custom: {
|
14809 | create: function create(element, id, sizeFn, fillStyleFn) {
|
14810 | return element.append("use").attr("xlink:href", "#" + id).attr("class", this.updatePointClass.bind(this)).style("fill", fillStyleFn).node();
|
14811 | },
|
14812 | update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
14813 | var _element$node$getBBox = element.node().getBBox(),
|
14814 | width = _element$node$getBBox.width,
|
14815 | height = _element$node$getBBox.height,
|
14816 | xPosFn2 = function (d) {
|
14817 | return xPosFn(d) - width / 2;
|
14818 | },
|
14819 | mainCircles = element;
|
14820 |
|
14821 | if (withTransition) {
|
14822 | var transitionName = getTransitionName();
|
14823 | flow && mainCircles.attr("x", xPosFn2), mainCircles = mainCircles.transition(transitionName), selectedCircles && selectedCircles.transition(getTransitionName());
|
14824 | }
|
14825 |
|
14826 | return mainCircles.attr("x", xPosFn2).attr("y", function yPosFn2(d) {
|
14827 | return yPosFn(d) - height / 2;
|
14828 | }).style("fill", fillStyleFn);
|
14829 | }
|
14830 | },
|
14831 |
|
14832 | circle: {
|
14833 | create: function create(element, sizeFn, fillStyleFn) {
|
14834 | return element.append("circle").attr("class", this.updatePointClass.bind(this)).attr("r", sizeFn).style("fill", fillStyleFn).node();
|
14835 | },
|
14836 | update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
14837 | var $$ = this,
|
14838 | mainCircles = element;
|
14839 |
|
14840 | if ($$.hasType("bubble") && mainCircles.attr("r", $$.pointR.bind($$)), withTransition) {
|
14841 | var transitionName = getTransitionName();
|
14842 | flow && mainCircles.attr("cx", xPosFn), mainCircles.attr("cx") && (mainCircles = mainCircles.transition(transitionName)), selectedCircles && selectedCircles.transition(getTransitionName());
|
14843 | }
|
14844 |
|
14845 | return mainCircles.attr("cx", xPosFn).attr("cy", yPosFn).style("fill", fillStyleFn);
|
14846 | }
|
14847 | },
|
14848 |
|
14849 | rectangle: {
|
14850 | create: function create(element, sizeFn, fillStyleFn) {
|
14851 | var rectSizeFn = function (d) {
|
14852 | return sizeFn(d) * 2;
|
14853 | };
|
14854 |
|
14855 | return element.append("rect").attr("class", this.updatePointClass.bind(this)).attr("width", rectSizeFn).attr("height", rectSizeFn).style("fill", fillStyleFn).node();
|
14856 | },
|
14857 | update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
14858 | var $$ = this,
|
14859 | r = $$.config.point_r,
|
14860 | rectXPosFn = function (d) {
|
14861 | return xPosFn(d) - r;
|
14862 | },
|
14863 | mainCircles = element;
|
14864 |
|
14865 | if (withTransition) {
|
14866 | var transitionName = getTransitionName();
|
14867 | flow && mainCircles.attr("x", rectXPosFn), mainCircles = mainCircles.transition(transitionName), selectedCircles && selectedCircles.transition(getTransitionName());
|
14868 | }
|
14869 |
|
14870 | return mainCircles.attr("x", rectXPosFn).attr("y", function rectYPosFn(d) {
|
14871 | return yPosFn(d) - r;
|
14872 | }).style("fill", fillStyleFn);
|
14873 | }
|
14874 | }
|
14875 | });
|
14876 | ;
|
14877 |
|
14878 |
|
14879 |
|
14880 |
|
14881 |
|
14882 |
|
14883 |
|
14884 |
|
14885 |
|
14886 |
|
14887 |
|
14888 |
|
14889 |
|
14890 |
|
14891 |
|
14892 |
|
14893 |
|
14894 |
|
14895 |
|
14896 |
|
14897 | function getPosition(isClockwise, type, edge, pos, range, ratio) {
|
14898 | var index = isClockwise && pos > 0 ? edge - pos : pos,
|
14899 | r = 2 * Math.PI,
|
14900 | func = type === "x" ? Math.sin : Math.cos;
|
14901 | return range * (1 - ratio * func(index * r / edge));
|
14902 | }
|
14903 |
|
14904 |
|
14905 | var cacheKey = KEY.radarPoints;
|
14906 | var radar = ({
|
14907 | initRadar: function initRadar() {
|
14908 | var $$ = this,
|
14909 | config = $$.config,
|
14910 | current = $$.state.current,
|
14911 | $el = $$.$el;
|
14912 | $$.hasType("radar") && ($el.radar = $el.main.select("." + config_classes.chart).append("g").attr("class", config_classes.chartRadars), $el.radar.levels = $el.radar.append("g").attr("class", config_classes.levels), $el.radar.axes = $el.radar.append("g").attr("class", config_classes.axis), $el.radar.shapes = $el.radar.append("g").attr("class", config_classes.shapes), current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value);
|
14913 | },
|
14914 | getRadarSize: function getRadarSize() {
|
14915 | var $$ = this,
|
14916 | config = $$.config,
|
14917 | _$$$state = $$.state,
|
14918 | arcWidth = _$$$state.arcWidth,
|
14919 | arcHeight = _$$$state.arcHeight,
|
14920 | padding = config.axis_x_categories.length < 4 ? -20 : 10,
|
14921 | size = (Math.min(arcWidth, arcHeight) - padding) / 2;
|
14922 | return [size, size];
|
14923 | },
|
14924 | updateTargetsForRadar: function updateTargetsForRadar(targets) {
|
14925 | var $$ = this,
|
14926 | config = $$.config;
|
14927 | isEmpty(config.axis_x_categories) && (config.axis_x_categories = getRange(0, getMinMax("max", targets.map(function (v) {
|
14928 | return v.values.length;
|
14929 | })))), $$.generateRadarPoints();
|
14930 | },
|
14931 | getRadarPosition: function getRadarPosition(type, index, range, ratio) {
|
14932 | var $$ = this,
|
14933 | config = $$.config,
|
14934 | _$$$getRadarSize = $$.getRadarSize(),
|
14935 | width = _$$$getRadarSize[0],
|
14936 | height = _$$$getRadarSize[1],
|
14937 | edge = config.axis_x_categories.length,
|
14938 | isClockwise = config.radar_direction_clockwise,
|
14939 | pos = toArray(type).map(function (v) {
|
14940 | return getPosition(isClockwise, v, edge, index, isDefined(range) ? range : type === "x" ? width : height, isNumber(ratio) ? ratio : config.radar_size_ratio);
|
14941 | });
|
14942 |
|
14943 | return pos.length === 1 ? pos[0] : pos;
|
14944 | },
|
14945 |
|
14946 | |
14947 |
|
14948 |
|
14949 |
|
14950 | generateRadarPoints: function generateRadarPoints() {
|
14951 | var $$ = this,
|
14952 | targets = $$.data.targets,
|
14953 | _$$$getRadarSize2 = $$.getRadarSize(),
|
14954 | width = _$$$getRadarSize2[0],
|
14955 | height = _$$$getRadarSize2[1],
|
14956 | points = $$.cache.get(cacheKey) || {},
|
14957 | size = points._size;
|
14958 |
|
14959 | size && (size.width === width || size.height === height) || (targets.forEach(function (d) {
|
14960 | points[d.id] = d.values.map(function (v, i) {
|
14961 | return $$.getRadarPosition(["x", "y"], i, undefined, $$.getRatio("radar", v));
|
14962 | });
|
14963 | }), points._size = {
|
14964 | width: width,
|
14965 | height: height
|
14966 | }, $$.cache.add(cacheKey, points));
|
14967 | },
|
14968 | redrawRadar: function redrawRadar(durationForExit) {
|
14969 | var $$ = this,
|
14970 | _$$$$el = $$.$el,
|
14971 | radar = _$$$$el.radar,
|
14972 | main = _$$$$el.main,
|
14973 | translate = $$.getTranslate("radar");
|
14974 | translate && (radar.attr("transform", translate), main.select("." + config_classes.chartTexts).attr("transform", translate), $$.generateRadarPoints(), $$.updateRadarLevel(), $$.updateRadarAxes(), $$.updateRadarShape(durationForExit));
|
14975 | },
|
14976 | generateGetRadarPoints: function generateGetRadarPoints() {
|
14977 | var points = this.cache.get(cacheKey);
|
14978 | return function (d, i) {
|
14979 | var point = points[d.id][i];
|
14980 | return [point, point, point, point];
|
14981 | };
|
14982 | },
|
14983 | updateRadarLevel: function updateRadarLevel() {
|
14984 | var $$ = this,
|
14985 | config = $$.config,
|
14986 | state = $$.state,
|
14987 | radar = $$.$el.radar,
|
14988 | _$$$getRadarSize3 = $$.getRadarSize(),
|
14989 | width = _$$$getRadarSize3[0],
|
14990 | height = _$$$getRadarSize3[1],
|
14991 | depth = config.radar_level_depth,
|
14992 | edge = config.axis_x_categories.length,
|
14993 | showText = config.radar_level_text_show,
|
14994 | radarLevels = radar.levels,
|
14995 | levelData = getRange(0, depth),
|
14996 | radius = config.radar_size_ratio * Math.min(width, height),
|
14997 | levelRatio = levelData.map(function (l) {
|
14998 | return radius * ((l + 1) / depth);
|
14999 | }),
|
15000 | levelTextFormat = (config.radar_level_text_format || function () {}).bind($$.api),
|
15001 | points = levelData.map(function (v) {
|
15002 | var range = levelRatio[v],
|
15003 | pos = getRange(0, edge).map(function (i) {
|
15004 | return $$.getRadarPosition(["x", "y"], i, range, 1).join(",");
|
15005 | });
|
15006 | return pos.join(" ");
|
15007 | }),
|
15008 | level = radarLevels.selectAll("." + config_classes.level).data(levelData);
|
15009 |
|
15010 | level.exit().remove();
|
15011 | var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
15012 | return config_classes.level + " " + config_classes.level + "-" + i;
|
15013 | });
|
15014 | 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 () {
|
15015 | return levelTextFormat(0);
|
15016 | }), levelEnter.append("text").attr("dx", "-.5em").style("text-anchor", "end").text(function (d) {
|
15017 | return levelTextFormat(state.current.dataMax / levelData.length * (d + 1));
|
15018 | })), levelEnter.merge(level).attr("transform", function (d) {
|
15019 | return "translate(" + (width - levelRatio[d]) + ", " + (height - levelRatio[d]) + ")";
|
15020 | }).selectAll("polygon").attr("points", function (d) {
|
15021 | return points[d];
|
15022 | }), showText && radarLevels.selectAll("text").attr("x", function (d) {
|
15023 | return isUndefined(d) ? width : points[d].split(",")[0];
|
15024 | }).attr("y", function (d) {
|
15025 | return isUndefined(d) ? height : 0;
|
15026 | });
|
15027 | },
|
15028 | updateRadarAxes: function updateRadarAxes() {
|
15029 | var $$ = this,
|
15030 | config = $$.config,
|
15031 | radar = $$.$el.radar,
|
15032 | _$$$getRadarSize4 = $$.getRadarSize(),
|
15033 | width = _$$$getRadarSize4[0],
|
15034 | height = _$$$getRadarSize4[1],
|
15035 | categories = config.axis_x_categories,
|
15036 | axis = radar.axes.selectAll("g").data(categories);
|
15037 |
|
15038 | axis.exit().remove();
|
15039 | var axisEnter = axis.enter().append("g").attr("class", function (d, i) {
|
15040 | return config_classes.axis + "-" + i;
|
15041 | });
|
15042 |
|
15043 |
|
15044 | if (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) {
|
15045 | return $$.getRadarPosition("x", i);
|
15046 | }).attr("y2", function (d, i) {
|
15047 | return $$.getRadarPosition("y", i);
|
15048 | }), config.radar_axis_text_show) {
|
15049 | var _config$radar_axis_te = config.radar_axis_text_position,
|
15050 | _config$radar_axis_te2 = _config$radar_axis_te.x,
|
15051 | x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2,
|
15052 | _config$radar_axis_te3 = _config$radar_axis_te.y,
|
15053 | y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3;
|
15054 | axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
|
15055 | selection.each(function (d) {
|
15056 | setTextValue((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), d + "", [-.6, 1.2]);
|
15057 | });
|
15058 | }).datum(function (d, i) {
|
15059 | return {
|
15060 | index: i
|
15061 | };
|
15062 | }).attr("transform", function (d) {
|
15063 | isUndefined(this.width) && (this.width = this.getBoundingClientRect().width / 2);
|
15064 | var posX = $$.getRadarPosition("x", d.index, undefined, 1),
|
15065 | posY = Math.round($$.getRadarPosition("y", d.index, undefined, 1));
|
15066 | return posX > width ? posX += this.width + x : Math.round(posX) < width && (posX -= this.width + x), posY > height ? (posY / 2 === height && this.firstChild.tagName === "tspan" && this.firstChild.setAttribute("dy", "0em"), posY += y) : posY < height && (posY -= y), "translate(" + posX + " " + posY + ")";
|
15067 | });
|
15068 | }
|
15069 |
|
15070 | $$.bindEvent();
|
15071 | },
|
15072 | bindEvent: function bindEvent() {
|
15073 | var $$ = this,
|
15074 | config = $$.config,
|
15075 | state = $$.state,
|
15076 | _$$$$el2 = $$.$el,
|
15077 | radar = _$$$$el2.radar,
|
15078 | svg = _$$$$el2.svg,
|
15079 | focusOnly = config.point_focus_only,
|
15080 | _state = state,
|
15081 | inputType = _state.inputType,
|
15082 | transiting = _state.transiting;
|
15083 |
|
15084 | if (config.interaction_enabled) {
|
15085 | var isMouse = inputType === "mouse",
|
15086 | getIndex = function (event) {
|
15087 | var target = event.target;
|
15088 |
|
15089 | /tspan/i.test(target.tagName) && (target = target.parentNode);
|
15090 | var d = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
15091 | return d && Object.keys(d).length === 1 ? d.index : undefined;
|
15092 | },
|
15093 | hide = function (event) {
|
15094 | var index = getIndex(event),
|
15095 | noIndex = isUndefined(index);
|
15096 | (isMouse || noIndex) && ($$.hideTooltip(), focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles(), isMouse ? $$.setOverOut(!1, index) : noIndex && $$.callOverOutForTouch());
|
15097 | };
|
15098 |
|
15099 | radar.axes.selectAll("text").on(isMouse ? "mouseover " : "touchstart", function (event) {
|
15100 | if (!transiting)
|
15101 | {
|
15102 | state.event = event;
|
15103 | var index = getIndex(event);
|
15104 | $$.selectRectForSingle(svg.node(), null, index), isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
|
15105 | }
|
15106 | }).on("mouseout", isMouse ? hide : null), isMouse || svg.on("touchstart", hide);
|
15107 | }
|
15108 | },
|
15109 | updateRadarShape: function updateRadarShape(durationForExit) {
|
15110 | var $$ = this,
|
15111 | targets = $$.data.targets.filter(function (d) {
|
15112 | return $$.isRadarType(d);
|
15113 | }),
|
15114 | points = $$.cache.get(cacheKey),
|
15115 | areas = $$.$el.radar.shapes.selectAll("polygon").data(targets),
|
15116 | areasEnter = areas.enter().append("g").attr("class", $$.getChartClass("Radar"));
|
15117 | areas.exit().transition().duration(durationForExit).remove(), areasEnter.append("polygon").merge(areas).style("fill", $$.color).style("stroke", $$.color).attr("points", function (d) {
|
15118 | return points[d.id].join(" ");
|
15119 | }), $$.updateTargetForCircle(targets, areasEnter);
|
15120 | },
|
15121 |
|
15122 | |
15123 |
|
15124 |
|
15125 |
|
15126 |
|
15127 |
|
15128 | radarCircleX: function radarCircleX(d) {
|
15129 | return this.cache.get(cacheKey)[d.id][d.index][0];
|
15130 | },
|
15131 |
|
15132 | |
15133 |
|
15134 |
|
15135 |
|
15136 |
|
15137 |
|
15138 | radarCircleY: function radarCircleY(d) {
|
15139 | return this.cache.get(cacheKey)[d.id][d.index][1];
|
15140 | }
|
15141 | });
|
15142 | ;
|
15143 |
|
15144 |
|
15145 |
|
15146 |
|
15147 |
|
15148 |
|
15149 |
|
15150 |
|
15151 | var common_point = ({
|
15152 | |
15153 |
|
15154 |
|
15155 |
|
15156 |
|
15157 |
|
15158 |
|
15159 |
|
15160 |
|
15161 |
|
15162 |
|
15163 |
|
15164 |
|
15165 |
|
15166 |
|
15167 |
|
15168 |
|
15169 |
|
15170 |
|
15171 |
|
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 |
|
15177 |
|
15178 |
|
15179 |
|
15180 |
|
15181 |
|
15182 |
|
15183 |
|
15184 |
|
15185 |
|
15186 |
|
15187 |
|
15188 |
|
15189 |
|
15190 |
|
15191 |
|
15192 |
|
15193 |
|
15194 |
|
15195 |
|
15196 |
|
15197 |
|
15198 |
|
15199 |
|
15200 |
|
15201 |
|
15202 |
|
15203 |
|
15204 |
|
15205 |
|
15206 |
|
15207 |
|
15208 |
|
15209 |
|
15210 |
|
15211 |
|
15212 |
|
15213 |
|
15214 |
|
15215 |
|
15216 |
|
15217 |
|
15218 |
|
15219 |
|
15220 |
|
15221 |
|
15222 |
|
15223 |
|
15224 |
|
15225 |
|
15226 |
|
15227 |
|
15228 |
|
15229 |
|
15230 |
|
15231 |
|
15232 |
|
15233 | point_show: !0,
|
15234 | point_r: 2.5,
|
15235 | point_sensitivity: 10,
|
15236 | point_focus_expand_enabled: !0,
|
15237 | point_focus_expand_r: undefined,
|
15238 | point_focus_only: !1,
|
15239 | point_opacity: undefined,
|
15240 | point_pattern: [],
|
15241 | point_select_r: undefined,
|
15242 | point_type: "circle"
|
15243 | });
|
15244 | ;
|
15245 |
|
15246 |
|
15247 |
|
15248 |
|
15249 |
|
15250 |
|
15251 |
|
15252 |
|
15253 | var Options_shape_area = ({
|
15254 | |
15255 |
|
15256 |
|
15257 |
|
15258 |
|
15259 |
|
15260 |
|
15261 |
|
15262 |
|
15263 |
|
15264 |
|
15265 |
|
15266 |
|
15267 |
|
15268 |
|
15269 |
|
15270 |
|
15271 |
|
15272 |
|
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 |
|
15282 |
|
15283 |
|
15284 |
|
15285 |
|
15286 |
|
15287 |
|
15288 |
|
15289 |
|
15290 |
|
15291 |
|
15292 |
|
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 |
|
15302 |
|
15303 |
|
15304 |
|
15305 | area_above: !1,
|
15306 | area_front: !0,
|
15307 | area_linearGradient: !1,
|
15308 | area_zerobased: !0
|
15309 | });
|
15310 | ;
|
15311 |
|
15312 |
|
15313 |
|
15314 |
|
15315 |
|
15316 |
|
15317 |
|
15318 |
|
15319 | var shape_bar = ({
|
15320 | |
15321 |
|
15322 |
|
15323 |
|
15324 |
|
15325 |
|
15326 |
|
15327 |
|
15328 |
|
15329 |
|
15330 |
|
15331 |
|
15332 |
|
15333 |
|
15334 |
|
15335 |
|
15336 |
|
15337 |
|
15338 |
|
15339 |
|
15340 |
|
15341 |
|
15342 |
|
15343 |
|
15344 |
|
15345 |
|
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 |
|
15351 |
|
15352 |
|
15353 |
|
15354 |
|
15355 |
|
15356 |
|
15357 |
|
15358 |
|
15359 |
|
15360 |
|
15361 |
|
15362 |
|
15363 |
|
15364 |
|
15365 |
|
15366 |
|
15367 |
|
15368 |
|
15369 |
|
15370 |
|
15371 |
|
15372 |
|
15373 |
|
15374 |
|
15375 |
|
15376 |
|
15377 |
|
15378 |
|
15379 |
|
15380 |
|
15381 |
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 | bar_label_threshold: 0,
|
15387 | bar_padding: 0,
|
15388 | bar_radius: undefined,
|
15389 | bar_radius_ratio: undefined,
|
15390 | bar_sensitivity: 2,
|
15391 | bar_width: undefined,
|
15392 | bar_width_ratio: .6,
|
15393 | bar_width_max: undefined,
|
15394 | bar_zerobased: !0
|
15395 | });
|
15396 | ;
|
15397 |
|
15398 |
|
15399 |
|
15400 |
|
15401 |
|
15402 |
|
15403 |
|
15404 |
|
15405 | var shape_bubble = ({
|
15406 | |
15407 |
|
15408 |
|
15409 |
|
15410 |
|
15411 |
|
15412 |
|
15413 |
|
15414 |
|
15415 |
|
15416 |
|
15417 |
|
15418 |
|
15419 |
|
15420 |
|
15421 |
|
15422 |
|
15423 |
|
15424 |
|
15425 |
|
15426 |
|
15427 |
|
15428 |
|
15429 | bubble_maxR: 35,
|
15430 | bubble_zerobased: !1
|
15431 | });
|
15432 | ;
|
15433 |
|
15434 |
|
15435 |
|
15436 |
|
15437 |
|
15438 |
|
15439 |
|
15440 |
|
15441 | var shape_candlestick = ({
|
15442 | |
15443 |
|
15444 |
|
15445 |
|
15446 |
|
15447 |
|
15448 |
|
15449 |
|
15450 |
|
15451 |
|
15452 |
|
15453 |
|
15454 |
|
15455 |
|
15456 |
|
15457 |
|
15458 |
|
15459 |
|
15460 |
|
15461 |
|
15462 |
|
15463 |
|
15464 |
|
15465 |
|
15466 |
|
15467 |
|
15468 |
|
15469 |
|
15470 |
|
15471 |
|
15472 |
|
15473 |
|
15474 |
|
15475 |
|
15476 |
|
15477 |
|
15478 |
|
15479 |
|
15480 |
|
15481 |
|
15482 |
|
15483 |
|
15484 |
|
15485 |
|
15486 |
|
15487 |
|
15488 |
|
15489 | candlestick_width: undefined,
|
15490 | candlestick_width_ratio: .6,
|
15491 | candlestick_width_max: undefined,
|
15492 | candlestick_color_down: "red"
|
15493 | });
|
15494 | ;
|
15495 |
|
15496 |
|
15497 |
|
15498 |
|
15499 |
|
15500 |
|
15501 |
|
15502 |
|
15503 | var shape_line = ({
|
15504 | |
15505 |
|
15506 |
|
15507 |
|
15508 |
|
15509 |
|
15510 |
|
15511 |
|
15512 |
|
15513 |
|
15514 |
|
15515 |
|
15516 |
|
15517 |
|
15518 |
|
15519 |
|
15520 |
|
15521 |
|
15522 |
|
15523 |
|
15524 |
|
15525 |
|
15526 |
|
15527 |
|
15528 |
|
15529 |
|
15530 |
|
15531 |
|
15532 |
|
15533 |
|
15534 |
|
15535 |
|
15536 |
|
15537 |
|
15538 |
|
15539 |
|
15540 |
|
15541 |
|
15542 | line_connectNull: !1,
|
15543 | line_step_type: "step",
|
15544 | line_zerobased: !1,
|
15545 | line_classes: undefined,
|
15546 | line_point: !0
|
15547 | });
|
15548 | ;
|
15549 |
|
15550 |
|
15551 |
|
15552 |
|
15553 |
|
15554 |
|
15555 |
|
15556 |
|
15557 | var scatter = ({
|
15558 | |
15559 |
|
15560 |
|
15561 |
|
15562 |
|
15563 |
|
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 |
|
15569 |
|
15570 |
|
15571 |
|
15572 |
|
15573 |
|
15574 |
|
15575 |
|
15576 |
|
15577 |
|
15578 |
|
15579 |
|
15580 |
|
15581 |
|
15582 |
|
15583 | scatter_zerobased: !1
|
15584 | });
|
15585 | ;
|
15586 |
|
15587 |
|
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 |
|
15594 | var spline = ({
|
15595 | |
15596 |
|
15597 |
|
15598 |
|
15599 |
|
15600 |
|
15601 |
|
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 |
|
15607 |
|
15608 |
|
15609 |
|
15610 |
|
15611 |
|
15612 |
|
15613 |
|
15614 |
|
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 |
|
15621 |
|
15622 |
|
15623 |
|
15624 |
|
15625 |
|
15626 |
|
15627 |
|
15628 |
|
15629 |
|
15630 | spline_interpolation_type: "cardinal"
|
15631 | });
|
15632 | ;
|
15633 |
|
15634 |
|
15635 |
|
15636 |
|
15637 |
|
15638 |
|
15639 |
|
15640 |
|
15641 | var donut = ({
|
15642 | |
15643 |
|
15644 |
|
15645 |
|
15646 |
|
15647 |
|
15648 |
|
15649 |
|
15650 |
|
15651 |
|
15652 |
|
15653 |
|
15654 |
|
15655 |
|
15656 |
|
15657 |
|
15658 |
|
15659 |
|
15660 |
|
15661 |
|
15662 |
|
15663 |
|
15664 |
|
15665 |
|
15666 |
|
15667 |
|
15668 |
|
15669 |
|
15670 |
|
15671 |
|
15672 |
|
15673 |
|
15674 |
|
15675 |
|
15676 |
|
15677 |
|
15678 |
|
15679 |
|
15680 |
|
15681 |
|
15682 |
|
15683 |
|
15684 |
|
15685 |
|
15686 |
|
15687 |
|
15688 |
|
15689 |
|
15690 |
|
15691 |
|
15692 |
|
15693 |
|
15694 |
|
15695 |
|
15696 |
|
15697 |
|
15698 |
|
15699 |
|
15700 |
|
15701 |
|
15702 |
|
15703 | donut_label_show: !0,
|
15704 | donut_label_format: undefined,
|
15705 | donut_label_threshold: .05,
|
15706 | donut_label_ratio: undefined,
|
15707 | donut_width: undefined,
|
15708 | donut_title: "",
|
15709 | donut_expand: {},
|
15710 | donut_expand_rate: .98,
|
15711 | donut_expand_duration: 50,
|
15712 | donut_padAngle: 0,
|
15713 | donut_startingAngle: 0
|
15714 | });
|
15715 | ;
|
15716 |
|
15717 |
|
15718 |
|
15719 |
|
15720 |
|
15721 |
|
15722 |
|
15723 |
|
15724 | var shape_gauge = ({
|
15725 | |
15726 |
|
15727 |
|
15728 |
|
15729 |
|
15730 |
|
15731 |
|
15732 |
|
15733 |
|
15734 |
|
15735 |
|
15736 |
|
15737 |
|
15738 |
|
15739 |
|
15740 |
|
15741 |
|
15742 |
|
15743 |
|
15744 |
|
15745 |
|
15746 |
|
15747 |
|
15748 |
|
15749 |
|
15750 |
|
15751 |
|
15752 |
|
15753 |
|
15754 |
|
15755 |
|
15756 |
|
15757 |
|
15758 |
|
15759 |
|
15760 |
|
15761 |
|
15762 |
|
15763 |
|
15764 |
|
15765 |
|
15766 |
|
15767 |
|
15768 |
|
15769 |
|
15770 |
|
15771 |
|
15772 |
|
15773 |
|
15774 |
|
15775 |
|
15776 |
|
15777 |
|
15778 |
|
15779 |
|
15780 |
|
15781 |
|
15782 |
|
15783 |
|
15784 |
|
15785 |
|
15786 |
|
15787 |
|
15788 |
|
15789 |
|
15790 |
|
15791 |
|
15792 |
|
15793 |
|
15794 |
|
15795 |
|
15796 |
|
15797 |
|
15798 |
|
15799 |
|
15800 |
|
15801 |
|
15802 |
|
15803 |
|
15804 |
|
15805 |
|
15806 |
|
15807 |
|
15808 |
|
15809 |
|
15810 |
|
15811 |
|
15812 |
|
15813 |
|
15814 |
|
15815 |
|
15816 | gauge_background: "",
|
15817 | gauge_fullCircle: !1,
|
15818 | gauge_label_show: !0,
|
15819 | gauge_label_format: undefined,
|
15820 | gauge_label_extents: undefined,
|
15821 | gauge_label_threshold: 0,
|
15822 | gauge_min: 0,
|
15823 | gauge_max: 100,
|
15824 | gauge_type: "single",
|
15825 | gauge_startingAngle: -1 * Math.PI / 2,
|
15826 | gauge_arcLength: 100,
|
15827 | gauge_title: "",
|
15828 | gauge_units: undefined,
|
15829 | gauge_width: undefined,
|
15830 | gauge_arcs_minWidth: 5,
|
15831 | gauge_expand: {},
|
15832 | gauge_expand_rate: .98,
|
15833 | gauge_expand_duration: 50
|
15834 | });
|
15835 | ;
|
15836 |
|
15837 |
|
15838 |
|
15839 |
|
15840 |
|
15841 |
|
15842 |
|
15843 |
|
15844 | var pie = ({
|
15845 | |
15846 |
|
15847 |
|
15848 |
|
15849 |
|
15850 |
|
15851 |
|
15852 |
|
15853 |
|
15854 |
|
15855 |
|
15856 |
|
15857 |
|
15858 |
|
15859 |
|
15860 |
|
15861 |
|
15862 |
|
15863 |
|
15864 |
|
15865 |
|
15866 |
|
15867 |
|
15868 |
|
15869 |
|
15870 |
|
15871 |
|
15872 |
|
15873 |
|
15874 |
|
15875 |
|
15876 |
|
15877 |
|
15878 |
|
15879 |
|
15880 |
|
15881 |
|
15882 |
|
15883 |
|
15884 |
|
15885 |
|
15886 |
|
15887 |
|
15888 |
|
15889 |
|
15890 |
|
15891 |
|
15892 |
|
15893 |
|
15894 |
|
15895 |
|
15896 |
|
15897 |
|
15898 |
|
15899 |
|
15900 |
|
15901 |
|
15902 |
|
15903 |
|
15904 |
|
15905 |
|
15906 |
|
15907 |
|
15908 |
|
15909 |
|
15910 |
|
15911 |
|
15912 |
|
15913 |
|
15914 |
|
15915 |
|
15916 |
|
15917 |
|
15918 |
|
15919 |
|
15920 |
|
15921 |
|
15922 |
|
15923 | pie_label_show: !0,
|
15924 | pie_label_format: undefined,
|
15925 | pie_label_threshold: .05,
|
15926 | pie_label_ratio: undefined,
|
15927 | pie_expand: {},
|
15928 | pie_expand_rate: .98,
|
15929 | pie_expand_duration: 50,
|
15930 | pie_innerRadius: 0,
|
15931 | pie_outerRadius: undefined,
|
15932 | pie_padAngle: 0,
|
15933 | pie_padding: 0,
|
15934 | pie_startingAngle: 0
|
15935 | });
|
15936 | ;
|
15937 |
|
15938 |
|
15939 |
|
15940 |
|
15941 |
|
15942 |
|
15943 |
|
15944 |
|
15945 | var shape_radar = ({
|
15946 | |
15947 |
|
15948 |
|
15949 |
|
15950 |
|
15951 |
|
15952 |
|
15953 |
|
15954 |
|
15955 |
|
15956 |
|
15957 |
|
15958 |
|
15959 |
|
15960 |
|
15961 |
|
15962 |
|
15963 |
|
15964 |
|
15965 |
|
15966 |
|
15967 |
|
15968 |
|
15969 |
|
15970 |
|
15971 |
|
15972 |
|
15973 |
|
15974 |
|
15975 |
|
15976 |
|
15977 |
|
15978 |
|
15979 |
|
15980 |
|
15981 |
|
15982 |
|
15983 |
|
15984 |
|
15985 |
|
15986 |
|
15987 |
|
15988 |
|
15989 |
|
15990 |
|
15991 |
|
15992 |
|
15993 |
|
15994 |
|
15995 |
|
15996 |
|
15997 |
|
15998 |
|
15999 |
|
16000 |
|
16001 |
|
16002 | radar_axis_max: undefined,
|
16003 | radar_axis_line_show: !0,
|
16004 | radar_axis_text_show: !0,
|
16005 | radar_axis_text_position: {},
|
16006 | radar_level_depth: 3,
|
16007 | radar_level_show: !0,
|
16008 | radar_level_text_format: function radar_level_text_format(x) {
|
16009 | return x % 1 === 0 ? x : x.toFixed(2);
|
16010 | },
|
16011 | radar_level_text_show: !0,
|
16012 | radar_size_ratio: .87,
|
16013 | radar_direction_clockwise: !1
|
16014 | });
|
16015 | ;
|
16016 |
|
16017 |
|
16018 |
|
16019 |
|
16020 |
|
16021 |
|
16022 |
|
16023 |
|
16024 |
|
16025 |
|
16026 |
|
16027 |
|
16028 |
|
16029 |
|
16030 |
|
16031 |
|
16032 |
|
16033 |
|
16034 |
|
16035 |
|
16036 |
|
16037 |
|
16038 |
|
16039 |
|
16040 |
|
16041 |
|
16042 |
|
16043 |
|
16044 |
|
16045 |
|
16046 |
|
16047 |
|
16048 |
|
16049 |
|
16050 |
|
16051 |
|
16052 |
|
16053 |
|
16054 |
|
16055 |
|
16056 |
|
16057 |
|
16058 |
|
16059 | function extendAxis(module, option) {
|
16060 | extend(ChartInternal.prototype, internal.concat(module)), extend(Chart.prototype, api), Options.setOptions(options.concat(option || []));
|
16061 | }
|
16062 |
|
16063 |
|
16064 |
|
16065 |
|
16066 |
|
16067 |
|
16068 |
|
16069 |
|
16070 | function extendLine(module, option) {
|
16071 | extendAxis([point, line].concat(module || [])), Options.setOptions([common_point, shape_line].concat(option || []));
|
16072 | }
|
16073 |
|
16074 |
|
16075 |
|
16076 |
|
16077 |
|
16078 |
|
16079 |
|
16080 |
|
16081 | function extendArc(module, option) {
|
16082 | extend(ChartInternal.prototype, [arc].concat(module || [])), Options.setOptions(option);
|
16083 | }
|
16084 |
|
16085 |
|
16086 | var _area = function area() {
|
16087 | return extendLine(shape_area, [Options_shape_area]), (_area = function area() {
|
16088 | return TYPE.AREA;
|
16089 | })();
|
16090 | },
|
16091 | areaLineRange = function () {
|
16092 | return extendLine(shape_area, [Options_shape_area]), (areaLineRange = function () {
|
16093 | return TYPE.AREA_LINE_RANGE;
|
16094 | })();
|
16095 | },
|
16096 | areaSpline = function () {
|
16097 | return extendLine(shape_area, [Options_shape_area, spline]), (areaSpline = function () {
|
16098 | return TYPE.AREA_SPLINE;
|
16099 | })();
|
16100 | },
|
16101 | areaSplineRange = function () {
|
16102 | return extendLine(shape_area, [Options_shape_area, spline]), (areaSplineRange = function () {
|
16103 | return TYPE.AREA_SPLINE_RANGE;
|
16104 | })();
|
16105 | },
|
16106 | areaStep = function () {
|
16107 | return extendLine(shape_area, [Options_shape_area]), (areaStep = function () {
|
16108 | return TYPE.AREA_STEP;
|
16109 | })();
|
16110 | },
|
16111 | resolver_shape_line = function () {
|
16112 | return extendLine(), (resolver_shape_line = function () {
|
16113 | return TYPE.LINE;
|
16114 | })();
|
16115 | },
|
16116 | shape_spline = function () {
|
16117 | return extendLine(undefined, [spline]), (shape_spline = function () {
|
16118 | return TYPE.SPLINE;
|
16119 | })();
|
16120 | },
|
16121 | step = function () {
|
16122 | return extendLine(), (step = function () {
|
16123 | return TYPE.STEP;
|
16124 | })();
|
16125 | },
|
16126 | shape_donut = function () {
|
16127 | return extendArc(undefined, [donut]), (shape_donut = function () {
|
16128 | return TYPE.DONUT;
|
16129 | })();
|
16130 | },
|
16131 | resolver_shape_gauge = function () {
|
16132 | return extendArc([gauge], [shape_gauge]), (resolver_shape_gauge = function () {
|
16133 | return TYPE.GAUGE;
|
16134 | })();
|
16135 | },
|
16136 | shape_pie = function () {
|
16137 | return extendArc(undefined, [pie]), (shape_pie = function () {
|
16138 | return TYPE.PIE;
|
16139 | })();
|
16140 | },
|
16141 | resolver_shape_radar = function () {
|
16142 | return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
|
16143 | return TYPE.RADAR;
|
16144 | })();
|
16145 | },
|
16146 | resolver_shape_bar = function () {
|
16147 | return extendAxis([bar], shape_bar), (resolver_shape_bar = function () {
|
16148 | return TYPE.BAR;
|
16149 | })();
|
16150 | },
|
16151 | resolver_shape_bubble = function () {
|
16152 | return extendAxis([point, bubble], [shape_bubble, common_point]), (resolver_shape_bubble = function () {
|
16153 | return TYPE.BUBBLE;
|
16154 | })();
|
16155 | },
|
16156 | resolver_shape_candlestick = function () {
|
16157 | return extendAxis([candlestick], [shape_candlestick]), (resolver_shape_candlestick = function () {
|
16158 | return TYPE.CANDLESTICK;
|
16159 | })();
|
16160 | },
|
16161 | shape_scatter = function () {
|
16162 | return extendAxis([point], [common_point, scatter]), (shape_scatter = function () {
|
16163 | return TYPE.SCATTER;
|
16164 | })();
|
16165 | };
|
16166 | ;
|
16167 |
|
16168 |
|
16169 |
|
16170 |
|
16171 |
|
16172 |
|
16173 |
|
16174 | var selection = ({
|
16175 | |
16176 |
|
16177 |
|
16178 |
|
16179 |
|
16180 |
|
16181 |
|
16182 |
|
16183 |
|
16184 |
|
16185 |
|
16186 |
|
16187 |
|
16188 |
|
16189 |
|
16190 |
|
16191 | selected: function selected(targetId) {
|
16192 | var $$ = this.internal,
|
16193 | dataPoint = [];
|
16194 | return $$.$el.main.selectAll("." + (config_classes.shapes + $$.getTargetSelectorSuffix(targetId))).selectAll("." + config_classes.shape).filter(function () {
|
16195 | return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed(config_classes.SELECTED);
|
16196 | }).each(function (d) {
|
16197 | return dataPoint.push(d);
|
16198 | }), dataPoint;
|
16199 | },
|
16200 |
|
16201 | |
16202 |
|
16203 |
|
16204 |
|
16205 |
|
16206 |
|
16207 |
|
16208 |
|
16209 |
|
16210 |
|
16211 |
|
16212 |
|
16213 |
|
16214 |
|
16215 |
|
16216 |
|
16217 |
|
16218 |
|
16219 |
|
16220 |
|
16221 |
|
16222 |
|
16223 |
|
16224 |
|
16225 | select: function select(ids, indices, resetOther) {
|
16226 | var $$ = this.internal,
|
16227 | config = $$.config,
|
16228 | $el = $$.$el;
|
16229 | config.data_selection_enabled && $el.main.selectAll("." + config_classes.shapes).selectAll("." + config_classes.shape).each(function (d, i) {
|
16230 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
16231 | id = d.data ? d.data.id : d.id,
|
16232 | toggle = $$.getToggle(this, d).bind($$),
|
16233 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
16234 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
16235 | isSelected = shape.classed(config_classes.SELECTED);
|
16236 |
|
16237 | shape.classed(config_classes.line) || shape.classed(config_classes.area) || (isTargetId && isTargetIndex ? config.data_selection_isselectable.bind($$.api)(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));
|
16238 | });
|
16239 | },
|
16240 |
|
16241 | |
16242 |
|
16243 |
|
16244 |
|
16245 |
|
16246 |
|
16247 |
|
16248 |
|
16249 |
|
16250 |
|
16251 |
|
16252 |
|
16253 |
|
16254 |
|
16255 |
|
16256 |
|
16257 |
|
16258 | unselect: function unselect(ids, indices) {
|
16259 | var $$ = this.internal,
|
16260 | config = $$.config,
|
16261 | $el = $$.$el;
|
16262 | config.data_selection_enabled && $el.main.selectAll("." + config_classes.shapes).selectAll("." + config_classes.shape).each(function (d, i) {
|
16263 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
16264 | id = d.data ? d.data.id : d.id,
|
16265 | toggle = $$.getToggle(this, d).bind($$),
|
16266 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
16267 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
16268 | isSelected = shape.classed(config_classes.SELECTED);
|
16269 |
|
16270 | shape.classed(config_classes.line) || shape.classed(config_classes.area) || isTargetId && isTargetIndex && config.data_selection_isselectable.bind($$.api)(d) && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i);
|
16271 | });
|
16272 | }
|
16273 | });
|
16274 | ;
|
16275 |
|
16276 |
|
16277 |
|
16278 |
|
16279 |
|
16280 | var subchart = ({
|
16281 | subchart: {
|
16282 | |
16283 |
|
16284 |
|
16285 |
|
16286 |
|
16287 |
|
16288 |
|
16289 |
|
16290 |
|
16291 |
|
16292 |
|
16293 |
|
16294 |
|
16295 |
|
16296 |
|
16297 |
|
16298 |
|
16299 |
|
16300 |
|
16301 |
|
16302 |
|
16303 |
|
16304 |
|
16305 | show: function () {
|
16306 | var $$ = this.internal,
|
16307 | subchart = $$.$el.subchart,
|
16308 | config = $$.config,
|
16309 | show = config.subchart_show;
|
16310 |
|
16311 | if (!show) {
|
16312 | config.subchart_show = !show, subchart.main || $$.initSubchart();
|
16313 | var $target = subchart.main.selectAll("." + config_classes.target);
|
16314 |
|
16315 | $$.data.targets.length !== $target.size() && ($$.updateSizes(), $$.updateTargetsForSubchart($$.data.targets), $target = subchart.main.selectAll("." + config_classes.target)), $target.style("opacity", "1"), subchart.main.style("display", null), this.flush();
|
16316 | }
|
16317 | },
|
16318 |
|
16319 | |
16320 |
|
16321 |
|
16322 |
|
16323 |
|
16324 |
|
16325 |
|
16326 |
|
16327 |
|
16328 | hide: function hide() {
|
16329 | var $$ = this.internal,
|
16330 | subchart = $$.$el.subchart,
|
16331 | config = $$.config;
|
16332 | config.subchart_show && subchart.main.style("display") !== "none" && (config.subchart_show = !1, subchart.main.style("display", "none"), this.flush());
|
16333 | },
|
16334 |
|
16335 | |
16336 |
|
16337 |
|
16338 |
|
16339 |
|
16340 |
|
16341 |
|
16342 |
|
16343 |
|
16344 |
|
16345 |
|
16346 | toggle: function toggle() {
|
16347 | var $$ = this.internal,
|
16348 | config = $$.config;
|
16349 | this.subchart[config.subchart_show ? "hide" : "show"]();
|
16350 | }
|
16351 | }
|
16352 | });
|
16353 |
|
16354 | var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(14);
|
16355 | ;
|
16356 |
|
16357 |
|
16358 |
|
16359 |
|
16360 |
|
16361 |
|
16362 |
|
16363 |
|
16364 |
|
16365 |
|
16366 |
|
16367 |
|
16368 |
|
16369 |
|
16370 |
|
16371 | function withinRange(domain, range) {
|
16372 | var min = range[0],
|
16373 | max = range[1];
|
16374 | return domain.every(function (v, i) {
|
16375 | return i === 0 ? v >= min : v <= max;
|
16376 | });
|
16377 | }
|
16378 |
|
16379 |
|
16380 |
|
16381 |
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 |
|
16387 |
|
16388 |
|
16389 |
|
16390 |
|
16391 |
|
16392 |
|
16393 |
|
16394 |
|
16395 |
|
16396 |
|
16397 | var zoom = function (domainValue) {
|
16398 | var resultDomain,
|
16399 | $$ = this.internal,
|
16400 | config = $$.config,
|
16401 | scale = $$.scale,
|
16402 | domain = domainValue;
|
16403 | if (!(config.zoom_enabled && domain)) resultDomain = scale.zoom ? scale.zoom.domain() : scale.x.orgDomain();else if ($$.axis.isTimeSeries() && (domain = domain.map(function (x) {
|
16404 | return parseDate.bind($$)(x);
|
16405 | })), withinRange(domain, $$.getZoomDomain())) {
|
16406 | if ($$.api.tooltip.hide(), config.subchart_show) {
|
16407 | var xScale = scale.zoom || scale.x;
|
16408 | $$.brush.getSelection().call($$.brush.move, [xScale(domain[0]), xScale(domain[1])]), resultDomain = domain;
|
16409 | } else scale.x.domain(domain), scale.zoom = scale.x, $$.axis.x.scale(scale.zoom), resultDomain = scale.zoom.orgDomain();
|
16410 |
|
16411 | $$.redraw({
|
16412 | withTransition: !0,
|
16413 | withY: config.zoom_rescale,
|
16414 | withDimension: !1
|
16415 | }), $$.setZoomResetButton(), callFn(config.zoom_onzoom, $$.api, resultDomain);
|
16416 | }
|
16417 | return resultDomain;
|
16418 | };
|
16419 |
|
16420 | extend(zoom, {
|
16421 | |
16422 |
|
16423 |
|
16424 |
|
16425 |
|
16426 |
|
16427 |
|
16428 |
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 | enable: function enable(enabled) {
|
16440 | var $$ = this.internal,
|
16441 | config = $$.config;
|
16442 | /^(drag|wheel)$/.test(enabled) && (config.zoom_type = enabled), config.zoom_enabled = !!enabled, $$.zoom ? enabled === !1 && $$.bindZoomEvent(!1) : ($$.initZoom(), $$.bindZoomEvent()), $$.updateAndRedraw();
|
16443 | },
|
16444 |
|
16445 | |
16446 |
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 |
|
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 | max: function max(_max) {
|
16457 | var $$ = this.internal,
|
16458 | config = $$.config,
|
16459 | xDomain = $$.org.xDomain;
|
16460 | return (_max === 0 || _max) && (config.zoom_x_max = getMinMax("max", [xDomain[1], _max])), config.zoom_x_max;
|
16461 | },
|
16462 |
|
16463 | |
16464 |
|
16465 |
|
16466 |
|
16467 |
|
16468 |
|
16469 |
|
16470 |
|
16471 |
|
16472 |
|
16473 |
|
16474 | min: function min(_min) {
|
16475 | var $$ = this.internal,
|
16476 | config = $$.config,
|
16477 | xDomain = $$.org.xDomain;
|
16478 | return (_min === 0 || _min) && (config.zoom_x_min = getMinMax("min", [xDomain[0], _min])), config.zoom_x_min;
|
16479 | },
|
16480 |
|
16481 | |
16482 |
|
16483 |
|
16484 |
|
16485 |
|
16486 |
|
16487 |
|
16488 |
|
16489 |
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 |
|
16495 |
|
16496 |
|
16497 |
|
16498 | range: function range(_range) {
|
16499 | var zoom = this.zoom;
|
16500 |
|
16501 | if (isObject(_range)) {
|
16502 | var min = _range.min,
|
16503 | max = _range.max;
|
16504 | isDefined(min) && zoom.min(min), isDefined(max) && zoom.max(max);
|
16505 | }
|
16506 |
|
16507 | return {
|
16508 | min: zoom.min(),
|
16509 | max: zoom.max()
|
16510 | };
|
16511 | }
|
16512 | });
|
16513 | var api_zoom = ({
|
16514 | zoom: zoom,
|
16515 |
|
16516 | |
16517 |
|
16518 |
|
16519 |
|
16520 |
|
16521 |
|
16522 |
|
16523 |
|
16524 | unzoom: function unzoom() {
|
16525 | var $$ = this.internal,
|
16526 | config = $$.config;
|
16527 |
|
16528 | if ($$.scale.zoom) {
|
16529 | config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity), $$.updateZoom(!0), $$.zoom.resetBtn && $$.zoom.resetBtn.style("display", "none");
|
16530 |
|
16531 | var eventRects = $$.$el.main.select("." + config_classes.eventRects);
|
16532 | (0,external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomTransform)(eventRects.node()) !== external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity && $$.zoom.transform(eventRects, external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity), $$.redraw({
|
16533 | withTransition: !0,
|
16534 | withUpdateXDomain: !0,
|
16535 | withUpdateOrgXDomain: !0,
|
16536 | withY: config.zoom_rescale
|
16537 | });
|
16538 | }
|
16539 | }
|
16540 | });
|
16541 |
|
16542 | var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(13);
|
16543 | ;
|
16544 |
|
16545 |
|
16546 |
|
16547 |
|
16548 |
|
16549 |
|
16550 |
|
16551 |
|
16552 |
|
16553 |
|
16554 |
|
16555 | var drag = ({
|
16556 | |
16557 |
|
16558 |
|
16559 |
|
16560 |
|
16561 |
|
16562 | drag: function drag(mouse) {
|
16563 | var $$ = this,
|
16564 | config = $$.config,
|
16565 | state = $$.state,
|
16566 | main = $$.$el.main,
|
16567 | isSelectionGrouped = config.data_selection_grouped,
|
16568 | isSelectable = config.interaction_enabled && config.data_selection_isselectable;
|
16569 |
|
16570 | if (!$$.hasArcType() && config.data_selection_enabled && (
|
16571 | !config.zoom_enabled || $$.zoom.altDomain) && config.data_selection_multiple
|
16572 | ) {
|
16573 | var _ref = state.dragStart || [0, 0],
|
16574 | sx = _ref[0],
|
16575 | sy = _ref[1],
|
16576 | mx = mouse[0],
|
16577 | my = mouse[1],
|
16578 | minX = Math.min(sx, mx),
|
16579 | maxX = Math.max(sx, mx),
|
16580 | minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my),
|
16581 | maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
|
16582 |
|
16583 | main.select("." + config_classes.dragarea).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY), main.selectAll("." + config_classes.shapes).selectAll("." + config_classes.shape).filter(function (d) {
|
16584 | return isSelectable && isSelectable.bind($$.api)(d);
|
16585 | }).each(function (d, i) {
|
16586 | var toggle,
|
16587 | shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
16588 | isSelected = shape.classed(config_classes.SELECTED),
|
16589 | isIncluded = shape.classed(config_classes.INCLUDED),
|
16590 | isWithin = !1;
|
16591 |
|
16592 | if (shape.classed(config_classes.circle)) {
|
16593 | var x = +shape.attr("cx") * 1,
|
16594 | y = +shape.attr("cy") * 1;
|
16595 | toggle = $$.togglePoint, isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
16596 | } else if (shape.classed(config_classes.bar)) {
|
16597 | var _getPathBox = getPathBox(this),
|
16598 | _x = _getPathBox.x,
|
16599 | y = _getPathBox.y,
|
16600 | width = _getPathBox.width,
|
16601 | height = _getPathBox.height;
|
16602 |
|
16603 | toggle = $$.togglePath, isWithin = !(maxX < _x || _x + width < minX) && !(maxY < y || y + height < minY);
|
16604 | } else
|
16605 | return;
|
16606 |
|
16607 |
|
16608 | isWithin ^ isIncluded && (shape.classed(config_classes.INCLUDED, !isIncluded), shape.classed(config_classes.SELECTED, !isSelected), toggle.call($$, !isSelected, shape, d, i));
|
16609 | });
|
16610 | }
|
16611 | },
|
16612 |
|
16613 | |
16614 |
|
16615 |
|
16616 |
|
16617 |
|
16618 |
|
16619 | dragstart: function dragstart(mouse) {
|
16620 | var $$ = this,
|
16621 | config = $$.config,
|
16622 | state = $$.state,
|
16623 | main = $$.$el.main;
|
16624 | $$.hasArcType() || !config.data_selection_enabled || (state.dragStart = mouse, main.select("." + config_classes.chart).append("rect").attr("class", config_classes.dragarea).style("opacity", "0.1"), $$.setDragStatus(!0));
|
16625 | },
|
16626 |
|
16627 | |
16628 |
|
16629 |
|
16630 |
|
16631 |
|
16632 | dragend: function dragend() {
|
16633 | var $$ = this,
|
16634 | config = $$.config,
|
16635 | main = $$.$el.main;
|
16636 | $$.hasArcType() || !config.data_selection_enabled || (main.select("." + config_classes.dragarea).transition().duration(100).style("opacity", "0").remove(), main.selectAll("." + config_classes.shape).classed(config_classes.INCLUDED, !1), $$.setDragStatus(!1));
|
16637 | }
|
16638 | });
|
16639 | ;
|
16640 |
|
16641 |
|
16642 | function selection_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
16643 |
|
16644 | function selection_objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = arguments[i] == null ? {} : arguments[i], i % 2 ? selection_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : selection_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
16645 |
|
16646 |
|
16647 |
|
16648 |
|
16649 |
|
16650 |
|
16651 |
|
16652 |
|
16653 |
|
16654 |
|
16655 | var internals_selection = (selection_objectSpread(selection_objectSpread({}, drag), {}, {
|
16656 | |
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 |
|
16663 | selectPoint: function selectPoint(target, d, i) {
|
16664 | var $$ = this,
|
16665 | config = $$.config,
|
16666 | main = $$.$el.main,
|
16667 | isRotated = config.axis_rotated,
|
16668 | cx = (isRotated ? $$.circleY : $$.circleX).bind($$),
|
16669 | cy = (isRotated ? $$.circleX : $$.circleY).bind($$),
|
16670 | r = $$.pointSelectR.bind($$);
|
16671 |
|
16672 | callFn(config.data_onselected, $$.api, d, target.node()), main.select("." + config_classes.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll("." + config_classes.selectedCircle + "-" + i).data([d]).enter().append("circle").attr("class", function () {
|
16673 | return $$.generateClass(config_classes.selectedCircle, i);
|
16674 | }).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", function (d2) {
|
16675 | return $$.pointSelectR(d2) * 1.4;
|
16676 | }).transition().duration(100).attr("r", r);
|
16677 | },
|
16678 |
|
16679 | |
16680 |
|
16681 |
|
16682 |
|
16683 |
|
16684 |
|
16685 |
|
16686 | unselectPoint: function unselectPoint(target, d, i) {
|
16687 | var $$ = this,
|
16688 | config = $$.config,
|
16689 | $el = $$.$el;
|
16690 |
|
16691 | callFn(config.data_onunselected, $$.api, d, target.node()), $el.main.select("." + config_classes.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll("." + config_classes.selectedCircle + "-" + i).transition().duration(100).attr("r", 0).remove();
|
16692 | },
|
16693 |
|
16694 | |
16695 |
|
16696 |
|
16697 |
|
16698 |
|
16699 |
|
16700 |
|
16701 |
|
16702 | togglePoint: function togglePoint(selected, target, d, i) {
|
16703 | var method = (selected ? "" : "un") + "selectPoint";
|
16704 | this[method](target, d, i);
|
16705 | },
|
16706 |
|
16707 | |
16708 |
|
16709 |
|
16710 |
|
16711 |
|
16712 |
|
16713 | selectPath: function selectPath(target, d) {
|
16714 | var $$ = this,
|
16715 | config = $$.config;
|
16716 | callFn(config.data_onselected, $$.api, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () {
|
16717 | return (0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.rgb)($$.color(d)).brighter(.75);
|
16718 | });
|
16719 | },
|
16720 |
|
16721 | |
16722 |
|
16723 |
|
16724 |
|
16725 |
|
16726 |
|
16727 | unselectPath: function unselectPath(target, d) {
|
16728 | var $$ = this,
|
16729 | config = $$.config;
|
16730 | callFn(config.data_onunselected, $$.api, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () {
|
16731 | return $$.color(d);
|
16732 | });
|
16733 | },
|
16734 |
|
16735 | |
16736 |
|
16737 |
|
16738 |
|
16739 |
|
16740 |
|
16741 |
|
16742 |
|
16743 | togglePath: function togglePath(selected, target, d, i) {
|
16744 | this[(selected ? "" : "un") + "selectPath"](target, d, i);
|
16745 | },
|
16746 |
|
16747 | |
16748 |
|
16749 |
|
16750 |
|
16751 |
|
16752 |
|
16753 |
|
16754 | getToggle: function getToggle(that, d) {
|
16755 | var $$ = this;
|
16756 | return that.nodeName === "path" ? $$.togglePath : $$.isStepType(d) ? function () {} :
|
16757 | $$.togglePoint;
|
16758 | },
|
16759 |
|
16760 | |
16761 |
|
16762 |
|
16763 |
|
16764 |
|
16765 |
|
16766 |
|
16767 | toggleShape: function toggleShape(that, d, i) {
|
16768 | var toggledShape,
|
16769 | $$ = this,
|
16770 | config = $$.config,
|
16771 | main = $$.$el.main,
|
16772 | shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that),
|
16773 | isSelected = shape.classed(config_classes.SELECTED),
|
16774 | toggle = $$.getToggle(that, d).bind($$);
|
16775 |
|
16776 | if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
16777 | if (!config.data_selection_multiple) {
|
16778 | var selector = "." + config_classes.shapes;
|
16779 | config.data_selection_grouped && (selector += $$.getTargetSelectorSuffix(d.id)), main.selectAll(selector).selectAll("." + config_classes.shape).each(function (d, i) {
|
16780 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
16781 | shape.classed(config_classes.SELECTED) && (toggledShape = shape, toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i));
|
16782 | });
|
16783 | }
|
16784 |
|
16785 | toggledShape && toggledShape.node() === shape.node() || (shape.classed(config_classes.SELECTED, !isSelected), toggle(!isSelected, shape, d, i));
|
16786 | }
|
16787 | }
|
16788 | }));
|
16789 | ;
|
16790 |
|
16791 |
|
16792 |
|
16793 |
|
16794 |
|
16795 |
|
16796 |
|
16797 |
|
16798 | var interactions_subchart = ({
|
16799 | |
16800 |
|
16801 |
|
16802 |
|
16803 | initBrush: function initBrush() {
|
16804 | var $$ = this,
|
16805 | config = $$.config,
|
16806 | scale = $$.scale,
|
16807 | subchart = $$.$el.subchart,
|
16808 | isRotated = config.axis_rotated;
|
16809 | $$.brush = isRotated ? (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushY)() : (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushX)();
|
16810 |
|
16811 |
|
16812 | var lastDomain,
|
16813 | timeout,
|
16814 | brushHandler = function () {
|
16815 | $$.redrawForBrush();
|
16816 | },
|
16817 | getBrushSize = function () {
|
16818 | var brush = $$.$el.svg.select("." + config_classes.brush + " .overlay"),
|
16819 | brushSize = {
|
16820 | width: 0,
|
16821 | height: 0
|
16822 | };
|
16823 | return brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), brushSize[isRotated ? "width" : "height"];
|
16824 | };
|
16825 |
|
16826 |
|
16827 | $$.brush.on("start", function () {
|
16828 | $$.state.inputType === "touch" && $$.hideTooltip(), brushHandler();
|
16829 | }).on("brush", brushHandler).on("end", function () {
|
16830 | lastDomain = scale.x.orgDomain();
|
16831 | }), $$.brush.updateResize = function () {
|
16832 | var _this = this;
|
16833 |
|
16834 | timeout && clearTimeout(timeout), timeout = setTimeout(function () {
|
16835 | var selection = _this.getSelection();
|
16836 |
|
16837 | lastDomain && (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection.node()) && _this.move(selection, lastDomain.map(scale.subX.orgScale()));
|
16838 | }, 0);
|
16839 | }, $$.brush.update = function () {
|
16840 | var extent = this.extent()();
|
16841 | return extent[1].filter(function (v) {
|
16842 | return isNaN(v);
|
16843 | }).length === 0 && subchart.main && subchart.main.select("." + config_classes.brush).call(this), this;
|
16844 | }, $$.brush.scale = function (scale) {
|
16845 | var h = config.subchart_size_height || getBrushSize(),
|
16846 | extent = $$.getExtent();
|
16847 |
|
16848 |
|
16849 |
|
16850 | !extent && scale.range ? extent = [[0, 0], [scale.range()[1], h]] : isArray(extent) && (extent = extent.map(function (v, i) {
|
16851 | return [v, i > 0 ? h : i];
|
16852 | })), isRotated && extent[1].reverse(), this.extent(extent), this.update();
|
16853 | }, $$.brush.getSelection = function () {
|
16854 | return (
|
16855 | subchart.main ? subchart.main.select("." + config_classes.brush) : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)([])
|
16856 | );
|
16857 | };
|
16858 | },
|
16859 |
|
16860 | |
16861 |
|
16862 |
|
16863 |
|
16864 | initSubchart: function initSubchart() {
|
16865 | var $$ = this,
|
16866 | config = $$.config,
|
16867 | _$$$state = $$.state,
|
16868 | clip = _$$$state.clip,
|
16869 | hasAxis = _$$$state.hasAxis,
|
16870 | _$$$$el = $$.$el,
|
16871 | defs = _$$$$el.defs,
|
16872 | svg = _$$$$el.svg,
|
16873 | subchart = _$$$$el.subchart,
|
16874 | axis = _$$$$el.axis;
|
16875 |
|
16876 | if (hasAxis) {
|
16877 | var visibility = config.subchart_show ? "visible" : "hidden",
|
16878 | clipId = clip.id + "-subchart",
|
16879 | clipPath = $$.getClipPath(clipId);
|
16880 | clip.idSubchart = clipId, $$.appendClip(defs, clipId), $$.initBrush(), subchart.main = svg.append("g").classed(config_classes.subchart, !0).attr("transform", $$.getTranslate("context"));
|
16881 | var main = subchart.main;
|
16882 | main.style("visibility", visibility), main.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart), ["bar", "line", "bubble", "candlestick", "scatter"].forEach(function (v) {
|
16883 | var type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
|
16884 |
|
16885 | if ($$.hasType(v) || $$.hasTypeOf(type)) {
|
16886 | var chart = main.select("." + config_classes.chart),
|
16887 | chartClassName = config_classes["chart" + type + "s"];
|
16888 | chart.select("." + chartClassName).empty() && chart.append("g").attr("class", chartClassName);
|
16889 | }
|
16890 | }), main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).call($$.brush), axis.subX = main.append("g").attr("class", config_classes.axisX).attr("transform", $$.getTranslate("subX")).attr("clip-path", config.axis_rotated ? "" : clip.pathXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden");
|
16891 | }
|
16892 | },
|
16893 |
|
16894 | |
16895 |
|
16896 |
|
16897 |
|
16898 |
|
16899 | updateTargetsForSubchart: function updateTargetsForSubchart(targets) {
|
16900 | var $$ = this,
|
16901 | config = $$.config,
|
16902 | state = $$.state,
|
16903 | main = $$.$el.subchart.main;
|
16904 | config.subchart_show && (["bar", "line", "bubble", "candlestick", "scatter"].filter(function (v) {
|
16905 | return $$.hasType(v) || $$.hasTypeOf(capitalize(v));
|
16906 | }).forEach(function (v) {
|
16907 | var isPointType = /^(bubble|scatter)$/.test(v),
|
16908 | name = capitalize(isPointType ? "circle" : v),
|
16909 | chartClass = $$.getChartClass(name, !0),
|
16910 | shapeClass = $$.getClass(isPointType ? "circles" : v + "s", !0),
|
16911 | shapeChart = main.select("." + config_classes["chart" + (name + "s")]);
|
16912 |
|
16913 | if (isPointType) {
|
16914 | var circle = shapeChart.selectAll("." + config_classes.circles).data(targets.filter($$["is" + capitalize(v) + "Type"].bind($$))).attr("class", shapeClass);
|
16915 | circle.exit().remove(), circle.enter().append("g").attr("class", shapeClass);
|
16916 | } else {
|
16917 | var shapeUpdate = shapeChart.selectAll("." + config_classes["chart" + name]).attr("class", chartClass).data(targets.filter($$["is" + name + "Type"].bind($$))),
|
16918 | shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass);
|
16919 |
|
16920 | shapeUpdate.exit().remove(), v === "line" && $$.hasTypeOf("Area") && shapeEnter.append("g").attr("class", $$.getClass("areas", !0));
|
16921 | }
|
16922 | }), main.selectAll("." + config_classes.brush + " rect").attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? state.width2 : state.height2));
|
16923 | },
|
16924 |
|
16925 | |
16926 |
|
16927 |
|
16928 |
|
16929 |
|
16930 |
|
16931 |
|
16932 | redrawSubchart: function redrawSubchart(withSubchart, duration, shape) {
|
16933 | var $$ = this,
|
16934 | config = $$.config,
|
16935 | main = $$.$el.subchart.main,
|
16936 | state = $$.state,
|
16937 | withTransition = !!duration;
|
16938 |
|
16939 |
|
16940 | if (main.style("visibility", config.subchart_show ? "visible" : "hidden"), config.subchart_show && (state.event && state.event.type === "zoom" && $$.brush.update(), withSubchart && (brushEmpty($$) || $$.brush.update(), Object.keys(shape.type).forEach(function (v) {
|
16941 | var name = capitalize(v),
|
16942 | drawFn = $$["generateDraw" + name](shape.indices[v], !0);
|
16943 | $$["update" + name](duration, !0), $$["redraw" + name](drawFn, withTransition, !0);
|
16944 | }), $$.hasType("bubble") || $$.hasType("scatter"))))
|
16945 | {
|
16946 | var cx = shape.pos.cx,
|
16947 | cy = $$.updateCircleY(!0);
|
16948 | $$.updateCircle(!0), $$.redrawCircle(cx, cy, withTransition, undefined, !0);
|
16949 | }
|
16950 | },
|
16951 |
|
16952 | |
16953 |
|
16954 |
|
16955 |
|
16956 | redrawForBrush: function redrawForBrush() {
|
16957 | var $$ = this,
|
16958 | _$$$config = $$.config,
|
16959 | onBrush = _$$$config.subchart_onbrush,
|
16960 | withY = _$$$config.zoom_rescale,
|
16961 | scale = $$.scale;
|
16962 | $$.redraw({
|
16963 | withTransition: !1,
|
16964 | withY: withY,
|
16965 | withSubchart: !1,
|
16966 | withUpdateXDomain: !0,
|
16967 | withDimension: !1
|
16968 | }), onBrush.bind($$.api)(scale.x.orgDomain());
|
16969 | },
|
16970 |
|
16971 | |
16972 |
|
16973 |
|
16974 |
|
16975 |
|
16976 |
|
16977 | transformContext: function transformContext(withTransition, transitions) {
|
16978 | var subXAxis,
|
16979 | $$ = this,
|
16980 | main = $$.$el.subchart.main;
|
16981 | transitions && transitions.axisSubX ? subXAxis = transitions.axisSubX : (subXAxis = main.select("." + config_classes.axisX), withTransition && (subXAxis = subXAxis.transition())), main.attr("transform", $$.getTranslate("context")), subXAxis.attr("transform", $$.getTranslate("subX"));
|
16982 | },
|
16983 |
|
16984 | |
16985 |
|
16986 |
|
16987 |
|
16988 |
|
16989 | getExtent: function getExtent() {
|
16990 | var $$ = this,
|
16991 | config = $$.config,
|
16992 | scale = $$.scale,
|
16993 | extent = config.axis_x_extent;
|
16994 | if (extent) if (isFunction(extent)) extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX);else if ($$.axis.isTimeSeries() && extent.every(isNaN)) {
|
16995 | var fn = parseDate.bind($$);
|
16996 | extent = extent.map(function (v) {
|
16997 | return scale.subX(fn(v));
|
16998 | });
|
16999 | }
|
17000 | return extent;
|
17001 | }
|
17002 | });
|
17003 | ;
|
17004 |
|
17005 |
|
17006 |
|
17007 |
|
17008 |
|
17009 |
|
17010 |
|
17011 |
|
17012 |
|
17013 |
|
17014 | var interactions_zoom = ({
|
17015 | |
17016 |
|
17017 |
|
17018 |
|
17019 | initZoom: function initZoom() {
|
17020 | var $$ = this;
|
17021 | $$.scale.zoom = null, $$.generateZoom(), $$.initZoomBehaviour();
|
17022 | },
|
17023 |
|
17024 | |
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 | bindZoomEvent: function bindZoomEvent(bind) {
|
17030 | bind === void 0 && (bind = !0);
|
17031 | var $$ = this,
|
17032 | config = $$.config,
|
17033 | main = $$.$el.main,
|
17034 | zoomEnabled = config.zoom_enabled,
|
17035 | eventRects = main.select("." + config_classes.eventRects);
|
17036 | zoomEnabled && bind ? !config.subchart_show && $$.bindZoomOnEventRect(eventRects, config.zoom_type) : bind === !1 && ($$.api.unzoom(), eventRects.on(".zoom", null).on(".drag", null));
|
17037 | },
|
17038 |
|
17039 | |
17040 |
|
17041 |
|
17042 |
|
17043 | generateZoom: function generateZoom() {
|
17044 | var $$ = this,
|
17045 | config = $$.config,
|
17046 | org = $$.org,
|
17047 | scale = $$.scale,
|
17048 | zoom = (0,external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoom)().duration(0).on("start", $$.onZoomStart.bind($$)).on("zoom", $$.onZoom.bind($$)).on("end", $$.onZoomEnd.bind($$));
|
17049 |
|
17050 |
|
17051 |
|
17052 |
|
17053 | |
17054 |
|
17055 |
|
17056 |
|
17057 |
|
17058 |
|
17059 | zoom.orgScaleExtent = function () {
|
17060 | var extent = config.zoom_extent || [1, 10];
|
17061 | return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])];
|
17062 | }, zoom.updateScaleExtent = function () {
|
17063 | var ratio = diffDomain($$.scale.x.orgDomain()) / diffDomain($$.getZoomDomain()),
|
17064 | extent = this.orgScaleExtent();
|
17065 | return this.scaleExtent([extent[0] * ratio, extent[1] * ratio]), this;
|
17066 | }, zoom.updateTransformScale = function (transform) {
|
17067 | org.xScale && org.xScale.range(scale.x.range());
|
17068 |
|
17069 | var newScale = transform[config.axis_rotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x),
|
17070 | domain = $$.trimXDomain(newScale.domain()),
|
17071 | rescale = config.zoom_rescale;
|
17072 | newScale.domain(domain, org.xDomain), scale.zoom = $$.getCustomizedScale(newScale), $$.axis.x.scale(scale.zoom), rescale && (!org.xScale && (org.xScale = scale.x.copy()), scale.x.domain(domain));
|
17073 | }, $$.zoom = zoom;
|
17074 | },
|
17075 |
|
17076 | |
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 | onZoomStart: function onZoomStart(event) {
|
17082 | var $$ = this,
|
17083 | sourceEvent = event.sourceEvent;
|
17084 | sourceEvent && ($$.zoom.startEvent = sourceEvent, $$.state.zooming = !0, callFn($$.config.zoom_onzoomstart, $$.api, event));
|
17085 | },
|
17086 |
|
17087 | |
17088 |
|
17089 |
|
17090 |
|
17091 |
|
17092 | onZoom: function onZoom(event) {
|
17093 | var $$ = this,
|
17094 | config = $$.config,
|
17095 | scale = $$.scale,
|
17096 | org = $$.org,
|
17097 | sourceEvent = event.sourceEvent;
|
17098 |
|
17099 | if (config.zoom_enabled && event.sourceEvent && $$.filterTargetsToShow($$.data.targets).length !== 0 && (scale.zoom || !(sourceEvent.type.indexOf("touch") > -1) || sourceEvent.touches.length !== 1)) {
|
17100 | var isMousemove = sourceEvent.type === "mousemove",
|
17101 | isZoomOut = sourceEvent.wheelDelta < 0,
|
17102 | transform = event.transform;
|
17103 | !isMousemove && isZoomOut && scale.x.domain().every(function (v, i) {
|
17104 | return v !== org.xDomain[i];
|
17105 | }) && scale.x.domain(org.xDomain), $$.zoom.updateTransformScale(transform), $$.axis.isCategorized() && scale.x.orgDomain()[0] === org.xDomain[0] && scale.x.domain([org.xDomain[0] - 1e-10, scale.x.orgDomain()[1]]), $$.redraw({
|
17106 | withTransition: !1,
|
17107 | withY: config.zoom_rescale,
|
17108 | withSubchart: !1,
|
17109 | withEventRect: !1,
|
17110 | withDimension: !1
|
17111 | }), $$.state.cancelClick = isMousemove, callFn(config.zoom_onzoom, $$.api, scale.zoom.domain());
|
17112 | }
|
17113 | },
|
17114 |
|
17115 | |
17116 |
|
17117 |
|
17118 |
|
17119 |
|
17120 | onZoomEnd: function onZoomEnd(event) {
|
17121 | var $$ = this,
|
17122 | config = $$.config,
|
17123 | scale = $$.scale,
|
17124 | startEvent = $$.zoom.startEvent,
|
17125 | e = event && event.sourceEvent;
|
17126 | startEvent && startEvent.type.indexOf("touch") > -1 && (startEvent = startEvent.changedTouches[0], e = e.changedTouches[0]);
|
17127 |
|
17128 | !startEvent || e && startEvent.clientX === e.clientX && startEvent.clientY === e.clientY || ($$.redrawEventRect(), $$.updateZoom(), $$.state.zooming = !1, callFn(config.zoom_onzoomend, $$.api, scale[scale.zoom ? "zoom" : "subX"].domain()));
|
17129 | },
|
17130 |
|
17131 | |
17132 |
|
17133 |
|
17134 |
|
17135 |
|
17136 | getZoomDomain: function getZoomDomain() {
|
17137 | var $$ = this,
|
17138 | config = $$.config,
|
17139 | org = $$.org,
|
17140 | _org$xDomain = org.xDomain,
|
17141 | min = _org$xDomain[0],
|
17142 | max = _org$xDomain[1];
|
17143 | 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];
|
17144 | },
|
17145 |
|
17146 | |
17147 |
|
17148 |
|
17149 |
|
17150 |
|
17151 | updateZoom: function updateZoom(force) {
|
17152 | var $$ = this,
|
17153 | _$$$scale = $$.scale,
|
17154 | subX = _$$$scale.subX,
|
17155 | x = _$$$scale.x,
|
17156 | zoom = _$$$scale.zoom;
|
17157 |
|
17158 | if (zoom) {
|
17159 | var zoomDomain = zoom.domain(),
|
17160 | xDomain = subX.domain(),
|
17161 | delta = .015,
|
17162 | isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
|
17163 | (force || isfullyShown) && ($$.axis.x.scale(subX), x.domain(subX.orgDomain()), $$.scale.zoom = null);
|
17164 | }
|
17165 | },
|
17166 |
|
17167 | |
17168 |
|
17169 |
|
17170 |
|
17171 |
|
17172 |
|
17173 | bindZoomOnEventRect: function bindZoomOnEventRect(eventRects, type) {
|
17174 | var $$ = this,
|
17175 | behaviour = type === "drag" ? $$.zoomBehaviour : $$.zoom;
|
17176 |
|
17177 |
|
17178 | $$.$el.svg.on("wheel", function () {}), eventRects.call(behaviour).on("dblclick.zoom", null);
|
17179 | },
|
17180 |
|
17181 | |
17182 |
|
17183 |
|
17184 |
|
17185 | initZoomBehaviour: function initZoomBehaviour() {
|
17186 | var zoomRect,
|
17187 | $$ = this,
|
17188 | config = $$.config,
|
17189 | state = $$.state,
|
17190 | isRotated = config.axis_rotated,
|
17191 | start = 0,
|
17192 | end = 0,
|
17193 | prop = {
|
17194 | axis: isRotated ? "y" : "x",
|
17195 | attr: isRotated ? "height" : "width",
|
17196 | index: isRotated ? 1 : 0
|
17197 | };
|
17198 | $$.zoomBehaviour = (0,external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_.drag)().clickDistance(4).on("start", function (event) {
|
17199 | state.event = event, $$.setDragStatus(!0), $$.unselectRect(), zoomRect || (zoomRect = $$.$el.main.append("rect").attr("clip-path", state.clip.path).attr("class", config_classes.zoomBrush).attr("width", isRotated ? state.width : 0).attr("height", isRotated ? 0 : state.height)), start = getPointer(event, this)[prop.index], end = start, zoomRect.attr(prop.axis, start).attr(prop.attr, 0), $$.onZoomStart(event);
|
17200 | }).on("drag", function (event) {
|
17201 | end = getPointer(event, this)[prop.index], zoomRect.attr(prop.axis, Math.min(start, end)).attr(prop.attr, Math.abs(end - start));
|
17202 | }).on("end", function (event) {
|
17203 | var _ref,
|
17204 | scale = $$.scale.zoom || $$.scale.x;
|
17205 |
|
17206 | if (state.event = event, $$.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) {
|
17207 | return scale.invert(v);
|
17208 | })), $$.onZoomEnd(event);else if ($$.isMultipleX()) $$.clickHandlerForMultipleXS.bind(this)($$);else {
|
17209 | var _getPointer = getPointer(event),
|
17210 | x = _getPointer[0],
|
17211 | y = _getPointer[1],
|
17212 | target = browser_doc.elementFromPoint(x, y);
|
17213 |
|
17214 | $$.clickHandlerForSingleX.bind(target)((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(), $$);
|
17215 | }
|
17216 | });
|
17217 | },
|
17218 | setZoomResetButton: function setZoomResetButton() {
|
17219 | var $$ = this,
|
17220 | config = $$.config,
|
17221 | resetButton = config.zoom_resetButton;
|
17222 | resetButton && config.zoom_type === "drag" && ($$.zoom.resetBtn ? $$.zoom.resetBtn.style("display", null) : $$.zoom.resetBtn = $$.$el.chart.append("div").classed(config_classes.button, !0).append("span").on("click", function () {
|
17223 | isFunction(resetButton.onclick) && resetButton.onclick.bind($$.api)(this), $$.api.unzoom();
|
17224 | }).classed(config_classes.buttonZoomReset, !0).text(resetButton.text || "Reset Zoom"));
|
17225 | }
|
17226 | });
|
17227 | ;
|
17228 |
|
17229 |
|
17230 |
|
17231 |
|
17232 |
|
17233 |
|
17234 |
|
17235 |
|
17236 | var data_selection = ({
|
17237 | |
17238 |
|
17239 |
|
17240 |
|
17241 |
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 |
|
17256 |
|
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 |
|
17264 | data_selection_enabled: !1,
|
17265 |
|
17266 | |
17267 |
|
17268 |
|
17269 |
|
17270 |
|
17271 |
|
17272 |
|
17273 |
|
17274 |
|
17275 |
|
17276 |
|
17277 |
|
17278 |
|
17279 |
|
17280 | data_selection_grouped: !1,
|
17281 |
|
17282 | |
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 |
|
17294 |
|
17295 |
|
17296 | data_selection_isselectable: function data_selection_isselectable() {
|
17297 | return !0;
|
17298 | },
|
17299 |
|
17300 | |
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 |
|
17307 |
|
17308 |
|
17309 |
|
17310 |
|
17311 |
|
17312 |
|
17313 |
|
17314 | data_selection_multiple: !0,
|
17315 |
|
17316 | |
17317 |
|
17318 |
|
17319 |
|
17320 |
|
17321 |
|
17322 |
|
17323 |
|
17324 |
|
17325 |
|
17326 |
|
17327 |
|
17328 |
|
17329 |
|
17330 |
|
17331 | data_selection_draggable: !1,
|
17332 |
|
17333 | |
17334 |
|
17335 |
|
17336 |
|
17337 |
|
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 | data_onselected: function data_onselected() {},
|
17349 |
|
17350 | |
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 |
|
17357 |
|
17358 |
|
17359 |
|
17360 |
|
17361 |
|
17362 |
|
17363 |
|
17364 |
|
17365 | data_onunselected: function data_onunselected() {}
|
17366 | });
|
17367 | ;
|
17368 |
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 | var interaction_subchart = ({
|
17377 | |
17378 |
|
17379 |
|
17380 |
|
17381 |
|
17382 |
|
17383 |
|
17384 |
|
17385 |
|
17386 |
|
17387 |
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 |
|
17398 |
|
17399 |
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 |
|
17412 |
|
17413 |
|
17414 |
|
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 | subchart_show: !1,
|
17423 | subchart_size_height: 60,
|
17424 | subchart_axis_x_show: !0,
|
17425 | subchart_axis_x_tick_show: !0,
|
17426 | subchart_axis_x_tick_text_show: !0,
|
17427 | subchart_onbrush: function subchart_onbrush() {}
|
17428 | });
|
17429 | ;
|
17430 |
|
17431 |
|
17432 |
|
17433 |
|
17434 |
|
17435 |
|
17436 |
|
17437 |
|
17438 | var interaction_zoom = ({
|
17439 | |
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 |
|
17446 |
|
17447 |
|
17448 |
|
17449 |
|
17450 |
|
17451 |
|
17452 |
|
17453 |
|
17454 |
|
17455 |
|
17456 |
|
17457 |
|
17458 |
|
17459 |
|
17460 |
|
17461 |
|
17462 |
|
17463 |
|
17464 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 |
|
17470 |
|
17471 |
|
17472 |
|
17473 |
|
17474 |
|
17475 |
|
17476 |
|
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 |
|
17484 |
|
17485 |
|
17486 |
|
17487 |
|
17488 |
|
17489 |
|
17490 |
|
17491 |
|
17492 |
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 |
|
17498 |
|
17499 |
|
17500 |
|
17501 |
|
17502 |
|
17503 |
|
17504 |
|
17505 | zoom_enabled: !1,
|
17506 | zoom_type: "wheel",
|
17507 | zoom_extent: undefined,
|
17508 | zoom_privileged: !1,
|
17509 | zoom_rescale: !1,
|
17510 | zoom_onzoom: undefined,
|
17511 | zoom_onzoomstart: undefined,
|
17512 | zoom_onzoomend: undefined,
|
17513 | zoom_resetButton: !0,
|
17514 | zoom_x_min: undefined,
|
17515 | zoom_x_max: undefined
|
17516 | });
|
17517 | ;
|
17518 |
|
17519 |
|
17520 |
|
17521 |
|
17522 |
|
17523 |
|
17524 |
|
17525 |
|
17526 |
|
17527 |
|
17528 |
|
17529 |
|
17530 |
|
17531 |
|
17532 |
|
17533 |
|
17534 |
|
17535 |
|
17536 |
|
17537 |
|
17538 |
|
17539 |
|
17540 | var _selectionModule = function selectionModule() {
|
17541 | return extend(ChartInternal.prototype, internals_selection), extend(Chart.prototype, selection), Options.setOptions([data_selection]), (_selectionModule = function selectionModule() {
|
17542 | return !0;
|
17543 | })();
|
17544 | },
|
17545 | subchartModule = function () {
|
17546 | return extend(ChartInternal.prototype, interactions_subchart), extend(Chart.prototype, subchart), Options.setOptions([interaction_subchart]), (subchartModule = function () {
|
17547 | return !0;
|
17548 | })();
|
17549 | },
|
17550 | zoomModule = function () {
|
17551 | return extend(ChartInternal.prototype, interactions_zoom), extend(Chart.prototype, api_zoom), Options.setOptions([interaction_zoom]), (zoomModule = function () {
|
17552 | return !0;
|
17553 | })();
|
17554 | };
|
17555 | ;
|
17556 |
|
17557 |
|
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 |
|
17563 |
|
17564 | var _defaults = {},
|
17565 | bb = {
|
17566 | |
17567 |
|
17568 |
|
17569 |
|
17570 |
|
17571 |
|
17572 |
|
17573 | version: "3.0.1",
|
17574 |
|
17575 | |
17576 |
|
17577 |
|
17578 |
|
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 |
|
17584 |
|
17585 |
|
17586 |
|
17587 |
|
17588 |
|
17589 |
|
17590 |
|
17591 |
|
17592 |
|
17593 |
|
17594 |
|
17595 |
|
17596 |
|
17597 |
|
17598 |
|
17599 |
|
17600 |
|
17601 |
|
17602 |
|
17603 |
|
17604 |
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 |
|
17610 |
|
17611 |
|
17612 |
|
17613 |
|
17614 |
|
17615 |
|
17616 |
|
17617 |
|
17618 |
|
17619 |
|
17620 |
|
17621 |
|
17622 |
|
17623 |
|
17624 |
|
17625 |
|
17626 |
|
17627 |
|
17628 |
|
17629 |
|
17630 |
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 |
|
17639 |
|
17640 |
|
17641 |
|
17642 |
|
17643 |
|
17644 | generate: function generate(config) {
|
17645 | var options = mergeObj({}, _defaults, config),
|
17646 | inst = new Chart(options);
|
17647 | return inst.internal.charts = this.instance, this.instance.push(inst), inst;
|
17648 | },
|
17649 |
|
17650 | |
17651 |
|
17652 |
|
17653 |
|
17654 |
|
17655 |
|
17656 |
|
17657 |
|
17658 |
|
17659 |
|
17660 |
|
17661 |
|
17662 |
|
17663 |
|
17664 |
|
17665 |
|
17666 |
|
17667 |
|
17668 |
|
17669 |
|
17670 |
|
17671 |
|
17672 | defaults: function defaults(options) {
|
17673 | return isObject(options) && (_defaults = options), _defaults;
|
17674 | },
|
17675 |
|
17676 | |
17677 |
|
17678 |
|
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 | instance: [],
|
17688 |
|
17689 | |
17690 |
|
17691 |
|
17692 |
|
17693 |
|
17694 |
|
17695 |
|
17696 |
|
17697 | plugin: {}
|
17698 | };
|
17699 |
|
17700 |
|
17701 |
|
17702 |
|
17703 | ;
|
17704 |
|
17705 |
|
17706 |
|
17707 |
|
17708 |
|
17709 |
|
17710 |
|
17711 | Object.keys(resolver_shape_namespaceObject).forEach(function (v) {
|
17712 | return resolver_shape_namespaceObject[v]();
|
17713 | }), Object.keys(resolver_interaction_namespaceObject).forEach(function (v) {
|
17714 | return resolver_interaction_namespaceObject[v]();
|
17715 | });
|
17716 |
|
17717 | }();
|
17718 | return __webpack_exports__;
|
17719 | })()
|
17720 | ;
|
17721 | }); |
\ | No newline at end of file |