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-time-format"), require("d3-selection"), require("d3-transition"), require("d3-axis"), require("d3-scale"), require("d3-brush"), require("d3-dsv"), require("d3-drag"), require("d3-shape"), require("d3-interpolate"), require("d3-color"), require("d3-zoom"), require("d3-ease"));
|
13 | else if(typeof define === 'function' && define.amd)
|
14 | define(["d3-time-format", "d3-selection", "d3-transition", "d3-axis", "d3-scale", "d3-brush", "d3-dsv", "d3-drag", "d3-shape", "d3-interpolate", "d3-color", "d3-zoom", "d3-ease"], factory);
|
15 | else {
|
16 | var a = typeof exports === 'object' ? factory(require("d3-time-format"), require("d3-selection"), require("d3-transition"), require("d3-axis"), require("d3-scale"), require("d3-brush"), require("d3-dsv"), require("d3-drag"), require("d3-shape"), require("d3-interpolate"), require("d3-color"), require("d3-zoom"), require("d3-ease")) : 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__2__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__) {
|
20 | return (function(modules) {
|
21 |
|
22 | var installedModules = {};
|
23 |
|
24 |
|
25 | function __webpack_require__(moduleId) {
|
26 |
|
27 |
|
28 | if(installedModules[moduleId]) {
|
29 | return installedModules[moduleId].exports;
|
30 | }
|
31 |
|
32 | var module = installedModules[moduleId] = {
|
33 | i: moduleId,
|
34 | l: false,
|
35 | exports: {}
|
36 | };
|
37 |
|
38 |
|
39 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
40 |
|
41 |
|
42 | module.l = true;
|
43 |
|
44 |
|
45 | return module.exports;
|
46 | }
|
47 |
|
48 |
|
49 |
|
50 | __webpack_require__.m = modules;
|
51 |
|
52 |
|
53 | __webpack_require__.c = installedModules;
|
54 |
|
55 |
|
56 | __webpack_require__.d = function(exports, name, getter) {
|
57 | if(!__webpack_require__.o(exports, name)) {
|
58 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
59 | }
|
60 | };
|
61 |
|
62 |
|
63 | __webpack_require__.r = function(exports) {
|
64 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
65 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
66 | }
|
67 | Object.defineProperty(exports, '__esModule', { value: true });
|
68 | };
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | __webpack_require__.t = function(value, mode) {
|
76 | if(mode & 1) value = __webpack_require__(value);
|
77 | if(mode & 8) return value;
|
78 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
79 | var ns = Object.create(null);
|
80 | __webpack_require__.r(ns);
|
81 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
82 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
83 | return ns;
|
84 | };
|
85 |
|
86 |
|
87 | __webpack_require__.n = function(module) {
|
88 | var getter = module && module.__esModule ?
|
89 | function getDefault() { return module['default']; } :
|
90 | function getModuleExports() { return module; };
|
91 | __webpack_require__.d(getter, 'a', getter);
|
92 | return getter;
|
93 | };
|
94 |
|
95 |
|
96 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
97 |
|
98 |
|
99 | __webpack_require__.p = "";
|
100 |
|
101 |
|
102 |
|
103 | return __webpack_require__(__webpack_require__.s = 0);
|
104 | })
|
105 |
|
106 | ([
|
107 |
|
108 | (function(module, exports, __webpack_require__) {
|
109 |
|
110 | __webpack_require__(1);
|
111 | module.exports = __webpack_require__(15);
|
112 |
|
113 |
|
114 | }),
|
115 |
|
116 | (function(module, exports, __webpack_require__) {
|
117 |
|
118 |
|
119 |
|
120 | }),
|
121 |
|
122 | (function(module, exports) {
|
123 |
|
124 | module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
125 |
|
126 | }),
|
127 |
|
128 | (function(module, exports) {
|
129 |
|
130 | module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
|
131 |
|
132 | }),
|
133 |
|
134 | (function(module, exports) {
|
135 |
|
136 | module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
137 |
|
138 | }),
|
139 |
|
140 | (function(module, exports) {
|
141 |
|
142 | module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
|
143 |
|
144 | }),
|
145 |
|
146 | (function(module, exports) {
|
147 |
|
148 | module.exports = __WEBPACK_EXTERNAL_MODULE__6__;
|
149 |
|
150 | }),
|
151 |
|
152 | (function(module, exports) {
|
153 |
|
154 | module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
155 |
|
156 | }),
|
157 |
|
158 | (function(module, exports) {
|
159 |
|
160 | module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
161 |
|
162 | }),
|
163 |
|
164 | (function(module, exports) {
|
165 |
|
166 | module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
167 |
|
168 | }),
|
169 |
|
170 | (function(module, exports) {
|
171 |
|
172 | module.exports = __WEBPACK_EXTERNAL_MODULE__10__;
|
173 |
|
174 | }),
|
175 |
|
176 | (function(module, exports) {
|
177 |
|
178 | module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
|
179 |
|
180 | }),
|
181 |
|
182 | (function(module, exports) {
|
183 |
|
184 | module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
185 |
|
186 | }),
|
187 |
|
188 | (function(module, exports) {
|
189 |
|
190 | module.exports = __WEBPACK_EXTERNAL_MODULE__13__;
|
191 |
|
192 | }),
|
193 |
|
194 | (function(module, exports) {
|
195 |
|
196 | module.exports = __WEBPACK_EXTERNAL_MODULE__14__;
|
197 |
|
198 | }),
|
199 |
|
200 | (function(module, __webpack_exports__, __webpack_require__) {
|
201 |
|
202 | "use strict";
|
203 |
|
204 | __webpack_require__.r(__webpack_exports__);
|
205 |
|
206 |
|
207 | __webpack_require__.d(__webpack_exports__, "bb", function() { return bb; });
|
208 |
|
209 |
|
210 | function _classCallCheck(instance, Constructor) {
|
211 | if (!(instance instanceof Constructor)) {
|
212 | throw new TypeError("Cannot call a class as a function");
|
213 | }
|
214 | }
|
215 |
|
216 | function _arrayWithHoles(arr) {
|
217 | if (Array.isArray(arr)) return arr;
|
218 | }
|
219 |
|
220 | function _iterableToArrayLimit(arr, i) {
|
221 | if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
222 | return;
|
223 | }
|
224 |
|
225 | var _arr = [];
|
226 | var _n = true;
|
227 | var _d = false;
|
228 | var _e = undefined;
|
229 |
|
230 | try {
|
231 | for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
232 | _arr.push(_s.value);
|
233 |
|
234 | if (i && _arr.length === i) break;
|
235 | }
|
236 | } catch (err) {
|
237 | _d = true;
|
238 | _e = err;
|
239 | } finally {
|
240 | try {
|
241 | if (!_n && _i["return"] != null) _i["return"]();
|
242 | } finally {
|
243 | if (_d) throw _e;
|
244 | }
|
245 | }
|
246 |
|
247 | return _arr;
|
248 | }
|
249 |
|
250 | function _nonIterableRest() {
|
251 | throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
252 | }
|
253 |
|
254 |
|
255 |
|
256 |
|
257 | function _slicedToArray(arr, i) {
|
258 | return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
259 | }
|
260 |
|
261 | function _defineProperties(target, props) {
|
262 | for (var i = 0; i < props.length; i++) {
|
263 | var descriptor = props[i];
|
264 | descriptor.enumerable = descriptor.enumerable || false;
|
265 | descriptor.configurable = true;
|
266 | if ("value" in descriptor) descriptor.writable = true;
|
267 | Object.defineProperty(target, descriptor.key, descriptor);
|
268 | }
|
269 | }
|
270 |
|
271 | function _createClass(Constructor, protoProps, staticProps) {
|
272 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
273 | if (staticProps) _defineProperties(Constructor, staticProps);
|
274 | return Constructor;
|
275 | }
|
276 |
|
277 | var external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_ = __webpack_require__(2);
|
278 |
|
279 |
|
280 | var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(3);
|
281 |
|
282 |
|
283 | var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_ = __webpack_require__(4);
|
284 |
|
285 |
|
286 | var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(5);
|
287 |
|
288 |
|
289 | var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(6);
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 | var config_classes = ({
|
302 | arc: "bb-arc",
|
303 | arcLabelLine: "bb-arc-label-line",
|
304 | arcs: "bb-arcs",
|
305 | area: "bb-area",
|
306 | areas: "bb-areas",
|
307 | axis: "bb-axis",
|
308 | axisX: "bb-axis-x",
|
309 | axisXLabel: "bb-axis-x-label",
|
310 | axisY: "bb-axis-y",
|
311 | axisY2: "bb-axis-y2",
|
312 | axisY2Label: "bb-axis-y2-label",
|
313 | axisYLabel: "bb-axis-y-label",
|
314 | bar: "bb-bar",
|
315 | bars: "bb-bars",
|
316 | brush: "bb-brush",
|
317 | button: "bb-button",
|
318 | buttonZoomReset: "bb-zoom-reset",
|
319 | chart: "bb-chart",
|
320 | chartArc: "bb-chart-arc",
|
321 | chartArcs: "bb-chart-arcs",
|
322 | chartArcsBackground: "bb-chart-arcs-background",
|
323 | chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
324 | chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
325 | chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
326 | chartArcsTitle: "bb-chart-arcs-title",
|
327 | chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
328 | chartBar: "bb-chart-bar",
|
329 | chartBars: "bb-chart-bars",
|
330 | chartLine: "bb-chart-line",
|
331 | chartLines: "bb-chart-lines",
|
332 | chartRadar: "bb-chart-radar",
|
333 | chartRadars: "bb-chart-radars",
|
334 | chartText: "bb-chart-text",
|
335 | chartTexts: "bb-chart-texts",
|
336 | circle: "bb-circle",
|
337 | circles: "bb-circles",
|
338 | colorPattern: "bb-color-pattern",
|
339 | colorScale: "bb-colorscale",
|
340 | defocused: "bb-defocused",
|
341 | dragarea: "bb-dragarea",
|
342 | empty: "bb-empty",
|
343 | eventRect: "bb-event-rect",
|
344 | eventRects: "bb-event-rects",
|
345 | eventRectsMultiple: "bb-event-rects-multiple",
|
346 | eventRectsSingle: "bb-event-rects-single",
|
347 | focused: "bb-focused",
|
348 | gaugeValue: "bb-gauge-value",
|
349 | grid: "bb-grid",
|
350 | gridLines: "bb-grid-lines",
|
351 | legendBackground: "bb-legend-background",
|
352 | legendItem: "bb-legend-item",
|
353 | legendItemEvent: "bb-legend-item-event",
|
354 | legendItemFocused: "bb-legend-item-focused",
|
355 | legendItemHidden: "bb-legend-item-hidden",
|
356 | legendItemPoint: "bb-legend-item-point",
|
357 | legendItemTile: "bb-legend-item-tile",
|
358 | level: "bb-level",
|
359 | levels: "bb-levels",
|
360 | line: "bb-line",
|
361 | lines: "bb-lines",
|
362 | region: "bb-region",
|
363 | regions: "bb-regions",
|
364 | selectedCircle: "bb-selected-circle",
|
365 | selectedCircles: "bb-selected-circles",
|
366 | shape: "bb-shape",
|
367 | shapes: "bb-shapes",
|
368 | stanfordElements: "bb-stanford-elements",
|
369 | stanfordLine: "bb-stanford-line",
|
370 | stanfordLines: "bb-stanford-lines",
|
371 | stanfordRegion: "bb-stanford-region",
|
372 | stanfordRegions: "bb-stanford-regions",
|
373 | target: "bb-target",
|
374 | text: "bb-text",
|
375 | texts: "bb-texts",
|
376 | title: "bb-title",
|
377 | tooltip: "bb-tooltip",
|
378 | tooltipContainer: "bb-tooltip-container",
|
379 | tooltipName: "bb-tooltip-name",
|
380 | xgrid: "bb-xgrid",
|
381 | xgridFocus: "bb-xgrid-focus",
|
382 | xgridLine: "bb-xgrid-line",
|
383 | xgridLines: "bb-xgrid-lines",
|
384 | xgrids: "bb-xgrids",
|
385 | ygrid: "bb-ygrid",
|
386 | ygridFocus: "bb-ygrid-focus",
|
387 | ygridLine: "bb-ygrid-line",
|
388 | ygridLines: "bb-ygrid-lines",
|
389 | ygrids: "bb-ygrids",
|
390 | zoomBrush: "bb-zoom-brush",
|
391 | zoomRect: "bb-zoom-rect",
|
392 | EXPANDED: "_expanded_",
|
393 | SELECTED: "_selected_",
|
394 | INCLUDED: "_included_",
|
395 | TextOverlapping: "text-overlapping"
|
396 | });
|
397 |
|
398 | function _arrayWithoutHoles(arr) {
|
399 | if (Array.isArray(arr)) {
|
400 | for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
401 | arr2[i] = arr[i];
|
402 | }
|
403 |
|
404 | return arr2;
|
405 | }
|
406 | }
|
407 |
|
408 | function _iterableToArray(iter) {
|
409 | if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
410 | }
|
411 |
|
412 | function _nonIterableSpread() {
|
413 | throw new TypeError("Invalid attempt to spread non-iterable instance");
|
414 | }
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | function _toConsumableArray(arr) {
|
420 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
421 | }
|
422 |
|
423 | function _typeof(obj) {
|
424 | "@babel/helpers - typeof";
|
425 |
|
426 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
427 | _typeof = function _typeof(obj) {
|
428 | return typeof obj;
|
429 | };
|
430 | } else {
|
431 | _typeof = function _typeof(obj) {
|
432 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
433 | };
|
434 | }
|
435 |
|
436 | return _typeof(obj);
|
437 | }
|
438 |
|
439 | var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(7);
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | var win = function () {
|
455 | var def = function (o) {
|
456 | return typeof o !== "undefined" && o;
|
457 | };
|
458 |
|
459 | return def(self) || def(window) || def(global) || def(globalThis) || Function("return this")();
|
460 | }(),
|
461 | browser_doc = win && win.document;
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 | var isValue = function (v) {
|
481 | return v || v === 0;
|
482 | },
|
483 | isFunction = function (v) {
|
484 | return typeof v === "function";
|
485 | },
|
486 | isString = function (v) {
|
487 | return typeof v === "string";
|
488 | },
|
489 | isNumber = function (v) {
|
490 | return typeof v === "number";
|
491 | },
|
492 | isUndefined = function (v) {
|
493 | return typeof v === "undefined";
|
494 | },
|
495 | isDefined = function (v) {
|
496 | return typeof v !== "undefined";
|
497 | },
|
498 | isBoolean = function (v) {
|
499 | return typeof v === "boolean";
|
500 | },
|
501 | ceil10 = function (v) {
|
502 | return Math.ceil(v / 10) * 10;
|
503 | },
|
504 | asHalfPixel = function (n) {
|
505 | return Math.ceil(n) + .5;
|
506 | },
|
507 | diffDomain = function (d) {
|
508 | return d[1] - d[0];
|
509 | },
|
510 | isObjectType = function (v) {
|
511 | return _typeof(v) === "object";
|
512 | },
|
513 | isEmpty = function (o) {
|
514 | return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
515 | },
|
516 | notEmpty = function (o) {
|
517 | return !isEmpty(o);
|
518 | },
|
519 | isArray = function (arr) {
|
520 | return arr && arr.constructor === Array;
|
521 | },
|
522 | isObject = function (obj) {
|
523 | return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj);
|
524 | },
|
525 | getOption = function (options, key, defaultValue) {
|
526 | return isDefined(options[key]) ? options[key] : defaultValue;
|
527 | },
|
528 | util_hasValue = function (dict, value) {
|
529 | var found = !1;
|
530 | return Object.keys(dict).forEach(function (key) {
|
531 | return dict[key] === value && (found = !0);
|
532 | }), found;
|
533 | },
|
534 | callFn = function (fn) {
|
535 | 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];
|
536 |
|
537 | return isFn && fn.call.apply(fn, args), isFn;
|
538 | },
|
539 | sanitise = function (str) {
|
540 | return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
541 | },
|
542 | setTextValue = function (node, text) {
|
543 | var dy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [-1, 1],
|
544 | toMiddle = !!(arguments.length > 3 && arguments[3] !== undefined) && arguments[3];
|
545 | if (node && isString(text)) if (text.indexOf("\n") === -1) node.text(text);else {
|
546 | var diff = [node.text(), text].map(function (v) {
|
547 | return v.replace(/[\s\n]/g, "");
|
548 | });
|
549 |
|
550 | if (diff[0] !== diff[1]) {
|
551 | var multiline = text.split("\n"),
|
552 | len = toMiddle ? multiline.length - 1 : 1;
|
553 | node.html(""), multiline.forEach(function (v, i) {
|
554 | node.append("tspan").attr("x", 0).attr("dy", "".concat(i === 0 ? dy[0] * len : dy[1], "em")).text(v);
|
555 | });
|
556 | }
|
557 | }
|
558 | },
|
559 | getRectSegList = function (path) {
|
560 | |
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 | var _path$getBBox = path.getBBox(),
|
568 | x = _path$getBBox.x,
|
569 | y = _path$getBBox.y,
|
570 | width = _path$getBBox.width,
|
571 | height = _path$getBBox.height;
|
572 |
|
573 | return [{
|
574 | x: x,
|
575 | y: y + height
|
576 | },
|
577 | {
|
578 | x: x,
|
579 | y: y
|
580 | },
|
581 | {
|
582 | x: x + width,
|
583 | y: y
|
584 | },
|
585 | {
|
586 | x: x + width,
|
587 | y: y + height
|
588 | }
|
589 | ];
|
590 | },
|
591 | getPathBox = function (path) {
|
592 | var _path$getBoundingClie = path.getBoundingClientRect(),
|
593 | width = _path$getBoundingClie.width,
|
594 | height = _path$getBoundingClie.height,
|
595 | items = getRectSegList(path),
|
596 | x = items[0].x,
|
597 | y = Math.min(items[0].y, items[1].y);
|
598 |
|
599 | return {
|
600 | x: x,
|
601 | y: y,
|
602 | width: width,
|
603 | height: height
|
604 | };
|
605 | },
|
606 | getBrushSelection = function (ctx) {
|
607 | var selection = null,
|
608 | event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"],
|
609 | main = ctx.context || ctx.main;
|
610 | return event && event.constructor.name === "BrushEvent" ? selection = event.selection : main && (selection = main.select(".".concat(config_classes.brush)).node()) && (selection = Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushSelection"])(selection)), selection;
|
611 | },
|
612 | getBoundingRect = function (node) {
|
613 | return node.rect || (node.rect = node.getBoundingClientRect());
|
614 | },
|
615 | getRandom = function () {
|
616 | var asStr = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0];
|
617 | return Math.random() + (asStr ? "" : 0);
|
618 | },
|
619 | brushEmpty = function (ctx) {
|
620 | var selection = getBrushSelection(ctx);
|
621 | return !selection || selection[0] === selection[1];
|
622 | },
|
623 | extend = function () {
|
624 | var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
625 | source = arguments.length > 1 ? arguments[1] : undefined;
|
626 |
|
627 | for (var p in source) target[p] = source[p];
|
628 |
|
629 | return target;
|
630 | },
|
631 | capitalize = function (str) {
|
632 | return str.charAt(0).toUpperCase() + str.slice(1);
|
633 | },
|
634 | toArray = function (v) {
|
635 | return [].slice.call(v);
|
636 | },
|
637 | getCssRules = function (styleSheets) {
|
638 | var rules = [];
|
639 | return styleSheets.forEach(function (sheet) {
|
640 | try {
|
641 | sheet.cssRules && sheet.cssRules.length && (rules = rules.concat(toArray(sheet.cssRules)));
|
642 | } catch (e) {
|
643 | console.error("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
|
644 | }
|
645 | }), rules;
|
646 | },
|
647 | getTranslation = function (node) {
|
648 | var transform = node ? node.transform : null,
|
649 | baseVal = transform ? transform.baseVal : [];
|
650 | return baseVal.length ? baseVal.getItem(0).matrix : {
|
651 | a: 0,
|
652 | b: 0,
|
653 | c: 0,
|
654 | d: 0,
|
655 | e: 0,
|
656 | f: 0
|
657 | };
|
658 | },
|
659 | getUnique = function (data) {
|
660 | var isDate = data[0] instanceof Date,
|
661 | d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
662 | return self.indexOf(v) === i;
|
663 | });
|
664 | return isDate ? d.map(function (v) {
|
665 | return new Date(v);
|
666 | }) : d;
|
667 | },
|
668 | mergeArray = function (arr) {
|
669 | return arr && arr.length ? arr.reduce(function (p, c) {
|
670 | return p.concat(c);
|
671 | }) : [];
|
672 | },
|
673 | mergeObj = function (_mergeObj) {
|
674 | function mergeObj() {
|
675 | return _mergeObj.apply(this, arguments);
|
676 | }
|
677 |
|
678 | return mergeObj.toString = function () {
|
679 | return _mergeObj.toString();
|
680 | }, mergeObj;
|
681 | }(function (target) {
|
682 | for (var _len2 = arguments.length, objectN = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) objectN[_key2 - 1] = arguments[_key2];
|
683 |
|
684 | if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
685 | var source = objectN.shift();
|
686 | return isObject(target) && isObject(source) && Object.keys(source).forEach(function (key) {
|
687 | var value = source[key];
|
688 | isObject(value) ? (!target[key] && (target[key] = {}), target[key] = mergeObj(target[key], value)) : target[key] = isArray(value) ? value.concat() : value;
|
689 | }), mergeObj.apply(void 0, [target].concat(objectN));
|
690 | }),
|
691 | sortValue = function (data) {
|
692 | var fn,
|
693 | isAsc = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1];
|
694 | return data[0] instanceof Date ? fn = isAsc ? function (a, b) {
|
695 | return a - b;
|
696 | } : function (a, b) {
|
697 | return b - a;
|
698 | } : isAsc && !data.every(isNaN) ? fn = function (a, b) {
|
699 | return a - b;
|
700 | } : !isAsc && (fn = function (a, b) {
|
701 | return a > b && -1 || a < b && 1 || a === b && 0;
|
702 | }), data.concat().sort(fn);
|
703 | },
|
704 | getMinMax = function (type, data) {
|
705 | var res = data.filter(function (v) {
|
706 | return notEmpty(v);
|
707 | });
|
708 | return res.length ? isNumber(res[0]) ? res = Math[type].apply(Math, _toConsumableArray(res)) : res[0] instanceof Date && (res = sortValue(res, type === "min")[0]) : res = undefined, res;
|
709 | },
|
710 | getRange = function (start, end) {
|
711 | var res = [];
|
712 |
|
713 | for (var i = start; i < end; i++) res.push(i);
|
714 |
|
715 | return res;
|
716 | },
|
717 | emulateEvent = {
|
718 | mouse: function () {
|
719 | var getParams = function () {
|
720 | return {
|
721 | bubbles: !1,
|
722 | cancelable: !1,
|
723 | screenX: 0,
|
724 | screenY: 0,
|
725 | clientX: 0,
|
726 | clientY: 0
|
727 | };
|
728 | };
|
729 |
|
730 | try {
|
731 | return new MouseEvent("t"), function (el, eventType) {
|
732 | var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams();
|
733 | el.dispatchEvent(new MouseEvent(eventType, params));
|
734 | };
|
735 | } catch (e) {
|
736 |
|
737 | return function (el, eventType) {
|
738 | var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams(),
|
739 | mouseEvent = browser_doc.createEvent("MouseEvent");
|
740 | mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
741 | params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
742 | };
|
743 | }
|
744 | }(),
|
745 | touch: function touch(el, eventType, params) {
|
746 | var touchObj = new Touch(mergeObj({
|
747 | identifier: Date.now(),
|
748 | target: el,
|
749 | radiusX: 2.5,
|
750 | radiusY: 2.5,
|
751 | rotationAngle: 10,
|
752 | force: .5
|
753 | }, params));
|
754 | el.dispatchEvent(new TouchEvent(eventType, {
|
755 | cancelable: !0,
|
756 | bubbles: !0,
|
757 | shiftKey: !0,
|
758 | touches: [touchObj],
|
759 | targetTouches: [],
|
760 | changedTouches: [touchObj]
|
761 | }));
|
762 | }
|
763 | },
|
764 | tplProcess = function (tpl, data) {
|
765 | var res = tpl;
|
766 |
|
767 | for (var x in data) res = res.replace(new RegExp("{=".concat(x, "}"), "g"), data[x]);
|
768 |
|
769 | return res;
|
770 | };
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 | var AxisRendererHelper_AxisRendererHelper = function () {
|
788 | function AxisRendererHelper(owner) {
|
789 | _classCallCheck(this, AxisRendererHelper);
|
790 |
|
791 | var scale = Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleLinear"])(),
|
792 | config = owner.config,
|
793 | params = owner.params;
|
794 | this.owner = owner, this.config = config, this.scale = scale, (config.noTransition || !params.config.transition_duration) && (config.withoutTransition = !0), config.range = scale.rangeExtent ? scale.rangeExtent() : this.scaleExtent((params.orgXScale || scale).range());
|
795 | }
|
796 | |
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 | return _createClass(AxisRendererHelper, [{
|
805 | key: "getTickTransformSetter",
|
806 |
|
807 | |
808 |
|
809 |
|
810 |
|
811 |
|
812 | value: function getTickTransformSetter(id) {
|
813 | var config = this.config,
|
814 | fn = id === "x" ? function (value) {
|
815 | return "translate(".concat(value + config.tickOffset, ",0)");
|
816 | } : function (value) {
|
817 | return "translate(0,".concat(value, ")");
|
818 | };
|
819 | return function (selection, scale) {
|
820 | selection.attr("transform", function (d) {
|
821 | return fn(Math.ceil(scale(d)));
|
822 | });
|
823 | };
|
824 | }
|
825 | }, {
|
826 | key: "scaleExtent",
|
827 | value: function scaleExtent(domain) {
|
828 | var start = domain[0],
|
829 | stop = domain[domain.length - 1];
|
830 | return start < stop ? [start, stop] : [stop, start];
|
831 | }
|
832 | }, {
|
833 | key: "generateTicks",
|
834 | value: function generateTicks(scale, isYAxes) {
|
835 | var tickStepSize = this.owner.params.tickStepSize,
|
836 | ticks = [];
|
837 |
|
838 | if (isYAxes && tickStepSize) for (var _scale$domain = scale.domain(), _scale$domain2 = _slicedToArray(_scale$domain, 2), start = _scale$domain2[0], end = _scale$domain2[1], interval = start; interval <= end;) ticks.push(interval), interval += tickStepSize;else if (scale.ticks) ticks = scale.ticks.apply(scale, _toConsumableArray(this.config.tickArguments || [])).map(function (v) {
|
839 | return (
|
840 | isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v
|
841 | );
|
842 | });else {
|
843 | for (var domain = scale.domain(), i = Math.ceil(domain[0]); i < domain[1]; i++) ticks.push(i);
|
844 |
|
845 | ticks.length > 0 && ticks[0] > 0 && ticks.unshift(ticks[0] - (ticks[1] - ticks[0]));
|
846 | }
|
847 | return ticks;
|
848 | }
|
849 | }, {
|
850 | key: "copyScale",
|
851 | value: function copyScale() {
|
852 | var newScale = this.scale.copy();
|
853 | return newScale.domain().length || newScale.domain(this.scale.domain()), newScale;
|
854 | }
|
855 | }, {
|
856 | key: "textFormatted",
|
857 | value: function textFormatted(v) {
|
858 | var tickFormat = this.config.tickFormat,
|
859 | value = /\d+\.\d+0{5,}\d$/.test(v) ? +(v + "").replace(/0+\d$/, "") : v,
|
860 | formatted = tickFormat ? tickFormat(value) : value;
|
861 |
|
862 |
|
863 |
|
864 | return isDefined(formatted) ? formatted : "";
|
865 | }
|
866 | }, {
|
867 | key: "transitionise",
|
868 | value: function transitionise(selection) {
|
869 | var config = this.config;
|
870 | return config.withoutTransition ? selection.interrupt() : selection.transition(config.transition);
|
871 | }
|
872 | }], [{
|
873 | key: "getSizeFor1Char",
|
874 | value: function getSizeFor1Char(node) {
|
875 |
|
876 | var size = {
|
877 | w: 5.5,
|
878 | h: 11.5
|
879 | };
|
880 | return node.empty() || node.select("text").text("0").call(function (el) {
|
881 | try {
|
882 | var _el$node$getBBox = el.node().getBBox(),
|
883 | width = _el$node$getBBox.width,
|
884 | height = _el$node$getBBox.height;
|
885 |
|
886 | width && height && (size.w = width, size.h = height);
|
887 | } catch (e) {} finally {
|
888 | el.text("");
|
889 | }
|
890 | }), this.getSizeFor1Char = function () {
|
891 | return size;
|
892 | }, size;
|
893 | }
|
894 | }]), AxisRendererHelper;
|
895 | }();
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 | var AxisRenderer_AxisRenderer = function () {
|
912 | function AxisRenderer() {
|
913 | var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
914 |
|
915 | _classCallCheck(this, AxisRenderer);
|
916 |
|
917 | var config = {
|
918 | innerTickSize: 6,
|
919 | outerTickSize: params.outerTick ? 6 : 0,
|
920 | orient: "bottom",
|
921 | range: [],
|
922 | tickArguments: null,
|
923 | tickCentered: null,
|
924 | tickCulling: !0,
|
925 | tickFormat: null,
|
926 | tickLength: 9,
|
927 | tickOffset: 0,
|
928 | tickPadding: 3,
|
929 | tickValues: null,
|
930 | transition: null,
|
931 | noTransition: params.noTransition
|
932 | };
|
933 | config.tickLength = Math.max(config.innerTickSize, 0) + config.tickPadding, this.config = config, this.params = params, this.helper = new AxisRendererHelper_AxisRendererHelper(this);
|
934 | }
|
935 | |
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 | return _createClass(AxisRenderer, [{
|
943 | key: "create",
|
944 | value: function create(g) {
|
945 | var ctx = this,
|
946 | config = this.config,
|
947 | params = this.params,
|
948 | helperInst = this.helper,
|
949 | scale = helperInst.scale,
|
950 | orient = config.orient,
|
951 | splitTickText = this.splitTickText.bind(this),
|
952 | isLeftRight = /^(left|right)$/.test(orient),
|
953 | isTopBottom = /^(top|bottom)$/.test(orient),
|
954 | tickTransform = helperInst.getTickTransformSetter(isTopBottom ? "x" : "y"),
|
955 | axisPx = tickTransform === helperInst.axisX ? "y" : "x",
|
956 | sign = /^(top|left)$/.test(orient) ? -1 : 1,
|
957 | rotate = params.tickTextRotate;
|
958 | this.config.range = scale.rangeExtent ? scale.rangeExtent() : helperInst.scaleExtent((params.orgXScale || scale).range());
|
959 | var _config = config,
|
960 | innerTickSize = _config.innerTickSize,
|
961 | tickLength = _config.tickLength,
|
962 | range = _config.range,
|
963 | name = params.name,
|
964 | tickTextPos = name && /^(x|y|y2)$/.test(name) ? params.config["axis_".concat(name, "_tick_text_position")] : {
|
965 | x: 0,
|
966 | y: 0
|
967 | },
|
968 | prefix = name === "subX" ? "subchart_axis_x" : "axis_".concat(name),
|
969 | axisShow = params.config["".concat(prefix, "_show")],
|
970 | tickShow = {
|
971 | tick: !!axisShow && params.config["".concat(prefix, "_tick_show")],
|
972 | text: !!axisShow && params.config["".concat(prefix, "_tick_text_show")]
|
973 | },
|
974 | $g = null;
|
975 |
|
976 | g.each(function () {
|
977 | var g = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
978 | scale0 = this.__chart__ || scale,
|
979 | scale1 = helperInst.copyScale();
|
980 | $g = g, this.__chart__ = scale1, config.tickOffset = params.isCategory ? Math.ceil((scale1(1) - scale1(0)) / 2) : 0;
|
981 |
|
982 | var path = g.selectAll(".domain").data([0]);
|
983 |
|
984 | if (path.enter().append("path").attr("class", "domain").merge(helperInst.transitionise(path)).attr("d", function () {
|
985 | var outerTickSized = config.outerTickSize * sign;
|
986 | return isTopBottom ? "M".concat(range[0], ",").concat(outerTickSized, "V0H").concat(range[1], "V").concat(outerTickSized) : "M".concat(outerTickSized, ",").concat(range[0], "H0V").concat(range[1], "H").concat(outerTickSized);
|
987 | }), tickShow.tick || tickShow.text) {
|
988 |
|
989 | var ticks = config.tickValues || helperInst.generateTicks(scale1, isLeftRight),
|
990 | tick = g.selectAll(".tick").data(ticks, scale1),
|
991 | tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", "1"),
|
992 | tickExit = tick.exit().remove();
|
993 |
|
994 | tick = tickEnter.merge(tick), tickShow.tick && tickEnter.append("line"), tickShow.text && tickEnter.append("text");
|
995 | var sizeFor1Char = AxisRendererHelper_AxisRendererHelper.getSizeFor1Char(tick),
|
996 | counts = [],
|
997 | tspan = tick.select("text").selectAll("tspan").data(function (d, index) {
|
998 | var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helperInst.textFormatted(d)) ? helperInst.textFormatted(d).concat() : [helperInst.textFormatted(d)];
|
999 | return counts[index] = split.length, split.map(function (splitted) {
|
1000 | return {
|
1001 | index: index,
|
1002 | splitted: splitted
|
1003 | };
|
1004 | });
|
1005 | });
|
1006 | tspan.exit().remove(), tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) {
|
1007 | return d.splitted;
|
1008 | }), tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", function () {
|
1009 | var dx = 0;
|
1010 | return /(top|bottom)/.test(orient) && rotate && (dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1)), dx + (tickTextPos.x || 0);
|
1011 | }()).attr("dy", function (d, i) {
|
1012 | var dy = 0;
|
1013 | 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";
|
1014 | });
|
1015 | var lineUpdate = tick.select("line"),
|
1016 | textUpdate = tick.select("text");
|
1017 |
|
1018 |
|
1019 | if (tickEnter.select("line").attr("".concat(axisPx, "2"), innerTickSize * sign), tickEnter.select("text").attr(axisPx, tickLength * sign), ctx.setTickLineTextPosition(lineUpdate, textUpdate), params.tickTitle) {
|
1020 | var title = textUpdate.select("title");
|
1021 | (title.empty() ? textUpdate.append("title") : title).text(function (index) {
|
1022 | return params.tickTitle[index];
|
1023 | });
|
1024 | }
|
1025 |
|
1026 | if (scale1.bandwidth) {
|
1027 | var x = scale1,
|
1028 | dx = x.bandwidth() / 2;
|
1029 | scale0 = function (d) {
|
1030 | return x(d) + dx;
|
1031 | }, scale1 = scale0;
|
1032 | } else scale0.bandwidth ? scale0 = scale1 : tickTransform(tickExit, scale1);
|
1033 |
|
1034 | tickTransform(tickEnter, scale0), tickTransform(helperInst.transitionise(tick).style("opacity", "1"), scale1);
|
1035 | }
|
1036 | }), this.g = $g;
|
1037 | }
|
1038 | |
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 | }, {
|
1045 | key: "getTickXY",
|
1046 | value: function getTickXY() {
|
1047 | var config = this.config,
|
1048 | pos = {
|
1049 | x: 0,
|
1050 | y: 0
|
1051 | };
|
1052 | return this.params.isCategory && (pos.x = config.tickCentered ? 0 : config.tickOffset, pos.y = config.tickCentered ? config.tickOffset : 0), pos;
|
1053 | }
|
1054 | |
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 | }, {
|
1062 | key: "getTickSize",
|
1063 | value: function getTickSize(d) {
|
1064 | var scale = this.helper.scale,
|
1065 | config = this.config,
|
1066 | innerTickSize = config.innerTickSize,
|
1067 | range = config.range,
|
1068 | tickPosition = scale(d) + (config.tickCentered ? 0 : config.tickOffset);
|
1069 | return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;
|
1070 | }
|
1071 | |
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 | }, {
|
1080 | key: "setTickLineTextPosition",
|
1081 | value: function setTickLineTextPosition(lineUpdate, textUpdate) {
|
1082 | var tickPos = this.getTickXY(),
|
1083 | _this$config = this.config,
|
1084 | innerTickSize = _this$config.innerTickSize,
|
1085 | orient = _this$config.orient,
|
1086 | tickLength = _this$config.tickLength,
|
1087 | tickOffset = _this$config.tickOffset,
|
1088 | rotate = this.params.tickTextRotate,
|
1089 | textAnchorForText = function (r) {
|
1090 | var value = ["start", "end"];
|
1091 | return orient === "top" && value.reverse(), r ? r > 0 ? value[0] : value[1] : "middle";
|
1092 | },
|
1093 | textTransform = function (r) {
|
1094 | return r ? "rotate(".concat(r, ")") : null;
|
1095 | },
|
1096 | yForText = function (r) {
|
1097 | var r2 = r / (orient === "bottom" ? 15 : 23);
|
1098 | return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
|
1099 | };
|
1100 |
|
1101 | 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;
|
1102 | }
|
1103 |
|
1104 | }, {
|
1105 | key: "splitTickText",
|
1106 | value: function splitTickText(d, scale, ticks, isLeftRight, charWidth) {
|
1107 | function split(splitted, text) {
|
1108 | for (var subtext, spaceIndex, textWidth, i = 1; i < text.length; i++)
|
1109 | 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));
|
1110 |
|
1111 | return splitted.concat(text);
|
1112 | }
|
1113 |
|
1114 | var params = this.params,
|
1115 | tickText = this.helper.textFormatted(d),
|
1116 | splitted = isString(tickText) && tickText.indexOf("\n") > -1 ? tickText.split("\n") : [];
|
1117 | if (splitted.length) return splitted;
|
1118 | if (isArray(tickText)) return tickText;
|
1119 | var tickWidth = params.tickWidth;
|
1120 | return (!tickWidth || tickWidth <= 0) && (tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110), split(splitted, tickText + "");
|
1121 | }
|
1122 | }, {
|
1123 | key: "scale",
|
1124 | value: function scale(x) {
|
1125 | return arguments.length ? (this.helper.scale = x, this) : this.helper.scale;
|
1126 | }
|
1127 | }, {
|
1128 | key: "orient",
|
1129 | value: function orient(x) {
|
1130 | return arguments.length ? (this.config.orient = x in {
|
1131 | top: 1,
|
1132 | right: 1,
|
1133 | bottom: 1,
|
1134 | left: 1
|
1135 | } ? x + "" : "bottom", this) : this.config.orient;
|
1136 | }
|
1137 | }, {
|
1138 | key: "tickFormat",
|
1139 | value: function tickFormat(format) {
|
1140 | return arguments.length ? (this.config.tickFormat = format, this) : this.config.tickFormat;
|
1141 | }
|
1142 | }, {
|
1143 | key: "tickCentered",
|
1144 | value: function tickCentered(isCentered) {
|
1145 | var config = this.config;
|
1146 | return arguments.length ? (config.tickCentered = isCentered, this) : config.tickCentered;
|
1147 | }
|
1148 | |
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 | }, {
|
1156 | key: "tickOffset",
|
1157 | value: function tickOffset() {
|
1158 | return this.config.tickOffset;
|
1159 | }
|
1160 | |
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 | }, {
|
1168 | key: "tickInterval",
|
1169 | value: function tickInterval(size) {
|
1170 | var interval;
|
1171 | if (this.params.isCategory) interval = this.config.tickOffset * 2;else {
|
1172 | var length = this.g.select("path.domain").node().getTotalLength() - this.config.outerTickSize * 2;
|
1173 | interval = length / (size || this.g.selectAll("line").size());
|
1174 | }
|
1175 | return interval === Infinity ? 0 : interval;
|
1176 | }
|
1177 | }, {
|
1178 | key: "ticks",
|
1179 | value: function ticks() {
|
1180 | for (var config = this.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
1181 |
|
1182 | return args.length ? (config.tickArguments = toArray(args), this) : config.tickArguments;
|
1183 | }
|
1184 | }, {
|
1185 | key: "tickCulling",
|
1186 | value: function tickCulling(culling) {
|
1187 | var config = this.config;
|
1188 | return arguments.length ? (config.tickCulling = culling, this) : config.tickCulling;
|
1189 | }
|
1190 | }, {
|
1191 | key: "tickValues",
|
1192 | value: function tickValues(x) {
|
1193 | var _this = this,
|
1194 | config = this.config;
|
1195 |
|
1196 | if (isFunction(x)) config.tickValues = function () {
|
1197 | return x(_this.helper.scale.domain());
|
1198 | };else {
|
1199 | if (!arguments.length) return config.tickValues;
|
1200 | config.tickValues = x;
|
1201 | }
|
1202 | return this;
|
1203 | }
|
1204 | }, {
|
1205 | key: "setTransition",
|
1206 | value: function setTransition(t) {
|
1207 | return this.config.transition = t, this;
|
1208 | }
|
1209 | }]), AxisRenderer;
|
1210 | }();
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 | var isHorizontal = function ($$, forHorizontal) {
|
1229 | var isRotated = $$.config.axis_rotated;
|
1230 | return forHorizontal ? isRotated : !isRotated;
|
1231 | },
|
1232 | getAxisClassName = function (id) {
|
1233 | return "".concat(config_classes.axis, " ").concat(config_classes["axis".concat(capitalize(id))]);
|
1234 | };
|
1235 |
|
1236 | var Axis_Axis = function () {
|
1237 | function Axis(owner) {
|
1238 | _classCallCheck(this, Axis), this.owner = owner, this.setOrient();
|
1239 | }
|
1240 |
|
1241 | return _createClass(Axis, [{
|
1242 | key: "init",
|
1243 | value: function init() {
|
1244 | var _this = this,
|
1245 | $$ = this.owner,
|
1246 | config = $$.config,
|
1247 | isRotated = config.axis_rotated,
|
1248 | main = $$.main,
|
1249 | target = ["x", "y"];
|
1250 |
|
1251 | config.axis_y2_show && target.push("y2"), $$.axesList = {}, target.forEach(function (v) {
|
1252 | var classAxis = getAxisClassName(v),
|
1253 | classLabel = config_classes["axis".concat(v.toUpperCase(), "Label")];
|
1254 | $$.axes[v] = main.append("g").attr("class", classAxis).attr("clip-path", function () {
|
1255 | var res = null;
|
1256 | return v === "x" ? res = $$.clipPathForXAxis : v === "y" && config.axis_y_inner && (res = $$.clipPathForYAxis), res;
|
1257 | }).attr("transform", $$.getTranslate(v)).style("visibility", config["axis_".concat(v, "_show")] ? "visible" : "hidden"), $$.axes[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", function () {
|
1258 | return _this.textAnchorForAxisLabel(v);
|
1259 | }), _this.generateAxes(v);
|
1260 | });
|
1261 | }
|
1262 | |
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 | }, {
|
1268 | key: "setOrient",
|
1269 | value: function setOrient() {
|
1270 | var $$ = this.owner,
|
1271 | config = $$.config,
|
1272 | isRotated = config.axis_rotated,
|
1273 | yInner = config.axis_y_inner,
|
1274 | y2Inner = config.axis_y2_inner;
|
1275 | $$.xOrient = isRotated ? "left" : "bottom", $$.yOrient = isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left", $$.y2Orient = isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right", $$.subXOrient = isRotated ? "left" : "bottom";
|
1276 | }
|
1277 | |
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 | }, {
|
1285 | key: "generateAxes",
|
1286 | value: function generateAxes(id) {
|
1287 | var d3Axis,
|
1288 | $$ = this.owner,
|
1289 | config = $$.config,
|
1290 | axes = [],
|
1291 | axesConfig = config["axis_".concat(id, "_axes")],
|
1292 | isRotated = config.axis_rotated;
|
1293 | 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) {
|
1294 | var tick = v.tick || {},
|
1295 | scale = $$[id].copy();
|
1296 | v.domain && scale.domain(v.domain), axes.push(d3Axis(scale).ticks(tick.count).tickFormat(tick.format || function (x) {
|
1297 | return x;
|
1298 | }).tickValues(tick.values).tickSizeOuter(tick.outer === !1 ? 0 : 6));
|
1299 | }), $$.axesList[id] = axes;
|
1300 | }
|
1301 | |
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 | }, {
|
1307 | key: "updateAxes",
|
1308 | value: function updateAxes() {
|
1309 | var $$ = this.owner,
|
1310 | config = $$.config;
|
1311 | Object.keys($$.axesList).forEach(function (id) {
|
1312 | var axesConfig = config["axis_".concat(id, "_axes")],
|
1313 | scale = $$[id].copy(),
|
1314 | range = scale.range();
|
1315 | $$.axesList[id].forEach(function (v, i) {
|
1316 | var axisRange = v.scale().range();
|
1317 |
|
1318 |
|
1319 | range.every(function (v, i) {
|
1320 | return v === axisRange[i];
|
1321 | }) || v.scale().range(range);
|
1322 | var className = "".concat(getAxisClassName(id), "-").concat(i + 1),
|
1323 | g = $$.main.select(".".concat(className.replace(/\s/, ".")));
|
1324 | g.empty() ? g = $$.main.append("g").attr("class", className).style("visibility", config["axis_".concat(id, "_show")] ? "visible" : "hidden").call(v) : (axesConfig[i].domain && scale.domain(axesConfig[i].domain), $$.xAxis.helper.transitionise(g).call(v.scale(scale))), g.attr("transform", $$.getTranslate(id, i + 1));
|
1325 | });
|
1326 | });
|
1327 | }
|
1328 |
|
1329 | }, {
|
1330 | key: "getAxis",
|
1331 | value: function getAxis(name, scale, outerTick, noTransition, noTickTextRotate) {
|
1332 | var $$ = this.owner,
|
1333 | config = $$.config,
|
1334 | isX = /^(x|subX)$/.test(name),
|
1335 | type = isX ? "x" : name,
|
1336 | isCategory = isX && $$.isCategorized(),
|
1337 | orient = $$["".concat(name, "Orient")],
|
1338 | tickFormat = isX ? $$.xAxisTickFormat : config["axis_".concat(name, "_tick_format")],
|
1339 | tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type),
|
1340 | tickValues = isX ? $$.xAxisTickValues : $$["".concat(name, "AxisTickValues")],
|
1341 | axisParams = mergeObj({
|
1342 | outerTick: outerTick,
|
1343 | noTransition: noTransition,
|
1344 | config: config,
|
1345 | name: name,
|
1346 | tickTextRotate: tickTextRotate
|
1347 | }, isX && {
|
1348 | isCategory: isCategory,
|
1349 | tickMultiline: config.axis_x_tick_multiline,
|
1350 | tickWidth: config.axis_x_tick_width,
|
1351 | tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
1352 | orgXScale: $$.x
|
1353 | });
|
1354 | isX || (axisParams.tickStepSize = config["axis_".concat(type, "_tick_stepSize")]);
|
1355 | var axis = new AxisRenderer_AxisRenderer(axisParams).scale(isX && $$.zoomScale || scale).orient(orient);
|
1356 | isX && $$.isTimeSeries() && tickValues && !isFunction(tickValues) ? tickValues = tickValues.map(function (v) {
|
1357 | return $$.parseDate(v);
|
1358 | }) : !isX && $$.isTimeSeriesY() && (axis.ticks(config.axis_y_tick_time_value), tickValues = null), tickValues && axis.tickValues(tickValues), axis.tickFormat(tickFormat || !isX && $$.isStackNormalized() && function (x) {
|
1359 | return "".concat(x, "%");
|
1360 | }), isCategory && (axis.tickCentered(config.axis_x_tick_centered), isEmpty(config.axis_x_tick_culling) && (config.axis_x_tick_culling = !1));
|
1361 | var tickCount = config["axis_".concat(type, "_tick_count")];
|
1362 | return tickCount && axis.ticks(tickCount), axis;
|
1363 | }
|
1364 | }, {
|
1365 | key: "updateXAxisTickValues",
|
1366 | value: function updateXAxisTickValues(targets, axis) {
|
1367 | var values,
|
1368 | $$ = this.owner,
|
1369 | config = $$.config,
|
1370 | fit = config.axis_x_tick_fit,
|
1371 | count = config.axis_x_tick_count;
|
1372 | return (fit || count && fit) && (values = this.generateTickValues($$.mapTargetsToUniqueXs(targets), count, $$.isTimeSeries())), axis ? axis.tickValues(values) : $$.xAxis && ($$.xAxis.tickValues(values), $$.subXAxis.tickValues(values)), values;
|
1373 | }
|
1374 | }, {
|
1375 | key: "getId",
|
1376 | value: function getId(id) {
|
1377 | var config = this.owner.config;
|
1378 | return id in config.data_axes ? config.data_axes[id] : "y";
|
1379 | }
|
1380 | }, {
|
1381 | key: "getXAxisTickFormat",
|
1382 | value: function getXAxisTickFormat() {
|
1383 | var format,
|
1384 | $$ = this.owner,
|
1385 | config = $$.config,
|
1386 | tickFormat = config.axis_x_tick_format,
|
1387 | isTimeSeries = $$.isTimeSeries(),
|
1388 | isCategorized = $$.isCategorized();
|
1389 | return tickFormat ? isFunction(tickFormat) ? format = tickFormat : isTimeSeries && (format = function (date) {
|
1390 | return date ? $$.axisTimeFormat(tickFormat)(date) : "";
|
1391 | }) : format = isTimeSeries ? $$.defaultAxisTimeFormat : isCategorized ? $$.categoryName : function (v) {
|
1392 | return v < 0 ? v.toFixed(0) : v;
|
1393 | }, isFunction(format) ? function (v) {
|
1394 | return format.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]);
|
1395 | } : format;
|
1396 | }
|
1397 | }, {
|
1398 | key: "getTickValues",
|
1399 | value: function getTickValues(id) {
|
1400 | var $$ = this.owner,
|
1401 | tickValues = $$.config["axis_".concat(id, "_tick_values")],
|
1402 | axis = $$["".concat(id, "Axis")];
|
1403 | return (isFunction(tickValues) ? tickValues() : tickValues) || (axis ? axis.tickValues() : undefined);
|
1404 | }
|
1405 | }, {
|
1406 | key: "getLabelOptionByAxisId",
|
1407 | value: function getLabelOptionByAxisId(id) {
|
1408 | return this.owner.config["axis_".concat(id, "_label")];
|
1409 | }
|
1410 | }, {
|
1411 | key: "getLabelText",
|
1412 | value: function getLabelText(id) {
|
1413 | var option = this.getLabelOptionByAxisId(id);
|
1414 | return isString(option) ? option : option ? option.text : null;
|
1415 | }
|
1416 | }, {
|
1417 | key: "setLabelText",
|
1418 | value: function setLabelText(id, text) {
|
1419 | var $$ = this.owner,
|
1420 | config = $$.config,
|
1421 | option = this.getLabelOptionByAxisId(id);
|
1422 | isString(option) ? config["axis_".concat(id, "_label")] = text : option && (option.text = text);
|
1423 | }
|
1424 | }, {
|
1425 | key: "getLabelPosition",
|
1426 | value: function getLabelPosition(id, defaultPosition) {
|
1427 | var isRotated = this.owner.config.axis_rotated,
|
1428 | option = this.getLabelOptionByAxisId(id),
|
1429 | position = isObjectType(option) && option.position ? option.position : defaultPosition[+!isRotated],
|
1430 | has = function (v) {
|
1431 | return !!~position.indexOf(v);
|
1432 | };
|
1433 |
|
1434 | return {
|
1435 | isInner: has("inner"),
|
1436 | isOuter: has("outer"),
|
1437 | isLeft: has("left"),
|
1438 | isCenter: has("center"),
|
1439 | isRight: has("right"),
|
1440 | isTop: has("top"),
|
1441 | isMiddle: has("middle"),
|
1442 | isBottom: has("bottom")
|
1443 | };
|
1444 | }
|
1445 | }, {
|
1446 | key: "getAxisLabelPosition",
|
1447 | value: function getAxisLabelPosition(id) {
|
1448 | return this.getLabelPosition(id, id === "x" ? ["inner-top", "inner-right"] : ["inner-right", "inner-top"]);
|
1449 | }
|
1450 | }, {
|
1451 | key: "getLabelPositionById",
|
1452 | value: function getLabelPositionById(id) {
|
1453 | return this.getAxisLabelPosition(id);
|
1454 | }
|
1455 | }, {
|
1456 | key: "xForAxisLabel",
|
1457 | value: function xForAxisLabel(id) {
|
1458 | var $$ = this.owner,
|
1459 | position = this.getAxisLabelPosition(id),
|
1460 | x = position.isMiddle ? -$$.height / 2 : 0;
|
1461 | return isHorizontal($$, id !== "x") ? x = position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width : position.isBottom && (x = -$$.height), x;
|
1462 | }
|
1463 | }, {
|
1464 | key: "dxForAxisLabel",
|
1465 | value: function dxForAxisLabel(id) {
|
1466 | var $$ = this.owner,
|
1467 | position = this.getAxisLabelPosition(id),
|
1468 | dx = position.isBottom ? "0.5em" : "0";
|
1469 | return isHorizontal($$, id !== "x") ? dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0" : position.isTop && (dx = "-0.5em"), dx;
|
1470 | }
|
1471 | }, {
|
1472 | key: "textAnchorForAxisLabel",
|
1473 | value: function textAnchorForAxisLabel(id) {
|
1474 | var $$ = this.owner,
|
1475 | position = this.getAxisLabelPosition(id),
|
1476 | anchor = position.isMiddle ? "middle" : "end";
|
1477 | return isHorizontal($$, id !== "x") ? anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end" : position.isBottom && (anchor = "start"), anchor;
|
1478 | }
|
1479 | }, {
|
1480 | key: "dyForAxisLabel",
|
1481 | value: function dyForAxisLabel(id) {
|
1482 | var dy,
|
1483 | $$ = this.owner,
|
1484 | config = $$.config,
|
1485 | isRotated = config.axis_rotated,
|
1486 | isInner = this.getAxisLabelPosition(id).isInner,
|
1487 | tickRotate = config["axis_".concat(id, "_tick_rotate")] ? $$.getHorizontalAxisHeight(id) : 0,
|
1488 | maxTickWidth = this.getMaxTickWidth(id);
|
1489 |
|
1490 | if (id === "x") {
|
1491 | var xHeight = config.axis_x_height;
|
1492 | dy = isRotated ? isInner ? "1.2em" : -25 - maxTickWidth : isInner ? "-0.5em" : xHeight ? xHeight - 10 : tickRotate ? tickRotate - 10 : "3em";
|
1493 | } else dy = {
|
1494 | y: ["-0.5em", 10, "3em", "1.2em", 10],
|
1495 | y2: ["1.2em", -20, "-2.2em", "-0.5em", 15]
|
1496 | }[id], dy = isRotated ? isInner ? dy[0] : tickRotate ? tickRotate * (id === "y2" ? -1 : 1) - dy[1] : dy[2] : isInner ? dy[3] : (dy[4] + (config["axis_".concat(id, "_inner")] ? 0 : maxTickWidth + dy[4])) * (id === "y" ? -1 : 1);
|
1497 |
|
1498 | return dy;
|
1499 | }
|
1500 | }, {
|
1501 | key: "getMaxTickWidth",
|
1502 | value: function getMaxTickWidth(id, withoutRecompute) {
|
1503 | var $$ = this.owner,
|
1504 | config = $$.config,
|
1505 | currentTickMax = $$.currentMaxTickWidths[id],
|
1506 | maxWidth = 0;
|
1507 | if (withoutRecompute || !config["axis_".concat(id, "_show")] || $$.filterTargetsToShow().length === 0) return currentTickMax.size;
|
1508 |
|
1509 | if ($$.svg) {
|
1510 | var isYAxis = /^y2?$/.test(id),
|
1511 | targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
1512 | scale = $$[id].copy().domain($$["get".concat(isYAxis ? "Y" : "X", "Domain")](targetsToShow, id)),
|
1513 | domain = scale.domain();
|
1514 |
|
1515 | if (domain[0] === domain[1] || isArray(currentTickMax.domain) && currentTickMax.domain[0] === currentTickMax.domain[1]) return currentTickMax.size;
|
1516 | currentTickMax.domain = domain;
|
1517 | var axis = this.getAxis(id, scale, !1, !1, !0),
|
1518 | tickCount = config["axis_".concat(id, "_tick_count")],
|
1519 | tickValues = config["axis_".concat(id, "_tick_values")];
|
1520 | !tickValues && tickCount && axis.tickValues(this.generateTickValues(domain, tickCount, isYAxis ? $$.isTimeSeriesY() : $$.isTimeSeries())), isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
|
1521 | var dummy = $$.selectChart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0px").style("left", "0px");
|
1522 | axis.create(dummy), dummy.selectAll("text").each(function (d, i) {
|
1523 | var currentTextWidth = this.getBoundingClientRect().width;
|
1524 | maxWidth = Math.max(maxWidth, currentTextWidth), id === "x" && ($$.currentMaxTickWidths.x.ticks[i] = currentTextWidth);
|
1525 | }), dummy.remove();
|
1526 | }
|
1527 |
|
1528 | return maxWidth > 0 && (currentTickMax.size = maxWidth), currentTickMax.size;
|
1529 | }
|
1530 | }, {
|
1531 | key: "getXAxisTickTextY2Overflow",
|
1532 | value: function getXAxisTickTextY2Overflow(defaultPadding) {
|
1533 | var $$ = this.owner,
|
1534 | config = $$.config,
|
1535 | xAxisTickRotate = $$.getAxisTickRotate("x");
|
1536 |
|
1537 | if (($$.isCategorized() || $$.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
|
1538 | var widthWithoutCurrentPaddingLeft = $$.currentWidth - $$.getCurrentPaddingLeft(),
|
1539 | maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding),
|
1540 | xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
|
1541 |
|
1542 | return Math.min(xAxisTickTextY2Overflow, widthWithoutCurrentPaddingLeft / 2);
|
1543 | }
|
1544 |
|
1545 | return 0;
|
1546 | }
|
1547 | }, {
|
1548 | key: "getXAxisTickMaxOverflow",
|
1549 | value: function getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft) {
|
1550 | for (var $$ = this.owner, config = $$.config, isTimeSeries = $$.isTimeSeries(), tickTextWidths = $$.currentMaxTickWidths.x.ticks, tickCount = tickTextWidths.length, _this$x$padding = this.x.padding, left = _this$x$padding.left, right = _this$x$padding.right, maxOverflow = 0, remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0), i = 0; i < tickCount; i++) {
|
1551 | var tickIndex = i + 1,
|
1552 | rotatedTickTextWidth = Math.cos(Math.PI * xAxisTickRotate / 180) * tickTextWidths[i],
|
1553 | ticksBeforeTickText = tickIndex - (isTimeSeries ? 1 : .5) + left;
|
1554 |
|
1555 |
|
1556 | if (!(ticksBeforeTickText <= 0)) {
|
1557 | var tickLength = (widthWithoutCurrentPaddingLeft - rotatedTickTextWidth) / ticksBeforeTickText;
|
1558 | maxOverflow = Math.max(maxOverflow, rotatedTickTextWidth - tickLength / 2 - ((remaining - tickIndex) * tickLength + right * tickLength));
|
1559 | }
|
1560 | }
|
1561 |
|
1562 | var tickOffset = 0;
|
1563 |
|
1564 | if (!isTimeSeries) {
|
1565 | var scale = Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleLinear"])().domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]).range([0, widthWithoutCurrentPaddingLeft - maxOverflow]);
|
1566 | tickOffset = Math.ceil((scale(1) - scale(0)) / 2);
|
1567 | }
|
1568 |
|
1569 | return maxOverflow + tickOffset;
|
1570 | }
|
1571 | |
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 | }, {
|
1579 | key: "getXAxisPadding",
|
1580 | value: function getXAxisPadding(tickCount) {
|
1581 | var $$ = this.owner,
|
1582 | padding = $$.config.axis_x_padding;
|
1583 |
|
1584 | if (isEmpty(padding) ? padding = {
|
1585 | left: 0,
|
1586 | right: 0
|
1587 | } : (padding.left = padding.left || 0, padding.right = padding.right || 0), $$.isTimeSeries()) {
|
1588 | var firstX = +$$.getXDomainMin($$.data.targets),
|
1589 | lastX = +$$.getXDomainMax($$.data.targets),
|
1590 | timeDiff = lastX - firstX,
|
1591 | range = timeDiff + padding.left + padding.right,
|
1592 | relativeTickWidth = timeDiff / tickCount / range,
|
1593 | left = padding.left / range / relativeTickWidth || 0,
|
1594 | _right = padding.right / range / relativeTickWidth || 0;
|
1595 |
|
1596 | padding = {
|
1597 | left: left,
|
1598 | right: _right
|
1599 | };
|
1600 | }
|
1601 |
|
1602 | return padding;
|
1603 | }
|
1604 | }, {
|
1605 | key: "updateLabels",
|
1606 | value: function updateLabels(withTransition) {
|
1607 | var _this2 = this,
|
1608 | $$ = this.owner,
|
1609 | labels = {
|
1610 | x: $$.main.select(".".concat(config_classes.axisX, " .").concat(config_classes.axisXLabel)),
|
1611 | y: $$.main.select(".".concat(config_classes.axisY, " .").concat(config_classes.axisYLabel)),
|
1612 | y2: $$.main.select(".".concat(config_classes.axisY2, " .").concat(config_classes.axisY2Label))
|
1613 | };
|
1614 |
|
1615 | Object.keys(labels).filter(function (id) {
|
1616 | return !labels[id].empty();
|
1617 | }).forEach(function (v) {
|
1618 | var node = labels[v];
|
1619 | (withTransition ? node.transition() : node).attr("x", function () {
|
1620 | return _this2.xForAxisLabel(v);
|
1621 | }).attr("dx", function () {
|
1622 | return _this2.dxForAxisLabel(v);
|
1623 | }).attr("dy", function () {
|
1624 | return _this2.dyForAxisLabel(v);
|
1625 | }).text(function () {
|
1626 | return _this2.getLabelText(v);
|
1627 | });
|
1628 | });
|
1629 | }
|
1630 | }, {
|
1631 | key: "getPadding",
|
1632 | value: function getPadding(padding, key, defaultValue, domainLength) {
|
1633 | var p = isNumber(padding) ? padding : padding[key];
|
1634 | return isValue(p) ? this.convertPixelsToAxisPadding(p, domainLength) : defaultValue;
|
1635 | }
|
1636 | }, {
|
1637 | key: "convertPixelsToAxisPadding",
|
1638 | value: function convertPixelsToAxisPadding(pixels, domainLength) {
|
1639 | var $$ = this.owner,
|
1640 | length = $$.config.axis_rotated ? $$.width : $$.height;
|
1641 | return domainLength * (pixels / length);
|
1642 | }
|
1643 | }, {
|
1644 | key: "generateTickValues",
|
1645 | value: function generateTickValues(values, tickCount, forTimeSeries) {
|
1646 | var start,
|
1647 | end,
|
1648 | count,
|
1649 | interval,
|
1650 | i,
|
1651 | tickValue,
|
1652 | tickValues = values;
|
1653 |
|
1654 | if (tickCount) {
|
1655 | var targetCount = isFunction(tickCount) ? tickCount() : tickCount;
|
1656 |
|
1657 | if (targetCount === 1) tickValues = [values[0]];else if (targetCount === 2) tickValues = [values[0], values[values.length - 1]];else if (targetCount > 2) {
|
1658 | var isCategorized = this.owner.isCategorized();
|
1659 |
|
1660 | for (count = targetCount - 2, start = values[0], end = values[values.length - 1], interval = (end - start) / (count + 1), tickValues = [start], i = 0; i < count; i++) tickValue = +start + interval * (i + 1), tickValues.push(forTimeSeries ? new Date(tickValue) : isCategorized ? Math.round(tickValue) : tickValue);
|
1661 |
|
1662 | tickValues.push(end);
|
1663 | }
|
1664 | }
|
1665 |
|
1666 | return forTimeSeries || (tickValues = tickValues.sort(function (a, b) {
|
1667 | return a - b;
|
1668 | })), tickValues;
|
1669 | }
|
1670 | }, {
|
1671 | key: "generateTransitions",
|
1672 | value: function generateTransitions(duration) {
|
1673 | var $$ = this.owner,
|
1674 | axes = $$.axes,
|
1675 | _map = ["x", "y", "y2", "subx"].map(function (v) {
|
1676 | var axis = axes[v];
|
1677 | return axis && duration && (axis = axis.transition().duration(duration)), axis;
|
1678 | }),
|
1679 | _map2 = _slicedToArray(_map, 4),
|
1680 | axisX = _map2[0],
|
1681 | axisY = _map2[1],
|
1682 | axisY2 = _map2[2],
|
1683 | axisSubX = _map2[3];
|
1684 |
|
1685 | return {
|
1686 | axisX: axisX,
|
1687 | axisY: axisY,
|
1688 | axisY2: axisY2,
|
1689 | axisSubX: axisSubX
|
1690 | };
|
1691 | }
|
1692 | }, {
|
1693 | key: "redraw",
|
1694 | value: function redraw(transitions, isHidden, isInit) {
|
1695 | var $$ = this.owner,
|
1696 | opacity = isHidden ? "0" : "1";
|
1697 | ["x", "y", "y2", "subX"].forEach(function (id) {
|
1698 | var axis = $$["".concat(id, "Axis")];
|
1699 | axis && (!isInit && (axis.config.withoutTransition = !$$.config.transition_duration), $$.axes[id.toLowerCase()].style("opacity", opacity), axis.create(transitions["axis".concat(capitalize(id))]));
|
1700 | }), this.updateAxes();
|
1701 | }
|
1702 | |
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 | }, {
|
1712 | key: "redrawAxis",
|
1713 | value: function redrawAxis(targetsToShow, wth, transitions, flow, isInit) {
|
1714 | var xDomainForZoom,
|
1715 | _this3 = this,
|
1716 | $$ = this.owner,
|
1717 | config = $$.config,
|
1718 | hasZoom = !!$$.zoomScale;
|
1719 |
|
1720 | !hasZoom && $$.isCategorized() && targetsToShow.length === 0 && $$.x.domain([0, $$.axes.x.selectAll(".tick").size()]), $$.x && targetsToShow.length ? (!hasZoom && $$.updateXDomain(targetsToShow, wth.UpdateXDomain, wth.UpdateOrgXDomain, wth.TrimXDomain), !config.axis_x_tick_values && this.updateXAxisTickValues(targetsToShow)) : $$.xAxis && ($$.xAxis.tickValues([]), $$.subXAxis.tickValues([])), config.zoom_rescale && !flow && (xDomainForZoom = $$.x.orgDomain()), ["y", "y2"].forEach(function (key) {
|
1721 | var axis = $$[key];
|
1722 |
|
1723 | if (axis) {
|
1724 | var tickValues = config["axis_".concat(key, "_tick_values")],
|
1725 | tickCount = config["axis_".concat(key, "_tick_count")];
|
1726 |
|
1727 | if (axis.domain($$.getYDomain(targetsToShow, key, xDomainForZoom)), !tickValues && tickCount) {
|
1728 | var domain = axis.domain();
|
1729 | $$["".concat(key, "Axis")].tickValues(_this3.generateTickValues(domain, domain.every(function (v) {
|
1730 | return v === 0;
|
1731 | }) ? 1 : tickCount, $$.isTimeSeriesY()));
|
1732 | }
|
1733 | }
|
1734 | }), this.redraw(transitions, $$.hasArcType(), isInit), this.updateLabels(wth.Transition), (wth.UpdateXDomain || wth.UpdateXAxis || wth.Y) && targetsToShow.length && this.setCulling(), wth.Y && ($$.subY && $$.subY.domain($$.getYDomain(targetsToShow, "y")), $$.subY2 && $$.subY2.domain($$.getYDomain(targetsToShow, "y2")));
|
1735 | }
|
1736 | |
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 | }, {
|
1742 | key: "setCulling",
|
1743 | value: function setCulling() {
|
1744 | var $$ = this.owner,
|
1745 | config = $$.config;
|
1746 | ["subx", "x", "y", "y2"].forEach(function (type) {
|
1747 | var axis = $$.axes[type],
|
1748 | id = type === "subx" ? "x" : type,
|
1749 | toCull = config["axis_".concat(id, "_tick_culling")];
|
1750 |
|
1751 | if (axis && toCull) {
|
1752 | var intervalForCulling,
|
1753 | tickText = axis.selectAll(".tick text"),
|
1754 | tickValues = sortValue(tickText.data()),
|
1755 | tickSize = tickValues.length,
|
1756 | cullingMax = config["axis_".concat(id, "_tick_culling_max")];
|
1757 |
|
1758 | if (tickSize) {
|
1759 | for (var _i = 1; _i < tickSize; _i++) if (tickSize / _i < cullingMax) {
|
1760 | intervalForCulling = _i;
|
1761 | break;
|
1762 | }
|
1763 |
|
1764 | tickText.each(function (d) {
|
1765 | this.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : "block";
|
1766 | });
|
1767 | } else tickText.style("display", "block");
|
1768 |
|
1769 |
|
1770 | if (type === "x") {
|
1771 | var clipPath = $$.clipXAxisTickMaxWidth ? $$.clipPathForXAxisTickTexts : null;
|
1772 | $$.svg.selectAll(".".concat(config_classes.axisX, " .tick text")).attr("clip-path", clipPath);
|
1773 | }
|
1774 | }
|
1775 | });
|
1776 | }
|
1777 | }]), Axis;
|
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 | var ChartInternal_ChartInternal = function () {
|
1807 | function ChartInternal(api) {
|
1808 | _classCallCheck(this, ChartInternal);
|
1809 |
|
1810 | var $$ = this;
|
1811 | $$.api = api, $$.config = $$.getOptions(), $$.data = {}, $$.cache = {}, $$.axes = {}, $$.rendered = !1;
|
1812 | }
|
1813 |
|
1814 | return _createClass(ChartInternal, [{
|
1815 | key: "beforeInit",
|
1816 | value: function beforeInit() {
|
1817 | var $$ = this;
|
1818 | $$.callPluginHook("$beforeInit"), callFn($$.config.onbeforeinit, $$, $$.api);
|
1819 | }
|
1820 | }, {
|
1821 | key: "afterInit",
|
1822 | value: function afterInit() {
|
1823 | var $$ = this;
|
1824 | $$.callPluginHook("$afterInit"), callFn($$.config.onafterinit, $$, $$.api);
|
1825 | }
|
1826 | }, {
|
1827 | key: "init",
|
1828 | value: function init() {
|
1829 | var $$ = this,
|
1830 | config = $$.config;
|
1831 | $$.initParams();
|
1832 | var bindto = {
|
1833 | element: config.bindto,
|
1834 | classname: "bb"
|
1835 | };
|
1836 | isObject(config.bindto) && (bindto.element = config.bindto.element || "#chart", bindto.classname = config.bindto.classname || bindto.classname), $$.selectChart = isFunction(bindto.element.node) ? config.bindto.element : Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(bindto.element || []), $$.selectChart.empty() && ($$.selectChart = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(browser_doc.body.appendChild(browser_doc.createElement("div")))), $$.selectChart.html("").classed(bindto.classname, !0), $$.initToRender();
|
1837 | }
|
1838 | |
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 | }, {
|
1845 | key: "initToRender",
|
1846 | value: function initToRender(forced) {
|
1847 | var $$ = this,
|
1848 | config = $$.config,
|
1849 | target = $$.selectChart,
|
1850 | isHidden = function () {
|
1851 | return target.style("display") === "none" || target.style("visibility") === "hidden";
|
1852 | },
|
1853 | isLazy = config.render.lazy || isHidden(),
|
1854 | MutationObserver = win.MutationObserver;
|
1855 |
|
1856 | if (isLazy && MutationObserver && config.render.observe !== !1 && !forced && new MutationObserver(function (mutation, observer) {
|
1857 | isHidden() || (observer.disconnect(), !$$.rendered && $$.initToRender(!0));
|
1858 | }).observe(target.node(), {
|
1859 | attributes: !0,
|
1860 | attributeFilter: ["class", "style"]
|
1861 | }), !isLazy || forced) {
|
1862 | var convertedData = $$.convertData(config, $$.initWithData);
|
1863 | convertedData && $$.initWithData(convertedData), $$.afterInit();
|
1864 | }
|
1865 | }
|
1866 | }, {
|
1867 | key: "initParams",
|
1868 | value: function initParams() {
|
1869 | var _this = this,
|
1870 | $$ = this,
|
1871 | config = $$.config,
|
1872 | isRotated = config.axis_rotated;
|
1873 |
|
1874 | $$.datetimeId = "bb-".concat(+new Date()), $$.initClip(), $$.dragStart = null, $$.dragging = !1, $$.flowing = !1, $$.cancelClick = !1, $$.mouseover = !1, $$.transiting = !1, $$.color = $$.generateColor(), $$.levelColor = $$.generateLevelColor(), $$.point = $$.generatePoint(), $$.extraLineClasses = $$.generateExtraLineClass(), $$.dataTimeFormat = config.data_xLocaltime ? 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"], $$.axisTimeFormat = 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"];
|
1875 | var isDragZoom = $$.config.zoom_enabled && $$.config.zoom_enabled.type === "drag";
|
1876 | $$.defaultAxisTimeFormat = function (d) {
|
1877 | var isZoomed = isDragZoom ? _this.zoomScale : _this.zoomScale && $$.x.orgDomain().toString() !== _this.zoomScale.domain().toString(),
|
1878 | 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";
|
1879 | return $$.axisTimeFormat(specifier)(d);
|
1880 | }, $$.hiddenTargetIds = [], $$.hiddenLegendIds = [], $$.focusedTargetIds = [], $$.defocusedTargetIds = [], $$.isLegendRight = config.legend_position === "right", $$.isLegendInset = config.legend_position === "inset", $$.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right", $$.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left", $$.legendStep = 0, $$.legendItemWidth = 0, $$.legendItemHeight = 0, $$.currentMaxTickWidths = {
|
1881 | x: {
|
1882 | size: 0,
|
1883 | ticks: [],
|
1884 | domain: ""
|
1885 | },
|
1886 | y: {
|
1887 | size: 0,
|
1888 | domain: ""
|
1889 | },
|
1890 | y2: {
|
1891 | size: 0,
|
1892 | domain: ""
|
1893 | }
|
1894 | }, $$.rotated_padding_left = 30, $$.rotated_padding_right = isRotated && !config.axis_x_show ? 0 : 30, $$.rotated_padding_top = 5, $$.withoutFadeIn = {}, $$.inputType = $$.convertInputType(), $$.axes.subx = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]);
|
1895 | }
|
1896 | }, {
|
1897 | key: "initWithData",
|
1898 | value: function initWithData(data) {
|
1899 | var $$ = this,
|
1900 | config = $$.config;
|
1901 |
|
1902 | if ($$.axis = new Axis_Axis($$), config.zoom_enabled && $$.initZoom(), $$.data.xs = {}, $$.data.targets = $$.convertDataToTargets(data), config.data_filter && ($$.data.targets = $$.data.targets.filter(config.data_filter)), config.data_hide && $$.addHiddenTargetIds(config.data_hide === !0 ? $$.mapToIds($$.data.targets) : config.data_hide), config.legend_hide && $$.addHiddenLegendIds(config.legend_hide === !0 ? $$.mapToIds($$.data.targets) : config.legend_hide), $$.updateSizes(), $$.updateScales(!0), $$.x && ($$.x.domain(sortValue($$.getXDomain($$.data.targets))), $$.subX.domain($$.x.domain()), $$.orgXDomain = $$.x.domain()), $$.y && ($$.y.domain($$.getYDomain($$.data.targets, "y")), $$.subY.domain($$.y.domain())), $$.y2 && ($$.y2.domain($$.getYDomain($$.data.targets, "y2")), $$.subY2 && $$.subY2.domain($$.y2.domain())), $$.svg = $$.selectChart.append("svg").style("overflow", "hidden").style("display", "block"), config.interaction_enabled && $$.inputType) {
|
1903 | var isTouch = $$.inputType === "touch";
|
1904 | $$.svg.on(isTouch ? "touchstart" : "mouseenter", function () {
|
1905 | return callFn(config.onover, $$, $$.api);
|
1906 | }).on(isTouch ? "touchend" : "mouseleave", function () {
|
1907 | return callFn(config.onout, $$, $$.api);
|
1908 | });
|
1909 | }
|
1910 |
|
1911 | config.svg_classname && $$.svg.attr("class", config.svg_classname), $$.defs = $$.svg.append("defs"), $$.clipChart = $$.appendClip($$.defs, $$.clipId), $$.clipXAxis = $$.appendClip($$.defs, $$.clipIdForXAxis), $$.clipXAxisTickTexts = $$.appendClip($$.defs, $$.clipIdForXAxisTickTexts), $$.clipYAxis = $$.appendClip($$.defs, $$.clipIdForYAxis), $$.clipGrid = $$.appendClip($$.defs, $$.clipIdForGrid), isFunction(config.color_tiles) && $$.patterns && $$.patterns.forEach(function (p) {
|
1912 | return $$.defs.append(function () {
|
1913 | return p.node;
|
1914 | });
|
1915 | }), $$.updateSvgSize(), $$.bindResize();
|
1916 |
|
1917 | var main = $$.svg.append("g").attr("transform", $$.getTranslate("main"));
|
1918 |
|
1919 |
|
1920 | if ($$.main = main, config.subchart_show && $$.initSubchart(), $$.initTooltip && $$.initTooltip(), $$.initLegend && $$.initLegend(), $$.initTitle && $$.initTitle(), config.data_empty_label_text && main.append("text").attr("class", "".concat(config_classes.text, " ").concat(config_classes.empty)).attr("text-anchor", "middle")
|
1921 | .attr("dominant-baseline", "middle"), $$.initRegion(), config.clipPath || $$.axis.init(), main.append("g").attr("class", config_classes.chart).attr("clip-path", $$.clipPath), $$.callPluginHook("$init"), $$.initEventRect(), $$.initChartElements(), $$.initGrid(), main.insert("rect", config.zoom_privileged ? null : "g.".concat(config_classes.regions)).attr("class", config_classes.zoomRect).attr("width", $$.width).attr("height", $$.height).style("opacity", "0").on("dblclick.zoom", null), config.clipPath && $$.axis.init(), $$.updateTargets($$.data.targets), $$.updateDimension(), callFn(config.oninit, $$, $$.api), $$.setBackground(), $$.redraw({
|
1922 | withTransition: !1,
|
1923 | withTransform: !0,
|
1924 | withUpdateXDomain: !0,
|
1925 | withUpdateOrgXDomain: !0,
|
1926 | withTransitionForAxis: !1,
|
1927 | initializing: !0
|
1928 | }), config.data_onmin || config.data_onmax) {
|
1929 | var minMax = $$.getMinMaxData();
|
1930 | callFn(config.data_onmin, $$, minMax.min), callFn(config.data_onmax, $$, minMax.max);
|
1931 | }
|
1932 |
|
1933 |
|
1934 | $$.api.element = $$.selectChart.node(), $$.rendered = !0;
|
1935 | }
|
1936 | }, {
|
1937 | key: "initChartElements",
|
1938 | value: function initChartElements() {
|
1939 | var $$ = this;
|
1940 | ["Bar", "Radar", "Line", "Bubble", "Arc", "Gauge", "Pie"].forEach(function (v) {
|
1941 | $$["init".concat(v)]();
|
1942 | }), notEmpty($$.config.data_labels) && $$.initText();
|
1943 | }
|
1944 | }, {
|
1945 | key: "setChartElements",
|
1946 | value: function setChartElements() {
|
1947 | var $$ = this;
|
1948 | $$.api.$ = {
|
1949 | chart: $$.selectChart,
|
1950 | svg: $$.svg,
|
1951 | defs: $$.defs,
|
1952 | main: $$.main,
|
1953 | tooltip: $$.tooltip,
|
1954 | legend: $$.legend,
|
1955 | title: $$.title,
|
1956 | grid: $$.grid,
|
1957 | arc: $$.arcs,
|
1958 | bar: {
|
1959 | bars: $$.mainBar
|
1960 | },
|
1961 | line: {
|
1962 | lines: $$.mainLine,
|
1963 | areas: $$.mainArea,
|
1964 | circles: $$.mainCircle
|
1965 | },
|
1966 | text: {
|
1967 | texts: $$.mainText
|
1968 | }
|
1969 | };
|
1970 | }
|
1971 | |
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 | }, {
|
1977 | key: "setBackground",
|
1978 | value: function setBackground() {
|
1979 | var $$ = this,
|
1980 | bg = $$.config.background;
|
1981 |
|
1982 | if (notEmpty(bg)) {
|
1983 | var element = $$.svg.select(".".concat(config_classes[$$.hasArcType() ? "chart" : "regions"])).insert(bg.imgUrl ? "image" : "rect", ":first-child");
|
1984 | bg.imgUrl ? element.attr("href", bg.imgUrl) : bg.color && element.style("fill", bg.color), element.attr("class", bg["class"] || null).attr("width", "100%").attr("height", "100%");
|
1985 | }
|
1986 | }
|
1987 | }, {
|
1988 | key: "smoothLines",
|
1989 | value: function smoothLines(el, type) {
|
1990 | type === "grid" && el.each(function () {
|
1991 | var g = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this);
|
1992 | ["x1", "x2", "y1", "y2"].forEach(function (v) {
|
1993 | return g.attr(v, Math.ceil(g.attr(v)));
|
1994 | });
|
1995 | });
|
1996 | }
|
1997 | |
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 | }, {
|
2004 | key: "updateSizes",
|
2005 | value: function updateSizes(isInit) {
|
2006 | var $$ = this;
|
2007 | isInit || $$.setContainerSize();
|
2008 | var config = $$.config,
|
2009 | isRotated = config.axis_rotated,
|
2010 | hasArc = $$.hasArcType(),
|
2011 | legend = {
|
2012 | width: $$.legend ? $$.getLegendWidth() : 0,
|
2013 | height: $$.legend ? $$.getLegendHeight() : 0
|
2014 | },
|
2015 | legendHeightForBottom = $$.isLegendRight || $$.isLegendInset ? 0 : legend.height,
|
2016 | xAxisHeight = isRotated || hasArc ? 0 : $$.getHorizontalAxisHeight("x"),
|
2017 | subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
2018 | subchartHeight = config.subchart_show && !hasArc ? config.subchart_size_height + subchartXAxisHeight : 0;
|
2019 | $$.margin = isRotated ? {
|
2020 | top: $$.getHorizontalAxisHeight("y2") + $$.getCurrentPaddingTop(),
|
2021 | right: hasArc ? 0 : $$.getCurrentPaddingRight(),
|
2022 | bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
2023 | left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
|
2024 | } : {
|
2025 | top: 4 + $$.getCurrentPaddingTop(),
|
2026 |
|
2027 | right: hasArc ? 0 : $$.getCurrentPaddingRight(),
|
2028 | bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
2029 | left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
2030 | }, $$.margin2 = isRotated ? {
|
2031 | top: $$.margin.top,
|
2032 | right: NaN,
|
2033 | bottom: 20 + legendHeightForBottom,
|
2034 | left: $$.rotated_padding_left
|
2035 | } : {
|
2036 | top: $$.currentHeight - subchartHeight - legendHeightForBottom,
|
2037 | right: NaN,
|
2038 | bottom: subchartXAxisHeight + legendHeightForBottom,
|
2039 | left: $$.margin.left
|
2040 | }, $$.margin3 = {
|
2041 | top: 0,
|
2042 | right: NaN,
|
2043 | bottom: 0,
|
2044 | left: 0
|
2045 | }, $$.updateSizeForLegend && $$.updateSizeForLegend(legend), $$.width = $$.currentWidth - $$.margin.left - $$.margin.right, $$.height = $$.currentHeight - $$.margin.top - $$.margin.bottom, $$.width < 0 && ($$.width = 0), $$.height < 0 && ($$.height = 0), $$.width2 = isRotated ? $$.margin.left - $$.rotated_padding_left - $$.rotated_padding_right : $$.width, $$.height2 = isRotated ? $$.height : $$.currentHeight - $$.margin2.top - $$.margin2.bottom, $$.width2 < 0 && ($$.width2 = 0), $$.height2 < 0 && ($$.height2 = 0), $$.arcWidth = $$.width - ($$.isLegendRight ? legend.width + 10 : 0), $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10), $$.hasType("gauge") && !config.gauge_fullCircle && ($$.arcHeight += $$.height - $$.getGaugeLabelHeight()), $$.updateRadius && $$.updateRadius(), $$.isLegendRight && hasArc && ($$.margin3.left = $$.arcWidth / 2 + $$.radiusExpanded * 1.1), !hasArc && config.axis_x_show && $$.updateXAxisTickClip();
|
2046 | }
|
2047 | |
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 | }, {
|
2054 | key: "updateTargets",
|
2055 | value: function updateTargets(targets) {
|
2056 | var $$ = this;
|
2057 |
|
2058 | $$.updateTargetsForText(targets), $$.updateTargetsForBar(targets), $$.updateTargetsForLine(targets), $$.hasArcType(targets) && ($$.hasType("radar") ? $$.updateTargetsForRadar(targets) : $$.updateTargetsForArc(targets)), $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets), $$.showTargets();
|
2059 | }
|
2060 | |
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 | }, {
|
2066 | key: "showTargets",
|
2067 | value: function showTargets() {
|
2068 | var $$ = this;
|
2069 | $$.svg.selectAll(".".concat(config_classes.target)).filter(function (d) {
|
2070 | return $$.isTargetToShow(d.id);
|
2071 | }).transition().duration($$.config.transition_duration).style("opacity", "1");
|
2072 | }
|
2073 | }, {
|
2074 | key: "getWithOption",
|
2075 | value: function getWithOption(options) {
|
2076 | var withOptions = {
|
2077 | Y: !0,
|
2078 | Subchart: !0,
|
2079 | Transition: !0,
|
2080 | EventRect: !0,
|
2081 | Dimension: !0,
|
2082 | TrimXDomain: !0,
|
2083 | Transform: !1,
|
2084 | UpdateXDomain: !1,
|
2085 | UpdateOrgXDomain: !1,
|
2086 | Legend: !1,
|
2087 | UpdateXAxis: "UpdateXDomain",
|
2088 | TransitionForExit: "Transition",
|
2089 | TransitionForAxis: "Transition"
|
2090 | };
|
2091 | return Object.keys(withOptions).forEach(function (key) {
|
2092 | var defVal = withOptions[key];
|
2093 | isString(defVal) && (defVal = withOptions[defVal]), withOptions[key] = getOption(options, "with".concat(key), defVal);
|
2094 | }), withOptions;
|
2095 | }
|
2096 | }, {
|
2097 | key: "redraw",
|
2098 | value: function redraw() {
|
2099 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
2100 | transitionsValue = arguments.length > 1 ? arguments[1] : undefined,
|
2101 | $$ = this,
|
2102 | main = $$.main,
|
2103 | config = $$.config,
|
2104 | targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
2105 | initializing = options.initializing,
|
2106 | flow = options.flow,
|
2107 | wth = $$.getWithOption(options),
|
2108 | duration = wth.Transition ? config.transition_duration : 0,
|
2109 | durationForExit = wth.TransitionForExit ? duration : 0,
|
2110 | durationForAxis = wth.TransitionForAxis ? duration : 0,
|
2111 | transitions = transitionsValue || $$.axis.generateTransitions(durationForAxis);
|
2112 | $$.updateSizes(initializing), wth.Legend && config.legend_show ? $$.updateLegend($$.mapToIds($$.data.targets), options, transitions) : wth.Dimension && $$.updateDimension(!0), $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing), $$.updateCircleY(), config.data_empty_label_text && main.select("text.".concat(config_classes.text, ".").concat(config_classes.empty)).attr("x", $$.width / 2).attr("y", $$.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null), $$.updateGrid(duration), $$.updateRegion(duration), $$.updateBar(durationForExit), $$.updateLine(durationForExit), $$.updateArea(durationForExit), $$.updateCircle(), $$.hasDataLabel() && $$.updateText(durationForExit), $$.redrawTitle && $$.redrawTitle(), $$.arcs && $$.redrawArc(duration, durationForExit, wth.Transform), $$.radars && $$.redrawRadar(durationForExit), $$.mainText && main.selectAll(".".concat(config_classes.selectedCircles)).filter($$.isBarType.bind($$)).selectAll("circle").remove(), config.interaction_enabled && !flow && wth.EventRect && $$.bindZoomEvent(), initializing && $$.setChartElements(), $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart), $$.callPluginHook("$redraw", options, duration);
|
2113 | }
|
2114 | |
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 | }, {
|
2124 | key: "generateRedrawList",
|
2125 | value: function generateRedrawList(targets, flow, duration, withSubchart) {
|
2126 | var $$ = this,
|
2127 | config = $$.config,
|
2128 | shape = $$.getDrawShape();
|
2129 | config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape);
|
2130 |
|
2131 | var flowFn = flow && $$.generateFlow({
|
2132 | targets: targets,
|
2133 | flow: flow,
|
2134 | duration: flow.duration,
|
2135 | shape: shape,
|
2136 | xv: $$.xv.bind($$)
|
2137 | }),
|
2138 | isTransition = (duration || flowFn) && $$.isTabVisible(),
|
2139 | redrawList = $$.getRedrawList(shape, flow, flowFn, isTransition),
|
2140 | afterRedraw = flow || config.onrendered ? function () {
|
2141 | flowFn && flowFn(), callFn(config.onrendered, $$, $$.api);
|
2142 | } : null;
|
2143 | if (afterRedraw)
|
2144 | if (isTransition && redrawList.length) {
|
2145 |
|
2146 | var waitForDraw = $$.generateWait();
|
2147 |
|
2148 | Object(external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_["transition"])().duration(duration).each(function () {
|
2149 | redrawList.reduce(function (acc, t1) {
|
2150 | return acc.concat(t1);
|
2151 | }, []).forEach(function (t) {
|
2152 | return waitForDraw.add(t);
|
2153 | });
|
2154 | }).call(waitForDraw, afterRedraw);
|
2155 | } else $$.transiting || afterRedraw();
|
2156 |
|
2157 | $$.mapToIds($$.data.targets).forEach(function (id) {
|
2158 | $$.withoutFadeIn[id] = !0;
|
2159 | });
|
2160 | }
|
2161 | |
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 | }, {
|
2168 | key: "getDrawShape",
|
2169 | value: function getDrawShape() {
|
2170 | var $$ = this,
|
2171 | isRotated = $$.config.axis_rotated,
|
2172 | hasRadar = $$.hasType("radar"),
|
2173 | shape = {
|
2174 | type: {},
|
2175 | indices: {}
|
2176 | };
|
2177 |
|
2178 |
|
2179 | if ($$.hasTypeOf("Line") || $$.hasType("bubble") || $$.hasType("scatter")) {
|
2180 | var indices = $$.getShapeIndices($$.isLineType);
|
2181 |
|
2182 | if (shape.indices.line = indices, shape.type.line = $$.generateDrawLine ? $$.generateDrawLine(indices, !1) : undefined, $$.hasTypeOf("Area")) {
|
2183 | var _indices = $$.getShapeIndices($$.isAreaType);
|
2184 |
|
2185 | shape.indices.area = _indices, shape.type.area = $$.generateDrawArea ? $$.generateDrawArea(_indices, !1) : undefined;
|
2186 | }
|
2187 | }
|
2188 |
|
2189 | if ($$.hasType("bar")) {
|
2190 | var _indices2 = $$.getShapeIndices($$.isBarType);
|
2191 |
|
2192 | shape.indices.bar = _indices2, shape.type.bar = $$.generateDrawBar ? $$.generateDrawBar(_indices2) : undefined;
|
2193 | }
|
2194 |
|
2195 | return shape.pos = {
|
2196 | xForText: $$.generateXYForText(shape.indices, !0),
|
2197 | yForText: $$.generateXYForText(shape.indices, !1),
|
2198 |
|
2199 | cx: (hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX).bind($$),
|
2200 | cy: (hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY).bind($$)
|
2201 | }, shape;
|
2202 | }
|
2203 | }, {
|
2204 | key: "getRedrawList",
|
2205 | value: function getRedrawList(shape, flow, flowFn, isTransition) {
|
2206 | var $$ = this,
|
2207 | config = $$.config,
|
2208 | hasArcType = $$.hasArcType(),
|
2209 | _shape$pos = shape.pos,
|
2210 | cx = _shape$pos.cx,
|
2211 | cy = _shape$pos.cy,
|
2212 | xForText = _shape$pos.xForText,
|
2213 | yForText = _shape$pos.yForText,
|
2214 | list = [];
|
2215 |
|
2216 | if (!hasArcType) {
|
2217 | var _shape$type = shape.type,
|
2218 | area = _shape$type.area,
|
2219 | bar = _shape$type.bar,
|
2220 | line = _shape$type.line;
|
2221 | (config.grid_x_lines.length || config.grid_y_lines.length) && list.push($$.redrawGrid(isTransition)), config.regions.length && list.push($$.redrawRegion(isTransition)), $$.hasTypeOf("Line") && (list.push($$.redrawLine(line, isTransition)), $$.hasTypeOf("Area") && list.push($$.redrawArea(area, isTransition))), $$.hasType("bar") && list.push($$.redrawBar(bar, isTransition)), flow || list.push($$.updategridFocus());
|
2222 | }
|
2223 |
|
2224 | return (!hasArcType || $$.hasType("radar")) && (notEmpty(config.data_labels) && list.push($$.redrawText(xForText, yForText, flow, isTransition)), list.push($$.redrawCircle(cx, cy, isTransition, flowFn))), list;
|
2225 | }
|
2226 | }, {
|
2227 | key: "updateAndRedraw",
|
2228 | value: function updateAndRedraw() {
|
2229 | var transitions,
|
2230 | options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
2231 | $$ = this,
|
2232 | config = $$.config;
|
2233 | options.withTransition = getOption(options, "withTransition", !0), options.withTransform = getOption(options, "withTransform", !1), options.withLegend = getOption(options, "withLegend", !1), options.withUpdateXDomain = !0, options.withUpdateOrgXDomain = !0, options.withTransitionForExit = !1, options.withTransitionForTransform = getOption(options, "withTransitionForTransform", options.withTransition), options.withLegend && config.legend_show || (transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0), $$.updateScales(), $$.updateSvgSize(), $$.transformAll(options.withTransitionForTransform, transitions)), $$.redraw(options, transitions);
|
2234 | }
|
2235 | }, {
|
2236 | key: "redrawWithoutRescale",
|
2237 | value: function redrawWithoutRescale() {
|
2238 | this.redraw({
|
2239 | withY: !1,
|
2240 | withSubchart: !1,
|
2241 | withEventRect: !1,
|
2242 | withTransitionForAxis: !1
|
2243 | });
|
2244 | }
|
2245 | }, {
|
2246 | key: "isTimeSeries",
|
2247 | value: function isTimeSeries() {
|
2248 | return this.config.axis_x_type === "timeseries";
|
2249 | }
|
2250 | }, {
|
2251 | key: "isCategorized",
|
2252 | value: function isCategorized() {
|
2253 | return this.config.axis_x_type.indexOf("category") >= 0 || this.hasType("radar");
|
2254 | }
|
2255 | }, {
|
2256 | key: "isCustomX",
|
2257 | value: function isCustomX() {
|
2258 | var $$ = this,
|
2259 | config = $$.config;
|
2260 | return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));
|
2261 | }
|
2262 | }, {
|
2263 | key: "isTimeSeriesY",
|
2264 | value: function isTimeSeriesY() {
|
2265 | return this.config.axis_y_type === "timeseries";
|
2266 | }
|
2267 | }, {
|
2268 | key: "getTranslate",
|
2269 | value: function getTranslate(target) {
|
2270 | var x,
|
2271 | y,
|
2272 | index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0,
|
2273 | $$ = this,
|
2274 | config = $$.config,
|
2275 | isRotated = config.axis_rotated,
|
2276 | hasGauge = $$.hasType("gauge"),
|
2277 | padding = 0;
|
2278 | if (index && /^(x|y2?)$/.test(target) && (padding = $$.getAxisSize(target) * index), target === "main") x = asHalfPixel($$.margin.left), y = asHalfPixel($$.margin.top);else if (target === "context") x = asHalfPixel($$.margin2.left), y = asHalfPixel($$.margin2.top);else if (target === "legend") x = $$.margin3.left, y = $$.margin3.top + (hasGauge ? 10 : 0);else if (target === "x") x = isRotated ? -padding : 0, y = isRotated ? 0 : $$.height + padding;else if (target === "y") x = isRotated ? 0 : -padding, y = isRotated ? $$.height + padding : 0;else if (target === "y2") x = isRotated ? 0 : $$.width + padding, y = isRotated ? 1 - padding : 0;else if (target === "subx") x = 0, y = isRotated ? 0 : $$.height2;else if (target === "arc") x = $$.arcWidth / 2, y = $$.arcHeight / 2;else if (target === "radar") {
|
2279 | var _$$$getRadarSize = $$.getRadarSize(),
|
2280 | _$$$getRadarSize2 = _slicedToArray(_$$$getRadarSize, 1),
|
2281 | width = _$$$getRadarSize2[0];
|
2282 |
|
2283 | x = $$.width / 2 - width, y = asHalfPixel($$.margin.top);
|
2284 | }
|
2285 | return "translate(".concat(x, ", ").concat(y, ")");
|
2286 | }
|
2287 | }, {
|
2288 | key: "initialOpacity",
|
2289 | value: function initialOpacity(d) {
|
2290 | return this.getBaseValue(d) !== null && this.withoutFadeIn[d.id] ? "1" : "0";
|
2291 | }
|
2292 | }, {
|
2293 | key: "initialOpacityForCircle",
|
2294 | value: function initialOpacityForCircle(d) {
|
2295 | return this.getBaseValue(d) !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0";
|
2296 | }
|
2297 | }, {
|
2298 | key: "opacityForCircle",
|
2299 | value: function opacityForCircle(d) {
|
2300 | var opacity = this.config.point_show ? "1" : "0";
|
2301 | return isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0";
|
2302 | }
|
2303 | }, {
|
2304 | key: "opacityForText",
|
2305 | value: function opacityForText() {
|
2306 | return this.hasDataLabel() ? "1" : "0";
|
2307 | }
|
2308 | |
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 | }, {
|
2315 | key: "xx",
|
2316 | value: function xx(d) {
|
2317 | var $$ = this,
|
2318 | fn = $$.config.zoom_enabled && $$.zoomScale ? $$.zoomScale : this.x;
|
2319 | return d ? fn(isValue(d.x) ? d.x : d) : null;
|
2320 | }
|
2321 | }, {
|
2322 | key: "xv",
|
2323 | value: function xv(d) {
|
2324 | var $$ = this,
|
2325 | value = $$.getBaseValue(d);
|
2326 | return $$.isTimeSeries() ? value = $$.parseDate(value) : $$.isCategorized() && isString(value) && (value = $$.config.axis_x_categories.indexOf(value)), Math.ceil($$.x(value));
|
2327 | }
|
2328 | }, {
|
2329 | key: "yv",
|
2330 | value: function yv(d) {
|
2331 | var $$ = this,
|
2332 | yScale = d.axis && d.axis === "y2" ? $$.y2 : $$.y;
|
2333 | return Math.ceil(yScale($$.getBaseValue(d)));
|
2334 | }
|
2335 | }, {
|
2336 | key: "subxx",
|
2337 | value: function subxx(d) {
|
2338 | return d ? this.subX(d.x) : null;
|
2339 | }
|
2340 | }, {
|
2341 | key: "transformMain",
|
2342 | value: function transformMain(withTransition, transitions) {
|
2343 | var xAxis,
|
2344 | yAxis,
|
2345 | y2Axis,
|
2346 | $$ = this;
|
2347 | transitions && transitions.axisX ? xAxis = transitions.axisX : (xAxis = $$.main.select(".".concat(config_classes.axisX)), withTransition && (xAxis = xAxis.transition())), transitions && transitions.axisY ? yAxis = transitions.axisY : (yAxis = $$.main.select(".".concat(config_classes.axisY)), withTransition && (yAxis = yAxis.transition())), transitions && transitions.axisY2 ? y2Axis = transitions.axisY2 : (y2Axis = $$.main.select(".".concat(config_classes.axisY2)), withTransition && (y2Axis = y2Axis.transition())), (withTransition ? $$.main.transition() : $$.main).attr("transform", $$.getTranslate("main")), xAxis.attr("transform", $$.getTranslate("x")), yAxis.attr("transform", $$.getTranslate("y")), y2Axis.attr("transform", $$.getTranslate("y2")), $$.main.select(".".concat(config_classes.chartArcs)).attr("transform", $$.getTranslate("arc"));
|
2348 | }
|
2349 | }, {
|
2350 | key: "transformAll",
|
2351 | value: function transformAll(withTransition, transitions) {
|
2352 | var $$ = this;
|
2353 | $$.transformMain(withTransition, transitions), $$.config.subchart_show && $$.transformContext(withTransition, transitions), $$.legend && $$.transformLegend(withTransition);
|
2354 | }
|
2355 | }, {
|
2356 | key: "updateSvgSize",
|
2357 | value: function updateSvgSize() {
|
2358 | var $$ = this,
|
2359 | brush = $$.svg.select(".".concat(config_classes.brush, " .overlay")),
|
2360 | brushSize = {
|
2361 | width: 0,
|
2362 | height: 0
|
2363 | };
|
2364 | brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), $$.svg.attr("width", $$.currentWidth).attr("height", $$.currentHeight), $$.svg.selectAll(["#".concat($$.clipId), "#".concat($$.clipIdForGrid)]).select("rect").attr("width", $$.width).attr("height", $$.height), $$.svg.select("#".concat($$.clipIdForXAxis)).select("rect").attr("x", $$.getXAxisClipX.bind($$)).attr("y", $$.getXAxisClipY.bind($$)).attr("width", $$.getXAxisClipWidth.bind($$)).attr("height", $$.getXAxisClipHeight.bind($$)), $$.svg.select("#".concat($$.clipIdForYAxis)).select("rect").attr("x", $$.getYAxisClipX.bind($$)).attr("y", $$.getYAxisClipY.bind($$)).attr("width", $$.getYAxisClipWidth.bind($$)).attr("height", $$.getYAxisClipHeight.bind($$)), $$.svg.select("#".concat($$.clipIdForSubchart)).select("rect").attr("width", $$.width).attr("height", brushSize.height), $$.svg.select(".".concat(config_classes.zoomRect)).attr("width", $$.width).attr("height", $$.height);
|
2365 | }
|
2366 | }, {
|
2367 | key: "updateDimension",
|
2368 | value: function updateDimension(withoutAxis) {
|
2369 | var $$ = this;
|
2370 | withoutAxis || ($$.xAxis && $$.config.axis_rotated ? ($$.xAxis.create($$.axes.x), $$.subXAxis.create($$.axes.subx)) : ($$.yAxis && $$.yAxis.create($$.axes.y), $$.y2Axis && $$.y2Axis.create($$.axes.y2))), $$.updateScales(withoutAxis), $$.updateSvgSize(), $$.transformAll(!1);
|
2371 | }
|
2372 | }, {
|
2373 | key: "bindResize",
|
2374 | value: function bindResize() {
|
2375 | var $$ = this,
|
2376 | config = $$.config,
|
2377 | resizeFunction = $$.generateResize(),
|
2378 | list = [];
|
2379 | list.push(function () {
|
2380 | return callFn(config.onresize, $$, $$.api);
|
2381 | }), config.resize_auto && list.push(function () {
|
2382 | return $$.api.flush(!1, !0);
|
2383 | }), list.push(function () {
|
2384 | return callFn(config.onresized, $$, $$.api);
|
2385 | }), list.forEach(function (v) {
|
2386 | return resizeFunction.add(v);
|
2387 | }), win.addEventListener("resize", $$.resizeFunction = resizeFunction);
|
2388 | }
|
2389 | }, {
|
2390 | key: "generateResize",
|
2391 | value: function generateResize() {
|
2392 | function callResizeFn() {
|
2393 | callResizeFn.timeout && (win.clearTimeout(callResizeFn.timeout), callResizeFn.timeout = null), callResizeFn.timeout = win.setTimeout(function () {
|
2394 | fn.forEach(function (f) {
|
2395 | return f();
|
2396 | });
|
2397 | }, 200);
|
2398 | }
|
2399 |
|
2400 | var fn = [];
|
2401 | return callResizeFn.add = function (f) {
|
2402 | return fn.push(f);
|
2403 | }, callResizeFn.remove = function (f) {
|
2404 | return fn.splice(fn.indexOf(f), 1);
|
2405 | }, callResizeFn;
|
2406 | }
|
2407 | }, {
|
2408 | key: "endall",
|
2409 | value: function endall(transition, callback) {
|
2410 | var n = 0;
|
2411 | transition.each(function () {
|
2412 | return ++n;
|
2413 | }).on("end", function () {
|
2414 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
2415 |
|
2416 | --n || callback.apply.apply(callback, [this].concat(args));
|
2417 | });
|
2418 | }
|
2419 | }, {
|
2420 | key: "generateWait",
|
2421 | value: function generateWait() {
|
2422 | var transitionsToWait = [],
|
2423 | f = function (transition, callback) {
|
2424 | function loop() {
|
2425 | for (var t, done = 0, i = 0; t = transitionsToWait[i]; i++) {
|
2426 | if (t.empty()) {
|
2427 | done++;
|
2428 | continue;
|
2429 | }
|
2430 |
|
2431 | try {
|
2432 | t.transition();
|
2433 | } catch (e) {
|
2434 | done++;
|
2435 | }
|
2436 | }
|
2437 |
|
2438 | timer && clearTimeout(timer), done === transitionsToWait.length ? callback && callback() : timer = setTimeout(loop, 50);
|
2439 | }
|
2440 |
|
2441 | var timer;
|
2442 | loop();
|
2443 | };
|
2444 |
|
2445 | return f.add = function (transition) {
|
2446 | isArray(transition) ? transitionsToWait = transitionsToWait.concat(transition) : transitionsToWait.push(transition);
|
2447 | }, f;
|
2448 | }
|
2449 | }, {
|
2450 | key: "parseDate",
|
2451 | value: function parseDate(date) {
|
2452 | var parsedDate,
|
2453 | $$ = this;
|
2454 | return date instanceof Date ? parsedDate = date : isString(date) ? parsedDate = $$.dataTimeFormat($$.config.data_xFormat)(date) : isNumber(date) && !isNaN(date) && (parsedDate = new Date(+date)), (!parsedDate || isNaN(+parsedDate)) && console && console.error && console.error("Failed to parse x '".concat(date, "' to Date object")), parsedDate;
|
2455 | }
|
2456 | }, {
|
2457 | key: "isTabVisible",
|
2458 | value: function isTabVisible() {
|
2459 | return !browser_doc.hidden;
|
2460 | }
|
2461 | }, {
|
2462 | key: "convertInputType",
|
2463 | value: function convertInputType() {
|
2464 | var $$ = this,
|
2465 | config = $$.config,
|
2466 | isMobile = !1;
|
2467 |
|
2468 |
|
2469 | if (/Mobi/.test(win.navigator.userAgent) && config.interaction_inputType_touch) {
|
2470 |
|
2471 | var hasTouchPoints = win.navigator && "maxTouchPoints" in win.navigator && win.navigator.maxTouchPoints > 0,
|
2472 | hasTouch = "ontouchmove" in win || win.DocumentTouch && browser_doc instanceof win.DocumentTouch;
|
2473 |
|
2474 |
|
2475 | isMobile = hasTouchPoints || hasTouch;
|
2476 | }
|
2477 |
|
2478 | var hasMouse = config.interaction_inputType_mouse && !isMobile && "onmouseover" in win;
|
2479 | return hasMouse && "mouse" || isMobile && "touch" || null;
|
2480 | }
|
2481 | |
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 | }, {
|
2488 | key: "callPluginHook",
|
2489 | value: function callPluginHook(phase) {
|
2490 | for (var _this2 = this, _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
2491 |
|
2492 | this.config.plugins.forEach(function (v) {
|
2493 | phase === "$beforeInit" && (v.$$ = _this2, _this2.api.plugins.push(v)), v[phase].apply(v, args);
|
2494 | });
|
2495 | }
|
2496 | }]), ChartInternal;
|
2497 | }();
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 | var Chart_Chart = function Chart(config) {
|
2554 | _classCallCheck(this, Chart);
|
2555 |
|
2556 | var $$ = new ChartInternal_ChartInternal(this);
|
2557 | |
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 | this.plugins = [], this.internal = $$, $$.loadConfig(config), $$.beforeInit(config), $$.init(), function bindThis(fn, target, argThis) {
|
2576 | Object.keys(fn).forEach(function (key) {
|
2577 | target[key] = fn[key].bind(argThis), Object.keys(fn[key]).length && bindThis(fn[key], target[key], argThis);
|
2578 | });
|
2579 | }(Chart.prototype, this, this);
|
2580 | };
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 | var Options_Options = function Options() {
|
2598 | return _classCallCheck(this, Options), {
|
2599 | |
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 | bindto: "#chart",
|
2626 |
|
2627 | |
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 | background: {},
|
2646 |
|
2647 | |
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 |
|
2656 |
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 | clipPath: !0,
|
2662 |
|
2663 | |
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 | svg_classname: undefined,
|
2675 |
|
2676 | |
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 | size_width: undefined,
|
2692 | size_height: undefined,
|
2693 |
|
2694 | |
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 | padding_left: undefined,
|
2712 | padding_right: undefined,
|
2713 | padding_top: undefined,
|
2714 | padding_bottom: undefined,
|
2715 |
|
2716 | |
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 | resize_auto: !0,
|
2728 |
|
2729 | |
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 | zoom_enabled: undefined,
|
2786 | zoom_extent: undefined,
|
2787 | zoom_privileged: !1,
|
2788 | zoom_rescale: !1,
|
2789 | zoom_onzoom: undefined,
|
2790 | zoom_onzoomstart: undefined,
|
2791 | zoom_onzoomend: undefined,
|
2792 | zoom_resetButton: !0,
|
2793 | zoom_x_min: undefined,
|
2794 | zoom_x_max: undefined,
|
2795 |
|
2796 | |
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 | interaction_enabled: !0,
|
2828 | interaction_brighten: !0,
|
2829 | interaction_inputType_mouse: !0,
|
2830 | interaction_inputType_touch: {},
|
2831 |
|
2832 | |
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 | onover: undefined,
|
2845 |
|
2846 | |
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 | onout: undefined,
|
2859 |
|
2860 | |
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 | onresize: undefined,
|
2873 |
|
2874 | |
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 | onresized: undefined,
|
2887 |
|
2888 | |
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 | onbeforeinit: undefined,
|
2901 |
|
2902 | |
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 | oninit: undefined,
|
2915 |
|
2916 | |
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 | onafterinit: undefined,
|
2929 |
|
2930 | |
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 | onrendered: undefined,
|
2943 |
|
2944 | |
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 | transition_duration: 350,
|
2957 |
|
2958 | |
2959 |
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 | data_x: undefined,
|
2971 |
|
2972 | |
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 | data_xs: {},
|
2988 |
|
2989 | |
2990 |
|
2991 |
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 |
|
3011 |
|
3012 | data_xFormat: "%Y-%m-%d",
|
3013 |
|
3014 | |
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 | data_xLocaltime: !0,
|
3026 |
|
3027 | |
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 |
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 | data_xSort: !0,
|
3039 |
|
3040 | |
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 | data_idConverter: function data_idConverter(id) {
|
3060 | return id;
|
3061 | },
|
3062 |
|
3063 | |
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 | data_names: {},
|
3079 |
|
3080 | |
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 | data_classes: {},
|
3096 |
|
3097 | |
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 | data_groups: [],
|
3112 |
|
3113 | |
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 | data_axes: {},
|
3129 |
|
3130 | |
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 | data_type: undefined,
|
3159 |
|
3160 | |
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 | data_types: {},
|
3177 |
|
3178 | |
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 | data_labels: {},
|
3246 | data_labels_colors: undefined,
|
3247 | data_labels_position: {},
|
3248 |
|
3249 | |
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 |
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 | data_order: "desc",
|
3288 |
|
3289 | |
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 | data_regions: {},
|
3318 |
|
3319 | |
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 |
|
3327 |
|
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 | data_color: undefined,
|
3333 |
|
3334 | |
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 | data_colors: {},
|
3352 |
|
3353 | |
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 | data_hide: !1,
|
3370 |
|
3371 | |
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 |
|
3388 |
|
3389 | data_filter: undefined,
|
3390 |
|
3391 | |
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 | data_stack_normalize: !1,
|
3410 |
|
3411 | |
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 | data_selection_enabled: !1,
|
3427 |
|
3428 | |
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 |
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 | data_selection_grouped: !1,
|
3443 |
|
3444 | |
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 | data_selection_isselectable: function data_selection_isselectable() {
|
3459 | return !0;
|
3460 | },
|
3461 |
|
3462 | |
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 | data_selection_multiple: !0,
|
3477 |
|
3478 | |
3479 |
|
3480 |
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 |
|
3490 |
|
3491 |
|
3492 |
|
3493 | data_selection_draggable: !1,
|
3494 |
|
3495 | |
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 | data_onclick: function data_onclick() {},
|
3515 |
|
3516 | |
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 | data_onover: function data_onover() {},
|
3536 |
|
3537 | |
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 |
|
3545 |
|
3546 |
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 | data_onout: function data_onout() {},
|
3557 |
|
3558 | |
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 |
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 | data_onselected: function data_onselected() {},
|
3574 |
|
3575 | |
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 | data_onunselected: function data_onunselected() {},
|
3591 |
|
3592 | |
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 |
|
3603 |
|
3604 |
|
3605 |
|
3606 | data_onmin: undefined,
|
3607 |
|
3608 | |
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 | data_onmax: undefined,
|
3623 |
|
3624 | |
3625 |
|
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 | data_url: undefined,
|
3637 |
|
3638 | |
3639 |
|
3640 |
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 | data_headers: undefined,
|
3656 |
|
3657 | |
3658 |
|
3659 |
|
3660 |
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 |
|
3669 |
|
3670 |
|
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 | data_json: undefined,
|
3680 |
|
3681 | |
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 |
|
3712 |
|
3713 |
|
3714 |
|
3715 |
|
3716 |
|
3717 |
|
3718 |
|
3719 |
|
3720 |
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 |
|
3729 |
|
3730 |
|
3731 |
|
3732 |
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 | data_rows: undefined,
|
3741 |
|
3742 | |
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 |
|
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 | data_columns: undefined,
|
3788 |
|
3789 | |
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 | data_mimeType: "csv",
|
3805 |
|
3806 | |
3807 |
|
3808 |
|
3809 |
|
3810 |
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 | data_keys: undefined,
|
3828 |
|
3829 | |
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 | data_empty_label_text: "",
|
3846 |
|
3847 | |
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 | subchart_show: !1,
|
3881 | subchart_size_height: 60,
|
3882 | subchart_axis_x_show: !0,
|
3883 | subchart_axis_x_tick_show: !0,
|
3884 | subchart_axis_x_tick_text_show: !0,
|
3885 | subchart_onbrush: function subchart_onbrush() {},
|
3886 |
|
3887 | |
3888 |
|
3889 |
|
3890 |
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 | color_pattern: [],
|
3961 | color_tiles: undefined,
|
3962 | color_threshold: {},
|
3963 | color_onover: undefined,
|
3964 |
|
3965 | |
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 | legend_show: !0,
|
4050 | legend_hide: !1,
|
4051 | legend_contents_bindto: undefined,
|
4052 | legend_contents_template: undefined,
|
4053 | legend_position: "bottom",
|
4054 | legend_inset_anchor: "top-left",
|
4055 | legend_inset_x: 10,
|
4056 | legend_inset_y: 0,
|
4057 | legend_inset_step: undefined,
|
4058 | legend_item_onclick: undefined,
|
4059 | legend_item_onover: undefined,
|
4060 | legend_item_onout: undefined,
|
4061 | legend_equally: !1,
|
4062 | legend_padding: 0,
|
4063 | legend_item_tile_width: 10,
|
4064 | legend_item_tile_height: 10,
|
4065 | legend_usePoint: !1,
|
4066 |
|
4067 | |
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 | axis_rotated: !1,
|
4079 |
|
4080 | |
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 | axis_x_clipPath: !0,
|
4092 |
|
4093 | |
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 | axis_x_show: !0,
|
4107 |
|
4108 | |
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 | axis_x_type: "indexed",
|
4129 |
|
4130 | |
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 |
|
4143 |
|
4144 | axis_x_localtime: !0,
|
4145 |
|
4146 | |
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 | axis_x_categories: [],
|
4161 |
|
4162 | |
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 | axis_x_tick_centered: !1,
|
4178 |
|
4179 | |
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 | axis_x_tick_format: undefined,
|
4207 |
|
4208 | |
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 | axis_x_tick_culling: {},
|
4228 |
|
4229 | |
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 | axis_x_tick_culling_max: 10,
|
4247 |
|
4248 | |
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 | axis_x_tick_count: undefined,
|
4265 |
|
4266 | |
4267 |
|
4268 |
|
4269 |
|
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 |
|
4279 |
|
4280 |
|
4281 |
|
4282 | axis_x_tick_show: !0,
|
4283 |
|
4284 | |
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 | axis_x_tick_text_show: !0,
|
4303 |
|
4304 | |
4305 |
|
4306 |
|
4307 |
|
4308 |
|
4309 |
|
4310 |
|
4311 |
|
4312 |
|
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 | axis_x_tick_text_position: {
|
4325 | x: 0,
|
4326 | y: 0
|
4327 | },
|
4328 |
|
4329 | |
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 |
|
4348 | axis_x_tick_fit: !0,
|
4349 |
|
4350 | |
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 |
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 |
|
4371 |
|
4372 | axis_x_tick_values: null,
|
4373 |
|
4374 | |
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 |
|
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 | axis_x_tick_autorotate: !1,
|
4400 |
|
4401 | |
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 | axis_x_tick_rotate: 0,
|
4421 |
|
4422 | |
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 |
|
4429 |
|
4430 |
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 | axis_x_tick_outer: !0,
|
4438 |
|
4439 | |
4440 |
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 |
|
4465 |
|
4466 |
|
4467 | axis_x_tick_multiline: !0,
|
4468 |
|
4469 | |
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 |
|
4483 |
|
4484 |
|
4485 |
|
4486 | axis_x_tick_width: null,
|
4487 |
|
4488 | |
4489 |
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 |
|
4496 |
|
4497 |
|
4498 |
|
4499 |
|
4500 |
|
4501 |
|
4502 |
|
4503 |
|
4504 | axis_x_tick_tooltip: !1,
|
4505 |
|
4506 | |
4507 |
|
4508 |
|
4509 |
|
4510 |
|
4511 |
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 | axis_x_max: undefined,
|
4530 |
|
4531 | |
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 | axis_x_min: undefined,
|
4555 |
|
4556 | |
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 | axis_x_padding: {},
|
4589 |
|
4590 | |
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 | axis_x_height: undefined,
|
4605 |
|
4606 | |
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 |
|
4614 |
|
4615 |
|
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 |
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 |
|
4634 | axis_x_extent: undefined,
|
4635 |
|
4636 | |
4637 |
|
4638 |
|
4639 |
|
4640 |
|
4641 |
|
4642 |
|
4643 |
|
4644 |
|
4645 |
|
4646 |
|
4647 |
|
4648 |
|
4649 |
|
4650 |
|
4651 |
|
4652 |
|
4653 |
|
4654 |
|
4655 |
|
4656 |
|
4657 |
|
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 |
|
4667 |
|
4668 |
|
4669 |
|
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 |
|
4675 |
|
4676 |
|
4677 | axis_x_label: {},
|
4678 |
|
4679 | |
4680 |
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 |
|
4686 |
|
4687 |
|
4688 |
|
4689 |
|
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 |
|
4695 |
|
4696 |
|
4697 |
|
4698 |
|
4699 |
|
4700 |
|
4701 |
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 |
|
4715 |
|
4716 | axis_x_axes: [],
|
4717 |
|
4718 | |
4719 |
|
4720 |
|
4721 |
|
4722 |
|
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 | axis_y_clipPath: !0,
|
4730 |
|
4731 | |
4732 |
|
4733 |
|
4734 |
|
4735 |
|
4736 |
|
4737 |
|
4738 |
|
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 | axis_y_show: !0,
|
4745 |
|
4746 | |
4747 |
|
4748 |
|
4749 |
|
4750 |
|
4751 |
|
4752 |
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 |
|
4762 |
|
4763 | axis_y_type: undefined,
|
4764 |
|
4765 | |
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 | axis_y_max: undefined,
|
4780 |
|
4781 | |
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 |
|
4795 |
|
4796 | axis_y_min: undefined,
|
4797 |
|
4798 | |
4799 |
|
4800 |
|
4801 |
|
4802 |
|
4803 |
|
4804 |
|
4805 |
|
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 | axis_y_inverted: !1,
|
4813 |
|
4814 | |
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 | axis_y_center: undefined,
|
4828 |
|
4829 | |
4830 |
|
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 |
|
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 | axis_y_inner: !1,
|
4843 |
|
4844 | |
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 |
|
4852 |
|
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 | axis_y_label: {},
|
4869 |
|
4870 | |
4871 |
|
4872 |
|
4873 |
|
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 | axis_y_tick_format: undefined,
|
4889 |
|
4890 | |
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 |
|
4905 |
|
4906 |
|
4907 | axis_y_tick_culling: !1,
|
4908 |
|
4909 | |
4910 |
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 | axis_y_tick_culling_max: 5,
|
4927 |
|
4928 | |
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 |
|
4936 |
|
4937 |
|
4938 |
|
4939 |
|
4940 |
|
4941 |
|
4942 |
|
4943 | axis_y_tick_outer: !0,
|
4944 |
|
4945 | |
4946 |
|
4947 |
|
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 |
|
4958 |
|
4959 |
|
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 | axis_y_tick_values: null,
|
4966 |
|
4967 | |
4968 |
|
4969 |
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 |
|
4977 |
|
4978 |
|
4979 |
|
4980 |
|
4981 |
|
4982 |
|
4983 |
|
4984 | axis_y_tick_rotate: 0,
|
4985 |
|
4986 | |
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 |
|
4999 |
|
5000 |
|
5001 |
|
5002 | axis_y_tick_count: undefined,
|
5003 |
|
5004 | |
5005 |
|
5006 |
|
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 |
|
5012 |
|
5013 |
|
5014 |
|
5015 |
|
5016 |
|
5017 |
|
5018 |
|
5019 |
|
5020 | axis_y_tick_show: !0,
|
5021 |
|
5022 | |
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 |
|
5028 |
|
5029 |
|
5030 |
|
5031 |
|
5032 |
|
5033 |
|
5034 |
|
5035 |
|
5036 |
|
5037 |
|
5038 |
|
5039 |
|
5040 | axis_y_tick_stepSize: null,
|
5041 |
|
5042 | |
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 |
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 |
|
5058 |
|
5059 |
|
5060 | axis_y_tick_text_show: !0,
|
5061 |
|
5062 | |
5063 |
|
5064 |
|
5065 |
|
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 |
|
5081 |
|
5082 | axis_y_tick_text_position: {
|
5083 | x: 0,
|
5084 | y: 0
|
5085 | },
|
5086 |
|
5087 | |
5088 |
|
5089 |
|
5090 |
|
5091 |
|
5092 |
|
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 |
|
5102 |
|
5103 |
|
5104 |
|
5105 |
|
5106 |
|
5107 |
|
5108 |
|
5109 | axis_y_tick_time_value: undefined,
|
5110 |
|
5111 | |
5112 |
|
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 |
|
5118 |
|
5119 |
|
5120 |
|
5121 |
|
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 |
|
5128 |
|
5129 |
|
5130 |
|
5131 |
|
5132 |
|
5133 |
|
5134 |
|
5135 |
|
5136 | axis_y_padding: {},
|
5137 |
|
5138 | |
5139 |
|
5140 |
|
5141 |
|
5142 |
|
5143 |
|
5144 |
|
5145 |
|
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 | axis_y_default: undefined,
|
5153 |
|
5154 | |
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 | axis_y_axes: [],
|
5192 |
|
5193 | |
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 |
|
5199 |
|
5200 |
|
5201 |
|
5202 |
|
5203 |
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 | axis_y2_show: !1,
|
5210 |
|
5211 | |
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 |
|
5224 | axis_y2_max: undefined,
|
5225 |
|
5226 | |
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 | axis_y2_min: undefined,
|
5240 |
|
5241 | |
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 |
|
5251 |
|
5252 |
|
5253 |
|
5254 |
|
5255 | axis_y2_inverted: !1,
|
5256 |
|
5257 | |
5258 |
|
5259 |
|
5260 |
|
5261 |
|
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 |
|
5269 |
|
5270 | axis_y2_center: undefined,
|
5271 |
|
5272 | |
5273 |
|
5274 |
|
5275 |
|
5276 |
|
5277 |
|
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 |
|
5285 | axis_y2_inner: !1,
|
5286 |
|
5287 | |
5288 |
|
5289 |
|
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 |
|
5295 |
|
5296 |
|
5297 |
|
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 | axis_y2_label: {},
|
5312 |
|
5313 | |
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 | axis_y2_tick_format: undefined,
|
5331 |
|
5332 | |
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 |
|
5340 |
|
5341 |
|
5342 |
|
5343 |
|
5344 |
|
5345 |
|
5346 |
|
5347 |
|
5348 |
|
5349 | axis_y2_tick_culling: !1,
|
5350 |
|
5351 | |
5352 |
|
5353 |
|
5354 |
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 |
|
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 | axis_y2_tick_culling_max: 5,
|
5369 |
|
5370 | |
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 | axis_y2_tick_outer: !0,
|
5386 |
|
5387 | |
5388 |
|
5389 |
|
5390 |
|
5391 |
|
5392 |
|
5393 |
|
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 |
|
5404 |
|
5405 |
|
5406 |
|
5407 | axis_y2_tick_values: null,
|
5408 |
|
5409 | |
5410 |
|
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 |
|
5416 |
|
5417 |
|
5418 |
|
5419 |
|
5420 |
|
5421 |
|
5422 |
|
5423 |
|
5424 |
|
5425 |
|
5426 | axis_y2_tick_rotate: 0,
|
5427 |
|
5428 | |
5429 |
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 | axis_y2_tick_count: undefined,
|
5445 |
|
5446 | |
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 | axis_y2_tick_show: !0,
|
5463 |
|
5464 | |
5465 |
|
5466 |
|
5467 |
|
5468 |
|
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 |
|
5477 |
|
5478 |
|
5479 |
|
5480 |
|
5481 |
|
5482 | axis_y2_tick_stepSize: null,
|
5483 |
|
5484 | |
5485 |
|
5486 |
|
5487 |
|
5488 |
|
5489 |
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 | axis_y2_tick_text_show: !0,
|
5503 |
|
5504 | |
5505 |
|
5506 |
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 |
|
5512 |
|
5513 |
|
5514 |
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 |
|
5524 | axis_y2_tick_text_position: {
|
5525 | x: 0,
|
5526 | y: 0
|
5527 | },
|
5528 |
|
5529 | |
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 |
|
5537 |
|
5538 |
|
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 |
|
5548 |
|
5549 |
|
5550 |
|
5551 |
|
5552 |
|
5553 | axis_y2_padding: {},
|
5554 |
|
5555 | |
5556 |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 | axis_y2_default: undefined,
|
5570 |
|
5571 | |
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 | axis_y2_axes: [],
|
5609 |
|
5610 | |
5611 |
|
5612 |
|
5613 |
|
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 | grid_x_show: !1,
|
5665 | grid_x_type: "tick",
|
5666 | grid_x_lines: [],
|
5667 | grid_y_show: !1,
|
5668 | grid_y_lines: [],
|
5669 | grid_y_ticks: 10,
|
5670 | grid_focus_edge: !1,
|
5671 | grid_focus_show: !0,
|
5672 | grid_focus_y: !1,
|
5673 | grid_front: !1,
|
5674 | grid_lines_front: !0,
|
5675 |
|
5676 | |
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 |
|
5698 |
|
5699 |
|
5700 |
|
5701 |
|
5702 |
|
5703 |
|
5704 |
|
5705 |
|
5706 |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 |
|
5715 |
|
5716 |
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 |
|
5738 |
|
5739 |
|
5740 |
|
5741 |
|
5742 | point_show: !0,
|
5743 | point_r: 2.5,
|
5744 | point_sensitivity: 10,
|
5745 | point_focus_expand_enabled: !0,
|
5746 | point_focus_expand_r: undefined,
|
5747 | point_pattern: [],
|
5748 | point_select_r: undefined,
|
5749 | point_type: "circle",
|
5750 |
|
5751 | |
5752 |
|
5753 |
|
5754 |
|
5755 |
|
5756 |
|
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 | line_connectNull: !1,
|
5789 | line_step_type: "step",
|
5790 | line_zerobased: !1,
|
5791 | line_classes: undefined,
|
5792 | line_point: !0,
|
5793 |
|
5794 | |
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 |
|
5802 |
|
5803 |
|
5804 |
|
5805 |
|
5806 |
|
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 | scatter_zerobased: !1,
|
5819 |
|
5820 | |
5821 |
|
5822 |
|
5823 |
|
5824 |
|
5825 |
|
5826 |
|
5827 |
|
5828 |
|
5829 |
|
5830 |
|
5831 |
|
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 |
|
5845 |
|
5846 |
|
5847 |
|
5848 |
|
5849 |
|
5850 |
|
5851 |
|
5852 |
|
5853 |
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 |
|
5860 |
|
5861 |
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 |
|
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 |
|
5876 |
|
5877 |
|
5878 | bar_padding: 0,
|
5879 | bar_radius: undefined,
|
5880 | bar_radius_ratio: undefined,
|
5881 | bar_sensitivity: 2,
|
5882 | bar_width: undefined,
|
5883 | bar_width_ratio: .6,
|
5884 | bar_width_max: undefined,
|
5885 | bar_zerobased: !0,
|
5886 |
|
5887 | |
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 |
|
5897 |
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 | bubble_maxR: 35,
|
5910 | bubble_zerobased: !1,
|
5911 |
|
5912 | |
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 |
|
5919 |
|
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 |
|
5949 |
|
5950 |
|
5951 |
|
5952 |
|
5953 |
|
5954 |
|
5955 |
|
5956 |
|
5957 |
|
5958 | area_zerobased: !0,
|
5959 | area_above: !1,
|
5960 | area_linearGradient: !1,
|
5961 |
|
5962 | |
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 |
|
5976 |
|
5977 |
|
5978 |
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 | pie_label_show: !0,
|
6024 | pie_label_format: undefined,
|
6025 | pie_label_threshold: .05,
|
6026 | pie_label_ratio: undefined,
|
6027 | pie_expand: {},
|
6028 | pie_expand_rate: .98,
|
6029 | pie_expand_duration: 50,
|
6030 | pie_innerRadius: 0,
|
6031 | pie_padAngle: 0,
|
6032 | pie_padding: 0,
|
6033 | pie_startingAngle: 0,
|
6034 |
|
6035 | |
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 | plugins: [],
|
6048 |
|
6049 | |
6050 |
|
6051 |
|
6052 |
|
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 |
|
6072 |
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 |
|
6096 |
|
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 |
|
6109 |
|
6110 | gauge_fullCircle: !1,
|
6111 | gauge_label_show: !0,
|
6112 | gauge_label_format: undefined,
|
6113 | gauge_min: 0,
|
6114 | gauge_max: 100,
|
6115 | gauge_type: "single",
|
6116 | gauge_startingAngle: -1 * Math.PI / 2,
|
6117 | gauge_label_extents: undefined,
|
6118 | gauge_title: "",
|
6119 | gauge_units: undefined,
|
6120 | gauge_width: undefined,
|
6121 | gauge_arcs_minWidth: 5,
|
6122 | gauge_expand: {},
|
6123 | gauge_expand_rate: .98,
|
6124 | gauge_expand_duration: 50,
|
6125 |
|
6126 | |
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 |
|
6144 |
|
6145 |
|
6146 |
|
6147 |
|
6148 |
|
6149 |
|
6150 |
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 |
|
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 |
|
6176 |
|
6177 |
|
6178 |
|
6179 |
|
6180 |
|
6181 |
|
6182 |
|
6183 | donut_label_show: !0,
|
6184 | donut_label_format: undefined,
|
6185 | donut_label_threshold: .05,
|
6186 | donut_label_ratio: undefined,
|
6187 | donut_width: undefined,
|
6188 | donut_title: "",
|
6189 | donut_expand: {},
|
6190 | donut_expand_rate: .98,
|
6191 | donut_expand_duration: 50,
|
6192 | donut_padAngle: 0,
|
6193 | donut_startingAngle: 0,
|
6194 |
|
6195 | |
6196 |
|
6197 |
|
6198 |
|
6199 |
|
6200 |
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 |
|
6212 |
|
6213 |
|
6214 |
|
6215 |
|
6216 |
|
6217 |
|
6218 |
|
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 |
|
6225 |
|
6226 |
|
6227 |
|
6228 | spline_interpolation_type: "cardinal",
|
6229 |
|
6230 | |
6231 |
|
6232 |
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 |
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 | radar_axis_max: undefined,
|
6286 | radar_axis_line_show: !0,
|
6287 | radar_axis_text_show: !0,
|
6288 | radar_axis_text_position: {},
|
6289 | radar_level_depth: 3,
|
6290 | radar_level_show: !0,
|
6291 | radar_level_text_format: function radar_level_text_format(x) {
|
6292 | return x % 1 === 0 ? x : x.toFixed(2);
|
6293 | },
|
6294 | radar_level_text_show: !0,
|
6295 | radar_size_ratio: .87,
|
6296 | radar_direction_clockwise: !1,
|
6297 |
|
6298 | |
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 |
|
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 | render: {},
|
6338 |
|
6339 | |
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 |
|
6353 |
|
6354 |
|
6355 |
|
6356 |
|
6357 |
|
6358 |
|
6359 |
|
6360 |
|
6361 | regions: [],
|
6362 |
|
6363 | |
6364 |
|
6365 |
|
6366 |
|
6367 |
|
6368 |
|
6369 |
|
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 |
|
6375 |
|
6376 |
|
6377 |
|
6378 |
|
6379 |
|
6380 |
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 |
|
6395 |
|
6396 |
|
6397 |
|
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 |
|
6403 |
|
6404 |
|
6405 |
|
6406 |
|
6407 |
|
6408 |
|
6409 |
|
6410 |
|
6411 |
|
6412 |
|
6413 |
|
6414 |
|
6415 |
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 |
|
6429 |
|
6430 |
|
6431 |
|
6432 |
|
6433 |
|
6434 |
|
6435 |
|
6436 |
|
6437 |
|
6438 |
|
6439 |
|
6440 |
|
6441 |
|
6442 |
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 |
|
6448 |
|
6449 |
|
6450 |
|
6451 |
|
6452 |
|
6453 |
|
6454 |
|
6455 |
|
6456 |
|
6457 |
|
6458 |
|
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 |
|
6464 |
|
6465 |
|
6466 |
|
6467 |
|
6468 |
|
6469 |
|
6470 |
|
6471 |
|
6472 |
|
6473 |
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 |
|
6483 |
|
6484 |
|
6485 |
|
6486 |
|
6487 |
|
6488 |
|
6489 |
|
6490 |
|
6491 |
|
6492 |
|
6493 |
|
6494 |
|
6495 |
|
6496 |
|
6497 |
|
6498 |
|
6499 |
|
6500 |
|
6501 |
|
6502 |
|
6503 |
|
6504 |
|
6505 |
|
6506 |
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 |
|
6512 |
|
6513 |
|
6514 |
|
6515 |
|
6516 |
|
6517 |
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 |
|
6530 |
|
6531 |
|
6532 |
|
6533 |
|
6534 |
|
6535 |
|
6536 |
|
6537 | tooltip_show: !0,
|
6538 | tooltip_doNotHide: !1,
|
6539 | tooltip_grouped: !0,
|
6540 | tooltip_format_title: undefined,
|
6541 | tooltip_format_name: undefined,
|
6542 | tooltip_format_value: undefined,
|
6543 | tooltip_position: undefined,
|
6544 | tooltip_contents: {},
|
6545 | tooltip_init_show: !1,
|
6546 | tooltip_init_x: 0,
|
6547 | tooltip_init_position: {
|
6548 | top: "0px",
|
6549 | left: "50px"
|
6550 | },
|
6551 | tooltip_linked: !1,
|
6552 | tooltip_linked_name: "",
|
6553 | tooltip_onshow: function tooltip_onshow() {},
|
6554 | tooltip_onhide: function tooltip_onhide() {},
|
6555 | tooltip_onshown: function tooltip_onshown() {},
|
6556 | tooltip_onhidden: function tooltip_onhidden() {},
|
6557 | tooltip_order: null,
|
6558 |
|
6559 | |
6560 |
|
6561 |
|
6562 |
|
6563 |
|
6564 |
|
6565 |
|
6566 |
|
6567 |
|
6568 |
|
6569 |
|
6570 |
|
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 |
|
6576 |
|
6577 |
|
6578 |
|
6579 |
|
6580 |
|
6581 |
|
6582 |
|
6583 |
|
6584 |
|
6585 |
|
6586 |
|
6587 | title_text: undefined,
|
6588 | title_padding: {
|
6589 | top: 0,
|
6590 | right: 0,
|
6591 | bottom: 0,
|
6592 | left: 0
|
6593 | },
|
6594 | title_position: "center"
|
6595 | };
|
6596 | };
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 |
|
6605 |
|
6606 |
|
6607 | extend(ChartInternal_ChartInternal.prototype, {
|
6608 | getOptions: function getOptions() {
|
6609 | return new Options_Options();
|
6610 | },
|
6611 |
|
6612 | |
6613 |
|
6614 |
|
6615 |
|
6616 |
|
6617 | loadConfig: function loadConfig(config) {
|
6618 | var target,
|
6619 | keys,
|
6620 | read,
|
6621 | thisConfig = this.config,
|
6622 | find = function () {
|
6623 | var key = keys.shift();
|
6624 | return key && target && isObjectType(target) && key in target ? (target = target[key], find()) : key ? undefined : target;
|
6625 | };
|
6626 |
|
6627 | Object.keys(thisConfig).forEach(function (key) {
|
6628 | target = config, keys = key.split("_"), read = find(), isDefined(read) && (thisConfig[key] = read);
|
6629 | });
|
6630 | }
|
6631 | });
|
6632 |
|
6633 |
|
6634 |
|
6635 |
|
6636 |
|
6637 |
|
6638 |
|
6639 |
|
6640 | extend(ChartInternal_ChartInternal.prototype, {
|
6641 | getScale: function getScale(min, max, forTimeseries) {
|
6642 | return (forTimeseries ? Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleTime"])() : Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleLinear"])()).range([min, max]);
|
6643 | },
|
6644 |
|
6645 | |
6646 |
|
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 |
|
6653 |
|
6654 | getX: function getX(min, max, domain, offset) {
|
6655 | var $$ = this,
|
6656 | scale = $$.zoomScale || $$.getScale(min, max, $$.isTimeSeries());
|
6657 | return $$.getCustomizedScale(domain ? scale.domain(domain) : scale, offset);
|
6658 | },
|
6659 |
|
6660 | |
6661 |
|
6662 |
|
6663 |
|
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 | getY: function getY(min, max, domain) {
|
6669 | var scale = this.getScale(min, max, this.isTimeSeriesY());
|
6670 | return domain && scale.domain(domain), scale;
|
6671 | },
|
6672 |
|
6673 | |
6674 |
|
6675 |
|
6676 |
|
6677 |
|
6678 |
|
6679 |
|
6680 | getCustomizedScale: function getCustomizedScale(scaleValue, offsetValue) {
|
6681 | var $$ = this,
|
6682 | offset = offsetValue || function () {
|
6683 | return $$.xAxis.tickOffset();
|
6684 | },
|
6685 | scale = function (d, raw) {
|
6686 | var v = scaleValue(d) + offset();
|
6687 | return raw ? v : Math.ceil(v);
|
6688 | };
|
6689 |
|
6690 |
|
6691 | for (var key in scaleValue) scale[key] = scaleValue[key];
|
6692 |
|
6693 | return scale.orgDomain = function () {
|
6694 | return scaleValue.domain();
|
6695 | }, scale.orgScale = function () {
|
6696 | return scaleValue;
|
6697 | }, $$.isCategorized() && (scale.domain = function (domainValue) {
|
6698 | var domain = domainValue;
|
6699 | return arguments.length ? (scaleValue.domain(domain), scale) : (domain = this.orgDomain(), [domain[0], domain[1] + 1]);
|
6700 | }), scale;
|
6701 | },
|
6702 | getYScale: function getYScale(id) {
|
6703 | return this.axis.getId(id) === "y2" ? this.y2 : this.y;
|
6704 | },
|
6705 | getSubYScale: function getSubYScale(id) {
|
6706 | return this.axis.getId(id) === "y2" ? this.subY2 : this.subY;
|
6707 | },
|
6708 |
|
6709 | |
6710 |
|
6711 |
|
6712 |
|
6713 |
|
6714 | updateScales: function updateScales(isInit) {
|
6715 | var updateXDomain = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
6716 | $$ = this,
|
6717 | config = $$.config,
|
6718 | isRotated = config.axis_rotated;
|
6719 | $$.xMin = isRotated ? 1 : 0, $$.xMax = isRotated ? $$.height : $$.width, $$.yMin = isRotated ? 0 : $$.height, $$.yMax = isRotated ? $$.width : 1, $$.subXMin = $$.xMin, $$.subXMax = $$.xMax, $$.subYMin = isRotated ? 0 : $$.height2, $$.subYMax = isRotated ? $$.width2 : 1;
|
6720 |
|
6721 |
|
6722 | var xDomain = updateXDomain && $$.x && $$.x.orgDomain(),
|
6723 | xSubDomain = updateXDomain && $$.orgXDomain;
|
6724 |
|
6725 |
|
6726 | $$.x = $$.getX($$.xMin, $$.xMax, xDomain, function () {
|
6727 | return $$.xAxis.tickOffset();
|
6728 | }), $$.subX = $$.getX($$.xMin, $$.xMax, xSubDomain, function (d) {
|
6729 | return d % 1 ? 0 : $$.subXAxis.tickOffset();
|
6730 | }), $$.xAxisTickFormat = $$.axis.getXAxisTickFormat(), $$.xAxisTickValues = $$.axis.getTickValues("x"), $$.xAxis = $$.axis.getAxis("x", $$.x, config.axis_x_tick_outer, isInit), $$.subXAxis = $$.axis.getAxis("subX", $$.subX, config.axis_x_tick_outer, isInit), $$.y = $$.getY($$.yMin, $$.yMax, $$.y ? $$.y.domain() : config.axis_y_default), $$.subY = $$.getY($$.subYMin, $$.subYMax, $$.subY ? $$.subY.domain() : config.axis_y_default), $$.yAxisTickValues = $$.axis.getTickValues("y"), $$.yAxis = $$.axis.getAxis("y", $$.y, config.axis_y_tick_outer, isInit), config.axis_y2_show && ($$.y2 = $$.getY($$.yMin, $$.yMax, $$.y2 ? $$.y2.domain() : config.axis_y2_default), $$.subY2 = $$.getY($$.subYMin, $$.subYMax, $$.subY2 ? $$.subY2.domain() : config.axis_y2_default), $$.y2AxisTickValues = $$.axis.getTickValues("y2"), $$.y2Axis = $$.axis.getAxis("y2", $$.y2, config.axis_y2_tick_outer, isInit)), $$.updateArc && $$.updateArc();
|
6731 | }
|
6732 | });
|
6733 |
|
6734 |
|
6735 |
|
6736 |
|
6737 |
|
6738 |
|
6739 |
|
6740 |
|
6741 |
|
6742 | extend(ChartInternal_ChartInternal.prototype, {
|
6743 | getYDomainMinMax: function getYDomainMinMax(targets, type) {
|
6744 | var $$ = this,
|
6745 | config = $$.config,
|
6746 | isMin = type === "min",
|
6747 | dataGroups = config.data_groups,
|
6748 | ids = $$.mapToIds(targets),
|
6749 | ys = $$.getValuesAsIdKeyed(targets);
|
6750 | return dataGroups.length > 0 && function () {
|
6751 | for (var idsInGroup, _ret, hasValue = $$["has".concat(isMin ? "Negative" : "Positive", "ValueInTargets")](targets), _loop = function (j, _idsInGroup) {
|
6752 | if (_idsInGroup = _idsInGroup.filter(function (v) {
|
6753 | return ids.indexOf(v) >= 0;
|
6754 | }), _idsInGroup.length === 0) return idsInGroup = _idsInGroup, "continue";
|
6755 | var baseId = _idsInGroup[0],
|
6756 | baseAxisId = $$.axis.getId(baseId);
|
6757 | hasValue && ys[baseId] && (ys[baseId] = ys[baseId].map(function (v) {
|
6758 | return (isMin ? v < 0 : v > 0) ? v : 0;
|
6759 | }));
|
6760 |
|
6761 | for (var id, _ret2, _loop2 = function (k, id) {
|
6762 | if (!ys[id]) return "continue";
|
6763 | var axisId = $$.axis.getId(id);
|
6764 | ys[id].forEach(function (v, i) {
|
6765 | var val = +v,
|
6766 | meetCondition = isMin ? val > 0 : val < 0;
|
6767 | axisId !== baseAxisId || hasValue && meetCondition || (ys[baseId][i] += val);
|
6768 | });
|
6769 | }, k = 1; id = _idsInGroup[k]; k++) _ret2 = _loop2(k, id), _ret2 === "continue";
|
6770 |
|
6771 | idsInGroup = _idsInGroup;
|
6772 | }, j = 0; idsInGroup = dataGroups[j]; j++) _ret = _loop(j, idsInGroup), _ret === "continue";
|
6773 | }(), getMinMax(type, Object.keys(ys).map(function (key) {
|
6774 | return getMinMax(type, ys[key]);
|
6775 | }));
|
6776 | },
|
6777 | getYDomainMin: function getYDomainMin(targets) {
|
6778 | return this.getYDomainMinMax(targets, "min");
|
6779 | },
|
6780 | getYDomainMax: function getYDomainMax(targets) {
|
6781 | return this.getYDomainMinMax(targets, "max");
|
6782 | },
|
6783 |
|
6784 | |
6785 |
|
6786 |
|
6787 |
|
6788 |
|
6789 | isHiddenTargetWithYDomain: function isHiddenTargetWithYDomain(id) {
|
6790 | var $$ = this;
|
6791 | return $$.hiddenTargetIds.some(function (v) {
|
6792 | return $$.axis.getId(v) === id;
|
6793 | });
|
6794 | },
|
6795 | getYDomain: function getYDomain(targets, axisId, xDomain) {
|
6796 | var $$ = this,
|
6797 | config = $$.config,
|
6798 | pfx = "axis_".concat(axisId);
|
6799 | if ($$.isStackNormalized()) return [0, 100];
|
6800 | var targetsByAxisId = targets.filter(function (t) {
|
6801 | return $$.axis.getId(t.id) === axisId;
|
6802 | }),
|
6803 | yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId;
|
6804 | if (yTargets.length === 0) return $$.isHiddenTargetWithYDomain(axisId) ? $$[axisId].domain() : axisId === "y2" ? $$.y.domain() :
|
6805 |
|
6806 | $$.getYDomain(targets, "y2", xDomain);
|
6807 | var yMin = config["".concat(pfx, "_min")],
|
6808 | yMax = config["".concat(pfx, "_max")],
|
6809 | yDomainMin = $$.getYDomainMin(yTargets),
|
6810 | yDomainMax = $$.getYDomainMax(yTargets),
|
6811 | center = config["".concat(pfx, "_center")],
|
6812 | isZeroBased = ["area", "bar", "bubble", "line", "scatter"].some(function (v) {
|
6813 | return $$.hasType(v, yTargets) && config["".concat(v, "_zerobased")];
|
6814 | }),
|
6815 | isInverted = config["".concat(pfx, "_inverted")],
|
6816 | showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,
|
6817 | showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
6818 | 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);
|
6819 | var isAllPositive = yDomainMin >= 0 && yDomainMax >= 0,
|
6820 | isAllNegative = yDomainMin <= 0 && yDomainMax <= 0;
|
6821 | (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) && (isZeroBased = !1), isZeroBased && (isAllPositive && (yDomainMin = 0), isAllNegative && (yDomainMax = 0));
|
6822 | var domainLength = Math.abs(yDomainMax - yDomainMin),
|
6823 | padding = {
|
6824 | top: domainLength * .1,
|
6825 | bottom: domainLength * .1
|
6826 | };
|
6827 |
|
6828 | if (isDefined(center)) {
|
6829 | var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
|
6830 | yDomainMax = center + yDomainAbs, yDomainMin = center - yDomainAbs;
|
6831 | }
|
6832 |
|
6833 |
|
6834 | if (showHorizontalDataLabel) {
|
6835 | var diff = diffDomain($$.y.range()),
|
6836 | ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map(function (v) {
|
6837 | return v / diff;
|
6838 | });
|
6839 | ["bottom", "top"].forEach(function (v, i) {
|
6840 | padding[v] += domainLength * (ratio[i] / (1 - ratio[0] - ratio[1]));
|
6841 | });
|
6842 | } else if (showVerticalDataLabel) {
|
6843 | var lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height");
|
6844 | ["bottom", "top"].forEach(function (v, i) {
|
6845 | padding[v] += $$.axis.convertPixelsToAxisPadding(lengths[i], domainLength);
|
6846 | });
|
6847 | }
|
6848 |
|
6849 |
|
6850 |
|
6851 | var p = config["".concat(pfx, "_padding")];
|
6852 | notEmpty(p) && ["bottom", "top"].forEach(function (v) {
|
6853 | padding[v] = $$.axis.getPadding(p, v, padding[v], domainLength);
|
6854 | }), isZeroBased && (isAllPositive && (padding.bottom = yDomainMin), isAllNegative && (padding.top = -yDomainMax));
|
6855 | var domain = [yDomainMin - padding.bottom, yDomainMax + padding.top];
|
6856 | return isInverted ? domain.reverse() : domain;
|
6857 | },
|
6858 | getXDomainMinMax: function getXDomainMinMax(targets, type) {
|
6859 | var $$ = this,
|
6860 | configValue = $$.config["axis_x_".concat(type)],
|
6861 | dataValue = getMinMax(type, targets.map(function (t) {
|
6862 | return getMinMax(type, t.values.map(function (v) {
|
6863 | return v.x;
|
6864 | }));
|
6865 | })),
|
6866 | value = isObject(configValue) ? configValue.value : configValue;
|
6867 | return value = isDefined(value) && $$.isTimeSeries() ? $$.parseDate(value) : value, isObject(configValue) && configValue.fit && (type === "min" && value < dataValue || type === "max" && value > dataValue) && (value = undefined), isDefined(value) ? value : dataValue;
|
6868 | },
|
6869 | getXDomainMin: function getXDomainMin(targets) {
|
6870 | return this.getXDomainMinMax(targets, "min");
|
6871 | },
|
6872 | getXDomainMax: function getXDomainMax(targets) {
|
6873 | return this.getXDomainMinMax(targets, "max");
|
6874 | },
|
6875 | getXDomainPadding: function getXDomainPadding(domain) {
|
6876 | var maxDataCount,
|
6877 | padding,
|
6878 | $$ = this,
|
6879 | config = $$.config,
|
6880 | diff = domain[1] - domain[0],
|
6881 | xPadding = config.axis_x_padding;
|
6882 | $$.isCategorized() ? padding = 0 : $$.hasType("bar") ? (maxDataCount = $$.getMaxDataCount(), padding = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5) : padding = diff * .01;
|
6883 | var left = padding,
|
6884 | right = padding;
|
6885 | 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), {
|
6886 | left: left,
|
6887 | right: right
|
6888 | };
|
6889 | },
|
6890 | getXDomain: function getXDomain(targets) {
|
6891 | var $$ = this,
|
6892 | xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)],
|
6893 | _xDomain2 = _slicedToArray(xDomain, 2),
|
6894 | firstX = _xDomain2[0],
|
6895 | lastX = _xDomain2[1],
|
6896 | padding = $$.getXDomainPadding(xDomain),
|
6897 | min = 0,
|
6898 | max = 0;
|
6899 |
|
6900 | return firstX - lastX !== 0 || $$.isCategorized() || ($$.isTimeSeries() ? (firstX = new Date(firstX.getTime() * .5), lastX = new Date(lastX.getTime() * 1.5)) : (firstX = firstX === 0 ? 1 : firstX * .5, lastX = lastX === 0 ? -1 : lastX * 1.5)), (firstX || firstX === 0) && (min = $$.isTimeSeries() ? new Date(firstX.getTime() - padding.left) : firstX - padding.left), (lastX || lastX === 0) && (max = $$.isTimeSeries() ? new Date(lastX.getTime() + padding.right) : lastX + padding.right), [min, max];
|
6901 | },
|
6902 | updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
|
6903 | var $$ = this,
|
6904 | config = $$.config,
|
6905 | zoomEnabled = config.zoom_enabled;
|
6906 |
|
6907 | if (withUpdateOrgXDomain && ($$.x.domain(domain || sortValue($$.getXDomain(targets))), $$.orgXDomain = $$.x.domain(), zoomEnabled && $$.zoom.updateScaleExtent(), $$.subX.domain($$.x.domain()), $$.brush && $$.brush.scale($$.subX)), withUpdateXDomain) {
|
6908 | var domainValue = domain || !$$.brush || brushEmpty($$) ? $$.orgXDomain : getBrushSelection($$).map($$.subX.invert);
|
6909 | $$.x.domain(domainValue), zoomEnabled && $$.zoom.updateScaleExtent();
|
6910 | }
|
6911 |
|
6912 |
|
6913 | return withTrim && $$.x.domain($$.trimXDomain($$.x.orgDomain())), $$.x.domain();
|
6914 | },
|
6915 | trimXDomain: function trimXDomain(domain) {
|
6916 | var zoomDomain = this.getZoomDomain(),
|
6917 | _zoomDomain = _slicedToArray(zoomDomain, 2),
|
6918 | min = _zoomDomain[0],
|
6919 | max = _zoomDomain[1];
|
6920 |
|
6921 | 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;
|
6922 | }
|
6923 | });
|
6924 |
|
6925 |
|
6926 |
|
6927 |
|
6928 |
|
6929 |
|
6930 |
|
6931 |
|
6932 |
|
6933 |
|
6934 | extend(ChartInternal_ChartInternal.prototype, {
|
6935 | isX: function isX(key) {
|
6936 | var $$ = this,
|
6937 | config = $$.config,
|
6938 | dataKey = config.data_x && key === config.data_x,
|
6939 | existValue = notEmpty(config.data_xs) && util_hasValue(config.data_xs, key);
|
6940 | return dataKey || existValue;
|
6941 | },
|
6942 | isNotX: function isNotX(key) {
|
6943 | return !this.isX(key);
|
6944 | },
|
6945 | isStackNormalized: function isStackNormalized() {
|
6946 | var config = this.config;
|
6947 | return config.data_stack_normalize && config.data_groups.length;
|
6948 | },
|
6949 | isGrouped: function isGrouped(id) {
|
6950 | return this.config.data_groups.map(function (v) {
|
6951 | return v.indexOf(id) >= 0;
|
6952 | })[0];
|
6953 | },
|
6954 | getXKey: function getXKey(id) {
|
6955 | var $$ = this,
|
6956 | config = $$.config;
|
6957 | return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;
|
6958 | },
|
6959 | getXValuesOfXKey: function getXValuesOfXKey(key, targets) {
|
6960 | var xValues,
|
6961 | $$ = this,
|
6962 | ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [];
|
6963 | return ids.forEach(function (id) {
|
6964 | $$.getXKey(id) === key && (xValues = $$.data.xs[id]);
|
6965 | }), xValues;
|
6966 | },
|
6967 |
|
6968 | |
6969 |
|
6970 |
|
6971 |
|
6972 |
|
6973 |
|
6974 |
|
6975 | getIndexByX: function getIndexByX(x, basedX) {
|
6976 | var $$ = this;
|
6977 | return basedX ? basedX.indexOf(isString(x) ? x : +x) : ($$.filterByX($$.data.targets, x)[0] || {
|
6978 | index: null
|
6979 | }).index;
|
6980 | },
|
6981 | getXValue: function getXValue(id, i) {
|
6982 | var $$ = this;
|
6983 | return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;
|
6984 | },
|
6985 | getOtherTargetXs: function getOtherTargetXs() {
|
6986 | var $$ = this,
|
6987 | idsForX = Object.keys($$.data.xs);
|
6988 | return idsForX.length ? $$.data.xs[idsForX[0]] : null;
|
6989 | },
|
6990 | getOtherTargetX: function getOtherTargetX(index) {
|
6991 | var xs = this.getOtherTargetXs();
|
6992 | return xs && index < xs.length ? xs[index] : null;
|
6993 | },
|
6994 | addXs: function addXs(xs) {
|
6995 | var $$ = this;
|
6996 | Object.keys(xs).forEach(function (id) {
|
6997 | $$.config.data_xs[id] = xs[id];
|
6998 | });
|
6999 | },
|
7000 | isMultipleX: function isMultipleX() {
|
7001 | return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType("bubble") || this.hasType("scatter");
|
7002 | },
|
7003 | addName: function addName(data) {
|
7004 | var name,
|
7005 | $$ = this;
|
7006 | return data && (name = $$.config.data_names[data.id], data.name = name === undefined ? data.id : name), data;
|
7007 | },
|
7008 | getAllValuesOnIndex: function getAllValuesOnIndex(index) {
|
7009 | var $$ = this;
|
7010 | return $$.filterTargetsToShow($$.data.targets).map(function (t) {
|
7011 | return $$.addName($$.getValueOnIndex(t.values, index));
|
7012 | });
|
7013 | },
|
7014 | getValueOnIndex: function getValueOnIndex(values, index) {
|
7015 | var valueOnIndex = values.filter(function (v) {
|
7016 | return v.index === index;
|
7017 | });
|
7018 | return valueOnIndex.length ? valueOnIndex[0] : null;
|
7019 | },
|
7020 | updateTargetX: function updateTargetX(targets, x) {
|
7021 | var $$ = this;
|
7022 | targets.forEach(function (t) {
|
7023 | t.values.forEach(function (v, i) {
|
7024 | v.x = $$.generateTargetX(x[i], t.id, i);
|
7025 | }), $$.data.xs[t.id] = x;
|
7026 | });
|
7027 | },
|
7028 | updateTargetXs: function updateTargetXs(targets, xs) {
|
7029 | var $$ = this;
|
7030 | targets.forEach(function (t) {
|
7031 | xs[t.id] && $$.updateTargetX([t], xs[t.id]);
|
7032 | });
|
7033 | },
|
7034 | generateTargetX: function generateTargetX(rawX, id, index) {
|
7035 | var $$ = this,
|
7036 | x = $$.isCategorized() ? index : rawX || index;
|
7037 | return $$.isTimeSeries() ? x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)) : $$.isCustomX() && !$$.isCategorized() && (x = isValue(rawX) ? +rawX : $$.getXValue(id, index)), x;
|
7038 | },
|
7039 | cloneTarget: function cloneTarget(target) {
|
7040 | return {
|
7041 | id: target.id,
|
7042 | id_org: target.id_org,
|
7043 | values: target.values.map(function (d) {
|
7044 | return {
|
7045 | x: d.x,
|
7046 | value: d.value,
|
7047 | id: d.id
|
7048 | };
|
7049 | })
|
7050 | };
|
7051 | },
|
7052 | updateXs: function updateXs(values) {
|
7053 | values.length && (this.xs = values.map(function (v) {
|
7054 | return v.x;
|
7055 | }));
|
7056 | },
|
7057 | getPrevX: function getPrevX(i) {
|
7058 | var x = this.xs[i - 1];
|
7059 | return isDefined(x) ? x : null;
|
7060 | },
|
7061 | getNextX: function getNextX(i) {
|
7062 | var x = this.xs[i + 1];
|
7063 | return isDefined(x) ? x : null;
|
7064 | },
|
7065 |
|
7066 | |
7067 |
|
7068 |
|
7069 |
|
7070 |
|
7071 |
|
7072 | getBaseValue: function getBaseValue(data) {
|
7073 | var $$ = this,
|
7074 | value = data.value;
|
7075 | return value && ($$.isAreaRangeType(data) ? value = $$.getAreaRangeData(data, "mid") : $$.isBubbleZType(data) && (value = $$.getBubbleZData(value, "y"))), value;
|
7076 | },
|
7077 |
|
7078 | |
7079 |
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 | getMinMaxValue: function getMinMaxValue(data) {
|
7085 | var min,
|
7086 | max,
|
7087 | getBaseValue = this.getBaseValue.bind(this);
|
7088 | return (data || this.data.targets.map(function (t) {
|
7089 | return t.values;
|
7090 | })).forEach(function (v, i) {
|
7091 | var value = v.map(getBaseValue).filter(isNumber);
|
7092 | min = Math.min.apply(Math, [i ? min : Infinity].concat(_toConsumableArray(value))), max = Math.max.apply(Math, [i ? max : -Infinity].concat(_toConsumableArray(value)));
|
7093 | }), {
|
7094 | min: min,
|
7095 | max: max
|
7096 | };
|
7097 | },
|
7098 |
|
7099 | |
7100 |
|
7101 |
|
7102 |
|
7103 |
|
7104 | getMinMaxData: function getMinMaxData() {
|
7105 | var $$ = this,
|
7106 | cacheKey = "$minMaxData",
|
7107 | minMaxData = $$.getCache(cacheKey);
|
7108 |
|
7109 | if (!minMaxData) {
|
7110 | var data = $$.data.targets.map(function (t) {
|
7111 | return t.values;
|
7112 | }),
|
7113 | minMax = $$.getMinMaxValue(data),
|
7114 | min = [],
|
7115 | max = [];
|
7116 |
|
7117 | data.forEach(function (v) {
|
7118 | var minData = $$.getFilteredDataByValue(v, minMax.min),
|
7119 | maxData = $$.getFilteredDataByValue(v, minMax.max);
|
7120 | minData.length && (min = min.concat(minData)), maxData.length && (max = max.concat(maxData));
|
7121 | }), $$.addCache(cacheKey, minMaxData = {
|
7122 | min: min,
|
7123 | max: max
|
7124 | });
|
7125 | }
|
7126 |
|
7127 | return minMaxData;
|
7128 | },
|
7129 |
|
7130 | |
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 | getTotalPerIndex: function getTotalPerIndex() {
|
7136 | var $$ = this,
|
7137 | sum = $$.getCache("$totalPerIndex");
|
7138 | return $$.isStackNormalized() && !sum && (sum = [], $$.data.targets.forEach(function (row) {
|
7139 | row.values.forEach(function (v, i) {
|
7140 | sum[i] || (sum[i] = 0), sum[i] += isNumber(v.value) ? v.value : 0;
|
7141 | });
|
7142 | })), sum;
|
7143 | },
|
7144 |
|
7145 | |
7146 |
|
7147 |
|
7148 |
|
7149 |
|
7150 | getTotalDataSum: function getTotalDataSum() {
|
7151 | var $$ = this,
|
7152 | cacheKey = "$totalDataSum",
|
7153 | totalDataSum = $$.getCache(cacheKey);
|
7154 |
|
7155 | if (!totalDataSum) {
|
7156 | var total = mergeArray($$.data.targets.map(function (t) {
|
7157 | return t.values;
|
7158 | })).map(function (v) {
|
7159 | return v.value;
|
7160 | }).reduce(function (p, c) {
|
7161 | return p + c;
|
7162 | });
|
7163 | $$.addCache(cacheKey, totalDataSum = total);
|
7164 | }
|
7165 |
|
7166 | return totalDataSum;
|
7167 | },
|
7168 |
|
7169 | |
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 | getFilteredDataByValue: function getFilteredDataByValue(data, value) {
|
7177 | var _this = this;
|
7178 |
|
7179 | return data.filter(function (t) {
|
7180 | return _this.getBaseValue(t) === value;
|
7181 | });
|
7182 | },
|
7183 |
|
7184 | |
7185 |
|
7186 |
|
7187 |
|
7188 |
|
7189 | getMaxDataCount: function getMaxDataCount() {
|
7190 | return Math.max.apply(Math, _toConsumableArray(this.data.targets.map(function (t) {
|
7191 | return t.values.length;
|
7192 | })));
|
7193 | },
|
7194 | getMaxDataCountTarget: function getMaxDataCountTarget() {
|
7195 | var target = this.filterTargetsToShow() || [],
|
7196 | length = target.length;
|
7197 | return length > 1 ? (target = target.map(function (t) {
|
7198 | return t.values;
|
7199 | }).reduce(function (a, b) {
|
7200 | return a.concat(b);
|
7201 | }).map(function (v) {
|
7202 | return v.x;
|
7203 | }), target = sortValue(getUnique(target)).map(function (x, index) {
|
7204 | return {
|
7205 | x: x,
|
7206 | index: index
|
7207 | };
|
7208 | })) : length && (target = target[0].values), target;
|
7209 | },
|
7210 | mapToIds: function mapToIds(targets) {
|
7211 | return targets.map(function (d) {
|
7212 | return d.id;
|
7213 | });
|
7214 | },
|
7215 | mapToTargetIds: function mapToTargetIds(ids) {
|
7216 | var $$ = this;
|
7217 | return ids ? isArray(ids) ? ids.concat() : [ids] : $$.mapToIds($$.data.targets);
|
7218 | },
|
7219 | hasTarget: function hasTarget(targets, id) {
|
7220 | var ids = this.mapToIds(targets);
|
7221 |
|
7222 | for (var val, i = 0; val = ids[i]; i++) if (val === id) return !0;
|
7223 |
|
7224 | return !1;
|
7225 | },
|
7226 | isTargetToShow: function isTargetToShow(targetId) {
|
7227 | return this.hiddenTargetIds.indexOf(targetId) < 0;
|
7228 | },
|
7229 | isLegendToShow: function isLegendToShow(targetId) {
|
7230 | return this.hiddenLegendIds.indexOf(targetId) < 0;
|
7231 | },
|
7232 | filterTargetsToShow: function filterTargetsToShow(targets) {
|
7233 | var $$ = this;
|
7234 | return (targets || $$.data.targets).filter(function (t) {
|
7235 | return $$.isTargetToShow(t.id);
|
7236 | });
|
7237 | },
|
7238 | mapTargetsToUniqueXs: function mapTargetsToUniqueXs(targets) {
|
7239 | var $$ = this,
|
7240 | xs = [];
|
7241 | return targets && targets.length && (xs = getUnique(mergeArray(targets.map(function (t) {
|
7242 | return t.values.map(function (v) {
|
7243 | return +v.x;
|
7244 | });
|
7245 | }))), xs = $$.isTimeSeries() ? xs.map(function (x) {
|
7246 | return new Date(+x);
|
7247 | }) : xs.map(function (x) {
|
7248 | return +x;
|
7249 | })), sortValue(xs);
|
7250 | },
|
7251 | addHiddenTargetIds: function addHiddenTargetIds(targetIds) {
|
7252 | this.hiddenTargetIds = this.hiddenTargetIds.concat(targetIds);
|
7253 | },
|
7254 | removeHiddenTargetIds: function removeHiddenTargetIds(targetIds) {
|
7255 | this.hiddenTargetIds = this.hiddenTargetIds.filter(function (id) {
|
7256 | return targetIds.indexOf(id) < 0;
|
7257 | });
|
7258 | },
|
7259 | addHiddenLegendIds: function addHiddenLegendIds(targetIds) {
|
7260 | this.hiddenLegendIds = this.hiddenLegendIds.concat(targetIds);
|
7261 | },
|
7262 | removeHiddenLegendIds: function removeHiddenLegendIds(targetIds) {
|
7263 | this.hiddenLegendIds = this.hiddenLegendIds.filter(function (id) {
|
7264 | return targetIds.indexOf(id) < 0;
|
7265 | });
|
7266 | },
|
7267 | getValuesAsIdKeyed: function getValuesAsIdKeyed(targets) {
|
7268 | var $$ = this,
|
7269 | ys = {},
|
7270 | isMultipleX = $$.isMultipleX(),
|
7271 | xs = isMultipleX ? $$.mapTargetsToUniqueXs(targets).map(function (v) {
|
7272 | return isString(v) ? v : +v;
|
7273 | }) : null;
|
7274 | return targets.forEach(function (t) {
|
7275 | var data = [];
|
7276 | t.values.forEach(function (v) {
|
7277 | var value = v.value;
|
7278 | isArray(value) ? data.push.apply(data, _toConsumableArray(value)) : isObject(value) && "high" in value ? data.push.apply(data, _toConsumableArray(Object.values(value))) : $$.isBubbleZType(v) ? data.push($$.getBubbleZData(value, "y")) : isMultipleX ? data[$$.getIndexByX(v.x, xs)] = value : data.push(value);
|
7279 | }), ys[t.id] = data;
|
7280 | }), ys;
|
7281 | },
|
7282 | checkValueInTargets: function checkValueInTargets(targets, checker) {
|
7283 | var values,
|
7284 | ids = Object.keys(targets);
|
7285 |
|
7286 | for (var i = 0; i < ids.length; i++) {
|
7287 | values = targets[ids[i]].values;
|
7288 |
|
7289 | for (var j = 0; j < values.length; j++) if (checker(values[j].value)) return !0;
|
7290 | }
|
7291 |
|
7292 | return !1;
|
7293 | },
|
7294 | hasMultiTargets: function hasMultiTargets() {
|
7295 | return this.filterTargetsToShow().length > 1;
|
7296 | },
|
7297 | hasNegativeValueInTargets: function hasNegativeValueInTargets(targets) {
|
7298 | return this.checkValueInTargets(targets, function (v) {
|
7299 | return v < 0;
|
7300 | });
|
7301 | },
|
7302 | hasPositiveValueInTargets: function hasPositiveValueInTargets(targets) {
|
7303 | return this.checkValueInTargets(targets, function (v) {
|
7304 | return v > 0;
|
7305 | });
|
7306 | },
|
7307 | _checkOrder: function _checkOrder(type) {
|
7308 | var config = this.config,
|
7309 | order = config.data_order;
|
7310 | return isString(order) && order.toLowerCase() === type;
|
7311 | },
|
7312 | isOrderDesc: function isOrderDesc() {
|
7313 | return this._checkOrder("desc");
|
7314 | },
|
7315 | isOrderAsc: function isOrderAsc() {
|
7316 | return this._checkOrder("asc");
|
7317 | },
|
7318 |
|
7319 | |
7320 |
|
7321 |
|
7322 |
|
7323 |
|
7324 |
|
7325 | orderTargets: function orderTargets(targetsValue) {
|
7326 | var $$ = this,
|
7327 | config = $$.config,
|
7328 | targets = _toConsumableArray(targetsValue),
|
7329 | orderAsc = $$.isOrderAsc(),
|
7330 | orderDesc = $$.isOrderDesc();
|
7331 |
|
7332 |
|
7333 | return orderAsc || orderDesc ? targets.sort(function (t1, t2) {
|
7334 | var reducer = function (p, c) {
|
7335 | return p + Math.abs(c.value);
|
7336 | },
|
7337 | t1Sum = t1.values.reduce(reducer, 0),
|
7338 | t2Sum = t2.values.reduce(reducer, 0);
|
7339 |
|
7340 | return orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
7341 | }) : isFunction(config.data_order) && targets.sort(config.data_order), targets;
|
7342 | },
|
7343 | filterByX: function filterByX(targets, x) {
|
7344 | return mergeArray(targets.map(function (t) {
|
7345 | return t.values;
|
7346 | })).filter(function (v) {
|
7347 | return v.x - x === 0;
|
7348 | });
|
7349 | },
|
7350 | filterRemoveNull: function filterRemoveNull(data) {
|
7351 | var _this2 = this;
|
7352 |
|
7353 | return data.filter(function (d) {
|
7354 | return isValue(_this2.getBaseValue(d));
|
7355 | });
|
7356 | },
|
7357 | filterByXDomain: function filterByXDomain(targets, xDomain) {
|
7358 | return targets.map(function (t) {
|
7359 | return {
|
7360 | id: t.id,
|
7361 | id_org: t.id_org,
|
7362 | values: t.values.filter(function (v) {
|
7363 | return xDomain[0] <= v.x && v.x <= xDomain[1];
|
7364 | })
|
7365 | };
|
7366 | });
|
7367 | },
|
7368 | hasDataLabel: function hasDataLabel() {
|
7369 | var dataLabels = this.config.data_labels;
|
7370 | return isBoolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels);
|
7371 | },
|
7372 | getDataLabelLength: function getDataLabelLength(min, max, key) {
|
7373 | var $$ = this,
|
7374 | lengths = [0, 0];
|
7375 | return $$.selectChart.select("svg").selectAll(".dummy").data([min, max]).enter().append("text").text(function (d) {
|
7376 | return $$.dataLabelFormat(d.id)(d);
|
7377 | }).each(function (d, i) {
|
7378 | lengths[i] = this.getBoundingClientRect()[key] * 1.3;
|
7379 | }).remove(), lengths;
|
7380 | },
|
7381 | isNoneArc: function isNoneArc(d) {
|
7382 | return this.hasTarget(this.data.targets, d.id);
|
7383 | },
|
7384 | isArc: function isArc(d) {
|
7385 | return "data" in d && this.hasTarget(this.data.targets, d.data.id);
|
7386 | },
|
7387 | findSameXOfValues: function findSameXOfValues(values, index) {
|
7388 | var i,
|
7389 | targetX = values[index].x,
|
7390 | sames = [];
|
7391 |
|
7392 | for (i = index - 1; i >= 0 && !(targetX !== values[i].x); i--) sames.push(values[i]);
|
7393 |
|
7394 | for (i = index; i < values.length && !(targetX !== values[i].x); i++) sames.push(values[i]);
|
7395 |
|
7396 | return sames;
|
7397 | },
|
7398 | findClosestFromTargets: function findClosestFromTargets(targets, pos) {
|
7399 | var $$ = this,
|
7400 | candidates = targets.map(function (target) {
|
7401 | return $$.findClosest(target.values, pos);
|
7402 | });
|
7403 |
|
7404 |
|
7405 | return $$.findClosest(candidates, pos);
|
7406 | },
|
7407 | findClosest: function findClosest(values, pos) {
|
7408 | var closest,
|
7409 | $$ = this,
|
7410 | data = values.filter(function (v) {
|
7411 | return v && isValue(v.value);
|
7412 | }),
|
7413 | minDist = $$.config.point_sensitivity;
|
7414 | return data.filter(function (v) {
|
7415 | return $$.isBarType(v.id);
|
7416 | }).forEach(function (v) {
|
7417 | var shape = $$.main.select(".".concat(config_classes.bars).concat($$.getTargetSelectorSuffix(v.id), " .").concat(config_classes.bar, "-").concat(v.index)).node();
|
7418 | !closest && $$.isWithinBar(shape) && (closest = v);
|
7419 | }), data.filter(function (v) {
|
7420 | return !$$.isBarType(v.id);
|
7421 | }).forEach(function (v) {
|
7422 | var d = $$.dist(v, pos);
|
7423 | d < minDist && (minDist = d, closest = v);
|
7424 | }), closest;
|
7425 | },
|
7426 | dist: function dist(data, pos) {
|
7427 | var $$ = this,
|
7428 | isRotated = $$.config.axis_rotated,
|
7429 | xIndex = isRotated ? 1 : 0,
|
7430 | yIndex = isRotated ? 0 : 1,
|
7431 | y = $$.circleY(data, data.index),
|
7432 | x = ($$.zoomScale || $$.x)(data.x);
|
7433 | return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));
|
7434 | },
|
7435 |
|
7436 | |
7437 |
|
7438 |
|
7439 |
|
7440 |
|
7441 |
|
7442 | convertValuesToStep: function convertValuesToStep(values) {
|
7443 | var $$ = this,
|
7444 | config = $$.config,
|
7445 | isRotated = config.axis_rotated,
|
7446 | stepType = config.line_step_type,
|
7447 | isCategorized = $$.isCategorized(),
|
7448 | converted = isArray(values) ? values.concat() : [values];
|
7449 | if (!isRotated && !isCategorized) return values;
|
7450 |
|
7451 | var id = converted[0].id,
|
7452 | x = converted[0].x - 1,
|
7453 | value = converted[0].value;
|
7454 |
|
7455 | return isCategorized && converted.unshift({
|
7456 | x: x,
|
7457 | value: value,
|
7458 | id: id
|
7459 | }), stepType === "step-after" && converted.unshift({
|
7460 | x: x - 1,
|
7461 | value: value,
|
7462 | id: id
|
7463 | }), x = converted.length, value = converted[x - 1].value, isCategorized && converted.push({
|
7464 | x: x,
|
7465 | value: value,
|
7466 | id: id
|
7467 | }), stepType === "step-before" && converted.push({
|
7468 | x: x + 1,
|
7469 | value: value,
|
7470 | id: id
|
7471 | }), converted;
|
7472 | },
|
7473 | convertValuesToRange: function convertValuesToRange(values) {
|
7474 | var converted = isArray(values) ? values.concat() : [values],
|
7475 | ranges = [];
|
7476 | return converted.forEach(function (range) {
|
7477 | var x = range.x,
|
7478 | id = range.id;
|
7479 | ranges.push({
|
7480 | x: x,
|
7481 | id: id,
|
7482 | value: range.value[0]
|
7483 | }), ranges.push({
|
7484 | x: x,
|
7485 | id: id,
|
7486 | value: range.value[2]
|
7487 | });
|
7488 | }), ranges;
|
7489 | },
|
7490 | updateDataAttributes: function updateDataAttributes(name, attrs) {
|
7491 | var $$ = this,
|
7492 | config = $$.config,
|
7493 | current = config["data_".concat(name)];
|
7494 | return isUndefined(attrs) ? current : (Object.keys(attrs).forEach(function (id) {
|
7495 | current[id] = attrs[id];
|
7496 | }), $$.redraw({
|
7497 | withLegend: !0
|
7498 | }), current);
|
7499 | },
|
7500 | getAreaRangeData: function getAreaRangeData(d, type) {
|
7501 | var value = d.value;
|
7502 |
|
7503 | if (isArray(value)) {
|
7504 | var index = ["high", "mid", "low"].indexOf(type);
|
7505 | return index === -1 ? null : value[index];
|
7506 | }
|
7507 |
|
7508 | return value[type];
|
7509 | },
|
7510 |
|
7511 | |
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 |
|
7518 |
|
7519 | getRatio: function getRatio(type, d, asPercent) {
|
7520 | var $$ = this,
|
7521 | config = $$.config,
|
7522 | api = $$.api,
|
7523 | ratio = 0;
|
7524 |
|
7525 | if (d && api.data.shown.call(api).length) {
|
7526 | var dataValues = api.data.values.bind(api);
|
7527 | if (ratio = d.ratio || d.value, type === "arc") {
|
7528 |
|
7529 | if ($$.pie.padAngle()()) {
|
7530 | var total = $$.getTotalDataSum();
|
7531 | $$.hiddenTargetIds.length && (total -= dataValues($$.hiddenTargetIds).reduce(function (p, c) {
|
7532 | return p + c;
|
7533 | })), ratio = d.value / total;
|
7534 | } else ratio = (d.endAngle - d.startAngle) / (Math.PI * ($$.hasType("gauge") && !config.gauge_fullCircle ? 1 : 2));
|
7535 | } else if (type === "index") {
|
7536 | var _total = this.getTotalPerIndex();
|
7537 |
|
7538 | if ($$.hiddenTargetIds.length) {
|
7539 | var hiddenSum = dataValues($$.hiddenTargetIds, !1);
|
7540 | hiddenSum.length && (hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
7541 | return acc.map(function (v, i) {
|
7542 | return (isNumber(v) ? v : 0) + curr[i];
|
7543 | });
|
7544 | }), _total = _total.map(function (v, i) {
|
7545 | return v - hiddenSum[i];
|
7546 | }));
|
7547 | }
|
7548 |
|
7549 | d.ratio = isNumber(d.value) && _total && _total[d.index] > 0 ? d.value / _total[d.index] : 0, ratio = d.ratio;
|
7550 | } else type === "radar" && (ratio = parseFloat(Math.max(d.value, 0)) / $$.maxValue * config.radar_size_ratio);
|
7551 | }
|
7552 |
|
7553 | return asPercent && ratio ? ratio * 100 : ratio;
|
7554 | },
|
7555 |
|
7556 | |
7557 |
|
7558 |
|
7559 |
|
7560 |
|
7561 | updateDataIndexByX: function updateDataIndexByX(tickValues) {
|
7562 | var $$ = this,
|
7563 | tickValueMap = tickValues.reduce(function (out, tick, index) {
|
7564 | return out[+tick.x] = index, out;
|
7565 | }, {});
|
7566 | $$.data.targets.forEach(function (t) {
|
7567 | t.values.forEach(function (value, valueIndex) {
|
7568 | var index = tickValueMap[+value.x];
|
7569 | index === undefined && (index = valueIndex), value.index = index;
|
7570 | });
|
7571 | });
|
7572 | }
|
7573 | });
|
7574 |
|
7575 | var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(8);
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 |
|
7583 |
|
7584 |
|
7585 |
|
7586 |
|
7587 |
|
7588 |
|
7589 |
|
7590 |
|
7591 |
|
7592 |
|
7593 | var convertCsvTsvToData = function (parser, xsv) {
|
7594 | var d,
|
7595 | rows = parser.rows(xsv);
|
7596 | return rows.length === 1 ? (d = [{}], rows[0].forEach(function (id) {
|
7597 | d[0][id] = null;
|
7598 | })) : d = parser.parse(xsv), d;
|
7599 | };
|
7600 |
|
7601 | extend(ChartInternal_ChartInternal.prototype, {
|
7602 | |
7603 |
|
7604 |
|
7605 |
|
7606 |
|
7607 |
|
7608 |
|
7609 | convertData: function convertData(args, callback) {
|
7610 | var data,
|
7611 | $$ = this;
|
7612 | if (args.bindto ? (data = {}, ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) {
|
7613 | var key = "data_".concat(v);
|
7614 | key in args && (data[v] = args[key]);
|
7615 | })) : data = args, data.url && callback) $$.convertUrlToData(data.url, data.mimeType, data.headers, data.keys, callback);else if (data.json) data = $$.convertJsonToData(data.json, data.keys);else if (data.rows) data = $$.convertRowsToData(data.rows);else if (data.columns) data = $$.convertColumnsToData(data.columns);else if (args.bindto) throw Error("url or json or rows or columns is required.");
|
7616 | return isArray(data) && data;
|
7617 | },
|
7618 |
|
7619 | |
7620 |
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 | convertUrlToData: function convertUrlToData(url) {
|
7629 | var _this = this,
|
7630 | mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "csv",
|
7631 | headers = arguments.length > 2 ? arguments[2] : undefined,
|
7632 | keys = arguments.length > 3 ? arguments[3] : undefined,
|
7633 | done = arguments.length > 4 ? arguments[4] : undefined,
|
7634 | req = new XMLHttpRequest();
|
7635 |
|
7636 | req.open("GET", url), headers && Object.keys(headers).forEach(function (key) {
|
7637 | req.setRequestHeader(key, headers[key]);
|
7638 | }), req.onreadystatechange = function () {
|
7639 | if (req.readyState === 4) if (req.status === 200) {
|
7640 | var response = req.responseText;
|
7641 | response && done.call(_this, _this["convert".concat(capitalize(mimeType), "ToData")](mimeType === "json" ? JSON.parse(response) : response, keys));
|
7642 | } else throw new Error("".concat(url, ": Something went wrong loading!"));
|
7643 | }, req.send();
|
7644 | },
|
7645 | convertCsvToData: function convertCsvToData(xsv) {
|
7646 | return convertCsvTsvToData({
|
7647 | rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["csvParseRows"],
|
7648 | parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["csvParse"]
|
7649 | }, xsv);
|
7650 | },
|
7651 | convertTsvToData: function convertTsvToData(tsv) {
|
7652 | return convertCsvTsvToData({
|
7653 | rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["tsvParseRows"],
|
7654 | parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_["tsvParse"]
|
7655 | }, tsv);
|
7656 | },
|
7657 | convertJsonToData: function convertJsonToData(json, keysParam) {
|
7658 | var targetKeys,
|
7659 | data,
|
7660 | _this2 = this,
|
7661 | config = this.config,
|
7662 | newRows = [];
|
7663 |
|
7664 | if (isArray(json)) {
|
7665 | var keys = keysParam || config.data_keys;
|
7666 | keys.x ? (targetKeys = keys.value.concat(keys.x), config.data_x = keys.x) : targetKeys = keys.value, newRows.push(targetKeys), json.forEach(function (o) {
|
7667 | var newRow = targetKeys.map(function (key) {
|
7668 |
|
7669 | var v = _this2.findValueInJson(o, key);
|
7670 |
|
7671 | return isUndefined(v) && (v = null), v;
|
7672 | });
|
7673 | newRows.push(newRow);
|
7674 | }), data = this.convertRowsToData(newRows);
|
7675 | } else Object.keys(json).forEach(function (key) {
|
7676 | var tmp = json[key].concat();
|
7677 | tmp.unshift(key), newRows.push(tmp);
|
7678 | }), data = this.convertColumnsToData(newRows);
|
7679 |
|
7680 | return data;
|
7681 | },
|
7682 | findValueInJson: function findValueInJson(object, path) {
|
7683 | if (object[path] !== undefined) return object[path];
|
7684 | var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"),
|
7685 | pathArray = convertedPath.replace(/^\./, "").split("."),
|
7686 | target = object;
|
7687 |
|
7688 | return pathArray.some(function (k) {
|
7689 | return !(target = target && k in target ? target[k] : undefined);
|
7690 | }), target;
|
7691 | },
|
7692 | convertRowsToData: function convertRowsToData(rows) {
|
7693 | var keys = rows[0],
|
7694 | newRows = [];
|
7695 | return rows.forEach(function (row, i) {
|
7696 | if (i > 0) {
|
7697 | var newRow = {};
|
7698 | row.forEach(function (v, j) {
|
7699 | if (isUndefined(v)) throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!"));
|
7700 | newRow[keys[j]] = v;
|
7701 | }), newRows.push(newRow);
|
7702 | }
|
7703 | }), newRows;
|
7704 | },
|
7705 | convertColumnsToData: function convertColumnsToData(columns) {
|
7706 | var newRows = [];
|
7707 | return columns.forEach(function (col, i) {
|
7708 | var key = col[0];
|
7709 | col.forEach(function (v, j) {
|
7710 | if (j > 0) {
|
7711 | if (isUndefined(newRows[j - 1]) && (newRows[j - 1] = {}), isUndefined(v)) throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!"));
|
7712 | newRows[j - 1][key] = v;
|
7713 | }
|
7714 | });
|
7715 | }), newRows;
|
7716 | },
|
7717 | convertDataToTargets: function convertDataToTargets(data, appendXs) {
|
7718 | var xsData,
|
7719 | _this3 = this,
|
7720 | $$ = this,
|
7721 | config = $$.config,
|
7722 | isTimeSeries = $$.isTimeSeries(),
|
7723 | dataKeys = Object.keys(data[0] || {}),
|
7724 | ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [],
|
7725 | xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : [];
|
7726 |
|
7727 | ids.forEach(function (id) {
|
7728 | var xKey = _this3.getXKey(id);
|
7729 |
|
7730 | _this3.isCustomX() || isTimeSeries ? xs.indexOf(xKey) >= 0 ? xsData = (appendXs && $$.data.xs[id] || []).concat(data.map(function (d) {
|
7731 | return d[xKey];
|
7732 | }).filter(isValue).map(function (rawX, i) {
|
7733 | return $$.generateTargetX(rawX, id, i);
|
7734 | })) : config.data_x ? xsData = _this3.getOtherTargetXs() : notEmpty(config.data_xs) && (xsData = $$.getXValuesOfXKey(xKey, $$.data.targets)) : xsData = data.map(function (d, i) {
|
7735 | return i;
|
7736 | }), xsData && (_this3.data.xs[id] = xsData);
|
7737 | }), ids.forEach(function (id) {
|
7738 | if (!_this3.data.xs[id]) throw new Error("x is not defined for id = \"".concat(id, "\"."));
|
7739 | });
|
7740 |
|
7741 | var targets = ids.map(function (id, index) {
|
7742 | var convertedId = config.data_idConverter(id),
|
7743 | xKey = $$.getXKey(id),
|
7744 | isCategorized = $$.isCustomX() && $$.isCategorized(),
|
7745 | hasCategory = isCategorized && data.map(function (v) {
|
7746 | return v.x;
|
7747 | }).every(function (v) {
|
7748 | return config.axis_x_categories.indexOf(v) > -1;
|
7749 | });
|
7750 | return {
|
7751 | id: convertedId,
|
7752 | id_org: id,
|
7753 | values: data.map(function (d, i) {
|
7754 | var x,
|
7755 | rawX = d[xKey],
|
7756 | value = d[id];
|
7757 | return value = value === null || isNaN(value) || isObject(value) ? isArray(value) || isObject(value) ? value : null : +value, isCategorized && index === 0 && !isUndefined(rawX) ? (!hasCategory && index === 0 && i === 0 && (config.axis_x_categories = []), x = config.axis_x_categories.indexOf(rawX), x === -1 && (x = config.axis_x_categories.length, config.axis_x_categories.push(rawX))) : x = $$.generateTargetX(rawX, id, i), (isUndefined(value) || $$.data.xs[id].length <= i) && (x = undefined), {
|
7758 | x: x,
|
7759 | value: value,
|
7760 | id: convertedId
|
7761 | };
|
7762 | }).filter(function (v) {
|
7763 | return isDefined(v.x);
|
7764 | })
|
7765 | };
|
7766 | });
|
7767 |
|
7768 | return targets.forEach(function (t) {
|
7769 | config.data_xSort && (t.values = t.values.sort(function (v1, v2) {
|
7770 | var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
|
7771 | x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
|
7772 | return x1 - x2;
|
7773 | })), t.values.forEach(function (v, i) {
|
7774 | return v.index = i;
|
7775 | }), $$.data.xs[t.id].sort(function (v1, v2) {
|
7776 | return v1 - v2;
|
7777 | });
|
7778 | }), $$.hasNegativeValue = $$.hasNegativeValueInTargets(targets), $$.hasPositiveValue = $$.hasPositiveValueInTargets(targets), config.data_type && $$.setTargetType($$.mapToIds(targets).filter(function (id) {
|
7779 | return !(id in config.data_types);
|
7780 | }), config.data_type), targets.forEach(function (d) {
|
7781 | return $$.addCache(d.id_org, d, !0);
|
7782 | }), targets;
|
7783 | }
|
7784 | });
|
7785 |
|
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 |
|
7791 |
|
7792 |
|
7793 | extend(ChartInternal_ChartInternal.prototype, {
|
7794 | load: function load(rawTargets, args) {
|
7795 | var $$ = this,
|
7796 | targets = rawTargets;
|
7797 |
|
7798 |
|
7799 | targets && (args.filter && (targets = targets.filter(args.filter)), (args.type || args.types) && targets.forEach(function (t) {
|
7800 | var type = args.types && args.types[t.id] || args.type;
|
7801 | $$.setTargetType(t.id, type);
|
7802 | }), $$.data.targets.forEach(function (d) {
|
7803 | for (var i = 0; i < targets.length; i++) if (d.id === targets[i].id) {
|
7804 | d.values = targets[i].values, targets.splice(i, 1);
|
7805 | break;
|
7806 | }
|
7807 | }), $$.data.targets = $$.data.targets.concat(targets)), $$.updateTargets($$.data.targets), $$.redraw({
|
7808 | withUpdateOrgXDomain: !0,
|
7809 | withUpdateXDomain: !0,
|
7810 | withLegend: !0
|
7811 | }), args.done && args.done();
|
7812 | },
|
7813 | loadFromArgs: function loadFromArgs(args) {
|
7814 | var $$ = this;
|
7815 |
|
7816 | if ($$.config) {
|
7817 | $$.resetCache();
|
7818 | var data = args.data || $$.convertData(args, function (d) {
|
7819 | return $$.load($$.convertDataToTargets(d), args);
|
7820 | });
|
7821 | data && $$.load($$.convertDataToTargets(data), args);
|
7822 | }
|
7823 |
|
7824 | },
|
7825 | unload: function unload(rawTargetIds, customDoneCb) {
|
7826 | var $$ = this,
|
7827 | done = customDoneCb,
|
7828 | targetIds = rawTargetIds;
|
7829 |
|
7830 | return $$.resetCache(), done || (done = function () {}), targetIds = targetIds.filter(function (id) {
|
7831 | return $$.hasTarget($$.data.targets, id);
|
7832 | }), targetIds && targetIds.length !== 0 ? void ($$.svg.selectAll(targetIds.map(function (id) {
|
7833 | return $$.selectorTarget(id);
|
7834 | })).transition().style("opacity", "0").remove().call($$.endall, done), targetIds.forEach(function (id) {
|
7835 | $$.withoutFadeIn[id] = !1, $$.legend && $$.legend.selectAll(".".concat(config_classes.legendItem).concat($$.getTargetSelectorSuffix(id))).remove(), $$.data.targets = $$.data.targets.filter(function (t) {
|
7836 | return t.id !== id;
|
7837 | });
|
7838 | })) : void done();
|
7839 | }
|
7840 | });
|
7841 |
|
7842 |
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 | extend(ChartInternal_ChartInternal.prototype, {
|
7849 | |
7850 |
|
7851 |
|
7852 |
|
7853 |
|
7854 |
|
7855 | categoryName: function categoryName(i) {
|
7856 | var config = this.config;
|
7857 | return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;
|
7858 | }
|
7859 | });
|
7860 |
|
7861 | var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack_require__(9);
|
7862 |
|
7863 |
|
7864 |
|
7865 |
|
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 | extend(ChartInternal_ChartInternal.prototype, {
|
7875 | |
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 | initEventRect: function initEventRect() {
|
7881 | var $$ = this;
|
7882 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.eventRects).style("fill-opacity", "0");
|
7883 | },
|
7884 |
|
7885 | |
7886 |
|
7887 |
|
7888 |
|
7889 | redrawEventRect: function redrawEventRect() {
|
7890 | var eventRectUpdate,
|
7891 | $$ = this,
|
7892 | config = $$.config,
|
7893 | isMultipleX = $$.isMultipleX(),
|
7894 | zoomEnabled = config.zoom_enabled,
|
7895 | eventRects = $$.main.select(".".concat(config_classes.eventRects)).style("cursor", zoomEnabled && zoomEnabled.type !== "drag" ? config.axis_rotated ? "ns-resize" : "ew-resize" : null).classed(config_classes.eventRectsMultiple, isMultipleX).classed(config_classes.eventRectsSingle, !isMultipleX);
|
7896 | if (eventRects.selectAll(".".concat(config_classes.eventRect)).remove(), $$.eventRect = eventRects.selectAll(".".concat(config_classes.eventRect)), isMultipleX) eventRectUpdate = $$.eventRect.data([0]), eventRectUpdate = $$.generateEventRectsForMultipleXs(eventRectUpdate.enter()).merge(eventRectUpdate);else {
|
7897 |
|
7898 | var xAxisTickValues = $$.getMaxDataCountTarget();
|
7899 |
|
7900 | $$.updateDataIndexByX(xAxisTickValues), $$.updateXs(xAxisTickValues), $$.updatePointClass(!0), eventRects.datum(xAxisTickValues), $$.eventRect = eventRects.selectAll(".".concat(config_classes.eventRect)), eventRectUpdate = $$.eventRect.data(function (d) {
|
7901 | return d;
|
7902 | }), eventRectUpdate.exit().remove(), eventRectUpdate = $$.generateEventRectsForSingleX(eventRectUpdate.enter()).merge(eventRectUpdate);
|
7903 | }
|
7904 | $$.eventRect = eventRectUpdate, $$.updateEventRect(eventRectUpdate), $$.inputType !== "touch" || $$.svg.on("touchstart.eventRect") || $$.hasArcType() || $$.bindTouchOnEventRect(isMultipleX);
|
7905 | },
|
7906 | bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) {
|
7907 | var startPx,
|
7908 | $$ = this,
|
7909 | config = $$.config,
|
7910 | getEventRect = function () {
|
7911 | var touch = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].changedTouches[0];
|
7912 | return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
|
7913 | },
|
7914 | getIndex = function (eventRect) {
|
7915 | var index = eventRect && eventRect.attr("class") && eventRect.attr("class").replace(new RegExp("(".concat(config_classes.eventRect, "-?|s)"), "g"), "") * 1;
|
7916 | return (isNaN(index) || index === null) && (index = -1), index;
|
7917 | },
|
7918 | selectRect = function (context) {
|
7919 | if (isMultipleX) $$.selectRectForMultipleXs(context);else {
|
7920 | var eventRect = getEventRect(),
|
7921 | index = getIndex(eventRect);
|
7922 | $$.callOverOutForTouch(index), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index);
|
7923 | }
|
7924 | },
|
7925 | preventDefault = config.interaction_inputType_touch.preventDefault,
|
7926 | isPrevented = isBoolean(preventDefault) && preventDefault || !1,
|
7927 | preventThreshold = !isNaN(preventDefault) && preventDefault || null,
|
7928 | preventEvent = function (event) {
|
7929 | var eventType = event.type,
|
7930 | touch = event.changedTouches[0],
|
7931 | currentXY = touch["client".concat(config.axis_rotated ? "Y" : "X")];
|
7932 | 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());
|
7933 | };
|
7934 |
|
7935 |
|
7936 | $$.svg.on("touchstart.eventRect touchmove.eventRect", function () {
|
7937 | var eventRect = getEventRect(),
|
7938 | event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"];
|
7939 |
|
7940 | if (!eventRect.empty() && eventRect.classed(config_classes.eventRect)) {
|
7941 |
|
7942 | if ($$.dragging || $$.flowing || $$.hasArcType() || event.touches.length > 1) return;
|
7943 | preventEvent(event), selectRect(this);
|
7944 | } else $$.unselectRect(), $$.callOverOutForTouch();
|
7945 | }, !0).on("touchend.eventRect", function () {
|
7946 | var eventRect = getEventRect();
|
7947 | !eventRect.empty() && eventRect.classed(config_classes.eventRect) && ($$.hasArcType() || !$$.toggleShape || $$.cancelClick) && $$.cancelClick && ($$.cancelClick = !1);
|
7948 | }, !0);
|
7949 | },
|
7950 |
|
7951 | |
7952 |
|
7953 |
|
7954 |
|
7955 |
|
7956 | updateEventRect: function updateEventRect(eventRectUpdate) {
|
7957 | var x,
|
7958 | y,
|
7959 | w,
|
7960 | h,
|
7961 | $$ = this,
|
7962 | config = $$.config,
|
7963 | xScale = $$.zoomScale || $$.x,
|
7964 | eventRectData = eventRectUpdate || $$.eventRect.data(),
|
7965 | isRotated = config.axis_rotated;
|
7966 | if ($$.isMultipleX())
|
7967 | x = 0, y = 0, w = $$.width, h = $$.height;else {
|
7968 | var rectW, rectX;
|
7969 | if ($$.isCategorized()) rectW = $$.getEventRectWidth(), rectX = function (d) {
|
7970 | return xScale(d.x) - rectW / 2;
|
7971 | };else {
|
7972 | var getPrevNextX = function (d) {
|
7973 | var index = d.index;
|
7974 | return {
|
7975 | prev: $$.getPrevX(index),
|
7976 | next: $$.getNextX(index)
|
7977 | };
|
7978 | };
|
7979 |
|
7980 | rectW = function (d) {
|
7981 | var x = getPrevNextX(d);
|
7982 |
|
7983 | return x.prev === null && x.next === null ? isRotated ? $$.height : $$.width : (x.prev === null && (x.prev = xScale.domain()[0]), x.next === null && (x.next = xScale.domain()[1]), Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2));
|
7984 | }, rectX = function (d) {
|
7985 | var x = getPrevNextX(d),
|
7986 | thisX = d.x;
|
7987 |
|
7988 | return x.prev === null && x.next === null ? 0 : (x.prev === null && (x.prev = xScale.domain()[0]), (xScale(thisX) + xScale(x.prev)) / 2);
|
7989 | };
|
7990 | }
|
7991 | x = isRotated ? 0 : rectX, y = isRotated ? rectX : 0, w = isRotated ? $$.width : rectW, h = isRotated ? rectW : $$.height;
|
7992 | }
|
7993 | eventRectData.attr("class", $$.classEvent.bind($$)).attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
7994 | },
|
7995 | selectRectForSingle: function selectRectForSingle(context, eventRect, index) {
|
7996 | var $$ = this,
|
7997 | config = $$.config,
|
7998 | isSelectionEnabled = config.data_selection_enabled,
|
7999 | isSelectionGrouped = config.data_selection_grouped,
|
8000 | isTooltipGrouped = config.tooltip_grouped,
|
8001 | selectedData = $$.getAllValuesOnIndex(index);
|
8002 | isTooltipGrouped && ($$.showTooltip(selectedData, context), $$.showGridFocus(selectedData), !isSelectionEnabled || isSelectionGrouped) || $$.main.selectAll(".".concat(config_classes.shape, "-").concat(index)).each(function () {
|
8003 | Object(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(), $$.hideTooltip(), !isSelectionGrouped && $$.expandCirclesBars(index));
|
8004 | }).filter(function (d) {
|
8005 | return $$.isWithinShape(this, d);
|
8006 | }).call(function (selected) {
|
8007 | var d = selected.data();
|
8008 | isSelectionEnabled && (isSelectionGrouped || config.data_selection_isselectable(d)) && eventRect.style("cursor", "pointer"), isTooltipGrouped || ($$.showTooltip(d, context), $$.showGridFocus(d), $$.unexpandCircles(), selected.each(function (d) {
|
8009 | return $$.expandCirclesBars(index, d.id);
|
8010 | }));
|
8011 | });
|
8012 | },
|
8013 | expandCirclesBars: function expandCirclesBars(index, id, reset) {
|
8014 | var $$ = this,
|
8015 | config = $$.config;
|
8016 | config.point_focus_expand_enabled && $$.expandCircles(index, id, reset), $$.expandBars(index, id, reset);
|
8017 | },
|
8018 | selectRectForMultipleXs: function selectRectForMultipleXs(context) {
|
8019 | var $$ = this,
|
8020 | config = $$.config,
|
8021 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
8022 |
|
8023 |
|
8024 | if (!($$.dragging || $$.hasArcType(targetsToShow))) {
|
8025 | var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(context),
|
8026 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
8027 | if ($$.mouseover && (!closest || closest.id !== $$.mouseover.id) && (config.data_onout.call($$.api, $$.mouseover), $$.mouseover = undefined), !closest) return void $$.unselectRect();
|
8028 | var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x),
|
8029 | selectedData = sameXData.map(function (d) {
|
8030 | return $$.addName(d);
|
8031 | });
|
8032 |
|
8033 | $$.showTooltip(selectedData, context), $$.expandCirclesBars(closest.index, closest.id, !0), $$.showGridFocus(selectedData), ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && ($$.svg.select(".".concat(config_classes.eventRect)).style("cursor", "pointer"), !$$.mouseover && (config.data_onover.call($$.api, closest), $$.mouseover = closest));
|
8034 | }
|
8035 | },
|
8036 |
|
8037 | |
8038 |
|
8039 |
|
8040 |
|
8041 | unselectRect: function unselectRect() {
|
8042 | var $$ = this;
|
8043 | $$.svg.select(".".concat(config_classes.eventRect)).style("cursor", null), $$.hideGridFocus(), $$.hideTooltip(), $$._handleLinkedCharts(!1), $$.unexpandCircles(), $$.unexpandBars();
|
8044 | },
|
8045 |
|
8046 | |
8047 |
|
8048 |
|
8049 |
|
8050 |
|
8051 |
|
8052 | setOverOut: function setOverOut(isOver, d) {
|
8053 | var $$ = this,
|
8054 | config = $$.config,
|
8055 | isArc = isObject(d);
|
8056 |
|
8057 |
|
8058 | if (isArc || d !== -1) {
|
8059 | var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
8060 | if (config.color_onover && $$.setOverColor(isOver, d, isArc), isArc) callback(d, $$.main.select(".".concat(config_classes.arc).concat($$.getTargetSelectorSuffix(d.id))).node());else if (!config.tooltip_grouped) {
|
8061 | var callee = $$.setOverOut,
|
8062 | last = callee.last || [],
|
8063 | shape = $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).filter(function (d) {
|
8064 | return $$.isWithinShape(this, d);
|
8065 | });
|
8066 | shape.each(function (d) {
|
8067 | var _this = this;
|
8068 |
|
8069 | (last.length === 0 || last.every(function (v) {
|
8070 | return v !== _this;
|
8071 | })) && (callback(d, this), last.push(this));
|
8072 | }), last.length > 0 && shape.empty() && (callback = config.data_onout.bind($$.api), last.forEach(function (v) {
|
8073 | return callback(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(v).datum(), v);
|
8074 | }), last = []), callee.last = last;
|
8075 | } else isOver && $$.expandCirclesBars(d, null, !0), $$.isMultipleX() || $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).each(function (d) {
|
8076 | callback(d, this);
|
8077 | });
|
8078 | }
|
8079 | },
|
8080 |
|
8081 | |
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 | callOverOutForTouch: function callOverOutForTouch(d) {
|
8087 | var $$ = this,
|
8088 | callee = $$.callOverOutForTouch,
|
8089 | last = callee.last;
|
8090 | (isObject(d) && last ? d.id !== last.id : d !== last) && ((last || isNumber(last)) && $$.setOverOut(!1, last), (d || isNumber(d)) && $$.setOverOut(!0, d), callee.last = d);
|
8091 | },
|
8092 |
|
8093 | |
8094 |
|
8095 |
|
8096 |
|
8097 |
|
8098 | getDraggableSelection: function getDraggableSelection() {
|
8099 | var $$ = this,
|
8100 | config = $$.config;
|
8101 | return config.interaction_enabled && config.data_selection_draggable && $$.drag ? Object(external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_["drag"])().on("drag", function () {
|
8102 | $$.drag(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this));
|
8103 | }).on("start", function () {
|
8104 | $$.dragstart(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this));
|
8105 | }).on("end", function () {
|
8106 | $$.dragend();
|
8107 | }) : function () {};
|
8108 | },
|
8109 |
|
8110 | |
8111 |
|
8112 |
|
8113 |
|
8114 |
|
8115 |
|
8116 |
|
8117 | generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) {
|
8118 | var $$ = this,
|
8119 | config = $$.config,
|
8120 | rect = eventRectEnter.append("rect").attr("class", $$.classEvent.bind($$)).style("cursor", config.data_selection_enabled && config.data_selection_grouped ? "pointer" : null).on("click", function (d) {
|
8121 | $$.clickHandlerForSingleX.bind(this)(d, $$);
|
8122 | }).call($$.getDraggableSelection());
|
8123 | return $$.inputType === "mouse" && rect.on("mouseover", function (d) {
|
8124 | $$.dragging || $$.flowing || $$.hasArcType() || $$.config.tooltip_grouped && $$.setOverOut(!0, d.index);
|
8125 | }).on("mousemove", function (d) {
|
8126 |
|
8127 | if (!($$.dragging || $$.flowing || $$.hasArcType())) {
|
8128 | var index = d.index,
|
8129 | eventRect = $$.svg.select(".".concat(config_classes.eventRect, "-").concat(index));
|
8130 | $$.isStepType(d) && $$.config.line_step_type === "step-after" && Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)[0] < $$.x($$.getXValue(d.id, index)) && (index -= 1), index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, eventRect, index), $$.config.tooltip_grouped || $$.setOverOut(index !== -1, d.index);
|
8131 | }
|
8132 | }).on("mouseout", function (d) {
|
8133 | !$$.config || $$.hasArcType() || ($$.unselectRect(), $$.setOverOut(!1, d.index));
|
8134 | }), rect;
|
8135 | },
|
8136 | clickHandlerForSingleX: function clickHandlerForSingleX(d, ctx) {
|
8137 | var $$ = ctx,
|
8138 | config = $$.config;
|
8139 | if ($$.hasArcType() || !$$.toggleShape || $$.cancelClick) return void ($$.cancelClick && ($$.cancelClick = !1));
|
8140 | var index = d.index;
|
8141 | $$.main.selectAll(".".concat(config_classes.shape, "-").concat(index)).each(function (d2) {
|
8142 | (config.data_selection_grouped || $$.isWithinShape(this, d2)) && ($$.toggleShape(this, d2, index), config.data_onclick.call($$.api, d2, this));
|
8143 | });
|
8144 | },
|
8145 |
|
8146 | |
8147 |
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 | generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) {
|
8154 | var $$ = this,
|
8155 | rect = eventRectEnter.append("rect").attr("x", 0).attr("y", 0).attr("width", $$.width).attr("height", $$.height).attr("class", config_classes.eventRect).on("click", function () {
|
8156 | $$.clickHandlerForMultipleXS.bind(this)($$);
|
8157 | }).call($$.getDraggableSelection());
|
8158 | return $$.inputType === "mouse" && rect.on("mouseover mousemove", function () {
|
8159 | $$.selectRectForMultipleXs(this);
|
8160 | }).on("mouseout", function () {
|
8161 | !$$.config || $$.hasArcType() || $$.unselectRect();
|
8162 | }), rect;
|
8163 | },
|
8164 | clickHandlerForMultipleXS: function clickHandlerForMultipleXS(ctx) {
|
8165 | var $$ = ctx,
|
8166 | config = $$.config,
|
8167 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
8168 |
|
8169 | if (!$$.hasArcType(targetsToShow)) {
|
8170 | var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this),
|
8171 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
8172 | !closest || ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) && $$.main.selectAll(".".concat(config_classes.shapes).concat($$.getTargetSelectorSuffix(closest.id))).selectAll(".".concat(config_classes.shape, "-").concat(closest.index)).each(function () {
|
8173 | (config.data_selection_grouped || $$.isWithinShape(this, closest)) && ($$.toggleShape(this, closest, closest.index), config.data_onclick.call($$.api, closest, this));
|
8174 | });
|
8175 | }
|
8176 |
|
8177 | },
|
8178 |
|
8179 | |
8180 |
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 |
|
8186 | dispatchEvent: function dispatchEvent(type, index, mouse) {
|
8187 | var $$ = this,
|
8188 | isMultipleX = $$.isMultipleX(),
|
8189 | selector = ".".concat(isMultipleX ? config_classes.eventRect : "".concat(config_classes.eventRect, "-").concat(index)),
|
8190 | eventRect = $$.main.select(selector).node(),
|
8191 | _eventRect$getBoundin = eventRect.getBoundingClientRect(),
|
8192 | width = _eventRect$getBoundin.width,
|
8193 | left = _eventRect$getBoundin.left,
|
8194 | top = _eventRect$getBoundin.top,
|
8195 | x = left + (mouse ? mouse[0] : 0) + (isMultipleX || $$.config.axis_rotated ? 0 : width / 2),
|
8196 | y = top + (mouse ? mouse[1] : 0);
|
8197 |
|
8198 | emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](eventRect, type, {
|
8199 | screenX: x,
|
8200 | screenY: y,
|
8201 | clientX: x,
|
8202 | clientY: y
|
8203 | });
|
8204 | }
|
8205 | });
|
8206 |
|
8207 |
|
8208 |
|
8209 |
|
8210 |
|
8211 |
|
8212 |
|
8213 |
|
8214 |
|
8215 | extend(ChartInternal_ChartInternal.prototype, {
|
8216 | |
8217 |
|
8218 |
|
8219 |
|
8220 | setContainerSize: function setContainerSize() {
|
8221 | var $$ = this;
|
8222 | $$.currentWidth = $$.getCurrentWidth(), $$.currentHeight = $$.getCurrentHeight();
|
8223 | },
|
8224 | getCurrentWidth: function getCurrentWidth() {
|
8225 | var $$ = this;
|
8226 | return $$.config.size_width || $$.getParentWidth();
|
8227 | },
|
8228 | getCurrentHeight: function getCurrentHeight() {
|
8229 | var $$ = this,
|
8230 | config = $$.config,
|
8231 | h = config.size_height || $$.getParentHeight();
|
8232 | return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1);
|
8233 | },
|
8234 |
|
8235 | |
8236 |
|
8237 |
|
8238 |
|
8239 |
|
8240 |
|
8241 | getAxisSize: function getAxisSize(id) {
|
8242 | var $$ = this,
|
8243 | config = $$.config,
|
8244 | isRotated = config.axis_rotated;
|
8245 | return isRotated && id === "x" || !isRotated && /y2?/.test(id) ? $$.getAxisWidthByAxisId(id, !0) : $$.getHorizontalAxisHeight(id);
|
8246 | },
|
8247 | getCurrentPaddingTop: function getCurrentPaddingTop() {
|
8248 | var $$ = this,
|
8249 | config = $$.config,
|
8250 | axesLen = config.axis_y2_axes.length,
|
8251 | padding = isValue(config.padding_top) ? config.padding_top : 0;
|
8252 | return $$.title && $$.title.node() && (padding += $$.getTitlePadding()), axesLen && config.axis_rotated && (padding += $$.getHorizontalAxisHeight("y2") * axesLen), padding;
|
8253 | },
|
8254 | getCurrentPaddingBottom: function getCurrentPaddingBottom() {
|
8255 | var $$ = this,
|
8256 | config = $$.config,
|
8257 | axisId = config.axis_rotated ? "y" : "x",
|
8258 | axesLen = config["axis_".concat(axisId, "_axes")].length,
|
8259 | padding = isValue(config.padding_bottom) ? config.padding_bottom : 0;
|
8260 | return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
8261 | },
|
8262 | getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
|
8263 | var padding,
|
8264 | $$ = this,
|
8265 | config = $$.config,
|
8266 | isRotated = config.axis_rotated,
|
8267 | axisId = isRotated ? "x" : "y",
|
8268 | axesLen = config["axis_".concat(axisId, "_axes")].length,
|
8269 | axisWidth = $$.getAxisWidthByAxisId(axisId, withoutRecompute);
|
8270 | return padding = isValue(config.padding_left) ? config.padding_left : isRotated ? config.axis_x_show ? Math.max(ceil10(axisWidth), 40) : 1 : !config.axis_y_show || config.axis_y_inner ? $$.axis.getAxisLabelPosition("y").isOuter ? 30 : 1 : ceil10(axisWidth), padding + axisWidth * axesLen;
|
8271 | },
|
8272 | getCurrentPaddingRight: function getCurrentPaddingRight() {
|
8273 | var padding,
|
8274 | withoutTickTextOverflow = !!(arguments.length > 0 && arguments[0] !== undefined) && arguments[0],
|
8275 | $$ = this,
|
8276 | config = $$.config,
|
8277 | defaultPadding = 10,
|
8278 | legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
8279 | axesLen = config.axis_y2_axes.length,
|
8280 | axisWidth = $$.getAxisWidthByAxisId("y2"),
|
8281 | xAxisTickTextOverflow = withoutTickTextOverflow ? 0 : $$.axis.getXAxisTickTextY2Overflow(defaultPadding);
|
8282 | return padding = isValue(config.padding_right) ? config.padding_right + 1 : config.axis_rotated ? defaultPadding + legendWidthOnRight : !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;
|
8283 | },
|
8284 |
|
8285 | |
8286 |
|
8287 |
|
8288 |
|
8289 |
|
8290 | getParentRectValue: function getParentRectValue(key) {
|
8291 | for (var v, offsetName = "offset".concat(capitalize(key)), parent = this.selectChart.node(); !v && parent && parent.tagName !== "BODY";) {
|
8292 | try {
|
8293 | v = parent.getBoundingClientRect()[key];
|
8294 | } catch (e) {
|
8295 | offsetName in parent && (v = parent[offsetName]);
|
8296 | }
|
8297 |
|
8298 | parent = parent.parentNode;
|
8299 | }
|
8300 |
|
8301 | if (key === "width") {
|
8302 |
|
8303 |
|
8304 | var bodyWidth = browser_doc.body.offsetWidth;
|
8305 | v > bodyWidth && (v = bodyWidth);
|
8306 | }
|
8307 |
|
8308 | return v;
|
8309 | },
|
8310 | getParentWidth: function getParentWidth() {
|
8311 | return this.getParentRectValue("width");
|
8312 | },
|
8313 | getParentHeight: function getParentHeight() {
|
8314 | var h = this.selectChart.style("height");
|
8315 | return h.indexOf("px") > 0 ? parseInt(h, 10) : 0;
|
8316 | },
|
8317 | getSvgLeft: function getSvgLeft(withoutRecompute) {
|
8318 | var $$ = this,
|
8319 | config = $$.config,
|
8320 | hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner,
|
8321 | leftAxisClass = config.axis_rotated ? config_classes.axisX : config_classes.axisY,
|
8322 | leftAxis = $$.main.select(".".concat(leftAxisClass)).node(),
|
8323 | svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {
|
8324 | right: 0
|
8325 | },
|
8326 | chartRect = $$.selectChart.node().getBoundingClientRect(),
|
8327 | hasArc = $$.hasArcType(),
|
8328 | svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));
|
8329 | return svgLeft > 0 ? svgLeft : 0;
|
8330 | },
|
8331 | getAxisWidthByAxisId: function getAxisWidthByAxisId(id, withoutRecompute) {
|
8332 | var $$ = this,
|
8333 | position = $$.axis.getLabelPositionById(id);
|
8334 | return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40);
|
8335 | },
|
8336 | getHorizontalAxisHeight: function getHorizontalAxisHeight(id) {
|
8337 | var $$ = this,
|
8338 | config = $$.config,
|
8339 | isRotated = config.axis_rotated,
|
8340 | h = 30;
|
8341 | if (id === "x" && !config.axis_x_show) return 8;
|
8342 | if (id === "x" && config.axis_x_height) return config.axis_x_height;
|
8343 | if (id === "y" && !config.axis_y_show) return !config.legend_show || $$.isLegendRight || $$.isLegendInset ? 1 : 10;
|
8344 | if (id === "y2" && !config.axis_y2_show) return $$.rotated_padding_top;
|
8345 |
|
8346 | var rotate = $$.getAxisTickRotate(id);
|
8347 |
|
8348 | return (id === "x" && !isRotated || /y2?/.test(id) && isRotated) && rotate && (h = 30 + $$.axis.getMaxTickWidth(id) * Math.cos(Math.PI * (90 - rotate) / 180), !config.axis_x_tick_multiline && $$.currentHeight && h > $$.currentHeight / 2 && (h = $$.currentHeight / 2)), h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id !== "y2" || isRotated ? 0 : -10);
|
8349 | },
|
8350 | getEventRectWidth: function getEventRectWidth() {
|
8351 | return Math.max(0, this.xAxis.tickInterval());
|
8352 | },
|
8353 |
|
8354 | |
8355 |
|
8356 |
|
8357 |
|
8358 |
|
8359 |
|
8360 | getAxisTickRotate: function getAxisTickRotate(id) {
|
8361 | var $$ = this,
|
8362 | config = $$.config,
|
8363 | rotate = config["axis_".concat(id, "_tick_rotate")];
|
8364 |
|
8365 | if (id === "x") {
|
8366 | var isCategorized = $$.isCategorized(),
|
8367 | isTimeSeries = $$.isTimeSeries(),
|
8368 | allowedXAxisTypes = isCategorized || isTimeSeries,
|
8369 | tickCount = 0;
|
8370 | config.axis_x_tick_fit && allowedXAxisTypes && ($$.axis.x = {
|
8371 | padding: {
|
8372 | left: 0,
|
8373 | right: 0
|
8374 | },
|
8375 | tickCount: 0
|
8376 | }, tickCount = $$.currentMaxTickWidths.x.ticks.length + (isTimeSeries ? -1 : 1), tickCount !== $$.axis.x.tickCount && ($$.axis.x.padding = $$.axis.getXAxisPadding(tickCount)), $$.axis.x.tickCount = tickCount), $$.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);
|
8377 | }
|
8378 |
|
8379 | return rotate;
|
8380 | },
|
8381 |
|
8382 | |
8383 |
|
8384 |
|
8385 |
|
8386 | needToRotateXAxisTickTexts: function needToRotateXAxisTickTexts() {
|
8387 | var $$ = this,
|
8388 | xAxisLength = $$.currentWidth - $$.getCurrentPaddingLeft(!1) - $$.getCurrentPaddingRight(!0),
|
8389 | tickCountWithPadding = $$.axis.x.tickCount + $$.axis.x.padding.left + $$.axis.x.padding.right,
|
8390 | maxTickWidth = $$.axis.getMaxTickWidth("x");
|
8391 | return maxTickWidth > (xAxisLength / tickCountWithPadding || 0);
|
8392 | }
|
8393 | });
|
8394 |
|
8395 | var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webpack_require__(10);
|
8396 |
|
8397 |
|
8398 |
|
8399 |
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 | extend(ChartInternal_ChartInternal.prototype, {
|
8408 | getShapeIndices: function getShapeIndices(typeFilter) {
|
8409 | var $$ = this,
|
8410 | config = $$.config,
|
8411 | xs = config.data_xs,
|
8412 | hasXs = notEmpty(xs),
|
8413 | indices = {},
|
8414 | i = hasXs ? {} : 0;
|
8415 | return hasXs && getUnique(Object.keys(xs).map(function (v) {
|
8416 | return xs[v];
|
8417 | })).forEach(function (v) {
|
8418 | i[v] = 0, indices[v] = {};
|
8419 | }), $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) {
|
8420 | 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) {
|
8421 | ind[d.id] = ind[_row4];
|
8422 | break;
|
8423 | }
|
8424 |
|
8425 | isUndefined(ind[d.id]) && (ind[d.id] = xKey ? i[xKey]++ : i++, ind.__max__ = (xKey ? i[xKey] : i) - 1);
|
8426 | }), indices;
|
8427 | },
|
8428 |
|
8429 | |
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 | getIndices: function getIndices(indices, id) {
|
8437 | var xs = this.config.data_xs;
|
8438 | return notEmpty(xs) ? indices[xs[id]] : indices;
|
8439 | },
|
8440 |
|
8441 | |
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 | getIndicesMax: function getIndicesMax(indices) {
|
8448 | return notEmpty(this.config.data_xs) ?
|
8449 | Object.keys(indices).map(function (v) {
|
8450 | return indices[v].__max__ || 0;
|
8451 | }).reduce(function (acc, curr) {
|
8452 | return acc + curr;
|
8453 | }) : indices.__max__;
|
8454 | },
|
8455 | getShapeX: function getShapeX(offset, indices, isSub) {
|
8456 | var $$ = this,
|
8457 | scale = isSub ? $$.subX : $$.zoomScale || $$.x,
|
8458 | barPadding = $$.config.bar_padding,
|
8459 | sum = function (p, c) {
|
8460 | return p + c;
|
8461 | },
|
8462 | halfWidth = isObjectType(offset) && offset.total.length ? offset.total.reduce(sum) / 2 : 0;
|
8463 |
|
8464 | return function (d) {
|
8465 | var ind = $$.getIndices(indices, d.id),
|
8466 | index = d.id in ind ? ind[d.id] : 0,
|
8467 | targetsNum = (ind.__max__ || 0) + 1,
|
8468 | x = 0;
|
8469 |
|
8470 | if (notEmpty(d.x)) {
|
8471 | var xPos = scale(d.x);
|
8472 | 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);
|
8473 | }
|
8474 |
|
8475 |
|
8476 | return offset && x && targetsNum > 1 && barPadding && (index && (x += barPadding * index), targetsNum > 2 ? x -= (targetsNum - 1) * barPadding / 2 : targetsNum === 2 && (x -= barPadding / 2)), x;
|
8477 | };
|
8478 | },
|
8479 | getShapeY: function getShapeY(isSub) {
|
8480 | var $$ = this,
|
8481 | isStackNormalized = $$.isStackNormalized();
|
8482 | return function (d) {
|
8483 | var value = isStackNormalized ? $$.getRatio("index", d, !0) : $$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "y") : d.value;
|
8484 | return (isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id))(value);
|
8485 | };
|
8486 | },
|
8487 |
|
8488 | |
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 |
|
8494 | getShapeOffsetData: function getShapeOffsetData(typeFilter) {
|
8495 | var $$ = this,
|
8496 | targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),
|
8497 | shapeOffsetTargets = targets.map(function (target) {
|
8498 | var rowValues = target.values;
|
8499 | $$.isStepType(target) && (rowValues = $$.convertValuesToStep(rowValues));
|
8500 | var values,
|
8501 | rowValueMapByXValue = rowValues.reduce(function (out, value) {
|
8502 | return out[+value.x] = value, out;
|
8503 | }, {});
|
8504 | return values = $$.isStackNormalized() ? rowValues.map(function (v) {
|
8505 | return $$.getRatio("index", v, !0);
|
8506 | }) : rowValues.map(function (_ref) {
|
8507 | var value = _ref.value;
|
8508 | return value;
|
8509 | }), {
|
8510 | id: target.id,
|
8511 | rowValues: rowValues,
|
8512 | rowValueMapByXValue: rowValueMapByXValue,
|
8513 | values: values
|
8514 | };
|
8515 | }),
|
8516 | indexMapByTargetId = targets.reduce(function (out, _ref2, index) {
|
8517 | var id = _ref2.id;
|
8518 | return out[id] = index, out;
|
8519 | }, {});
|
8520 | return {
|
8521 | indexMapByTargetId: indexMapByTargetId,
|
8522 | shapeOffsetTargets: shapeOffsetTargets
|
8523 | };
|
8524 | },
|
8525 | getShapeOffset: function getShapeOffset(typeFilter, indices, isSub) {
|
8526 | var $$ = this,
|
8527 | _$$$getShapeOffsetDat = $$.getShapeOffsetData(typeFilter),
|
8528 | shapeOffsetTargets = _$$$getShapeOffsetDat.shapeOffsetTargets,
|
8529 | indexMapByTargetId = _$$$getShapeOffsetDat.indexMapByTargetId;
|
8530 |
|
8531 | return function (d, idx) {
|
8532 | var ind = $$.getIndices(indices, d.id),
|
8533 | scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id),
|
8534 | y0 = scale(0),
|
8535 | dataXAsNumber = +d.x,
|
8536 | offset = y0;
|
8537 | return shapeOffsetTargets.forEach(function (t) {
|
8538 | var rowValues = t.rowValues,
|
8539 | values = t.values;
|
8540 |
|
8541 | if (t.id !== d.id && ind[t.id] === ind[d.id] && indexMapByTargetId[t.id] < indexMapByTargetId[d.id]) {
|
8542 | var _rowValue = rowValues[idx];
|
8543 |
|
8544 | _rowValue && +_rowValue.x === dataXAsNumber || (_rowValue = t.rowValueMapByXValue[dataXAsNumber]), _rowValue && _rowValue.value * d.value >= 0 && (offset += scale(values[_rowValue.index]) - y0);
|
8545 | }
|
8546 | }), offset;
|
8547 | };
|
8548 | },
|
8549 | isWithinShape: function isWithinShape(that, d) {
|
8550 | var isWithin,
|
8551 | $$ = this,
|
8552 | shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(that);
|
8553 | return $$.isTargetToShow(d.id) ? $$.hasValidPointType(that.nodeName) ? isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.isBubbleType(d) ? $$.pointSelectR(d) * 1.5 : 0) : that.nodeName === "path" && (isWithin = !shape.classed(config_classes.bar) || $$.isWithinBar(that)) : isWithin = !1, isWithin;
|
8554 | },
|
8555 | getInterpolate: function getInterpolate(d) {
|
8556 | var $$ = this,
|
8557 | interpolation = $$.getInterpolateType(d);
|
8558 | return {
|
8559 | "basis": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBasis"],
|
8560 | "basis-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBasisClosed"],
|
8561 | "basis-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBasisOpen"],
|
8562 | "bundle": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveBundle"],
|
8563 | "cardinal": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCardinal"],
|
8564 | "cardinal-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCardinalClosed"],
|
8565 | "cardinal-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCardinalOpen"],
|
8566 | "catmull-rom": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCatmullRom"],
|
8567 | "catmull-rom-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCatmullRomClosed"],
|
8568 | "catmull-rom-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveCatmullRomOpen"],
|
8569 | "monotone-x": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveMonotoneX"],
|
8570 | "monotone-y": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveMonotoneY"],
|
8571 | "natural": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveNatural"],
|
8572 | "linear-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveLinearClosed"],
|
8573 | "linear": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveLinear"],
|
8574 | "step": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveStep"],
|
8575 | "step-after": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveStepAfter"],
|
8576 | "step-before": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["curveStepBefore"]
|
8577 | }[interpolation];
|
8578 | },
|
8579 | getInterpolateType: function getInterpolateType(d) {
|
8580 | var $$ = this,
|
8581 | type = $$.config.spline_interpolation_type,
|
8582 | interpolation = $$.isInterpolationType(type) ? type : "cardinal";
|
8583 | return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? $$.config.line_step_type : "linear";
|
8584 | }
|
8585 | });
|
8586 |
|
8587 | var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(11);
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 |
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 | extend(ChartInternal_ChartInternal.prototype, {
|
8602 | initPie: function initPie() {
|
8603 | var $$ = this,
|
8604 | config = $$.config,
|
8605 | dataType = config.data_type,
|
8606 | padding = config.pie_padding,
|
8607 | startingAngle = config["".concat(dataType, "_startingAngle")] || 0,
|
8608 | padAngle = ($$.hasType("pie") && padding ? padding * .01 : config["".concat(dataType, "_padAngle")]) || 0;
|
8609 | $$.pie = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["pie"])().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).sortValues($$.isOrderAsc() || $$.isOrderDesc() ? function (a, b) {
|
8610 | return $$.isOrderAsc() ? a - b : b - a;
|
8611 | } : null).value(function (d) {
|
8612 | return d.values.reduce(function (a, b) {
|
8613 | return a + b.value;
|
8614 | }, 0);
|
8615 | });
|
8616 | },
|
8617 | updateRadius: function updateRadius() {
|
8618 | var $$ = this,
|
8619 | config = $$.config,
|
8620 | radius = config.pie_innerRadius,
|
8621 | padding = config.pie_padding,
|
8622 | w = config.gauge_width || config.donut_width,
|
8623 | gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
8624 | $$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2 * ($$.hasMultiArcGauge() ? .85 : 1), $$.radius = $$.radiusExpanded * .95, $$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : .6, $$.gaugeArcWidth = w || (gaugeArcWidth <= $$.radius - $$.innerRadius ? $$.radius - $$.innerRadius : gaugeArcWidth <= $$.radius ? gaugeArcWidth : $$.radius);
|
8625 | var innerRadius = radius || (padding ? padding * ($$.innerRadiusRatio + .1) : 0);
|
8626 |
|
8627 | $$.innerRadius = $$.hasType("donut") || $$.hasType("gauge") ? $$.radius * $$.innerRadiusRatio : innerRadius;
|
8628 | },
|
8629 | getInnerRadius: function getInnerRadius(d) {
|
8630 | var $$ = this,
|
8631 | radius = $$.innerRadius;
|
8632 | return !isNumber(radius) && d && (radius = radius[d.data.id] || 0), radius;
|
8633 | },
|
8634 | updateArc: function updateArc() {
|
8635 | var $$ = this;
|
8636 | $$.svgArc = $$.getSvgArc(), $$.svgArcExpanded = $$.getSvgArcExpanded();
|
8637 | },
|
8638 | updateAngle: function updateAngle(dValue) {
|
8639 | var $$ = this,
|
8640 | config = $$.config,
|
8641 | pie = $$.pie,
|
8642 | d = dValue,
|
8643 | found = !1;
|
8644 | if (!config) return null;
|
8645 | var radius = Math.PI * (config.gauge_fullCircle ? 2 : 1),
|
8646 | gStart = config.gauge_startingAngle;
|
8647 |
|
8648 | if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
|
8649 | var totalSum = $$.getTotalDataSum();
|
8650 |
|
8651 | totalSum > config.gauge_max && (config.gauge_max = totalSum);
|
8652 | var gEnd = radius * (totalSum / (config.gauge_max - config.gauge_min));
|
8653 | pie = pie.startAngle(gStart).endAngle(gEnd + gStart);
|
8654 | }
|
8655 |
|
8656 | if (pie($$.filterTargetsToShow()).forEach(function (t, i) {
|
8657 | found || t.data.id !== d.data.id || (found = !0, d = t, d.index = i);
|
8658 | }), isNaN(d.startAngle) && (d.startAngle = 0), isNaN(d.endAngle) && (d.endAngle = d.startAngle), d.data && $$.hasMultiArcGauge()) {
|
8659 | var maxValue = $$.getMinMaxData().max[0].value;
|
8660 |
|
8661 | maxValue > config.gauge_max && (config.gauge_max = maxValue);
|
8662 | var gMin = config.gauge_min,
|
8663 | gMax = config.gauge_max,
|
8664 | gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : gMax - gMin;
|
8665 | d.startAngle = gStart, d.endAngle = gStart + radius / (gMax - gMin) * gValue;
|
8666 | }
|
8667 |
|
8668 | return found ? d : null;
|
8669 | },
|
8670 | getSvgArc: function getSvgArc() {
|
8671 | var $$ = this,
|
8672 | ir = $$.getInnerRadius(),
|
8673 | singleArcWidth = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
8674 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
8675 | arc = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["arc"])().outerRadius(function (d) {
|
8676 | return hasMultiArcGauge ? $$.radius - singleArcWidth * d.index : $$.radius;
|
8677 | }).innerRadius(function (d) {
|
8678 | return hasMultiArcGauge ? $$.radius - singleArcWidth * (d.index + 1) : isNumber(ir) ? ir : 0;
|
8679 | }),
|
8680 | newArc = function (d, withoutUpdate) {
|
8681 | var path = "M 0 0";
|
8682 |
|
8683 | if (d.value || d.data) {
|
8684 | isNumber(ir) || (arc = arc.innerRadius($$.getInnerRadius(d)));
|
8685 | var updated = !withoutUpdate && $$.updateAngle(d);
|
8686 | withoutUpdate ? path = arc(d) : updated && (path = arc(updated));
|
8687 | }
|
8688 |
|
8689 | return path;
|
8690 | };
|
8691 |
|
8692 | return newArc.centroid = arc.centroid, newArc;
|
8693 | },
|
8694 | getSvgArcExpanded: function getSvgArcExpanded(rate) {
|
8695 | var $$ = this,
|
8696 | newRate = rate || 1,
|
8697 | singleArcWidth = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
8698 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
8699 | expandWidth = Math.min($$.radiusExpanded * newRate - $$.radius, singleArcWidth * .8 - (1 - newRate) * 100),
|
8700 | arc = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["arc"])().outerRadius(function (d) {
|
8701 | return hasMultiArcGauge ? $$.radius - singleArcWidth * d.index + expandWidth : $$.radiusExpanded * newRate;
|
8702 | }).innerRadius(function (d) {
|
8703 | return hasMultiArcGauge ? $$.radius - singleArcWidth * (d.index + 1) : $$.innerRadius;
|
8704 | });
|
8705 | return function (d) {
|
8706 | var updated = $$.updateAngle(d);
|
8707 | return updated ? (hasMultiArcGauge ? arc : arc.innerRadius($$.getInnerRadius(d)))(updated) : "M 0 0";
|
8708 | };
|
8709 | },
|
8710 | getArc: function getArc(d, withoutUpdate, force) {
|
8711 | return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
8712 | },
|
8713 | transformForArcLabel: function transformForArcLabel(d) {
|
8714 | var $$ = this,
|
8715 | config = $$.config,
|
8716 | updated = $$.updateAngle(d),
|
8717 | translate = "";
|
8718 | if (updated) if ($$.hasMultiArcGauge()) {
|
8719 | var y1 = Math.sin(updated.endAngle - Math.PI / 2),
|
8720 | x = Math.cos(updated.endAngle - Math.PI / 2) * ($$.radiusExpanded + 25),
|
8721 | y = y1 * ($$.radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
8722 | translate = "translate(".concat(x, ",").concat(y, ")");
|
8723 | } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
8724 | var c = this.svgArc.centroid(updated),
|
8725 | x = isNaN(c[0]) ? 0 : c[0],
|
8726 | y = isNaN(c[1]) ? 0 : c[1],
|
8727 | h = Math.sqrt(x * x + y * y),
|
8728 | ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio;
|
8729 | ratio = ratio ? isFunction(ratio) ? ratio(d, $$.radius, h) : ratio : $$.radius && (h ? (36 / $$.radius > .375 ? 1.175 - 36 / $$.radius : .8) * $$.radius / h : 0), translate = "translate(".concat(x * ratio, ",").concat(y * ratio, ")");
|
8730 | }
|
8731 | return translate;
|
8732 | },
|
8733 | convertToArcData: function convertToArcData(d) {
|
8734 | return this.addName({
|
8735 | id: d.data.id,
|
8736 | value: d.value,
|
8737 | ratio: this.getRatio("arc", d),
|
8738 | index: d.index
|
8739 | });
|
8740 | },
|
8741 | textForArcLabel: function textForArcLabel(selection) {
|
8742 | var $$ = this;
|
8743 | $$.shouldShowArcLabel() && selection.each(function (d) {
|
8744 | var node = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
8745 | updated = $$.updateAngle(d),
|
8746 | value = updated ? updated.value : d.value,
|
8747 | ratio = $$.getRatio("arc", updated),
|
8748 | id = d.data.id,
|
8749 | hasGauge = $$.hasType("gauge"),
|
8750 | isUnderThreshold = hasGauge || $$.meetsArcLabelThreshold(ratio);
|
8751 |
|
8752 | if (isUnderThreshold) {
|
8753 | var text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, id).toString();
|
8754 | setTextValue(node, text, [-1, 1], hasGauge);
|
8755 | }
|
8756 | });
|
8757 | },
|
8758 | textForGaugeMinMax: function textForGaugeMinMax(value, isMax) {
|
8759 | var format = this.getGaugeLabelExtents();
|
8760 | return format ? format(value, isMax) : value;
|
8761 | },
|
8762 | expandArc: function expandArc(targetIds) {
|
8763 | var $$ = this;
|
8764 |
|
8765 | if ($$.transiting) {
|
8766 | var interval = setInterval(function () {
|
8767 | $$.transiting || (clearInterval(interval), $$.legend.selectAll(".".concat(config_classes.legendItemFocused)).size() > 0 && $$.expandArc(targetIds));
|
8768 | }, 10);
|
8769 | return;
|
8770 | }
|
8771 |
|
8772 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
8773 | $$.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(config_classes.chartArc))).each(function (d) {
|
8774 | if ($$.shouldExpand(d.data.id)) {
|
8775 | var expandDuration = $$.getExpandConfig(d.data.id, "duration"),
|
8776 | svgArcExpandedSub = $$.getSvgArcExpanded($$.getExpandConfig(d.data.id, "rate"));
|
8777 | Object(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);
|
8778 | }
|
8779 | });
|
8780 | },
|
8781 | unexpandArc: function unexpandArc(targetIds) {
|
8782 | var $$ = this;
|
8783 |
|
8784 | if (!$$.transiting) {
|
8785 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
8786 | $$.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(config_classes.chartArc))).selectAll("path").transition().duration(function (d) {
|
8787 | return $$.getExpandConfig(d.data.id, "duration");
|
8788 | }).attr("d", $$.svgArc), $$.svg.selectAll("".concat(config_classes.arc)).style("opacity", "1");
|
8789 | }
|
8790 | },
|
8791 |
|
8792 | |
8793 |
|
8794 |
|
8795 |
|
8796 |
|
8797 |
|
8798 |
|
8799 | getExpandConfig: function getExpandConfig(id, key) {
|
8800 | var type,
|
8801 | $$ = this,
|
8802 | config = $$.config;
|
8803 | return $$.isDonutType(id) ? type = "donut" : $$.isGaugeType(id) ? type = "gauge" : $$.isPieType(id) && (type = "pie"), type ? config["".concat(type, "_expand_").concat(key)] : {
|
8804 | duration: 50,
|
8805 | rate: .98
|
8806 | }[key];
|
8807 | },
|
8808 | shouldExpand: function shouldExpand(id) {
|
8809 | var $$ = this,
|
8810 | config = $$.config;
|
8811 | return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
|
8812 | },
|
8813 | shouldShowArcLabel: function shouldShowArcLabel() {
|
8814 | var $$ = this,
|
8815 | config = $$.config;
|
8816 | return ["pie", "donut", "gauge"].some(function (v) {
|
8817 | return $$.hasType(v) && config["".concat(v, "_label_show")];
|
8818 | });
|
8819 | },
|
8820 | meetsArcLabelThreshold: function meetsArcLabelThreshold(ratio) {
|
8821 | var $$ = this,
|
8822 | config = $$.config,
|
8823 | threshold = $$.hasType("donut") ? config.donut_label_threshold : config.pie_label_threshold;
|
8824 | return ratio >= threshold;
|
8825 | },
|
8826 | getArcLabelFormat: function getArcLabelFormat() {
|
8827 | var $$ = this,
|
8828 | config = $$.config,
|
8829 | format = config.pie_label_format;
|
8830 | return $$.hasType("gauge") ? format = config.gauge_label_format : $$.hasType("donut") && (format = config.donut_label_format), format;
|
8831 | },
|
8832 | getGaugeLabelExtents: function getGaugeLabelExtents() {
|
8833 | var config = this.config;
|
8834 | return config.gauge_label_extents;
|
8835 | },
|
8836 | getArcTitle: function getArcTitle() {
|
8837 | var $$ = this,
|
8838 | type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
|
8839 | return type ? $$.config["".concat(type, "_title")] : "";
|
8840 | },
|
8841 | updateTargetsForArc: function updateTargetsForArc(targets) {
|
8842 | var $$ = this,
|
8843 | main = $$.main,
|
8844 | hasGauge = $$.hasType("gauge"),
|
8845 | classChartArc = $$.classChartArc.bind($$),
|
8846 | classArcs = $$.classArcs.bind($$),
|
8847 | classFocus = $$.classFocus.bind($$),
|
8848 | mainPieUpdate = main.select(".".concat(config_classes.chartArcs)).selectAll(".".concat(config_classes.chartArc)).data($$.pie(targets)).attr("class", function (d) {
|
8849 | return classChartArc(d) + classFocus(d.data);
|
8850 | }),
|
8851 | mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc);
|
8852 | 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");
|
8853 | },
|
8854 | initArc: function initArc() {
|
8855 | var $$ = this;
|
8856 | $$.arcs = $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartArcs).attr("transform", $$.getTranslate("arc")), $$.setArcTitle();
|
8857 | },
|
8858 |
|
8859 | |
8860 |
|
8861 |
|
8862 |
|
8863 | setArcTitle: function setArcTitle() {
|
8864 | var $$ = this,
|
8865 | title = $$.getArcTitle(),
|
8866 | hasGauge = $$.hasType("gauge");
|
8867 |
|
8868 | if (title) {
|
8869 | var text = $$.arcs.append("text").attr("class", config_classes[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"]).style("text-anchor", "middle");
|
8870 | hasGauge && text.attr("dy", "-0.3em").style("font-size", "27px"), setTextValue(text, title, hasGauge ? undefined : [-.6, 1.35], !0);
|
8871 | }
|
8872 | },
|
8873 | redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
8874 | var $$ = this,
|
8875 | config = $$.config,
|
8876 | main = $$.main,
|
8877 | hasInteraction = config.interaction_enabled,
|
8878 | mainArc = main.selectAll(".".concat(config_classes.arcs)).selectAll(".".concat(config_classes.arc)).data($$.arcData.bind($$));
|
8879 |
|
8880 | mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove(), mainArc = mainArc.enter().append("path").attr("class", $$.classArc.bind($$)).style("fill", function (d) {
|
8881 | return $$.color(d.data);
|
8882 | }).style("cursor", function (d) {
|
8883 | return hasInteraction && config.data_selection_isselectable(d) ? "pointer" : null;
|
8884 | }).style("opacity", "0").each(function (d) {
|
8885 | $$.isGaugeType(d.data) && (d.startAngle = config.gauge_startingAngle, d.endAngle = config.gauge_startingAngle), this._current = d;
|
8886 | }).merge(mainArc), $$.hasMultiArcGauge() && $$.redrawMultiArcGauge(), mainArc.attr("transform", function (d) {
|
8887 | return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
|
8888 | }).style("opacity", function (d) {
|
8889 | return d === this._current ? "0" : "1";
|
8890 | }).each(function () {
|
8891 | $$.transiting = !0;
|
8892 | }).transition().duration(duration).attrTween("d", function (d) {
|
8893 | var updated = $$.updateAngle(d);
|
8894 | if (!updated) return function () {
|
8895 | return "M 0 0";
|
8896 | };
|
8897 | isNaN(this._current.startAngle) && (this._current.startAngle = 0), isNaN(this._current.endAngle) && (this._current.endAngle = this._current.startAngle);
|
8898 | var interpolate = Object(external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_["interpolate"])(this._current, updated);
|
8899 | return this._current = interpolate(0), function (t) {
|
8900 | var interpolated = interpolate(t);
|
8901 |
|
8902 | return interpolated.data = d.data, $$.getArc(interpolated, !0);
|
8903 | };
|
8904 | }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
|
8905 | var color;
|
8906 | return $$.levelColor ? (color = $$.levelColor(d.data.values[0].value), config.data_colors[d.data.id] = color) : color = $$.color(d.data.id), color;
|
8907 | })
|
8908 | .style("opacity", "1").call($$.endall, function () {
|
8909 | if ($$.levelColor) {
|
8910 | var path = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
8911 | d = path.datum();
|
8912 | $$.updateLegendItemColor(d.data.id, path.style("fill"));
|
8913 | }
|
8914 |
|
8915 | $$.transiting = !1, callFn(config.onrendered, $$, $$.api);
|
8916 | }), hasInteraction && $$.bindArcEvent(mainArc), $$.redrawArcText(duration);
|
8917 | },
|
8918 | redrawMultiArcGauge: function redrawMultiArcGauge() {
|
8919 | var $$ = this,
|
8920 | config = $$.config,
|
8921 | arcLabelLines = $$.main.selectAll(".".concat(config_classes.arcs)).selectAll(".".concat(config_classes.arcLabelLine)).data($$.arcData.bind($$)),
|
8922 | mainArcLabelLine = arcLabelLines.enter().append("rect").attr("class", function (d) {
|
8923 | return "".concat(config_classes.arcLabelLine, " ").concat(config_classes.target, " ").concat(config_classes.target, "-").concat(d.data.id);
|
8924 | }).merge(arcLabelLines);
|
8925 | mainArcLabelLine.style("fill", function (d) {
|
8926 | return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data);
|
8927 | }).style("display", config.gauge_label_show ? "" : "none").each(function (d) {
|
8928 | var lineLength = 0,
|
8929 | lineThickness = 2,
|
8930 | x = 0,
|
8931 | y = 0,
|
8932 | transform = "";
|
8933 |
|
8934 | if ($$.hiddenTargetIds.indexOf(d.data.id) < 0) {
|
8935 | var updated = $$.updateAngle(d),
|
8936 | innerLineLength = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length * (updated.index + 1),
|
8937 | lineAngle = updated.endAngle - Math.PI / 2,
|
8938 | arcInnerRadius = $$.radius - innerLineLength,
|
8939 | linePositioningAngle = lineAngle - (arcInnerRadius === 0 ? 0 : 1 / arcInnerRadius);
|
8940 | lineLength = $$.radiusExpanded - $$.radius + innerLineLength, x = Math.cos(linePositioningAngle) * arcInnerRadius, y = Math.sin(linePositioningAngle) * arcInnerRadius, transform = "rotate(".concat(lineAngle * 180 / Math.PI, ", ").concat(x, ", ").concat(y, ")");
|
8941 | }
|
8942 |
|
8943 | Object(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, ".concat(lineLength + lineThickness, ", 0"));
|
8944 | });
|
8945 | },
|
8946 | bindArcEvent: function bindArcEvent(arc) {
|
8947 | function selectArc(_this, arcData, id) {
|
8948 | $$.expandArc(id), $$.api.focus(id), $$.toggleFocusLegend(id, !0), $$.showTooltip([arcData], _this);
|
8949 | }
|
8950 |
|
8951 | function unselectArc(arcData) {
|
8952 | var id = arcData && arcData.id || undefined;
|
8953 | $$.unexpandArc(id), $$.api.revert(), $$.revertLegend(), $$.hideTooltip();
|
8954 | }
|
8955 |
|
8956 | var $$ = this,
|
8957 | isTouch = $$.inputType === "touch",
|
8958 | isMouse = $$.inputType === "mouse";
|
8959 |
|
8960 |
|
8961 | if (arc.on("click", function (d, i) {
|
8962 | var arcData,
|
8963 | updated = $$.updateAngle(d);
|
8964 | updated && (arcData = $$.convertToArcData(updated), $$.toggleShape && $$.toggleShape(this, arcData, i), $$.config.data_onclick.call($$.api, arcData, this));
|
8965 | }), isMouse && arc.on("mouseover", function (d) {
|
8966 | if (!$$.transiting)
|
8967 | {
|
8968 | var updated = $$.updateAngle(d),
|
8969 | arcData = updated ? $$.convertToArcData(updated) : null,
|
8970 | id = arcData && arcData.id || undefined;
|
8971 | selectArc(this, arcData, id), $$.setOverOut(!0, arcData);
|
8972 | }
|
8973 | }).on("mouseout", function (d) {
|
8974 | if (!$$.transiting)
|
8975 | {
|
8976 | var updated = $$.updateAngle(d),
|
8977 | arcData = updated ? $$.convertToArcData(updated) : null;
|
8978 | unselectArc(), $$.setOverOut(!1, arcData);
|
8979 | }
|
8980 | }).on("mousemove", function (d) {
|
8981 | var updated = $$.updateAngle(d),
|
8982 | arcData = updated ? $$.convertToArcData(updated) : null;
|
8983 | $$.showTooltip([arcData], this);
|
8984 | }), isTouch && $$.hasArcType() && !$$.radars) {
|
8985 | var getEventArc = function () {
|
8986 | var touch = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].changedTouches[0],
|
8987 | eventArc = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
|
8988 | return eventArc;
|
8989 | },
|
8990 | handler = function () {
|
8991 | if (!$$.transiting)
|
8992 | {
|
8993 | var eventArc = getEventArc(),
|
8994 | datum = eventArc.datum(),
|
8995 | updated = datum && datum.data && datum.data.id ? $$.updateAngle(datum) : null,
|
8996 | arcData = updated ? $$.convertToArcData(updated) : null,
|
8997 | id = arcData && arcData.id || undefined;
|
8998 | $$.callOverOutForTouch(arcData), isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
8999 | }
|
9000 | };
|
9001 |
|
9002 | $$.svg.on("touchstart", handler).on("touchmove", handler);
|
9003 | }
|
9004 | },
|
9005 | redrawArcText: function redrawArcText(duration) {
|
9006 | var text,
|
9007 | $$ = this,
|
9008 | config = $$.config,
|
9009 | main = $$.main,
|
9010 | hasGauge = $$.hasType("gauge"),
|
9011 | hasMultiArcGauge = $$.hasMultiArcGauge();
|
9012 |
|
9013 | if (hasGauge && $$.data.targets.length === 1 && config.gauge_title || (text = main.selectAll(".".concat(config_classes.chartArc)).select("text").style("opacity", "0").attr("class", function (d) {
|
9014 | return $$.isGaugeType(d.data) ? config_classes.gaugeValue : null;
|
9015 | }).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
|
9016 | return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? "".concat(Math.round($$.radius / 5), "px") : null;
|
9017 | }).transition().duration(duration).style("opacity", function (d) {
|
9018 | return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? "1" : "0";
|
9019 | }), hasMultiArcGauge && text.attr("dy", "-.1em")), main.select(".".concat(config_classes.chartArcsTitle)).style("opacity", $$.hasType("donut") || hasGauge ? "1" : "0"), hasGauge) {
|
9020 | var isFullCircle = config.gauge_fullCircle,
|
9021 | startAngle = -1 * Math.PI / 2,
|
9022 | endAngle = (isFullCircle ? -4 : -1) * startAngle;
|
9023 | isFullCircle && text && text.attr("dy", "".concat(Math.round($$.radius / 14)));
|
9024 | var backgroundArc = $$.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat(config_classes.chartArcsBackground));
|
9025 |
|
9026 | if (hasMultiArcGauge) {
|
9027 | var index = 0;
|
9028 | backgroundArc = backgroundArc.selectAll("path.".concat(config_classes.chartArcsBackground)).data($$.data.targets), backgroundArc.enter().append("path").attr("class", function (d, i) {
|
9029 | return "".concat(config_classes.chartArcsBackground, " ").concat(config_classes.chartArcsBackground, "-").concat(i);
|
9030 | }).merge(backgroundArc).attr("d", function (d1) {
|
9031 | if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) return "M 0 0";
|
9032 | var d = {
|
9033 | data: [{
|
9034 | value: config.gauge_max
|
9035 | }],
|
9036 | startAngle: startAngle,
|
9037 | endAngle: endAngle,
|
9038 | index: index++
|
9039 | };
|
9040 | return $$.getArc(d, !0, !0);
|
9041 | }), backgroundArc.exit().remove();
|
9042 | } else backgroundArc.attr("d", function () {
|
9043 | var d = {
|
9044 | data: [{
|
9045 | value: config.gauge_max
|
9046 | }],
|
9047 | startAngle: startAngle,
|
9048 | endAngle: endAngle
|
9049 | };
|
9050 | return $$.getArc(d, !0, !0);
|
9051 | });
|
9052 |
|
9053 | $$.arcs.select(".".concat(config_classes.chartArcsGaugeUnit)).attr("dy", ".75em").text(config.gauge_label_show ? config.gauge_units : ""), config.gauge_label_show && ($$.arcs.select(".".concat(config_classes.chartArcsGaugeMin)).attr("dx", "".concat(-1 * ($$.innerRadius + ($$.radius - $$.innerRadius) / (isFullCircle ? 1 : 2)), "px")).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_min, !1)), !isFullCircle && $$.arcs.select(".".concat(config_classes.chartArcsGaugeMax)).attr("dx", "".concat($$.innerRadius + ($$.radius - $$.innerRadius) / 2, "px")).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0)));
|
9054 | }
|
9055 | },
|
9056 | initGauge: function initGauge() {
|
9057 | var $$ = this,
|
9058 | config = $$.config,
|
9059 | arcs = $$.arcs,
|
9060 | appendText = function (className) {
|
9061 | arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none");
|
9062 | };
|
9063 |
|
9064 | $$.hasType("gauge") && (arcs.append($$.hasMultiArcGauge() ? "g" : "path").attr("class", config_classes.chartArcsBackground), config.gauge_units && appendText(config_classes.chartArcsGaugeUnit), config.gauge_label_show && (appendText(config_classes.chartArcsGaugeMin), !config.gauge_fullCircle && appendText(config_classes.chartArcsGaugeMax)));
|
9065 | },
|
9066 | getGaugeLabelHeight: function getGaugeLabelHeight() {
|
9067 | return this.config.gauge_label_show ? 20 : 0;
|
9068 | }
|
9069 | });
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 |
|
9081 | extend(ChartInternal_ChartInternal.prototype, {
|
9082 | initBar: function initBar() {
|
9083 | var $$ = this;
|
9084 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartBars);
|
9085 | },
|
9086 | updateTargetsForBar: function updateTargetsForBar(targets) {
|
9087 | var $$ = this,
|
9088 | config = $$.config,
|
9089 | classChartBar = $$.classChartBar.bind($$),
|
9090 | classBars = $$.classBars.bind($$),
|
9091 | classFocus = $$.classFocus.bind($$),
|
9092 | mainBarUpdate = $$.main.select(".".concat(config_classes.chartBars)).selectAll(".".concat(config_classes.chartBar)).data(targets).attr("class", function (d) {
|
9093 | return classChartBar(d) + classFocus(d);
|
9094 | }),
|
9095 | mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", "none");
|
9096 |
|
9097 | mainBarEnter.append("g").attr("class", classBars).style("cursor", function (d) {
|
9098 | return config.data_selection_isselectable(d) ? "pointer" : null;
|
9099 | });
|
9100 | },
|
9101 | updateBar: function updateBar(durationForExit) {
|
9102 | var $$ = this,
|
9103 | barData = $$.barData.bind($$),
|
9104 | classBar = $$.classBar.bind($$),
|
9105 | initialOpacity = $$.initialOpacity.bind($$);
|
9106 | $$.mainBar = $$.main.selectAll(".".concat(config_classes.bars)).selectAll(".".concat(config_classes.bar)).data(barData), $$.mainBar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainBar = $$.mainBar.enter().append("path").attr("class", classBar).style("fill", $$.color).merge($$.mainBar).style("opacity", initialOpacity);
|
9107 | },
|
9108 | redrawBar: function redrawBar(drawBar, withTransition) {
|
9109 | return [(withTransition ? this.mainBar.transition(getRandom()) : this.mainBar).attr("d", drawBar).style("fill", this.color).style("opacity", "1")];
|
9110 | },
|
9111 | getBarW: function getBarW(axis, barTargetsNum) {
|
9112 | var result,
|
9113 | $$ = this,
|
9114 | config = $$.config,
|
9115 | maxDataCount = $$.getMaxDataCount(),
|
9116 | isGrouped = config.data_groups.length,
|
9117 | tickInterval = ($$.zoomScale || $$) && !$$.isCategorized() ? $$.xx($$.subX.domain()[1]) / maxDataCount : axis.tickInterval(maxDataCount),
|
9118 | getWidth = function (id) {
|
9119 | var width = id ? config.bar_width[id] : config.bar_width,
|
9120 | ratio = id ? width.ratio : config.bar_width_ratio,
|
9121 | max = id ? width.max : config.bar_width_max,
|
9122 | w = isNumber(width) ? width : barTargetsNum ? tickInterval * ratio / barTargetsNum : 0;
|
9123 | return max && w > max ? max : w;
|
9124 | };
|
9125 |
|
9126 | return result = getWidth(), !isGrouped && isObjectType(config.bar_width) && (result = {
|
9127 | width: result,
|
9128 | total: []
|
9129 | }, $$.filterTargetsToShow($$.data.targets).forEach(function (v) {
|
9130 | config.bar_width[v.id] && (result[v.id] = getWidth(v.id), result.total.push(result[v.id] || result.width));
|
9131 | })), result;
|
9132 | },
|
9133 | getBars: function getBars(i, id) {
|
9134 | var $$ = this,
|
9135 | suffix = isValue(i) ? "-".concat(i) : "";
|
9136 | return (id ? $$.main.selectAll(".".concat(config_classes.bars).concat($$.getTargetSelectorSuffix(id))) : $$.main).selectAll(".".concat(config_classes.bar).concat(suffix));
|
9137 | },
|
9138 | expandBars: function expandBars(i, id, reset) {
|
9139 | var $$ = this;
|
9140 | reset && $$.unexpandBars(), $$.getBars(i, id).classed(config_classes.EXPANDED, !0);
|
9141 | },
|
9142 | unexpandBars: function unexpandBars(i) {
|
9143 | this.getBars(i).classed(config_classes.EXPANDED, !1);
|
9144 | },
|
9145 | generateDrawBar: function generateDrawBar(barIndices, isSub) {
|
9146 | var $$ = this,
|
9147 | config = $$.config,
|
9148 | getPoints = $$.generateGetBarPoints(barIndices, isSub),
|
9149 | isRotated = config.axis_rotated,
|
9150 | isGrouped = config.data_groups.length,
|
9151 | barRadius = config.bar_radius,
|
9152 | barRadiusRatio = config.bar_radius_ratio,
|
9153 | getRadius = isNumber(barRadius) && barRadius > 0 ? function () {
|
9154 | return barRadius;
|
9155 | } : isNumber(barRadiusRatio) ? function (w) {
|
9156 | return w * barRadiusRatio;
|
9157 | } : null;
|
9158 | return function (d, i) {
|
9159 |
|
9160 | var points = getPoints(d, i),
|
9161 | indexX = +isRotated,
|
9162 | indexY = +!indexX,
|
9163 | isNegative = d.value < 0,
|
9164 | pathRadius = ["", ""],
|
9165 | radius = 0;
|
9166 |
|
9167 | if (getRadius && !isGrouped) {
|
9168 | var index = isRotated ? indexY : indexX,
|
9169 | barW = points[2][index] - points[0][index];
|
9170 | radius = getRadius(barW);
|
9171 | var arc = "a".concat(radius, ",").concat(radius, " ").concat(isNegative ? "1 0 0" : "0 0 1", " ");
|
9172 | pathRadius[+!isRotated] = "".concat(arc).concat(radius, ",").concat(radius), pathRadius[+isRotated] = "".concat(arc).concat([-radius, radius][isRotated ? "sort" : "reverse"]()), isNegative && pathRadius.reverse();
|
9173 | }
|
9174 |
|
9175 |
|
9176 |
|
9177 | var path = isRotated ? "H".concat(points[1][indexX] - radius, " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) : "V".concat(points[1][indexY] + (isNegative ? -radius : radius), " ").concat(pathRadius[0], "H").concat(points[2][indexX] - radius, " ").concat(pathRadius[1], "V").concat(points[3][indexY]);
|
9178 | return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
|
9179 | };
|
9180 | },
|
9181 | generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) {
|
9182 | var $$ = this,
|
9183 | axis = isSub ? $$.subXAxis : $$.xAxis,
|
9184 | barTargetsNum = $$.getIndicesMax(barIndices) + 1,
|
9185 | barW = $$.getBarW(axis, barTargetsNum),
|
9186 | barX = $$.getShapeX(barW, barIndices, !!isSub),
|
9187 | barY = $$.getShapeY(!!isSub),
|
9188 | barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),
|
9189 | yScale = isSub ? $$.getSubYScale : $$.getYScale;
|
9190 | return function (d, i) {
|
9191 | var y0 = yScale.call($$, d.id)(0),
|
9192 | offset = barOffset(d, i) || y0,
|
9193 | width = isNumber(barW) ? barW : barW[d.id] || barW.width,
|
9194 | posX = barX(d),
|
9195 | posY = barY(d);
|
9196 |
|
9197 | return $$.config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0), posY -= y0 - offset, [[posX, offset], [posX, posY], [posX + width, posY], [posX + width, offset]];
|
9198 | };
|
9199 | },
|
9200 | isWithinBar: function isWithinBar(that) {
|
9201 | var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(that),
|
9202 | list = getRectSegList(that),
|
9203 | _list2 = _slicedToArray(list, 2),
|
9204 | seg0 = _list2[0],
|
9205 | seg1 = _list2[1],
|
9206 | x = Math.min(seg0.x, seg1.x),
|
9207 | y = Math.min(seg0.y, seg1.y),
|
9208 | offset = this.config.bar_sensitivity,
|
9209 | _that$getBBox = that.getBBox(),
|
9210 | width = _that$getBBox.width,
|
9211 | height = _that$getBBox.height;
|
9212 |
|
9213 | return x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
|
9214 | }
|
9215 | });
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 | extend(ChartInternal_ChartInternal.prototype, {
|
9224 | |
9225 |
|
9226 |
|
9227 |
|
9228 | initBubble: function initBubble() {
|
9229 | var $$ = this,
|
9230 | config = $$.config;
|
9231 | $$.hasType("bubble") && (config.point_show = !0, config.point_type = "circle", config.point_sensitivity = 25);
|
9232 | },
|
9233 |
|
9234 | |
9235 |
|
9236 |
|
9237 |
|
9238 |
|
9239 |
|
9240 | getBaseLength: function getBaseLength() {
|
9241 | var $$ = this,
|
9242 | cacheKey = "$baseLength",
|
9243 | baseLength = $$.getCache(cacheKey);
|
9244 | return baseLength || $$.addCache(cacheKey, baseLength = getMinMax("min", [$$.axes.x.select("path").node().getTotalLength(), $$.axes.y.select("path").node().getTotalLength()])), baseLength;
|
9245 | },
|
9246 |
|
9247 | |
9248 |
|
9249 |
|
9250 |
|
9251 |
|
9252 |
|
9253 | getBubbleR: function getBubbleR(d) {
|
9254 | var $$ = this,
|
9255 | maxR = $$.config.bubble_maxR;
|
9256 | isFunction(maxR) ? maxR = maxR(d) : !isNumber(maxR) && (maxR = $$.getBaseLength() / ($$.getMaxDataCount() * 2) + 12);
|
9257 | var max = getMinMax("max", $$.getMinMaxData().max.map(function (d) {
|
9258 | return $$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "y") : isObject(d.value) ? d.value.mid : d.value;
|
9259 | })),
|
9260 | maxArea = maxR * maxR * Math.PI,
|
9261 | area = ($$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "z") : d.value) * (maxArea / max);
|
9262 | return Math.sqrt(area / Math.PI);
|
9263 | },
|
9264 |
|
9265 | |
9266 |
|
9267 |
|
9268 |
|
9269 |
|
9270 |
|
9271 |
|
9272 | getBubbleZData: function getBubbleZData(d, type) {
|
9273 | return isObject(d) ? d[type] : d[type === "y" ? 0 : 1];
|
9274 | },
|
9275 |
|
9276 | |
9277 |
|
9278 |
|
9279 |
|
9280 |
|
9281 |
|
9282 | isBubbleZType: function isBubbleZType(d) {
|
9283 | var $$ = this;
|
9284 | return $$.isBubbleType(d) && (isObject(d.value) && ("z" in d.value || "y" in d.value) || isArray(d.value) && d.value.length === 2);
|
9285 | }
|
9286 | });
|
9287 |
|
9288 |
|
9289 |
|
9290 |
|
9291 |
|
9292 |
|
9293 |
|
9294 |
|
9295 |
|
9296 |
|
9297 | extend(ChartInternal_ChartInternal.prototype, {
|
9298 | initLine: function initLine() {
|
9299 | var $$ = this;
|
9300 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartLines);
|
9301 | },
|
9302 | updateTargetsForLine: function updateTargetsForLine(targets) {
|
9303 | var $$ = this,
|
9304 | config = $$.config,
|
9305 | classChartLine = $$.classChartLine.bind($$),
|
9306 | classLines = $$.classLines.bind($$),
|
9307 | classAreas = $$.classAreas.bind($$),
|
9308 | classCircles = $$.classCircles.bind($$),
|
9309 | classFocus = $$.classFocus.bind($$),
|
9310 | mainLineUpdate = $$.main.select(".".concat(config_classes.chartLines)).selectAll(".".concat(config_classes.chartLine)).data(targets).attr("class", function (d) {
|
9311 | return classChartLine(d) + classFocus(d);
|
9312 | }),
|
9313 | mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", "none");
|
9314 |
|
9315 |
|
9316 |
|
9317 | mainLineEnter.append("g").attr("class", classLines), mainLineEnter.append("g").attr("class", classAreas), config.point_show && (config.data_selection_enabled && mainLineEnter.append("g").attr("class", function (d) {
|
9318 | return $$.generateClass(config_classes.selectedCircles, d.id);
|
9319 | }), mainLineEnter.append("g").attr("class", classCircles).style("cursor", function (d) {
|
9320 | return config.data_selection_isselectable(d) ? "pointer" : null;
|
9321 | })), targets.forEach(function (t) {
|
9322 | $$.main.selectAll(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(t.id))).selectAll("".concat(config_classes.selectedCircle)).each(function (d) {
|
9323 | d.value = t.values[d.index].value;
|
9324 | });
|
9325 | });
|
9326 | },
|
9327 | updateLine: function updateLine(durationForExit) {
|
9328 | var $$ = this;
|
9329 | $$.mainLine = $$.main.selectAll(".".concat(config_classes.lines)).selectAll(".".concat(config_classes.line)).data($$.lineData.bind($$)), $$.mainLine.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainLine = $$.mainLine.enter().append("path").attr("class", function (d) {
|
9330 | return "".concat($$.classLine.bind($$)(d), " ").concat($$.extraLineClasses(d) || "");
|
9331 | }).style("stroke", $$.color).merge($$.mainLine).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) {
|
9332 | return $$.isStepType(d) ? "crispEdges" : "";
|
9333 | }).attr("transform", null);
|
9334 | },
|
9335 | redrawLine: function redrawLine(drawLine, withTransition) {
|
9336 | return [(withTransition ? this.mainLine.transition(getRandom()) : this.mainLine).attr("d", drawLine).style("stroke", this.color).style("opacity", "1")];
|
9337 | },
|
9338 |
|
9339 | |
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 |
|
9345 | getCurve: function getCurve(d) {
|
9346 | var $$ = this,
|
9347 | isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d);
|
9348 |
|
9349 |
|
9350 | return isRotatedStepType ? function (context) {
|
9351 | var step = $$.getInterpolate(d)(context);
|
9352 |
|
9353 | return step.orgPoint = step.point, step.pointRotated = function (x, y) {
|
9354 | this._point === 1 && (this._point = 2);
|
9355 | var y1 = this._y * (1 - this._t) + y * this._t;
|
9356 | this._context.lineTo(this._x, y1), this._context.lineTo(x, y1), this._x = x, this._y = y;
|
9357 | }, step.point = function (x, y) {
|
9358 | this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
|
9359 | }, step;
|
9360 | } : $$.getInterpolate(d);
|
9361 | },
|
9362 | generateDrawLine: function generateDrawLine(lineIndices, isSub) {
|
9363 | var $$ = this,
|
9364 | config = $$.config,
|
9365 | lineConnectNull = config.line_connectNull,
|
9366 | isRotated = config.axis_rotated,
|
9367 | getPoints = $$.generateGetLinePoints(lineIndices, isSub),
|
9368 | yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,
|
9369 | xValue = function (d) {
|
9370 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
9371 | },
|
9372 | yValue = function (d, i) {
|
9373 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.getBaseValue(d));
|
9374 | },
|
9375 | line = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["line"])();
|
9376 |
|
9377 | line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue), lineConnectNull || (line = line.defined(function (d) {
|
9378 | return $$.getBaseValue(d) !== null;
|
9379 | }));
|
9380 | var x = isSub ? $$.subX : $$.x;
|
9381 | return function (d) {
|
9382 | var path,
|
9383 | y = yScaleGetter.call($$, d.id),
|
9384 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
9385 | x0 = 0,
|
9386 | y0 = 0;
|
9387 |
|
9388 | if ($$.isLineType(d)) {
|
9389 | var regions = config.data_regions[d.id];
|
9390 | regions ? path = $$.lineWithRegions(values, x, y, regions) : ($$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = line.curve($$.getCurve(d))(values));
|
9391 | } else values[0] && (x0 = x(values[0].x), y0 = y(values[0].value)), path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
9392 |
|
9393 | return path || "M 0 0";
|
9394 | };
|
9395 | },
|
9396 | generateGetLinePoints: function generateGetLinePoints(lineIndices, isSubValue) {
|
9397 |
|
9398 | var $$ = this,
|
9399 | config = $$.config,
|
9400 | isSub = !!isSubValue,
|
9401 | x = $$.getShapeX(0, lineIndices, isSub),
|
9402 | y = $$.getShapeY(isSub),
|
9403 | lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub),
|
9404 | yScale = isSub ? $$.getSubYScale : $$.getYScale;
|
9405 | return function (d, i) {
|
9406 | var y0 = yScale.call($$, d.id)(0),
|
9407 | offset = lineOffset(d, i) || y0,
|
9408 | posX = x(d),
|
9409 | posY = y(d);
|
9410 | config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY) && (posY = y0);
|
9411 |
|
9412 | var point = [posX, posY - (y0 - offset)];
|
9413 | return [point, point,
|
9414 | point, point];
|
9415 | };
|
9416 | },
|
9417 | lineWithRegions: function lineWithRegions(d, x, y, _regions) {
|
9418 | var xp,
|
9419 | yp,
|
9420 | diff,
|
9421 | diffx2,
|
9422 | $$ = this,
|
9423 | config = $$.config,
|
9424 | isRotated = config.axis_rotated,
|
9425 | isTimeSeries = $$.isTimeSeries(),
|
9426 | xOffset = $$.isCategorized() ? .5 : 0,
|
9427 | regions = [],
|
9428 | dasharray = "2 2",
|
9429 | isWithinRegions = function (withinX, withinRegions) {
|
9430 | for (var reg, i = 0; reg = withinRegions[i]; i++) if (reg.start < withinX && withinX <= reg.end) return reg.style;
|
9431 |
|
9432 | return !1;
|
9433 | };
|
9434 |
|
9435 |
|
9436 | if (isDefined(_regions)) {
|
9437 | var getValue = function (v, def) {
|
9438 | return isUndefined(v) ? def : isTimeSeries ? $$.parseDate(v) : v;
|
9439 | };
|
9440 |
|
9441 | for (var reg, i = 0; reg = _regions[i]; i++) {
|
9442 | var start = getValue(reg.start, d[0].x),
|
9443 | end = getValue(reg.end, d[d.length - 1].x),
|
9444 | style = reg.style || {
|
9445 | dasharray: dasharray
|
9446 | };
|
9447 | regions[i] = {
|
9448 | start: start,
|
9449 | end: end,
|
9450 | style: style
|
9451 | };
|
9452 | }
|
9453 | }
|
9454 |
|
9455 |
|
9456 | var xValue = isRotated ? function (dt) {
|
9457 | return y(dt.value);
|
9458 | } : function (dt) {
|
9459 | return x(dt.x);
|
9460 | },
|
9461 | yValue = isRotated ? function (dt) {
|
9462 | return x(dt.x);
|
9463 | } : function (dt) {
|
9464 | return y(dt.value);
|
9465 | },
|
9466 | generateM = function (points) {
|
9467 | return "M".concat(points[0][0], ",").concat(points[0][1], "L").concat(points[1][0], ",").concat(points[1][1]);
|
9468 | },
|
9469 | sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) {
|
9470 | var x0 = d0.x.getTime(),
|
9471 | xDiff = d1.x - d0.x,
|
9472 | xv0 = new Date(x0 + xDiff * k),
|
9473 | xv1 = new Date(x0 + xDiff * (k + timeseriesDiff)),
|
9474 | points = isRotated ? [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] : [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
|
9475 | return generateM(points);
|
9476 | } : function (d0, d1, k, otherDiff) {
|
9477 | 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))]];
|
9478 | return generateM(points);
|
9479 | },
|
9480 | path = "";
|
9481 |
|
9482 | for (var data, _i = 0; data = d[_i]; _i++) {
|
9483 | var prevData = d[_i - 1],
|
9484 | hasPrevData = prevData && isValue(prevData.value),
|
9485 | style = isWithinRegions(data.x, regions);
|
9486 |
|
9487 | if (isValue(data.value))
|
9488 | if (isUndefined(regions) || !style || !hasPrevData) path += "".concat(_i && hasPrevData ? "L" : "M").concat(xValue(data), ",").concat(yValue(data));else if (hasPrevData) {
|
9489 | try {
|
9490 | style = style.dasharray.split(" ");
|
9491 | } catch (e) {
|
9492 | style = dasharray.split(" ");
|
9493 | }
|
9494 |
|
9495 |
|
9496 | xp = $$.getScale(prevData.x + xOffset, data.x + xOffset, isTimeSeries), yp = $$.getScale(prevData.value, data.value);
|
9497 | var dx = x(data.x) - x(prevData.x),
|
9498 | dy = y(data.value) - y(prevData.value),
|
9499 | dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
|
9500 | diff = style[0] / dd, diffx2 = diff * style[1];
|
9501 |
|
9502 | for (var _j = diff; _j <= 1; _j += diffx2) path += sWithRegion(prevData, data, _j, diff), _j + diffx2 >= 1 && (path += sWithRegion(prevData, data, 1, 0));
|
9503 | }
|
9504 | }
|
9505 |
|
9506 | return path;
|
9507 | },
|
9508 | updateAreaGradient: function updateAreaGradient() {
|
9509 | var $$ = this;
|
9510 | $$.data.targets.forEach(function (d) {
|
9511 | var id = "".concat($$.datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id));
|
9512 |
|
9513 | if ($$.isAreaType(d) && $$.defs.select("#".concat(id)).empty()) {
|
9514 | var color = $$.color(d),
|
9515 | _$$$config$area_linea = $$.config.area_linearGradient,
|
9516 | _$$$config$area_linea2 = _$$$config$area_linea.x,
|
9517 | x = _$$$config$area_linea2 === void 0 ? [0, 0] : _$$$config$area_linea2,
|
9518 | _$$$config$area_linea3 = _$$$config$area_linea.y,
|
9519 | y = _$$$config$area_linea3 === void 0 ? [0, 1] : _$$$config$area_linea3,
|
9520 | _$$$config$area_linea4 = _$$$config$area_linea.stops,
|
9521 | stops = _$$$config$area_linea4 === void 0 ? [[0, color, 1], [1, color, 0]] : _$$$config$area_linea4,
|
9522 | linearGradient = $$.defs.append("linearGradient").attr("id", "".concat(id)).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
9523 | stops.forEach(function (v) {
|
9524 | var stopColor = isFunction(v[1]) ? v[1](d.id) : v[1];
|
9525 | linearGradient.append("stop").attr("offset", v[0]).attr("stop-color", stopColor || color).attr("stop-opacity", v[2]);
|
9526 | });
|
9527 | }
|
9528 | });
|
9529 | },
|
9530 | updateAreaColor: function updateAreaColor(d) {
|
9531 | var $$ = this;
|
9532 | return $$.config.area_linearGradient ? "url(#".concat($$.datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id), ")") : $$.color(d);
|
9533 | },
|
9534 | updateArea: function updateArea(durationForExit) {
|
9535 | var $$ = this;
|
9536 | $$.config.area_linearGradient && $$.updateAreaGradient(), $$.mainArea = $$.main.selectAll(".".concat(config_classes.areas)).selectAll(".".concat(config_classes.area)).data($$.lineData.bind($$)), $$.mainArea.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.mainArea = $$.mainArea.enter().append("path").attr("class", $$.classArea.bind($$)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () {
|
9537 | return $$.orgAreaOpacity = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).style("opacity"), "0";
|
9538 | }).merge($$.mainArea), $$.mainArea.style("opacity", $$.orgAreaOpacity);
|
9539 | },
|
9540 | redrawArea: function redrawArea(drawArea, withTransition) {
|
9541 | var $$ = this;
|
9542 | return [(withTransition ? $$.mainArea.transition(getRandom()) : $$.mainArea).attr("d", drawArea).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function (d) {
|
9543 | return ($$.isAreaRangeType(d) ? $$.orgAreaOpacity / 1.75 : $$.orgAreaOpacity) + "";
|
9544 | })];
|
9545 | },
|
9546 |
|
9547 | |
9548 |
|
9549 |
|
9550 |
|
9551 |
|
9552 |
|
9553 |
|
9554 | generateDrawArea: function generateDrawArea(areaIndices, isSub) {
|
9555 | var $$ = this,
|
9556 | config = $$.config,
|
9557 | lineConnectNull = config.line_connectNull,
|
9558 | isRotated = config.axis_rotated,
|
9559 | getPoints = $$.generateGetAreaPoints(areaIndices, isSub),
|
9560 | yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,
|
9561 | xValue = function (d) {
|
9562 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
9563 | },
|
9564 | value0 = function (d, i) {
|
9565 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.isAreaRangeType(d) ? $$.getAreaRangeData(d, "high") : 0);
|
9566 | },
|
9567 | value1 = function (d, i) {
|
9568 | return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)($$.isAreaRangeType(d) ? $$.getAreaRangeData(d, "low") : d.value);
|
9569 | };
|
9570 |
|
9571 | return function (d) {
|
9572 | var path,
|
9573 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
9574 | x0 = 0,
|
9575 | y0 = 0;
|
9576 |
|
9577 | if ($$.isAreaType(d)) {
|
9578 | var area = Object(external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_["area"])();
|
9579 | area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1), lineConnectNull || (area = area.defined(function (d) {
|
9580 | return $$.getBaseValue(d) !== null;
|
9581 | })), $$.isStepType(d) && (values = $$.convertValuesToStep(values)), path = area.curve($$.getCurve(d))(values);
|
9582 | } else values[0] && (x0 = $$.x(values[0].x), y0 = $$.getYScale(d.id)(values[0].value)), path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
9583 |
|
9584 | return path || "M 0 0";
|
9585 | };
|
9586 | },
|
9587 | generateGetAreaPoints: function generateGetAreaPoints(areaIndices, isSub) {
|
9588 |
|
9589 | var $$ = this,
|
9590 | config = $$.config,
|
9591 | x = $$.getShapeX(0, areaIndices, !!isSub),
|
9592 | y = $$.getShapeY(!!isSub),
|
9593 | areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, !!isSub),
|
9594 | yScale = isSub ? $$.getSubYScale : $$.getYScale;
|
9595 | return function (d, i) {
|
9596 | var y0 = yScale.call($$, d.id)(0),
|
9597 | offset = areaOffset(d, i) || y0,
|
9598 | posX = x(d),
|
9599 | posY = y(d);
|
9600 |
|
9601 | 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)],
|
9602 | [posX, offset]
|
9603 | ];
|
9604 | };
|
9605 | },
|
9606 | updateCircle: function updateCircle() {
|
9607 | var $$ = this;
|
9608 |
|
9609 | if ($$.config.point_show) {
|
9610 | $$.mainCircle = $$.main.selectAll(".".concat(config_classes.circles)).selectAll(".".concat(config_classes.circle)).data(function (d) {
|
9611 | return !$$.isBarType(d) && (!$$.isLineType(d) || $$.shouldDrawPointsForLine(d)) && $$.labelishData(d);
|
9612 | }), $$.mainCircle.exit().remove();
|
9613 | var fn = $$.point("create", this, $$.pointR.bind($$), $$.color);
|
9614 | $$.mainCircle = $$.mainCircle.enter().append(fn).merge($$.mainCircle).style("stroke", $$.color).style("opacity", $$.initialOpacityForCircle.bind($$));
|
9615 | }
|
9616 | },
|
9617 | redrawCircle: function redrawCircle(cx, cy, withTransition, flow) {
|
9618 | var $$ = this,
|
9619 | selectedCircles = $$.main.selectAll(".".concat(config_classes.selectedCircle));
|
9620 | if (!$$.config.point_show) return [];
|
9621 | var mainCircles = [];
|
9622 | $$.mainCircle.each(function (d) {
|
9623 | var fn = $$.point("update", $$, cx, cy, $$.opacityForCircle.bind($$), $$.color, withTransition, flow, selectedCircles).bind(this),
|
9624 | result = fn(d);
|
9625 | mainCircles.push(result);
|
9626 | });
|
9627 | var posAttr = $$.isCirclePoint() ? "c" : "";
|
9628 | return [mainCircles, selectedCircles.attr("".concat(posAttr, "x"), cx).attr("".concat(posAttr, "y"), cy)];
|
9629 | },
|
9630 | circleX: function circleX(d) {
|
9631 | var $$ = this,
|
9632 | hasValue = isValue(d.x);
|
9633 | return $$.config.zoom_enabled && $$.zoomScale ? hasValue ? $$.zoomScale(d.x) : null : hasValue ? $$.x(d.x) : null;
|
9634 | },
|
9635 | updateCircleY: function updateCircleY() {
|
9636 | var $$ = this,
|
9637 | getPoints = $$.generateGetLinePoints($$.getShapeIndices($$.isLineType), !1);
|
9638 |
|
9639 | $$.circleY = function (d, i) {
|
9640 | var id = d.id;
|
9641 | return $$.isGrouped(id) ? getPoints(d, i)[0][1] : $$.getYScale(id)($$.getBaseValue(d));
|
9642 | };
|
9643 | },
|
9644 | getCircles: function getCircles(i, id) {
|
9645 | var $$ = this,
|
9646 | suffix = isValue(i) ? "-".concat(i) : "";
|
9647 | return (id ? $$.main.selectAll(".".concat(config_classes.circles).concat($$.getTargetSelectorSuffix(id))) : $$.main).selectAll(".".concat(config_classes.circle).concat(suffix));
|
9648 | },
|
9649 | expandCircles: function expandCircles(i, id, reset) {
|
9650 | var $$ = this,
|
9651 | r = $$.pointExpandedR.bind($$);
|
9652 | reset && $$.unexpandCircles();
|
9653 | var circles = $$.getCircles(i, id).classed(config_classes.EXPANDED, !0),
|
9654 | scale = r(circles) / $$.config.point_r,
|
9655 | ratio = 1 - scale;
|
9656 | $$.isCirclePoint() ? circles.attr("r", r) : circles.each(function () {
|
9657 | var point = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this);
|
9658 | if (this.tagName === "circle") point.attr("r", r);else {
|
9659 | var _this$getBBox = this.getBBox(),
|
9660 | width = _this$getBBox.width,
|
9661 | height = _this$getBBox.height,
|
9662 | x = ratio * (+point.attr("x") + width / 2),
|
9663 | y = ratio * (+point.attr("y") + height / 2);
|
9664 |
|
9665 | point.attr("transform", "translate(".concat(x, " ").concat(y, ") scale(").concat(scale, ")"));
|
9666 | }
|
9667 | });
|
9668 | },
|
9669 | unexpandCircles: function unexpandCircles(i) {
|
9670 | var $$ = this,
|
9671 | r = $$.pointR.bind($$),
|
9672 | circles = $$.getCircles(i).filter(function () {
|
9673 | return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.EXPANDED);
|
9674 | }).classed(config_classes.EXPANDED, !1);
|
9675 | circles.attr("r", r), $$.isCirclePoint() || circles.attr("transform", "scale(".concat(r(circles) / $$.config.point_r, ")"));
|
9676 | },
|
9677 | pointR: function (d) {
|
9678 | var $$ = this,
|
9679 | config = $$.config,
|
9680 | pointR = config.point_r,
|
9681 | r = pointR;
|
9682 | return $$.isStepType(d) ? r = 0 : $$.isBubbleType(d) ? r = $$.getBubbleR(d) : isFunction(pointR) && (r = pointR(d)), r;
|
9683 | },
|
9684 | pointExpandedR: function pointExpandedR(d) {
|
9685 | var $$ = this,
|
9686 | config = $$.config,
|
9687 | scale = $$.isBubbleType(d) ? 1.15 : 1.75;
|
9688 | return config.point_focus_expand_enabled ? config.point_focus_expand_r || $$.pointR(d) * scale : $$.pointR(d);
|
9689 | },
|
9690 | pointSelectR: function pointSelectR(d) {
|
9691 | var $$ = this,
|
9692 | selectR = $$.config.point_select_r;
|
9693 | return isFunction(selectR) ? selectR(d) : selectR || $$.pointR(d) * 4;
|
9694 | },
|
9695 | isWithinCircle: function isWithinCircle(node, r) {
|
9696 | var mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(node),
|
9697 | element = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(node),
|
9698 | prefix = this.isCirclePoint() ? "c" : "",
|
9699 | cx = +element.attr("".concat(prefix, "x")),
|
9700 | cy = +element.attr("".concat(prefix, "y"));
|
9701 |
|
9702 |
|
9703 | if (!(cx || cy) && node.nodeType === 1) {
|
9704 | var _ref = node.getBBox ? node.getBBox() : node.getBoundingClientRect(),
|
9705 | x = _ref.x,
|
9706 | y = _ref.y;
|
9707 |
|
9708 | cx = x, cy = y;
|
9709 | }
|
9710 |
|
9711 | return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
|
9712 | },
|
9713 | isWithinStep: function isWithinStep(that, y) {
|
9714 | return Math.abs(y - Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(that)[1]) < 30;
|
9715 | },
|
9716 | shouldDrawPointsForLine: function shouldDrawPointsForLine(d) {
|
9717 | var linePoint = this.config.line_point;
|
9718 | return linePoint === !0 || isArray(linePoint) && linePoint.indexOf(d.id) !== -1;
|
9719 | }
|
9720 | });
|
9721 |
|
9722 |
|
9723 |
|
9724 |
|
9725 |
|
9726 |
|
9727 |
|
9728 |
|
9729 |
|
9730 |
|
9731 | extend(ChartInternal_ChartInternal.prototype, {
|
9732 | hasValidPointType: function hasValidPointType(type) {
|
9733 | return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type);
|
9734 | },
|
9735 | hasValidPointDrawMethods: function hasValidPointDrawMethods(type) {
|
9736 | var pointType = type || this.config.point_type;
|
9737 | return isObjectType(pointType) && isFunction(pointType.create) && isFunction(pointType.update);
|
9738 | },
|
9739 | insertPointInfoDefs: function insertPointInfoDefs(point, id) {
|
9740 | var $$ = this,
|
9741 | copyAttr = function (from, target) {
|
9742 | for (var name, attribs = from.attributes, i = 0; name = attribs[i]; i++) name = name.name, target.setAttribute(name, from.getAttribute(name));
|
9743 | },
|
9744 | doc = new DOMParser().parseFromString(point, "image/svg+xml"),
|
9745 | node = doc.documentElement,
|
9746 | clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].svg, node.nodeName.toLowerCase());
|
9747 |
|
9748 | if (clone.id = id, clone.style.fill = "inherit", clone.style.stroke = "inherit", copyAttr(node, clone), node.childNodes && node.childNodes.length) {
|
9749 | var parent = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(clone);
|
9750 | "innerHTML" in clone ? parent.html(node.innerHTML) : toArray(node.childNodes).forEach(function (v) {
|
9751 | copyAttr(v, parent.append(v.tagName).node());
|
9752 | });
|
9753 | }
|
9754 |
|
9755 | $$.defs.node().appendChild(clone);
|
9756 | },
|
9757 | pointFromDefs: function pointFromDefs(id) {
|
9758 | return this.defs.select("#".concat(id));
|
9759 | },
|
9760 | updatePointClass: function updatePointClass(d) {
|
9761 | var $$ = this,
|
9762 | pointClass = !1;
|
9763 | return (isObject(d) || $$.mainCircle) && (pointClass = d === !0 ? $$.mainCircle.each(function (d) {
|
9764 | var className = $$.classCircle.bind($$)(d);
|
9765 | this.getAttribute("class").indexOf(config_classes.EXPANDED) > -1 && (className += " ".concat(config_classes.EXPANDED)), this.setAttribute("class", className);
|
9766 | }) : $$.classCircle(d)), pointClass;
|
9767 | },
|
9768 | generatePoint: function generatePoint() {
|
9769 | var $$ = this,
|
9770 | config = $$.config,
|
9771 | ids = [],
|
9772 | pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
9773 | return function (method, context) {
|
9774 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
9775 |
|
9776 | return function (d) {
|
9777 | var id = d.id || d.data && d.data.id || d,
|
9778 | element = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this);
|
9779 | ids.indexOf(id) < 0 && ids.push(id);
|
9780 | var point = pattern[ids.indexOf(id) % pattern.length];
|
9781 | if ($$.hasValidPointType(point)) point = $$[point];else if (!$$.hasValidPointDrawMethods(point)) {
|
9782 | var pointId = "".concat($$.datetimeId, "-point-").concat(id),
|
9783 | pointFromDefs = $$.pointFromDefs(pointId);
|
9784 | if (pointFromDefs.size() < 1 && $$.insertPointInfoDefs(point, pointId), method === "create") return $$.custom.create.bind(context).apply(void 0, [element, pointId].concat(args));
|
9785 | if (method === "update") return $$.custom.update.bind(context).apply(void 0, [element].concat(args));
|
9786 | }
|
9787 | return point[method].bind(context).apply(void 0, [element].concat(args));
|
9788 | };
|
9789 | };
|
9790 | },
|
9791 | getTransitionName: function getTransitionName() {
|
9792 | return getRandom();
|
9793 | },
|
9794 | custom: {
|
9795 | create: function create(element, id, sizeFn, fillStyleFn) {
|
9796 | return element.append("use").attr("xlink:href", "#".concat(id)).attr("class", this.updatePointClass.bind(this)).style("fill", fillStyleFn).node();
|
9797 | },
|
9798 | update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
9799 | var $$ = this,
|
9800 | _element$node$getBBox = element.node().getBBox(),
|
9801 | width = _element$node$getBBox.width,
|
9802 | height = _element$node$getBBox.height,
|
9803 | xPosFn2 = function (d) {
|
9804 | return xPosFn(d) - width / 2;
|
9805 | },
|
9806 | mainCircles = element;
|
9807 |
|
9808 | if (withTransition) {
|
9809 | var transitionName = $$.getTransitionName();
|
9810 | flow && mainCircles.attr("x", xPosFn2), mainCircles = mainCircles.transition(transitionName), selectedCircles.transition($$.getTransitionName());
|
9811 | }
|
9812 |
|
9813 | return mainCircles.attr("x", xPosFn2).attr("y", function yPosFn2(d) {
|
9814 | return yPosFn(d) - height / 2;
|
9815 | }).style("opacity", opacityStyleFn).style("fill", fillStyleFn);
|
9816 | }
|
9817 | },
|
9818 |
|
9819 | circle: {
|
9820 | create: function create(element, sizeFn, fillStyleFn) {
|
9821 | return element.append("circle").attr("class", this.updatePointClass.bind(this)).attr("r", sizeFn).style("fill", fillStyleFn).node();
|
9822 | },
|
9823 | update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
9824 | var $$ = this,
|
9825 | mainCircles = element;
|
9826 |
|
9827 | if ($$.hasType("bubble") && mainCircles.attr("r", $$.pointR.bind($$)), withTransition) {
|
9828 | var transitionName = $$.getTransitionName();
|
9829 | flow && mainCircles.attr("cx", xPosFn), mainCircles.attr("cx") && (mainCircles = mainCircles.transition(transitionName)), selectedCircles.transition($$.getTransitionName());
|
9830 | }
|
9831 |
|
9832 | return mainCircles.attr("cx", xPosFn).attr("cy", yPosFn).style("opacity", opacityStyleFn).style("fill", fillStyleFn);
|
9833 | }
|
9834 | },
|
9835 |
|
9836 | rectangle: {
|
9837 | create: function create(element, sizeFn, fillStyleFn) {
|
9838 | var rectSizeFn = function (d) {
|
9839 | return sizeFn(d) * 2;
|
9840 | };
|
9841 |
|
9842 | return element.append("rect").attr("class", this.updatePointClass.bind(this)).attr("width", rectSizeFn).attr("height", rectSizeFn).style("fill", fillStyleFn).node();
|
9843 | },
|
9844 | update: function update(element, xPosFn, yPosFn, opacityStyleFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
9845 | var $$ = this,
|
9846 | r = $$.config.point_r,
|
9847 | rectXPosFn = function (d) {
|
9848 | return xPosFn(d) - r;
|
9849 | },
|
9850 | mainCircles = element;
|
9851 |
|
9852 | if (withTransition) {
|
9853 | var transitionName = $$.getTransitionName();
|
9854 | flow && mainCircles.attr("x", rectXPosFn), mainCircles = mainCircles.transition(transitionName), selectedCircles.transition($$.getTransitionName());
|
9855 | }
|
9856 |
|
9857 | return mainCircles.attr("x", rectXPosFn).attr("y", function rectYPosFn(d) {
|
9858 | return yPosFn(d) - r;
|
9859 | }).style("opacity", opacityStyleFn).style("fill", fillStyleFn);
|
9860 | }
|
9861 | }
|
9862 | });
|
9863 |
|
9864 |
|
9865 |
|
9866 |
|
9867 |
|
9868 |
|
9869 |
|
9870 |
|
9871 |
|
9872 |
|
9873 |
|
9874 |
|
9875 |
|
9876 |
|
9877 |
|
9878 |
|
9879 |
|
9880 |
|
9881 |
|
9882 |
|
9883 |
|
9884 |
|
9885 |
|
9886 | function getPosition(isClockwise, type, edge, pos, range, ratio) {
|
9887 | var index = isClockwise && pos > 0 ? edge - pos : pos,
|
9888 | r = 2 * Math.PI,
|
9889 | func = type === "x" ? Math.sin : Math.cos;
|
9890 | return range * (1 - ratio * func(index * r / edge));
|
9891 | }
|
9892 |
|
9893 |
|
9894 | var radar_cacheKey = "$radarPoints";
|
9895 | extend(ChartInternal_ChartInternal.prototype, {
|
9896 | initRadar: function initRadar() {
|
9897 | var $$ = this,
|
9898 | config = $$.config;
|
9899 | $$.hasType("radar") && ($$.radars = $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartRadars), $$.radars.levels = $$.radars.append("g").attr("class", config_classes.levels), $$.radars.axes = $$.radars.append("g").attr("class", config_classes.axis), $$.radars.shapes = $$.radars.append("g").attr("class", config_classes.shapes), $$.maxValue = config.radar_axis_max || $$.getMinMaxData().max[0].value);
|
9900 | },
|
9901 | getRadarSize: function getRadarSize() {
|
9902 | var $$ = this,
|
9903 | config = $$.config,
|
9904 | padding = config.axis_x_categories.length < 4 ? -20 : 10,
|
9905 | size = (Math.min($$.arcWidth, $$.arcHeight) - padding) / 2;
|
9906 | return [size, size];
|
9907 | },
|
9908 | updateTargetsForRadar: function updateTargetsForRadar(targets) {
|
9909 | var $$ = this,
|
9910 | config = $$.config;
|
9911 | isEmpty(config.axis_x_categories) && (config.axis_x_categories = getRange(0, getMinMax("max", targets.map(function (v) {
|
9912 | return v.values.length;
|
9913 | })))), $$.generateRadarPoints();
|
9914 | },
|
9915 | getRadarPosition: function getRadarPosition(type, index, range, ratio) {
|
9916 | var $$ = this,
|
9917 | config = $$.config,
|
9918 | _$$$getRadarSize = $$.getRadarSize(),
|
9919 | _$$$getRadarSize2 = _slicedToArray(_$$$getRadarSize, 2),
|
9920 | width = _$$$getRadarSize2[0],
|
9921 | height = _$$$getRadarSize2[1],
|
9922 | edge = config.axis_x_categories.length,
|
9923 | isClockwise = config.radar_direction_clockwise,
|
9924 | pos = toArray(type).map(function (v) {
|
9925 | return getPosition(isClockwise, v, edge, index, isDefined(range) ? range : type === "x" ? width : height, isNumber(ratio) ? ratio : config.radar_size_ratio);
|
9926 | });
|
9927 |
|
9928 | return pos.length === 1 ? pos[0] : pos;
|
9929 | },
|
9930 |
|
9931 | |
9932 |
|
9933 |
|
9934 |
|
9935 | generateRadarPoints: function generateRadarPoints() {
|
9936 | var $$ = this,
|
9937 | targets = $$.data.targets,
|
9938 | _$$$getRadarSize3 = $$.getRadarSize(),
|
9939 | _$$$getRadarSize4 = _slicedToArray(_$$$getRadarSize3, 2),
|
9940 | width = _$$$getRadarSize4[0],
|
9941 | height = _$$$getRadarSize4[1],
|
9942 | points = $$.getCache(radar_cacheKey) || {},
|
9943 | size = points._size;
|
9944 |
|
9945 | size && (size.width === width || size.height === height) || (targets.forEach(function (d) {
|
9946 | points[d.id] = d.values.map(function (v, i) {
|
9947 | return $$.getRadarPosition(["x", "y"], i, undefined, $$.getRatio("radar", v));
|
9948 | });
|
9949 | }), points._size = {
|
9950 | width: width,
|
9951 | height: height
|
9952 | }, $$.addCache(radar_cacheKey, points));
|
9953 | },
|
9954 | redrawRadar: function redrawRadar(durationForExit) {
|
9955 | var $$ = this,
|
9956 | translate = $$.getTranslate("radar");
|
9957 | translate && ($$.radars.attr("transform", translate), $$.main.selectAll(".".concat(config_classes.circles)).attr("transform", translate), $$.main.select(".".concat(config_classes.chartTexts)).attr("transform", translate), $$.generateRadarPoints(), $$.updateRadarLevel(), $$.updateRadarAxes(), $$.updateRadarShape(durationForExit));
|
9958 | },
|
9959 | generateGetRadarPoints: function generateGetRadarPoints() {
|
9960 | var $$ = this,
|
9961 | points = $$.getCache(radar_cacheKey);
|
9962 | return function (d, i) {
|
9963 | var point = points[d.id][i];
|
9964 | return [point, point, point, point];
|
9965 | };
|
9966 | },
|
9967 | updateRadarLevel: function updateRadarLevel() {
|
9968 | var $$ = this,
|
9969 | config = $$.config,
|
9970 | _$$$getRadarSize5 = $$.getRadarSize(),
|
9971 | _$$$getRadarSize6 = _slicedToArray(_$$$getRadarSize5, 2),
|
9972 | width = _$$$getRadarSize6[0],
|
9973 | height = _$$$getRadarSize6[1],
|
9974 | depth = config.radar_level_depth,
|
9975 | edge = config.axis_x_categories.length,
|
9976 | showText = config.radar_level_text_show,
|
9977 | radarLevels = $$.radars.levels,
|
9978 | levelData = getRange(0, depth),
|
9979 | radius = config.radar_size_ratio * Math.min(width, height),
|
9980 | levelRatio = levelData.map(function (l) {
|
9981 | return radius * ((l + 1) / depth);
|
9982 | }),
|
9983 | levelTextFormat = config.radar_level_text_format,
|
9984 | points = levelData.map(function (v) {
|
9985 | var range = levelRatio[v],
|
9986 | pos = getRange(0, edge).map(function (i) {
|
9987 | return $$.getRadarPosition(["x", "y"], i, range, 1).join(",");
|
9988 | });
|
9989 | return pos.join(" ");
|
9990 | }),
|
9991 | level = radarLevels.selectAll(".".concat(config_classes.level)).data(levelData);
|
9992 |
|
9993 | level.exit().remove();
|
9994 | var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
9995 | return "".concat(config_classes.level, " ").concat(config_classes.level, "-").concat(i);
|
9996 | });
|
9997 | 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 () {
|
9998 | return levelTextFormat(0);
|
9999 | }), levelEnter.append("text").attr("dx", "-.5em").style("text-anchor", "end").text(function (d) {
|
10000 | return levelTextFormat($$.maxValue / levelData.length * (d + 1));
|
10001 | })), levelEnter.merge(level).attr("transform", function (d) {
|
10002 | return "translate(".concat(width - levelRatio[d], ", ").concat(height - levelRatio[d], ")");
|
10003 | }).selectAll("polygon").attr("points", function (d) {
|
10004 | return points[d];
|
10005 | }), showText && radarLevels.selectAll("text").attr("x", function (d) {
|
10006 | return isUndefined(d) ? width : points[d].split(",")[0];
|
10007 | }).attr("y", function (d) {
|
10008 | return isUndefined(d) ? height : 0;
|
10009 | });
|
10010 | },
|
10011 | updateRadarAxes: function updateRadarAxes() {
|
10012 | var $$ = this,
|
10013 | config = $$.config,
|
10014 | _$$$getRadarSize7 = $$.getRadarSize(),
|
10015 | _$$$getRadarSize8 = _slicedToArray(_$$$getRadarSize7, 2),
|
10016 | width = _$$$getRadarSize8[0],
|
10017 | height = _$$$getRadarSize8[1],
|
10018 | categories = config.axis_x_categories,
|
10019 | axis = $$.radars.axes.selectAll("g").data(categories);
|
10020 |
|
10021 | axis.exit().remove();
|
10022 | var axisEnter = axis.enter().append("g").attr("class", function (d, i) {
|
10023 | return "".concat(config_classes.axis, "-").concat(i);
|
10024 | });
|
10025 |
|
10026 |
|
10027 | 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) {
|
10028 | return $$.getRadarPosition("x", i);
|
10029 | }).attr("y2", function (d, i) {
|
10030 | return $$.getRadarPosition("y", i);
|
10031 | }), config.radar_axis_text_show) {
|
10032 | var _config$radar_axis_te = config.radar_axis_text_position,
|
10033 | _config$radar_axis_te2 = _config$radar_axis_te.x,
|
10034 | x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2,
|
10035 | _config$radar_axis_te3 = _config$radar_axis_te.y,
|
10036 | y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3;
|
10037 | axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
|
10038 | selection.each(function (d) {
|
10039 | setTextValue(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this), d + "", [-.6, 1.2]);
|
10040 | });
|
10041 | }).datum(function (d, i) {
|
10042 | return {
|
10043 | index: i
|
10044 | };
|
10045 | }).attr("transform", function (d) {
|
10046 | isUndefined(this.width) && (this.width = this.getBoundingClientRect().width / 2);
|
10047 | var posX = $$.getRadarPosition("x", d.index, undefined, 1),
|
10048 | posY = Math.round($$.getRadarPosition("y", d.index, undefined, 1));
|
10049 | 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(".concat(posX, " ").concat(posY, ")");
|
10050 | });
|
10051 | }
|
10052 |
|
10053 | $$.bindEvent();
|
10054 | },
|
10055 | bindEvent: function bindEvent() {
|
10056 | var _this = this,
|
10057 | $$ = this,
|
10058 | config = $$.config;
|
10059 |
|
10060 | if (config.interaction_enabled) {
|
10061 | var isMouse = $$.inputType === "mouse",
|
10062 | getIndex = function () {
|
10063 | var target = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].target;
|
10064 |
|
10065 | /tspan/i.test(target.tagName) && (target = target.parentNode);
|
10066 | var d = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(target).datum();
|
10067 | return d && Object.keys(d).length === 1 ? d.index : undefined;
|
10068 | },
|
10069 | hide = function () {
|
10070 | var index = getIndex(),
|
10071 | noIndex = isUndefined(index);
|
10072 | (isMouse || noIndex) && (_this.hideTooltip(), _this.unexpandCircles(), isMouse ? $$.setOverOut(!1, index) : noIndex && $$.callOverOutForTouch());
|
10073 | };
|
10074 |
|
10075 | $$.radars.select(".".concat(config_classes.axis)).on(isMouse ? "mouseover " : "touchstart", function () {
|
10076 | if (!$$.transiting)
|
10077 | {
|
10078 | var index = getIndex();
|
10079 | $$.selectRectForSingle($$.svg.node(), null, index), isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
|
10080 | }
|
10081 | }).on("mouseout", isMouse ? hide : null), isMouse || $$.svg.on("touchstart", hide);
|
10082 | }
|
10083 | },
|
10084 | updateRadarShape: function updateRadarShape(durationForExit) {
|
10085 | var $$ = this,
|
10086 | targets = $$.data.targets,
|
10087 | points = $$.getCache(radar_cacheKey),
|
10088 | areas = $$.radars.shapes.selectAll("polygon").data(targets),
|
10089 | areasEnter = areas.enter().append("g").attr("class", $$.classChartRadar.bind($$));
|
10090 | areas.exit().transition().duration(durationForExit).remove(), areasEnter.append("polygon").merge(areas).style("fill", $$.color).style("stroke", $$.color).attr("points", function (d) {
|
10091 | return points[d.id].join(" ");
|
10092 | });
|
10093 | },
|
10094 |
|
10095 | |
10096 |
|
10097 |
|
10098 |
|
10099 |
|
10100 |
|
10101 | radarCircleX: function radarCircleX(d) {
|
10102 | return this.getCache(radar_cacheKey)[d.id][d.index][0];
|
10103 | },
|
10104 |
|
10105 | |
10106 |
|
10107 |
|
10108 |
|
10109 |
|
10110 |
|
10111 | radarCircleY: function radarCircleY(d) {
|
10112 | return this.getCache(radar_cacheKey)[d.id][d.index][1];
|
10113 | }
|
10114 | });
|
10115 |
|
10116 |
|
10117 |
|
10118 |
|
10119 |
|
10120 |
|
10121 |
|
10122 |
|
10123 |
|
10124 | extend(ChartInternal_ChartInternal.prototype, {
|
10125 | |
10126 |
|
10127 |
|
10128 |
|
10129 | initText: function initText() {
|
10130 | var $$ = this;
|
10131 | $$.main.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartTexts), $$.mainText = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]);
|
10132 | },
|
10133 |
|
10134 | |
10135 |
|
10136 |
|
10137 |
|
10138 |
|
10139 | updateTargetsForText: function updateTargetsForText(targets) {
|
10140 | var $$ = this,
|
10141 | classChartText = $$.classChartText.bind($$),
|
10142 | classTexts = $$.classTexts.bind($$),
|
10143 | classFocus = $$.classFocus.bind($$),
|
10144 | mainTextUpdate = $$.main.select(".".concat(config_classes.chartTexts)).selectAll(".".concat(config_classes.chartText)).data(targets).attr("class", function (d) {
|
10145 | return classChartText(d) + classFocus(d);
|
10146 | }),
|
10147 | mainTextEnter = mainTextUpdate.enter().append("g").attr("class", classChartText).style("opacity", "0").style("pointer-events", "none");
|
10148 | mainTextEnter.append("g").attr("class", classTexts);
|
10149 | },
|
10150 |
|
10151 | |
10152 |
|
10153 |
|
10154 |
|
10155 |
|
10156 | updateText: function updateText(durationForExit) {
|
10157 | var _this = this,
|
10158 | $$ = this,
|
10159 | config = $$.config,
|
10160 | dataFn = $$.labelishData.bind($$),
|
10161 | classText = $$.classText.bind($$);
|
10162 |
|
10163 | $$.mainText = $$.main.selectAll(".".concat(config_classes.texts)).selectAll(".".concat(config_classes.text)).data(function (d) {
|
10164 | return _this.isRadarType(d) ? d.values : dataFn(d);
|
10165 | }), $$.mainText.exit().transition().duration(durationForExit).style("fill-opacity", "0").remove(), $$.mainText = $$.mainText.enter().append("text").merge($$.mainText).attr("class", classText).attr("text-anchor", function (d) {
|
10166 | return config.axis_rotated ? d.value < 0 ? "end" : "start" : "middle";
|
10167 | }).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", "0").text(function (d, i, j) {
|
10168 | var value = $$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "z") : d.value;
|
10169 | return $$.dataLabelFormat(d.id)(value, d.id, i, j);
|
10170 | });
|
10171 | },
|
10172 | updateTextColor: function updateTextColor(d) {
|
10173 | var color,
|
10174 | $$ = this,
|
10175 | labelColors = $$.config.data_labels_colors;
|
10176 | return isString(labelColors) ? color = labelColors : isObject(labelColors) && (color = labelColors[d.id]), color || $$.color(d);
|
10177 | },
|
10178 |
|
10179 | |
10180 |
|
10181 |
|
10182 |
|
10183 |
|
10184 |
|
10185 |
|
10186 |
|
10187 | redrawText: function redrawText(x, y, forFlow, withTransition) {
|
10188 | var $$ = this,
|
10189 | t = getRandom(),
|
10190 | opacityForText = forFlow ? 0 : $$.opacityForText.bind($$);
|
10191 | return [$$.mainText.each(function (d, i) {
|
10192 | var text = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this);
|
10193 |
|
10194 | (withTransition && text.attr("x") ? text.transition(t) : text).attr("x", x.bind(this)(d, i)).attr("y", y.bind(this)(d, i)).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", opacityForText);
|
10195 | })];
|
10196 | },
|
10197 |
|
10198 | |
10199 |
|
10200 |
|
10201 |
|
10202 |
|
10203 |
|
10204 |
|
10205 | getTextRect: function getTextRect(element, className) {
|
10206 | var $$ = this,
|
10207 | base = element.node ? element.node() : element;
|
10208 | /text/i.test(base.tagName) || (base = base.querySelector("text"));
|
10209 | var text = base.textContent,
|
10210 | cacheKey = "$".concat(text.replace(/\W/g, "_")),
|
10211 | rect = $$.getCache(cacheKey);
|
10212 | return rect || ($$.svg.append("text").style("visibility", "hidden").style("font", Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(base).style("font")).classed(className, !0).text(text).call(function (v) {
|
10213 | rect = getBoundingRect(v.node());
|
10214 | }).remove(), $$.addCache(cacheKey, rect)), rect;
|
10215 | },
|
10216 |
|
10217 | |
10218 |
|
10219 |
|
10220 |
|
10221 |
|
10222 |
|
10223 |
|
10224 | generateXYForText: function generateXYForText(indices, forX) {
|
10225 | var $$ = this,
|
10226 | types = Object.keys(indices),
|
10227 | points = {},
|
10228 | getter = forX ? $$.getXForText : $$.getYForText;
|
10229 | return $$.hasType("radar") && types.push("radar"), types.forEach(function (v) {
|
10230 | points[v] = $$["generateGet".concat(capitalize(v), "Points")](indices[v], !1);
|
10231 | }), function (d, i) {
|
10232 | var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isRadarType(d) && "radar" || "line";
|
10233 | return getter.call($$, points[type](d, i), d, this);
|
10234 | };
|
10235 | },
|
10236 |
|
10237 | |
10238 |
|
10239 |
|
10240 |
|
10241 |
|
10242 |
|
10243 |
|
10244 |
|
10245 | getCenteredTextPos: function getCenteredTextPos(d, points, textElement) {
|
10246 | var $$ = this,
|
10247 | config = $$.config,
|
10248 | isRotated = config.axis_rotated;
|
10249 |
|
10250 | if (config.data_labels.centered && $$.isBarType(d)) {
|
10251 | var rect = getBoundingRect(textElement),
|
10252 | isPositive = d.value >= 0;
|
10253 |
|
10254 | if (isRotated) {
|
10255 | var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
10256 | return isPositive ? -w - 3 : w + 2;
|
10257 | }
|
10258 |
|
10259 | var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
10260 | return isPositive ? h : -h - 2;
|
10261 | }
|
10262 |
|
10263 | return 0;
|
10264 | },
|
10265 |
|
10266 | |
10267 |
|
10268 |
|
10269 |
|
10270 |
|
10271 |
|
10272 |
|
10273 | getTextPos: function getTextPos(id, type) {
|
10274 | var pos = this.config.data_labels_position;
|
10275 | return (id in pos ? pos[id] : pos)[type] || 0;
|
10276 | },
|
10277 |
|
10278 | |
10279 |
|
10280 |
|
10281 |
|
10282 |
|
10283 |
|
10284 |
|
10285 |
|
10286 | getXForText: function getXForText(points, d, textElement) {
|
10287 | var xPos,
|
10288 | padding,
|
10289 | $$ = this,
|
10290 | config = $$.config,
|
10291 | isRotated = config.axis_rotated;
|
10292 |
|
10293 | if (isRotated ? (padding = $$.isBarType(d) ? 4 : 6, xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1)) : xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : points[0][0], d.value === null) if (xPos > $$.width) {
|
10294 | var _getBoundingRect = getBoundingRect(textElement),
|
10295 | width = _getBoundingRect.width;
|
10296 |
|
10297 | xPos = $$.width - width;
|
10298 | } else xPos < 0 && (xPos = 4);
|
10299 | return isRotated && (xPos += $$.getCenteredTextPos(d, points, textElement)), xPos + $$.getTextPos(d.id, "x");
|
10300 | },
|
10301 |
|
10302 | |
10303 |
|
10304 |
|
10305 |
|
10306 |
|
10307 |
|
10308 |
|
10309 |
|
10310 | getYForText: function getYForText(points, d, textElement) {
|
10311 | var yPos,
|
10312 | $$ = this,
|
10313 | config = $$.config,
|
10314 | isRotated = config.axis_rotated,
|
10315 | r = config.point_r,
|
10316 | rect = getBoundingRect(textElement),
|
10317 | baseY = 3;
|
10318 | if (isRotated) yPos = (points[0][0] + points[2][0] + rect.height * .6) / 2;else if (yPos = points[2][1], isNumber(r) && r > 5 && ($$.isLineType(d) || $$.isScatterType(d)) && (baseY += config.point_r / 2.3), d.value < 0 || d.value === 0 && !$$.hasPositiveValue && $$.hasNegativeValue) yPos += rect.height + ($$.isBarType(d) ? -baseY : baseY);else {
|
10319 | var diff = -baseY * 2;
|
10320 | $$.isBarType(d) ? diff = -baseY : $$.isBubbleType(d) && (diff = baseY), yPos += diff;
|
10321 | }
|
10322 |
|
10323 | if (d.value === null && !isRotated) {
|
10324 | var boxHeight = rect.height;
|
10325 | yPos < boxHeight ? yPos = boxHeight : yPos > this.height && (yPos = this.height - 4);
|
10326 | }
|
10327 |
|
10328 | return isRotated || (yPos += $$.getCenteredTextPos(d, points, textElement)), yPos + $$.getTextPos(d.id, "y");
|
10329 | },
|
10330 |
|
10331 | |
10332 |
|
10333 |
|
10334 |
|
10335 |
|
10336 |
|
10337 |
|
10338 |
|
10339 | markOverlapped: function markOverlapped(id, $$, selector) {
|
10340 | var textNodes = $$.arcs.selectAll(selector),
|
10341 | filteredTextNodes = textNodes.filter(function (node) {
|
10342 | return node.data.id !== id;
|
10343 | }),
|
10344 | textNode = textNodes.filter(function (node) {
|
10345 | return node.data.id === id;
|
10346 | }),
|
10347 | translate = getTranslation(textNode.node()),
|
10348 | calcHypo = function (x, y) {
|
10349 | return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
10350 | };
|
10351 |
|
10352 | textNode.node() && filteredTextNodes.each(function () {
|
10353 | var coordinate = getTranslation(this),
|
10354 | filteredTextNode = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
10355 | nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode,
|
10356 | overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength()),
|
10357 | overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < parseInt(textNode.style("font-size"), 0);
|
10358 | filteredTextNode.classed(config_classes.TextOverlapping, overlapsX && overlapsY);
|
10359 | });
|
10360 | },
|
10361 |
|
10362 | |
10363 |
|
10364 |
|
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 | undoMarkOverlapped: function undoMarkOverlapped($$, selector) {
|
10370 | $$.arcs.selectAll(selector).each(function () {
|
10371 | Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([this, this.previousSibling]).classed(config_classes.TextOverlapping, !1);
|
10372 | });
|
10373 | }
|
10374 | });
|
10375 |
|
10376 |
|
10377 |
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 |
|
10383 | var TYPES = {
|
10384 | Area: ["area", "area-spline", "area-spline-range", "area-line-range", "area-step"],
|
10385 | AreaRange: ["area-spline-range", "area-line-range"],
|
10386 | Arc: ["pie", "donut", "gauge", "radar"],
|
10387 | Line: ["line", "spline", "area", "area-spline", "area-spline-range", "area-line-range", "step", "area-step"],
|
10388 | Step: ["step", "area-step"],
|
10389 | Spline: ["spline", "area-spline", "area-spline-range"]
|
10390 | };
|
10391 | extend(ChartInternal_ChartInternal.prototype, {
|
10392 | setTargetType: function setTargetType(targetIds, type) {
|
10393 | var $$ = this,
|
10394 | config = $$.config;
|
10395 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
10396 | $$.withoutFadeIn[id] = type === config.data_types[id], config.data_types[id] = type;
|
10397 | }), targetIds || (config.data_type = type);
|
10398 | },
|
10399 | hasType: function hasType(type, targetsValue) {
|
10400 | var $$ = this,
|
10401 | types = $$.config.data_types,
|
10402 | targets = targetsValue || $$.data.targets,
|
10403 | has = !1;
|
10404 | return targets && targets.length ? targets.forEach(function (target) {
|
10405 | var t = types[target.id];
|
10406 | (t && t.indexOf(type) >= 0 || !t && type === "line") && (has = !0);
|
10407 | }) : Object.keys(types).length ? Object.keys(types).forEach(function (id) {
|
10408 | types[id] === type && (has = !0);
|
10409 | }) : has = $$.config.data_type === type, has;
|
10410 | },
|
10411 |
|
10412 | |
10413 |
|
10414 |
|
10415 |
|
10416 |
|
10417 |
|
10418 |
|
10419 |
|
10420 | hasTypeOf: function hasTypeOf(type, targets) {
|
10421 | var _this = this,
|
10422 | exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
10423 |
|
10424 | return !TYPES[type].filter(function (v) {
|
10425 | return exclude.indexOf(v) === -1;
|
10426 | }).every(function (v) {
|
10427 | return !_this.hasType(v, targets);
|
10428 | });
|
10429 | },
|
10430 |
|
10431 | |
10432 |
|
10433 |
|
10434 |
|
10435 |
|
10436 |
|
10437 |
|
10438 | isTypeOf: function isTypeOf(d, type) {
|
10439 | var id = isString(d) ? d : d.id,
|
10440 | dataType = this.config.data_types[id];
|
10441 | return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
10442 | },
|
10443 |
|
10444 | |
10445 |
|
10446 |
|
10447 |
|
10448 |
|
10449 |
|
10450 |
|
10451 | hasArcType: function hasArcType(targets, exclude) {
|
10452 | return this.hasTypeOf("Arc", targets, exclude);
|
10453 | },
|
10454 | hasMultiArcGauge: function hasMultiArcGauge() {
|
10455 | return this.hasType("gauge") && this.config.gauge_type === "multi";
|
10456 | },
|
10457 | isLineType: function isLineType(d) {
|
10458 | var id = isString(d) ? d : d.id;
|
10459 | return !this.config.data_types[id] || this.isTypeOf(id, TYPES.Line);
|
10460 | },
|
10461 | isStepType: function isStepType(d) {
|
10462 | return this.isTypeOf(d, TYPES.Step);
|
10463 | },
|
10464 | isSplineType: function isSplineType(d) {
|
10465 | return this.isTypeOf(d, TYPES.Spline);
|
10466 | },
|
10467 | isAreaType: function isAreaType(d) {
|
10468 | return this.isTypeOf(d, TYPES.Area);
|
10469 | },
|
10470 | isAreaRangeType: function isAreaRangeType(d) {
|
10471 | return this.isTypeOf(d, TYPES.AreaRange);
|
10472 | },
|
10473 | isBarType: function isBarType(d) {
|
10474 | return this.isTypeOf(d, "bar");
|
10475 | },
|
10476 | isBubbleType: function isBubbleType(d) {
|
10477 | return this.isTypeOf(d, "bubble");
|
10478 | },
|
10479 | isScatterType: function isScatterType(d) {
|
10480 | return this.isTypeOf(d, "scatter");
|
10481 | },
|
10482 | isPieType: function isPieType(d) {
|
10483 | return this.isTypeOf(d, "pie");
|
10484 | },
|
10485 | isGaugeType: function isGaugeType(d) {
|
10486 | return this.isTypeOf(d, "gauge");
|
10487 | },
|
10488 | isDonutType: function isDonutType(d) {
|
10489 | return this.isTypeOf(d, "donut");
|
10490 | },
|
10491 | isRadarType: function isRadarType(d) {
|
10492 | return this.isTypeOf(d, "radar");
|
10493 | },
|
10494 | isArcType: function isArcType(d) {
|
10495 | return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
|
10496 | },
|
10497 |
|
10498 | isCirclePoint: function isCirclePoint() {
|
10499 | var config = this.config,
|
10500 | pattern = config.point_pattern;
|
10501 | return config.point_type === "circle" && (!pattern || isArray(pattern) && pattern.length === 0);
|
10502 | },
|
10503 | lineData: function lineData(d) {
|
10504 | return this.isLineType(d) ? [d] : [];
|
10505 | },
|
10506 | arcData: function arcData(d) {
|
10507 | return this.isArcType(d.data) ? [d] : [];
|
10508 | },
|
10509 | barData: function barData(d) {
|
10510 | return this.isBarType(d) ? d.values : [];
|
10511 | },
|
10512 |
|
10513 | |
10514 |
|
10515 |
|
10516 |
|
10517 |
|
10518 |
|
10519 | labelishData: function labelishData(d) {
|
10520 | return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isRadarType(d) ? d.values : [];
|
10521 | },
|
10522 | barLineBubbleData: function barLineBubbleData(d) {
|
10523 | return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
|
10524 | },
|
10525 |
|
10526 | isInterpolationType: function isInterpolationType(type) {
|
10527 | 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;
|
10528 | }
|
10529 | });
|
10530 |
|
10531 |
|
10532 |
|
10533 |
|
10534 |
|
10535 |
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 | var getGridTextAnchor = function (d) {
|
10541 | return isValue(d.position) || "end";
|
10542 | },
|
10543 | getGridTextDx = function (d) {
|
10544 | return d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
10545 | },
|
10546 | getGridTextX = function (isX, width, height) {
|
10547 | return function (d) {
|
10548 | var x = isX ? 0 : width;
|
10549 | return d.position === "start" ? x = isX ? -height : 0 : d.position === "middle" && (x = (isX ? -height : width) / 2), x;
|
10550 | };
|
10551 | };
|
10552 |
|
10553 | extend(ChartInternal_ChartInternal.prototype, {
|
10554 | initGrid: function initGrid() {
|
10555 | var $$ = this;
|
10556 | $$.xgrid = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]), $$.initGridLines(), $$.initFocusGrid();
|
10557 | },
|
10558 | initGridLines: function initGridLines() {
|
10559 | var $$ = this,
|
10560 | config = $$.config;
|
10561 | (config.grid_x_lines.length || config.grid_y_lines.length) && ($$.gridLines = $$.main.insert("g", ".".concat(config_classes.chart).concat(config.grid_lines_front ? " + *" : "")).attr("clip-path", $$.clipPathForGrid).attr("class", "".concat(config_classes.grid, " ").concat(config_classes.gridLines)), $$.gridLines.append("g").attr("class", config_classes.xgridLines), $$.gridLines.append("g").attr("class", config_classes.ygridLines), $$.xgridLines = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]));
|
10562 | },
|
10563 | updateXGrid: function updateXGrid(withoutUpdate) {
|
10564 | var $$ = this,
|
10565 | config = $$.config,
|
10566 | isRotated = config.axis_rotated,
|
10567 | xgridData = $$.generateGridData(config.grid_x_type, $$.x),
|
10568 | tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0,
|
10569 | pos = function (d) {
|
10570 | return (($$.zoomScale || $$.x)(d) + tickOffset) * (isRotated ? -1 : 1);
|
10571 | };
|
10572 |
|
10573 | $$.xgridAttr = isRotated ? {
|
10574 | "x1": 0,
|
10575 | "x2": $$.width,
|
10576 | "y1": pos,
|
10577 | "y2": pos
|
10578 | } : {
|
10579 | "x1": pos,
|
10580 | "x2": pos,
|
10581 | "y1": 0,
|
10582 | "y2": $$.height
|
10583 | }, $$.xgrid = $$.main.select(".".concat(config_classes.xgrids)).selectAll(".".concat(config_classes.xgrid)).data(xgridData), $$.xgrid.exit().remove(), $$.xgrid = $$.xgrid.enter().append("line").attr("class", config_classes.xgrid).merge($$.xgrid), withoutUpdate || $$.xgrid.each(function () {
|
10584 | var grid = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this);
|
10585 | Object.keys($$.xgridAttr).forEach(function (id) {
|
10586 | grid.attr(id, $$.xgridAttr[id]).style("opacity", function () {
|
10587 | return grid.attr(isRotated ? "y1" : "x1") === (isRotated ? $$.height : 0) ? "0" : "1";
|
10588 | });
|
10589 | });
|
10590 | });
|
10591 | },
|
10592 | updateYGrid: function updateYGrid() {
|
10593 | var $$ = this,
|
10594 | config = $$.config,
|
10595 | isRotated = config.axis_rotated,
|
10596 | gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks),
|
10597 | pos = function (d) {
|
10598 | return Math.ceil($$.y(d));
|
10599 | };
|
10600 |
|
10601 | $$.ygrid = $$.main.select(".".concat(config_classes.ygrids)).selectAll(".".concat(config_classes.ygrid)).data(gridValues), $$.ygrid.exit().remove(), $$.ygrid = $$.ygrid.enter().append("line").attr("class", config_classes.ygrid).merge($$.ygrid), $$.ygrid.attr("x1", isRotated ? pos : 0).attr("x2", isRotated ? pos : $$.width).attr("y1", isRotated ? 0 : pos).attr("y2", isRotated ? $$.height : pos), $$.smoothLines($$.ygrid, "grid");
|
10602 | },
|
10603 | updateGrid: function updateGrid(duration) {
|
10604 | var $$ = this;
|
10605 |
|
10606 | $$.gridLines || $$.initGridLines(), $$.grid.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.hideGridFocus(), $$.updateXGridLines(duration), $$.updateYGridLines(duration);
|
10607 | },
|
10608 |
|
10609 | |
10610 |
|
10611 |
|
10612 |
|
10613 |
|
10614 | updateXGridLines: function updateXGridLines(duration) {
|
10615 | var $$ = this,
|
10616 | main = $$.main,
|
10617 | config = $$.config,
|
10618 | isRotated = config.axis_rotated;
|
10619 | config.grid_x_show && $$.updateXGrid(), $$.xgridLines = main.select(".".concat(config_classes.xgridLines)).selectAll(".".concat(config_classes.xgridLine)).data(config.grid_x_lines), $$.xgridLines.exit().transition().duration(duration).style("opacity", "0").remove();
|
10620 |
|
10621 | var xgridLine = $$.xgridLines.enter().append("g");
|
10622 | xgridLine.append("line").style("opacity", "0"), xgridLine.append("text").attr("transform", isRotated ? "" : "rotate(-90)").attr("dy", -5).style("opacity", "0"), $$.xgridLines = xgridLine.merge($$.xgridLines), $$.xgridLines.attr("class", function (d) {
|
10623 | return "".concat(config_classes.xgridLine, " ").concat(d["class"] || "").trim();
|
10624 | }).select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx).transition().duration(duration).text(function (d) {
|
10625 | return d.text;
|
10626 | }).transition().style("opacity", "1");
|
10627 | },
|
10628 |
|
10629 | |
10630 |
|
10631 |
|
10632 |
|
10633 |
|
10634 | updateYGridLines: function updateYGridLines(duration) {
|
10635 | var $$ = this,
|
10636 | main = $$.main,
|
10637 | config = $$.config,
|
10638 | isRotated = config.axis_rotated;
|
10639 | config.grid_y_show && $$.updateYGrid(), $$.ygridLines = main.select(".".concat(config_classes.ygridLines)).selectAll(".".concat(config_classes.ygridLine)).data(config.grid_y_lines), $$.ygridLines.exit().transition().duration(duration).style("opacity", "0").remove();
|
10640 |
|
10641 | var ygridLine = $$.ygridLines.enter().append("g");
|
10642 | ygridLine.append("line").style("opacity", "0"), ygridLine.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0"), $$.ygridLines = ygridLine.merge($$.ygridLines);
|
10643 |
|
10644 | var yv = $$.yv.bind($$);
|
10645 | $$.ygridLines.attr("class", function (d) {
|
10646 | return "".concat(config_classes.ygridLine, " ").concat(d["class"] || "").trim();
|
10647 | }).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) {
|
10648 | return d.text;
|
10649 | }).transition().style("opacity", "1");
|
10650 | },
|
10651 | redrawGrid: function redrawGrid(withTransition) {
|
10652 | var $$ = this,
|
10653 | isRotated = $$.config.axis_rotated,
|
10654 | xv = $$.xv.bind($$),
|
10655 | lines = $$.xgridLines.select("line"),
|
10656 | texts = $$.xgridLines.select("text");
|
10657 | 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) {
|
10658 | return d.text;
|
10659 | }), [(withTransition ? lines.transition() : lines).style("opacity", "1"), (withTransition ? texts.transition() : texts).style("opacity", "1")];
|
10660 | },
|
10661 | initFocusGrid: function initFocusGrid() {
|
10662 | var $$ = this,
|
10663 | config = $$.config,
|
10664 | isFront = config.grid_front,
|
10665 | className = ".".concat(config_classes[isFront && $$.gridLines ? "gridLines" : "chart"]).concat(isFront ? " + *" : "");
|
10666 | $$.grid = $$.main.insert("g", className).attr("clip-path", $$.clipPathForGrid).attr("class", config_classes.grid), config.grid_x_show && $$.grid.append("g").attr("class", config_classes.xgrids), config.grid_y_show && $$.grid.append("g").attr("class", config_classes.ygrids), config.grid_focus_show && ($$.grid.append("g").attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus), config.grid_focus_y && !config.tooltip_grouped && $$.grid.append("g").attr("class", config_classes.ygridFocus).append("line").attr("class", config_classes.ygridFocus));
|
10667 | },
|
10668 |
|
10669 | |
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 | showGridFocus: function showGridFocus(selectedData) {
|
10675 | var $$ = this,
|
10676 | config = $$.config,
|
10677 | isRotated = config.axis_rotated,
|
10678 | dataToShow = selectedData.filter(function (d) {
|
10679 | return d && isValue($$.getBaseValue(d));
|
10680 | });
|
10681 |
|
10682 |
|
10683 | if (!(!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType())) {
|
10684 | var focusEl = $$.main.selectAll("line.".concat(config_classes.xgridFocus, ", line.").concat(config_classes.ygridFocus)),
|
10685 | isEdge = config.grid_focus_edge && !config.tooltip_grouped,
|
10686 | xx = $$.xx.bind($$);
|
10687 | focusEl.style("visibility", "visible").data(dataToShow.concat(dataToShow)).each(function (d) {
|
10688 | var xy,
|
10689 | el = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
10690 | pos = {
|
10691 | x: xx(d),
|
10692 | y: $$.getYScale(d.id)(d.value)
|
10693 | };
|
10694 | if (el.classed(config_classes.xgridFocus)) xy = isRotated ? [null,
|
10695 | pos.x,
|
10696 | isEdge ? pos.y : $$.width,
|
10697 | pos.x
|
10698 | ] : [pos.x, isEdge ? pos.y : null, pos.x, $$.height];else {
|
10699 | var isY2 = $$.axis.getId(d.id) === "y2";
|
10700 | xy = isRotated ? [pos.y,
|
10701 | isEdge && !isY2 ? pos.x : null,
|
10702 | pos.y,
|
10703 | isEdge && isY2 ? pos.x : $$.height
|
10704 | ] : [isEdge && isY2 ? pos.x : null, pos.y, isEdge && !isY2 ? pos.x : $$.width, pos.y];
|
10705 | }
|
10706 | ["x1", "y1", "x2", "y2"].forEach(function (v, i) {
|
10707 | return el.attr(v, xy[i]);
|
10708 | });
|
10709 | }), $$.smoothLines(focusEl, "grid");
|
10710 | }
|
10711 | },
|
10712 | hideGridFocus: function hideGridFocus() {
|
10713 | var $$ = this;
|
10714 | $$.inputType === "mouse" && $$.main.selectAll("line.".concat(config_classes.xgridFocus, ", line.").concat(config_classes.ygridFocus)).style("visibility", "hidden");
|
10715 | },
|
10716 | updategridFocus: function updategridFocus() {
|
10717 | var $$ = this;
|
10718 |
|
10719 | if ($$.inputType === "touch") {
|
10720 | var d = $$.grid.select("line.".concat(config_classes.xgridFocus)).datum();
|
10721 | d && $$.showGridFocus([d]);
|
10722 | } else {
|
10723 | var _isRotated = $$.config.axis_rotated;
|
10724 | $$.main.select("line.".concat(config_classes.xgridFocus)).attr("x1", _isRotated ? 0 : -10).attr("x2", _isRotated ? $$.width : -10).attr("y1", _isRotated ? -10 : 0).attr("y2", _isRotated ? -10 : $$.height);
|
10725 | }
|
10726 | },
|
10727 | generateGridData: function generateGridData(type, scale) {
|
10728 | var $$ = this,
|
10729 | tickNum = $$.main.select(".".concat(config_classes.axisX)).selectAll(".tick").size(),
|
10730 | gridData = [];
|
10731 |
|
10732 | if (type === "year") {
|
10733 | var xDomain = $$.getXDomain(),
|
10734 | firstYear = xDomain[0].getFullYear(),
|
10735 | lastYear = xDomain[1].getFullYear();
|
10736 |
|
10737 | for (var i = firstYear; i <= lastYear; i++) gridData.push(new Date("".concat(i, "-01-01 00:00:00")));
|
10738 | } else gridData = scale.ticks(10), gridData.length > tickNum && (gridData = gridData.filter(function (d) {
|
10739 | return (d + "").indexOf(".") < 0;
|
10740 | }));
|
10741 |
|
10742 | return gridData;
|
10743 | },
|
10744 | getGridFilterToRemove: function getGridFilterToRemove(params) {
|
10745 | return params ? function (line) {
|
10746 | var found = !1;
|
10747 | return (isArray(params) ? params.concat() : [params]).forEach(function (param) {
|
10748 | ("value" in param && line.value === param.value || "class" in param && line["class"] === param["class"]) && (found = !0);
|
10749 | }), found;
|
10750 | } : function () {
|
10751 | return !0;
|
10752 | };
|
10753 | },
|
10754 | removeGridLines: function removeGridLines(params, forX) {
|
10755 | var $$ = this,
|
10756 | config = $$.config,
|
10757 | toRemove = $$.getGridFilterToRemove(params),
|
10758 | classLines = forX ? config_classes.xgridLines : config_classes.ygridLines,
|
10759 | classLine = forX ? config_classes.xgridLine : config_classes.ygridLine;
|
10760 | $$.main.select(".".concat(classLines)).selectAll(".".concat(classLine)).filter(toRemove).transition().duration(config.transition_duration).style("opacity", "0").remove();
|
10761 | var gridLines = "grid_".concat(forX ? "x" : "y", "_lines");
|
10762 | config[gridLines] = config[gridLines].filter(function toShow(line) {
|
10763 | return !toRemove(line);
|
10764 | });
|
10765 | }
|
10766 | });
|
10767 |
|
10768 |
|
10769 |
|
10770 |
|
10771 |
|
10772 |
|
10773 |
|
10774 |
|
10775 |
|
10776 |
|
10777 |
|
10778 |
|
10779 |
|
10780 | extend(ChartInternal_ChartInternal.prototype, {
|
10781 | |
10782 |
|
10783 |
|
10784 |
|
10785 | initTooltip: function initTooltip() {
|
10786 | var $$ = this,
|
10787 | config = $$.config,
|
10788 | bindto = config.tooltip_contents.bindto;
|
10789 |
|
10790 |
|
10791 | if ($$.tooltip = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(bindto), $$.tooltip.empty() && ($$.tooltip = $$.selectChart.style("position", "relative").append("div").attr("class", config_classes.tooltipContainer).style("position", "absolute").style("pointer-events", "none").style("display", "none")), config.tooltip_init_show) {
|
10792 | if ($$.isTimeSeries() && isString(config.tooltip_init_x)) {
|
10793 | var i,
|
10794 | val,
|
10795 | targets = $$.data.targets[0];
|
10796 |
|
10797 | for (config.tooltip_init_x = $$.parseDate(config.tooltip_init_x), i = 0; (val = targets.values[i]) && val.x - config.tooltip_init_x !== 0; i++);
|
10798 |
|
10799 | config.tooltip_init_x = i;
|
10800 | }
|
10801 |
|
10802 | $$.tooltip.html($$.getTooltipHTML($$.data.targets.map(function (d) {
|
10803 | return $$.addName(d.values[config.tooltip_init_x]);
|
10804 | }), $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType(null, ["radar"])), $$.color)), bindto || $$.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", "block");
|
10805 | }
|
10806 |
|
10807 | $$.bindTooltipResizePos();
|
10808 | },
|
10809 |
|
10810 | |
10811 |
|
10812 |
|
10813 |
|
10814 |
|
10815 |
|
10816 | getTooltipHTML: function getTooltipHTML() {
|
10817 | for (var _config$tooltip_conte, _$$, $$ = this, config = $$.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
10818 |
|
10819 | return isFunction(config.tooltip_contents) ? (_config$tooltip_conte = config.tooltip_contents).call.apply(_config$tooltip_conte, [$$].concat(args)) : (_$$ = $$).getTooltipContent.apply(_$$, args);
|
10820 | },
|
10821 |
|
10822 | |
10823 |
|
10824 |
|
10825 |
|
10826 |
|
10827 |
|
10828 |
|
10829 |
|
10830 |
|
10831 | getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) {
|
10832 | var $$ = this,
|
10833 | config = $$.config,
|
10834 | titleFormat = config.tooltip_format_title || defaultTitleFormat,
|
10835 | nameFormat = config.tooltip_format_name || function (name) {
|
10836 | return name;
|
10837 | },
|
10838 | valueFormat = config.tooltip_format_value || ($$.isStackNormalized() ? function (v, ratio) {
|
10839 | return "".concat((ratio * 100).toFixed(2), "%");
|
10840 | } : defaultValueFormat),
|
10841 | order = config.tooltip_order,
|
10842 | getRowValue = function (row) {
|
10843 | return $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row);
|
10844 | },
|
10845 | getBgColor = $$.levelColor ? function (row) {
|
10846 | return $$.levelColor(row.value);
|
10847 | } : function (row) {
|
10848 | return color(row);
|
10849 | },
|
10850 | contents = config.tooltip_contents,
|
10851 | tplStr = contents.template,
|
10852 | targetIds = $$.mapToTargetIds();
|
10853 |
|
10854 | if (order === null && config.data_groups.length) {
|
10855 |
|
10856 | var ids = $$.orderTargets($$.data.targets).map(function (i2) {
|
10857 | return i2.id;
|
10858 | }).reverse();
|
10859 | d.sort(function (a, b) {
|
10860 | var v1 = a ? a.value : null,
|
10861 | v2 = b ? b.value : null;
|
10862 | return v1 > 0 && v2 > 0 && (v1 = a.id ? ids.indexOf(a.id) : null, v2 = b.id ? ids.indexOf(b.id) : null), v1 - v2;
|
10863 | });
|
10864 | } else if (/^(asc|desc)$/.test(order)) {
|
10865 | d.sort(function (a, b) {
|
10866 | var v1 = a ? getRowValue(a) : null,
|
10867 | v2 = b ? getRowValue(b) : null;
|
10868 | return order === "asc" ? v1 - v2 : v2 - v1;
|
10869 | });
|
10870 | } else isFunction(order) && d.sort(order);
|
10871 |
|
10872 | var text,
|
10873 | row,
|
10874 | param,
|
10875 | value,
|
10876 | i,
|
10877 | tpl = $$.getTooltipContentTemplate(tplStr),
|
10878 | len = d.length;
|
10879 |
|
10880 | for (i = 0; i < len; i++) if (row = d[i], row && (getRowValue(row) || getRowValue(row) === 0)) {
|
10881 | if (isUndefined(text)) {
|
10882 | var title = sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
10883 | text = tplProcess(tpl[0], {
|
10884 | CLASS_TOOLTIP: config_classes.tooltip,
|
10885 | TITLE: isValue(title) ? tplStr ? title : "<tr><th colspan=\"2\">".concat(title, "</th></tr>") : ""
|
10886 | });
|
10887 | }
|
10888 |
|
10889 | if (param = [row.ratio, row.id, row.index, d], value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(_toConsumableArray(param)))), $$.isAreaRangeType(row)) {
|
10890 | var _map = ["high", "low"].map(function (v) {
|
10891 | return sanitise(valueFormat.apply(void 0, [$$.getAreaRangeData(row, v)].concat(_toConsumableArray(param))));
|
10892 | }),
|
10893 | _map2 = _slicedToArray(_map, 2),
|
10894 | high = _map2[0],
|
10895 | low = _map2[1];
|
10896 |
|
10897 | value = "<b>Mid:</b> ".concat(value, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low);
|
10898 | }
|
10899 |
|
10900 | if (value !== undefined) {
|
10901 | var _ret = function () {
|
10902 |
|
10903 | if (row.name === null) return "continue";
|
10904 | var name = sanitise(nameFormat.apply(void 0, [row.name].concat(_toConsumableArray(param)))),
|
10905 | color = getBgColor(row),
|
10906 | contentValue = {
|
10907 | CLASS_TOOLTIP_NAME: config_classes.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
10908 | COLOR: tplStr || !$$.patterns ? color : "<svg><rect style=\"fill:".concat(color, "\" width=\"10\" height=\"10\"></rect></svg>"),
|
10909 | NAME: name,
|
10910 | VALUE: value
|
10911 | };
|
10912 |
|
10913 | if (tplStr && isObject(contents.text)) {
|
10914 | var index = targetIds.indexOf(row.id);
|
10915 | Object.keys(contents.text).forEach(function (key) {
|
10916 | contentValue[key] = contents.text[key][index];
|
10917 | });
|
10918 | }
|
10919 |
|
10920 | text += tplProcess(tpl[1], contentValue);
|
10921 | }();
|
10922 |
|
10923 | if (_ret === "continue") continue;
|
10924 | }
|
10925 | }
|
10926 |
|
10927 | return "".concat(text, "</table>");
|
10928 | },
|
10929 |
|
10930 | |
10931 |
|
10932 |
|
10933 |
|
10934 |
|
10935 |
|
10936 | getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) {
|
10937 | return (tplStr || "<table class=\"{=CLASS_TOOLTIP}\"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class=\"{=CLASS_TOOLTIP_NAME}\">\n\t\t\t\t\t<td class=\"name\">".concat(this.patterns ? "{=COLOR}" : "<span style=\"background-color:{=COLOR}\"></span>", "{=NAME}</td>\n\t\t\t\t\t<td class=\"value\">{=VALUE}</td>\n\t\t\t\t</tr>}}\n\t\t\t</tbody></table>")).replace(/(\r?\n|\t)/g, "").split(/{{(.*)}}/);
|
10938 | },
|
10939 |
|
10940 | |
10941 |
|
10942 |
|
10943 |
|
10944 |
|
10945 |
|
10946 |
|
10947 |
|
10948 |
|
10949 | tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) {
|
10950 | var $$ = this,
|
10951 | config = $$.config,
|
10952 | hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
10953 | svgLeft = $$.getSvgLeft(!0),
|
10954 | _d3Mouse = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(element),
|
10955 | _d3Mouse2 = _slicedToArray(_d3Mouse, 2),
|
10956 | left = _d3Mouse2[0],
|
10957 | top = _d3Mouse2[1],
|
10958 | chartRight = svgLeft + $$.currentWidth - $$.getCurrentPaddingRight(!0),
|
10959 | chartLeft = $$.getCurrentPaddingLeft(!0),
|
10960 | size = 20;
|
10961 |
|
10962 |
|
10963 | if (top += size, $$.hasArcType()) {
|
10964 | var raw = $$.inputType === "touch" || $$.hasType("radar");
|
10965 | raw || (top += hasGauge ? $$.height : $$.height / 2, left += ($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2);
|
10966 | } else {
|
10967 | var dataScale = $$.x(dataToShow[0].x);
|
10968 | config.axis_rotated ? (top = dataScale + size, left += svgLeft + 100, chartRight -= svgLeft) : (top -= 5, left = svgLeft + chartLeft + size + ($$.zoomScale ? left : dataScale));
|
10969 | }
|
10970 |
|
10971 |
|
10972 | return left + tWidth + 15 > chartRight && (left -= svgLeft + tWidth + chartLeft), top + tHeight > $$.currentHeight && (top -= hasGauge ? tHeight * 3 : tHeight + 30), top < 0 && (top = 0), {
|
10973 | top: top,
|
10974 | left: left
|
10975 | };
|
10976 | },
|
10977 |
|
10978 | |
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 |
|
10984 | showTooltip: function showTooltip(selectedData, element) {
|
10985 | var $$ = this,
|
10986 | config = $$.config,
|
10987 | bindto = config.tooltip_contents.bindto,
|
10988 | forArc = $$.hasArcType(null, ["radar"]),
|
10989 | dataToShow = selectedData.filter(function (d) {
|
10990 | return d && isValue($$.getBaseValue(d));
|
10991 | });
|
10992 |
|
10993 | if (dataToShow.length !== 0 && config.tooltip_show) {
|
10994 | var datum = $$.tooltip.datum(),
|
10995 | _ref = datum || {},
|
10996 | _ref$width = _ref.width,
|
10997 | width = _ref$width === void 0 ? 0 : _ref$width,
|
10998 | _ref$height = _ref.height,
|
10999 | height = _ref$height === void 0 ? 0 : _ref$height,
|
11000 | dataStr = JSON.stringify(selectedData);
|
11001 |
|
11002 | if (!datum || datum.current !== dataStr) {
|
11003 | var index = selectedData.concat().sort()[0].index;
|
11004 | callFn(config.tooltip_onshow, $$, $$.api, selectedData), $$.tooltip.html($$.getTooltipHTML(selectedData, $$.axis.getXAxisTickFormat(), $$.getYFormat(forArc), $$.color)).style("display", null).style("visibility", null)
|
11005 | .datum(datum = {
|
11006 | index: index,
|
11007 | current: dataStr,
|
11008 | width: width = $$.tooltip.property("offsetWidth"),
|
11009 | height: height = $$.tooltip.property("offsetHeight")
|
11010 | }), callFn(config.tooltip_onshown, $$, $$.api, selectedData), $$._handleLinkedCharts(!0, index);
|
11011 | }
|
11012 |
|
11013 | if (!bindto) {
|
11014 | var fnPos = config.tooltip_position || $$.tooltipPosition,
|
11015 | pos = fnPos.call(this, dataToShow, width, height, element);
|
11016 |
|
11017 | ["top", "left"].forEach(function (v) {
|
11018 | var value = pos[v];
|
11019 | $$.tooltip.style(v, "".concat(value, "px")), v !== "left" || datum.xPosInPercent || (datum.xPosInPercent = value / $$.currentWidth * 100);
|
11020 | });
|
11021 | }
|
11022 | }
|
11023 | },
|
11024 |
|
11025 | |
11026 |
|
11027 |
|
11028 |
|
11029 | bindTooltipResizePos: function bindTooltipResizePos() {
|
11030 | var $$ = this,
|
11031 | resizeFunction = $$.resizeFunction,
|
11032 | tooltip = $$.tooltip;
|
11033 | resizeFunction.add(function () {
|
11034 | if (tooltip.style("display") === "block") {
|
11035 | var currentWidth = $$.currentWidth,
|
11036 | _tooltip$datum = tooltip.datum(),
|
11037 | width = _tooltip$datum.width,
|
11038 | xPosInPercent = _tooltip$datum.xPosInPercent,
|
11039 | _value = currentWidth / 100 * xPosInPercent,
|
11040 | diff = currentWidth - (_value + width);
|
11041 |
|
11042 | diff < 0 && (_value += diff), tooltip.style("left", "".concat(_value, "px"));
|
11043 | }
|
11044 | });
|
11045 | },
|
11046 |
|
11047 | |
11048 |
|
11049 |
|
11050 |
|
11051 |
|
11052 | hideTooltip: function hideTooltip(force) {
|
11053 | var $$ = this,
|
11054 | api = $$.api,
|
11055 | config = $$.config,
|
11056 | tooltip = $$.tooltip;
|
11057 |
|
11058 | if (tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
11059 | var selectedData = JSON.parse(this.tooltip.datum().current);
|
11060 |
|
11061 | callFn(config.tooltip_onhide, $$, api, selectedData), tooltip.style("display", "none").style("visibility", "hidden")
|
11062 | .datum(null), callFn(config.tooltip_onhidden, $$, api, selectedData);
|
11063 | }
|
11064 | },
|
11065 |
|
11066 | |
11067 |
|
11068 |
|
11069 |
|
11070 |
|
11071 |
|
11072 | _handleLinkedCharts: function _handleLinkedCharts(show, index) {
|
11073 | var $$ = this;
|
11074 |
|
11075 | if ($$.config.tooltip_linked) {
|
11076 | var linkedName = $$.config.tooltip_linked_name;
|
11077 | ($$.api.internal.charts || []).forEach(function (c) {
|
11078 | if (c !== $$.api) {
|
11079 | var _config = c.internal.config,
|
11080 | isLinked = _config.tooltip_linked,
|
11081 | name = _config.tooltip_linked_name,
|
11082 | isInDom = browser_doc.body.contains(c.element);
|
11083 |
|
11084 | if (isLinked && linkedName === name && isInDom) {
|
11085 | var data = c.internal.tooltip.data()[0],
|
11086 | isNotSameIndex = index !== (data && data.index);
|
11087 |
|
11088 |
|
11089 | try {
|
11090 | show && isNotSameIndex ? c.tooltip.show({
|
11091 | index: index
|
11092 | }) : !show && c.tooltip.hide();
|
11093 | } catch (e) {}
|
11094 | }
|
11095 | }
|
11096 | });
|
11097 | }
|
11098 | }
|
11099 | });
|
11100 |
|
11101 |
|
11102 |
|
11103 |
|
11104 |
|
11105 |
|
11106 |
|
11107 |
|
11108 |
|
11109 |
|
11110 | extend(ChartInternal_ChartInternal.prototype, {
|
11111 | |
11112 |
|
11113 |
|
11114 |
|
11115 | initLegend: function initLegend() {
|
11116 | var $$ = this,
|
11117 | config = $$.config;
|
11118 | $$.legendItemTextBox = {}, $$.legendHasRendered = !1, $$.legend = $$.svg.append("g"), config.legend_show ? ($$.legend.attr("transform", $$.getTranslate("legend")), $$.updateLegend()) : ($$.legend.style("visibility", "hidden"), $$.hiddenLegendIds = $$.mapToIds($$.data.targets));
|
11119 | },
|
11120 |
|
11121 | |
11122 |
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 | updateLegend: function updateLegend(targetIds, options, transitions) {
|
11129 | var $$ = this,
|
11130 | config = $$.config,
|
11131 | optionz = options || {
|
11132 | withTransform: !1,
|
11133 | withTransitionForTransform: !1,
|
11134 | withTransition: !1
|
11135 | };
|
11136 |
|
11137 |
|
11138 |
|
11139 | optionz.withTransition = getOption(optionz, "withTransition", !0), optionz.withTransitionForTransform = getOption(optionz, "withTransitionForTransform", !0), config.legend_contents_bindto && config.legend_contents_template ? $$.updateLegendTemplate() : $$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions), $$.legend.selectAll(".".concat(config_classes.legendItem)).classed(config_classes.legendItemHidden, function (id) {
|
11140 | return !$$.isTargetToShow(id);
|
11141 | }), $$.updateScales(!1, !$$.zoomScale), $$.updateSvgSize(), $$.transformAll(optionz.withTransitionForTransform, transitions), $$.legendHasRendered = !0;
|
11142 | },
|
11143 |
|
11144 | |
11145 |
|
11146 |
|
11147 |
|
11148 | updateLegendTemplate: function updateLegendTemplate() {
|
11149 | var $$ = this,
|
11150 | config = $$.config,
|
11151 | wrapper = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(config.legend_contents_bindto),
|
11152 | template = config.legend_contents_template;
|
11153 |
|
11154 | if (!wrapper.empty()) {
|
11155 | var targets = $$.mapToIds($$.data.targets),
|
11156 | ids = [],
|
11157 | html = "";
|
11158 | targets.forEach(function (v) {
|
11159 | var content = isFunction(template) ? template.call($$, v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, {
|
11160 | COLOR: $$.color(v),
|
11161 | TITLE: v
|
11162 | });
|
11163 | content && (ids.push(v), html += content);
|
11164 | });
|
11165 | var legendItem = wrapper.html(html).selectAll(function () {
|
11166 | return this.childNodes;
|
11167 | }).data(ids);
|
11168 | $$.setLegendItem(legendItem), $$.legend = wrapper;
|
11169 | }
|
11170 | },
|
11171 |
|
11172 | |
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 | updateSizeForLegend: function updateSizeForLegend(size) {
|
11178 | var $$ = this,
|
11179 | config = $$.config,
|
11180 | width = size.width,
|
11181 | height = size.height,
|
11182 | insetLegendPosition = {
|
11183 | top: $$.isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : $$.currentHeight - height - $$.getCurrentPaddingBottom() - config.legend_inset_y,
|
11184 | left: $$.isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : $$.currentWidth - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5
|
11185 | };
|
11186 | $$.margin3 = {
|
11187 | top: $$.isLegendRight ? 0 : $$.isLegendInset ? insetLegendPosition.top : $$.currentHeight - height,
|
11188 | right: NaN,
|
11189 | bottom: 0,
|
11190 | left: $$.isLegendRight ? $$.currentWidth - width : $$.isLegendInset ? insetLegendPosition.left : 0
|
11191 | };
|
11192 | },
|
11193 |
|
11194 | |
11195 |
|
11196 |
|
11197 |
|
11198 |
|
11199 | transformLegend: function transformLegend(withTransition) {
|
11200 | var $$ = this;
|
11201 | (withTransition ? $$.legend.transition() : $$.legend).attr("transform", $$.getTranslate("legend"));
|
11202 | },
|
11203 |
|
11204 | |
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 | updateLegendStep: function updateLegendStep(step) {
|
11210 | this.legendStep = step;
|
11211 | },
|
11212 |
|
11213 | |
11214 |
|
11215 |
|
11216 |
|
11217 |
|
11218 | updateLegendItemWidth: function updateLegendItemWidth(w) {
|
11219 | this.legendItemWidth = w;
|
11220 | },
|
11221 |
|
11222 | |
11223 |
|
11224 |
|
11225 |
|
11226 |
|
11227 | updateLegendItemHeight: function updateLegendItemHeight(h) {
|
11228 | this.legendItemHeight = h;
|
11229 | },
|
11230 |
|
11231 | |
11232 |
|
11233 |
|
11234 |
|
11235 |
|
11236 |
|
11237 | updateLegendItemColor: function updateLegendItemColor(id, color) {
|
11238 | this.legend.select(".".concat(config_classes.legendItem, "-").concat(id, " line")).style("stroke", color);
|
11239 | },
|
11240 |
|
11241 | |
11242 |
|
11243 |
|
11244 |
|
11245 |
|
11246 | getLegendWidth: function getLegendWidth() {
|
11247 | var $$ = this;
|
11248 | return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0;
|
11249 | },
|
11250 |
|
11251 | |
11252 |
|
11253 |
|
11254 |
|
11255 |
|
11256 | getLegendHeight: function getLegendHeight() {
|
11257 | var $$ = this;
|
11258 | return $$.config.legend_show ? $$.isLegendRight ? $$.currentHeight : Math.max(20, $$.legendItemHeight) * ($$.legendStep + 1) : 0;
|
11259 | },
|
11260 |
|
11261 | |
11262 |
|
11263 |
|
11264 |
|
11265 |
|
11266 |
|
11267 | opacityForLegend: function opacityForLegend(legendItem) {
|
11268 | return legendItem.classed(config_classes.legendItemHidden) ? null : "1";
|
11269 | },
|
11270 |
|
11271 | |
11272 |
|
11273 |
|
11274 |
|
11275 |
|
11276 |
|
11277 | opacityForUnfocusedLegend: function opacityForUnfocusedLegend(legendItem) {
|
11278 | return legendItem.classed(config_classes.legendItemHidden) ? null : "0.3";
|
11279 | },
|
11280 |
|
11281 | |
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 | toggleFocusLegend: function toggleFocusLegend(targetIds, focus) {
|
11288 | var $$ = this,
|
11289 | targetIdz = $$.mapToTargetIds(targetIds);
|
11290 | $$.legend.selectAll(".".concat(config_classes.legendItem)).filter(function (id) {
|
11291 | return targetIdz.indexOf(id) >= 0;
|
11292 | }).classed(config_classes.legendItemFocused, focus).transition().duration(100).style("opacity", function () {
|
11293 | return (focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend).call($$, Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this));
|
11294 | });
|
11295 | },
|
11296 |
|
11297 | |
11298 |
|
11299 |
|
11300 |
|
11301 | revertLegend: function revertLegend() {
|
11302 | var $$ = this;
|
11303 | $$.legend.selectAll(".".concat(config_classes.legendItem)).classed(config_classes.legendItemFocused, !1).transition().duration(100).style("opacity", function () {
|
11304 | return $$.opacityForLegend(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this));
|
11305 | });
|
11306 | },
|
11307 |
|
11308 | |
11309 |
|
11310 |
|
11311 |
|
11312 |
|
11313 | showLegend: function showLegend(targetIds) {
|
11314 | var $$ = this,
|
11315 | config = $$.config;
|
11316 | config.legend_show || (config.legend_show = !0, $$.legend.style("visibility", "visible"), !$$.legendHasRendered && $$.updateLegend()), $$.removeHiddenLegendIds(targetIds), $$.legend.selectAll($$.selectorLegends(targetIds)).style("visibility", "visible").transition().style("opacity", function () {
|
11317 | return $$.opacityForLegend(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this));
|
11318 | });
|
11319 | },
|
11320 |
|
11321 | |
11322 |
|
11323 |
|
11324 |
|
11325 |
|
11326 | hideLegend: function hideLegend(targetIds) {
|
11327 | var $$ = this,
|
11328 | config = $$.config;
|
11329 | 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");
|
11330 | },
|
11331 |
|
11332 | |
11333 |
|
11334 |
|
11335 |
|
11336 | clearLegendItemTextBoxCache: function clearLegendItemTextBoxCache() {
|
11337 | this.legendItemTextBox = {};
|
11338 | },
|
11339 |
|
11340 | |
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 | setLegendItem: function setLegendItem(item) {
|
11346 | var $$ = this,
|
11347 | config = $$.config,
|
11348 | isTouch = $$.inputType === "touch",
|
11349 | hasGauge = $$.hasType("gauge");
|
11350 | item.attr("class", function (id) {
|
11351 | var node = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
11352 | itemClass = !node.empty() && node.attr("class") || "";
|
11353 | return itemClass + $$.generateClass(config_classes.legendItem, id);
|
11354 | }).style("visibility", function (id) {
|
11355 | return $$.isLegendToShow(id) ? "visible" : "hidden";
|
11356 | }).style("cursor", "pointer").on("click", function (id) {
|
11357 | callFn(config.legend_item_onclick, $$, id) || (external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].altKey ? ($$.api.hide(), $$.api.show(id)) : ($$.api.toggle(id), !isTouch && $$.isTargetToShow(id) ? $$.api.focus(id) : $$.api.revert())), isTouch && $$.hideTooltip();
|
11358 | }), isTouch || item.on("mouseout", function (id) {
|
11359 | callFn(config.legend_item_onout, $$, id) || (Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.legendItemFocused, !1), hasGauge && $$.undoMarkOverlapped($$, ".".concat(config_classes.gaugeValue)), $$.api.revert());
|
11360 | }).on("mouseover", function (id) {
|
11361 | callFn(config.legend_item_onover, $$, id) || (Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.legendItemFocused, !0), hasGauge && $$.markOverlapped(id, $$, ".".concat(config_classes.gaugeValue)), !$$.transiting && $$.isTargetToShow(id) && $$.api.focus(id));
|
11362 | });
|
11363 | },
|
11364 |
|
11365 | |
11366 |
|
11367 |
|
11368 |
|
11369 |
|
11370 |
|
11371 | updateLegendElement: function updateLegendElement(targetIds, options) {
|
11372 | var xForLegend,
|
11373 | yForLegend,
|
11374 | background,
|
11375 | $$ = this,
|
11376 | config = $$.config,
|
11377 | posMin = 10,
|
11378 | tileWidth = config.legend_item_tile_width + 5,
|
11379 | maxWidth = 0,
|
11380 | maxHeight = 0,
|
11381 | totalLength = 0,
|
11382 | offsets = {},
|
11383 | widths = {},
|
11384 | heights = {},
|
11385 | margins = [0],
|
11386 | steps = {},
|
11387 | step = 0,
|
11388 | isLegendRightOrInset = $$.isLegendRight || $$.isLegendInset,
|
11389 | targetIdz = targetIds.filter(function (id) {
|
11390 | return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
|
11391 | }),
|
11392 | withTransition = options.withTransition,
|
11393 | getTextBox = function (textElement, id) {
|
11394 | return $$.legendItemTextBox[id] || ($$.legendItemTextBox[id] = $$.getTextRect(textElement, config_classes.legendItem)), $$.legendItemTextBox[id];
|
11395 | },
|
11396 | updatePositions = function (textElement, id, index) {
|
11397 | var margin,
|
11398 | isLast = index === targetIdz.length - 1,
|
11399 | box = getTextBox(textElement, id),
|
11400 | itemWidth = box.width + tileWidth + (isLast && !isLegendRightOrInset ? 0 : 10) + config.legend_padding,
|
11401 | itemHeight = box.height + 4,
|
11402 | itemLength = isLegendRightOrInset ? itemHeight : itemWidth,
|
11403 | areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(),
|
11404 | updateValues = function (id2, withoutStep) {
|
11405 | withoutStep || (margin = (areaLength - totalLength - itemLength) / 2, margin < posMin && (margin = (areaLength - itemLength) / 2, totalLength = 0, step++)), steps[id2] = step, margins[step] = $$.isLegendInset ? 10 : margin, offsets[id2] = totalLength, totalLength += itemLength;
|
11406 | };
|
11407 |
|
11408 | 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);
|
11409 | widths[id] = itemWidth, heights[id] = itemHeight, (!maxWidth || itemWidth >= maxWidth) && (maxWidth = itemWidth), (!maxHeight || itemHeight >= maxHeight) && (maxHeight = itemHeight);
|
11410 | var maxLength = isLegendRightOrInset ? maxHeight : maxWidth;
|
11411 | config.legend_equally ? (Object.keys(widths).forEach(function (id2) {
|
11412 | return widths[id2] = maxWidth;
|
11413 | }), Object.keys(heights).forEach(function (id2) {
|
11414 | return heights[id2] = maxHeight;
|
11415 | }), margin = (areaLength - maxLength * targetIdz.length) / 2, margin < posMin ? (totalLength = 0, step = 0, targetIdz.forEach(function (id2) {
|
11416 | return updateValues(id2);
|
11417 | })) : updateValues(id, !0)) : updateValues(id);
|
11418 | };
|
11419 |
|
11420 | $$.isLegendInset && (step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length, $$.updateLegendStep(step)), $$.isLegendRight ? (xForLegend = function (id) {
|
11421 | return maxWidth * steps[id];
|
11422 | }, yForLegend = function (id) {
|
11423 | return margins[steps[id]] + offsets[id];
|
11424 | }) : $$.isLegendInset ? (xForLegend = function (id) {
|
11425 | return maxWidth * steps[id] + 10;
|
11426 | }, yForLegend = function (id) {
|
11427 | return margins[steps[id]] + offsets[id];
|
11428 | }) : (xForLegend = function (id) {
|
11429 | return margins[steps[id]] + offsets[id];
|
11430 | }, yForLegend = function (id) {
|
11431 | return maxHeight * steps[id];
|
11432 | });
|
11433 |
|
11434 | var xForLegendText = function (id, i) {
|
11435 | return xForLegend(id, i) + 4 + config.legend_item_tile_width;
|
11436 | },
|
11437 | xForLegendRect = function (id, i) {
|
11438 | return xForLegend(id, i);
|
11439 | },
|
11440 | x1ForLegendTile = function (id, i) {
|
11441 | return xForLegend(id, i) - 2;
|
11442 | },
|
11443 | x2ForLegendTile = function (id, i) {
|
11444 | return xForLegend(id, i) - 2 + config.legend_item_tile_width;
|
11445 | },
|
11446 | yForLegendText = function (id, i) {
|
11447 | return yForLegend(id, i) + 9;
|
11448 | },
|
11449 | yForLegendRect = function (id, i) {
|
11450 | return yForLegend(id, i) - 5;
|
11451 | },
|
11452 | yForLegendTile = function (id, i) {
|
11453 | return yForLegend(id, i) + 4;
|
11454 | },
|
11455 | pos = -200,
|
11456 | l = $$.legend.selectAll(".".concat(config_classes.legendItem)).data(targetIdz).enter().append("g");
|
11457 |
|
11458 | $$.setLegendItem(l), l.append("text").text(function (id) {
|
11459 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
11460 | }).each(function (id, i) {
|
11461 | updatePositions(this, id, i);
|
11462 | }).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);
|
11463 | var usePoint = $$.config.legend_usePoint;
|
11464 |
|
11465 | if (usePoint) {
|
11466 | var ids = [];
|
11467 | l.append(function (d) {
|
11468 | var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
11469 | ids.indexOf(d) === -1 && ids.push(d);
|
11470 | var point = pattern[ids.indexOf(d) % pattern.length];
|
11471 | return point === "rectangle" && (point = "rect"), browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].svg, $$.hasValidPointType(point) ? point : "use");
|
11472 | }).attr("class", config_classes.legendItemPoint).style("fill", function (d) {
|
11473 | return $$.color(d);
|
11474 | }).style("pointer-events", "none").attr("href", function (data, idx, selection) {
|
11475 | var node = selection[idx],
|
11476 | nodeName = node.nodeName.toLowerCase();
|
11477 | return nodeName === "use" ? "#".concat($$.datetimeId, "-point-").concat(data) : undefined;
|
11478 | });
|
11479 | } else l.append("line").attr("class", config_classes.legendItemTile).style("stroke", $$.color).style("pointer-events", "none").attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos).attr("y1", isLegendRightOrInset ? pos : yForLegendTile).attr("x2", isLegendRightOrInset ? x2ForLegendTile : pos).attr("y2", isLegendRightOrInset ? pos : yForLegendTile).attr("stroke-width", config.legend_item_tile_height);
|
11480 |
|
11481 |
|
11482 | background = $$.legend.select(".".concat(config_classes.legendBackground, " rect")), $$.isLegendInset && maxWidth > 0 && background.size() === 0 && (background = $$.legend.insert("g", ".".concat(config_classes.legendItem)).attr("class", config_classes.legendBackground).append("rect"));
|
11483 | var texts = $$.legend.selectAll("text").data(targetIdz).text(function (id) {
|
11484 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
11485 | })
|
11486 | .each(function (id, i) {
|
11487 | updatePositions(this, id, i);
|
11488 | });
|
11489 | (withTransition ? texts.transition() : texts).attr("x", xForLegendText).attr("y", yForLegendText);
|
11490 | var rects = $$.legend.selectAll("rect.".concat(config_classes.legendItemEvent)).data(targetIdz);
|
11491 |
|
11492 | if ((withTransition ? rects.transition() : rects).attr("width", function (id) {
|
11493 | return widths[id];
|
11494 | }).attr("height", function (id) {
|
11495 | return heights[id];
|
11496 | }).attr("x", xForLegendRect).attr("y", yForLegendRect), usePoint) {
|
11497 | var tiles = $$.legend.selectAll(".".concat(config_classes.legendItemPoint)).data(targetIdz);
|
11498 | (withTransition ? tiles.transition() : tiles).each(function () {
|
11499 | var radius,
|
11500 | width,
|
11501 | height,
|
11502 | nodeName = this.nodeName.toLowerCase(),
|
11503 | pointR = $$.config.point_r,
|
11504 | x = "x",
|
11505 | y = "y",
|
11506 | xOffset = 2,
|
11507 | yOffset = 2.5;
|
11508 |
|
11509 | if (nodeName === "circle") {
|
11510 | var size = pointR * .2;
|
11511 | x = "cx", y = "cy", radius = pointR + size, xOffset = pointR * 2, yOffset = -size;
|
11512 | } else if (nodeName === "rect") {
|
11513 | var _size = pointR * 2.5;
|
11514 |
|
11515 | width = _size, height = _size, yOffset = 3;
|
11516 | }
|
11517 |
|
11518 | Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).attr(x, function (d) {
|
11519 | return x1ForLegendTile(d) + xOffset;
|
11520 | }).attr(y, function (d) {
|
11521 | return yForLegendTile(d) - yOffset;
|
11522 | }).attr("r", radius).attr("width", width).attr("height", height);
|
11523 | });
|
11524 | } else {
|
11525 | var _tiles = $$.legend.selectAll("line.".concat(config_classes.legendItemTile)).data(targetIdz);
|
11526 |
|
11527 | (withTransition ? _tiles.transition() : _tiles).style("stroke", $$.levelColor ? function (id) {
|
11528 | return $$.levelColor($$.cache[id].values[0].value);
|
11529 | } : $$.color).attr("x1", x1ForLegendTile).attr("y1", yForLegendTile).attr("x2", x2ForLegendTile).attr("y2", yForLegendTile);
|
11530 | }
|
11531 |
|
11532 | background && (withTransition ? background.transition() : background).attr("height", $$.getLegendHeight() - 12).attr("width", maxWidth * (step + 1) + 10), $$.updateLegendItemWidth(maxWidth), $$.updateLegendItemHeight(maxHeight), $$.updateLegendStep(step);
|
11533 | }
|
11534 | });
|
11535 |
|
11536 |
|
11537 |
|
11538 |
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 |
|
11544 |
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 |
|
11550 |
|
11551 | var getTextPos = function () {
|
11552 | var position,
|
11553 | pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "left",
|
11554 | width = arguments.length > 1 ? arguments[1] : undefined,
|
11555 | isNum = isNumber(width);
|
11556 | return position = pos.indexOf("center") > -1 ? isNum ? width / 2 : "middle" : pos.indexOf("right") > -1 ? isNum ? width : "end" : isNum ? 0 : "start", position;
|
11557 | };
|
11558 |
|
11559 | extend(ChartInternal_ChartInternal.prototype, {
|
11560 | |
11561 |
|
11562 |
|
11563 |
|
11564 | initTitle: function initTitle() {
|
11565 | var $$ = this;
|
11566 |
|
11567 | if ($$.config.title_text) {
|
11568 | $$.title = $$.svg.append("g");
|
11569 | var text = $$.title.append("text").style("text-anchor", getTextPos($$.config.title_position)).attr("class", config_classes.title);
|
11570 | setTextValue(text, $$.config.title_text, [.3, 1.5]);
|
11571 | }
|
11572 | },
|
11573 |
|
11574 | |
11575 |
|
11576 |
|
11577 |
|
11578 | redrawTitle: function redrawTitle() {
|
11579 | var $$ = this;
|
11580 |
|
11581 | if ($$.title) {
|
11582 | var y = $$.yForTitle.call($$);
|
11583 | /g/i.test($$.title.node().tagName) ? $$.title.attr("transform", "translate(".concat(getTextPos($$.config.title_position, $$.currentWidth), ", ").concat(y, ")")) : $$.title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
11584 | }
|
11585 | },
|
11586 |
|
11587 | |
11588 |
|
11589 |
|
11590 |
|
11591 |
|
11592 | xForTitle: function xForTitle() {
|
11593 | var x,
|
11594 | $$ = this,
|
11595 | config = $$.config,
|
11596 | position = config.title_position || "left",
|
11597 | textRectWidth = $$.getTextRect($$.title, config_classes.title).width;
|
11598 | return /(right|center)/.test(position) ? (x = $$.currentWidth - textRectWidth, position.indexOf("right") >= 0 ? x = $$.currentWidth - textRectWidth - config.title_padding.right : position.indexOf("center") >= 0 && (x = ($$.currentWidth - textRectWidth) / 2)) : x = config.title_padding.left || 0, x;
|
11599 | },
|
11600 |
|
11601 | |
11602 |
|
11603 |
|
11604 |
|
11605 |
|
11606 | yForTitle: function yForTitle() {
|
11607 | var $$ = this;
|
11608 | return ($$.config.title_padding.top || 0) + $$.getTextRect($$.title, config_classes.title).height;
|
11609 | },
|
11610 |
|
11611 | |
11612 |
|
11613 |
|
11614 |
|
11615 |
|
11616 | getTitlePadding: function getTitlePadding() {
|
11617 | var $$ = this;
|
11618 | return $$.yForTitle() + ($$.config.title_padding.bottom || 0);
|
11619 | }
|
11620 | });
|
11621 |
|
11622 |
|
11623 |
|
11624 |
|
11625 |
|
11626 |
|
11627 |
|
11628 |
|
11629 | extend(ChartInternal_ChartInternal.prototype, {
|
11630 | initClip: function initClip() {
|
11631 | var $$ = this;
|
11632 |
|
11633 |
|
11634 | $$.clipId = "".concat($$.datetimeId, "-clip"), $$.clipIdForXAxis = "".concat($$.clipId, "-xaxis"), $$.clipIdForYAxis = "".concat($$.clipId, "-yaxis"), $$.clipIdForGrid = "".concat($$.clipId, "-grid"), $$.clipPath = $$.getClipPath($$.clipId), $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis), $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis), $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid);
|
11635 | },
|
11636 | getClipPath: function getClipPath(id) {
|
11637 | var $$ = this,
|
11638 | config = $$.config;
|
11639 | if (!config.clipPath && /-clip$/.test(id) || !config.axis_x_clipPath && /-clip-xaxis$/.test(id) || !config.axis_y_clipPath && /-clip-yaxis$/.test(id)) return null;
|
11640 | var isIE9 = !!win.navigator && win.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0;
|
11641 | return "url(".concat(isIE9 ? "" : browser_doc.URL.split("#")[0], "#").concat(id, ")");
|
11642 | },
|
11643 | appendClip: function appendClip(parent, id) {
|
11644 | return parent.append("clipPath").attr("id", id).append("rect");
|
11645 | },
|
11646 | getAxisClipX: function getAxisClipX(forHorizontal) {
|
11647 |
|
11648 | var left = Math.max(30, this.margin.left);
|
11649 | return forHorizontal ? -(1 + left) : -(left - 1);
|
11650 | },
|
11651 | getAxisClipY: function getAxisClipY(forHorizontal) {
|
11652 | return forHorizontal ? -20 : -this.margin.top;
|
11653 | },
|
11654 | getXAxisClipX: function getXAxisClipX() {
|
11655 | var $$ = this;
|
11656 | return $$.getAxisClipX(!$$.config.axis_rotated);
|
11657 | },
|
11658 | getXAxisClipY: function getXAxisClipY() {
|
11659 | var $$ = this;
|
11660 | return $$.getAxisClipY(!$$.config.axis_rotated);
|
11661 | },
|
11662 | getYAxisClipX: function getYAxisClipX() {
|
11663 | var $$ = this;
|
11664 | return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated);
|
11665 | },
|
11666 | getYAxisClipY: function getYAxisClipY() {
|
11667 | var $$ = this;
|
11668 | return $$.getAxisClipY($$.config.axis_rotated);
|
11669 | },
|
11670 | getAxisClipWidth: function getAxisClipWidth(forHorizontal) {
|
11671 | var $$ = this,
|
11672 | left = Math.max(30, $$.margin.left),
|
11673 | right = Math.max(30, $$.margin.right);
|
11674 |
|
11675 | return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20;
|
11676 | },
|
11677 | getAxisClipHeight: function getAxisClipHeight(forHorizontal) {
|
11678 |
|
11679 | return (forHorizontal ? this.margin.bottom : this.margin.top + this.height) + 20;
|
11680 | },
|
11681 | getXAxisClipWidth: function getXAxisClipWidth() {
|
11682 | var $$ = this;
|
11683 | return $$.getAxisClipWidth(!$$.config.axis_rotated);
|
11684 | },
|
11685 | getXAxisClipHeight: function getXAxisClipHeight() {
|
11686 | var $$ = this;
|
11687 | return $$.getAxisClipHeight(!$$.config.axis_rotated);
|
11688 | },
|
11689 | getYAxisClipWidth: function getYAxisClipWidth() {
|
11690 | var $$ = this;
|
11691 | return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0);
|
11692 | },
|
11693 | getYAxisClipHeight: function getYAxisClipHeight() {
|
11694 | var $$ = this;
|
11695 | return $$.getAxisClipHeight($$.config.axis_rotated);
|
11696 | },
|
11697 | updateXAxisTickClip: function updateXAxisTickClip() {
|
11698 | var $$ = this,
|
11699 | newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
11700 | $$.clipIdForXAxisTickTexts = "".concat($$.clipId, "-xaxisticktexts"), $$.clipPathForXAxisTickTexts = $$.getClipPath($$.clipIdForXAxisTickTexts), !$$.config.axis_x_tick_multiline && $$.getAxisTickRotate("x") && newXAxisHeight !== $$.xAxisHeight && ($$.setXAxisTickClipWidth(), $$.setXAxisTickTextClipPathWidth()), $$.xAxisHeight = newXAxisHeight;
|
11701 | },
|
11702 | setXAxisTickClipWidth: function setXAxisTickClipWidth() {
|
11703 | var $$ = this,
|
11704 | config = $$.config,
|
11705 | xAxisTickRotate = $$.getAxisTickRotate("x");
|
11706 |
|
11707 | if (!config.axis_x_tick_multiline && xAxisTickRotate) {
|
11708 | var sinRotation = Math.sin(Math.PI / 180 * Math.abs(xAxisTickRotate));
|
11709 | $$.xAxisTickClipPathMaxWidth = ($$.getHorizontalAxisHeight("x") - 20) / sinRotation;
|
11710 | } else $$.xAxisTickClipPathMaxWidth = null;
|
11711 | },
|
11712 | setXAxisTickTextClipPathWidth: function setXAxisTickTextClipPathWidth() {
|
11713 | var $$ = this;
|
11714 | $$.svg && $$.svg.select("#".concat($$.clipIdForXAxisTickTexts, " rect")).attr("width", $$.xAxisTickClipPathMaxWidth).attr("height", 30);
|
11715 | }
|
11716 | });
|
11717 |
|
11718 |
|
11719 |
|
11720 |
|
11721 |
|
11722 |
|
11723 |
|
11724 |
|
11725 |
|
11726 |
|
11727 | extend(ChartInternal_ChartInternal.prototype, {
|
11728 | initRegion: function initRegion() {
|
11729 | var $$ = this;
|
11730 | $$.region = $$.main.append("g").attr("clip-path", $$.clipPath).attr("class", config_classes.regions);
|
11731 | },
|
11732 | updateRegion: function updateRegion(duration) {
|
11733 | var $$ = this,
|
11734 | config = $$.config;
|
11735 |
|
11736 |
|
11737 | $$.region.style("visibility", $$.hasArcType() ? "hidden" : "visible"), $$.mainRegion = $$.main.select(".".concat(config_classes.regions)).selectAll(".".concat(config_classes.region)).data(config.regions), $$.mainRegion.exit().transition().duration(duration).style("opacity", "0").remove(), $$.mainRegion = $$.mainRegion.enter().append("g").merge($$.mainRegion).attr("class", $$.classRegion.bind($$)), $$.mainRegion.append("rect").style("fill-opacity", "0");
|
11738 | },
|
11739 | redrawRegion: function redrawRegion(withTransition) {
|
11740 | var $$ = this,
|
11741 | regions = $$.mainRegion.select("rect");
|
11742 | 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) {
|
11743 | return isValue(d.opacity) ? d.opacity : "0.1";
|
11744 | }).on("end", function () {
|
11745 | Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this.parentNode).selectAll("rect:not([x])").remove();
|
11746 | })];
|
11747 | },
|
11748 | getRegionXY: function getRegionXY(type, d) {
|
11749 | var scale,
|
11750 | $$ = this,
|
11751 | config = $$.config,
|
11752 | isRotated = config.axis_rotated,
|
11753 | isX = type === "x",
|
11754 | key = "start",
|
11755 | pos = 0;
|
11756 | return d.axis === "y" || d.axis === "y2" ? (!isX && (key = "end"), (isX ? isRotated : !isRotated) && key in d && (scale = $$[d.axis], pos = scale(d[key]))) : (isX ? !isRotated : isRotated) && key in d && (scale = $$.zoomScale || $$.x, pos = scale($$.isTimeSeries() ? $$.parseDate(d[key]) : d[key])), pos;
|
11757 | },
|
11758 | regionX: function regionX(d) {
|
11759 | return this.getRegionXY("x", d);
|
11760 | },
|
11761 | regionY: function regionY(d) {
|
11762 | return this.getRegionXY("y", d);
|
11763 | },
|
11764 | getRegionSize: function getRegionSize(type, d) {
|
11765 | var scale,
|
11766 | $$ = this,
|
11767 | config = $$.config,
|
11768 | isRotated = config.axis_rotated,
|
11769 | isWidth = type === "width",
|
11770 | start = $$[isWidth ? "regionX" : "regionY"](d),
|
11771 | key = "end",
|
11772 | end = $$[type];
|
11773 | return d.axis === "y" || d.axis === "y2" ? (!isWidth && (key = "start"), (isWidth ? isRotated : !isRotated) && key in d && (scale = $$[d.axis], end = scale(d[key]))) : (isWidth ? !isRotated : isRotated) && key in d && (scale = $$.zoomScale || $$.x, end = scale($$.isTimeSeries() ? $$.parseDate(d[key]) : d[key])), end < start ? 0 : end - start;
|
11774 | },
|
11775 | regionWidth: function regionWidth(d) {
|
11776 | return this.getRegionSize("width", d);
|
11777 | },
|
11778 | regionHeight: function regionHeight(d) {
|
11779 | return this.getRegionSize("height", d);
|
11780 | },
|
11781 | isRegionOnX: function isRegionOnX(d) {
|
11782 | return !d.axis || d.axis === "x";
|
11783 | }
|
11784 | });
|
11785 |
|
11786 |
|
11787 |
|
11788 |
|
11789 |
|
11790 |
|
11791 |
|
11792 |
|
11793 |
|
11794 |
|
11795 |
|
11796 | extend(ChartInternal_ChartInternal.prototype, {
|
11797 | |
11798 |
|
11799 |
|
11800 |
|
11801 |
|
11802 |
|
11803 | drag: function drag(mouse) {
|
11804 | var $$ = this,
|
11805 | config = $$.config,
|
11806 | main = $$.main;
|
11807 |
|
11808 | if (!$$.hasArcType() && config.data_selection_enabled && (
|
11809 | !config.zoom_enabled || $$.zoom.altDomain) && config.data_selection_multiple
|
11810 | ) {
|
11811 | var _$$$dragStart = _slicedToArray($$.dragStart, 2),
|
11812 | sx = _$$$dragStart[0],
|
11813 | sy = _$$$dragStart[1],
|
11814 | _mouse = _slicedToArray(mouse, 2),
|
11815 | mx = _mouse[0],
|
11816 | my = _mouse[1],
|
11817 | minX = Math.min(sx, mx),
|
11818 | maxX = Math.max(sx, mx),
|
11819 | minY = config.data_selection_grouped ? $$.margin.top : Math.min(sy, my),
|
11820 | maxY = config.data_selection_grouped ? $$.height : Math.max(sy, my);
|
11821 |
|
11822 | main.select(".".concat(config_classes.dragarea)).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY), main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).filter(function (d) {
|
11823 | return config.data_selection_isselectable(d);
|
11824 | }).each(function (d, i) {
|
11825 | var toggle,
|
11826 | shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
11827 | isSelected = shape.classed(config_classes.SELECTED),
|
11828 | isIncluded = shape.classed(config_classes.INCLUDED),
|
11829 | isWithin = !1;
|
11830 |
|
11831 | if (shape.classed(config_classes.circle)) {
|
11832 | var x = shape.attr("cx") * 1,
|
11833 | y = shape.attr("cy") * 1;
|
11834 | toggle = $$.togglePoint, isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
11835 | } else if (shape.classed(config_classes.bar)) {
|
11836 | var _getPathBox = getPathBox(this),
|
11837 | _x = _getPathBox.x,
|
11838 | y = _getPathBox.y,
|
11839 | width = _getPathBox.width,
|
11840 | height = _getPathBox.height;
|
11841 |
|
11842 | toggle = $$.togglePath, isWithin = !(maxX < _x || _x + width < minX) && !(maxY < y || y + height < minY);
|
11843 | } else
|
11844 | return;
|
11845 |
|
11846 | isWithin ^ isIncluded && (shape.classed(config_classes.INCLUDED, !isIncluded), shape.classed(config_classes.SELECTED, !isSelected), toggle.call($$, !isSelected, shape, d, i));
|
11847 | });
|
11848 | }
|
11849 | },
|
11850 |
|
11851 | |
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 | dragstart: function dragstart(mouse) {
|
11858 | var $$ = this,
|
11859 | config = $$.config;
|
11860 | $$.hasArcType() || !config.data_selection_enabled || ($$.dragStart = mouse, $$.main.select(".".concat(config_classes.chart)).append("rect").attr("class", config_classes.dragarea).style("opacity", "0.1"), $$.setDragStatus(!0));
|
11861 | },
|
11862 |
|
11863 | |
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 | dragend: function dragend() {
|
11869 | var $$ = this,
|
11870 | config = $$.config;
|
11871 | $$.hasArcType() || !config.data_selection_enabled || ($$.main.select(".".concat(config_classes.dragarea)).transition().duration(100).style("opacity", "0").remove(), $$.main.selectAll(".".concat(config_classes.shape)).classed(config_classes.INCLUDED, !1), $$.setDragStatus(!1));
|
11872 | },
|
11873 | setDragStatus: function setDragStatus(isDragging) {
|
11874 | this.dragging = isDragging;
|
11875 | }
|
11876 | });
|
11877 |
|
11878 | var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(12);
|
11879 |
|
11880 |
|
11881 |
|
11882 |
|
11883 |
|
11884 |
|
11885 |
|
11886 |
|
11887 |
|
11888 |
|
11889 |
|
11890 | extend(ChartInternal_ChartInternal.prototype, {
|
11891 | |
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 |
|
11897 |
|
11898 | selectPoint: function selectPoint(target, d, i) {
|
11899 | var $$ = this,
|
11900 | config = $$.config,
|
11901 | isRotated = config.axis_rotated,
|
11902 | cx = (isRotated ? $$.circleY : $$.circleX).bind($$),
|
11903 | cy = (isRotated ? $$.circleX : $$.circleY).bind($$),
|
11904 | r = $$.pointSelectR.bind($$);
|
11905 |
|
11906 | callFn(config.data_onselected, $$.api, d, target.node()), $$.main.select(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(d.id))).selectAll(".".concat(config_classes.selectedCircle, "-").concat(i)).data([d]).enter().append("circle").attr("class", function () {
|
11907 | return $$.generateClass(config_classes.selectedCircle, i);
|
11908 | }).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", function (d2) {
|
11909 | return $$.pointSelectR(d2) * 1.4;
|
11910 | }).transition().duration(100).attr("r", r);
|
11911 | },
|
11912 |
|
11913 | |
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 |
|
11920 | unselectPoint: function unselectPoint(target, d, i) {
|
11921 | var $$ = this;
|
11922 |
|
11923 | callFn($$.config.data_onunselected, $$.api, d, target.node()), $$.main.select(".".concat(config_classes.selectedCircles).concat($$.getTargetSelectorSuffix(d.id))).selectAll(".".concat(config_classes.selectedCircle, "-").concat(i)).transition().duration(100).attr("r", 0).remove();
|
11924 | },
|
11925 |
|
11926 | |
11927 |
|
11928 |
|
11929 |
|
11930 |
|
11931 |
|
11932 |
|
11933 |
|
11934 | togglePoint: function togglePoint(selected, target, d, i) {
|
11935 | var method = "".concat(selected ? "" : "un", "selectPoint");
|
11936 | this[method](target, d, i);
|
11937 | },
|
11938 |
|
11939 | |
11940 |
|
11941 |
|
11942 |
|
11943 |
|
11944 |
|
11945 | selectPath: function selectPath(target, d) {
|
11946 | var $$ = this,
|
11947 | config = $$.config;
|
11948 | callFn(config.data_onselected, $$, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () {
|
11949 | return Object(external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_["rgb"])($$.color(d)).brighter(.75);
|
11950 | });
|
11951 | },
|
11952 |
|
11953 | |
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 | unselectPath: function unselectPath(target, d) {
|
11960 | var $$ = this,
|
11961 | config = $$.config;
|
11962 | callFn(config.data_onunselected, $$, d, target.node()), config.interaction_brighten && target.transition().duration(100).style("fill", function () {
|
11963 | return $$.color(d);
|
11964 | });
|
11965 | },
|
11966 |
|
11967 | |
11968 |
|
11969 |
|
11970 |
|
11971 |
|
11972 |
|
11973 |
|
11974 |
|
11975 | togglePath: function togglePath(selected, target, d, i) {
|
11976 | this["".concat(selected ? "" : "un", "selectPath")](target, d, i);
|
11977 | },
|
11978 |
|
11979 | |
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 |
|
11985 |
|
11986 | getToggle: function getToggle(that, d) {
|
11987 | var $$ = this;
|
11988 | return that.nodeName === "path" ? $$.togglePath : $$.isStepType(d) ? function () {} :
|
11989 | $$.togglePoint;
|
11990 | },
|
11991 |
|
11992 | |
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 | toggleShape: function toggleShape(that, d, i) {
|
12000 | var toggledShape,
|
12001 | $$ = this,
|
12002 | config = $$.config,
|
12003 | shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(that),
|
12004 | isSelected = shape.classed(config_classes.SELECTED),
|
12005 | toggle = $$.getToggle(that, d).bind($$);
|
12006 |
|
12007 | if (config.data_selection_enabled && config.data_selection_isselectable(d)) {
|
12008 | if (!config.data_selection_multiple) {
|
12009 | var selector = ".".concat(config_classes.shapes);
|
12010 | config.data_selection_grouped && (selector += $$.getTargetSelectorSuffix(d.id)), $$.main.selectAll(selector).selectAll(".".concat(config_classes.shape)).each(function (d, i) {
|
12011 | var shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this);
|
12012 | shape.classed(config_classes.SELECTED) && (toggledShape = shape, toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i));
|
12013 | });
|
12014 | }
|
12015 |
|
12016 | toggledShape && toggledShape.node() === shape.node() || (shape.classed(config_classes.SELECTED, !isSelected), toggle(!isSelected, shape, d, i));
|
12017 | }
|
12018 | }
|
12019 | });
|
12020 |
|
12021 |
|
12022 |
|
12023 |
|
12024 |
|
12025 |
|
12026 |
|
12027 |
|
12028 |
|
12029 |
|
12030 | extend(ChartInternal_ChartInternal.prototype, {
|
12031 | |
12032 |
|
12033 |
|
12034 |
|
12035 | initBrush: function initBrush() {
|
12036 | var $$ = this,
|
12037 | config = $$.config,
|
12038 | isRotated = config.axis_rotated;
|
12039 | $$.brush = isRotated ? Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushY"])() : Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushX"])();
|
12040 |
|
12041 |
|
12042 | var lastDomain,
|
12043 | timeout,
|
12044 | brushHandler = function () {
|
12045 | $$.redrawForBrush();
|
12046 | },
|
12047 | getBrushSize = function () {
|
12048 | var brush = $$.svg.select(".".concat(config_classes.brush, " .overlay")),
|
12049 | brushSize = {
|
12050 | width: 0,
|
12051 | height: 0
|
12052 | };
|
12053 | return brush.size() && (brushSize.width = +brush.attr("width"), brushSize.height = +brush.attr("height")), brushSize[isRotated ? "width" : "height"];
|
12054 | };
|
12055 |
|
12056 |
|
12057 | $$.brush.on("start", function () {
|
12058 | $$.inputType === "touch" && $$.hideTooltip(), brushHandler();
|
12059 | }).on("brush", brushHandler).on("end", function () {
|
12060 | lastDomain = $$.x.orgDomain();
|
12061 | }), $$.brush.updateResize = function () {
|
12062 | var _this = this;
|
12063 |
|
12064 | timeout && clearTimeout(timeout), timeout = setTimeout(function () {
|
12065 | var selection = _this.getSelection();
|
12066 |
|
12067 | lastDomain && Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushSelection"])(selection.node()) && _this.move(selection, lastDomain.map($$.subX.orgScale()));
|
12068 | }, 0);
|
12069 | }, $$.brush.update = function () {
|
12070 | var extent = this.extent()();
|
12071 | return extent[1].filter(function (v) {
|
12072 | return isNaN(v);
|
12073 | }).length === 0 && $$.context && $$.context.select(".".concat(config_classes.brush)).call(this), this;
|
12074 | }, $$.brush.scale = function (scale) {
|
12075 | var h = config.subchart_size_height || getBrushSize(),
|
12076 | extent = $$.getExtent();
|
12077 |
|
12078 |
|
12079 |
|
12080 | !extent && scale.range ? extent = [[0, 0], [scale.range()[1], h]] : isArray(extent) && (extent = extent.map(function (v, i) {
|
12081 | return [v, i > 0 ? h : i];
|
12082 | })), isRotated && extent[1].reverse(), this.extent(extent), this.update();
|
12083 | }, $$.brush.getSelection = function () {
|
12084 | return $$.context ? $$.context.select(".".concat(config_classes.brush)) : Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])([]);
|
12085 | };
|
12086 | },
|
12087 |
|
12088 | |
12089 |
|
12090 |
|
12091 |
|
12092 | initSubchart: function initSubchart() {
|
12093 | var $$ = this,
|
12094 | config = $$.config,
|
12095 | visibility = config.subchart_show ? "visible" : "hidden",
|
12096 | clipId = "".concat($$.clipId, "-subchart"),
|
12097 | clipPath = $$.getClipPath(clipId);
|
12098 | $$.clipIdForSubchart = clipId, $$.appendClip($$.defs, clipId), $$.initBrush(), $$.context = $$.svg.append("g").attr("transform", $$.getTranslate("context"));
|
12099 | var context = $$.context;
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 |
|
12105 |
|
12106 | context.style("visibility", visibility), context.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart), $$.hasType("bar") && context.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartBars), context.select(".".concat(config_classes.chart)).append("g").attr("class", config_classes.chartLines), context.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).call($$.brush), $$.axes.subx = context.append("g").attr("class", config_classes.axisX).attr("transform", $$.getTranslate("subx")).attr("clip-path", config.axis_rotated ? "" : $$.clipPathForXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden");
|
12107 | },
|
12108 |
|
12109 | |
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 | updateTargetsForSubchart: function updateTargetsForSubchart(targets) {
|
12115 | var $$ = this,
|
12116 | context = $$.context,
|
12117 | config = $$.config,
|
12118 | classChartBar = $$.classChartBar.bind($$),
|
12119 | classBars = $$.classBars.bind($$),
|
12120 | classChartLine = $$.classChartLine.bind($$),
|
12121 | classLines = $$.classLines.bind($$),
|
12122 | classAreas = $$.classAreas.bind($$);
|
12123 |
|
12124 | if (config.subchart_show) {
|
12125 |
|
12126 | var contextBarUpdate = context.select(".".concat(config_classes.chartBars)).selectAll(".".concat(config_classes.chartBar)).data(targets).attr("class", classChartBar),
|
12127 | contextBarEnter = contextBarUpdate.enter().append("g").style("opacity", "0").attr("class", classChartBar).merge(contextBarUpdate);
|
12128 | contextBarEnter.append("g").attr("class", classBars);
|
12129 |
|
12130 | var contextLineUpdate = context.select(".".concat(config_classes.chartLines)).selectAll(".".concat(config_classes.chartLine)).data(targets).attr("class", classChartLine),
|
12131 | contextLineEnter = contextLineUpdate.enter().append("g").style("opacity", "0").attr("class", classChartLine).merge(contextLineUpdate);
|
12132 |
|
12133 |
|
12134 |
|
12135 | contextLineEnter.append("g").attr("class", classLines), $$.hasType("area") && contextLineEnter.append("g").attr("class", classAreas), context.selectAll(".".concat(config_classes.brush, " rect")).attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? $$.width2 : $$.height2);
|
12136 | }
|
12137 | },
|
12138 |
|
12139 | |
12140 |
|
12141 |
|
12142 |
|
12143 |
|
12144 | updateBarForSubchart: function updateBarForSubchart(durationForExit) {
|
12145 | var $$ = this;
|
12146 | $$.contextBar = $$.context.selectAll(".".concat(config_classes.bars)).selectAll(".".concat(config_classes.bar)).data($$.barData.bind($$)), $$.contextBar.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextBar = $$.contextBar.enter().append("path").attr("class", $$.classBar.bind($$)).style("stroke", "none").style("fill", $$.color).merge($$.contextBar).style("opacity", $$.initialOpacity.bind($$));
|
12147 | },
|
12148 |
|
12149 | |
12150 |
|
12151 |
|
12152 |
|
12153 |
|
12154 |
|
12155 |
|
12156 | redrawBarForSubchart: function redrawBarForSubchart(drawBarOnSub, withTransition, duration) {
|
12157 | var contextBar = withTransition ? this.contextBar.transition(getRandom()).duration(duration) : this.contextBar;
|
12158 | contextBar.attr("d", drawBarOnSub).style("opacity", "1");
|
12159 | },
|
12160 |
|
12161 | |
12162 |
|
12163 |
|
12164 |
|
12165 |
|
12166 | updateLineForSubchart: function updateLineForSubchart(durationForExit) {
|
12167 | var $$ = this;
|
12168 | $$.contextLine = $$.context.selectAll(".".concat(config_classes.lines)).selectAll(".".concat(config_classes.line)).data($$.lineData.bind($$)), $$.contextLine.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextLine = $$.contextLine.enter().append("path").attr("class", $$.classLine.bind($$)).style("stroke", $$.color).merge($$.contextLine).style("opacity", $$.initialOpacity.bind($$));
|
12169 | },
|
12170 |
|
12171 | |
12172 |
|
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 |
|
12178 | redrawLineForSubchart: function redrawLineForSubchart(drawLineOnSub, withTransition, duration) {
|
12179 | var contextLine = withTransition ? this.contextLine.transition(getRandom()).duration(duration) : this.contextLine;
|
12180 | contextLine.attr("d", drawLineOnSub).style("opacity", "1");
|
12181 | },
|
12182 |
|
12183 | |
12184 |
|
12185 |
|
12186 |
|
12187 |
|
12188 | updateAreaForSubchart: function updateAreaForSubchart(durationForExit) {
|
12189 | var $$ = this;
|
12190 | $$.contextArea = $$.context.selectAll(".".concat(config_classes.areas)).selectAll(".".concat(config_classes.area)).data($$.lineData.bind($$)), $$.contextArea.exit().transition().duration(durationForExit).style("opacity", "0").remove(), $$.contextArea = $$.contextArea.enter().append("path").attr("class", $$.classArea.bind($$)).style("fill", $$.color).style("opacity", function () {
|
12191 | return $$.orgAreaOpacity = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).style("opacity"), "0";
|
12192 | }).merge($$.contextArea).style("opacity", "0");
|
12193 | },
|
12194 |
|
12195 | |
12196 |
|
12197 |
|
12198 |
|
12199 |
|
12200 |
|
12201 |
|
12202 | redrawAreaForSubchart: function redrawAreaForSubchart(drawAreaOnSub, withTransition, duration) {
|
12203 | var contextArea = withTransition ? this.contextArea.transition(getRandom()).duration(duration) : this.contextArea;
|
12204 | contextArea.attr("d", drawAreaOnSub).style("fill", this.color).style("opacity", this.orgAreaOpacity);
|
12205 | },
|
12206 |
|
12207 | |
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 | redrawSubchart: function redrawSubchart(withSubchart, duration, shape) {
|
12215 | var $$ = this,
|
12216 | config = $$.config;
|
12217 | $$.context.style("visibility", config.subchart_show ? "visible" : "hidden"), config.subchart_show && (external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"] && external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].type === "zoom" && $$.brush.update(), withSubchart && (!brushEmpty($$) && $$.brush.update(), Object.keys(shape.type).forEach(function (v) {
|
12218 | var name = capitalize(v),
|
12219 | draw = $$["generateDraw".concat(name)](shape.indices[v], !0);
|
12220 | $$["update".concat(name, "ForSubchart")](duration), $$["redraw".concat(name, "ForSubchart")](draw, duration, duration);
|
12221 | })));
|
12222 | },
|
12223 |
|
12224 | |
12225 |
|
12226 |
|
12227 |
|
12228 | redrawForBrush: function redrawForBrush() {
|
12229 | var $$ = this;
|
12230 | $$.redraw({
|
12231 | withTransition: !1,
|
12232 | withY: $$.config.zoom_rescale,
|
12233 | withSubchart: !1,
|
12234 | withUpdateXDomain: !0,
|
12235 | withDimension: !1
|
12236 | }), $$.config.subchart_onbrush.call($$.api, $$.x.orgDomain());
|
12237 | },
|
12238 |
|
12239 | |
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 | transformContext: function transformContext(withTransition, transitions) {
|
12246 | var subXAxis,
|
12247 | $$ = this;
|
12248 | transitions && transitions.axisSubX ? subXAxis = transitions.axisSubX : (subXAxis = $$.context.select(".".concat(config_classes.axisX)), withTransition && (subXAxis = subXAxis.transition())), $$.context.attr("transform", $$.getTranslate("context")), subXAxis.attr("transform", $$.getTranslate("subx"));
|
12249 | },
|
12250 |
|
12251 | |
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 | getExtent: function getExtent() {
|
12257 | var $$ = this,
|
12258 | extent = $$.config.axis_x_extent;
|
12259 | return extent && (isFunction(extent) ? extent = extent($$.getXDomain($$.data.targets), $$.subX) : $$.isTimeSeries() && extent.every(isNaN) && (extent = extent.map(function (v) {
|
12260 | return $$.subX($$.parseDate(v));
|
12261 | }))), extent;
|
12262 | }
|
12263 | });
|
12264 |
|
12265 | var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(13);
|
12266 |
|
12267 |
|
12268 |
|
12269 |
|
12270 |
|
12271 |
|
12272 |
|
12273 |
|
12274 |
|
12275 |
|
12276 |
|
12277 |
|
12278 |
|
12279 |
|
12280 |
|
12281 | extend(ChartInternal_ChartInternal.prototype, {
|
12282 | |
12283 |
|
12284 |
|
12285 |
|
12286 | initZoom: function initZoom() {
|
12287 | var $$ = this;
|
12288 | $$.zoomScale = null, $$.generateZoom(), $$.initZoomBehaviour();
|
12289 | },
|
12290 |
|
12291 | |
12292 |
|
12293 |
|
12294 |
|
12295 |
|
12296 | bindZoomEvent: function bindZoomEvent() {
|
12297 | var bind = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0],
|
12298 | $$ = this,
|
12299 | zoomEnabled = $$.config.zoom_enabled;
|
12300 | $$.redrawEventRect();
|
12301 | var eventRects = $$.main.select(".".concat(config_classes.eventRects));
|
12302 | zoomEnabled && bind ? !$$.config.subchart_show && $$.bindZoomOnEventRect(eventRects, zoomEnabled.type) : bind === !1 && ($$.api.unzoom(), eventRects.on(".zoom", null).on(".drag", null));
|
12303 | },
|
12304 |
|
12305 | |
12306 |
|
12307 |
|
12308 |
|
12309 | generateZoom: function generateZoom() {
|
12310 | var $$ = this,
|
12311 | config = $$.config,
|
12312 | zoom = Object(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($$));
|
12313 |
|
12314 |
|
12315 | |
12316 |
|
12317 |
|
12318 |
|
12319 |
|
12320 | zoom.orgScaleExtent = function () {
|
12321 | var extent = config.zoom_extent || [1, 10];
|
12322 | return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])];
|
12323 | }, zoom.updateScaleExtent = function () {
|
12324 | var ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()),
|
12325 | extent = this.orgScaleExtent();
|
12326 | return this.scaleExtent([extent[0] * ratio, extent[1] * ratio]), this;
|
12327 | }, zoom.updateTransformScale = function (transform) {
|
12328 | $$.orgXScale && $$.orgXScale.range($$.x.range());
|
12329 |
|
12330 | var newScale = transform[config.axis_rotated ? "rescaleY" : "rescaleX"]($$.orgXScale || $$.x),
|
12331 | domain = $$.trimXDomain(newScale.domain()),
|
12332 | rescale = config.zoom_rescale;
|
12333 | newScale.domain(domain, $$.orgXDomain), $$.zoomScale = $$.getCustomizedScale(newScale), $$.xAxis.scale($$.zoomScale), rescale && (!$$.orgXScale && ($$.orgXScale = $$.x.copy()), $$.x.domain(domain));
|
12334 | }, $$.zoom = zoom;
|
12335 | },
|
12336 |
|
12337 | |
12338 |
|
12339 |
|
12340 |
|
12341 | onZoomStart: function onZoomStart() {
|
12342 | var $$ = this,
|
12343 | event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].sourceEvent;
|
12344 | event && ($$.zoom.startEvent = event, callFn($$.config.zoom_onzoomstart, $$.api, event));
|
12345 | },
|
12346 |
|
12347 | |
12348 |
|
12349 |
|
12350 |
|
12351 | onZoom: function onZoom() {
|
12352 | var $$ = this,
|
12353 | config = $$.config,
|
12354 | event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"],
|
12355 | sourceEvent = event.sourceEvent;
|
12356 |
|
12357 | if (config.zoom_enabled && event.sourceEvent && $$.filterTargetsToShow($$.data.targets).length !== 0 && ($$.zoomScale || !(sourceEvent.type.indexOf("touch") > -1) || sourceEvent.touches.length !== 1)) {
|
12358 | var isMousemove = sourceEvent.type === "mousemove",
|
12359 | isZoomOut = sourceEvent.wheelDelta < 0,
|
12360 | transform = event.transform;
|
12361 | !isMousemove && isZoomOut && $$.x.domain().every(function (v, i) {
|
12362 | return v !== $$.orgXDomain[i];
|
12363 | }) && $$.x.domain($$.orgXDomain), $$.zoom.updateTransformScale(transform), $$.isCategorized() && $$.x.orgDomain()[0] === $$.orgXDomain[0] && $$.x.domain([$$.orgXDomain[0] - 1e-10, $$.x.orgDomain()[1]]), $$.redraw({
|
12364 | withTransition: !1,
|
12365 | withY: config.zoom_rescale,
|
12366 | withSubchart: !1,
|
12367 | withEventRect: !1,
|
12368 | withDimension: !1
|
12369 | }), $$.cancelClick = isMousemove, callFn(config.zoom_onzoom, $$.api, $$.zoomScale.domain());
|
12370 | }
|
12371 | },
|
12372 |
|
12373 | |
12374 |
|
12375 |
|
12376 |
|
12377 | onZoomEnd: function onZoomEnd() {
|
12378 | var $$ = this,
|
12379 | startEvent = $$.zoom.startEvent,
|
12380 | event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"] && external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].sourceEvent;
|
12381 | startEvent && startEvent.type.indexOf("touch") > -1 && (startEvent = startEvent.changedTouches[0], event = event.changedTouches[0]);
|
12382 |
|
12383 | !startEvent || event && startEvent.clientX === event.clientX && startEvent.clientY === event.clientY || ($$.redrawEventRect(), $$.updateZoom(), callFn($$.config.zoom_onzoomend, $$.api, $$[$$.zoomScale ? "zoomScale" : "subX"].domain()));
|
12384 | },
|
12385 |
|
12386 | |
12387 |
|
12388 |
|
12389 |
|
12390 |
|
12391 | getZoomDomain: function getZoomDomain() {
|
12392 | var $$ = this,
|
12393 | config = $$.config,
|
12394 | _$$$orgXDomain = _slicedToArray($$.orgXDomain, 2),
|
12395 | min = _$$$orgXDomain[0],
|
12396 | max = _$$$orgXDomain[1];
|
12397 |
|
12398 | 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];
|
12399 | },
|
12400 |
|
12401 | |
12402 |
|
12403 |
|
12404 |
|
12405 |
|
12406 | updateZoom: function updateZoom(force) {
|
12407 | var $$ = this;
|
12408 |
|
12409 | if ($$.zoomScale) {
|
12410 | var zoomDomain = $$.zoomScale.domain(),
|
12411 | xDomain = $$.subX.domain(),
|
12412 | delta = .015,
|
12413 | isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
|
12414 | (force || isfullyShown) && ($$.xAxis.scale($$.subX), $$.x.domain($$.subX.orgDomain()), $$.zoomScale = null);
|
12415 | }
|
12416 | },
|
12417 |
|
12418 | |
12419 |
|
12420 |
|
12421 |
|
12422 | bindZoomOnEventRect: function bindZoomOnEventRect(eventRects, type) {
|
12423 | var $$ = this,
|
12424 | behaviour = type === "drag" ? $$.zoomBehaviour : $$.zoom;
|
12425 | eventRects.call(behaviour).on("dblclick.zoom", null);
|
12426 | },
|
12427 |
|
12428 | |
12429 |
|
12430 |
|
12431 |
|
12432 | initZoomBehaviour: function initZoomBehaviour() {
|
12433 | var $$ = this,
|
12434 | config = $$.config,
|
12435 | isRotated = config.axis_rotated,
|
12436 | start = 0,
|
12437 | end = 0,
|
12438 | zoomRect = null,
|
12439 | prop = {
|
12440 | axis: isRotated ? "y" : "x",
|
12441 | attr: isRotated ? "height" : "width",
|
12442 | index: isRotated ? 1 : 0
|
12443 | };
|
12444 | $$.zoomBehaviour = Object(external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_["drag"])().clickDistance(4).on("start", function () {
|
12445 | $$.setDragStatus(!0), zoomRect || (zoomRect = $$.main.append("rect").attr("clip-path", $$.clipPath).attr("class", config_classes.zoomBrush).attr("width", isRotated ? $$.width : 0).attr("height", isRotated ? 0 : $$.height)), start = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)[prop.index], end = start, zoomRect.attr(prop.axis, start).attr(prop.attr, 0), $$.onZoomStart();
|
12446 | }).on("drag", function () {
|
12447 | end = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["mouse"])(this)[prop.index], zoomRect.attr(prop.axis, Math.min(start, end)).attr(prop.attr, Math.abs(end - start));
|
12448 | }).on("end", function () {
|
12449 | var _ref,
|
12450 | scale = $$.zoomScale || $$.x;
|
12451 |
|
12452 | if ($$.setDragStatus(!1), zoomRect.attr(prop.axis, 0).attr(prop.attr, 0), start > end && (_ref = [end, start], start = _ref[0], end = _ref[1], _ref), start < 0 && (end += Math.abs(start), start = 0), start !== end) $$.api.zoom([start, end].map(function (v) {
|
12453 | return scale.invert(v);
|
12454 | })), $$.onZoomEnd();else if ($$.isMultipleX()) $$.clickHandlerForMultipleXS.bind(this)($$);else {
|
12455 | var _event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"].sourceEvent || external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"],
|
12456 | _ref2 = "clientX" in _event ? [_event.clientX, _event.clientY] : [_event.x, _event.y],
|
12457 | _ref3 = _slicedToArray(_ref2, 2),
|
12458 | x = _ref3[0],
|
12459 | y = _ref3[1],
|
12460 | target = browser_doc.elementFromPoint(x, y);
|
12461 |
|
12462 | $$.clickHandlerForSingleX.bind(target)(Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(target).datum(), $$);
|
12463 | }
|
12464 | });
|
12465 | },
|
12466 | setZoomResetButton: function setZoomResetButton() {
|
12467 | var $$ = this,
|
12468 | config = $$.config,
|
12469 | resetButton = config.zoom_resetButton;
|
12470 | resetButton && config.zoom_enabled.type === "drag" && ($$.zoom.resetBtn ? $$.zoom.resetBtn.style("display", null) : $$.zoom.resetBtn = $$.selectChart.append("div").classed(config_classes.button, !0).append("span").on("click", function () {
|
12471 | isFunction(resetButton.onclick) && resetButton.onclick(this), $$.api.unzoom.call($$);
|
12472 | }).classed(config_classes.buttonZoomReset, !0).text(resetButton.text || "Reset Zoom"));
|
12473 | }
|
12474 | });
|
12475 |
|
12476 |
|
12477 |
|
12478 |
|
12479 |
|
12480 |
|
12481 |
|
12482 |
|
12483 |
|
12484 |
|
12485 |
|
12486 |
|
12487 |
|
12488 |
|
12489 |
|
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 | var colorizePattern = function (pattern, color, id) {
|
12497 | var node = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(pattern.cloneNode(!0));
|
12498 | return node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color), {
|
12499 | id: id,
|
12500 | node: node.node()
|
12501 | };
|
12502 | },
|
12503 | schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
|
12504 |
|
12505 |
|
12506 |
|
12507 | extend(ChartInternal_ChartInternal.prototype, {
|
12508 | |
12509 |
|
12510 |
|
12511 |
|
12512 |
|
12513 |
|
12514 | getColorFromCss: function getColorFromCss() {
|
12515 | var body = browser_doc.body,
|
12516 | pattern = body["__colorPattern__"];
|
12517 |
|
12518 | if (!pattern) {
|
12519 | var span = browser_doc.createElement("span");
|
12520 | span.className = config_classes.colorPattern, span.style.display = "none", body.appendChild(span);
|
12521 | var content = win.getComputedStyle(span).backgroundImage;
|
12522 | span.parentNode.removeChild(span), content.indexOf(";") > -1 && (pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) {
|
12523 | return v.trim().replace(/[\"'\s]/g, "");
|
12524 | }).filter(Boolean), body["__colorPattern__"] = pattern);
|
12525 | }
|
12526 |
|
12527 | return pattern;
|
12528 | },
|
12529 | generateColor: function generateColor() {
|
12530 | var $$ = this,
|
12531 | config = $$.config,
|
12532 | colors = config.data_colors,
|
12533 | callback = config.data_color,
|
12534 | ids = [],
|
12535 | pattern = notEmpty(config.color_pattern) ? config.color_pattern : Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleOrdinal"])($$.getColorFromCss() || schemeCategory10).range(),
|
12536 | originalColorPattern = pattern;
|
12537 |
|
12538 | if (isFunction(config.color_tiles)) {
|
12539 | var tiles = config.color_tiles(),
|
12540 | colorizedPatterns = pattern.map(function (p, index) {
|
12541 | var color = p.replace(/[#\(\)\s,]/g, ""),
|
12542 | id = "".concat($$.datetimeId, "-pattern-").concat(color, "-").concat(index);
|
12543 | return colorizePattern(tiles[index % tiles.length], p, id);
|
12544 | });
|
12545 |
|
12546 | pattern = colorizedPatterns.map(function (p) {
|
12547 | return "url(#".concat(p.id, ")");
|
12548 | }), $$.patterns = colorizedPatterns;
|
12549 | }
|
12550 |
|
12551 | return function (d) {
|
12552 | var color,
|
12553 | id = d.id || d.data && d.data.id || d,
|
12554 | isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !$$.config.data_types[id];
|
12555 | return isFunction(colors[id]) ? color = colors[id](d) : colors[id] ? color = colors[id] : (ids.indexOf(id) < 0 && ids.push(id), color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length], colors[id] = color), isFunction(callback) ? callback(color, d) : color;
|
12556 | };
|
12557 | },
|
12558 | generateLevelColor: function generateLevelColor() {
|
12559 | var $$ = this,
|
12560 | config = $$.config,
|
12561 | colors = config.color_pattern,
|
12562 | threshold = config.color_threshold,
|
12563 | asValue = threshold.unit === "value",
|
12564 | max = threshold.max || 100,
|
12565 | values = threshold.values && threshold.values.length ? threshold.values : [];
|
12566 | return notEmpty(threshold) ? function (value) {
|
12567 | var v = asValue ? value : value * 100 / max,
|
12568 | color = colors[colors.length - 1];
|
12569 |
|
12570 | for (var i = 0, l = values.length; i < l; i++) if (v <= values[i]) {
|
12571 | color = colors[i];
|
12572 | break;
|
12573 | }
|
12574 |
|
12575 | return color;
|
12576 | } : null;
|
12577 | },
|
12578 |
|
12579 | |
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 |
|
12585 |
|
12586 | setOverColor: function setOverColor(isOver, d) {
|
12587 | var $$ = this,
|
12588 | config = $$.config,
|
12589 | onover = config.color_onover,
|
12590 | color = isOver ? onover : $$.color;
|
12591 | isObject(color) ? color = function (_ref) {
|
12592 | var id = _ref.id;
|
12593 | return id in onover ? onover[id] : $$.color(id);
|
12594 | } : isString(color) && (color = function () {
|
12595 | return onover;
|
12596 | }), isObject(d) ? $$.main.selectAll(".".concat(config_classes.arc).concat($$.getTargetSelectorSuffix(d.id))).style("fill", color(d)) : $$.main.selectAll(".".concat(config_classes.shape, "-").concat(d)).style("fill", color);
|
12597 | }
|
12598 | });
|
12599 |
|
12600 |
|
12601 |
|
12602 |
|
12603 |
|
12604 |
|
12605 |
|
12606 |
|
12607 | var getFormat = function ($$, typeValue, v) {
|
12608 | var config = $$.config,
|
12609 | type = "axis_".concat(typeValue, "_tick_format"),
|
12610 | format = config[type] ? config[type] : $$.defaultValueFormat;
|
12611 | return format(v);
|
12612 | };
|
12613 |
|
12614 | extend(ChartInternal_ChartInternal.prototype, {
|
12615 | getYFormat: function getYFormat(forArc) {
|
12616 | var $$ = this,
|
12617 | formatForY = $$.yFormat,
|
12618 | formatForY2 = $$.y2Format;
|
12619 | return forArc && !$$.hasType("gauge") && (formatForY = $$.defaultArcValueFormat, formatForY2 = $$.defaultArcValueFormat), function (v, ratio, id) {
|
12620 | var format = $$.axis.getId(id) === "y2" ? formatForY2 : formatForY;
|
12621 | return format.call($$, v, ratio);
|
12622 | };
|
12623 | },
|
12624 | yFormat: function yFormat(v) {
|
12625 | return getFormat(this, "y", v);
|
12626 | },
|
12627 | y2Format: function y2Format(v) {
|
12628 | return getFormat(this, "y2", v);
|
12629 | },
|
12630 | defaultValueFormat: function defaultValueFormat(v) {
|
12631 | return isValue(v) ? +v : "";
|
12632 | },
|
12633 | defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
12634 | return "".concat((ratio * 100).toFixed(1), "%");
|
12635 | },
|
12636 | dataLabelFormat: function dataLabelFormat(targetId) {
|
12637 | var $$ = this,
|
12638 | dataLabels = $$.config.data_labels,
|
12639 | defaultFormat = function (v) {
|
12640 | return isValue(v) ? +v : "";
|
12641 | },
|
12642 | format = defaultFormat;
|
12643 |
|
12644 | return isFunction(dataLabels.format) ? format = dataLabels.format : isObjectType(dataLabels.format) && (dataLabels.format[targetId] ? format = dataLabels.format[targetId] === !0 ? defaultFormat : dataLabels.format[targetId] : format = function () {
|
12645 | return "";
|
12646 | }), format;
|
12647 | }
|
12648 | });
|
12649 |
|
12650 |
|
12651 |
|
12652 |
|
12653 |
|
12654 |
|
12655 |
|
12656 | extend(ChartInternal_ChartInternal.prototype, {
|
12657 | |
12658 |
|
12659 |
|
12660 |
|
12661 |
|
12662 |
|
12663 |
|
12664 | addCache: function addCache(key, value) {
|
12665 | var isDataType = !!(arguments.length > 2 && arguments[2] !== undefined) && arguments[2];
|
12666 | this.cache[key] = isDataType ? this.cloneTarget(value) : value;
|
12667 | },
|
12668 |
|
12669 | |
12670 |
|
12671 |
|
12672 |
|
12673 |
|
12674 | removeCache: function removeCache(key) {
|
12675 | var _this = this;
|
12676 |
|
12677 | toArray(key).forEach(function (v) {
|
12678 | return delete _this.cache[v];
|
12679 | });
|
12680 | },
|
12681 |
|
12682 | |
12683 |
|
12684 |
|
12685 |
|
12686 |
|
12687 |
|
12688 |
|
12689 | getCache: function getCache(key) {
|
12690 | var isDataType = !!(arguments.length > 1 && arguments[1] !== undefined) && arguments[1];
|
12691 |
|
12692 | if (isDataType) {
|
12693 | var targets = [];
|
12694 |
|
12695 | for (var id, i = 0; id = key[i]; i++) id in this.cache && targets.push(this.cloneTarget(this.cache[id]));
|
12696 |
|
12697 | return targets;
|
12698 | }
|
12699 |
|
12700 | return this.cache[key] || null;
|
12701 | },
|
12702 |
|
12703 | |
12704 |
|
12705 |
|
12706 |
|
12707 |
|
12708 | resetCache: function resetCache(all) {
|
12709 | var $$ = this;
|
12710 |
|
12711 | for (var x in $$.cache) (all || /^\$/.test(x)) && ($$.cache[x] = null);
|
12712 | }
|
12713 | });
|
12714 |
|
12715 |
|
12716 |
|
12717 |
|
12718 |
|
12719 |
|
12720 |
|
12721 |
|
12722 | extend(ChartInternal_ChartInternal.prototype, {
|
12723 | generateClass: function generateClass(prefix, targetId) {
|
12724 | return " ".concat(prefix, " ").concat(prefix + this.getTargetSelectorSuffix(targetId));
|
12725 | },
|
12726 | classText: function classText(d) {
|
12727 | return this.generateClass(config_classes.text, d.index);
|
12728 | },
|
12729 | classTexts: function classTexts(d) {
|
12730 | return this.generateClass(config_classes.texts, d.id);
|
12731 | },
|
12732 | classShape: function classShape(d) {
|
12733 | return this.generateClass(config_classes.shape, d.index);
|
12734 | },
|
12735 | classShapes: function classShapes(d) {
|
12736 | return this.generateClass(config_classes.shapes, d.id);
|
12737 | },
|
12738 | generateExtraLineClass: function generateExtraLineClass() {
|
12739 | var $$ = this,
|
12740 | classes = $$.config.line_classes || [],
|
12741 | ids = [];
|
12742 | return function (d) {
|
12743 | var id = d.id || d.data && d.data.id || d;
|
12744 | return ids.indexOf(id) < 0 && ids.push(id), classes[ids.indexOf(id) % classes.length];
|
12745 | };
|
12746 | },
|
12747 | classLine: function classLine(d) {
|
12748 | return this.classShape(d) + this.generateClass(config_classes.line, d.id);
|
12749 | },
|
12750 | classLines: function classLines(d) {
|
12751 | return this.classShapes(d) + this.generateClass(config_classes.lines, d.id);
|
12752 | },
|
12753 | classCircle: function classCircle(d) {
|
12754 | return this.classShape(d) + this.generateClass(config_classes.circle, d.index);
|
12755 | },
|
12756 | classCircles: function classCircles(d) {
|
12757 | return this.classShapes(d) + this.generateClass(config_classes.circles, d.id);
|
12758 | },
|
12759 | classBar: function classBar(d) {
|
12760 | return this.classShape(d) + this.generateClass(config_classes.bar, d.index);
|
12761 | },
|
12762 | classBars: function classBars(d) {
|
12763 | return this.classShapes(d) + this.generateClass(config_classes.bars, d.id);
|
12764 | },
|
12765 | classArc: function classArc(d) {
|
12766 | return this.classShape(d.data) + this.generateClass(config_classes.arc, d.data.id);
|
12767 | },
|
12768 | classArcs: function classArcs(d) {
|
12769 | return this.classShapes(d.data) + this.generateClass(config_classes.arcs, d.data.id);
|
12770 | },
|
12771 | classArea: function classArea(d) {
|
12772 | return this.classShape(d) + this.generateClass(config_classes.area, d.id);
|
12773 | },
|
12774 | classAreas: function classAreas(d) {
|
12775 | return this.classShapes(d) + this.generateClass(config_classes.areas, d.id);
|
12776 | },
|
12777 | classRegion: function classRegion(d, i) {
|
12778 | return "".concat(this.generateClass(config_classes.region, i), " ").concat("class" in d ? d["class"] : "");
|
12779 | },
|
12780 | classEvent: function classEvent(d) {
|
12781 | return this.generateClass(config_classes.eventRect, d.index);
|
12782 | },
|
12783 | classTarget: function classTarget(id) {
|
12784 | var additionalClassSuffix = this.config.data_classes[id],
|
12785 | additionalClass = "";
|
12786 | return additionalClassSuffix && (additionalClass = " ".concat(config_classes.target, "-").concat(additionalClassSuffix)), this.generateClass(config_classes.target, id) + additionalClass;
|
12787 | },
|
12788 | classFocus: function classFocus(d) {
|
12789 | return this.classFocused(d) + this.classDefocused(d);
|
12790 | },
|
12791 | classFocused: function classFocused(d) {
|
12792 | return " ".concat(this.focusedTargetIds.indexOf(d.id) >= 0 ? config_classes.focused : "");
|
12793 | },
|
12794 | classDefocused: function classDefocused(d) {
|
12795 | return " ".concat(this.defocusedTargetIds.indexOf(d.id) >= 0 ? config_classes.defocused : "");
|
12796 | },
|
12797 | classChartText: function classChartText(d) {
|
12798 | return config_classes.chartText + this.classTarget(d.id);
|
12799 | },
|
12800 | classChartLine: function classChartLine(d) {
|
12801 | return config_classes.chartLine + this.classTarget(d.id);
|
12802 | },
|
12803 | classChartBar: function classChartBar(d) {
|
12804 | return config_classes.chartBar + this.classTarget(d.id);
|
12805 | },
|
12806 | classChartArc: function classChartArc(d) {
|
12807 | return config_classes.chartArc + this.classTarget(d.data.id);
|
12808 | },
|
12809 | classChartRadar: function classChartRadar(d) {
|
12810 | return config_classes.chartRadar + this.classTarget(d.id);
|
12811 | },
|
12812 | getTargetSelectorSuffix: function getTargetSelectorSuffix(targetId) {
|
12813 | return targetId || targetId === 0 ? "-".concat(targetId).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, "-") : "";
|
12814 | },
|
12815 | selectorTarget: function selectorTarget(id, prefix) {
|
12816 | return "".concat(prefix || "", ".").concat(config_classes.target + this.getTargetSelectorSuffix(id));
|
12817 | },
|
12818 | selectorTargets: function selectorTargets(idsValue, prefix) {
|
12819 | var $$ = this,
|
12820 | ids = idsValue || [];
|
12821 | return ids.length ? ids.map(function (id) {
|
12822 | return $$.selectorTarget(id, prefix);
|
12823 | }) : null;
|
12824 | },
|
12825 | selectorLegend: function selectorLegend(id) {
|
12826 | return ".".concat(config_classes.legendItem + this.getTargetSelectorSuffix(id));
|
12827 | },
|
12828 | selectorLegends: function selectorLegends(ids) {
|
12829 | var $$ = this;
|
12830 | return ids && ids.length ? ids.map(function (id) {
|
12831 | return $$.selectorLegend(id);
|
12832 | }) : null;
|
12833 | }
|
12834 | });
|
12835 |
|
12836 |
|
12837 |
|
12838 |
|
12839 |
|
12840 |
|
12841 |
|
12842 |
|
12843 |
|
12844 | extend(Chart_Chart.prototype, {
|
12845 | |
12846 |
|
12847 |
|
12848 |
|
12849 |
|
12850 |
|
12851 |
|
12852 |
|
12853 |
|
12854 |
|
12855 |
|
12856 |
|
12857 |
|
12858 |
|
12859 |
|
12860 |
|
12861 |
|
12862 | focus: function focus(targetIdsValue) {
|
12863 | var $$ = this.internal,
|
12864 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
12865 | candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
12866 | this.revert(), this.defocus(), candidates.classed(config_classes.focused, !0).classed(config_classes.defocused, !1), $$.hasArcType() && ($$.expandArc(targetIds), $$.hasType("gauge") && $$.markOverlapped(targetIdsValue, $$, ".".concat(config_classes.gaugeValue))), $$.toggleFocusLegend(targetIds, !0), $$.focusedTargetIds = targetIds, $$.defocusedTargetIds = $$.defocusedTargetIds.filter(function (id) {
|
12867 | return targetIds.indexOf(id) < 0;
|
12868 | });
|
12869 | },
|
12870 |
|
12871 | |
12872 |
|
12873 |
|
12874 |
|
12875 |
|
12876 |
|
12877 |
|
12878 |
|
12879 |
|
12880 |
|
12881 |
|
12882 |
|
12883 |
|
12884 |
|
12885 |
|
12886 |
|
12887 |
|
12888 | defocus: function defocus(targetIdsValue) {
|
12889 | var $$ = this.internal,
|
12890 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
12891 | candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
12892 | candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !0), $$.hasArcType() && ($$.unexpandArc(targetIds), $$.hasType("gauge") && $$.undoMarkOverlapped($$, ".".concat(config_classes.gaugeValue))), $$.toggleFocusLegend(targetIds, !1), $$.focusedTargetIds = $$.focusedTargetIds.filter(function (id) {
|
12893 | return targetIds.indexOf(id) < 0;
|
12894 | }), $$.defocusedTargetIds = targetIds;
|
12895 | },
|
12896 |
|
12897 | |
12898 |
|
12899 |
|
12900 |
|
12901 |
|
12902 |
|
12903 |
|
12904 |
|
12905 |
|
12906 |
|
12907 |
|
12908 |
|
12909 |
|
12910 |
|
12911 |
|
12912 |
|
12913 |
|
12914 | revert: function revert(targetIdsValue) {
|
12915 | var $$ = this.internal,
|
12916 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
12917 | candidates = $$.svg.selectAll($$.selectorTargets(targetIds));
|
12918 |
|
12919 | candidates.classed(config_classes.focused, !1).classed(config_classes.defocused, !1), $$.hasArcType() && $$.unexpandArc(targetIds), $$.config.legend_show && ($$.showLegend(targetIds.filter($$.isLegendToShow.bind($$))), $$.legend.selectAll($$.selectorLegends(targetIds)).filter(function () {
|
12920 | return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.legendItemFocused);
|
12921 | }).classed(config_classes.legendItemFocused, !1)), $$.focusedTargetIds = [], $$.defocusedTargetIds = [];
|
12922 | }
|
12923 | });
|
12924 |
|
12925 |
|
12926 |
|
12927 |
|
12928 |
|
12929 |
|
12930 |
|
12931 | extend(Chart_Chart.prototype, {
|
12932 | |
12933 |
|
12934 |
|
12935 |
|
12936 | _showHide: function _showHide(show, targetIdsValue, options) {
|
12937 | var $$ = this.internal,
|
12938 | targetIds = $$.mapToTargetIds(targetIdsValue);
|
12939 | $$["".concat(show ? "remove" : "add", "HiddenTargetIds")](targetIds);
|
12940 | var targets = $$.svg.selectAll($$.selectorTargets(targetIds)),
|
12941 | opacity = show ? "1" : "0";
|
12942 | targets.transition().style("opacity", opacity, "important").call($$.endall, function () {
|
12943 | targets.style("opacity", null).style("opacity", opacity);
|
12944 | }), options.withLegend && $$["".concat(show ? "show" : "hide", "Legend")](targetIds), $$.redraw({
|
12945 | withUpdateOrgXDomain: !0,
|
12946 | withUpdateXDomain: !0,
|
12947 | withLegend: !0
|
12948 | });
|
12949 | },
|
12950 |
|
12951 | |
12952 |
|
12953 |
|
12954 |
|
12955 |
|
12956 |
|
12957 |
|
12958 |
|
12959 |
|
12960 |
|
12961 |
|
12962 |
|
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 |
|
12970 | show: function show(targetIdsValue) {
|
12971 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
12972 |
|
12973 | this._showHide(!0, targetIdsValue, options);
|
12974 | },
|
12975 |
|
12976 | |
12977 |
|
12978 |
|
12979 |
|
12980 |
|
12981 |
|
12982 |
|
12983 |
|
12984 |
|
12985 |
|
12986 |
|
12987 |
|
12988 |
|
12989 |
|
12990 |
|
12991 |
|
12992 |
|
12993 |
|
12994 |
|
12995 | hide: function hide(targetIdsValue) {
|
12996 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
12997 |
|
12998 | this._showHide(!1, targetIdsValue, options);
|
12999 | },
|
13000 |
|
13001 | |
13002 |
|
13003 |
|
13004 |
|
13005 |
|
13006 |
|
13007 |
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 |
|
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 | toggle: function toggle(targetIds) {
|
13021 | var _this = this,
|
13022 | options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
13023 | $$ = this.internal,
|
13024 | targets = {
|
13025 | show: [],
|
13026 | hide: []
|
13027 | };
|
13028 |
|
13029 |
|
13030 |
|
13031 |
|
13032 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
13033 | return targets[$$.isTargetToShow(id) ? "hide" : "show"].push(id);
|
13034 | }), targets.show.length && this.show(targets.show, options), targets.hide.length && setTimeout(function () {
|
13035 | return _this.hide(targets.hide, options);
|
13036 | }, 0);
|
13037 | }
|
13038 | });
|
13039 |
|
13040 |
|
13041 |
|
13042 |
|
13043 |
|
13044 |
|
13045 |
|
13046 |
|
13047 |
|
13048 |
|
13049 |
|
13050 |
|
13051 |
|
13052 |
|
13053 |
|
13054 |
|
13055 |
|
13056 |
|
13057 | var withinRange = function (domain, range) {
|
13058 | var _range = _slicedToArray(range, 2),
|
13059 | min = _range[0],
|
13060 | max = _range[1];
|
13061 |
|
13062 | return domain.every(function (v, i) {
|
13063 | return i === 0 ? v >= min : v <= max;
|
13064 | });
|
13065 | },
|
13066 | api_zoom_zoom = function (domainValue) {
|
13067 | var resultDomain,
|
13068 | $$ = this.internal,
|
13069 | domain = domainValue;
|
13070 |
|
13071 | if ($$.config.zoom_enabled && domain && withinRange(domain, $$.getZoomDomain())) {
|
13072 | var isTimeSeries = $$.isTimeSeries();
|
13073 |
|
13074 | if (isTimeSeries && (domain = domain.map(function (x) {
|
13075 | return $$.parseDate(x);
|
13076 | })), $$.config.subchart_show) {
|
13077 | var xScale = $$.zoomScale || $$.x;
|
13078 | $$.brush.getSelection().call($$.brush.move, [xScale(domain[0]), xScale(domain[1])]), resultDomain = domain;
|
13079 | } else $$.x.domain(domain), $$.zoomScale = $$.x, $$.xAxis.scale($$.zoomScale), resultDomain = $$.zoomScale.orgDomain();
|
13080 |
|
13081 | $$.redraw({
|
13082 | withTransition: !0,
|
13083 | withY: $$.config.zoom_rescale,
|
13084 | withDimension: !1
|
13085 | }), $$.setZoomResetButton(), callFn($$.config.zoom_onzoom, $$.api, resultDomain);
|
13086 | } else resultDomain = $$.zoomScale ? $$.zoomScale.domain() : $$.x.orgDomain();
|
13087 |
|
13088 | return resultDomain;
|
13089 | };
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 |
|
13096 |
|
13097 |
|
13098 |
|
13099 |
|
13100 |
|
13101 |
|
13102 |
|
13103 |
|
13104 |
|
13105 |
|
13106 |
|
13107 |
|
13108 |
|
13109 | extend(api_zoom_zoom, {
|
13110 | |
13111 |
|
13112 |
|
13113 |
|
13114 |
|
13115 |
|
13116 |
|
13117 |
|
13118 |
|
13119 |
|
13120 |
|
13121 |
|
13122 |
|
13123 |
|
13124 |
|
13125 |
|
13126 |
|
13127 |
|
13128 | enable: function enable() {
|
13129 | var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "wheel",
|
13130 | $$ = this.internal,
|
13131 | config = $$.config,
|
13132 | enableType = enabled;
|
13133 | enabled && (enableType = isString(enabled) && /^(drag|wheel)$/.test(enabled) ? {
|
13134 | type: enabled
|
13135 | } : enabled), config.zoom_enabled = enableType, $$.zoom ? enabled === !1 && $$.bindZoomEvent(!1) : ($$.initZoom(), $$.bindZoomEvent()), $$.updateAndRedraw();
|
13136 | },
|
13137 |
|
13138 | |
13139 |
|
13140 |
|
13141 |
|
13142 |
|
13143 |
|
13144 |
|
13145 |
|
13146 |
|
13147 |
|
13148 |
|
13149 | max: function max(_max) {
|
13150 | var $$ = this.internal,
|
13151 | config = $$.config;
|
13152 | return (_max === 0 || _max) && (config.zoom_x_max = getMinMax("max", [$$.orgXDomain[1], _max])), config.zoom_x_max;
|
13153 | },
|
13154 |
|
13155 | |
13156 |
|
13157 |
|
13158 |
|
13159 |
|
13160 |
|
13161 |
|
13162 |
|
13163 |
|
13164 |
|
13165 |
|
13166 | min: function min(_min) {
|
13167 | var $$ = this.internal,
|
13168 | config = $$.config;
|
13169 | return (_min === 0 || _min) && (config.zoom_x_min = getMinMax("min", [$$.orgXDomain[0], _min])), config.zoom_x_min;
|
13170 | },
|
13171 |
|
13172 | |
13173 |
|
13174 |
|
13175 |
|
13176 |
|
13177 |
|
13178 |
|
13179 |
|
13180 |
|
13181 |
|
13182 |
|
13183 |
|
13184 |
|
13185 |
|
13186 |
|
13187 |
|
13188 |
|
13189 | range: function range(_range2) {
|
13190 | var zoom = this.zoom;
|
13191 |
|
13192 | if (isObject(_range2)) {
|
13193 | var min = _range2.min,
|
13194 | max = _range2.max;
|
13195 | isDefined(min) && zoom.min(min), isDefined(max) && zoom.max(max);
|
13196 | }
|
13197 |
|
13198 | return {
|
13199 | min: zoom.min(),
|
13200 | max: zoom.max()
|
13201 | };
|
13202 | }
|
13203 | }), extend(Chart_Chart.prototype, {
|
13204 | zoom: api_zoom_zoom,
|
13205 |
|
13206 | |
13207 |
|
13208 |
|
13209 |
|
13210 |
|
13211 |
|
13212 |
|
13213 |
|
13214 | unzoom: function unzoom() {
|
13215 | var $$ = this.internal,
|
13216 | config = $$.config;
|
13217 |
|
13218 | if ($$.zoomScale) {
|
13219 | 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");
|
13220 |
|
13221 | var eventRects = $$.main.select(".".concat(config_classes.eventRects));
|
13222 | Object(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({
|
13223 | withTransition: !0,
|
13224 | withUpdateXDomain: !0,
|
13225 | withUpdateOrgXDomain: !0,
|
13226 | withY: config.zoom_rescale
|
13227 | });
|
13228 | }
|
13229 | }
|
13230 | });
|
13231 |
|
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 |
|
13237 |
|
13238 | extend(Chart_Chart.prototype, {
|
13239 | |
13240 |
|
13241 |
|
13242 |
|
13243 |
|
13244 |
|
13245 |
|
13246 |
|
13247 |
|
13248 |
|
13249 |
|
13250 |
|
13251 |
|
13252 |
|
13253 |
|
13254 |
|
13255 |
|
13256 |
|
13257 |
|
13258 |
|
13259 |
|
13260 |
|
13261 |
|
13262 |
|
13263 |
|
13264 |
|
13265 |
|
13266 |
|
13267 |
|
13268 |
|
13269 |
|
13270 |
|
13271 |
|
13272 |
|
13273 |
|
13274 |
|
13275 |
|
13276 |
|
13277 |
|
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 |
|
13283 |
|
13284 |
|
13285 |
|
13286 |
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 |
|
13306 |
|
13307 |
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 | load: function load(args) {
|
13319 | var $$ = this.internal,
|
13320 | config = $$.config;
|
13321 |
|
13322 |
|
13323 |
|
13324 |
|
13325 |
|
13326 | args.xs && $$.addXs(args.xs), "names" in args && this.data.names(args.names), "classes" in args && Object.keys(args.classes).forEach(function (id) {
|
13327 | config.data_classes[id] = args.classes[id];
|
13328 | }), "categories" in args && $$.isCategorized() && (config.axis_x_categories = args.categories), "axes" in args && Object.keys(args.axes).forEach(function (id) {
|
13329 | config.data_axes[id] = args.axes[id];
|
13330 | }), "colors" in args && Object.keys(args.colors).forEach(function (id) {
|
13331 | config.data_colors[id] = args.colors[id];
|
13332 | }), "unload" in args && args.unload !== !1 ? $$.unload($$.mapToTargetIds(args.unload === !0 ? null : args.unload), function () {
|
13333 | return $$.loadFromArgs(args);
|
13334 | }) : $$.loadFromArgs(args);
|
13335 | },
|
13336 |
|
13337 | |
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 |
|
13349 |
|
13350 |
|
13351 |
|
13352 |
|
13353 |
|
13354 |
|
13355 |
|
13356 |
|
13357 |
|
13358 |
|
13359 |
|
13360 | unload: function unload(argsValue) {
|
13361 | var $$ = this.internal,
|
13362 | args = argsValue || {};
|
13363 | isArray(args) ? args = {
|
13364 | ids: args
|
13365 | } : isString(args) && (args = {
|
13366 | ids: [args]
|
13367 | });
|
13368 | var ids = $$.mapToTargetIds(args.ids);
|
13369 | $$.unload(ids, function () {
|
13370 | $$.redraw({
|
13371 | withUpdateOrgXDomain: !0,
|
13372 | withUpdateXDomain: !0,
|
13373 | withLegend: !0
|
13374 | }), $$.removeCache(ids), args.done && args.done();
|
13375 | });
|
13376 | }
|
13377 | });
|
13378 |
|
13379 | var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack_require__(14);
|
13380 |
|
13381 |
|
13382 |
|
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 |
|
13393 | extend(Chart_Chart.prototype, {
|
13394 | |
13395 |
|
13396 |
|
13397 |
|
13398 |
|
13399 |
|
13400 |
|
13401 |
|
13402 |
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 |
|
13408 |
|
13409 |
|
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 |
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 |
|
13424 |
|
13425 |
|
13426 |
|
13427 |
|
13428 |
|
13429 |
|
13430 |
|
13431 |
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 | flow: function flow(args) {
|
13444 | var data,
|
13445 | domain,
|
13446 | diff,
|
13447 | to,
|
13448 | $$ = this.internal,
|
13449 | length = 0,
|
13450 | tail = 0;
|
13451 |
|
13452 | if ((args.json || args.rows || args.columns) && (data = $$.convertData(args)), data && $$.isTabVisible()) {
|
13453 | var notfoundIds = [],
|
13454 | orgDataCount = $$.getMaxDataCount(),
|
13455 | targets = $$.convertDataToTargets(data, !0);
|
13456 | $$.data.targets.forEach(function (t) {
|
13457 | for (var found = !1, i = 0; i < targets.length; i++) if (t.id === targets[i].id) {
|
13458 | found = !0, t.values[t.values.length - 1] && (tail = t.values[t.values.length - 1].index + 1), length = targets[i].values.length;
|
13459 |
|
13460 | for (var _j3 = 0; _j3 < length; _j3++) targets[i].values[_j3].index = tail + _j3, $$.isTimeSeries() || (targets[i].values[_j3].x = tail + _j3);
|
13461 |
|
13462 | t.values = t.values.concat(targets[i].values), targets.splice(i, 1);
|
13463 | break;
|
13464 | }
|
13465 |
|
13466 | found || notfoundIds.push(t.id);
|
13467 | }), $$.data.targets.forEach(function (t) {
|
13468 | for (var _i = 0; _i < notfoundIds.length; _i++) if (t.id === notfoundIds[_i]) {
|
13469 | tail = t.values[t.values.length - 1].index + 1;
|
13470 |
|
13471 | for (var _j4 = 0; _j4 < length; _j4++) t.values.push({
|
13472 | id: t.id,
|
13473 | index: tail + _j4,
|
13474 | x: $$.isTimeSeries() ? $$.getOtherTargetX(tail + _j4) : tail + _j4,
|
13475 | value: null
|
13476 | });
|
13477 | }
|
13478 | }), $$.data.targets.length && targets.forEach(function (t) {
|
13479 | for (var missing = [], i = $$.data.targets[0].values[0].index; i < tail; i++) missing.push({
|
13480 | id: t.id,
|
13481 | index: i,
|
13482 | x: $$.isTimeSeries() ? $$.getOtherTargetX(i) : i,
|
13483 | value: null
|
13484 | });
|
13485 |
|
13486 | t.values.forEach(function (v) {
|
13487 | v.index += tail, $$.isTimeSeries() || (v.x += tail);
|
13488 | }), t.values = missing.concat(t.values);
|
13489 | }), $$.data.targets = $$.data.targets.concat(targets);
|
13490 |
|
13491 |
|
13492 |
|
13493 | var baseTarget = $$.data.targets[0],
|
13494 | baseValue = baseTarget.values[0];
|
13495 | isDefined(args.to) ? (length = 0, to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to, baseTarget.values.forEach(function (v) {
|
13496 | v.x < to && length++;
|
13497 | })) : 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({
|
13498 | flow: {
|
13499 | index: baseValue.index,
|
13500 | length: length,
|
13501 | duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,
|
13502 | done: args.done,
|
13503 | orgDataCount: orgDataCount
|
13504 | },
|
13505 | withLegend: !0,
|
13506 | withTransition: orgDataCount > 1,
|
13507 | withTrimXDomain: !1,
|
13508 | withUpdateXAxis: !0
|
13509 | });
|
13510 | }
|
13511 | }
|
13512 | }), extend(ChartInternal_ChartInternal.prototype, {
|
13513 | |
13514 |
|
13515 |
|
13516 |
|
13517 |
|
13518 |
|
13519 |
|
13520 | generateFlow: function generateFlow(args) {
|
13521 | var $$ = this,
|
13522 | config = $$.config;
|
13523 | return function () {
|
13524 | var translateX,
|
13525 | targets = args.targets,
|
13526 | flow = args.flow,
|
13527 | _args$shape$type = args.shape.type,
|
13528 | drawBar = _args$shape$type.bar,
|
13529 | drawLine = _args$shape$type.line,
|
13530 | drawArea = _args$shape$type.area,
|
13531 | _args$shape$pos = args.shape.pos,
|
13532 | cx = _args$shape$pos.cx,
|
13533 | cy = _args$shape$pos.cy,
|
13534 | xForText = _args$shape$pos.xForText,
|
13535 | yForText = _args$shape$pos.yForText,
|
13536 | xv = args.xv,
|
13537 | duration = args.duration,
|
13538 | scaleX = 1,
|
13539 | flowIndex = flow.index,
|
13540 | flowLength = flow.length,
|
13541 | flowStart = $$.getValueOnIndex($$.data.targets[0].values, flowIndex),
|
13542 | flowEnd = $$.getValueOnIndex($$.data.targets[0].values, flowIndex + flowLength),
|
13543 | orgDomain = $$.x.domain(),
|
13544 | durationForFlow = flow.duration || duration,
|
13545 | done = flow.done || function () {},
|
13546 | wait = $$.generateWait(),
|
13547 | xgrid = $$.xgrid || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13548 | xgridLines = $$.xgridLines || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13549 | mainRegion = $$.mainRegion || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13550 | mainText = $$.mainText || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13551 | mainBar = $$.mainBar || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13552 | mainLine = $$.mainLine || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13553 | mainArea = $$.mainArea || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]),
|
13554 | mainCircle = $$.mainCircle || Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["selectAll"])([]);
|
13555 |
|
13556 | $$.flowing = !0, $$.data.targets.forEach(function (d) {
|
13557 | d.values.splice(0, flowLength);
|
13558 | });
|
13559 |
|
13560 | var domain = $$.updateXDomain(targets, !0, !0);
|
13561 |
|
13562 | $$.updateXGrid && $$.updateXGrid(!0), flow.orgDataCount ? flow.orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x) ? translateX = $$.x(orgDomain[0]) - $$.x(domain[0]) : $$.isTimeSeries() ? translateX = $$.x(orgDomain[0]) - $$.x(domain[0]) : translateX = $$.x(flowStart.x) - $$.x(flowEnd.x) : $$.data.targets[0].values.length === 1 ? $$.isTimeSeries() ? (flowStart = $$.getValueOnIndex($$.data.targets[0].values, 0), flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1), translateX = $$.x(flowStart.x) - $$.x(flowEnd.x)) : translateX = diffDomain(domain) / 2 : translateX = $$.x(orgDomain[0]) - $$.x(domain[0]), scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
13563 | var transform = "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
13564 | $$.hideGridFocus();
|
13565 | var gt = Object(external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_["transition"])().ease(external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_["easeLinear"]).duration(durationForFlow);
|
13566 | wait.add([$$.axes.x.transition(gt).call(function (g) {
|
13567 | return $$.xAxis.setTransition(gt).create(g);
|
13568 | }), mainBar.transition(gt).attr("transform", transform), mainLine.transition(gt).attr("transform", transform), mainArea.transition(gt).attr("transform", transform), mainCircle.transition(gt).attr("transform", transform), mainText.transition(gt).attr("transform", transform), mainRegion.filter($$.isRegionOnX).transition(gt).attr("transform", transform), xgrid.transition(gt).attr("transform", transform), xgridLines.transition(gt).attr("transform", transform)]), gt.call(wait, function () {
|
13569 | var isRotated = config.axis_rotated;
|
13570 |
|
13571 | if (flowLength) {
|
13572 | for (var target = {
|
13573 | shapes: [],
|
13574 | texts: [],
|
13575 | eventRects: []
|
13576 | }, i = 0; i < flowLength; i++) target.shapes.push(".".concat(config_classes.shape, "-").concat(i)), target.texts.push(".".concat(config_classes.text, "-").concat(i)), target.eventRects.push(".".concat(config_classes.eventRect, "-").concat(i));
|
13577 |
|
13578 | ["shapes", "texts", "eventRects"].forEach(function (v) {
|
13579 | $$.svg.selectAll(".".concat(config_classes[v])).selectAll(target[v]).remove();
|
13580 | }), $$.svg.select(".".concat(config_classes.xgrid)).remove();
|
13581 | }
|
13582 |
|
13583 |
|
13584 | if (xgrid.size() && xgrid.attr("transform", null).attr($$.xgridAttr), xgridLines.attr("transform", null), xgridLines.select("line").attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? $$.width : xv), xgridLines.select("text").attr("x", isRotated ? $$.width : 0).attr("y", xv), mainBar.attr("transform", null).attr("d", drawBar), mainLine.attr("transform", null).attr("d", drawLine), mainArea.attr("transform", null).attr("d", drawArea), mainCircle.attr("transform", null), $$.isCirclePoint()) mainCircle.attr("cx", cx).attr("cy", cy);else {
|
13585 | var xFunc = function (d) {
|
13586 | return cx(d) - config.point_r;
|
13587 | },
|
13588 | yFunc = function (d) {
|
13589 | return cy(d) - config.point_r;
|
13590 | };
|
13591 |
|
13592 | mainCircle.attr("x", xFunc).attr("y", yFunc).attr("cx", cx)
|
13593 | .attr("cy", cy);
|
13594 | }
|
13595 | mainText.attr("transform", null).attr("x", xForText).attr("y", yForText).style("fill-opacity", $$.opacityForText.bind($$)), mainRegion.attr("transform", null), mainRegion.select("rect").filter($$.isRegionOnX).attr("x", $$.regionX.bind($$)).attr("width", $$.regionWidth.bind($$)), config.interaction_enabled && $$.redrawEventRect(), done(), $$.flowing = !1;
|
13596 | });
|
13597 | };
|
13598 | }
|
13599 | });
|
13600 |
|
13601 |
|
13602 |
|
13603 |
|
13604 |
|
13605 |
|
13606 |
|
13607 |
|
13608 |
|
13609 | extend(Chart_Chart.prototype, {
|
13610 | |
13611 |
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 |
|
13619 |
|
13620 |
|
13621 |
|
13622 |
|
13623 |
|
13624 |
|
13625 |
|
13626 | selected: function selected(targetId) {
|
13627 | var $$ = this.internal,
|
13628 | dataPoint = [];
|
13629 | return $$.main.selectAll(".".concat(config_classes.shapes + $$.getTargetSelectorSuffix(targetId))).selectAll(".".concat(config_classes.shape)).filter(function () {
|
13630 | return Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this).classed(config_classes.SELECTED);
|
13631 | }).each(function (d) {
|
13632 | return dataPoint.push(d);
|
13633 | }), dataPoint;
|
13634 | },
|
13635 |
|
13636 | |
13637 |
|
13638 |
|
13639 |
|
13640 |
|
13641 |
|
13642 |
|
13643 |
|
13644 |
|
13645 |
|
13646 |
|
13647 |
|
13648 |
|
13649 |
|
13650 |
|
13651 |
|
13652 |
|
13653 |
|
13654 |
|
13655 |
|
13656 |
|
13657 |
|
13658 |
|
13659 |
|
13660 | select: function select(ids, indices, resetOther) {
|
13661 | var $$ = this.internal,
|
13662 | config = $$.config;
|
13663 | config.data_selection_enabled && $$.main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).each(function (d, i) {
|
13664 | var shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
13665 | id = d.data ? d.data.id : d.id,
|
13666 | toggle = $$.getToggle(this, d).bind($$),
|
13667 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
13668 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
13669 | isSelected = shape.classed(config_classes.SELECTED);
|
13670 |
|
13671 | shape.classed(config_classes.line) || shape.classed(config_classes.area) || (isTargetId && isTargetIndex ? config.data_selection_isselectable(d) && !isSelected && toggle(!0, shape.classed(config_classes.SELECTED, !0), d, i) : isDefined(resetOther) && resetOther && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i));
|
13672 | });
|
13673 | },
|
13674 |
|
13675 | |
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 |
|
13684 |
|
13685 |
|
13686 |
|
13687 |
|
13688 |
|
13689 |
|
13690 |
|
13691 |
|
13692 | unselect: function unselect(ids, indices) {
|
13693 | var $$ = this.internal,
|
13694 | config = $$.config;
|
13695 | config.data_selection_enabled && $$.main.selectAll(".".concat(config_classes.shapes)).selectAll(".".concat(config_classes.shape)).each(function (d, i) {
|
13696 | var shape = Object(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["select"])(this),
|
13697 | id = d.data ? d.data.id : d.id,
|
13698 | toggle = $$.getToggle(this, d).bind($$),
|
13699 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
13700 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
13701 | isSelected = shape.classed(config_classes.SELECTED);
|
13702 |
|
13703 | shape.classed(config_classes.line) || shape.classed(config_classes.area) || isTargetId && isTargetIndex && config.data_selection_isselectable(d) && isSelected && toggle(!1, shape.classed(config_classes.SELECTED, !1), d, i);
|
13704 | });
|
13705 | }
|
13706 | });
|
13707 |
|
13708 |
|
13709 |
|
13710 |
|
13711 |
|
13712 |
|
13713 |
|
13714 |
|
13715 |
|
13716 |
|
13717 |
|
13718 |
|
13719 |
|
13720 |
|
13721 |
|
13722 | function transformTo(targetIds, type, optionsForRedraw) {
|
13723 | var $$ = this,
|
13724 | options = optionsForRedraw || {
|
13725 | withTransitionForAxis: !$$.hasArcType()
|
13726 | };
|
13727 |
|
13728 | options.withTransitionForTransform = !1, $$.transiting = !1, $$.setTargetType(targetIds, type), $$.updateTargets($$.data.targets), $$.updateAndRedraw(options);
|
13729 | }
|
13730 |
|
13731 | extend(Chart_Chart.prototype, {
|
13732 | |
13733 |
|
13734 |
|
13735 |
|
13736 |
|
13737 |
|
13738 |
|
13739 |
|
13740 |
|
13741 |
|
13742 |
|
13743 |
|
13744 |
|
13745 |
|
13746 |
|
13747 |
|
13748 |
|
13749 | transform: function transform(type, targetIds) {
|
13750 | var $$ = this.internal,
|
13751 | options = ["pie", "donut"].indexOf(type) >= 0 ? {
|
13752 | withTransform: !0
|
13753 | } : null;
|
13754 | transformTo.bind($$)(targetIds, type, options);
|
13755 | }
|
13756 | });
|
13757 |
|
13758 |
|
13759 |
|
13760 |
|
13761 |
|
13762 |
|
13763 |
|
13764 | extend(Chart_Chart.prototype, {
|
13765 | |
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 |
|
13771 |
|
13772 |
|
13773 |
|
13774 |
|
13775 |
|
13776 |
|
13777 |
|
13778 | groups: function groups(_groups) {
|
13779 | var $$ = this.internal,
|
13780 | config = $$.config;
|
13781 | return isUndefined(_groups) ? config.data_groups : (config.data_groups = _groups, $$.redraw(), config.data_groups);
|
13782 | }
|
13783 | });
|
13784 |
|
13785 |
|
13786 |
|
13787 |
|
13788 |
|
13789 |
|
13790 |
|
13791 |
|
13792 |
|
13793 |
|
13794 |
|
13795 |
|
13796 |
|
13797 |
|
13798 |
|
13799 |
|
13800 |
|
13801 |
|
13802 |
|
13803 |
|
13804 |
|
13805 | var xgrids = function (grids) {
|
13806 | var $$ = this.internal,
|
13807 | config = $$.config;
|
13808 | return grids ? (config.grid_x_lines = grids, $$.redrawWithoutRescale(), config.grid_x_lines) : config.grid_x_lines;
|
13809 | };
|
13810 |
|
13811 | extend(xgrids, {
|
13812 | |
13813 |
|
13814 |
|
13815 |
|
13816 |
|
13817 |
|
13818 |
|
13819 |
|
13820 |
|
13821 |
|
13822 |
|
13823 |
|
13824 |
|
13825 |
|
13826 |
|
13827 |
|
13828 |
|
13829 |
|
13830 |
|
13831 | add: function add(grids) {
|
13832 | return this.xgrids(this.internal.config.grid_x_lines.concat(grids || []));
|
13833 | },
|
13834 |
|
13835 | |
13836 |
|
13837 |
|
13838 |
|
13839 |
|
13840 |
|
13841 |
|
13842 |
|
13843 |
|
13844 |
|
13845 |
|
13846 |
|
13847 |
|
13848 |
|
13849 |
|
13850 |
|
13851 |
|
13852 |
|
13853 |
|
13854 | remove: function remove(params) {
|
13855 |
|
13856 | this.internal.removeGridLines(params, !0);
|
13857 | }
|
13858 | });
|
13859 |
|
13860 |
|
13861 |
|
13862 |
|
13863 |
|
13864 |
|
13865 |
|
13866 |
|
13867 |
|
13868 |
|
13869 |
|
13870 |
|
13871 |
|
13872 |
|
13873 | var ygrids = function (grids) {
|
13874 | var $$ = this.internal,
|
13875 | config = $$.config;
|
13876 | return grids ? (config.grid_y_lines = grids, $$.redrawWithoutRescale(), config.grid_y_lines) : config.grid_y_lines;
|
13877 | };
|
13878 |
|
13879 | extend(ygrids, {
|
13880 | |
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 |
|
13886 |
|
13887 |
|
13888 |
|
13889 |
|
13890 |
|
13891 |
|
13892 |
|
13893 |
|
13894 |
|
13895 |
|
13896 |
|
13897 |
|
13898 |
|
13899 | add: function add(grids) {
|
13900 | return this.ygrids(this.internal.config.grid_y_lines.concat(grids || []));
|
13901 | },
|
13902 |
|
13903 | |
13904 |
|
13905 |
|
13906 |
|
13907 |
|
13908 |
|
13909 |
|
13910 |
|
13911 |
|
13912 |
|
13913 |
|
13914 |
|
13915 |
|
13916 |
|
13917 |
|
13918 |
|
13919 |
|
13920 |
|
13921 |
|
13922 | remove: function remove(params) {
|
13923 |
|
13924 | this.internal.removeGridLines(params, !1);
|
13925 | }
|
13926 | }), extend(Chart_Chart.prototype, {
|
13927 | xgrids: xgrids,
|
13928 | ygrids: ygrids
|
13929 | });
|
13930 |
|
13931 |
|
13932 |
|
13933 |
|
13934 |
|
13935 |
|
13936 |
|
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 |
|
13942 |
|
13943 |
|
13944 |
|
13945 |
|
13946 |
|
13947 |
|
13948 |
|
13949 |
|
13950 |
|
13951 |
|
13952 |
|
13953 | var api_region_regions = function (_regions) {
|
13954 | var $$ = this.internal,
|
13955 | config = $$.config;
|
13956 | return _regions ? (config.regions = _regions, $$.redrawWithoutRescale(), _regions) : config.regions;
|
13957 | };
|
13958 |
|
13959 | extend(api_region_regions, {
|
13960 | |
13961 |
|
13962 |
|
13963 |
|
13964 |
|
13965 |
|
13966 |
|
13967 |
|
13968 |
|
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 |
|
13974 |
|
13975 |
|
13976 |
|
13977 |
|
13978 |
|
13979 |
|
13980 | add: function add(regions) {
|
13981 | var $$ = this.internal,
|
13982 | config = $$.config;
|
13983 | return regions ? (config.regions = config.regions.concat(regions), $$.redrawWithoutRescale(), config.regions) : config.regions;
|
13984 | },
|
13985 |
|
13986 | |
13987 |
|
13988 |
|
13989 |
|
13990 |
|
13991 |
|
13992 |
|
13993 |
|
13994 |
|
13995 |
|
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 |
|
14002 |
|
14003 |
|
14004 |
|
14005 | remove: function remove(optionsValue) {
|
14006 | var $$ = this.internal,
|
14007 | config = $$.config,
|
14008 | options = optionsValue || {},
|
14009 | duration = getOption(options, "duration", config.transition_duration),
|
14010 | classes = getOption(options, "classes", [config_classes.region]),
|
14011 | regions = $$.main.select(".".concat(config_classes.regions)).selectAll(classes.map(function (c) {
|
14012 | return ".".concat(c);
|
14013 | }));
|
14014 | return (duration ? regions.transition().duration(duration) : regions).style("opacity", "0").remove(), regions = config.regions, Object.keys(options).length ? (regions = regions.filter(function (region) {
|
14015 | var found = !1;
|
14016 | return !region["class"] || (region["class"].split(" ").forEach(function (c) {
|
14017 | classes.indexOf(c) >= 0 && (found = !0);
|
14018 | }), !found);
|
14019 | }), config.regions = regions) : config.regions = [], regions;
|
14020 | }
|
14021 | }), extend(Chart_Chart.prototype, {
|
14022 | regions: api_region_regions
|
14023 | });
|
14024 |
|
14025 |
|
14026 |
|
14027 |
|
14028 |
|
14029 |
|
14030 |
|
14031 |
|
14032 |
|
14033 |
|
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 |
|
14040 |
|
14041 |
|
14042 |
|
14043 |
|
14044 |
|
14045 |
|
14046 |
|
14047 |
|
14048 |
|
14049 |
|
14050 | var api_data_data = function (targetIds) {
|
14051 | var targets = this.internal.data.targets;
|
14052 |
|
14053 | if (!isUndefined(targetIds)) {
|
14054 | var ids = isArray(targetIds) ? targetIds : [targetIds];
|
14055 | return targets.filter(function (t) {
|
14056 | return ids.some(function (v) {
|
14057 | return v === t.id;
|
14058 | });
|
14059 | });
|
14060 | }
|
14061 |
|
14062 | return targets;
|
14063 | };
|
14064 |
|
14065 | extend(api_data_data, {
|
14066 | |
14067 |
|
14068 |
|
14069 |
|
14070 |
|
14071 |
|
14072 |
|
14073 |
|
14074 |
|
14075 |
|
14076 |
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 | shown: function shown(targetIds) {
|
14085 | return this.internal.filterTargetsToShow(this.data(targetIds));
|
14086 | },
|
14087 |
|
14088 | |
14089 |
|
14090 |
|
14091 |
|
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 |
|
14099 |
|
14100 | values: function (targetId) {
|
14101 | var flat = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1],
|
14102 | values = null;
|
14103 |
|
14104 | if (targetId) {
|
14105 | var targets = this.data(targetId);
|
14106 | targets && isArray(targets) && (values = [], targets.forEach(function (v) {
|
14107 | var dataValue = v.values.map(function (d) {
|
14108 | return d.value;
|
14109 | });
|
14110 | flat ? values = values.concat(dataValue) : values.push(dataValue);
|
14111 | }));
|
14112 | }
|
14113 |
|
14114 | return values;
|
14115 | },
|
14116 |
|
14117 | |
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 |
|
14124 |
|
14125 |
|
14126 |
|
14127 |
|
14128 |
|
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 | names: function names(_names) {
|
14136 | return this.internal.clearLegendItemTextBoxCache(), this.internal.updateDataAttributes("names", _names);
|
14137 | },
|
14138 |
|
14139 | |
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 |
|
14145 |
|
14146 |
|
14147 |
|
14148 |
|
14149 |
|
14150 |
|
14151 |
|
14152 |
|
14153 |
|
14154 |
|
14155 |
|
14156 |
|
14157 | colors: function colors(_colors) {
|
14158 | return this.internal.updateDataAttributes("colors", _colors);
|
14159 | },
|
14160 |
|
14161 | |
14162 |
|
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 |
|
14168 |
|
14169 |
|
14170 |
|
14171 |
|
14172 |
|
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 |
|
14179 |
|
14180 | axes: function axes(_axes) {
|
14181 | return this.internal.updateDataAttributes("axes", _axes);
|
14182 | },
|
14183 |
|
14184 | |
14185 |
|
14186 |
|
14187 |
|
14188 |
|
14189 |
|
14190 |
|
14191 |
|
14192 |
|
14193 |
|
14194 |
|
14195 | min: function min() {
|
14196 | return this.internal.getMinMaxData().min;
|
14197 | },
|
14198 |
|
14199 | |
14200 |
|
14201 |
|
14202 |
|
14203 |
|
14204 |
|
14205 |
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 | max: function max() {
|
14211 | return this.internal.getMinMaxData().max;
|
14212 | }
|
14213 | }), extend(Chart_Chart.prototype, {
|
14214 | data: api_data_data
|
14215 | });
|
14216 |
|
14217 |
|
14218 |
|
14219 |
|
14220 |
|
14221 |
|
14222 |
|
14223 | extend(Chart_Chart.prototype, {
|
14224 | |
14225 |
|
14226 |
|
14227 |
|
14228 |
|
14229 |
|
14230 |
|
14231 |
|
14232 |
|
14233 |
|
14234 | category: function category(i, _category) {
|
14235 | var $$ = this.internal,
|
14236 | config = $$.config;
|
14237 | return arguments.length > 1 && (config.axis_x_categories[i] = _category, $$.redraw()), config.axis_x_categories[i];
|
14238 | },
|
14239 |
|
14240 | |
14241 |
|
14242 |
|
14243 |
|
14244 |
|
14245 |
|
14246 |
|
14247 |
|
14248 |
|
14249 |
|
14250 |
|
14251 | categories: function categories(_categories) {
|
14252 | var $$ = this.internal,
|
14253 | config = $$.config;
|
14254 | return arguments.length ? (config.axis_x_categories = _categories, $$.redraw(), config.axis_x_categories) : config.axis_x_categories;
|
14255 | }
|
14256 | });
|
14257 |
|
14258 |
|
14259 |
|
14260 |
|
14261 |
|
14262 |
|
14263 |
|
14264 | extend(Chart_Chart.prototype, {
|
14265 | |
14266 |
|
14267 |
|
14268 |
|
14269 |
|
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 | color: function color(id) {
|
14275 | return this.internal.color(id);
|
14276 | }
|
14277 | });
|
14278 |
|
14279 |
|
14280 |
|
14281 |
|
14282 |
|
14283 |
|
14284 |
|
14285 | extend(Chart_Chart.prototype, {
|
14286 | |
14287 |
|
14288 |
|
14289 |
|
14290 |
|
14291 |
|
14292 |
|
14293 |
|
14294 |
|
14295 |
|
14296 |
|
14297 |
|
14298 |
|
14299 |
|
14300 | x: function x(_x) {
|
14301 | var $$ = this.internal,
|
14302 | isCategorized = $$.isCustomX() && $$.isCategorized();
|
14303 | return isArray(_x) && (isCategorized ? $$.api.categories(_x) : ($$.updateTargetX($$.data.targets, _x), $$.redraw({
|
14304 | withUpdateOrgXDomain: !0,
|
14305 | withUpdateXDomain: !0
|
14306 | }))), isCategorized ? $$.api.categories() : $$.data.xs;
|
14307 | },
|
14308 |
|
14309 | |
14310 |
|
14311 |
|
14312 |
|
14313 |
|
14314 |
|
14315 |
|
14316 |
|
14317 |
|
14318 |
|
14319 |
|
14320 |
|
14321 |
|
14322 |
|
14323 |
|
14324 |
|
14325 |
|
14326 | xs: function xs(_xs) {
|
14327 | var $$ = this.internal;
|
14328 | return isObject(_xs) && ($$.updateTargetXs($$.data.targets, _xs), $$.redraw({
|
14329 | withUpdateOrgXDomain: !0,
|
14330 | withUpdateXDomain: !0
|
14331 | })), $$.data.xs;
|
14332 | }
|
14333 | });
|
14334 |
|
14335 |
|
14336 |
|
14337 |
|
14338 |
|
14339 |
|
14340 |
|
14341 |
|
14342 |
|
14343 |
|
14344 |
|
14345 |
|
14346 |
|
14347 |
|
14348 |
|
14349 |
|
14350 | var setMinMax = function ($$, type, value) {
|
14351 | var config = $$.config,
|
14352 | axisX = "axis_x_".concat(type),
|
14353 | axisY = "axis_y_".concat(type),
|
14354 | axisY2 = "axis_y2_".concat(type);
|
14355 | return isDefined(value) && (isObjectType(value) ? (isValue(value.x) && (config[axisX] = value.x), isValue(value.y) && (config[axisY] = value.y), isValue(value.y2) && (config[axisY2] = value.y2)) : (config[axisY] = value, config[axisY2] = value), $$.redraw({
|
14356 | withUpdateOrgXDomain: !0,
|
14357 | withUpdateXDomain: !0
|
14358 | })), undefined;
|
14359 | },
|
14360 | api_axis_getMinMax = function ($$, type) {
|
14361 | var config = $$.config;
|
14362 | return {
|
14363 | x: config["axis_x_".concat(type)],
|
14364 | y: config["axis_y_".concat(type)],
|
14365 | y2: config["axis_y2_".concat(type)]
|
14366 | };
|
14367 | },
|
14368 | api_axis_axis = extend(function () {}, {
|
14369 | |
14370 |
|
14371 |
|
14372 |
|
14373 |
|
14374 |
|
14375 |
|
14376 |
|
14377 |
|
14378 |
|
14379 |
|
14380 |
|
14381 |
|
14382 | labels: function labels(_labels) {
|
14383 | var $$ = this.internal;
|
14384 | arguments.length && (Object.keys(_labels).forEach(function (axisId) {
|
14385 | $$.axis.setLabelText(axisId, _labels[axisId]);
|
14386 | }), $$.axis.updateLabels());
|
14387 | },
|
14388 |
|
14389 | |
14390 |
|
14391 |
|
14392 |
|
14393 |
|
14394 |
|
14395 |
|
14396 |
|
14397 |
|
14398 |
|
14399 |
|
14400 |
|
14401 |
|
14402 |
|
14403 |
|
14404 |
|
14405 | min: function min(_min) {
|
14406 | var $$ = this.internal;
|
14407 | return arguments.length ? setMinMax($$, "min", _min) : api_axis_getMinMax($$, "min");
|
14408 | },
|
14409 |
|
14410 | |
14411 |
|
14412 |
|
14413 |
|
14414 |
|
14415 |
|
14416 |
|
14417 |
|
14418 |
|
14419 |
|
14420 |
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 |
|
14426 | max: function max(_max) {
|
14427 | var $$ = this.internal;
|
14428 | return arguments.length ? setMinMax($$, "max", _max) : api_axis_getMinMax($$, "max");
|
14429 | },
|
14430 |
|
14431 | |
14432 |
|
14433 |
|
14434 |
|
14435 |
|
14436 |
|
14437 |
|
14438 |
|
14439 |
|
14440 |
|
14441 |
|
14442 |
|
14443 |
|
14444 |
|
14445 |
|
14446 |
|
14447 |
|
14448 |
|
14449 |
|
14450 |
|
14451 |
|
14452 | range: function range(_range) {
|
14453 | var axis = this.axis;
|
14454 | if (arguments.length) isDefined(_range.max) && axis.max(_range.max), isDefined(_range.min) && axis.min(_range.min);else return {
|
14455 | max: axis.max(),
|
14456 | min: axis.min()
|
14457 | };
|
14458 | return undefined;
|
14459 | }
|
14460 | });
|
14461 |
|
14462 |
|
14463 |
|
14464 |
|
14465 |
|
14466 |
|
14467 |
|
14468 |
|
14469 |
|
14470 | extend(Chart_Chart.prototype, {
|
14471 | axis: api_axis_axis
|
14472 | });
|
14473 |
|
14474 |
|
14475 |
|
14476 |
|
14477 |
|
14478 |
|
14479 |
|
14480 |
|
14481 |
|
14482 |
|
14483 |
|
14484 |
|
14485 | var legend = extend(function () {}, {
|
14486 | |
14487 |
|
14488 |
|
14489 |
|
14490 |
|
14491 |
|
14492 |
|
14493 |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 |
|
14500 |
|
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 | show: function show(targetIds) {
|
14506 | var $$ = this.internal;
|
14507 | $$.showLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({
|
14508 | withLegend: !0
|
14509 | });
|
14510 | },
|
14511 |
|
14512 | |
14513 |
|
14514 |
|
14515 |
|
14516 |
|
14517 |
|
14518 |
|
14519 |
|
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 |
|
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 |
|
14530 |
|
14531 | hide: function hide(targetIds) {
|
14532 | var $$ = this.internal;
|
14533 | $$.hideLegend($$.mapToTargetIds(targetIds)), $$.updateAndRedraw({
|
14534 | withLegend: !0
|
14535 | });
|
14536 | }
|
14537 | });
|
14538 | extend(Chart_Chart.prototype, {
|
14539 | legend: legend
|
14540 | });
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 |
|
14547 |
|
14548 |
|
14549 | extend(Chart_Chart.prototype, {
|
14550 | |
14551 |
|
14552 |
|
14553 |
|
14554 |
|
14555 |
|
14556 |
|
14557 |
|
14558 |
|
14559 |
|
14560 |
|
14561 |
|
14562 |
|
14563 | resize: function resize(size) {
|
14564 | var $$ = this.internal,
|
14565 | config = $$.config;
|
14566 | $$.rendered && (config.size_width = size ? size.width : null, config.size_height = size ? size.height : null, this.flush(!1, !0), $$.resizeFunction());
|
14567 | },
|
14568 |
|
14569 | |
14570 |
|
14571 |
|
14572 |
|
14573 |
|
14574 |
|
14575 |
|
14576 |
|
14577 |
|
14578 |
|
14579 |
|
14580 |
|
14581 | flush: function flush(soft, _isFromResize) {
|
14582 | var $$ = this.internal;
|
14583 | $$.rendered ? (_isFromResize ? $$.brush && $$.brush.updateResize() : $$.axis && $$.axis.setOrient(), $$.zoomScale = null, soft ? $$.redraw({
|
14584 | withTransform: !0,
|
14585 | withUpdateXDomain: !0,
|
14586 | withUpdateOrgXDomain: !0,
|
14587 | withLegend: !0
|
14588 | }) : $$.updateAndRedraw({
|
14589 | withLegend: !0,
|
14590 | withTransition: !1,
|
14591 | withTransitionForTransform: !1
|
14592 | })) : $$.initToRender(!0);
|
14593 | },
|
14594 |
|
14595 | |
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 |
|
14602 |
|
14603 | destroy: function destroy() {
|
14604 | var _this = this,
|
14605 | $$ = this.internal;
|
14606 |
|
14607 | return notEmpty($$) && ($$.callPluginHook("$willDestroy"), $$.charts.splice($$.charts.indexOf(this), 1), $$.svg.select("*").interrupt(), $$.generateResize.timeout && win.clearTimeout($$.generateResize.timeout), win.removeEventListener("resize", $$.resizeFunction), $$.selectChart.classed("bb", !1).html(""), Object.keys(this).forEach(function (key) {
|
14608 | key === "internal" && Object.keys($$).forEach(function (k) {
|
14609 | $$[k] = null;
|
14610 | }), _this[key] = null, delete _this[key];
|
14611 | })), null;
|
14612 | },
|
14613 |
|
14614 | |
14615 |
|
14616 |
|
14617 |
|
14618 |
|
14619 |
|
14620 |
|
14621 |
|
14622 |
|
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 |
|
14630 |
|
14631 |
|
14632 |
|
14633 | config: function config(name, value, redraw) {
|
14634 | var res,
|
14635 | $$ = this.internal,
|
14636 | key = name && name.replace(/\./g, "_");
|
14637 | return key in $$.config && (isDefined(value) ? ($$.config[key] = value, res = value, redraw && this.flush()) : res = $$.config[key]), res;
|
14638 | }
|
14639 | });
|
14640 |
|
14641 |
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 | var api_tooltip_tooltip = extend(function () {}, {
|
14653 | |
14654 |
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 |
|
14660 |
|
14661 |
|
14662 |
|
14663 |
|
14664 |
|
14665 |
|
14666 |
|
14667 |
|
14668 |
|
14669 |
|
14670 |
|
14671 |
|
14672 |
|
14673 |
|
14674 |
|
14675 |
|
14676 |
|
14677 |
|
14678 |
|
14679 |
|
14680 |
|
14681 |
|
14682 |
|
14683 |
|
14684 |
|
14685 |
|
14686 |
|
14687 |
|
14688 |
|
14689 |
|
14690 |
|
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 | show: function show() {
|
14703 | var index,
|
14704 | mouse,
|
14705 | args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
14706 | $$ = this.internal;
|
14707 |
|
14708 |
|
14709 | if (args.mouse && (mouse = args.mouse), args.data) {
|
14710 | var y = $$.getYScale(args.data.id)(args.data.value);
|
14711 | $$.isMultipleX() ? mouse = [$$.x(args.data.x), y] : (!$$.config.tooltip_grouped && (mouse = [0, y]), index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x));
|
14712 | } else isDefined(args.x) ? index = $$.getIndexByX(args.x) : isDefined(args.index) && (index = args.index);
|
14713 |
|
14714 |
|
14715 | ($$.inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach(function (eventName) {
|
14716 | $$.dispatchEvent(eventName, index, mouse);
|
14717 | });
|
14718 | },
|
14719 |
|
14720 | |
14721 |
|
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 | hide: function hide() {
|
14727 | var $$ = this.internal;
|
14728 |
|
14729 | $$.inputType === "touch" && $$.callOverOutForTouch(), $$.hideTooltip(!0), $$.hideGridFocus(), $$.unexpandCircles(), $$.unexpandBars();
|
14730 | }
|
14731 | });
|
14732 | extend(Chart_Chart.prototype, {
|
14733 | tooltip: api_tooltip_tooltip
|
14734 | });
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 |
|
14752 | var b64EncodeUnicode = function (str) {
|
14753 | return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) {
|
14754 | return String.fromCharCode("0x".concat(p));
|
14755 | }));
|
14756 | },
|
14757 | nodeToSvgDataUrl = function (node, size) {
|
14758 | var serializer = new XMLSerializer(),
|
14759 | clone = node.cloneNode(!0),
|
14760 | cssText = getCssRules(toArray(browser_doc.styleSheets)).filter(function (r) {
|
14761 | return r.cssText;
|
14762 | }).map(function (r) {
|
14763 | return r.cssText;
|
14764 | });
|
14765 | clone.setAttribute("xmlns", external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].xhtml);
|
14766 | var nodeXml = serializer.serializeToString(clone),
|
14767 | style = browser_doc.createElement("style");
|
14768 |
|
14769 | style.appendChild(browser_doc.createTextNode(cssText.join("\n")));
|
14770 | var styleXml = serializer.serializeToString(style),
|
14771 | dataStr = "<svg xmlns=\"".concat(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["namespaces"].svg, "\" width=\"").concat(size.width, "\" height=\"").concat(size.height, "\">\n\t\t\t<foreignObject width=\"100%\" height=\"100%\">\n\t\t\t\t").concat(styleXml, "\n\t\t\t\t").concat(nodeXml.replace(/(url\()[^#]+/g, "$1"), "\n\t\t\t</foreignObject></svg>").replace("/\n/g", "%0A");
|
14772 |
|
14773 |
|
14774 | return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr));
|
14775 | };
|
14776 |
|
14777 |
|
14778 |
|
14779 |
|
14780 |
|
14781 |
|
14782 |
|
14783 |
|
14784 | extend(Chart_Chart.prototype, {
|
14785 | |
14786 |
|
14787 |
|
14788 |
|
14789 |
|
14790 |
|
14791 |
|
14792 |
|
14793 |
|
14794 |
|
14795 |
|
14796 |
|
14797 |
|
14798 |
|
14799 |
|
14800 |
|
14801 |
|
14802 |
|
14803 |
|
14804 |
|
14805 |
|
14806 |
|
14807 |
|
14808 |
|
14809 |
|
14810 |
|
14811 | "export": function _export(mimeType, callback) {
|
14812 | var $$ = this.internal,
|
14813 | size = {
|
14814 | width: $$.currentWidth,
|
14815 | height: $$.currentHeight
|
14816 | },
|
14817 | svgDataUrl = nodeToSvgDataUrl(this.element, size);
|
14818 |
|
14819 | if (isFunction(callback)) {
|
14820 | var img = new Image();
|
14821 | img.crosssOrigin = "Anonymous", img.onload = function () {
|
14822 | var canvas = browser_doc.createElement("canvas"),
|
14823 | ctx = canvas.getContext("2d");
|
14824 | canvas.width = size.width, canvas.height = size.height, ctx.drawImage(img, 0, 0), callback(canvas.toDataURL(mimeType));
|
14825 | }, img.src = svgDataUrl;
|
14826 | }
|
14827 |
|
14828 | return svgDataUrl;
|
14829 | }
|
14830 | });
|
14831 |
|
14832 |
|
14833 |
|
14834 |
|
14835 |
|
14836 |
|
14837 |
|
14838 |
|
14839 |
|
14840 |
|
14841 |
|
14842 |
|
14843 |
|
14844 |
|
14845 |
|
14846 |
|
14847 |
|
14848 |
|
14849 |
|
14850 |
|
14851 |
|
14852 |
|
14853 |
|
14854 |
|
14855 |
|
14856 |
|
14857 |
|
14858 |
|
14859 |
|
14860 |
|
14861 |
|
14862 |
|
14863 |
|
14864 |
|
14865 |
|
14866 |
|
14867 |
|
14868 |
|
14869 |
|
14870 |
|
14871 |
|
14872 |
|
14873 |
|
14874 |
|
14875 |
|
14876 |
|
14877 |
|
14878 |
|
14879 |
|
14880 |
|
14881 |
|
14882 |
|
14883 |
|
14884 |
|
14885 |
|
14886 |
|
14887 |
|
14888 |
|
14889 |
|
14890 |
|
14891 | var _defaults = {},
|
14892 | bb = {
|
14893 | |
14894 |
|
14895 |
|
14896 |
|
14897 |
|
14898 |
|
14899 |
|
14900 | version: "1.12.1",
|
14901 |
|
14902 | |
14903 |
|
14904 |
|
14905 |
|
14906 |
|
14907 |
|
14908 |
|
14909 |
|
14910 |
|
14911 |
|
14912 |
|
14913 |
|
14914 |
|
14915 |
|
14916 |
|
14917 |
|
14918 |
|
14919 |
|
14920 |
|
14921 |
|
14922 |
|
14923 |
|
14924 |
|
14925 |
|
14926 |
|
14927 |
|
14928 | generate: function generate(config) {
|
14929 | var options = mergeObj({}, _defaults, config),
|
14930 | inst = new Chart_Chart(options);
|
14931 | return inst.internal.charts = this.instance, this.instance.push(inst), inst;
|
14932 | },
|
14933 |
|
14934 | |
14935 |
|
14936 |
|
14937 |
|
14938 |
|
14939 |
|
14940 |
|
14941 |
|
14942 |
|
14943 |
|
14944 |
|
14945 |
|
14946 |
|
14947 |
|
14948 |
|
14949 |
|
14950 |
|
14951 |
|
14952 |
|
14953 |
|
14954 |
|
14955 |
|
14956 | defaults: function defaults(options) {
|
14957 | return isObject(options) && (_defaults = options), _defaults;
|
14958 | },
|
14959 |
|
14960 | |
14961 |
|
14962 |
|
14963 |
|
14964 |
|
14965 |
|
14966 |
|
14967 |
|
14968 |
|
14969 |
|
14970 |
|
14971 | instance: [],
|
14972 |
|
14973 | |
14974 |
|
14975 |
|
14976 |
|
14977 |
|
14978 |
|
14979 |
|
14980 |
|
14981 | plugin: {},
|
14982 |
|
14983 | |
14984 |
|
14985 |
|
14986 |
|
14987 | chart: {
|
14988 | fn: Chart_Chart.prototype,
|
14989 | internal: {
|
14990 | fn: ChartInternal_ChartInternal.prototype,
|
14991 | axis: {
|
14992 | fn: Axis_Axis.prototype
|
14993 | }
|
14994 | }
|
14995 | }
|
14996 | };
|
14997 |
|
14998 |
|
14999 |
|
15000 |
|
15001 |
|
15002 |
|
15003 | var core = __webpack_exports__["default"] = (bb);
|
15004 |
|
15005 | })
|
15006 | ]);
|
15007 | });
|
15008 |
|
\ | No newline at end of file |