1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | (function webpackUniversalModuleDefinition(root, factory) {
|
11 | if(typeof exports === 'object' && typeof module === 'object')
|
12 | module.exports = factory(require("d3-axis"), require("d3-brush"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom"));
|
13 | else if(typeof define === 'function' && define.amd)
|
14 | define(["d3-axis", "d3-brush", "d3-drag", "d3-dsv", "d3-ease", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "d3-time-format", "d3-transition", "d3-zoom"], factory);
|
15 | else {
|
16 | var a = typeof exports === 'object' ? factory(require("d3-axis"), require("d3-brush"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom")) : factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
17 | for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
18 | }
|
19 | })(this, function(__WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__13__) {
|
20 | return (function() {
|
21 | "use strict";
|
22 | var __webpack_modules__ = ([
|
23 | ,
|
24 | ,
|
25 |
|
26 | (function(module) {
|
27 |
|
28 | module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
29 |
|
30 | }),
|
31 |
|
32 | (function(module) {
|
33 |
|
34 | module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
|
35 |
|
36 | }),
|
37 |
|
38 | (function(module) {
|
39 |
|
40 | module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
41 |
|
42 | }),
|
43 |
|
44 | (function(module) {
|
45 |
|
46 | module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
|
47 |
|
48 | }),
|
49 |
|
50 | (function(module) {
|
51 |
|
52 | module.exports = __WEBPACK_EXTERNAL_MODULE__6__;
|
53 |
|
54 | }),
|
55 |
|
56 | (function(module) {
|
57 |
|
58 | module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
59 |
|
60 | }),
|
61 |
|
62 | (function(module) {
|
63 |
|
64 | module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
65 |
|
66 | }),
|
67 |
|
68 | (function(module) {
|
69 |
|
70 | module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
71 |
|
72 | }),
|
73 |
|
74 | (function(module) {
|
75 |
|
76 | module.exports = __WEBPACK_EXTERNAL_MODULE__10__;
|
77 |
|
78 | }),
|
79 |
|
80 | (function(module) {
|
81 |
|
82 | module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
|
83 |
|
84 | }),
|
85 |
|
86 | (function(module) {
|
87 |
|
88 | module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
89 |
|
90 | }),
|
91 |
|
92 | (function(module) {
|
93 |
|
94 | module.exports = __WEBPACK_EXTERNAL_MODULE__13__;
|
95 |
|
96 | })
|
97 | ]);
|
98 |
|
99 |
|
100 | var __webpack_module_cache__ = {};
|
101 |
|
102 |
|
103 | function __webpack_require__(moduleId) {
|
104 |
|
105 | var cachedModule = __webpack_module_cache__[moduleId];
|
106 | if (cachedModule !== undefined) {
|
107 | return cachedModule.exports;
|
108 | }
|
109 |
|
110 | var module = __webpack_module_cache__[moduleId] = {
|
111 |
|
112 |
|
113 | exports: {}
|
114 | };
|
115 |
|
116 |
|
117 | __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
118 |
|
119 |
|
120 | return module.exports;
|
121 | }
|
122 |
|
123 |
|
124 |
|
125 | !function() {
|
126 |
|
127 | __webpack_require__.d = function(exports, definition) {
|
128 | for(var key in definition) {
|
129 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
130 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
131 | }
|
132 | }
|
133 | };
|
134 | }();
|
135 |
|
136 |
|
137 | !function() {
|
138 | __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
139 | }();
|
140 |
|
141 |
|
142 | !function() {
|
143 |
|
144 | __webpack_require__.r = function(exports) {
|
145 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
146 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
147 | }
|
148 | Object.defineProperty(exports, '__esModule', { value: true });
|
149 | };
|
150 | }();
|
151 |
|
152 |
|
153 | var __webpack_exports__ = {};
|
154 |
|
155 | !function() {
|
156 |
|
157 |
|
158 | }();
|
159 |
|
160 | !function() {
|
161 |
|
162 | __webpack_require__.r(__webpack_exports__);
|
163 |
|
164 |
|
165 | __webpack_require__.d(__webpack_exports__, {
|
166 | "bb": function() { return bb; },
|
167 | "default": function() { return bb; }
|
168 | });
|
169 |
|
170 |
|
171 | var resolver_shape_namespaceObject = {};
|
172 | __webpack_require__.r(resolver_shape_namespaceObject);
|
173 | __webpack_require__.d(resolver_shape_namespaceObject, {
|
174 | "area": function() { return _area; },
|
175 | "areaLineRange": function() { return areaLineRange; },
|
176 | "areaSpline": function() { return areaSpline; },
|
177 | "areaSplineRange": function() { return areaSplineRange; },
|
178 | "areaStep": function() { return areaStep; },
|
179 | "bar": function() { return resolver_shape_bar; },
|
180 | "bubble": function() { return resolver_shape_bubble; },
|
181 | "candlestick": function() { return resolver_shape_candlestick; },
|
182 | "donut": function() { return shape_donut; },
|
183 | "gauge": function() { return resolver_shape_gauge; },
|
184 | "line": function() { return resolver_shape_line; },
|
185 | "pie": function() { return shape_pie; },
|
186 | "polar": function() { return resolver_shape_polar; },
|
187 | "radar": function() { return resolver_shape_radar; },
|
188 | "scatter": function() { return shape_scatter; },
|
189 | "spline": function() { return shape_spline; },
|
190 | "step": function() { return step; }
|
191 | });
|
192 |
|
193 |
|
194 | var resolver_interaction_namespaceObject = {};
|
195 | __webpack_require__.r(resolver_interaction_namespaceObject);
|
196 | __webpack_require__.d(resolver_interaction_namespaceObject, {
|
197 | "selection": function() { return _selectionModule; },
|
198 | "subchart": function() { return subchartModule; },
|
199 | "zoom": function() { return zoomModule; }
|
200 | });
|
201 |
|
202 | ;
|
203 | function _newArrowCheck(innerThis, boundThis) {
|
204 | if (innerThis !== boundThis) {
|
205 | throw new TypeError("Cannot instantiate an arrow function");
|
206 | }
|
207 | }
|
208 |
|
209 | var external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_ = __webpack_require__(4);
|
210 |
|
211 | var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(2);
|
212 | ;
|
213 |
|
214 | var _this = undefined;
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | var win = function () {
|
226 | _newArrowCheck(this, _this);
|
227 | var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self;
|
228 | return root || Function("return this")();
|
229 | }.bind(undefined)();
|
230 |
|
231 |
|
232 |
|
233 | win.requestIdleCallback = win.requestIdleCallback || function (cb) {
|
234 | _newArrowCheck(this, _this);
|
235 | return setTimeout(cb, 1);
|
236 | }.bind(undefined);
|
237 |
|
238 | win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
|
239 | _newArrowCheck(this, _this);
|
240 | return setTimeout(cb, 1);
|
241 | }.bind(undefined);
|
242 | var browser_doc = win == null ? void 0 : win.document;
|
243 | ;
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 | var TYPE = {
|
253 | AREA: "area",
|
254 | AREA_LINE_RANGE: "area-line-range",
|
255 | AREA_SPLINE: "area-spline",
|
256 | AREA_SPLINE_RANGE: "area-spline-range",
|
257 | AREA_STEP: "area-step",
|
258 | BAR: "bar",
|
259 | BUBBLE: "bubble",
|
260 | CANDLESTICK: "candlestick",
|
261 | DONUT: "donut",
|
262 | GAUGE: "gauge",
|
263 | LINE: "line",
|
264 | PIE: "pie",
|
265 | POLAR: "polar",
|
266 | RADAR: "radar",
|
267 | SCATTER: "scatter",
|
268 | SPLINE: "spline",
|
269 | STEP: "step"
|
270 | };
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 | var TYPE_METHOD_NEEDED = {
|
277 | AREA: "initArea",
|
278 | AREA_LINE_RANGE: "initArea",
|
279 | AREA_SPLINE: "initArea",
|
280 | AREA_SPLINE_RANGE: "initArea",
|
281 | AREA_STEP: "initArea",
|
282 | BAR: "initBar",
|
283 | BUBBLE: "initCircle",
|
284 | CANDLESTICK: "initCandlestick",
|
285 | DONUT: "initArc",
|
286 | GAUGE: "initArc",
|
287 | LINE: "initLine",
|
288 | PIE: "initArc",
|
289 | POLAR: "initPolar",
|
290 | RADAR: "initCircle",
|
291 | SCATTER: "initCircle",
|
292 | SPLINE: "initLine",
|
293 | STEP: "initLine"
|
294 | };
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 | var TYPE_BY_CATEGORY = {
|
301 | Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP],
|
302 | AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE],
|
303 | Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.POLAR, TYPE.RADAR],
|
304 | Line: [TYPE.LINE, TYPE.SPLINE, TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.STEP, TYPE.AREA_STEP],
|
305 | Step: [TYPE.STEP, TYPE.AREA_STEP],
|
306 | Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
|
307 | };
|
308 | ;
|
309 | function _defineProperty(obj, key, value) {
|
310 | if (key in obj) {
|
311 | Object.defineProperty(obj, key, {
|
312 | value: value,
|
313 | enumerable: true,
|
314 | configurable: true,
|
315 | writable: true
|
316 | });
|
317 | } else {
|
318 | obj[key] = value;
|
319 | }
|
320 | return obj;
|
321 | }
|
322 |
|
323 | var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
324 | ;
|
325 |
|
326 |
|
327 | var util_this = undefined;
|
328 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
329 | function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 | var isValue = function (v) {
|
340 | _newArrowCheck(this, util_this);
|
341 | return v || v === 0;
|
342 | }.bind(undefined),
|
343 | isFunction = function (v) {
|
344 | _newArrowCheck(this, util_this);
|
345 | return typeof v === "function";
|
346 | }.bind(undefined),
|
347 | isString = function (v) {
|
348 | _newArrowCheck(this, util_this);
|
349 | return typeof v === "string";
|
350 | }.bind(undefined),
|
351 | isNumber = function (v) {
|
352 | _newArrowCheck(this, util_this);
|
353 | return typeof v === "number";
|
354 | }.bind(undefined),
|
355 | isUndefined = function (v) {
|
356 | _newArrowCheck(this, util_this);
|
357 | return typeof v === "undefined";
|
358 | }.bind(undefined),
|
359 | isDefined = function (v) {
|
360 | _newArrowCheck(this, util_this);
|
361 | return typeof v !== "undefined";
|
362 | }.bind(undefined),
|
363 | isboolean = function (v) {
|
364 | _newArrowCheck(this, util_this);
|
365 | return typeof v === "boolean";
|
366 | }.bind(undefined),
|
367 | ceil10 = function (v) {
|
368 | _newArrowCheck(this, util_this);
|
369 | return Math.ceil(v / 10) * 10;
|
370 | }.bind(undefined),
|
371 | asHalfPixel = function (n) {
|
372 | _newArrowCheck(this, util_this);
|
373 | return Math.ceil(n) + .5;
|
374 | }.bind(undefined),
|
375 | diffDomain = function (d) {
|
376 | _newArrowCheck(this, util_this);
|
377 | return d[1] - d[0];
|
378 | }.bind(undefined),
|
379 | isObjectType = function (v) {
|
380 | _newArrowCheck(this, util_this);
|
381 | return typeof v === "object";
|
382 | }.bind(undefined),
|
383 | isEmpty = function (o) {
|
384 | _newArrowCheck(this, util_this);
|
385 | return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
386 | }.bind(undefined),
|
387 | notEmpty = function (o) {
|
388 | _newArrowCheck(this, util_this);
|
389 | return !isEmpty(o);
|
390 | }.bind(undefined),
|
391 | isArray = function (arr) {
|
392 | _newArrowCheck(this, util_this);
|
393 | return Array.isArray(arr);
|
394 | }.bind(undefined),
|
395 | isObject = function (obj) {
|
396 | _newArrowCheck(this, util_this);
|
397 | return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
398 | }.bind(undefined);
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | function getOption(options, key, defaultValue) {
|
409 | return isDefined(options[key]) ? options[key] : defaultValue;
|
410 | }
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | function hasValue(dict, value) {
|
420 | var _this2 = this,
|
421 | found = !1;
|
422 | Object.keys(dict).forEach(function (key) {
|
423 | _newArrowCheck(this, _this2);
|
424 | return dict[key] === value && (found = !0);
|
425 | }.bind(this));
|
426 | return found;
|
427 | }
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 | function callFn(fn, thisArg) {
|
438 | for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
439 | args[_key - 2] = arguments[_key];
|
440 | }
|
441 | isFn && fn.call.apply(fn, [thisArg].concat(args));
|
442 | return isFn;
|
443 | }
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 | function endall(transition, cb) {
|
452 | var _this3 = this,
|
453 | n = 0,
|
454 | end = function () {
|
455 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
456 | args[_key2] = arguments[_key2];
|
457 | }
|
458 | --n || cb.apply.apply(cb, [this].concat(args));
|
459 | };
|
460 |
|
461 | if ("duration" in transition) {
|
462 | transition.each(function () {
|
463 | _newArrowCheck(this, _this3);
|
464 | return ++n;
|
465 | }.bind(this)).on("end", end);
|
466 | } else {
|
467 | ++n;
|
468 | transition.call(end);
|
469 | }
|
470 | }
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 | function sanitise(str) {
|
479 | return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
480 | }
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | function setTextValue(node, text, dy, toMiddle) {
|
491 | var _this4 = this;
|
492 | if (dy === void 0) {
|
493 | dy = [-1, 1];
|
494 | }
|
495 | if (toMiddle === void 0) {
|
496 | toMiddle = !1;
|
497 | }
|
498 | if (!node || !isString(text)) {
|
499 | return;
|
500 | }
|
501 | if (text.indexOf("\n") === -1) {
|
502 | node.text(text);
|
503 | } else {
|
504 | var diff = [node.text(), text].map(function (v) {
|
505 | _newArrowCheck(this, _this4);
|
506 | return v.replace(/[\s\n]/g, "");
|
507 | }.bind(this));
|
508 | if (diff[0] !== diff[1]) {
|
509 | var multiline = text.split("\n"),
|
510 | len = toMiddle ? multiline.length - 1 : 1;
|
511 |
|
512 | node.html("");
|
513 | multiline.forEach(function (v, i) {
|
514 | _newArrowCheck(this, _this4);
|
515 | node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
516 | }.bind(this));
|
517 | }
|
518 | }
|
519 | }
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 | function getRectSegList(path) {
|
528 | |
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 | var _path$getBBox = path.getBBox(),
|
536 | x = _path$getBBox.x,
|
537 | y = _path$getBBox.y,
|
538 | width = _path$getBBox.width,
|
539 | height = _path$getBBox.height;
|
540 | return [{
|
541 | x: x,
|
542 | y: y + height
|
543 | },
|
544 |
|
545 | {
|
546 | x: x,
|
547 | y: y
|
548 | },
|
549 |
|
550 | {
|
551 | x: x + width,
|
552 | y: y
|
553 | },
|
554 |
|
555 | {
|
556 | x: x + width,
|
557 | y: y + height
|
558 | }
|
559 | ];
|
560 | }
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 | function getPathBox(path) {
|
569 | var _path$getBoundingClie = path.getBoundingClientRect(),
|
570 | width = _path$getBoundingClie.width,
|
571 | height = _path$getBoundingClie.height,
|
572 | items = getRectSegList(path),
|
573 | x = items[0].x,
|
574 | y = Math.min(items[0].y, items[1].y);
|
575 | return {
|
576 | x: x,
|
577 | y: y,
|
578 | width: width,
|
579 | height: height
|
580 | };
|
581 | }
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 | function getPointer(event, element) {
|
591 | var _ref,
|
592 | touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
593 | pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
594 | _this5 = this;
|
595 | return pointer.map(function (v) {
|
596 | _newArrowCheck(this, _this5);
|
597 | return isNaN(v) ? 0 : v;
|
598 | }.bind(this));
|
599 | }
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 | function getBrushSelection(ctx) {
|
608 | var event = ctx.event,
|
609 | $el = ctx.$el,
|
610 | main = $el.subchart.main || $el.main,
|
611 | selection;
|
612 |
|
613 | if (event && event.type === "brush") {
|
614 | selection = event.selection;
|
615 |
|
616 | } else if (main && (selection = main.select(".bb-brush").node())) {
|
617 | selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
|
618 | }
|
619 | return selection;
|
620 | }
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 | function getBoundingRect(node) {
|
630 | var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
631 | return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
632 | }
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 | function getRandom(asStr, min, max) {
|
643 | if (asStr === void 0) {
|
644 | asStr = !0;
|
645 | }
|
646 | if (min === void 0) {
|
647 | min = 0;
|
648 | }
|
649 | if (max === void 0) {
|
650 | max = 1e4;
|
651 | }
|
652 | var rand = Math.floor(Math.random() * (max - min) + min);
|
653 | return asStr ? rand + "" : rand;
|
654 | }
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 | function findIndex(arr, v, start, end, isRotated) {
|
667 | if (start > end) {
|
668 | return -1;
|
669 | }
|
670 | var mid = Math.floor((start + end) / 2),
|
671 | _arr$mid = arr[mid],
|
672 | x = _arr$mid.x,
|
673 | _arr$mid$w = _arr$mid.w,
|
674 | w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
675 | if (isRotated) {
|
676 | x = arr[mid].y;
|
677 | w = arr[mid].h;
|
678 | }
|
679 | if (v >= x && v <= x + w) {
|
680 | return mid;
|
681 | }
|
682 | return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
683 | }
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 | function brushEmpty(ctx) {
|
692 | var selection = getBrushSelection(ctx);
|
693 | if (selection) {
|
694 |
|
695 |
|
696 |
|
697 | return selection[0] === selection[1];
|
698 | }
|
699 | return !0;
|
700 | }
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 | function deepClone() {
|
709 | for (var _this6 = this, clone = function (v) {
|
710 | _newArrowCheck(this, _this6);
|
711 | if (isObject(v) && v.constructor) {
|
712 | var r = new v.constructor();
|
713 | for (var k in v) {
|
714 | r[k] = clone(v[k]);
|
715 | }
|
716 | return r;
|
717 | }
|
718 | return v;
|
719 | }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
720 | objectN[_key3] = arguments[_key3];
|
721 | }
|
722 | return objectN.map(function (v) {
|
723 | _newArrowCheck(this, _this6);
|
724 | return clone(v);
|
725 | }.bind(this)).reduce(function (a, c) {
|
726 | _newArrowCheck(this, _this6);
|
727 | return _objectSpread(_objectSpread({}, a), c);
|
728 | }.bind(this));
|
729 | }
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 | function extend(target, source) {
|
739 | var _this7 = this;
|
740 | if (target === void 0) {
|
741 | target = {};
|
742 | }
|
743 | if (isArray(source)) {
|
744 | source.forEach(function (v) {
|
745 | _newArrowCheck(this, _this7);
|
746 | return extend(target, v);
|
747 | }.bind(this));
|
748 | }
|
749 |
|
750 |
|
751 | for (var p in source) {
|
752 | if (/^\d+$/.test(p) || p in target) {
|
753 | continue;
|
754 | }
|
755 | target[p] = source[p];
|
756 | }
|
757 | return target;
|
758 | }
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 | var capitalize = function (str) {
|
767 | _newArrowCheck(this, util_this);
|
768 | return str.charAt(0).toUpperCase() + str.slice(1);
|
769 | }.bind(undefined);
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 | function camelize(str, separator) {
|
779 | var _this8 = this;
|
780 | if (separator === void 0) {
|
781 | separator = "-";
|
782 | }
|
783 | return str.split(separator).map(function (v, i) {
|
784 | _newArrowCheck(this, _this8);
|
785 | return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
786 | }.bind(this)).join("");
|
787 | }
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 | var toArray = function (v) {
|
796 | _newArrowCheck(this, util_this);
|
797 | return [].slice.call(v);
|
798 | }.bind(undefined);
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 | function addCssRules(style, selector, prop) {
|
809 | var _this9 = this,
|
810 | rootSelctor = style.rootSelctor,
|
811 | sheet = style.sheet,
|
812 | getSelector = function (s) {
|
813 | _newArrowCheck(this, _this9);
|
814 | return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
815 | }.bind(this),
|
816 | rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
817 | return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
818 | }
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 | function getCssRules(styleSheets) {
|
827 | var _this10 = this,
|
828 | rules = [];
|
829 | styleSheets.forEach(function (sheet) {
|
830 | _newArrowCheck(this, _this10);
|
831 | try {
|
832 | if (sheet.cssRules && sheet.cssRules.length) {
|
833 | rules = rules.concat(toArray(sheet.cssRules));
|
834 | }
|
835 | } catch (e) {
|
836 | console.error("Error while reading rules from " + sheet.href + ": " + e.toString());
|
837 | }
|
838 | }.bind(this));
|
839 | return rules;
|
840 | }
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 | function getTranslation(node) {
|
849 | var transform = node ? node.transform : null,
|
850 | baseVal = transform && transform.baseVal;
|
851 | return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
852 | a: 0,
|
853 | b: 0,
|
854 | c: 0,
|
855 | d: 0,
|
856 | e: 0,
|
857 | f: 0
|
858 | };
|
859 | }
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 | function getUnique(data) {
|
868 | var _this11 = this,
|
869 | isDate = data[0] instanceof Date,
|
870 | d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
871 | _newArrowCheck(this, _this11);
|
872 | return self.indexOf(v) === i;
|
873 | }.bind(this));
|
874 | return isDate ? d.map(function (v) {
|
875 | _newArrowCheck(this, _this11);
|
876 | return new Date(v);
|
877 | }.bind(this)) : d;
|
878 | }
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 | function mergeArray(arr) {
|
887 | var _this12 = this;
|
888 | return arr && arr.length ? arr.reduce(function (p, c) {
|
889 | _newArrowCheck(this, _this12);
|
890 | return p.concat(c);
|
891 | }.bind(this)) : [];
|
892 | }
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 | function mergeObj(target) {
|
902 | for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
903 | objectN[_key4 - 1] = arguments[_key4];
|
904 | }
|
905 | if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
906 | return target;
|
907 | }
|
908 | var source = objectN.shift();
|
909 | if (isObject(target) && isObject(source)) {
|
910 | Object.keys(source).forEach(function (key) {
|
911 | _newArrowCheck(this, _this13);
|
912 | var value = source[key];
|
913 | if (isObject(value)) {
|
914 | target[key] || (target[key] = {});
|
915 | target[key] = mergeObj(target[key], value);
|
916 | } else {
|
917 | target[key] = isArray(value) ? value.concat() : value;
|
918 | }
|
919 | }.bind(this));
|
920 | }
|
921 | return mergeObj.apply(void 0, [target].concat(objectN));
|
922 | }
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | function sortValue(data, isAsc) {
|
932 | var _this14 = this;
|
933 | if (isAsc === void 0) {
|
934 | isAsc = !0;
|
935 | }
|
936 | var fn;
|
937 | if (data[0] instanceof Date) {
|
938 | fn = isAsc ? function (a, b) {
|
939 | _newArrowCheck(this, _this14);
|
940 | return a - b;
|
941 | }.bind(this) : function (a, b) {
|
942 | _newArrowCheck(this, _this14);
|
943 | return b - a;
|
944 | }.bind(this);
|
945 | } else {
|
946 | if (isAsc && !data.every(isNaN)) {
|
947 | fn = function (a, b) {
|
948 | _newArrowCheck(this, _this14);
|
949 | return a - b;
|
950 | }.bind(this);
|
951 | } else if (!isAsc) {
|
952 | fn = function (a, b) {
|
953 | _newArrowCheck(this, _this14);
|
954 | return a > b && -1 || a < b && 1 || a === b && 0;
|
955 | }.bind(this);
|
956 | }
|
957 | }
|
958 | return data.concat().sort(fn);
|
959 | }
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 | function getMinMax(type, data) {
|
969 | var _this15 = this,
|
970 | res = data.filter(function (v) {
|
971 | _newArrowCheck(this, _this15);
|
972 | return notEmpty(v);
|
973 | }.bind(this));
|
974 | if (res.length) {
|
975 | if (isNumber(res[0])) {
|
976 | res = Math[type].apply(Math, res);
|
977 | } else if (res[0] instanceof Date) {
|
978 | res = sortValue(res, type === "min")[0];
|
979 | }
|
980 | } else {
|
981 | res = undefined;
|
982 | }
|
983 | return res;
|
984 | }
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 | var getRange = function (start, end, step) {
|
995 | if (step === void 0) {
|
996 | step = 1;
|
997 | }
|
998 | _newArrowCheck(this, util_this);
|
999 | var res = [],
|
1000 | n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
1001 | for (var i = start; i < n; i++) {
|
1002 | res.push(start + i * step);
|
1003 | }
|
1004 | return res;
|
1005 | }.bind(undefined),
|
1006 | emulateEvent = {
|
1007 | mouse: function () {
|
1008 | var _this16 = this;
|
1009 | _newArrowCheck(this, util_this);
|
1010 | var getParams = function () {
|
1011 | _newArrowCheck(this, _this16);
|
1012 | return {
|
1013 | bubbles: !1,
|
1014 | cancelable: !1,
|
1015 | screenX: 0,
|
1016 | screenY: 0,
|
1017 | clientX: 0,
|
1018 | clientY: 0
|
1019 | };
|
1020 | }.bind(this);
|
1021 | try {
|
1022 |
|
1023 | new MouseEvent("t");
|
1024 | return function (el, eventType, params) {
|
1025 | if (params === void 0) {
|
1026 | params = getParams();
|
1027 | }
|
1028 | _newArrowCheck(this, _this16);
|
1029 | el.dispatchEvent(new MouseEvent(eventType, params));
|
1030 | }.bind(this);
|
1031 | } catch (e) {
|
1032 |
|
1033 | return function (el, eventType, params) {
|
1034 | if (params === void 0) {
|
1035 | params = getParams();
|
1036 | }
|
1037 | _newArrowCheck(this, _this16);
|
1038 | var mouseEvent = browser_doc.createEvent("MouseEvent");
|
1039 |
|
1040 |
|
1041 | mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
1042 |
|
1043 | params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
|
1044 | el.dispatchEvent(mouseEvent);
|
1045 | }.bind(this);
|
1046 | }
|
1047 | }.bind(undefined)(),
|
1048 | touch: function touch(el, eventType, params) {
|
1049 | _newArrowCheck(this, util_this);
|
1050 | var touchObj = new Touch(mergeObj({
|
1051 | identifier: Date.now(),
|
1052 | target: el,
|
1053 | radiusX: 2.5,
|
1054 | radiusY: 2.5,
|
1055 | rotationAngle: 10,
|
1056 | force: .5
|
1057 | }, params));
|
1058 | el.dispatchEvent(new TouchEvent(eventType, {
|
1059 | cancelable: !0,
|
1060 | bubbles: !0,
|
1061 | shiftKey: !0,
|
1062 | touches: [touchObj],
|
1063 | targetTouches: [],
|
1064 | changedTouches: [touchObj]
|
1065 | }));
|
1066 | }.bind(undefined)
|
1067 | };
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 | function tplProcess(tpl, data) {
|
1076 | var res = tpl;
|
1077 | for (var x in data) {
|
1078 | res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
1079 | }
|
1080 | return res;
|
1081 | }
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 | function parseDate(date) {
|
1091 | var parsedDate;
|
1092 | if (date instanceof Date) {
|
1093 | parsedDate = date;
|
1094 | } else if (isString(date)) {
|
1095 | var _format$dataTime,
|
1096 | config = this.config,
|
1097 | format = this.format;
|
1098 |
|
1099 |
|
1100 | parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
1101 | } else if (isNumber(date) && !isNaN(date)) {
|
1102 | parsedDate = new Date(+date);
|
1103 | }
|
1104 | if (!parsedDate || isNaN(+parsedDate)) {
|
1105 | console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
|
1106 | }
|
1107 | return parsedDate;
|
1108 | }
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 | function isTabVisible() {
|
1116 | return (browser_doc == null ? void 0 : browser_doc.hidden) === !1 || (browser_doc == null ? void 0 : browser_doc.visibilityState) === "visible";
|
1117 | }
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 | function convertInputType(mouse, touch) {
|
1127 | var _this17 = this,
|
1128 | DocumentTouch = win.DocumentTouch,
|
1129 | matchMedia = win.matchMedia,
|
1130 | navigator = win.navigator,
|
1131 | hasTouch = !1;
|
1132 | if (touch) {
|
1133 |
|
1134 | if (navigator && "maxTouchPoints" in navigator) {
|
1135 | hasTouch = navigator.maxTouchPoints > 0;
|
1136 |
|
1137 |
|
1138 |
|
1139 | } else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
|
1140 | hasTouch = !0;
|
1141 | } else {
|
1142 |
|
1143 | if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
|
1144 | hasTouch = !0;
|
1145 | } else {
|
1146 |
|
1147 | var UA = navigator.userAgent;
|
1148 | hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
1149 | }
|
1150 | }
|
1151 | }
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 | var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
1157 | _newArrowCheck(this, _this17);
|
1158 | return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
1159 | }.bind(this));
|
1160 |
|
1161 |
|
1162 | return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
1163 | }
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 | function runUntil(fn, conditionFn) {
|
1172 | var _this18 = this;
|
1173 | if (conditionFn() === !1) {
|
1174 | win.requestAnimationFrame(function () {
|
1175 | _newArrowCheck(this, _this18);
|
1176 | return runUntil(fn, conditionFn);
|
1177 | }.bind(this));
|
1178 | } else {
|
1179 | fn();
|
1180 | }
|
1181 | }
|
1182 | ;
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | function checkModuleImport(ctx) {
|
1200 | var $$ = ctx,
|
1201 | config = $$.config,
|
1202 | type = "";
|
1203 | if (isEmpty(config.data_type || config.data_types) && !$$[TYPE_METHOD_NEEDED.LINE]) {
|
1204 | type = "line";
|
1205 | } else {
|
1206 | for (var x in TYPE_METHOD_NEEDED) {
|
1207 | var t = TYPE[x];
|
1208 | if ($$.hasType(t) && !$$[TYPE_METHOD_NEEDED[x]]) {
|
1209 | type = t;
|
1210 | break;
|
1211 | }
|
1212 | }
|
1213 | }
|
1214 | type && logError("Please, make sure if %c" + camelize(type), "module has been imported and specified correctly.");
|
1215 | }
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 | function logError(head, tail) {
|
1224 | var _window$console,
|
1225 | prefix = "[billboard.js]",
|
1226 | hasConsole = (_window$console = win.console) == null ? void 0 : _window$console.error;
|
1227 | if (hasConsole) {
|
1228 | console.error("\u274C " + prefix + " " + head, "background:red;color:white;display:block;font-size:15px", tail);
|
1229 | console.info("%cℹ️", "font-size:15px", "https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality");
|
1230 | }
|
1231 | throw Error(prefix + " " + head.replace(/\%c([a-z-]+)/i, "'$1' ") + " " + tail);
|
1232 | }
|
1233 | ;
|
1234 |
|
1235 | function classes_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
1236 | function classes_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? classes_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : classes_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 | var $COMMON = {
|
1246 | button: "bb-button",
|
1247 | chart: "bb-chart",
|
1248 | empty: "bb-empty",
|
1249 | main: "bb-main",
|
1250 | target: "bb-target",
|
1251 | EXPANDED: "_expanded_"
|
1252 | };
|
1253 | var $ARC = {
|
1254 | arc: "bb-arc",
|
1255 | arcLabelLine: "bb-arc-label-line",
|
1256 | arcs: "bb-arcs",
|
1257 | chartArc: "bb-chart-arc",
|
1258 | chartArcs: "bb-chart-arcs",
|
1259 | chartArcsBackground: "bb-chart-arcs-background",
|
1260 | chartArcsTitle: "bb-chart-arcs-title"
|
1261 | };
|
1262 | var $AREA = {
|
1263 | area: "bb-area",
|
1264 | areas: "bb-areas"
|
1265 | };
|
1266 | var $AXIS = {
|
1267 | axis: "bb-axis",
|
1268 | axisX: "bb-axis-x",
|
1269 | axisXLabel: "bb-axis-x-label",
|
1270 | axisY: "bb-axis-y",
|
1271 | axisY2: "bb-axis-y2",
|
1272 | axisY2Label: "bb-axis-y2-label",
|
1273 | axisYLabel: "bb-axis-y-label"
|
1274 | };
|
1275 | var $BAR = {
|
1276 | bar: "bb-bar",
|
1277 | bars: "bb-bars",
|
1278 | chartBar: "bb-chart-bar",
|
1279 | chartBars: "bb-chart-bars"
|
1280 | };
|
1281 | var $CANDLESTICK = {
|
1282 | candlestick: "bb-candlestick",
|
1283 | candlesticks: "bb-candlesticks",
|
1284 | chartCandlestick: "bb-chart-candlestick",
|
1285 | chartCandlesticks: "bb-chart-candlesticks",
|
1286 | valueDown: "bb-value-down",
|
1287 | valueUp: "bb-value-up"
|
1288 | };
|
1289 | var $CIRCLE = {
|
1290 | chartCircles: "bb-chart-circles",
|
1291 | circle: "bb-circle",
|
1292 | circles: "bb-circles"
|
1293 | };
|
1294 | var $COLOR = {
|
1295 | colorPattern: "bb-color-pattern",
|
1296 | colorScale: "bb-colorscale"
|
1297 | };
|
1298 | var $DRAG = {
|
1299 | dragarea: "bb-dragarea",
|
1300 | INCLUDED: "_included_"
|
1301 | };
|
1302 | var $GAUGE = {
|
1303 | chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
1304 | chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
1305 | chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
1306 | chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
1307 | gaugeValue: "bb-gauge-value"
|
1308 | };
|
1309 | var $LEGEND = {
|
1310 | legend: "bb-legend",
|
1311 | legendBackground: "bb-legend-background",
|
1312 | legendItem: "bb-legend-item",
|
1313 | legendItemEvent: "bb-legend-item-event",
|
1314 | legendItemHidden: "bb-legend-item-hidden",
|
1315 | legendItemPoint: "bb-legend-item-point",
|
1316 | legendItemTile: "bb-legend-item-tile"
|
1317 | };
|
1318 | var $LINE = {
|
1319 | chartLine: "bb-chart-line",
|
1320 | chartLines: "bb-chart-lines",
|
1321 | line: "bb-line",
|
1322 | lines: "bb-lines"
|
1323 | };
|
1324 | var $EVENT = {
|
1325 | eventRect: "bb-event-rect",
|
1326 | eventRects: "bb-event-rects",
|
1327 | eventRectsMultiple: "bb-event-rects-multiple",
|
1328 | eventRectsSingle: "bb-event-rects-single"
|
1329 | };
|
1330 | var $FOCUS = {
|
1331 | focused: "bb-focused",
|
1332 | defocused: "bb-defocused",
|
1333 | legendItemFocused: "bb-legend-item-focused",
|
1334 | xgridFocus: "bb-xgrid-focus",
|
1335 | ygridFocus: "bb-ygrid-focus"
|
1336 | };
|
1337 | var $GRID = {
|
1338 | grid: "bb-grid",
|
1339 | gridLines: "bb-grid-lines",
|
1340 | xgrid: "bb-xgrid",
|
1341 | xgridLine: "bb-xgrid-line",
|
1342 | xgridLines: "bb-xgrid-lines",
|
1343 | xgrids: "bb-xgrids",
|
1344 | ygrid: "bb-ygrid",
|
1345 | ygridLine: "bb-ygrid-line",
|
1346 | ygridLines: "bb-ygrid-lines",
|
1347 | ygrids: "bb-ygrids"
|
1348 | };
|
1349 | var $LEVEL = {
|
1350 | level: "bb-level",
|
1351 | levels: "bb-levels"
|
1352 | };
|
1353 | var $RADAR = {
|
1354 | chartRadar: "bb-chart-radar",
|
1355 | chartRadars: "bb-chart-radars"
|
1356 | };
|
1357 | var $REGION = {
|
1358 | region: "bb-region",
|
1359 | regions: "bb-regions"
|
1360 | };
|
1361 | var $SELECT = {
|
1362 | selectedCircle: "bb-selected-circle",
|
1363 | selectedCircles: "bb-selected-circles",
|
1364 | SELECTED: "_selected_"
|
1365 | };
|
1366 | var $SHAPE = {
|
1367 | shape: "bb-shape",
|
1368 | shapes: "bb-shapes"
|
1369 | };
|
1370 | var $SUBCHART = {
|
1371 | brush: "bb-brush",
|
1372 | subchart: "bb-subchart"
|
1373 | };
|
1374 | var $TEXT = {
|
1375 | chartText: "bb-chart-text",
|
1376 | chartTexts: "bb-chart-texts",
|
1377 | text: "bb-text",
|
1378 | texts: "bb-texts",
|
1379 | title: "bb-title",
|
1380 | TextOverlapping: "text-overlapping"
|
1381 | };
|
1382 | var $TOOLTIP = {
|
1383 | tooltip: "bb-tooltip",
|
1384 | tooltipContainer: "bb-tooltip-container",
|
1385 | tooltipName: "bb-tooltip-name"
|
1386 | };
|
1387 | var $ZOOM = {
|
1388 | buttonZoomReset: "bb-zoom-reset",
|
1389 | zoomBrush: "bb-zoom-brush"
|
1390 | };
|
1391 | var classes = (classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM));
|
1392 | ;
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 | var Element = function () {
|
1404 | return {
|
1405 | chart: null,
|
1406 | main: null,
|
1407 | svg: null,
|
1408 | axis: {
|
1409 |
|
1410 | x: null,
|
1411 | y: null,
|
1412 | y2: null,
|
1413 | subX: null
|
1414 | },
|
1415 | defs: null,
|
1416 | tooltip: null,
|
1417 | legend: null,
|
1418 | title: null,
|
1419 | subchart: {
|
1420 | main: null,
|
1421 |
|
1422 | bar: null,
|
1423 |
|
1424 | line: null,
|
1425 |
|
1426 | area: null
|
1427 | },
|
1428 |
|
1429 | arcs: null,
|
1430 | bar: null,
|
1431 |
|
1432 | candlestick: null,
|
1433 | line: null,
|
1434 |
|
1435 | area: null,
|
1436 |
|
1437 | circle: null,
|
1438 |
|
1439 | radar: null,
|
1440 | text: null,
|
1441 |
|
1442 | grid: {
|
1443 | main: null,
|
1444 |
|
1445 | x: null,
|
1446 |
|
1447 | y: null
|
1448 | },
|
1449 |
|
1450 | gridLines: {
|
1451 | main: null,
|
1452 |
|
1453 | x: null,
|
1454 |
|
1455 | y: null
|
1456 | },
|
1457 |
|
1458 | region: {
|
1459 | main: null,
|
1460 |
|
1461 | list: null
|
1462 | },
|
1463 |
|
1464 | eventRect: null,
|
1465 | zoomResetBtn: null
|
1466 | };
|
1467 | };
|
1468 |
|
1469 | ;
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 | var State = function () {
|
1481 | return {
|
1482 |
|
1483 | width: 0,
|
1484 | width2: 0,
|
1485 | height: 0,
|
1486 | height2: 0,
|
1487 | margin: {
|
1488 | top: 0,
|
1489 | bottom: 0,
|
1490 | left: 0,
|
1491 | right: 0
|
1492 | },
|
1493 | margin2: {
|
1494 | top: 0,
|
1495 | bottom: 0,
|
1496 | left: 0,
|
1497 | right: 0
|
1498 | },
|
1499 | margin3: {
|
1500 | top: 0,
|
1501 | bottom: 0,
|
1502 | left: 0,
|
1503 | right: 0
|
1504 | },
|
1505 | arcWidth: 0,
|
1506 | arcHeight: 0,
|
1507 | xAxisHeight: 0,
|
1508 | hasAxis: !1,
|
1509 | hasRadar: !1,
|
1510 |
|
1511 | cssRule: {},
|
1512 | current: {
|
1513 |
|
1514 | width: 0,
|
1515 | height: 0,
|
1516 | dataMax: 0,
|
1517 | maxTickWidths: {
|
1518 | x: {
|
1519 | size: 0,
|
1520 | ticks: [],
|
1521 | clipPath: 0,
|
1522 | domain: ""
|
1523 | },
|
1524 | y: {
|
1525 | size: 0,
|
1526 | domain: ""
|
1527 | },
|
1528 | y2: {
|
1529 | size: 0,
|
1530 | domain: ""
|
1531 | }
|
1532 | },
|
1533 |
|
1534 | types: []
|
1535 | },
|
1536 |
|
1537 | isLegendRight: !1,
|
1538 | isLegendInset: !1,
|
1539 | isLegendTop: !1,
|
1540 | isLegendLeft: !1,
|
1541 | legendStep: 0,
|
1542 | legendItemWidth: 0,
|
1543 | legendItemHeight: 0,
|
1544 | legendHasRendered: !1,
|
1545 | eventReceiver: {
|
1546 | currentIdx: -1,
|
1547 |
|
1548 | rect: {},
|
1549 |
|
1550 | data: [],
|
1551 |
|
1552 | coords: []
|
1553 | },
|
1554 |
|
1555 | axis: {
|
1556 | x: {
|
1557 | padding: {
|
1558 | left: 0,
|
1559 | right: 0
|
1560 | },
|
1561 | tickCount: 0
|
1562 | }
|
1563 | },
|
1564 | rotatedPadding: {
|
1565 | left: 30,
|
1566 | right: 0,
|
1567 | top: 5
|
1568 | },
|
1569 | withoutFadeIn: {},
|
1570 | inputType: "",
|
1571 | datetimeId: "",
|
1572 |
|
1573 | clip: {
|
1574 | id: "",
|
1575 | idXAxis: "",
|
1576 | idYAxis: "",
|
1577 | idXAxisTickTexts: "",
|
1578 | idGrid: "",
|
1579 | idSubchart: "",
|
1580 |
|
1581 | path: "",
|
1582 | pathXAxis: "",
|
1583 | pathYAxis: "",
|
1584 | pathXAxisTickTexts: "",
|
1585 | pathGrid: ""
|
1586 | },
|
1587 |
|
1588 | event: null,
|
1589 |
|
1590 | dragStart: null,
|
1591 | dragging: !1,
|
1592 | flowing: !1,
|
1593 | cancelClick: !1,
|
1594 | mouseover: !1,
|
1595 | rendered: !1,
|
1596 | transiting: !1,
|
1597 | redrawing: !1,
|
1598 |
|
1599 | resizing: !1,
|
1600 |
|
1601 | toggling: !1,
|
1602 |
|
1603 | zooming: !1,
|
1604 | hasNegativeValue: !1,
|
1605 | hasPositiveValue: !0,
|
1606 | orgAreaOpacity: "0.2",
|
1607 | orgConfig: {},
|
1608 |
|
1609 |
|
1610 |
|
1611 | hiddenTargetIds: [],
|
1612 | hiddenLegendIds: [],
|
1613 | focusedTargetIds: [],
|
1614 | defocusedTargetIds: [],
|
1615 |
|
1616 | radius: 0,
|
1617 | innerRadius: 0,
|
1618 | outerRadius: undefined,
|
1619 | innerRadiusRatio: 0,
|
1620 | gaugeArcWidth: 0,
|
1621 | radiusExpanded: 0,
|
1622 |
|
1623 | xgridAttr: {
|
1624 | x1: null,
|
1625 | x2: null,
|
1626 | y1: null,
|
1627 | y2: null
|
1628 | }
|
1629 | };
|
1630 | };
|
1631 |
|
1632 | ;
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 | var Store_classes = {
|
1643 | element: Element,
|
1644 | state: State
|
1645 | };
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 | var Store = function () {
|
1654 | function Store() {
|
1655 | var _this = this;
|
1656 | Object.keys(Store_classes).forEach(function (v) {
|
1657 | _newArrowCheck(this, _this);
|
1658 | this[v] = new Store_classes[v]();
|
1659 | }.bind(this));
|
1660 | }
|
1661 | var _proto = Store.prototype;
|
1662 | _proto.getStore = function getStore(name) {
|
1663 | return this[name];
|
1664 | };
|
1665 | return Store;
|
1666 | }();
|
1667 |
|
1668 | ;
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 | var main = ({
|
1677 | |
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 | bindto: "#chart",
|
1704 | |
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 | background: {},
|
1724 | |
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 | clipPath: !0,
|
1739 | |
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 | svg_classname: undefined,
|
1752 | |
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 | size_width: undefined,
|
1769 | size_height: undefined,
|
1770 | |
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 | padding: !0,
|
1798 | padding_left: undefined,
|
1799 | padding_right: undefined,
|
1800 | padding_top: undefined,
|
1801 | padding_bottom: undefined,
|
1802 | |
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 | resize_auto: !0,
|
1828 | resize_timer: !0,
|
1829 | |
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 | onclick: undefined,
|
1843 | |
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 | onover: undefined,
|
1857 | |
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 | onout: undefined,
|
1871 | |
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 | onresize: undefined,
|
1884 | |
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 | onresized: undefined,
|
1897 | |
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 | onbeforeinit: undefined,
|
1910 | |
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 | oninit: undefined,
|
1923 | |
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 | onafterinit: undefined,
|
1936 | |
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 | onrendered: undefined,
|
1949 | |
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 | transition_duration: 250,
|
1963 | |
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 | plugins: [],
|
1976 | |
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 | render: {},
|
2017 | |
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 | regions: []
|
2040 | });
|
2041 | ;
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 | var boost = ({
|
2050 | |
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 | boost_useCssRule: !1,
|
2071 | boost_useWorker: !1
|
2072 | });
|
2073 | ;
|
2074 |
|
2075 | var data_this = undefined;
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 | var data = ({
|
2085 | |
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 | data_x: undefined,
|
2098 | |
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 | data_idConverter: function data_idConverter(id) {
|
2118 | _newArrowCheck(this, data_this);
|
2119 | return id;
|
2120 | }.bind(undefined),
|
2121 | |
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 | data_names: {},
|
2138 | |
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 | data_classes: {},
|
2154 | |
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 | data_type: undefined,
|
2214 | |
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 | data_types: {},
|
2263 | |
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 |
|
2287 |
|
2288 |
|
2289 |
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 | data_order: "desc",
|
2314 | |
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 | data_groups: [],
|
2329 | |
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 | data_groupsZeroAs: "positive",
|
2346 | |
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 | data_color: undefined,
|
2360 | |
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 | data_colors: {},
|
2378 | |
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 | data_labels: {},
|
2477 | data_labels_backgroundColors: undefined,
|
2478 | data_labels_colors: undefined,
|
2479 | data_labels_position: {},
|
2480 | |
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 | data_hide: !1,
|
2497 | |
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 | data_filter: undefined,
|
2516 | |
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 | data_onclick: function data_onclick() {
|
2536 | _newArrowCheck(this, data_this);
|
2537 | }.bind(undefined),
|
2538 | |
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 | data_onover: function data_onover() {
|
2558 | _newArrowCheck(this, data_this);
|
2559 | }.bind(undefined),
|
2560 | |
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 | data_onout: function data_onout() {
|
2580 | _newArrowCheck(this, data_this);
|
2581 | }.bind(undefined),
|
2582 | |
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 | data_onshown: undefined,
|
2598 | |
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 | data_onhidden: undefined,
|
2614 | |
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 | data_onmin: undefined,
|
2629 | |
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 | data_onmax: undefined,
|
2644 | |
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 |
|
2656 | data_url: undefined,
|
2657 | |
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 | data_headers: undefined,
|
2675 | |
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 | data_json: undefined,
|
2698 | |
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
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 |
|
2786 |
|
2787 |
|
2788 | data_rows: undefined,
|
2789 | |
2790 |
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
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 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 | data_columns: undefined,
|
2858 | |
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 | data_mimeType: "csv",
|
2874 | |
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 | data_keys: undefined,
|
2896 | |
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 | data_empty_label_text: ""
|
2913 | });
|
2914 | ;
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 | var color = ({
|
2923 | |
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 |
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 |
|
2971 |
|
2972 |
|
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 |
|
2990 |
|
2991 |
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 | color_pattern: [],
|
2998 | color_tiles: undefined,
|
2999 | color_threshold: {},
|
3000 | color_onover: undefined
|
3001 | });
|
3002 | ;
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 | var interaction = ({
|
3011 | |
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 |
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 | interaction_enabled: !0,
|
3044 | interaction_brighten: !0,
|
3045 | interaction_inputType_mouse: !0,
|
3046 | interaction_inputType_touch: {}
|
3047 | });
|
3048 | ;
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 | var legend = ({
|
3057 | |
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
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 | legend_show: !0,
|
3157 | legend_hide: !1,
|
3158 | legend_contents_bindto: undefined,
|
3159 | legend_contents_template: "<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",
|
3160 | legend_position: "bottom",
|
3161 | legend_inset_anchor: "top-left",
|
3162 | legend_inset_x: 10,
|
3163 | legend_inset_y: 0,
|
3164 | legend_inset_step: undefined,
|
3165 | legend_item_onclick: undefined,
|
3166 | legend_item_onover: undefined,
|
3167 | legend_item_onout: undefined,
|
3168 | legend_equally: !1,
|
3169 | legend_padding: 0,
|
3170 | legend_item_tile_width: 10,
|
3171 | legend_item_tile_height: 10,
|
3172 | legend_item_tile_r: 5,
|
3173 | legend_item_tile_type: "rectangle",
|
3174 | legend_usePoint: !1
|
3175 | });
|
3176 | ;
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 | var title = ({
|
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 | title_text: undefined,
|
3215 | title_padding: {
|
3216 | top: 0,
|
3217 | right: 0,
|
3218 | bottom: 0,
|
3219 | left: 0
|
3220 | },
|
3221 | title_position: "center"
|
3222 | });
|
3223 | ;
|
3224 |
|
3225 | var tooltip_this = undefined;
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 | var tooltip = ({
|
3234 | |
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
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 |
|
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 |
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 |
|
3327 |
|
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 | tooltip_show: !0,
|
3426 | tooltip_doNotHide: !1,
|
3427 | tooltip_grouped: !0,
|
3428 | tooltip_format_title: undefined,
|
3429 | tooltip_format_name: undefined,
|
3430 | tooltip_format_value: undefined,
|
3431 | tooltip_position: undefined,
|
3432 | tooltip_contents: {},
|
3433 | tooltip_init_show: !1,
|
3434 | tooltip_init_x: 0,
|
3435 | tooltip_init_position: {
|
3436 | top: "0px",
|
3437 | left: "50px"
|
3438 | },
|
3439 | tooltip_linked: !1,
|
3440 | tooltip_linked_name: "",
|
3441 | tooltip_onshow: function tooltip_onshow() {
|
3442 | _newArrowCheck(this, tooltip_this);
|
3443 | }.bind(undefined),
|
3444 | tooltip_onhide: function tooltip_onhide() {
|
3445 | _newArrowCheck(this, tooltip_this);
|
3446 | }.bind(undefined),
|
3447 | tooltip_onshown: function tooltip_onshown() {
|
3448 | _newArrowCheck(this, tooltip_this);
|
3449 | }.bind(undefined),
|
3450 | tooltip_onhidden: function tooltip_onhidden() {
|
3451 | _newArrowCheck(this, tooltip_this);
|
3452 | }.bind(undefined),
|
3453 | tooltip_order: null
|
3454 | });
|
3455 | ;
|
3456 |
|
3457 |
|
3458 | function Options_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
3459 | function Options_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? Options_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Options_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 | var Options = function () {
|
3482 | Options.setOptions = function setOptions(options) {
|
3483 | var _this = this;
|
3484 | this.data = options.reduce(function (a, c) {
|
3485 | _newArrowCheck(this, _this);
|
3486 | return Options_objectSpread(Options_objectSpread({}, a), c);
|
3487 | }.bind(this), this.data);
|
3488 | };
|
3489 | function Options() {
|
3490 | return deepClone(main, boost, data, color, interaction, legend, title, tooltip, Options.data);
|
3491 | }
|
3492 | return Options;
|
3493 | }();
|
3494 | Options.data = {};
|
3495 |
|
3496 | ;
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 | var KEY = {
|
3509 | bubbleBaseLength: "$baseLength",
|
3510 | colorPattern: "__colorPattern__",
|
3511 | dataMinMax: "$dataMinMax",
|
3512 | dataTotalSum: "$dataTotalSum",
|
3513 | dataTotalPerIndex: "$totalPerIndex",
|
3514 | legendItemTextBox: "legendItemTextBox",
|
3515 | radarPoints: "$radarPoints",
|
3516 | setOverOut: "setOverOut",
|
3517 | callOverOutForTouch: "callOverOutForTouch",
|
3518 | textRect: "textRect"
|
3519 | };
|
3520 | var Cache = function () {
|
3521 | function Cache() {
|
3522 | this.cache = {};
|
3523 | }
|
3524 | var _proto = Cache.prototype;
|
3525 | |
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 | _proto.add = function add(key, value, isDataType) {
|
3534 | if (isDataType === void 0) {
|
3535 | isDataType = !1;
|
3536 | }
|
3537 | this.cache[key] = isDataType ? this.cloneTarget(value) : value;
|
3538 | return this.cache[key];
|
3539 | }
|
3540 |
|
3541 | |
3542 |
|
3543 |
|
3544 |
|
3545 | ;
|
3546 | _proto.remove = function remove(key) {
|
3547 | var _this = this;
|
3548 | toArray(key).forEach(function (v) {
|
3549 | _newArrowCheck(this, _this);
|
3550 | return delete this.cache[v];
|
3551 | }.bind(this));
|
3552 | }
|
3553 |
|
3554 | |
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 | ;
|
3561 | _proto.get = function get(key, isDataType) {
|
3562 | if (isDataType === void 0) {
|
3563 | isDataType = !1;
|
3564 | }
|
3565 | if (isDataType) {
|
3566 | var targets = [];
|
3567 | for (var i = 0, id; id = key[i]; i++) {
|
3568 | if (id in this.cache) {
|
3569 | targets.push(this.cloneTarget(this.cache[id]));
|
3570 | }
|
3571 | }
|
3572 | return targets;
|
3573 | } else {
|
3574 | var value = this.cache[key];
|
3575 | return isValue(value) ? value : null;
|
3576 | }
|
3577 | }
|
3578 |
|
3579 | |
3580 |
|
3581 |
|
3582 |
|
3583 | ;
|
3584 | _proto.reset = function reset(all) {
|
3585 | var $$ = this;
|
3586 | for (var x in $$.cache) {
|
3587 |
|
3588 | if (all || /^\$/.test(x)) {
|
3589 | $$.cache[x] = null;
|
3590 | }
|
3591 | }
|
3592 | }
|
3593 |
|
3594 | |
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 | ;
|
3602 | _proto.cloneTarget = function cloneTarget(target) {
|
3603 | var _this2 = this;
|
3604 | return {
|
3605 | id: target.id,
|
3606 | id_org: target.id_org,
|
3607 | values: target.values.map(function (d) {
|
3608 | _newArrowCheck(this, _this2);
|
3609 | return {
|
3610 | x: d.x,
|
3611 | value: d.value,
|
3612 | id: d.id
|
3613 | };
|
3614 | }.bind(this))
|
3615 | };
|
3616 | };
|
3617 | return Cache;
|
3618 | }();
|
3619 |
|
3620 | ;
|
3621 |
|
3622 |
|
3623 |
|
3624 |
|
3625 |
|
3626 |
|
3627 |
|
3628 |
|
3629 | var generator_setTimeout = win.setTimeout,
|
3630 | generator_clearTimeout = win.clearTimeout;
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 | function generateResize(option) {
|
3639 | var _this4 = this,
|
3640 | fn = [],
|
3641 | timeout,
|
3642 | callResizeFn = function () {
|
3643 | var _this = this;
|
3644 |
|
3645 | callResizeFn.clear();
|
3646 | if (option === !1 && win.requestIdleCallback) {
|
3647 | requestIdleCallback(function () {
|
3648 | var _this2 = this;
|
3649 | _newArrowCheck(this, _this);
|
3650 | fn.forEach(function (f) {
|
3651 | _newArrowCheck(this, _this2);
|
3652 | return f();
|
3653 | }.bind(this));
|
3654 | }.bind(this), {
|
3655 | timeout: 200
|
3656 | });
|
3657 | } else {
|
3658 | timeout = generator_setTimeout(function () {
|
3659 | var _this3 = this;
|
3660 | _newArrowCheck(this, _this);
|
3661 | fn.forEach(function (f) {
|
3662 | _newArrowCheck(this, _this3);
|
3663 | return f();
|
3664 | }.bind(this));
|
3665 | }.bind(this), isNumber(option) ? option : 200);
|
3666 | }
|
3667 | };
|
3668 | callResizeFn.clear = function () {
|
3669 | _newArrowCheck(this, _this4);
|
3670 | if (timeout) {
|
3671 | generator_clearTimeout(timeout);
|
3672 | timeout = null;
|
3673 | }
|
3674 | }.bind(this);
|
3675 | callResizeFn.add = function (f) {
|
3676 | _newArrowCheck(this, _this4);
|
3677 | return fn.push(f);
|
3678 | }.bind(this);
|
3679 | callResizeFn.remove = function (f) {
|
3680 | _newArrowCheck(this, _this4);
|
3681 | return fn.splice(fn.indexOf(f), 1);
|
3682 | }.bind(this);
|
3683 | return callResizeFn;
|
3684 | }
|
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 |
|
3690 | function generateWait() {
|
3691 | var transitionsToWait = [],
|
3692 | f = function (selection, callback) {
|
3693 | var _this5 = this;
|
3694 | |
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 | function loop() {
|
3700 | var done = 0;
|
3701 | for (var i = 0, t; t = transitionsToWait[i]; i++) {
|
3702 | if (t === !0 || t.empty != null && t.empty()) {
|
3703 | done++;
|
3704 | continue;
|
3705 | }
|
3706 |
|
3707 |
|
3708 | if (isTabVisible() === !1) {
|
3709 | done = transitionsToWait.length;
|
3710 | break;
|
3711 | }
|
3712 | try {
|
3713 | t.transition();
|
3714 | } catch (e) {
|
3715 | done++;
|
3716 | }
|
3717 | }
|
3718 | return done === transitionsToWait.length;
|
3719 | }
|
3720 | runUntil(function () {
|
3721 | _newArrowCheck(this, _this5);
|
3722 | callback == null ? void 0 : callback();
|
3723 | }.bind(this), loop);
|
3724 | };
|
3725 | f.add = function (t) {
|
3726 | isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
|
3727 | };
|
3728 | return f;
|
3729 | }
|
3730 | ;
|
3731 |
|
3732 |
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 | var blob = {};
|
3739 |
|
3740 |
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 | function getObjectURL(fn, depsFn) {
|
3748 | var fnString = fn.toString(),
|
3749 | key = fnString.replace(/(function|[\s\W\n])/g, "").substring(0, 15);
|
3750 | if (!(key in blob)) {
|
3751 | var _depsFn$map$join;
|
3752 |
|
3753 | blob[key] = new win.Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fnString + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
|
3754 | type: "text/javascript"
|
3755 | });
|
3756 | }
|
3757 | return win.URL.createObjectURL(blob[key]);
|
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 | function runWorker(useWorker, fn, callback, depsFn) {
|
3784 | if (useWorker === void 0) {
|
3785 | useWorker = !0;
|
3786 | }
|
3787 | var runFn;
|
3788 | if (win.Worker && useWorker) {
|
3789 | var src = getObjectURL(fn, depsFn),
|
3790 | worker = new win.Worker(src);
|
3791 | runFn = function () {
|
3792 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
3793 | args[_key] = arguments[_key];
|
3794 | }
|
3795 |
|
3796 | worker.postMessage(args);
|
3797 |
|
3798 |
|
3799 | worker.onmessage = function (e) {
|
3800 |
|
3801 | win.URL.revokeObjectURL(src);
|
3802 | return callback(e.data);
|
3803 | };
|
3804 |
|
3805 |
|
3806 | worker.onerror = function (e) {
|
3807 | console.error(e);
|
3808 | };
|
3809 |
|
3810 |
|
3811 |
|
3812 |
|
3813 |
|
3814 | };
|
3815 | } else {
|
3816 | runFn = function () {
|
3817 | var res = fn.apply(void 0, arguments);
|
3818 | callback(res);
|
3819 | };
|
3820 | }
|
3821 | return runFn;
|
3822 | }
|
3823 |
|
3824 | var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(5);
|
3825 | ;
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 | function columns(columns) {
|
3848 | var newRows = [];
|
3849 | columns.forEach(function (col, i) {
|
3850 | var key = col[0];
|
3851 | col.forEach(function (v, j) {
|
3852 | if (j > 0) {
|
3853 | if (typeof newRows[j - 1] === "undefined") {
|
3854 | newRows[j - 1] = {};
|
3855 | }
|
3856 | if (typeof v === "undefined") {
|
3857 | throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
|
3858 | }
|
3859 | newRows[j - 1][key] = v;
|
3860 | }
|
3861 | });
|
3862 | });
|
3863 | return newRows;
|
3864 | }
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 | function rows(rows) {
|
3873 | var keys = rows[0],
|
3874 | newRows = [];
|
3875 | rows.forEach(function (row, i) {
|
3876 | if (i > 0) {
|
3877 | var newRow = {};
|
3878 | row.forEach(function (v, j) {
|
3879 | if (typeof v === "undefined") {
|
3880 | throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
|
3881 | }
|
3882 | newRow[keys[j]] = v;
|
3883 | });
|
3884 | newRows.push(newRow);
|
3885 | }
|
3886 | });
|
3887 | return newRows;
|
3888 | }
|
3889 |
|
3890 |
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 | function json(json, keysParam) {
|
3897 | var newRows = [],
|
3898 | findValueInJson = function (object, path) {
|
3899 | if (object[path] !== undefined) {
|
3900 | return object[path];
|
3901 | }
|
3902 | var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"),
|
3903 | pathArray = convertedPath.replace(/^\./, "").split("."),
|
3904 | target = object;
|
3905 | pathArray.some(function (k) {
|
3906 | return !(target = target && k in target ? target[k] : undefined);
|
3907 | });
|
3908 | return target;
|
3909 | },
|
3910 | targetKeys,
|
3911 | data;
|
3912 | if (Array.isArray(json)) {
|
3913 | if (keysParam.x) {
|
3914 | targetKeys = keysParam.value.concat(keysParam.x);
|
3915 | } else {
|
3916 | targetKeys = keysParam.value;
|
3917 | }
|
3918 | newRows.push(targetKeys);
|
3919 | json.forEach(function (o) {
|
3920 | var newRow = targetKeys.map(function (key) {
|
3921 |
|
3922 | var v = findValueInJson(o, key);
|
3923 | if (typeof v === "undefined") {
|
3924 | v = null;
|
3925 | }
|
3926 | return v;
|
3927 | });
|
3928 | newRows.push(newRow);
|
3929 | });
|
3930 | data = rows(newRows);
|
3931 | } else {
|
3932 | Object.keys(json).forEach(function (key) {
|
3933 | var tmp = json[key].concat();
|
3934 | tmp.unshift(key);
|
3935 | newRows.push(tmp);
|
3936 | });
|
3937 | data = columns(newRows);
|
3938 | }
|
3939 | return data;
|
3940 | }
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 | function url(url, mimeType, headers, keys, done) {
|
3953 | if (mimeType === void 0) {
|
3954 | mimeType = "csv";
|
3955 | }
|
3956 | var req = new XMLHttpRequest(),
|
3957 | converter = {
|
3958 | csv: csv,
|
3959 | tsv: tsv,
|
3960 | json: json
|
3961 | };
|
3962 | req.open("GET", url);
|
3963 | if (headers) {
|
3964 | Object.keys(headers).forEach(function (key) {
|
3965 | req.setRequestHeader(key, headers[key]);
|
3966 | });
|
3967 | }
|
3968 | req.onreadystatechange = function () {
|
3969 | if (req.readyState === 4) {
|
3970 | if (req.status === 200) {
|
3971 | var response = req.responseText;
|
3972 | response && done.call(this, converter[mimeType](mimeType === "json" ? JSON.parse(response) : response, keys));
|
3973 | } else {
|
3974 | throw new Error(url + ": Something went wrong loading!");
|
3975 | }
|
3976 | }
|
3977 | };
|
3978 | req.send();
|
3979 | }
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 | function convertCsvTsvToData(parser, xsv) {
|
3989 | var _this = this,
|
3990 | rows = parser.rows(xsv),
|
3991 | d;
|
3992 | if (rows.length === 1) {
|
3993 | d = [{}];
|
3994 | rows[0].forEach(function (id) {
|
3995 | _newArrowCheck(this, _this);
|
3996 | d[0][id] = null;
|
3997 | }.bind(this));
|
3998 | } else {
|
3999 | d = parser.parse(xsv);
|
4000 | }
|
4001 | return d;
|
4002 | }
|
4003 | function csv(xsv) {
|
4004 | return convertCsvTsvToData({
|
4005 | rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParseRows,
|
4006 | parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParse
|
4007 | }, xsv);
|
4008 | }
|
4009 | function tsv(tsv) {
|
4010 | return convertCsvTsvToData({
|
4011 | rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParseRows,
|
4012 | parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParse
|
4013 | }, tsv);
|
4014 | }
|
4015 | ;
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 | function getDataKeyForJson(keysParam, config) {
|
4032 | var keys = keysParam || (config == null ? void 0 : config.data_keys);
|
4033 | if (keys != null && keys.x) {
|
4034 | config.data_x = keys.x;
|
4035 | }
|
4036 | return keys;
|
4037 | }
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 | var convert = ({
|
4045 | |
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 | convertData: function convertData(args, callback) {
|
4052 | var _this = this,
|
4053 | config = this.config,
|
4054 | useWorker = config.boost_useWorker,
|
4055 | data = args;
|
4056 | if (args.bindto) {
|
4057 | data = {};
|
4058 | ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) {
|
4059 | _newArrowCheck(this, _this);
|
4060 | var key = "data_" + v;
|
4061 | if (key in args) {
|
4062 | data[v] = args[key];
|
4063 | }
|
4064 | }.bind(this));
|
4065 | }
|
4066 | if (data.url && callback) {
|
4067 | url(data.url, data.mimeType, data.headers, getDataKeyForJson(data.keys, config), callback);
|
4068 | } else if (data.json) {
|
4069 | runWorker(useWorker, json, callback, [columns, rows])(data.json, getDataKeyForJson(data.keys, config));
|
4070 | } else if (data.rows) {
|
4071 | runWorker(useWorker, rows, callback)(data.rows);
|
4072 | } else if (data.columns) {
|
4073 | runWorker(useWorker, columns, callback)(data.columns);
|
4074 | } else if (args.bindto) {
|
4075 | throw Error("url or json or rows or columns is required.");
|
4076 | }
|
4077 | },
|
4078 | convertDataToTargets: function convertDataToTargets(data, appendXs) {
|
4079 | var _this2 = this,
|
4080 | $$ = this,
|
4081 | axis = $$.axis,
|
4082 | config = $$.config,
|
4083 | state = $$.state,
|
4084 | isCategorized = !1,
|
4085 | isTimeSeries = !1,
|
4086 | isCustomX = !1;
|
4087 | if (axis) {
|
4088 | isCategorized = axis.isCategorized();
|
4089 | isTimeSeries = axis.isTimeSeries();
|
4090 | isCustomX = axis.isCustomX();
|
4091 | }
|
4092 | var dataKeys = Object.keys(data[0] || {}),
|
4093 | ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [],
|
4094 | xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : [],
|
4095 | xsData;
|
4096 |
|
4097 | ids.forEach(function (id) {
|
4098 | var _this3 = this;
|
4099 | _newArrowCheck(this, _this2);
|
4100 | var xKey = this.getXKey(id);
|
4101 | if (isCustomX || isTimeSeries) {
|
4102 |
|
4103 | if (xs.indexOf(xKey) >= 0) {
|
4104 | xsData = (appendXs && $$.data.xs[id] || []).concat(data.map(function (d) {
|
4105 | _newArrowCheck(this, _this3);
|
4106 | return d[xKey];
|
4107 | }.bind(this)).filter(isValue).map(function (rawX, i) {
|
4108 | _newArrowCheck(this, _this3);
|
4109 | return $$.generateTargetX(rawX, id, i);
|
4110 | }.bind(this)));
|
4111 | } else if (config.data_x) {
|
4112 |
|
4113 | xsData = this.getOtherTargetXs();
|
4114 | } else if (notEmpty(config.data_xs)) {
|
4115 |
|
4116 | xsData = $$.getXValuesOfXKey(xKey, $$.data.targets);
|
4117 | }
|
4118 |
|
4119 | } else {
|
4120 | xsData = data.map(function (d, i) {
|
4121 | _newArrowCheck(this, _this3);
|
4122 | return i;
|
4123 | }.bind(this));
|
4124 | }
|
4125 | xsData && (this.data.xs[id] = xsData);
|
4126 | }.bind(this));
|
4127 |
|
4128 |
|
4129 | ids.forEach(function (id) {
|
4130 | _newArrowCheck(this, _this2);
|
4131 | if (!this.data.xs[id]) {
|
4132 | throw new Error("x is not defined for id = \"" + id + "\".");
|
4133 | }
|
4134 | }.bind(this));
|
4135 |
|
4136 |
|
4137 | var targets = ids.map(function (id, index) {
|
4138 | var _this4 = this;
|
4139 | _newArrowCheck(this, _this2);
|
4140 | var convertedId = config.data_idConverter.bind($$.api)(id),
|
4141 | xKey = $$.getXKey(id),
|
4142 | isCategory = isCustomX && isCategorized,
|
4143 | hasCategory = isCategory && data.map(function (v) {
|
4144 | _newArrowCheck(this, _this4);
|
4145 | return v.x;
|
4146 | }.bind(this)).every(function (v) {
|
4147 | _newArrowCheck(this, _this4);
|
4148 | return config.axis_x_categories.indexOf(v) > -1;
|
4149 | }.bind(this)),
|
4150 | isDataAppend = data.__append__,
|
4151 | xIndex = xKey === null && isDataAppend ? $$.api.data.values(id).length : 0;
|
4152 | return {
|
4153 | id: convertedId,
|
4154 | id_org: id,
|
4155 | values: data.map(function (d, i) {
|
4156 | _newArrowCheck(this, _this4);
|
4157 | var rawX = d[xKey],
|
4158 | value = d[id],
|
4159 | x;
|
4160 | value = value !== null && !isNaN(value) && !isObject(value) ? +value : isArray(value) || isObject(value) ? value : null;
|
4161 |
|
4162 |
|
4163 | if ((isCategory || state.hasRadar) && index === 0 && !isUndefined(rawX)) {
|
4164 | if (!hasCategory && index === 0 && i === 0 && !isDataAppend) {
|
4165 | config.axis_x_categories = [];
|
4166 | }
|
4167 | x = config.axis_x_categories.indexOf(rawX);
|
4168 | if (x === -1) {
|
4169 | x = config.axis_x_categories.length;
|
4170 | config.axis_x_categories.push(rawX);
|
4171 | }
|
4172 | } else {
|
4173 | x = $$.generateTargetX(rawX, id, xIndex + i);
|
4174 | }
|
4175 |
|
4176 |
|
4177 | if (isUndefined(value) || $$.data.xs[id].length <= i) {
|
4178 | x = undefined;
|
4179 | }
|
4180 | return {
|
4181 | x: x,
|
4182 | value: value,
|
4183 | id: convertedId,
|
4184 | index: -1
|
4185 | };
|
4186 | }.bind(this)).filter(function (v) {
|
4187 | _newArrowCheck(this, _this4);
|
4188 | return isDefined(v.x);
|
4189 | }.bind(this))
|
4190 | };
|
4191 | }.bind(this));
|
4192 |
|
4193 |
|
4194 | targets.forEach(function (t) {
|
4195 | var _this5 = this,
|
4196 | _$$$data$xs$t$id;
|
4197 | _newArrowCheck(this, _this2);
|
4198 |
|
4199 | if (config.data_xSort) {
|
4200 | t.values = t.values.sort(function (v1, v2) {
|
4201 | _newArrowCheck(this, _this5);
|
4202 | var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
|
4203 | x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
|
4204 | return x1 - x2;
|
4205 | }.bind(this));
|
4206 | }
|
4207 |
|
4208 |
|
4209 | t.values.forEach(function (v, i) {
|
4210 | _newArrowCheck(this, _this5);
|
4211 | return v.index = i;
|
4212 | }.bind(this));
|
4213 |
|
4214 |
|
4215 | (_$$$data$xs$t$id = $$.data.xs[t.id]) == null ? void 0 : _$$$data$xs$t$id.sort(function (v1, v2) {
|
4216 | _newArrowCheck(this, _this5);
|
4217 | return v1 - v2;
|
4218 | }.bind(this));
|
4219 | }.bind(this));
|
4220 |
|
4221 |
|
4222 | state.hasNegativeValue = $$.hasNegativeValueInTargets(targets);
|
4223 | state.hasPositiveValue = $$.hasPositiveValueInTargets(targets);
|
4224 |
|
4225 |
|
4226 | if (config.data_type) {
|
4227 | $$.setTargetType($$.mapToIds(targets).filter(function (id) {
|
4228 | _newArrowCheck(this, _this2);
|
4229 | return !(id in config.data_types);
|
4230 | }.bind(this)), config.data_type);
|
4231 | }
|
4232 |
|
4233 |
|
4234 | targets.forEach(function (d) {
|
4235 | _newArrowCheck(this, _this2);
|
4236 | return $$.cache.add(d.id_org, d, !0);
|
4237 | }.bind(this));
|
4238 | return targets;
|
4239 | }
|
4240 | });
|
4241 | ;
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 | var data_data = ({
|
4251 | isX: function isX(key) {
|
4252 | var $$ = this,
|
4253 | config = $$.config,
|
4254 | dataKey = config.data_x && key === config.data_x,
|
4255 | existValue = notEmpty(config.data_xs) && hasValue(config.data_xs, key);
|
4256 | return dataKey || existValue;
|
4257 | },
|
4258 | isNotX: function isNotX(key) {
|
4259 | return !this.isX(key);
|
4260 | },
|
4261 | isStackNormalized: function isStackNormalized() {
|
4262 | var config = this.config;
|
4263 | return !!(config.data_stack_normalize && config.data_groups.length);
|
4264 | },
|
4265 | isGrouped: function isGrouped(id) {
|
4266 | var _this = this,
|
4267 | groups = this.config.data_groups;
|
4268 | return id ? groups.some(function (v) {
|
4269 | _newArrowCheck(this, _this);
|
4270 | return v.indexOf(id) >= 0 && v.length > 1;
|
4271 | }.bind(this)) : groups.length > 0;
|
4272 | },
|
4273 | getXKey: function getXKey(id) {
|
4274 | var $$ = this,
|
4275 | config = $$.config;
|
4276 | return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;
|
4277 | },
|
4278 | getXValuesOfXKey: function getXValuesOfXKey(key, targets) {
|
4279 | var _this2 = this,
|
4280 | $$ = this,
|
4281 | ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [],
|
4282 | xValues;
|
4283 | ids.forEach(function (id) {
|
4284 | _newArrowCheck(this, _this2);
|
4285 | if ($$.getXKey(id) === key) {
|
4286 | xValues = $$.data.xs[id];
|
4287 | }
|
4288 | }.bind(this));
|
4289 | return xValues;
|
4290 | },
|
4291 | |
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 | getIndexByX: function getIndexByX(x, basedX) {
|
4299 | var $$ = this;
|
4300 | return basedX ? basedX.indexOf(isString(x) ? x : +x) : ($$.filterByX($$.data.targets, x)[0] || {
|
4301 | index: null
|
4302 | }).index;
|
4303 | },
|
4304 | getXValue: function getXValue(id, i) {
|
4305 | var $$ = this;
|
4306 | return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;
|
4307 | },
|
4308 | getOtherTargetXs: function getOtherTargetXs() {
|
4309 | var $$ = this,
|
4310 | idsForX = Object.keys($$.data.xs);
|
4311 | return idsForX.length ? $$.data.xs[idsForX[0]] : null;
|
4312 | },
|
4313 | getOtherTargetX: function getOtherTargetX(index) {
|
4314 | var xs = this.getOtherTargetXs();
|
4315 | return xs && index < xs.length ? xs[index] : null;
|
4316 | },
|
4317 | addXs: function addXs(xs) {
|
4318 | var _this3 = this,
|
4319 | $$ = this,
|
4320 | config = $$.config;
|
4321 | Object.keys(xs).forEach(function (id) {
|
4322 | _newArrowCheck(this, _this3);
|
4323 | config.data_xs[id] = xs[id];
|
4324 | }.bind(this));
|
4325 | },
|
4326 | isMultipleX: function isMultipleX() {
|
4327 | return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType("bubble") || this.hasType("scatter");
|
4328 | },
|
4329 | addName: function addName(data) {
|
4330 | var $$ = this,
|
4331 | config = $$.config,
|
4332 | name;
|
4333 | if (data) {
|
4334 | name = config.data_names[data.id];
|
4335 | data.name = name !== undefined ? name : data.id;
|
4336 | }
|
4337 | return data;
|
4338 | },
|
4339 | |
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 | getAllValuesOnIndex: function getAllValuesOnIndex(index, filterNull) {
|
4347 | var _this4 = this;
|
4348 | if (filterNull === void 0) {
|
4349 | filterNull = !1;
|
4350 | }
|
4351 | var $$ = this,
|
4352 | value = $$.filterTargetsToShow($$.data.targets).map(function (t) {
|
4353 | _newArrowCheck(this, _this4);
|
4354 | return $$.addName($$.getValueOnIndex(t.values, index));
|
4355 | }.bind(this));
|
4356 | if (filterNull) {
|
4357 | value = value.filter(function (v) {
|
4358 | _newArrowCheck(this, _this4);
|
4359 | return v && "value" in v && isValue(v.value);
|
4360 | }.bind(this));
|
4361 | }
|
4362 | return value;
|
4363 | },
|
4364 | getValueOnIndex: function getValueOnIndex(values, index) {
|
4365 | var _this5 = this,
|
4366 | valueOnIndex = values.filter(function (v) {
|
4367 | _newArrowCheck(this, _this5);
|
4368 | return v.index === index;
|
4369 | }.bind(this));
|
4370 | return valueOnIndex.length ? valueOnIndex[0] : null;
|
4371 | },
|
4372 | updateTargetX: function updateTargetX(targets, x) {
|
4373 | var _this6 = this,
|
4374 | $$ = this;
|
4375 | targets.forEach(function (t) {
|
4376 | var _this7 = this;
|
4377 | _newArrowCheck(this, _this6);
|
4378 | t.values.forEach(function (v, i) {
|
4379 | _newArrowCheck(this, _this7);
|
4380 | v.x = $$.generateTargetX(x[i], t.id, i);
|
4381 | }.bind(this));
|
4382 | $$.data.xs[t.id] = x;
|
4383 | }.bind(this));
|
4384 | },
|
4385 | updateTargetXs: function updateTargetXs(targets, xs) {
|
4386 | var _this8 = this,
|
4387 | $$ = this;
|
4388 | targets.forEach(function (t) {
|
4389 | _newArrowCheck(this, _this8);
|
4390 | xs[t.id] && $$.updateTargetX([t], xs[t.id]);
|
4391 | }.bind(this));
|
4392 | },
|
4393 | generateTargetX: function generateTargetX(rawX, id, index) {
|
4394 | var $$ = this,
|
4395 | axis = $$.axis,
|
4396 | x = axis != null && axis.isCategorized() ? index : rawX || index;
|
4397 | if (axis != null && axis.isTimeSeries()) {
|
4398 | var fn = parseDate.bind($$);
|
4399 | x = rawX ? fn(rawX) : fn($$.getXValue(id, index));
|
4400 | } else if (axis != null && axis.isCustomX() && !(axis != null && axis.isCategorized())) {
|
4401 | x = isValue(rawX) ? +rawX : $$.getXValue(id, index);
|
4402 | }
|
4403 | return x;
|
4404 | },
|
4405 | updateXs: function updateXs(values) {
|
4406 | var _this9 = this;
|
4407 | if (values.length) {
|
4408 | this.axis.xs = values.map(function (v) {
|
4409 | _newArrowCheck(this, _this9);
|
4410 | return v.x;
|
4411 | }.bind(this));
|
4412 | }
|
4413 | },
|
4414 | getPrevX: function getPrevX(i) {
|
4415 | var x = this.axis.xs[i - 1];
|
4416 | return isDefined(x) ? x : null;
|
4417 | },
|
4418 | getNextX: function getNextX(i) {
|
4419 | var x = this.axis.xs[i + 1];
|
4420 | return isDefined(x) ? x : null;
|
4421 | },
|
4422 | |
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 | getBaseValue: function getBaseValue(data) {
|
4429 | var $$ = this,
|
4430 | hasAxis = $$.state.hasAxis,
|
4431 | value = data.value;
|
4432 |
|
4433 |
|
4434 | if (value && hasAxis) {
|
4435 | if ($$.isAreaRangeType(data)) {
|
4436 | value = $$.getRangedData(data, "mid");
|
4437 | } else if ($$.isBubbleZType(data)) {
|
4438 | value = $$.getBubbleZData(value, "y");
|
4439 | }
|
4440 | }
|
4441 | return value;
|
4442 | },
|
4443 | |
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 | getMinMaxValue: function getMinMaxValue(data) {
|
4450 | var _this10 = this,
|
4451 | getBaseValue = this.getBaseValue.bind(this),
|
4452 | min,
|
4453 | max;
|
4454 | (data || this.data.targets.map(function (t) {
|
4455 | _newArrowCheck(this, _this10);
|
4456 | return t.values;
|
4457 | }.bind(this))).forEach(function (v, i) {
|
4458 | _newArrowCheck(this, _this10);
|
4459 | var value = v.map(getBaseValue).filter(isNumber);
|
4460 | min = Math.min.apply(Math, [i ? min : Infinity].concat(value));
|
4461 | max = Math.max.apply(Math, [i ? max : -Infinity].concat(value));
|
4462 | }.bind(this));
|
4463 | return {
|
4464 | min: min,
|
4465 | max: max
|
4466 | };
|
4467 | },
|
4468 | |
4469 |
|
4470 |
|
4471 |
|
4472 |
|
4473 | getMinMaxData: function getMinMaxData() {
|
4474 | var _this11 = this,
|
4475 | $$ = this,
|
4476 | cacheKey = KEY.dataMinMax,
|
4477 | minMaxData = $$.cache.get(cacheKey);
|
4478 | if (!minMaxData) {
|
4479 | var data = $$.data.targets.map(function (t) {
|
4480 | _newArrowCheck(this, _this11);
|
4481 | return t.values;
|
4482 | }.bind(this)),
|
4483 | minMax = $$.getMinMaxValue(data),
|
4484 | _min = [],
|
4485 | _max = [];
|
4486 | data.forEach(function (v) {
|
4487 | _newArrowCheck(this, _this11);
|
4488 | var minData = $$.getFilteredDataByValue(v, minMax.min),
|
4489 | maxData = $$.getFilteredDataByValue(v, minMax.max);
|
4490 | if (minData.length) {
|
4491 | _min = _min.concat(minData);
|
4492 | }
|
4493 | if (maxData.length) {
|
4494 | _max = _max.concat(maxData);
|
4495 | }
|
4496 | }.bind(this));
|
4497 |
|
4498 |
|
4499 | $$.cache.add(cacheKey, minMaxData = {
|
4500 | min: _min,
|
4501 | max: _max
|
4502 | });
|
4503 | }
|
4504 | return minMaxData;
|
4505 | },
|
4506 | |
4507 |
|
4508 |
|
4509 |
|
4510 |
|
4511 | getTotalPerIndex: function getTotalPerIndex() {
|
4512 | var _this12 = this,
|
4513 | $$ = this,
|
4514 | cacheKey = KEY.dataTotalPerIndex,
|
4515 | sum = $$.cache.get(cacheKey);
|
4516 | if ($$.isStackNormalized() && !sum) {
|
4517 | sum = [];
|
4518 | $$.data.targets.forEach(function (row) {
|
4519 | var _this13 = this;
|
4520 | _newArrowCheck(this, _this12);
|
4521 | row.values.forEach(function (v, i) {
|
4522 | _newArrowCheck(this, _this13);
|
4523 | if (!sum[i]) {
|
4524 | sum[i] = 0;
|
4525 | }
|
4526 | sum[i] += isNumber(v.value) ? v.value : 0;
|
4527 | }.bind(this));
|
4528 | }.bind(this));
|
4529 | }
|
4530 | return sum;
|
4531 | },
|
4532 | |
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 | getTotalDataSum: function getTotalDataSum(subtractHidden) {
|
4539 | var _this14 = this,
|
4540 | $$ = this,
|
4541 | cacheKey = KEY.dataTotalSum,
|
4542 | total = $$.cache.get(cacheKey);
|
4543 | if (!isNumber(total)) {
|
4544 | var _sum = mergeArray($$.data.targets.map(function (t) {
|
4545 | _newArrowCheck(this, _this14);
|
4546 | return t.values;
|
4547 | }.bind(this))).map(function (v) {
|
4548 | _newArrowCheck(this, _this14);
|
4549 | return v.value;
|
4550 | }.bind(this)).reduce(function (p, c) {
|
4551 | _newArrowCheck(this, _this14);
|
4552 | return p + c;
|
4553 | }.bind(this));
|
4554 | $$.cache.add(cacheKey, total = _sum);
|
4555 | }
|
4556 | if (subtractHidden) {
|
4557 | total -= $$.getHiddenTotalDataSum();
|
4558 | }
|
4559 | return total;
|
4560 | },
|
4561 | |
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 | getHiddenTotalDataSum: function getHiddenTotalDataSum() {
|
4567 | var _this15 = this,
|
4568 | $$ = this,
|
4569 | api = $$.api,
|
4570 | hiddenTargetIds = $$.state.hiddenTargetIds,
|
4571 | total = 0;
|
4572 | if (hiddenTargetIds.length) {
|
4573 | total = api.data.values.bind(api)(hiddenTargetIds).reduce(function (p, c) {
|
4574 | _newArrowCheck(this, _this15);
|
4575 | return p + c;
|
4576 | }.bind(this));
|
4577 | }
|
4578 | return total;
|
4579 | },
|
4580 | |
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 | getFilteredDataByValue: function getFilteredDataByValue(data, value) {
|
4588 | var _this16 = this;
|
4589 | return data.filter(function (t) {
|
4590 | _newArrowCheck(this, _this16);
|
4591 | return this.getBaseValue(t) === value;
|
4592 | }.bind(this));
|
4593 | },
|
4594 | |
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 | getMaxDataCount: function getMaxDataCount() {
|
4600 | var _this17 = this;
|
4601 | return Math.max.apply(Math, this.data.targets.map(function (t) {
|
4602 | _newArrowCheck(this, _this17);
|
4603 | return t.values.length;
|
4604 | }.bind(this)));
|
4605 | },
|
4606 | getMaxDataCountTarget: function getMaxDataCountTarget() {
|
4607 | var _this18 = this,
|
4608 | target = this.filterTargetsToShow() || [],
|
4609 | length = target.length;
|
4610 | if (length > 1) {
|
4611 | target = target.map(function (t) {
|
4612 | _newArrowCheck(this, _this18);
|
4613 | return t.values;
|
4614 | }.bind(this)).reduce(function (a, b) {
|
4615 | _newArrowCheck(this, _this18);
|
4616 | return a.concat(b);
|
4617 | }.bind(this)).map(function (v) {
|
4618 | _newArrowCheck(this, _this18);
|
4619 | return v.x;
|
4620 | }.bind(this));
|
4621 | target = sortValue(getUnique(target)).map(function (x, index) {
|
4622 | _newArrowCheck(this, _this18);
|
4623 | return {
|
4624 | x: x,
|
4625 | index: index
|
4626 | };
|
4627 | }.bind(this));
|
4628 | } else if (length) {
|
4629 | target = target[0].values;
|
4630 | }
|
4631 | return target;
|
4632 | },
|
4633 | mapToIds: function mapToIds(targets) {
|
4634 | var _this19 = this;
|
4635 | return targets.map(function (d) {
|
4636 | _newArrowCheck(this, _this19);
|
4637 | return d.id;
|
4638 | }.bind(this));
|
4639 | },
|
4640 | mapToTargetIds: function mapToTargetIds(ids) {
|
4641 | var $$ = this;
|
4642 | return ids ? isArray(ids) ? ids.concat() : [ids] : $$.mapToIds($$.data.targets);
|
4643 | },
|
4644 | hasTarget: function hasTarget(targets, id) {
|
4645 | var ids = this.mapToIds(targets);
|
4646 | for (var i = 0, val; val = ids[i]; i++) {
|
4647 | if (val === id) {
|
4648 | return !0;
|
4649 | }
|
4650 | }
|
4651 | return !1;
|
4652 | },
|
4653 | isTargetToShow: function isTargetToShow(targetId) {
|
4654 | return this.state.hiddenTargetIds.indexOf(targetId) < 0;
|
4655 | },
|
4656 | isLegendToShow: function isLegendToShow(targetId) {
|
4657 | return this.state.hiddenLegendIds.indexOf(targetId) < 0;
|
4658 | },
|
4659 | filterTargetsToShow: function filterTargetsToShow(targets) {
|
4660 | var _this20 = this,
|
4661 | $$ = this;
|
4662 | return (targets || $$.data.targets).filter(function (t) {
|
4663 | _newArrowCheck(this, _this20);
|
4664 | return $$.isTargetToShow(t.id);
|
4665 | }.bind(this));
|
4666 | },
|
4667 | mapTargetsToUniqueXs: function mapTargetsToUniqueXs(targets) {
|
4668 | var _this21 = this,
|
4669 | $$ = this,
|
4670 | axis = $$.axis,
|
4671 | xs = [];
|
4672 | if (targets != null && targets.length) {
|
4673 | xs = getUnique(mergeArray(targets.map(function (t) {
|
4674 | var _this22 = this;
|
4675 | _newArrowCheck(this, _this21);
|
4676 | return t.values.map(function (v) {
|
4677 | _newArrowCheck(this, _this22);
|
4678 | return +v.x;
|
4679 | }.bind(this));
|
4680 | }.bind(this))));
|
4681 | xs = axis != null && axis.isTimeSeries() ? xs.map(function (x) {
|
4682 | _newArrowCheck(this, _this21);
|
4683 | return new Date(+x);
|
4684 | }.bind(this)) : xs.map(Number);
|
4685 | }
|
4686 | return sortValue(xs);
|
4687 | },
|
4688 | |
4689 |
|
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 | addTargetIds: function addTargetIds(type, targetIds) {
|
4695 | var _this23 = this,
|
4696 | state = this.state,
|
4697 | ids = isArray(targetIds) ? targetIds : [targetIds];
|
4698 | ids.forEach(function (v) {
|
4699 | _newArrowCheck(this, _this23);
|
4700 | state[type].indexOf(v) < 0 && state[type].push(v);
|
4701 | }.bind(this));
|
4702 | },
|
4703 | |
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 | removeTargetIds: function removeTargetIds(type, targetIds) {
|
4710 | var _this24 = this,
|
4711 | state = this.state,
|
4712 | ids = isArray(targetIds) ? targetIds : [targetIds];
|
4713 | ids.forEach(function (v) {
|
4714 | _newArrowCheck(this, _this24);
|
4715 | var index = state[type].indexOf(v);
|
4716 | index >= 0 && state[type].splice(index, 1);
|
4717 | }.bind(this));
|
4718 | },
|
4719 | addHiddenTargetIds: function addHiddenTargetIds(targetIds) {
|
4720 | this.addTargetIds("hiddenTargetIds", targetIds);
|
4721 | },
|
4722 | removeHiddenTargetIds: function removeHiddenTargetIds(targetIds) {
|
4723 | this.removeTargetIds("hiddenTargetIds", targetIds);
|
4724 | },
|
4725 | addHiddenLegendIds: function addHiddenLegendIds(targetIds) {
|
4726 | this.addTargetIds("hiddenLegendIds", targetIds);
|
4727 | },
|
4728 | removeHiddenLegendIds: function removeHiddenLegendIds(targetIds) {
|
4729 | this.removeTargetIds("hiddenLegendIds", targetIds);
|
4730 | },
|
4731 | getValuesAsIdKeyed: function getValuesAsIdKeyed(targets) {
|
4732 | var _this25 = this,
|
4733 | $$ = this,
|
4734 | hasAxis = $$.state.hasAxis,
|
4735 | ys = {},
|
4736 | isMultipleX = $$.isMultipleX(),
|
4737 | xs = isMultipleX ? $$.mapTargetsToUniqueXs(targets).map(function (v) {
|
4738 | _newArrowCheck(this, _this25);
|
4739 | return isString(v) ? v : +v;
|
4740 | }.bind(this)) : null;
|
4741 | targets.forEach(function (t) {
|
4742 | var _this26 = this;
|
4743 | _newArrowCheck(this, _this25);
|
4744 | var data = [];
|
4745 | t.values.filter(function (_ref) {
|
4746 | var value = _ref.value;
|
4747 | _newArrowCheck(this, _this26);
|
4748 | return isValue(value) || value === null;
|
4749 | }.bind(this)).forEach(function (v) {
|
4750 | _newArrowCheck(this, _this26);
|
4751 | var value = v.value;
|
4752 |
|
4753 |
|
4754 | if (value !== null && $$.isCandlestickType(v)) {
|
4755 | value = isArray(value) ? value.slice(0, 4) : [value.open, value.high, value.low, value.close];
|
4756 | }
|
4757 | if (isArray(value)) {
|
4758 | data.push.apply(data, value);
|
4759 | } else if (isObject(value) && "high" in value) {
|
4760 | data.push.apply(data, Object.values(value));
|
4761 | } else if ($$.isBubbleZType(v)) {
|
4762 | data.push(hasAxis && $$.getBubbleZData(value, "y"));
|
4763 | } else {
|
4764 | if (isMultipleX) {
|
4765 | data[$$.getIndexByX(v.x, xs)] = value;
|
4766 | } else {
|
4767 | data.push(value);
|
4768 | }
|
4769 | }
|
4770 | }.bind(this));
|
4771 | ys[t.id] = data;
|
4772 | }.bind(this));
|
4773 | return ys;
|
4774 | },
|
4775 | checkValueInTargets: function checkValueInTargets(targets, checker) {
|
4776 | var ids = Object.keys(targets),
|
4777 | values;
|
4778 | for (var i = 0; i < ids.length; i++) {
|
4779 | values = targets[ids[i]].values;
|
4780 | for (var j = 0; j < values.length; j++) {
|
4781 | if (checker(values[j].value)) {
|
4782 | return !0;
|
4783 | }
|
4784 | }
|
4785 | }
|
4786 | return !1;
|
4787 | },
|
4788 | hasMultiTargets: function hasMultiTargets() {
|
4789 | return this.filterTargetsToShow().length > 1;
|
4790 | },
|
4791 | hasNegativeValueInTargets: function hasNegativeValueInTargets(targets) {
|
4792 | var _this27 = this;
|
4793 | return this.checkValueInTargets(targets, function (v) {
|
4794 | _newArrowCheck(this, _this27);
|
4795 | return v < 0;
|
4796 | }.bind(this));
|
4797 | },
|
4798 | hasPositiveValueInTargets: function hasPositiveValueInTargets(targets) {
|
4799 | var _this28 = this;
|
4800 | return this.checkValueInTargets(targets, function (v) {
|
4801 | _newArrowCheck(this, _this28);
|
4802 | return v > 0;
|
4803 | }.bind(this));
|
4804 | },
|
4805 | |
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 |
|
4811 |
|
4812 | orderTargets: function orderTargets(targetsValue) {
|
4813 | var $$ = this,
|
4814 | targets = [].concat(targetsValue),
|
4815 | fn = $$.getSortCompareFn();
|
4816 | fn && targets.sort(fn);
|
4817 | return targets;
|
4818 | },
|
4819 | |
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 | getSortCompareFn: function getSortCompareFn(isArc) {
|
4826 | var _this29 = this;
|
4827 | if (isArc === void 0) {
|
4828 | isArc = !1;
|
4829 | }
|
4830 | var $$ = this,
|
4831 | config = $$.config,
|
4832 | order = config.data_order,
|
4833 | orderAsc = /asc/i.test(order),
|
4834 | orderDesc = /desc/i.test(order),
|
4835 | fn;
|
4836 | if (orderAsc || orderDesc) {
|
4837 | var reducer = function (p, c) {
|
4838 | _newArrowCheck(this, _this29);
|
4839 | return p + Math.abs(c.value);
|
4840 | }.bind(this);
|
4841 | fn = function (t1, t2) {
|
4842 | _newArrowCheck(this, _this29);
|
4843 | var t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value,
|
4844 | t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value;
|
4845 | return isArc ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
4846 | }.bind(this);
|
4847 | } else if (isFunction(order)) {
|
4848 | fn = order.bind($$.api);
|
4849 | }
|
4850 | return fn || null;
|
4851 | },
|
4852 | filterByX: function filterByX(targets, x) {
|
4853 | var _this30 = this;
|
4854 | return mergeArray(targets.map(function (t) {
|
4855 | _newArrowCheck(this, _this30);
|
4856 | return t.values;
|
4857 | }.bind(this))).filter(function (v) {
|
4858 | _newArrowCheck(this, _this30);
|
4859 | return v.x - x === 0;
|
4860 | }.bind(this));
|
4861 | },
|
4862 | filterRemoveNull: function filterRemoveNull(data) {
|
4863 | var _this31 = this;
|
4864 | return data.filter(function (d) {
|
4865 | _newArrowCheck(this, _this31);
|
4866 | return isValue(this.getBaseValue(d));
|
4867 | }.bind(this));
|
4868 | },
|
4869 | filterByXDomain: function filterByXDomain(targets, xDomain) {
|
4870 | var _this32 = this;
|
4871 | return targets.map(function (t) {
|
4872 | var _this33 = this;
|
4873 | _newArrowCheck(this, _this32);
|
4874 | return {
|
4875 | id: t.id,
|
4876 | id_org: t.id_org,
|
4877 | values: t.values.filter(function (v) {
|
4878 | _newArrowCheck(this, _this33);
|
4879 | return xDomain[0] <= v.x && v.x <= xDomain[1];
|
4880 | }.bind(this))
|
4881 | };
|
4882 | }.bind(this));
|
4883 | },
|
4884 | hasDataLabel: function hasDataLabel() {
|
4885 | var dataLabels = this.config.data_labels;
|
4886 | return isboolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels);
|
4887 | },
|
4888 | |
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 | getDataIndexFromEvent: function getDataIndexFromEvent(event) {
|
4894 | var $$ = this,
|
4895 | config = $$.config,
|
4896 | _$$$state = $$.state,
|
4897 | inputType = _$$$state.inputType,
|
4898 | _$$$state$eventReceiv = _$$$state.eventReceiver,
|
4899 | coords = _$$$state$eventReceiv.coords,
|
4900 | rect = _$$$state$eventReceiv.rect,
|
4901 | isRotated = config.axis_rotated,
|
4902 | e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event,
|
4903 | index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
|
4904 | return index;
|
4905 | },
|
4906 | getDataLabelLength: function getDataLabelLength(min, max, key) {
|
4907 | var _this34 = this,
|
4908 | $$ = this,
|
4909 | lengths = [0, 0];
|
4910 | $$.$el.chart.select("svg").selectAll(".dummy").data([min, max]).enter().append("text").text(function (d) {
|
4911 | _newArrowCheck(this, _this34);
|
4912 | return $$.dataLabelFormat(d.id)(d);
|
4913 | }.bind(this)).each(function (d, i) {
|
4914 | lengths[i] = this.getBoundingClientRect()[key] * 1.3;
|
4915 | }).remove();
|
4916 | return lengths;
|
4917 | },
|
4918 | isNoneArc: function isNoneArc(d) {
|
4919 | return this.hasTarget(this.data.targets, d.id);
|
4920 | },
|
4921 | isArc: function isArc(d) {
|
4922 | return "data" in d && this.hasTarget(this.data.targets, d.data.id);
|
4923 | },
|
4924 | findSameXOfValues: function findSameXOfValues(values, index) {
|
4925 | var targetX = values[index].x,
|
4926 | sames = [],
|
4927 | i;
|
4928 | for (i = index - 1; i >= 0; i--) {
|
4929 | if (targetX !== values[i].x) {
|
4930 | break;
|
4931 | }
|
4932 | sames.push(values[i]);
|
4933 | }
|
4934 | for (i = index; i < values.length; i++) {
|
4935 | if (targetX !== values[i].x) {
|
4936 | break;
|
4937 | }
|
4938 | sames.push(values[i]);
|
4939 | }
|
4940 | return sames;
|
4941 | },
|
4942 | findClosestFromTargets: function findClosestFromTargets(targets, pos) {
|
4943 | var _this35 = this,
|
4944 | $$ = this,
|
4945 | candidates = targets.map(function (target) {
|
4946 | _newArrowCheck(this, _this35);
|
4947 | return $$.findClosest(target.values, pos);
|
4948 | }.bind(this));
|
4949 |
|
4950 |
|
4951 |
|
4952 | return $$.findClosest(candidates, pos);
|
4953 | },
|
4954 | findClosest: function findClosest(values, pos) {
|
4955 | var _this36 = this,
|
4956 | $$ = this,
|
4957 | config = $$.config,
|
4958 | main = $$.$el.main,
|
4959 | data = values.filter(function (v) {
|
4960 | _newArrowCheck(this, _this36);
|
4961 | return v && isValue(v.value);
|
4962 | }.bind(this)),
|
4963 | minDist = config.point_sensitivity,
|
4964 | closest;
|
4965 |
|
4966 |
|
4967 | data.filter(function (v) {
|
4968 | _newArrowCheck(this, _this36);
|
4969 | return $$.isBarType(v.id) || $$.isCandlestickType(v.id);
|
4970 | }.bind(this)).forEach(function (v) {
|
4971 | _newArrowCheck(this, _this36);
|
4972 | var selector = $$.isBarType(v.id) ? "." + $BAR.chartBar + "." + $COMMON.target + $$.getTargetSelectorSuffix(v.id) + " ." + $BAR.bar + "-" + v.index : "." + $CANDLESTICK.chartCandlestick + "." + $COMMON.target + $$.getTargetSelectorSuffix(v.id) + " ." + $CANDLESTICK.candlestick + "-" + v.index + " path";
|
4973 | if (!closest && $$.isWithinBar(main.select(selector).node())) {
|
4974 | closest = v;
|
4975 | }
|
4976 | }.bind(this));
|
4977 |
|
4978 |
|
4979 | data.filter(function (v) {
|
4980 | _newArrowCheck(this, _this36);
|
4981 | return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id);
|
4982 | }.bind(this)).forEach(function (v) {
|
4983 | _newArrowCheck(this, _this36);
|
4984 | var d = $$.dist(v, pos);
|
4985 | if (d < minDist) {
|
4986 | minDist = d;
|
4987 | closest = v;
|
4988 | }
|
4989 | }.bind(this));
|
4990 | return closest;
|
4991 | },
|
4992 | dist: function dist(data, pos) {
|
4993 | var $$ = this,
|
4994 | isRotated = $$.config.axis_rotated,
|
4995 | scale = $$.scale,
|
4996 | xIndex = isRotated ? 1 : 0,
|
4997 | yIndex = isRotated ? 0 : 1,
|
4998 | y = $$.circleY(data, data.index),
|
4999 | x = (scale.zoom || scale.x)(data.x);
|
5000 | return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));
|
5001 | },
|
5002 | |
5003 |
|
5004 |
|
5005 |
|
5006 |
|
5007 |
|
5008 | convertValuesToStep: function convertValuesToStep(values) {
|
5009 | var $$ = this,
|
5010 | axis = $$.axis,
|
5011 | config = $$.config,
|
5012 | stepType = config.line_step_type,
|
5013 | isCategorized = axis ? axis.isCategorized() : !1,
|
5014 | converted = isArray(values) ? values.concat() : [values];
|
5015 | if (!(isCategorized || /step\-(after|before)/.test(stepType))) {
|
5016 | return values;
|
5017 | }
|
5018 |
|
5019 |
|
5020 | var head = converted[0],
|
5021 | tail = converted[converted.length - 1],
|
5022 | id = head.id,
|
5023 | x = head.x;
|
5024 |
|
5025 | converted.unshift({
|
5026 | x: --x,
|
5027 | value: head.value,
|
5028 | id: id
|
5029 | });
|
5030 | isCategorized && stepType === "step-after" && converted.unshift({
|
5031 | x: --x,
|
5032 | value: head.value,
|
5033 | id: id
|
5034 | });
|
5035 |
|
5036 |
|
5037 | x = tail.x;
|
5038 | converted.push({
|
5039 | x: ++x,
|
5040 | value: tail.value,
|
5041 | id: id
|
5042 | });
|
5043 | isCategorized && stepType === "step-before" && converted.push({
|
5044 | x: ++x,
|
5045 | value: tail.value,
|
5046 | id: id
|
5047 | });
|
5048 | return converted;
|
5049 | },
|
5050 | convertValuesToRange: function convertValuesToRange(values) {
|
5051 | var _this37 = this,
|
5052 | converted = isArray(values) ? values.concat() : [values],
|
5053 | ranges = [];
|
5054 | converted.forEach(function (range) {
|
5055 | _newArrowCheck(this, _this37);
|
5056 | var x = range.x,
|
5057 | id = range.id;
|
5058 | ranges.push({
|
5059 | x: x,
|
5060 | id: id,
|
5061 | value: range.value[0]
|
5062 | });
|
5063 | ranges.push({
|
5064 | x: x,
|
5065 | id: id,
|
5066 | value: range.value[2]
|
5067 | });
|
5068 | }.bind(this));
|
5069 | return ranges;
|
5070 | },
|
5071 | updateDataAttributes: function updateDataAttributes(name, attrs) {
|
5072 | var _this38 = this,
|
5073 | $$ = this,
|
5074 | config = $$.config,
|
5075 | current = config["data_" + name];
|
5076 | if (isUndefined(attrs)) {
|
5077 | return current;
|
5078 | }
|
5079 | Object.keys(attrs).forEach(function (id) {
|
5080 | _newArrowCheck(this, _this38);
|
5081 | current[id] = attrs[id];
|
5082 | }.bind(this));
|
5083 | $$.redraw({
|
5084 | withLegend: !0
|
5085 | });
|
5086 | return current;
|
5087 | },
|
5088 | getRangedData: function getRangedData(d, key, type) {
|
5089 | if (key === void 0) {
|
5090 | key = "";
|
5091 | }
|
5092 | if (type === void 0) {
|
5093 | type = "areaRange";
|
5094 | }
|
5095 | var value = d == null ? void 0 : d.value;
|
5096 | if (isArray(value)) {
|
5097 |
|
5098 | var index = {
|
5099 | areaRange: ["high", "mid", "low"],
|
5100 | candlestick: ["open", "high", "low", "close", "volume"]
|
5101 | }[type].indexOf(key);
|
5102 | return index >= 0 && value ? value[index] : undefined;
|
5103 | } else if (value) {
|
5104 | return value[key];
|
5105 | }
|
5106 | return value;
|
5107 | },
|
5108 | |
5109 |
|
5110 |
|
5111 |
|
5112 |
|
5113 |
|
5114 |
|
5115 |
|
5116 | getRatio: function getRatio(type, d, asPercent) {
|
5117 | var _this39 = this;
|
5118 | if (asPercent === void 0) {
|
5119 | asPercent = !1;
|
5120 | }
|
5121 | var $$ = this,
|
5122 | config = $$.config,
|
5123 | state = $$.state,
|
5124 | api = $$.api,
|
5125 | ratio = 0;
|
5126 | if (d && api.data.shown().length) {
|
5127 | ratio = d.ratio || d.value;
|
5128 | if (type === "arc") {
|
5129 |
|
5130 | if ($$.pie.padAngle()()) {
|
5131 | ratio = d.value / $$.getTotalDataSum(!0);
|
5132 |
|
5133 |
|
5134 | } else {
|
5135 | var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getStartAngle() * -2,
|
5136 | arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
|
5137 | ratio = (d.endAngle - d.startAngle) / arcLength;
|
5138 | }
|
5139 | } else if (type === "index") {
|
5140 | var dataValues = api.data.values.bind(api),
|
5141 | total = this.getTotalPerIndex();
|
5142 | if (state.hiddenTargetIds.length) {
|
5143 | var hiddenSum = dataValues(state.hiddenTargetIds, !1);
|
5144 | if (hiddenSum.length) {
|
5145 | hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
5146 | var _this40 = this;
|
5147 | _newArrowCheck(this, _this39);
|
5148 | return acc.map(function (v, i) {
|
5149 | _newArrowCheck(this, _this40);
|
5150 | return (isNumber(v) ? v : 0) + curr[i];
|
5151 | }.bind(this));
|
5152 | }.bind(this));
|
5153 | total = total.map(function (v, i) {
|
5154 | _newArrowCheck(this, _this39);
|
5155 | return v - hiddenSum[i];
|
5156 | }.bind(this));
|
5157 | }
|
5158 | }
|
5159 | d.ratio = isNumber(d.value) && total && total[d.index] > 0 ? d.value / total[d.index] : 0;
|
5160 | ratio = d.ratio;
|
5161 | } else if (type === "radar") {
|
5162 | ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;
|
5163 | } else if (type === "bar") {
|
5164 | var yScale = $$.getYScaleById.bind($$)(d.id),
|
5165 | _max2 = yScale.domain().reduce(function (a, c) {
|
5166 | _newArrowCheck(this, _this39);
|
5167 | return c - a;
|
5168 | }.bind(this));
|
5169 |
|
5170 | ratio = _max2 === 0 ? 0 : Math.abs(d.value) / _max2;
|
5171 | }
|
5172 | }
|
5173 | return asPercent && ratio ? ratio * 100 : ratio;
|
5174 | },
|
5175 | |
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 | updateDataIndexByX: function updateDataIndexByX(tickValues) {
|
5181 | var _this41 = this,
|
5182 | $$ = this,
|
5183 | tickValueMap = tickValues.reduce(function (out, tick, index) {
|
5184 | _newArrowCheck(this, _this41);
|
5185 | out[+tick.x] = index;
|
5186 | return out;
|
5187 | }.bind(this), {});
|
5188 | $$.data.targets.forEach(function (t) {
|
5189 | var _this42 = this;
|
5190 | _newArrowCheck(this, _this41);
|
5191 | t.values.forEach(function (value, valueIndex) {
|
5192 | _newArrowCheck(this, _this42);
|
5193 | var index = tickValueMap[+value.x];
|
5194 | if (index === undefined) {
|
5195 | index = valueIndex;
|
5196 | }
|
5197 | value.index = index;
|
5198 | }.bind(this));
|
5199 | }.bind(this));
|
5200 | },
|
5201 | |
5202 |
|
5203 |
|
5204 |
|
5205 |
|
5206 |
|
5207 | isBubbleZType: function isBubbleZType(d) {
|
5208 | var $$ = this;
|
5209 | return $$.isBubbleType(d) && (isObject(d.value) && ("z" in d.value || "y" in d.value) || isArray(d.value) && d.value.length === 2);
|
5210 | },
|
5211 | |
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 | isBarRangeType: function isBarRangeType(d) {
|
5218 | var _this43 = this,
|
5219 | $$ = this,
|
5220 | value = d.value;
|
5221 | return $$.isBarType(d) && isArray(value) && value.length === 2 && value.every(function (v) {
|
5222 | _newArrowCheck(this, _this43);
|
5223 | return isNumber(v);
|
5224 | }.bind(this));
|
5225 | },
|
5226 | |
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 | getDataById: function getDataById(id) {
|
5233 | var _d$,
|
5234 | d = this.cache.get(id) || this.api.data(id);
|
5235 | return (_d$ = d == null ? void 0 : d[0]) != null ? _d$ : d;
|
5236 | }
|
5237 | });
|
5238 | ;
|
5239 |
|
5240 |
|
5241 |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 | var load = ({
|
5247 | load: function load(rawTargets, args) {
|
5248 | var _this = this,
|
5249 | _args$done,
|
5250 | $$ = this,
|
5251 | append = args.append,
|
5252 | targets = rawTargets;
|
5253 | if (targets) {
|
5254 |
|
5255 | if (args.filter) {
|
5256 | targets = targets.filter(args.filter);
|
5257 | }
|
5258 |
|
5259 |
|
5260 | if (args.type || args.types) {
|
5261 | targets.forEach(function (t) {
|
5262 | var _args$types;
|
5263 | _newArrowCheck(this, _this);
|
5264 | var type = ((_args$types = args.types) == null ? void 0 : _args$types[t.id]) || args.type;
|
5265 | $$.setTargetType(t.id, type);
|
5266 | }.bind(this));
|
5267 | }
|
5268 |
|
5269 |
|
5270 | $$.data.targets.forEach(function (d) {
|
5271 | _newArrowCheck(this, _this);
|
5272 | for (var i = 0; i < targets.length; i++) {
|
5273 | if (d.id === targets[i].id) {
|
5274 | d.values = append ? d.values.concat(targets[i].values) : targets[i].values;
|
5275 | targets.splice(i, 1);
|
5276 | break;
|
5277 | }
|
5278 | }
|
5279 | }.bind(this));
|
5280 | $$.data.targets = $$.data.targets.concat(targets);
|
5281 | }
|
5282 |
|
5283 |
|
5284 | $$.updateTargets($$.data.targets);
|
5285 |
|
5286 |
|
5287 | $$.redraw({
|
5288 | withUpdateOrgXDomain: !0,
|
5289 | withUpdateXDomain: !0,
|
5290 | withLegend: !0
|
5291 | });
|
5292 |
|
5293 |
|
5294 | $$.updateTypesElements();
|
5295 | (_args$done = args.done) == null ? void 0 : _args$done.call($$.api);
|
5296 | },
|
5297 | loadFromArgs: function loadFromArgs(args) {
|
5298 | var _this2 = this,
|
5299 | $$ = this;
|
5300 |
|
5301 | if (!$$.config) {
|
5302 | return;
|
5303 | }
|
5304 |
|
5305 |
|
5306 | $$.cache.reset();
|
5307 | $$.convertData(args, function (d) {
|
5308 | _newArrowCheck(this, _this2);
|
5309 | var data = args.data || d;
|
5310 | args.append && (data.__append__ = !0);
|
5311 | data && $$.load($$.convertDataToTargets(data), args);
|
5312 | }.bind(this));
|
5313 | },
|
5314 | unload: function unload(rawTargetIds, customDoneCb) {
|
5315 | var _this3 = this,
|
5316 | $$ = this,
|
5317 | state = $$.state,
|
5318 | $el = $$.$el,
|
5319 | $T = $$.$T,
|
5320 | done = customDoneCb,
|
5321 | targetIds = rawTargetIds;
|
5322 |
|
5323 | $$.cache.reset();
|
5324 | if (!done) {
|
5325 | done = function () {
|
5326 | _newArrowCheck(this, _this3);
|
5327 | }.bind(this);
|
5328 | }
|
5329 |
|
5330 |
|
5331 | targetIds = targetIds.filter(function (id) {
|
5332 | _newArrowCheck(this, _this3);
|
5333 | return $$.hasTarget($$.data.targets, id);
|
5334 | }.bind(this));
|
5335 |
|
5336 |
|
5337 | if (!targetIds || targetIds.length === 0) {
|
5338 | done();
|
5339 | return;
|
5340 | }
|
5341 | var targets = $el.svg.selectAll(targetIds.map(function (id) {
|
5342 | _newArrowCheck(this, _this3);
|
5343 | return $$.selectorTarget(id);
|
5344 | }.bind(this)));
|
5345 | $T(targets).style("opacity", "0").remove().call(endall, done);
|
5346 | targetIds.forEach(function (id) {
|
5347 | var _this4 = this;
|
5348 | _newArrowCheck(this, _this3);
|
5349 |
|
5350 | state.withoutFadeIn[id] = !1;
|
5351 |
|
5352 |
|
5353 | if ($el.legend) {
|
5354 | $el.legend.selectAll("." + $LEGEND.legendItem + $$.getTargetSelectorSuffix(id)).remove();
|
5355 | }
|
5356 |
|
5357 |
|
5358 | $$.data.targets = $$.data.targets.filter(function (t) {
|
5359 | _newArrowCheck(this, _this4);
|
5360 | return t.id !== id;
|
5361 | }.bind(this));
|
5362 | }.bind(this));
|
5363 |
|
5364 |
|
5365 | $$.updateTypesElements();
|
5366 | }
|
5367 | });
|
5368 |
|
5369 | var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack_require__(7);
|
5370 | ;
|
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 | var interactions_interaction = ({
|
5382 | selectRectForSingle: function selectRectForSingle(context, eventRect, index) {
|
5383 | var _this = this,
|
5384 | $$ = this,
|
5385 | config = $$.config,
|
5386 | main = $$.$el.main,
|
5387 | isSelectionEnabled = config.data_selection_enabled,
|
5388 | isSelectionGrouped = config.data_selection_grouped,
|
5389 | isSelectable = config.data_selection_isselectable,
|
5390 | isTooltipGrouped = config.tooltip_grouped,
|
5391 | selectedData = $$.getAllValuesOnIndex(index);
|
5392 | if (isTooltipGrouped) {
|
5393 | $$.showTooltip(selectedData, context);
|
5394 | $$.showGridFocus == null ? void 0 : $$.showGridFocus(selectedData);
|
5395 | if (!isSelectionEnabled || isSelectionGrouped) {
|
5396 | return;
|
5397 | }
|
5398 | }
|
5399 |
|
5400 |
|
5401 | main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1);
|
5402 | var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) {
|
5403 | return $$.isWithinShape(this, d);
|
5404 | });
|
5405 | if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
5406 | $$.hideGridFocus == null ? void 0 : $$.hideGridFocus();
|
5407 | $$.hideTooltip();
|
5408 | isSelectionGrouped || $$.setExpand(index);
|
5409 | }
|
5410 | shapeAtIndex.call(function (selected) {
|
5411 | var _this2 = this;
|
5412 | _newArrowCheck(this, _this);
|
5413 | var d = selected.data();
|
5414 | if (isSelectionEnabled && (isSelectionGrouped || isSelectable != null && isSelectable.bind($$.api)(d))) {
|
5415 | eventRect.style("cursor", "pointer");
|
5416 | }
|
5417 | if (!isTooltipGrouped) {
|
5418 | $$.showTooltip(d, context);
|
5419 | $$.showGridFocus == null ? void 0 : $$.showGridFocus(d);
|
5420 | $$.unexpandCircles == null ? void 0 : $$.unexpandCircles();
|
5421 | selected.each(function (d) {
|
5422 | _newArrowCheck(this, _this2);
|
5423 | return $$.setExpand(index, d.id);
|
5424 | }.bind(this));
|
5425 | }
|
5426 | }.bind(this));
|
5427 | },
|
5428 | |
5429 |
|
5430 |
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 | setExpand: function setExpand(index, id, reset) {
|
5436 | var $$ = this,
|
5437 | config = $$.config,
|
5438 | circle = $$.$el.circle;
|
5439 | circle && config.point_focus_expand_enabled && $$.expandCircles(index, id, reset);
|
5440 |
|
5441 |
|
5442 | $$.expandBarTypeShapes(!0, index, id, reset);
|
5443 | },
|
5444 | |
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 | expandBarTypeShapes: function expandBarTypeShapes(expand, i, id, reset) {
|
5453 | var _this3 = this;
|
5454 | if (expand === void 0) {
|
5455 | expand = !0;
|
5456 | }
|
5457 | var $$ = this;
|
5458 | ["bar", "candlestick"].filter(function (v) {
|
5459 | _newArrowCheck(this, _this3);
|
5460 | return $$.$el[v];
|
5461 | }.bind(this)).forEach(function (v) {
|
5462 | _newArrowCheck(this, _this3);
|
5463 | reset && $$.$el[v].classed($COMMON.EXPANDED, !1);
|
5464 | $$.getShapeByIndex(v, i, id).classed($COMMON.EXPANDED, expand);
|
5465 | }.bind(this));
|
5466 | },
|
5467 | |
5468 |
|
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 | setOverOut: function setOverOut(isOver, d) {
|
5474 | var _this5 = this,
|
5475 | $$ = this,
|
5476 | config = $$.config,
|
5477 | hasRadar = $$.state.hasRadar,
|
5478 | main = $$.$el.main,
|
5479 | isArc = isObject(d);
|
5480 |
|
5481 | if (isArc || d !== -1) {
|
5482 | var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
5483 | config.color_onover && $$.setOverColor(isOver, d, isArc);
|
5484 | if (isArc && "id") {
|
5485 | callback(d, main.select("." + $ARC.arc + $$.getTargetSelectorSuffix(d.id)).node());
|
5486 | } else if (!config.tooltip_grouped) {
|
5487 | var last = $$.cache.get(KEY.setOverOut) || [],
|
5488 | shapesAtIndex = main.selectAll("." + $SHAPE.shape + "-" + d).filter(function (d) {
|
5489 | return $$.isWithinShape(this, d);
|
5490 | }),
|
5491 | shape = shapesAtIndex.filter(function () {
|
5492 | var _this4 = this;
|
5493 | return last.every(function (v) {
|
5494 | _newArrowCheck(this, _this4);
|
5495 | return v !== this;
|
5496 | }.bind(this));
|
5497 | });
|
5498 |
|
5499 | if (!isOver || shapesAtIndex.empty() || last.length === shape.size() && shape.nodes().every(function (v, i) {
|
5500 | _newArrowCheck(this, _this5);
|
5501 | return v !== last[i];
|
5502 | }.bind(this))) {
|
5503 | while (last.length) {
|
5504 | var target = last.pop();
|
5505 | config.data_onout.bind($$.api)((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(), target);
|
5506 | }
|
5507 | }
|
5508 |
|
5509 |
|
5510 | shape.each(function () {
|
5511 | if (isOver) {
|
5512 | callback((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).datum(), this);
|
5513 | last.push(this);
|
5514 | }
|
5515 | });
|
5516 | $$.cache.add(KEY.setOverOut, last);
|
5517 | } else {
|
5518 | if (isOver) {
|
5519 | config.point_focus_only && hasRadar ? $$.showCircleFocus($$.getAllValuesOnIndex(d, !0)) : $$.setExpand(d, null, !0);
|
5520 | }
|
5521 | $$.isMultipleX() || main.selectAll("." + $SHAPE.shape + "-" + d).each(function (d) {
|
5522 | callback(d, this);
|
5523 | });
|
5524 | }
|
5525 | }
|
5526 | },
|
5527 | |
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 | callOverOutForTouch: function callOverOutForTouch(d) {
|
5533 | var $$ = this,
|
5534 | last = $$.cache.get(KEY.callOverOutForTouch);
|
5535 | if (isObject(d) && last ? d.id !== last.id : d !== last) {
|
5536 | (last || isNumber(last)) && $$.setOverOut(!1, last);
|
5537 | (d || isNumber(d)) && $$.setOverOut(!0, d);
|
5538 | $$.cache.add(KEY.callOverOutForTouch, d);
|
5539 | }
|
5540 | },
|
5541 | |
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 | getDraggableSelection: function getDraggableSelection() {
|
5547 | var _this6 = this,
|
5548 | $$ = this,
|
5549 | config = $$.config,
|
5550 | state = $$.state;
|
5551 | return config.interaction_enabled && config.data_selection_draggable && $$.drag ? (0,external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_.drag)().on("drag", function (event) {
|
5552 | state.event = event;
|
5553 | $$.drag(getPointer(event, this));
|
5554 | }).on("start", function (event) {
|
5555 | state.event = event;
|
5556 | $$.dragstart(getPointer(event, this));
|
5557 | }).on("end", function (event) {
|
5558 | _newArrowCheck(this, _this6);
|
5559 | state.event = event;
|
5560 | $$.dragend();
|
5561 | }.bind(this)) : function () {
|
5562 | _newArrowCheck(this, _this6);
|
5563 | }.bind(this);
|
5564 | },
|
5565 | |
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 | dispatchEvent: function dispatchEvent(type, index, mouse) {
|
5573 | var _this7 = this,
|
5574 | $$ = this,
|
5575 | config = $$.config,
|
5576 | _$$$state = $$.state,
|
5577 | eventReceiver = _$$$state.eventReceiver,
|
5578 | hasAxis = _$$$state.hasAxis,
|
5579 | hasRadar = _$$$state.hasRadar,
|
5580 | _$$$$el = $$.$el,
|
5581 | eventRect = _$$$$el.eventRect,
|
5582 | arcs = _$$$$el.arcs,
|
5583 | radar = _$$$$el.radar,
|
5584 | isMultipleX = $$.isMultipleX(),
|
5585 | element = (hasRadar ? radar.axes.select("." + $AXIS.axis + "-" + index + " text") : eventRect || arcs.selectAll("." + $COMMON.target + " path").filter(function (d, i) {
|
5586 | _newArrowCheck(this, _this7);
|
5587 | return i === index;
|
5588 | }.bind(this))).node(),
|
5589 | _element$getBoundingC = element.getBoundingClientRect(),
|
5590 | width = _element$getBoundingC.width,
|
5591 | left = _element$getBoundingC.left,
|
5592 | top = _element$getBoundingC.top;
|
5593 | if (hasAxis && !hasRadar && !isMultipleX) {
|
5594 | var coords = eventReceiver.coords[index];
|
5595 | width = coords.w;
|
5596 | left += coords.x;
|
5597 | top += coords.y;
|
5598 | }
|
5599 | var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : width / 2),
|
5600 | y = top + (mouse ? mouse[1] : 0);
|
5601 | emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](element, type, {
|
5602 | screenX: x,
|
5603 | screenY: y,
|
5604 | clientX: x,
|
5605 | clientY: y
|
5606 | });
|
5607 | },
|
5608 | setDragStatus: function setDragStatus(isDragging) {
|
5609 | this.state.dragging = isDragging;
|
5610 | },
|
5611 | |
5612 |
|
5613 |
|
5614 |
|
5615 | unbindZoomEvent: function unbindZoomEvent() {
|
5616 | var $$ = this,
|
5617 | _$$$$el2 = $$.$el,
|
5618 | eventRect = _$$$$el2.eventRect,
|
5619 | zoomResetBtn = _$$$$el2.zoomResetBtn;
|
5620 | eventRect == null ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
5621 | zoomResetBtn == null ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
5622 | },
|
5623 | |
5624 |
|
5625 |
|
5626 |
|
5627 | unbindAllEvents: function unbindAllEvents() {
|
5628 | var _this8 = this,
|
5629 | $$ = this,
|
5630 | _$$$$el3 = $$.$el,
|
5631 | arcs = _$$$$el3.arcs,
|
5632 | eventRect = _$$$$el3.eventRect,
|
5633 | legend = _$$$$el3.legend,
|
5634 | region = _$$$$el3.region,
|
5635 | svg = _$$$$el3.svg,
|
5636 | brush = $$.brush;
|
5637 |
|
5638 | [svg, eventRect, region == null ? void 0 : region.list, brush == null ? void 0 : brush.getSelection(), arcs == null ? void 0 : arcs.selectAll("path"), legend == null ? void 0 : legend.selectAll("g")].forEach(function (v) {
|
5639 | _newArrowCheck(this, _this8);
|
5640 | return v == null ? void 0 : v.on("wheel click mouseover mousemove mouseout touchstart touchmove touchend touchstart.eventRect touchmove.eventRect touchend.eventRect .brush .drag .zoom wheel.zoom dblclick.zoom", null);
|
5641 | }.bind(this));
|
5642 | $$.unbindZoomEvent == null ? void 0 : $$.unbindZoomEvent();
|
5643 | }
|
5644 | });
|
5645 | ;
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 | var internals_class = ({
|
5653 | generateClass: function generateClass(prefix, targetId) {
|
5654 | return " " + prefix + " " + (prefix + this.getTargetSelectorSuffix(targetId));
|
5655 | },
|
5656 | |
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 | getClass: function getClass(type, withShape) {
|
5664 | var _this = this,
|
5665 | isPlural = /s$/.test(type),
|
5666 | useIdKey = /^(area|arc|line)s?$/.test(type),
|
5667 | key = isPlural ? "id" : "index";
|
5668 | return function (d) {
|
5669 | _newArrowCheck(this, _this);
|
5670 | var data = d.data || d,
|
5671 | result = (withShape ? this.generateClass(classes[isPlural ? "shapes" : "shape"], data[key]) : "") + this.generateClass(classes[type], data[useIdKey ? "id" : key]);
|
5672 | return result.trim();
|
5673 | }.bind(this);
|
5674 | },
|
5675 | |
5676 |
|
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 | getChartClass: function getChartClass(type) {
|
5682 | var _this2 = this;
|
5683 | return function (d) {
|
5684 | _newArrowCheck(this, _this2);
|
5685 | return classes["chart" + type] + this.classTarget((d.data ? d.data : d).id);
|
5686 | }.bind(this);
|
5687 | },
|
5688 | generateExtraLineClass: function generateExtraLineClass() {
|
5689 | var $$ = this,
|
5690 | classes = $$.config.line_classes || [],
|
5691 | ids = [];
|
5692 | return function (d) {
|
5693 | var _d$data,
|
5694 | id = d.id || ((_d$data = d.data) == null ? void 0 : _d$data.id) || d;
|
5695 | if (ids.indexOf(id) < 0) {
|
5696 | ids.push(id);
|
5697 | }
|
5698 | return classes[ids.indexOf(id) % classes.length];
|
5699 | };
|
5700 | },
|
5701 | classRegion: function classRegion(d, i) {
|
5702 | return this.generateClass(classes.region, i) + " " + ("class" in d ? d.class : "");
|
5703 | },
|
5704 | classTarget: function classTarget(id) {
|
5705 | var additionalClassSuffix = this.config.data_classes[id],
|
5706 | additionalClass = "";
|
5707 | if (additionalClassSuffix) {
|
5708 | additionalClass = " " + classes.target + "-" + additionalClassSuffix;
|
5709 | }
|
5710 | return this.generateClass(classes.target, id) + additionalClass;
|
5711 | },
|
5712 | classFocus: function classFocus(d) {
|
5713 | return this.classFocused(d) + this.classDefocused(d);
|
5714 | },
|
5715 | classFocused: function classFocused(d) {
|
5716 | return " " + (this.state.focusedTargetIds.indexOf(d.id) >= 0 ? classes.focused : "");
|
5717 | },
|
5718 | classDefocused: function classDefocused(d) {
|
5719 | return " " + (this.state.defocusedTargetIds.indexOf(d.id) >= 0 ? classes.defocused : "");
|
5720 | },
|
5721 | getTargetSelectorSuffix: function getTargetSelectorSuffix(targetId) {
|
5722 | var targetStr = targetId || targetId === 0 ? "-" + targetId : "";
|
5723 | return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-");
|
5724 | },
|
5725 | selectorTarget: function selectorTarget(id, prefix) {
|
5726 | var pfx = prefix || "",
|
5727 | target = this.getTargetSelectorSuffix(id);
|
5728 |
|
5729 | return pfx + "." + (classes.target + target) + ", " + pfx + "." + (classes.circles + target);
|
5730 | },
|
5731 | selectorTargets: function selectorTargets(idsValue, prefix) {
|
5732 | var _this3 = this,
|
5733 | ids = idsValue || [];
|
5734 | return ids.length ? ids.map(function (id) {
|
5735 | _newArrowCheck(this, _this3);
|
5736 | return this.selectorTarget(id, prefix);
|
5737 | }.bind(this)) : null;
|
5738 | },
|
5739 | selectorLegend: function selectorLegend(id) {
|
5740 | return "." + (classes.legendItem + this.getTargetSelectorSuffix(id));
|
5741 | },
|
5742 | selectorLegends: function selectorLegends(ids) {
|
5743 | var _this4 = this;
|
5744 | return ids != null && ids.length ? ids.map(function (id) {
|
5745 | _newArrowCheck(this, _this4);
|
5746 | return this.selectorLegend(id);
|
5747 | }.bind(this)) : null;
|
5748 | }
|
5749 | });
|
5750 | ;
|
5751 |
|
5752 |
|
5753 |
|
5754 |
|
5755 | var category = ({
|
5756 | |
5757 |
|
5758 |
|
5759 |
|
5760 |
|
5761 |
|
5762 | categoryName: function categoryName(i) {
|
5763 | var categories = this.config.axis_x_categories;
|
5764 | return i < (categories == null ? void 0 : categories.length) ? categories[i] : i;
|
5765 | }
|
5766 | });
|
5767 |
|
5768 | var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(6);
|
5769 | ;
|
5770 |
|
5771 | var color_this = undefined;
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 |
|
5791 | var colorizePattern = function (pattern, color, id) {
|
5792 | _newArrowCheck(this, color_this);
|
5793 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(pattern.cloneNode(!0));
|
5794 | node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color);
|
5795 | return {
|
5796 | id: id,
|
5797 | node: node.node()
|
5798 | };
|
5799 | }.bind(undefined);
|
5800 |
|
5801 |
|
5802 |
|
5803 |
|
5804 |
|
5805 |
|
5806 |
|
5807 |
|
5808 | function getColorFromCss(element) {
|
5809 | var _this2 = this,
|
5810 | cacheKey = KEY.colorPattern,
|
5811 | body = browser_doc.body,
|
5812 | pattern = body[cacheKey];
|
5813 | if (!pattern) {
|
5814 | var content = element.classed($COLOR.colorPattern, !0).style("background-image");
|
5815 | element.classed($COLOR.colorPattern, !1);
|
5816 | if (content.indexOf(";") > -1) {
|
5817 | pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) {
|
5818 | _newArrowCheck(this, _this2);
|
5819 | return v.trim().replace(/[\"'\s]/g, "");
|
5820 | }.bind(this)).filter(Boolean);
|
5821 | body[cacheKey] = pattern;
|
5822 | }
|
5823 | }
|
5824 | return pattern;
|
5825 | }
|
5826 |
|
5827 |
|
5828 |
|
5829 | var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
|
5830 | var internals_color = ({
|
5831 | generateColor: function generateColor() {
|
5832 | var _this3 = this,
|
5833 | $$ = this,
|
5834 | $el = $$.$el,
|
5835 | config = $$.config,
|
5836 | colors = config.data_colors,
|
5837 | callback = config.data_color,
|
5838 | ids = [],
|
5839 | pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)(getColorFromCss($el.chart) || schemeCategory10).range(),
|
5840 | originalColorPattern = pattern;
|
5841 | if (isFunction(config.color_tiles)) {
|
5842 | var tiles = config.color_tiles.bind($$.api)(),
|
5843 | colorizedPatterns = pattern.map(function (p, index) {
|
5844 | _newArrowCheck(this, _this3);
|
5845 | var color = p.replace(/[#\(\)\s,]/g, ""),
|
5846 | id = $$.state.datetimeId + "-pattern-" + color + "-" + index;
|
5847 | return colorizePattern(tiles[index % tiles.length], p, id);
|
5848 | }.bind(this));
|
5849 | pattern = colorizedPatterns.map(function (p) {
|
5850 | _newArrowCheck(this, _this3);
|
5851 | return "url(#" + p.id + ")";
|
5852 | }.bind(this));
|
5853 | $$.patterns = colorizedPatterns;
|
5854 | }
|
5855 | return function (d) {
|
5856 | var _data,
|
5857 | id = d.id || ((_data = d.data) == null ? void 0 : _data.id) || d,
|
5858 | isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id],
|
5859 | color;
|
5860 |
|
5861 | if (isFunction(colors[id])) {
|
5862 | color = colors[id].bind($$.api)(d);
|
5863 |
|
5864 |
|
5865 | } else if (colors[id]) {
|
5866 | color = colors[id];
|
5867 |
|
5868 |
|
5869 | } else {
|
5870 | if (ids.indexOf(id) < 0) {
|
5871 | ids.push(id);
|
5872 | }
|
5873 | color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length];
|
5874 | colors[id] = color;
|
5875 | }
|
5876 | return isFunction(callback) ? callback.bind($$.api)(color, d) : color;
|
5877 | };
|
5878 | },
|
5879 | generateLevelColor: function generateLevelColor() {
|
5880 | var $$ = this,
|
5881 | config = $$.config,
|
5882 | colors = config.color_pattern,
|
5883 | threshold = config.color_threshold,
|
5884 | asValue = threshold.unit === "value",
|
5885 | max = threshold.max || 100,
|
5886 | values = threshold.values && threshold.values.length ? threshold.values : [];
|
5887 | return notEmpty(threshold) ? function (value) {
|
5888 | var v = asValue ? value : value * 100 / max,
|
5889 | color = colors[colors.length - 1];
|
5890 | for (var i = 0, l = values.length; i < l; i++) {
|
5891 | if (v <= values[i]) {
|
5892 | color = colors[i];
|
5893 | break;
|
5894 | }
|
5895 | }
|
5896 | return color;
|
5897 | } : null;
|
5898 | },
|
5899 | |
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 | generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
|
5905 | var _this4 = this,
|
5906 | $$ = this,
|
5907 | $el = $$.$el,
|
5908 | config = $$.config,
|
5909 | state = $$.state,
|
5910 | backgroundColors = color || config.data_labels_backgroundColors;
|
5911 | if (backgroundColors) {
|
5912 | var ids = [];
|
5913 | if (isString(backgroundColors)) {
|
5914 | ids.push("");
|
5915 | } else if (isObject(backgroundColors)) {
|
5916 | ids = Object.keys(backgroundColors);
|
5917 | }
|
5918 | ids.forEach(function (v) {
|
5919 | _newArrowCheck(this, _this4);
|
5920 | var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
|
5921 | $el.defs.append("filter").attr("x", "0").attr("y", "0").attr("width", "1").attr("height", "1").attr("id", id).html("<feFlood flood-color=\"" + (v === "" ? backgroundColors : backgroundColors[v]) + "\" /><feComposite in=\"SourceGraphic\"/>");
|
5922 | }.bind(this));
|
5923 | }
|
5924 | },
|
5925 | |
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 | getGradienColortUrl: function getGradienColortUrl(id) {
|
5932 | return "url(#" + this.state.datetimeId + "-gradient" + this.getTargetSelectorSuffix(id) + ")";
|
5933 | },
|
5934 | |
5935 |
|
5936 |
|
5937 |
|
5938 | updateLinearGradient: function updateLinearGradient() {
|
5939 | var _this5 = this,
|
5940 | $$ = this,
|
5941 | config = $$.config,
|
5942 | targets = $$.data.targets,
|
5943 | datetimeId = $$.state.datetimeId,
|
5944 | defs = $$.$el.defs;
|
5945 | targets.forEach(function (d) {
|
5946 | var _this6 = this;
|
5947 | _newArrowCheck(this, _this5);
|
5948 | var id = datetimeId + "-gradient" + $$.getTargetSelectorSuffix(d.id),
|
5949 | supportedType = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar",
|
5950 | isRotated = config.axis_rotated;
|
5951 | if (supportedType && defs.select("#" + id).empty()) {
|
5952 | var color = $$.color(d),
|
5953 | _config = config[supportedType + "_linearGradient"],
|
5954 | _config$x = _config.x,
|
5955 | x = _config$x === void 0 ? isRotated ? [1, 0] : [0, 0] : _config$x,
|
5956 | _config$y = _config.y,
|
5957 | y = _config$y === void 0 ? isRotated ? [0, 0] : [0, 1] : _config$y,
|
5958 | _config$stops = _config.stops,
|
5959 | stops = _config$stops === void 0 ? [[0, color, 1], [1, color, 0]] : _config$stops,
|
5960 | linearGradient = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
5961 | stops.forEach(function (v) {
|
5962 | _newArrowCheck(this, _this6);
|
5963 | var stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
|
5964 | linearGradient.append("stop").attr("offset", v[0]).attr("stop-color", stopColor || color).attr("stop-opacity", v[2]);
|
5965 | }.bind(this));
|
5966 | }
|
5967 | }.bind(this));
|
5968 | },
|
5969 | |
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 |
|
5976 | setOverColor: function setOverColor(isOver, d) {
|
5977 | var _this7 = this,
|
5978 | $$ = this,
|
5979 | config = $$.config,
|
5980 | main = $$.$el.main,
|
5981 | onover = config.color_onover,
|
5982 | color = isOver ? onover : $$.color;
|
5983 | if (isObject(color)) {
|
5984 | color = function (_ref) {
|
5985 | var id = _ref.id;
|
5986 | _newArrowCheck(this, _this7);
|
5987 | return id in onover ? onover[id] : $$.color(id);
|
5988 | }.bind(this);
|
5989 | } else if (isString(color)) {
|
5990 | color = function () {
|
5991 | _newArrowCheck(this, _this7);
|
5992 | return onover;
|
5993 | }.bind(this);
|
5994 | } else if (isFunction(onover)) {
|
5995 | color = color.bind($$.api);
|
5996 | }
|
5997 | main.selectAll(isObject(d) ?
|
5998 | "." + $ARC.arc + $$.getTargetSelectorSuffix(d.id) : "." + $SHAPE.shape + "-" + d).style("fill", color);
|
5999 | }
|
6000 | });
|
6001 | ;
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 | var domain = ({
|
6010 | getYDomainMinMax: function getYDomainMinMax(targets, type) {
|
6011 | var _this = this,
|
6012 | $$ = this,
|
6013 | axis = $$.axis,
|
6014 | config = $$.config,
|
6015 | isMin = type === "min",
|
6016 | dataGroups = config.data_groups,
|
6017 | ids = $$.mapToIds(targets),
|
6018 | ys = $$.getValuesAsIdKeyed(targets);
|
6019 | if (dataGroups.length > 0) {
|
6020 | var hasValue = $$["has" + (isMin ? "Negative" : "Positive") + "ValueInTargets"](targets);
|
6021 | dataGroups.forEach(function (groupIds) {
|
6022 | var _this2 = this;
|
6023 | _newArrowCheck(this, _this);
|
6024 |
|
6025 | var idsInGroup = groupIds.filter(function (v) {
|
6026 | _newArrowCheck(this, _this2);
|
6027 | return ids.indexOf(v) >= 0;
|
6028 | }.bind(this));
|
6029 | if (idsInGroup.length) {
|
6030 | var baseId = idsInGroup[0],
|
6031 | baseAxisId = axis.getId(baseId);
|
6032 |
|
6033 | if (hasValue && ys[baseId]) {
|
6034 | ys[baseId] = ys[baseId].map(function (v) {
|
6035 | _newArrowCheck(this, _this2);
|
6036 | return (isMin ? v < 0 : v > 0) ? v : 0;
|
6037 | }.bind(this));
|
6038 | }
|
6039 | idsInGroup.filter(function (v, i) {
|
6040 | _newArrowCheck(this, _this2);
|
6041 | return i > 0;
|
6042 | }.bind(this)).forEach(function (id) {
|
6043 | var _this3 = this;
|
6044 | _newArrowCheck(this, _this2);
|
6045 | if (ys[id]) {
|
6046 | var axisId = axis.getId(id);
|
6047 | ys[id].forEach(function (v, i) {
|
6048 | _newArrowCheck(this, _this3);
|
6049 | var val = +v,
|
6050 | meetCondition = isMin ? val > 0 : val < 0;
|
6051 | if (axisId === baseAxisId && !(hasValue && meetCondition)) {
|
6052 | ys[baseId][i] += val;
|
6053 | }
|
6054 | }.bind(this));
|
6055 | }
|
6056 | }.bind(this));
|
6057 | }
|
6058 | }.bind(this));
|
6059 | }
|
6060 | return getMinMax(type, Object.keys(ys).map(function (key) {
|
6061 | _newArrowCheck(this, _this);
|
6062 | return getMinMax(type, ys[key]);
|
6063 | }.bind(this)));
|
6064 | },
|
6065 | |
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 | isHiddenTargetWithYDomain: function isHiddenTargetWithYDomain(id) {
|
6072 | var _this4 = this,
|
6073 | $$ = this;
|
6074 | return $$.state.hiddenTargetIds.some(function (v) {
|
6075 | _newArrowCheck(this, _this4);
|
6076 | return $$.axis.getId(v) === id;
|
6077 | }.bind(this));
|
6078 | },
|
6079 | getYDomain: function getYDomain(targets, axisId, xDomain) {
|
6080 | var _this5 = this,
|
6081 | $$ = this,
|
6082 | axis = $$.axis,
|
6083 | config = $$.config,
|
6084 | scale = $$.scale,
|
6085 | pfx = "axis_" + axisId;
|
6086 | if ($$.isStackNormalized()) {
|
6087 | return [0, 100];
|
6088 | }
|
6089 | var isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log",
|
6090 | targetsByAxisId = targets.filter(function (t) {
|
6091 | _newArrowCheck(this, _this5);
|
6092 | return axis.getId(t.id) === axisId;
|
6093 | }.bind(this)),
|
6094 | yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId;
|
6095 | if (yTargets.length === 0) {
|
6096 |
|
6097 | if ($$.isHiddenTargetWithYDomain(axisId)) {
|
6098 | return scale[axisId].domain();
|
6099 | } else {
|
6100 | return axisId === "y2" ? scale.y.domain() :
|
6101 |
|
6102 |
|
6103 | $$.getYDomain(targets, "y2", xDomain);
|
6104 | }
|
6105 | }
|
6106 | var yMin = config[pfx + "_min"],
|
6107 | yMax = config[pfx + "_max"],
|
6108 | center = config[pfx + "_center"],
|
6109 | isInverted = config[pfx + "_inverted"],
|
6110 | showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,
|
6111 | showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated,
|
6112 | yDomainMin = $$.getYDomainMinMax(yTargets, "min"),
|
6113 | yDomainMax = $$.getYDomainMinMax(yTargets, "max"),
|
6114 | isZeroBased = [TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER].concat(TYPE_BY_CATEGORY.Line).some(function (v) {
|
6115 | _newArrowCheck(this, _this5);
|
6116 | var type = v.indexOf("area") > -1 ? "area" : v;
|
6117 | return $$.hasType(v, yTargets, !0) && config[type + "_zerobased"];
|
6118 | }.bind(this));
|
6119 |
|
6120 | yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin < yMax ? yDomainMin : yMax - 10 : yDomainMin;
|
6121 | yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin < yDomainMax ? yDomainMax : yMin + 10 : yDomainMax;
|
6122 | if (isNaN(yDomainMin)) {
|
6123 |
|
6124 | yDomainMin = 0;
|
6125 | }
|
6126 | if (isNaN(yDomainMax)) {
|
6127 |
|
6128 | yDomainMax = yDomainMin;
|
6129 | }
|
6130 | if (yDomainMin === yDomainMax) {
|
6131 | yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0;
|
6132 | }
|
6133 | var isAllPositive = yDomainMin >= 0 && yDomainMax >= 0,
|
6134 | isAllNegative = yDomainMin <= 0 && yDomainMax <= 0;
|
6135 |
|
6136 | if (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) {
|
6137 | isZeroBased = !1;
|
6138 | }
|
6139 |
|
6140 |
|
6141 | if (isZeroBased) {
|
6142 | isAllPositive && (yDomainMin = 0);
|
6143 | isAllNegative && (yDomainMax = 0);
|
6144 | }
|
6145 | var domainLength = Math.abs(yDomainMax - yDomainMin),
|
6146 | padding = {
|
6147 | top: domainLength * .1,
|
6148 | bottom: domainLength * .1
|
6149 | };
|
6150 | if (isDefined(center)) {
|
6151 | var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
|
6152 | yDomainMax = center + yDomainAbs;
|
6153 | yDomainMin = center - yDomainAbs;
|
6154 | }
|
6155 |
|
6156 |
|
6157 | if (showHorizontalDataLabel) {
|
6158 | var diff = diffDomain(scale.y.range()),
|
6159 | ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map(function (v) {
|
6160 | _newArrowCheck(this, _this5);
|
6161 | return v / diff;
|
6162 | }.bind(this));
|
6163 | ["bottom", "top"].forEach(function (v, i) {
|
6164 | _newArrowCheck(this, _this5);
|
6165 | padding[v] += domainLength * (ratio[i] / (1 - ratio[0] - ratio[1]));
|
6166 | }.bind(this));
|
6167 | } else if (showVerticalDataLabel) {
|
6168 | var lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height");
|
6169 | ["bottom", "top"].forEach(function (v, i) {
|
6170 | _newArrowCheck(this, _this5);
|
6171 | padding[v] += $$.convertPixelToScale("y", lengths[i], domainLength);
|
6172 | }.bind(this));
|
6173 | }
|
6174 | padding = $$.getResettedPadding(padding);
|
6175 |
|
6176 |
|
6177 |
|
6178 | var p = config[pfx + "_padding"];
|
6179 | if (notEmpty(p)) {
|
6180 | ["bottom", "top"].forEach(function (v) {
|
6181 | _newArrowCheck(this, _this5);
|
6182 | padding[v] = axis.getPadding(p, v, padding[v], domainLength);
|
6183 | }.bind(this));
|
6184 | }
|
6185 |
|
6186 |
|
6187 | if (isZeroBased) {
|
6188 | isAllPositive && (padding.bottom = yDomainMin);
|
6189 | isAllNegative && (padding.top = -yDomainMax);
|
6190 | }
|
6191 | var domain = isLog ? [yDomainMin, yDomainMax].map(function (v) {
|
6192 | _newArrowCheck(this, _this5);
|
6193 | return v < 0 ? 0 : v;
|
6194 | }.bind(this)) : [yDomainMin - padding.bottom, yDomainMax + padding.top];
|
6195 | return isInverted ? domain.reverse() : domain;
|
6196 | },
|
6197 | getXDomainMinMax: function getXDomainMinMax(targets, type) {
|
6198 | var _this6 = this,
|
6199 | $$ = this,
|
6200 | configValue = $$.config["axis_x_" + type],
|
6201 | dataValue = getMinMax(type, targets.map(function (t) {
|
6202 | var _this7 = this;
|
6203 | _newArrowCheck(this, _this6);
|
6204 | return getMinMax(type, t.values.map(function (v) {
|
6205 | _newArrowCheck(this, _this7);
|
6206 | return v.x;
|
6207 | }.bind(this)));
|
6208 | }.bind(this))),
|
6209 | value = isObject(configValue) ? configValue.value : configValue,
|
6210 | _$$$axis;
|
6211 | value = isDefined(value) && (_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() ? parseDate.bind(this)(value) : value;
|
6212 | if (isObject(configValue) && configValue.fit && (type === "min" && value < dataValue || type === "max" && value > dataValue)) {
|
6213 | value = undefined;
|
6214 | }
|
6215 | return isDefined(value) ? value : dataValue;
|
6216 | },
|
6217 | |
6218 |
|
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 | getXDomainPadding: function getXDomainPadding(domain, tickCount) {
|
6225 | var $$ = this,
|
6226 | axis = $$.axis,
|
6227 | config = $$.config,
|
6228 | padding = config.axis_x_padding,
|
6229 | isTimeSeriesTickCount = axis.isTimeSeries() && tickCount,
|
6230 | diff = diffDomain(domain),
|
6231 | defaultValue;
|
6232 |
|
6233 | if (axis.isCategorized() || isTimeSeriesTickCount) {
|
6234 | defaultValue = 0;
|
6235 | } else if ($$.hasType("bar")) {
|
6236 | var maxDataCount = $$.getMaxDataCount();
|
6237 | defaultValue = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5;
|
6238 | } else {
|
6239 | defaultValue = $$.getResettedPadding(diff * .01);
|
6240 | }
|
6241 | var _ref = isNumber(padding) ? {
|
6242 | left: padding,
|
6243 | right: padding
|
6244 | } : padding,
|
6245 | _ref$left = _ref.left,
|
6246 | left = _ref$left === void 0 ? defaultValue : _ref$left,
|
6247 | _ref$right = _ref.right,
|
6248 | right = _ref$right === void 0 ? defaultValue : _ref$right;
|
6249 |
|
6250 |
|
6251 | if (padding.unit === "px") {
|
6252 | var domainLength = Math.abs(diff + diff * .2);
|
6253 | left = axis.getPadding(padding, "left", defaultValue, domainLength);
|
6254 | right = axis.getPadding(padding, "right", defaultValue, domainLength);
|
6255 | } else {
|
6256 | var range = diff + left + right;
|
6257 | if (isTimeSeriesTickCount && range) {
|
6258 | var relativeTickWidth = diff / tickCount / range;
|
6259 | left = left / range / relativeTickWidth;
|
6260 | right = right / range / relativeTickWidth;
|
6261 | }
|
6262 | }
|
6263 | return {
|
6264 | left: left,
|
6265 | right: right
|
6266 | };
|
6267 | },
|
6268 | |
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 | getXDomain: function getXDomain(targets) {
|
6275 | var $$ = this,
|
6276 | axis = $$.axis,
|
6277 | x = $$.scale.x,
|
6278 | domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")],
|
6279 | _domain = domain,
|
6280 | _domain$ = _domain[0],
|
6281 | min = _domain$ === void 0 ? 0 : _domain$,
|
6282 | _domain$2 = _domain[1],
|
6283 | max = _domain$2 === void 0 ? 0 : _domain$2;
|
6284 | if (x.type !== "log") {
|
6285 | var isCategorized = axis.isCategorized(),
|
6286 | isTimeSeries = axis.isTimeSeries(),
|
6287 | _padding = $$.getXDomainPadding(domain),
|
6288 | firstX = domain[0],
|
6289 | lastX = domain[1];
|
6290 |
|
6291 | if (firstX - lastX === 0 && !isCategorized) {
|
6292 | if (isTimeSeries) {
|
6293 | firstX = new Date(firstX.getTime() * .5);
|
6294 | lastX = new Date(lastX.getTime() * 1.5);
|
6295 | } else {
|
6296 | firstX = firstX === 0 ? 1 : firstX * .5;
|
6297 | lastX = lastX === 0 ? -1 : lastX * 1.5;
|
6298 | }
|
6299 | }
|
6300 | if (firstX || firstX === 0) {
|
6301 | min = isTimeSeries ? new Date(firstX.getTime() - _padding.left) : firstX - _padding.left;
|
6302 | }
|
6303 | if (lastX || lastX === 0) {
|
6304 | max = isTimeSeries ? new Date(lastX.getTime() + _padding.right) : lastX + _padding.right;
|
6305 | }
|
6306 | }
|
6307 | return [min, max];
|
6308 | },
|
6309 | updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
|
6310 | var $$ = this,
|
6311 | config = $$.config,
|
6312 | org = $$.org,
|
6313 | _$$$scale = $$.scale,
|
6314 | x = _$$$scale.x,
|
6315 | subX = _$$$scale.subX,
|
6316 | zoomEnabled = config.zoom_enabled;
|
6317 | if (withUpdateOrgXDomain) {
|
6318 | var _$$$brush;
|
6319 | x.domain(domain || sortValue($$.getXDomain(targets)));
|
6320 | org.xDomain = x.domain();
|
6321 | zoomEnabled && $$.zoom.updateScaleExtent();
|
6322 | subX.domain(x.domain());
|
6323 | (_$$$brush = $$.brush) == null ? void 0 : _$$$brush.scale(subX);
|
6324 | }
|
6325 | if (withUpdateXDomain) {
|
6326 | var domainValue = domain || !$$.brush || brushEmpty($$) ? org.xDomain : getBrushSelection($$).map(subX.invert);
|
6327 | x.domain(domainValue);
|
6328 | zoomEnabled && $$.zoom.updateScaleExtent();
|
6329 | }
|
6330 |
|
6331 |
|
6332 | withTrim && x.domain($$.trimXDomain(x.orgDomain()));
|
6333 | return x.domain();
|
6334 | },
|
6335 | trimXDomain: function trimXDomain(domain) {
|
6336 | var zoomDomain = this.getZoomDomain(),
|
6337 | min = zoomDomain[0],
|
6338 | max = zoomDomain[1];
|
6339 | if (domain[0] <= min) {
|
6340 | domain[1] = +domain[1] + (min - domain[0]);
|
6341 | domain[0] = min;
|
6342 | }
|
6343 | if (max <= domain[1]) {
|
6344 | domain[0] = +domain[0] - (domain[1] - max);
|
6345 | domain[1] = max;
|
6346 | }
|
6347 | return domain;
|
6348 | },
|
6349 | |
6350 |
|
6351 |
|
6352 |
|
6353 |
|
6354 | getZoomDomain: function getZoomDomain() {
|
6355 | var $$ = this,
|
6356 | config = $$.config,
|
6357 | org = $$.org,
|
6358 | _org$xDomain = org.xDomain,
|
6359 | min = _org$xDomain[0],
|
6360 | max = _org$xDomain[1];
|
6361 | if (isDefined(config.zoom_x_min)) {
|
6362 | min = getMinMax("min", [min, config.zoom_x_min]);
|
6363 | }
|
6364 | if (isDefined(config.zoom_x_max)) {
|
6365 | max = getMinMax("max", [max, config.zoom_x_max]);
|
6366 | }
|
6367 | return [min, max];
|
6368 | },
|
6369 | |
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 |
|
6375 |
|
6376 |
|
6377 | convertPixelToScale: function convertPixelToScale(type, pixels, domainLength) {
|
6378 | var $$ = this,
|
6379 | config = $$.config,
|
6380 | state = $$.state,
|
6381 | isRotated = config.axis_rotated,
|
6382 | length;
|
6383 | if (type === "x") {
|
6384 | length = isRotated ? "height" : "width";
|
6385 | } else {
|
6386 | length = isRotated ? "width" : "height";
|
6387 | }
|
6388 | return domainLength * (pixels / state[length]);
|
6389 | }
|
6390 | });
|
6391 | ;
|
6392 |
|
6393 |
|
6394 |
|
6395 |
|
6396 |
|
6397 |
|
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 |
|
6403 |
|
6404 |
|
6405 |
|
6406 | function getFormat($$, typeValue, v) {
|
6407 | var config = $$.config,
|
6408 | type = "axis_" + typeValue + "_tick_format",
|
6409 | format = config[type] ? config[type] : $$.defaultValueFormat;
|
6410 | return format(v);
|
6411 | }
|
6412 | var format = ({
|
6413 | yFormat: function yFormat(v) {
|
6414 | return getFormat(this, "y", v);
|
6415 | },
|
6416 | y2Format: function y2Format(v) {
|
6417 | return getFormat(this, "y2", v);
|
6418 | },
|
6419 | |
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 | getDefaultValueFormat: function getDefaultValueFormat() {
|
6425 | var $$ = this,
|
6426 | defaultArcValueFormat = $$.defaultArcValueFormat,
|
6427 | yFormat = $$.yFormat,
|
6428 | y2Format = $$.y2Format,
|
6429 | hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
6430 | return function (v, ratio, id) {
|
6431 | var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
|
6432 | return format.call($$, v, ratio);
|
6433 | };
|
6434 | },
|
6435 | defaultValueFormat: function defaultValueFormat(v) {
|
6436 | return isValue(v) ? +v : "";
|
6437 | },
|
6438 | defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
6439 | return (ratio * 100).toFixed(1) + "%";
|
6440 | },
|
6441 | defaultPolarValueFormat: function defaultPolarValueFormat(v) {
|
6442 | return "" + v;
|
6443 | },
|
6444 | dataLabelFormat: function dataLabelFormat(targetId) {
|
6445 | var _this = this,
|
6446 | $$ = this,
|
6447 | dataLabels = $$.config.data_labels,
|
6448 | defaultFormat = function (v) {
|
6449 | _newArrowCheck(this, _this);
|
6450 | return isValue(v) ? +v : "";
|
6451 | }.bind(this),
|
6452 | format = defaultFormat;
|
6453 |
|
6454 | if (isFunction(dataLabels.format)) {
|
6455 | format = dataLabels.format;
|
6456 | } else if (isObjectType(dataLabels.format)) {
|
6457 | if (dataLabels.format[targetId]) {
|
6458 | format = dataLabels.format[targetId] === !0 ? defaultFormat : dataLabels.format[targetId];
|
6459 | } else {
|
6460 | format = function () {
|
6461 | _newArrowCheck(this, _this);
|
6462 | return "";
|
6463 | }.bind(this);
|
6464 | }
|
6465 | }
|
6466 | return format.bind($$.api);
|
6467 | }
|
6468 | });
|
6469 | ;
|
6470 |
|
6471 |
|
6472 |
|
6473 |
|
6474 |
|
6475 |
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 |
|
6481 |
|
6482 |
|
6483 |
|
6484 |
|
6485 |
|
6486 |
|
6487 | function getLegendColor(id) {
|
6488 | var $$ = this,
|
6489 | data = $$.getDataById(id),
|
6490 | color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
6491 | return color;
|
6492 | }
|
6493 | var internals_legend = ({
|
6494 | |
6495 |
|
6496 |
|
6497 |
|
6498 | initLegend: function initLegend() {
|
6499 | var $$ = this,
|
6500 | config = $$.config,
|
6501 | $el = $$.$el;
|
6502 | $$.legendItemTextBox = {};
|
6503 | $$.state.legendHasRendered = !1;
|
6504 | if (config.legend_show) {
|
6505 | if (!config.legend_contents_bindto) {
|
6506 | $el.legend = $$.$el.svg.append("g").classed($LEGEND.legend, !0).attr("transform", $$.getTranslate("legend"));
|
6507 | }
|
6508 |
|
6509 |
|
6510 |
|
6511 | $$.updateLegend();
|
6512 | } else {
|
6513 | $$.state.hiddenLegendIds = $$.mapToIds($$.data.targets);
|
6514 | }
|
6515 | },
|
6516 | |
6517 |
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 | updateLegend: function updateLegend(targetIds, options, transitions) {
|
6524 | var $$ = this,
|
6525 | config = $$.config,
|
6526 | state = $$.state,
|
6527 | scale = $$.scale,
|
6528 | $el = $$.$el,
|
6529 | optionz = options || {
|
6530 | withTransform: !1,
|
6531 | withTransitionForTransform: !1,
|
6532 | withTransition: !1
|
6533 | };
|
6534 | optionz.withTransition = getOption(optionz, "withTransition", !0);
|
6535 | optionz.withTransitionForTransform = getOption(optionz, "withTransitionForTransform", !0);
|
6536 | if (config.legend_contents_bindto && config.legend_contents_template) {
|
6537 | $$.updateLegendTemplate();
|
6538 | } else {
|
6539 | $$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
6540 | }
|
6541 |
|
6542 |
|
6543 | $el.legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) {
|
6544 | var hide = !$$.isTargetToShow(id);
|
6545 | if (hide) {
|
6546 | this.style.opacity = null;
|
6547 | }
|
6548 | return hide;
|
6549 | });
|
6550 |
|
6551 |
|
6552 | $$.updateScales(!1, !scale.zoom);
|
6553 | $$.updateSvgSize();
|
6554 |
|
6555 |
|
6556 | $$.transformAll(optionz.withTransitionForTransform, transitions);
|
6557 | state.legendHasRendered = !0;
|
6558 | },
|
6559 | |
6560 |
|
6561 |
|
6562 |
|
6563 | updateLegendTemplate: function updateLegendTemplate() {
|
6564 | var _this = this,
|
6565 | $$ = this,
|
6566 | config = $$.config,
|
6567 | $el = $$.$el,
|
6568 | wrapper = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(config.legend_contents_bindto),
|
6569 | template = config.legend_contents_template;
|
6570 | if (!wrapper.empty()) {
|
6571 | var targets = $$.mapToIds($$.data.targets),
|
6572 | ids = [],
|
6573 | html = "";
|
6574 | targets.forEach(function (v) {
|
6575 | _newArrowCheck(this, _this);
|
6576 | var content = isFunction(template) ? template.bind($$.api)(v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, {
|
6577 | COLOR: $$.color(v),
|
6578 | TITLE: v
|
6579 | });
|
6580 | if (content) {
|
6581 | ids.push(v);
|
6582 | html += content;
|
6583 | }
|
6584 | }.bind(this));
|
6585 | var legendItem = wrapper.html(html).selectAll(function () {
|
6586 | return this.childNodes;
|
6587 | }).data(ids);
|
6588 | $$.setLegendItem(legendItem);
|
6589 | $el.legend = wrapper;
|
6590 | }
|
6591 | },
|
6592 | |
6593 |
|
6594 |
|
6595 |
|
6596 |
|
6597 | updateSizeForLegend: function updateSizeForLegend(size) {
|
6598 | var $$ = this,
|
6599 | config = $$.config,
|
6600 | _$$$state = $$.state,
|
6601 | isLegendTop = _$$$state.isLegendTop,
|
6602 | isLegendLeft = _$$$state.isLegendLeft,
|
6603 | isLegendRight = _$$$state.isLegendRight,
|
6604 | isLegendInset = _$$$state.isLegendInset,
|
6605 | current = _$$$state.current,
|
6606 | width = size.width,
|
6607 | height = size.height,
|
6608 | insetLegendPosition = {
|
6609 | top: isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : current.height - height - $$.getCurrentPaddingBottom() - config.legend_inset_y,
|
6610 | left: isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : current.width - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5
|
6611 | };
|
6612 | $$.state.margin3 = {
|
6613 | top: isLegendRight ? 0 : isLegendInset ? insetLegendPosition.top : current.height - height,
|
6614 | right: NaN,
|
6615 | bottom: 0,
|
6616 | left: isLegendRight ? current.width - width : isLegendInset ? insetLegendPosition.left : 0
|
6617 | };
|
6618 | },
|
6619 | |
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 | transformLegend: function transformLegend(withTransition) {
|
6625 | var $$ = this,
|
6626 | legend = $$.$el.legend,
|
6627 | $T = $$.$T;
|
6628 | $T(legend, withTransition).attr("transform", $$.getTranslate("legend"));
|
6629 | },
|
6630 | |
6631 |
|
6632 |
|
6633 |
|
6634 |
|
6635 | updateLegendStep: function updateLegendStep(step) {
|
6636 | this.state.legendStep = step;
|
6637 | },
|
6638 | |
6639 |
|
6640 |
|
6641 |
|
6642 |
|
6643 | updateLegendItemWidth: function updateLegendItemWidth(width) {
|
6644 | this.state.legendItemWidth = width;
|
6645 | },
|
6646 | |
6647 |
|
6648 |
|
6649 |
|
6650 |
|
6651 | updateLegendItemHeight: function updateLegendItemHeight(height) {
|
6652 | this.state.legendItemHeight = height;
|
6653 | },
|
6654 | |
6655 |
|
6656 |
|
6657 |
|
6658 |
|
6659 |
|
6660 | updateLegendItemColor: function updateLegendItemColor(id, color) {
|
6661 | var legend = this.$el.legend;
|
6662 | if (legend) {
|
6663 | legend.select("." + $LEGEND.legendItem + "-" + id + " line").style("stroke", color);
|
6664 | }
|
6665 | },
|
6666 | |
6667 |
|
6668 |
|
6669 |
|
6670 |
|
6671 | getLegendWidth: function getLegendWidth() {
|
6672 | var $$ = this,
|
6673 | _$$$state2 = $$.state,
|
6674 | width = _$$$state2.current.width,
|
6675 | isLegendRight = _$$$state2.isLegendRight,
|
6676 | isLegendInset = _$$$state2.isLegendInset,
|
6677 | legendItemWidth = _$$$state2.legendItemWidth,
|
6678 | legendStep = _$$$state2.legendStep;
|
6679 | return $$.config.legend_show ? isLegendRight || isLegendInset ? legendItemWidth * (legendStep + 1) : width : 0;
|
6680 | },
|
6681 | |
6682 |
|
6683 |
|
6684 |
|
6685 |
|
6686 | getLegendHeight: function getLegendHeight() {
|
6687 | var $$ = this,
|
6688 | _$$$state3 = $$.state,
|
6689 | current = _$$$state3.current,
|
6690 | isLegendRight = _$$$state3.isLegendRight,
|
6691 | legendItemHeight = _$$$state3.legendItemHeight,
|
6692 | legendStep = _$$$state3.legendStep;
|
6693 | return $$.config.legend_show ? isLegendRight ? current.height : Math.max(20, legendItemHeight) * (legendStep + 1) : 0;
|
6694 | },
|
6695 | |
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | opacityForUnfocusedLegend: function opacityForUnfocusedLegend(legendItem) {
|
6702 | return legendItem.classed($LEGEND.legendItemHidden) ? null : "0.3";
|
6703 | },
|
6704 | |
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 |
|
6710 | toggleFocusLegend: function toggleFocusLegend(targetIds, focus) {
|
6711 | var _this2 = this,
|
6712 | $$ = this,
|
6713 | legend = $$.$el.legend,
|
6714 | $T = $$.$T,
|
6715 | targetIdz = $$.mapToTargetIds(targetIds);
|
6716 | legend && $T(legend.selectAll("." + $LEGEND.legendItem).filter(function (id) {
|
6717 | _newArrowCheck(this, _this2);
|
6718 | return targetIdz.indexOf(id) >= 0;
|
6719 | }.bind(this)).classed($FOCUS.legendItemFocused, focus)).style("opacity", function () {
|
6720 | return focus ? null : $$.opacityForUnfocusedLegend.call($$, (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this));
|
6721 | });
|
6722 | },
|
6723 | |
6724 |
|
6725 |
|
6726 |
|
6727 | revertLegend: function revertLegend() {
|
6728 | var $$ = this,
|
6729 | legend = $$.$el.legend,
|
6730 | $T = $$.$T;
|
6731 | legend && $T(legend.selectAll("." + $LEGEND.legendItem).classed($FOCUS.legendItemFocused, !1)).style("opacity", null);
|
6732 | },
|
6733 | |
6734 |
|
6735 |
|
6736 |
|
6737 |
|
6738 | showLegend: function showLegend(targetIds) {
|
6739 | var $$ = this,
|
6740 | config = $$.config,
|
6741 | $el = $$.$el,
|
6742 | $T = $$.$T;
|
6743 | if (!config.legend_show) {
|
6744 | config.legend_show = !0;
|
6745 | $el.legend ? $el.legend.style("visibility", null) : $$.initLegend();
|
6746 | $$.state.legendHasRendered || $$.updateLegend();
|
6747 | }
|
6748 | $$.removeHiddenLegendIds(targetIds);
|
6749 | $T($el.legend.selectAll($$.selectorLegends(targetIds)).style("visibility", null)).style("opacity", null);
|
6750 | },
|
6751 | |
6752 |
|
6753 |
|
6754 |
|
6755 |
|
6756 | hideLegend: function hideLegend(targetIds) {
|
6757 | var $$ = this,
|
6758 | config = $$.config,
|
6759 | legend = $$.$el.legend;
|
6760 | if (config.legend_show && isEmpty(targetIds)) {
|
6761 | config.legend_show = !1;
|
6762 | legend.style("visibility", "hidden");
|
6763 | }
|
6764 | $$.addHiddenLegendIds(targetIds);
|
6765 | legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden");
|
6766 | },
|
6767 | |
6768 |
|
6769 |
|
6770 |
|
6771 |
|
6772 |
|
6773 |
|
6774 | getLegendItemTextBox: function getLegendItemTextBox(id, textElement) {
|
6775 | var $$ = this,
|
6776 | cache = $$.cache,
|
6777 | state = $$.state,
|
6778 | data,
|
6779 | cacheKey = KEY.legendItemTextBox;
|
6780 | if (id) {
|
6781 | data = !state.redrawing && cache.get(cacheKey) || {};
|
6782 | if (!data[id]) {
|
6783 | data[id] = $$.getTextRect(textElement, $LEGEND.legendItem);
|
6784 | cache.add(cacheKey, data);
|
6785 | }
|
6786 | data = data[id];
|
6787 | }
|
6788 | return data;
|
6789 | },
|
6790 | |
6791 |
|
6792 |
|
6793 |
|
6794 |
|
6795 | setLegendItem: function setLegendItem(item) {
|
6796 | var _this3 = this,
|
6797 | $$ = this,
|
6798 | $el = $$.$el,
|
6799 | api = $$.api,
|
6800 | config = $$.config,
|
6801 | state = $$.state,
|
6802 | isTouch = state.inputType === "touch",
|
6803 | hasGauge = $$.hasType("gauge"),
|
6804 | useCssRule = config.boost_useCssRule;
|
6805 | item.attr("class", function (id) {
|
6806 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
6807 | itemClass = !node.empty() && node.attr("class") || "";
|
6808 | return itemClass + $$.generateClass($LEGEND.legendItem, id);
|
6809 | }).style("visibility", function (id) {
|
6810 | _newArrowCheck(this, _this3);
|
6811 | return $$.isLegendToShow(id) ? null : "hidden";
|
6812 | }.bind(this));
|
6813 | if (config.interaction_enabled) {
|
6814 | if (useCssRule) {
|
6815 | [["." + $LEGEND.legendItem, "cursor:pointer"], ["." + $LEGEND.legendItem + " text", "pointer-events:none"], ["." + $LEGEND.legendItemPoint + " text", "pointer-events:none"], ["." + $LEGEND.legendItemTile, "pointer-events:none"], ["." + $LEGEND.legendItemEvent, "fill-opacity:0"]].forEach(function (v) {
|
6816 | _newArrowCheck(this, _this3);
|
6817 | var selector = v[0],
|
6818 | props = v[1];
|
6819 | $$.setCssRule(!1, selector, [props])($el.legend);
|
6820 | }.bind(this));
|
6821 | }
|
6822 | item.style("cursor", $$.getStylePropValue("pointer")).on("click", function (event, id) {
|
6823 | if (!callFn(config.legend_item_onclick, api, id)) {
|
6824 | if (event.altKey) {
|
6825 | api.hide();
|
6826 | api.show(id);
|
6827 | } else {
|
6828 | api.toggle(id);
|
6829 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !1);
|
6830 | }
|
6831 | }
|
6832 | isTouch && $$.hideTooltip();
|
6833 | });
|
6834 | isTouch || item.on("mouseout", function (event, id) {
|
6835 | if (!callFn(config.legend_item_onout, api, id)) {
|
6836 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !1);
|
6837 | if (hasGauge) {
|
6838 | $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
|
6839 | }
|
6840 | $$.api.revert();
|
6841 | }
|
6842 | }).on("mouseover", function (event, id) {
|
6843 | if (!callFn(config.legend_item_onover, api, id)) {
|
6844 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !0);
|
6845 | if (hasGauge) {
|
6846 | $$.markOverlapped(id, $$, "." + $GAUGE.gaugeValue);
|
6847 | }
|
6848 | if (!state.transiting && $$.isTargetToShow(id)) {
|
6849 | api.focus(id);
|
6850 | }
|
6851 | }
|
6852 | });
|
6853 | }
|
6854 | },
|
6855 | |
6856 |
|
6857 |
|
6858 |
|
6859 |
|
6860 |
|
6861 | updateLegendElement: function updateLegendElement(targetIds, options) {
|
6862 | var _this4 = this,
|
6863 | $$ = this,
|
6864 | config = $$.config,
|
6865 | state = $$.state,
|
6866 | legend = $$.$el.legend,
|
6867 | $T = $$.$T,
|
6868 | legendType = config.legend_item_tile_type,
|
6869 | isRectangle = legendType !== "circle",
|
6870 | legendItemR = config.legend_item_tile_r,
|
6871 | itemTileSize = {
|
6872 | width: isRectangle ? config.legend_item_tile_width : legendItemR * 2,
|
6873 | height: isRectangle ? config.legend_item_tile_height : legendItemR * 2
|
6874 | },
|
6875 | dimension = {
|
6876 | padding: {
|
6877 | top: 4,
|
6878 | right: 10
|
6879 | },
|
6880 | max: {
|
6881 | width: 0,
|
6882 | height: 0
|
6883 | },
|
6884 | posMin: 10,
|
6885 | step: 0,
|
6886 | tileWidth: itemTileSize.width + 5,
|
6887 | totalLength: 0
|
6888 | },
|
6889 | sizes = {
|
6890 | offsets: {},
|
6891 | widths: {},
|
6892 | heights: {},
|
6893 | margins: [0],
|
6894 | steps: {}
|
6895 | },
|
6896 | xForLegend,
|
6897 | yForLegend,
|
6898 | background,
|
6899 | targetIdz = targetIds.filter(function (id) {
|
6900 | _newArrowCheck(this, _this4);
|
6901 | return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
|
6902 | }.bind(this)),
|
6903 | withTransition = options.withTransition,
|
6904 | updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes);
|
6905 | if (state.isLegendInset) {
|
6906 | dimension.step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length;
|
6907 | $$.updateLegendStep(dimension.step);
|
6908 | }
|
6909 | if (state.isLegendRight) {
|
6910 | xForLegend = function (id) {
|
6911 | _newArrowCheck(this, _this4);
|
6912 | return dimension.max.width * sizes.steps[id];
|
6913 | }.bind(this);
|
6914 | yForLegend = function (id) {
|
6915 | _newArrowCheck(this, _this4);
|
6916 | return sizes.margins[sizes.steps[id]] + sizes.offsets[id];
|
6917 | }.bind(this);
|
6918 | } else if (state.isLegendInset) {
|
6919 | xForLegend = function (id) {
|
6920 | _newArrowCheck(this, _this4);
|
6921 | return dimension.max.width * sizes.steps[id] + 10;
|
6922 | }.bind(this);
|
6923 | yForLegend = function (id) {
|
6924 | _newArrowCheck(this, _this4);
|
6925 | return sizes.margins[sizes.steps[id]] + sizes.offsets[id];
|
6926 | }.bind(this);
|
6927 | } else {
|
6928 | xForLegend = function (id) {
|
6929 | _newArrowCheck(this, _this4);
|
6930 | return sizes.margins[sizes.steps[id]] + sizes.offsets[id];
|
6931 | }.bind(this);
|
6932 | yForLegend = function (id) {
|
6933 | _newArrowCheck(this, _this4);
|
6934 | return dimension.max.height * sizes.steps[id];
|
6935 | }.bind(this);
|
6936 | }
|
6937 | var posFn = {
|
6938 | xText: function xText(id, i) {
|
6939 | _newArrowCheck(this, _this4);
|
6940 | return xForLegend(id, i) + 4 + itemTileSize.width;
|
6941 | }.bind(this),
|
6942 | xRect: function xRect(id, i) {
|
6943 | _newArrowCheck(this, _this4);
|
6944 | return xForLegend(id, i);
|
6945 | }.bind(this),
|
6946 | x1Tile: function x1Tile(id, i) {
|
6947 | _newArrowCheck(this, _this4);
|
6948 | return xForLegend(id, i) - 2;
|
6949 | }.bind(this),
|
6950 | x2Tile: function x2Tile(id, i) {
|
6951 | _newArrowCheck(this, _this4);
|
6952 | return xForLegend(id, i) - 2 + itemTileSize.width;
|
6953 | }.bind(this),
|
6954 | yText: function yText(id, i) {
|
6955 | _newArrowCheck(this, _this4);
|
6956 | return yForLegend(id, i) + 9;
|
6957 | }.bind(this),
|
6958 | yRect: function yRect(id, i) {
|
6959 | _newArrowCheck(this, _this4);
|
6960 | return yForLegend(id, i) - 5;
|
6961 | }.bind(this),
|
6962 | yTile: function yTile(id, i) {
|
6963 | _newArrowCheck(this, _this4);
|
6964 | return yForLegend(id, i) + 4;
|
6965 | }.bind(this)
|
6966 | };
|
6967 | $$.generateLegendItem(targetIdz, itemTileSize, updatePositions, posFn);
|
6968 |
|
6969 |
|
6970 | background = legend.select("." + $LEGEND.legendBackground + " rect");
|
6971 | if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) {
|
6972 | background = legend.insert("g", "." + $LEGEND.legendItem).attr("class", $LEGEND.legendBackground).append("rect");
|
6973 | }
|
6974 | var texts = legend.selectAll("text").data(targetIdz).text(function (id) {
|
6975 | _newArrowCheck(this, _this4);
|
6976 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
6977 | }.bind(this))
|
6978 | .each(function (id, i) {
|
6979 | updatePositions(this, id, i);
|
6980 | });
|
6981 | $T(texts, withTransition).attr("x", posFn.xText).attr("y", posFn.yText);
|
6982 | var rects = legend.selectAll("rect." + $LEGEND.legendItemEvent).data(targetIdz);
|
6983 | $T(rects, withTransition).attr("width", function (id) {
|
6984 | _newArrowCheck(this, _this4);
|
6985 | return sizes.widths[id];
|
6986 | }.bind(this)).attr("height", function (id) {
|
6987 | _newArrowCheck(this, _this4);
|
6988 | return sizes.heights[id];
|
6989 | }.bind(this)).attr("x", posFn.xRect).attr("y", posFn.yRect);
|
6990 |
|
6991 |
|
6992 | $$.updateLegendItemPos(targetIdz, withTransition, posFn);
|
6993 | if (background) {
|
6994 | $T(background, withTransition).attr("height", $$.getLegendHeight() - 12).attr("width", dimension.max.width * (dimension.step + 1) + 10);
|
6995 | }
|
6996 |
|
6997 |
|
6998 | $$.updateLegendItemWidth(dimension.max.width);
|
6999 | $$.updateLegendItemHeight(dimension.max.height);
|
7000 | $$.updateLegendStep(dimension.step);
|
7001 | },
|
7002 | |
7003 |
|
7004 |
|
7005 |
|
7006 |
|
7007 |
|
7008 |
|
7009 |
|
7010 | getUpdateLegendPositions: function getUpdateLegendPositions(targetIdz, dimension, sizes) {
|
7011 | var $$ = this,
|
7012 | config = $$.config,
|
7013 | state = $$.state,
|
7014 | isLegendRightOrInset = state.isLegendRight || state.isLegendInset;
|
7015 | return function (textElement, id, index) {
|
7016 | var _this5 = this,
|
7017 | isLast = index === targetIdz.length - 1,
|
7018 | box = $$.getLegendItemTextBox(id, textElement),
|
7019 | itemWidth = box.width + dimension.tileWidth + (isLast && !isLegendRightOrInset ? 0 : dimension.padding.right) + config.legend_padding,
|
7020 | itemHeight = box.height + dimension.padding.top,
|
7021 | itemLength = isLegendRightOrInset ? itemHeight : itemWidth,
|
7022 | areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(),
|
7023 | margin,
|
7024 | updateValues = function (id2, withoutStep) {
|
7025 | if (!withoutStep) {
|
7026 | margin = (areaLength - dimension.totalLength - itemLength) / 2;
|
7027 | if (margin < dimension.posMin) {
|
7028 | margin = (areaLength - itemLength) / 2;
|
7029 | dimension.totalLength = 0;
|
7030 | dimension.step++;
|
7031 | }
|
7032 | }
|
7033 | sizes.steps[id2] = dimension.step;
|
7034 | sizes.margins[dimension.step] = state.isLegendInset ? 10 : margin;
|
7035 | sizes.offsets[id2] = dimension.totalLength;
|
7036 | dimension.totalLength += itemLength;
|
7037 | };
|
7038 | if (index === 0) {
|
7039 | dimension.totalLength = 0;
|
7040 | dimension.step = 0;
|
7041 | dimension.max.width = 0;
|
7042 | dimension.max.height = 0;
|
7043 | }
|
7044 | if (config.legend_show && !$$.isLegendToShow(id)) {
|
7045 | sizes.widths[id] = 0;
|
7046 | sizes.heights[id] = 0;
|
7047 | sizes.steps[id] = 0;
|
7048 | sizes.offsets[id] = 0;
|
7049 | return;
|
7050 | }
|
7051 | sizes.widths[id] = itemWidth;
|
7052 | sizes.heights[id] = itemHeight;
|
7053 | if (!dimension.max.width || itemWidth >= dimension.max.width) {
|
7054 | dimension.max.width = itemWidth;
|
7055 | }
|
7056 | if (!dimension.max.height || itemHeight >= dimension.max.height) {
|
7057 | dimension.max.height = itemHeight;
|
7058 | }
|
7059 | var maxLength = isLegendRightOrInset ? dimension.max.height : dimension.max.width;
|
7060 | if (config.legend_equally) {
|
7061 | Object.keys(sizes.widths).forEach(function (id2) {
|
7062 | _newArrowCheck(this, _this5);
|
7063 | return sizes.widths[id2] = dimension.max.width;
|
7064 | }.bind(this));
|
7065 | Object.keys(sizes.heights).forEach(function (id2) {
|
7066 | _newArrowCheck(this, _this5);
|
7067 | return sizes.heights[id2] = dimension.max.height;
|
7068 | }.bind(this));
|
7069 | margin = (areaLength - maxLength * targetIdz.length) / 2;
|
7070 | if (margin < dimension.posMin) {
|
7071 | dimension.totalLength = 0;
|
7072 | dimension.step = 0;
|
7073 | targetIdz.forEach(function (id2) {
|
7074 | _newArrowCheck(this, _this5);
|
7075 | return updateValues(id2);
|
7076 | }.bind(this));
|
7077 | } else {
|
7078 | updateValues(id, !0);
|
7079 | }
|
7080 | } else {
|
7081 | updateValues(id);
|
7082 | }
|
7083 | };
|
7084 | },
|
7085 | |
7086 |
|
7087 |
|
7088 |
|
7089 |
|
7090 |
|
7091 |
|
7092 |
|
7093 | generateLegendItem: function generateLegendItem(targetIdz, itemTileSize, updatePositions, posFn) {
|
7094 | var _this6 = this,
|
7095 | $$ = this,
|
7096 | config = $$.config,
|
7097 | state = $$.state,
|
7098 | legend = $$.$el.legend,
|
7099 | usePoint = config.legend_usePoint,
|
7100 | legendItemR = config.legend_item_tile_r,
|
7101 | legendType = config.legend_item_tile_type,
|
7102 | isRectangle = legendType !== "circle",
|
7103 | isLegendRightOrInset = state.isLegendRight || state.isLegendInset,
|
7104 | l = legend.selectAll("." + $LEGEND.legendItem).data(targetIdz).enter().append("g");
|
7105 | $$.setLegendItem(l);
|
7106 | l.append("text").text(function (id) {
|
7107 | _newArrowCheck(this, _this6);
|
7108 | return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
7109 | }.bind(this)).each(function (id, i) {
|
7110 | updatePositions(this, id, i);
|
7111 | }).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yText);
|
7112 | l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? posFn.xRect : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yRect);
|
7113 | if (usePoint) {
|
7114 | var _ids = [];
|
7115 | l.append(function (d) {
|
7116 | _newArrowCheck(this, _this6);
|
7117 | var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
7118 | _ids.indexOf(d) === -1 && _ids.push(d);
|
7119 | var point = pattern[_ids.indexOf(d) % pattern.length];
|
7120 | if (point === "rectangle") {
|
7121 | point = "rect";
|
7122 | }
|
7123 | return browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use");
|
7124 | }.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).attr("href", function (data, idx, selection) {
|
7125 | _newArrowCheck(this, _this6);
|
7126 | var node = selection[idx],
|
7127 | nodeName = node.nodeName.toLowerCase(),
|
7128 | id = $$.getTargetSelectorSuffix(data);
|
7129 | return nodeName === "use" ? "#" + state.datetimeId + "-point" + id : undefined;
|
7130 | }.bind(this));
|
7131 | } else {
|
7132 | l.append(isRectangle ? "line" : legendType).attr("class", $LEGEND.legendItemTile).style("stroke", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).call(function (selection) {
|
7133 | _newArrowCheck(this, _this6);
|
7134 | if (legendType === "circle") {
|
7135 | selection.attr("r", legendItemR).style("fill", getLegendColor.bind($$)).attr("cx", isLegendRightOrInset ? posFn.x2Tile : -200).attr("cy", isLegendRightOrInset ? -200 : posFn.yTile);
|
7136 | } else if (isRectangle) {
|
7137 | selection.attr("stroke-width", itemTileSize.height).attr("x1", isLegendRightOrInset ? posFn.x1Tile : -200).attr("y1", isLegendRightOrInset ? -200 : posFn.yTile).attr("x2", isLegendRightOrInset ? posFn.x2Tile : -200).attr("y2", isLegendRightOrInset ? -200 : posFn.yTile);
|
7138 | }
|
7139 | }.bind(this));
|
7140 | }
|
7141 | },
|
7142 | |
7143 |
|
7144 |
|
7145 |
|
7146 |
|
7147 |
|
7148 |
|
7149 | updateLegendItemPos: function updateLegendItemPos(targetIdz, withTransition, posFn) {
|
7150 | var _this8 = this,
|
7151 | $$ = this,
|
7152 | config = $$.config,
|
7153 | legend = $$.$el.legend,
|
7154 | $T = $$.$T,
|
7155 | usePoint = config.legend_usePoint,
|
7156 | legendType = config.legend_item_tile_type;
|
7157 | if (usePoint) {
|
7158 | var tiles = legend.selectAll("." + $LEGEND.legendItemPoint).data(targetIdz);
|
7159 | $T(tiles, withTransition).each(function () {
|
7160 | var _this7 = this,
|
7161 | nodeName = this.nodeName.toLowerCase(),
|
7162 | pointR = config.point_r,
|
7163 | x = "x",
|
7164 | y = "y",
|
7165 | xOffset = 2,
|
7166 | yOffset = 2.5,
|
7167 | radius = null,
|
7168 | width = null,
|
7169 | height = null;
|
7170 | if (nodeName === "circle") {
|
7171 | var size = pointR * .2;
|
7172 | x = "cx";
|
7173 | y = "cy";
|
7174 | radius = pointR + size;
|
7175 | xOffset = pointR * 2;
|
7176 | yOffset = -size;
|
7177 | } else if (nodeName === "rect") {
|
7178 | var _size = pointR * 2.5;
|
7179 | width = _size;
|
7180 | height = _size;
|
7181 | yOffset = 3;
|
7182 | }
|
7183 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr(x, function (d) {
|
7184 | _newArrowCheck(this, _this7);
|
7185 | return posFn.x1Tile(d) + xOffset;
|
7186 | }.bind(this)).attr(y, function (d) {
|
7187 | _newArrowCheck(this, _this7);
|
7188 | return posFn.yTile(d) - yOffset;
|
7189 | }.bind(this)).attr("r", radius).attr("width", width).attr("height", height);
|
7190 | });
|
7191 | } else {
|
7192 | var _tiles = legend.selectAll("." + $LEGEND.legendItemTile).data(targetIdz);
|
7193 | $T(_tiles, withTransition).style("stroke", getLegendColor.bind($$)).call(function (selection) {
|
7194 | var _this9 = this;
|
7195 | _newArrowCheck(this, _this8);
|
7196 | if (legendType === "circle") {
|
7197 | selection.attr("cx", function (d) {
|
7198 | _newArrowCheck(this, _this9);
|
7199 | var x2 = posFn.x2Tile(d);
|
7200 | return x2 - (x2 - posFn.x1Tile(d)) / 2;
|
7201 | }.bind(this)).attr("cy", posFn.yTile);
|
7202 | } else if (legendType !== "circle") {
|
7203 | selection.attr("x1", posFn.x1Tile).attr("y1", posFn.yTile).attr("x2", posFn.x2Tile).attr("y2", posFn.yTile);
|
7204 | }
|
7205 | }.bind(this));
|
7206 | }
|
7207 | }
|
7208 | });
|
7209 |
|
7210 | var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_ = __webpack_require__(8);
|
7211 | ;
|
7212 |
|
7213 |
|
7214 |
|
7215 |
|
7216 |
|
7217 |
|
7218 |
|
7219 |
|
7220 |
|
7221 | var redraw = ({
|
7222 | redraw: function redraw(options) {
|
7223 | var _$$$axis,
|
7224 | _this = this;
|
7225 | if (options === void 0) {
|
7226 | options = {};
|
7227 | }
|
7228 | var $$ = this,
|
7229 | config = $$.config,
|
7230 | state = $$.state,
|
7231 | $el = $$.$el,
|
7232 | main = $el.main;
|
7233 | state.redrawing = !0;
|
7234 | var targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
7235 | _options = options,
|
7236 | flow = _options.flow,
|
7237 | initializing = _options.initializing,
|
7238 | wth = $$.getWithOption(options),
|
7239 | duration = wth.Transition ? config.transition_duration : 0,
|
7240 | durationForExit = wth.TransitionForExit ? duration : 0,
|
7241 | durationForAxis = wth.TransitionForAxis ? duration : 0,
|
7242 | transitions = (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.generateTransitions(durationForAxis);
|
7243 | $$.updateSizes(initializing);
|
7244 |
|
7245 |
|
7246 | if (wth.Legend && config.legend_show) {
|
7247 | options.withTransition = !!duration;
|
7248 | $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
|
7249 | } else if (wth.Dimension) {
|
7250 |
|
7251 |
|
7252 | $$.updateDimension(!0);
|
7253 | }
|
7254 |
|
7255 |
|
7256 | if (!$$.hasArcType() || state.hasRadar) {
|
7257 | $$.updateCircleY && ($$.circleY = $$.updateCircleY());
|
7258 | }
|
7259 |
|
7260 |
|
7261 | if (state.hasAxis) {
|
7262 |
|
7263 | $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
|
7264 |
|
7265 |
|
7266 | config.data_empty_label_text && main.select("text." + $TEXT.text + "." + $COMMON.empty).attr("x", state.width / 2).attr("y", state.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null);
|
7267 |
|
7268 |
|
7269 | $$.hasGrid() && $$.updateGrid();
|
7270 |
|
7271 |
|
7272 | config.regions.length && $$.updateRegion();
|
7273 | ["bar", "candlestick", "line", "area"].forEach(function (v) {
|
7274 | _newArrowCheck(this, _this);
|
7275 | var name = capitalize(v);
|
7276 | if (/^(line|area)$/.test(v) && $$.hasTypeOf(name) || $$.hasType(v)) {
|
7277 | $$["update" + name](wth.TransitionForExit);
|
7278 | }
|
7279 | }.bind(this));
|
7280 |
|
7281 |
|
7282 | $el.text && main.selectAll("." + $SELECT.selectedCircles).filter($$.isBarType.bind($$)).selectAll("circle").remove();
|
7283 |
|
7284 |
|
7285 | if (config.interaction_enabled && !flow && wth.EventRect) {
|
7286 | $$.redrawEventRect();
|
7287 | $$.bindZoomEvent == null ? void 0 : $$.bindZoomEvent();
|
7288 | }
|
7289 | } else {
|
7290 |
|
7291 | $el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform);
|
7292 |
|
7293 |
|
7294 | $el.radar && $$.redrawRadar();
|
7295 |
|
7296 |
|
7297 | $el.polar && $$.redrawPolar();
|
7298 | }
|
7299 |
|
7300 |
|
7301 | if (!state.resizing && ($$.hasPointType() || state.hasRadar)) {
|
7302 | $$.updateCircle();
|
7303 | }
|
7304 |
|
7305 |
|
7306 | $$.hasDataLabel() && !$$.hasArcType(null, ["radar"]) && $$.updateText();
|
7307 |
|
7308 |
|
7309 | $$.redrawTitle == null ? void 0 : $$.redrawTitle();
|
7310 | initializing && $$.updateTypesElements();
|
7311 | $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart);
|
7312 | $$.callPluginHook("$redraw", options, duration);
|
7313 | },
|
7314 | |
7315 |
|
7316 |
|
7317 |
|
7318 |
|
7319 |
|
7320 |
|
7321 |
|
7322 | generateRedrawList: function generateRedrawList(targets, flow, duration, withSubchart) {
|
7323 | var _this2 = this,
|
7324 | $$ = this,
|
7325 | config = $$.config,
|
7326 | state = $$.state,
|
7327 | shape = $$.getDrawShape();
|
7328 | if (state.hasAxis) {
|
7329 |
|
7330 | config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape);
|
7331 | }
|
7332 |
|
7333 |
|
7334 | var flowFn = flow && $$.generateFlow({
|
7335 | targets: targets,
|
7336 | flow: flow,
|
7337 | duration: flow.duration,
|
7338 | shape: shape,
|
7339 | xv: $$.xv.bind($$)
|
7340 | }),
|
7341 | withTransition = (duration || flowFn) && isTabVisible(),
|
7342 | redrawList = $$.getRedrawList(shape, flow, flowFn, withTransition),
|
7343 | afterRedraw = function () {
|
7344 | _newArrowCheck(this, _this2);
|
7345 | flowFn && flowFn();
|
7346 | state.redrawing = !1;
|
7347 | callFn(config.onrendered, $$.api);
|
7348 | }.bind(this);
|
7349 | if (afterRedraw) {
|
7350 |
|
7351 | if (withTransition && redrawList.length) {
|
7352 |
|
7353 | var waitForDraw = generateWait();
|
7354 |
|
7355 |
|
7356 | (0,external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_.transition)().duration(duration).each(function () {
|
7357 | var _this3 = this;
|
7358 | _newArrowCheck(this, _this2);
|
7359 | redrawList.reduce(function (acc, t1) {
|
7360 | _newArrowCheck(this, _this3);
|
7361 | return acc.concat(t1);
|
7362 | }.bind(this), []).forEach(function (t) {
|
7363 | _newArrowCheck(this, _this3);
|
7364 | return waitForDraw.add(t);
|
7365 | }.bind(this));
|
7366 | }.bind(this)).call(waitForDraw, afterRedraw);
|
7367 | } else if (!state.transiting) {
|
7368 | afterRedraw();
|
7369 | }
|
7370 | }
|
7371 |
|
7372 |
|
7373 | $$.mapToIds($$.data.targets).forEach(function (id) {
|
7374 | _newArrowCheck(this, _this2);
|
7375 | state.withoutFadeIn[id] = !0;
|
7376 | }.bind(this));
|
7377 | },
|
7378 | getRedrawList: function getRedrawList(shape, flow, flowFn, withTransition) {
|
7379 | var _this4 = this,
|
7380 | $$ = this,
|
7381 | config = $$.config,
|
7382 | _$$$state = $$.state,
|
7383 | hasAxis = _$$$state.hasAxis,
|
7384 | hasRadar = _$$$state.hasRadar,
|
7385 | grid = $$.$el.grid,
|
7386 | _shape$pos = shape.pos,
|
7387 | cx = _shape$pos.cx,
|
7388 | cy = _shape$pos.cy,
|
7389 | xForText = _shape$pos.xForText,
|
7390 | yForText = _shape$pos.yForText,
|
7391 | list = [];
|
7392 | if (hasAxis) {
|
7393 | if (config.grid_x_lines.length || config.grid_y_lines.length) {
|
7394 | list.push($$.redrawGrid(withTransition));
|
7395 | }
|
7396 | if (config.regions.length) {
|
7397 | list.push($$.redrawRegion(withTransition));
|
7398 | }
|
7399 | Object.keys(shape.type).forEach(function (v) {
|
7400 | _newArrowCheck(this, _this4);
|
7401 | var name = capitalize(v),
|
7402 | drawFn = shape.type[v];
|
7403 | if (/^(area|line)$/.test(v) && $$.hasTypeOf(name) || $$.hasType(v)) {
|
7404 | list.push($$["redraw" + name](drawFn, withTransition));
|
7405 | }
|
7406 | }.bind(this));
|
7407 | !flow && grid.main && list.push($$.updateGridFocus());
|
7408 | }
|
7409 | if (!$$.hasArcType() || hasRadar) {
|
7410 | notEmpty(config.data_labels) && config.data_labels !== !1 && list.push($$.redrawText(xForText, yForText, flow, withTransition));
|
7411 | }
|
7412 | if (($$.hasPointType() || hasRadar) && !config.point_focus_only) {
|
7413 | $$.redrawCircle && list.push($$.redrawCircle(cx, cy, withTransition, flowFn));
|
7414 | }
|
7415 | return list;
|
7416 | },
|
7417 | updateAndRedraw: function updateAndRedraw(options) {
|
7418 | if (options === void 0) {
|
7419 | options = {};
|
7420 | }
|
7421 | var $$ = this,
|
7422 | config = $$.config,
|
7423 | state = $$.state,
|
7424 | transitions;
|
7425 |
|
7426 | options.withTransition = getOption(options, "withTransition", !0);
|
7427 | options.withTransform = getOption(options, "withTransform", !1);
|
7428 | options.withLegend = getOption(options, "withLegend", !1);
|
7429 |
|
7430 |
|
7431 | options.withUpdateXDomain = !0;
|
7432 | options.withUpdateOrgXDomain = !0;
|
7433 | options.withTransitionForExit = !1;
|
7434 | options.withTransitionForTransform = getOption(options, "withTransitionForTransform", options.withTransition);
|
7435 |
|
7436 |
|
7437 | if (!(options.withLegend && config.legend_show)) {
|
7438 | if (state.hasAxis) {
|
7439 | transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0);
|
7440 | }
|
7441 |
|
7442 |
|
7443 | $$.updateScales();
|
7444 | $$.updateSvgSize();
|
7445 |
|
7446 |
|
7447 | $$.transformAll(options.withTransitionForTransform, transitions);
|
7448 | }
|
7449 |
|
7450 |
|
7451 | $$.redraw(options, transitions);
|
7452 | },
|
7453 | |
7454 |
|
7455 |
|
7456 |
|
7457 | redrawWithoutRescale: function redrawWithoutRescale() {
|
7458 | this.redraw({
|
7459 | withY: !1,
|
7460 | withDimension: !1,
|
7461 | withLegend: !1,
|
7462 | withSubchart: !1,
|
7463 | withEventRect: !1,
|
7464 | withTransitionForAxis: !1
|
7465 | });
|
7466 | }
|
7467 | });
|
7468 | ;
|
7469 |
|
7470 |
|
7471 |
|
7472 |
|
7473 |
|
7474 |
|
7475 |
|
7476 |
|
7477 |
|
7478 |
|
7479 |
|
7480 |
|
7481 |
|
7482 |
|
7483 |
|
7484 | function getScale(type, min, max) {
|
7485 | if (type === void 0) {
|
7486 | type = "linear";
|
7487 | }
|
7488 | if (min === void 0) {
|
7489 | min = 0;
|
7490 | }
|
7491 | if (max === void 0) {
|
7492 | max = 1;
|
7493 | }
|
7494 | var scale = {
|
7495 | linear: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear,
|
7496 | log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSymlog,
|
7497 | _log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLog,
|
7498 | time: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleTime,
|
7499 | utc: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleUtc
|
7500 | }[type]();
|
7501 | scale.type = type;
|
7502 | /_?log/.test(type) && scale.clamp(!0);
|
7503 | return scale.range([min, max]);
|
7504 | }
|
7505 | var scale = ({
|
7506 | |
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 | getXScale: function getXScale(min, max, domain, offset) {
|
7516 | var $$ = this,
|
7517 | scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
|
7518 | return $$.getCustomizedScale(domain ? scale.domain(domain) : scale, offset);
|
7519 | },
|
7520 | |
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 | getYScale: function getYScale(id, min, max, domain) {
|
7530 | var $$ = this,
|
7531 | scale = getScale($$.axis.getAxisType(id), min, max);
|
7532 | domain && scale.domain(domain);
|
7533 | return scale;
|
7534 | },
|
7535 | |
7536 |
|
7537 |
|
7538 |
|
7539 |
|
7540 |
|
7541 |
|
7542 | getYScaleById: function getYScaleById(id, isSub) {
|
7543 | if (isSub === void 0) {
|
7544 | isSub = !1;
|
7545 | }
|
7546 | var isY2 = this.axis.getId(id) === "y2",
|
7547 | key = isSub ? isY2 ? "subY2" : "subY" : isY2 ? "y2" : "y";
|
7548 | return this.scale[key];
|
7549 | },
|
7550 | |
7551 |
|
7552 |
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 | getCustomizedScale: function getCustomizedScale(scaleValue, offsetValue) {
|
7558 | var _this = this,
|
7559 | $$ = this,
|
7560 | offset = offsetValue || function () {
|
7561 | _newArrowCheck(this, _this);
|
7562 | return $$.axis.x.tickOffset();
|
7563 | }.bind(this),
|
7564 | scale = function (d, raw) {
|
7565 | var v = scaleValue(d) + offset();
|
7566 | return raw ? v : Math.ceil(v);
|
7567 | };
|
7568 |
|
7569 | for (var key in scaleValue) {
|
7570 | scale[key] = scaleValue[key];
|
7571 | }
|
7572 | scale.orgDomain = function () {
|
7573 | _newArrowCheck(this, _this);
|
7574 | return scaleValue.domain();
|
7575 | }.bind(this);
|
7576 | scale.orgScale = function () {
|
7577 | _newArrowCheck(this, _this);
|
7578 | return scaleValue;
|
7579 | }.bind(this);
|
7580 |
|
7581 |
|
7582 | if ($$.axis.isCategorized()) {
|
7583 | scale.domain = function (domainValue) {
|
7584 | var domain = domainValue;
|
7585 | if (!arguments.length) {
|
7586 | domain = this.orgDomain();
|
7587 | return [domain[0], domain[1] + 1];
|
7588 | }
|
7589 | scaleValue.domain(domain);
|
7590 | return scale;
|
7591 | };
|
7592 | }
|
7593 | return scale;
|
7594 | },
|
7595 | |
7596 |
|
7597 |
|
7598 |
|
7599 |
|
7600 |
|
7601 | updateScales: function updateScales(isInit, updateXDomain) {
|
7602 | var _this2 = this;
|
7603 | if (updateXDomain === void 0) {
|
7604 | updateXDomain = !0;
|
7605 | }
|
7606 | var $$ = this,
|
7607 | axis = $$.axis,
|
7608 | config = $$.config,
|
7609 | format = $$.format,
|
7610 | org = $$.org,
|
7611 | scale = $$.scale,
|
7612 | _$$$state = $$.state,
|
7613 | width = _$$$state.width,
|
7614 | height = _$$$state.height,
|
7615 | width2 = _$$$state.width2,
|
7616 | height2 = _$$$state.height2,
|
7617 | hasAxis = _$$$state.hasAxis;
|
7618 | if (hasAxis) {
|
7619 | var _scale$x,
|
7620 | isRotated = config.axis_rotated,
|
7621 | resettedPadding = $$.getResettedPadding(1),
|
7622 | min = {
|
7623 | x: isRotated ? resettedPadding : 0,
|
7624 | y: isRotated ? 0 : height,
|
7625 | subX: isRotated ? 1 : 0,
|
7626 | subY: isRotated ? 0 : height2
|
7627 | },
|
7628 | max = {
|
7629 | x: isRotated ? height : width,
|
7630 | y: isRotated ? width : resettedPadding,
|
7631 | subX: isRotated ? height : width,
|
7632 | subY: isRotated ? width2 : 1
|
7633 | },
|
7634 | xDomain = updateXDomain && ((_scale$x = scale.x) == null ? void 0 : _scale$x.orgDomain()),
|
7635 | xSubDomain = updateXDomain && org.xDomain;
|
7636 | scale.x = $$.getXScale(min.x, max.x, xDomain, function () {
|
7637 | _newArrowCheck(this, _this2);
|
7638 | return axis.x.tickOffset();
|
7639 | }.bind(this));
|
7640 | scale.subX = $$.getXScale(min.x, max.x, xSubDomain, function (d) {
|
7641 | var _axis$subX;
|
7642 | _newArrowCheck(this, _this2);
|
7643 | return d % 1 ? 0 : ((_axis$subX = axis.subX) != null ? _axis$subX : axis.x).tickOffset();
|
7644 | }.bind(this));
|
7645 | format.xAxisTick = axis.getXAxisTickFormat();
|
7646 | format.subXAxisTick = axis.getXAxisTickFormat(!0);
|
7647 | axis.setAxis("x", scale.x, config.axis_x_tick_outer, isInit);
|
7648 | if (config.subchart_show) {
|
7649 | axis.setAxis("subX", scale.subX, config.axis_x_tick_outer, isInit);
|
7650 | }
|
7651 |
|
7652 |
|
7653 | scale.y = $$.getYScale("y", min.y, max.y, scale.y ? scale.y.domain() : config.axis_y_default);
|
7654 | scale.subY = $$.getYScale("y", min.subY, max.subY, scale.subY ? scale.subY.domain() : config.axis_y_default);
|
7655 | axis.setAxis("y", scale.y, config.axis_y_tick_outer, isInit);
|
7656 |
|
7657 |
|
7658 | if (config.axis_y2_show) {
|
7659 | scale.y2 = $$.getYScale("y2", min.y, max.y, scale.y2 ? scale.y2.domain() : config.axis_y2_default);
|
7660 | scale.subY2 = $$.getYScale("y2", min.subY, max.subY, scale.subY2 ? scale.subY2.domain() : config.axis_y2_default);
|
7661 | axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
|
7662 | }
|
7663 | } else {
|
7664 |
|
7665 | $$.updateArc == null ? void 0 : $$.updateArc();
|
7666 | }
|
7667 | },
|
7668 | |
7669 |
|
7670 |
|
7671 |
|
7672 |
|
7673 |
|
7674 | xx: function xx(d) {
|
7675 | var $$ = this,
|
7676 | config = $$.config,
|
7677 | _$$$scale = $$.scale,
|
7678 | x = _$$$scale.x,
|
7679 | zoom = _$$$scale.zoom,
|
7680 | fn = config.zoom_enabled && zoom ? zoom : x;
|
7681 | return d ? fn(isValue(d.x) ? d.x : d) : null;
|
7682 | },
|
7683 | xv: function xv(d) {
|
7684 | var $$ = this,
|
7685 | axis = $$.axis,
|
7686 | config = $$.config,
|
7687 | _$$$scale2 = $$.scale,
|
7688 | x = _$$$scale2.x,
|
7689 | zoom = _$$$scale2.zoom,
|
7690 | fn = config.zoom_enabled && zoom ? zoom : x,
|
7691 | value = $$.getBaseValue(d);
|
7692 | if (axis.isTimeSeries()) {
|
7693 | value = parseDate.call($$, value);
|
7694 | } else if (axis.isCategorized() && isString(value)) {
|
7695 | value = config.axis_x_categories.indexOf(value);
|
7696 | }
|
7697 | return Math.ceil(fn(value));
|
7698 | },
|
7699 | yv: function yv(d) {
|
7700 | var $$ = this,
|
7701 | _$$$scale3 = $$.scale,
|
7702 | y = _$$$scale3.y,
|
7703 | y2 = _$$$scale3.y2,
|
7704 | yScale = d.axis && d.axis === "y2" ? y2 : y;
|
7705 | return Math.ceil(yScale($$.getBaseValue(d)));
|
7706 | },
|
7707 | subxx: function subxx(d) {
|
7708 | return d ? this.scale.subX(d.x) : null;
|
7709 | }
|
7710 | });
|
7711 |
|
7712 | var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webpack_require__(9);
|
7713 | ;
|
7714 |
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 | var shape = ({
|
7724 | |
7725 |
|
7726 |
|
7727 |
|
7728 |
|
7729 | getDrawShape: function getDrawShape() {
|
7730 | var _this = this,
|
7731 | $$ = this,
|
7732 | isRotated = $$.config.axis_rotated,
|
7733 | hasRadar = $$.state.hasRadar,
|
7734 | shape = {
|
7735 | type: {},
|
7736 | indices: {},
|
7737 | pos: {}
|
7738 | };
|
7739 | ["bar", "candlestick", "line", "area"].forEach(function (v) {
|
7740 | _newArrowCheck(this, _this);
|
7741 | var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
|
7742 | if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
7743 | var indices = $$.getShapeIndices($$["is" + name + "Type"]),
|
7744 | drawFn = $$["generateDraw" + name];
|
7745 | shape.indices[v] = indices;
|
7746 | shape.type[v] = drawFn ? drawFn.bind($$)(indices, !1) : undefined;
|
7747 | }
|
7748 | }.bind(this));
|
7749 | if (!$$.hasArcType() || hasRadar) {
|
7750 |
|
7751 | var cx = hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX,
|
7752 | cy = hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY;
|
7753 | shape.pos = {
|
7754 | xForText: $$.generateXYForText(shape.indices, !0),
|
7755 | yForText: $$.generateXYForText(shape.indices, !1),
|
7756 | cx: (cx || function () {}).bind($$),
|
7757 | cy: (cy || function () {}).bind($$)
|
7758 | };
|
7759 | }
|
7760 | return shape;
|
7761 | },
|
7762 | |
7763 |
|
7764 |
|
7765 |
|
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 | getShapeIndices: function getShapeIndices(typeFilter) {
|
7776 | var _this2 = this,
|
7777 | $$ = this,
|
7778 | config = $$.config,
|
7779 | xs = config.data_xs,
|
7780 | hasXs = notEmpty(xs),
|
7781 | indices = {},
|
7782 | i = hasXs ? {} : 0;
|
7783 | if (hasXs) {
|
7784 | getUnique(Object.keys(xs).map(function (v) {
|
7785 | _newArrowCheck(this, _this2);
|
7786 | return xs[v];
|
7787 | }.bind(this))).forEach(function (v) {
|
7788 | _newArrowCheck(this, _this2);
|
7789 | i[v] = 0;
|
7790 | indices[v] = {};
|
7791 | }.bind(this));
|
7792 | }
|
7793 | $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) {
|
7794 | _newArrowCheck(this, _this2);
|
7795 | var xKey = d.id in xs ? xs[d.id] : "",
|
7796 | ind = xKey ? indices[xKey] : indices;
|
7797 | for (var j = 0, groups; groups = config.data_groups[j]; j++) {
|
7798 | if (groups.indexOf(d.id) < 0) {
|
7799 | continue;
|
7800 | }
|
7801 | for (var k = 0, row; row = groups[k]; k++) {
|
7802 | if (row in ind) {
|
7803 | ind[d.id] = ind[row];
|
7804 | break;
|
7805 | }
|
7806 | }
|
7807 | }
|
7808 | if (isUndefined(ind[d.id])) {
|
7809 | ind[d.id] = xKey ? i[xKey]++ : i++;
|
7810 | ind.__max__ = (xKey ? i[xKey] : i) - 1;
|
7811 | }
|
7812 | }.bind(this));
|
7813 | return indices;
|
7814 | },
|
7815 | |
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 |
|
7821 |
|
7822 |
|
7823 | getIndices: function getIndices(indices, d) {
|
7824 | var _this3 = this,
|
7825 | $$ = this,
|
7826 | _$$$config = $$.config,
|
7827 | xs = _$$$config.data_xs,
|
7828 | removeNull = _$$$config.bar_indices_removeNull,
|
7829 | id = d.id,
|
7830 | index = d.index;
|
7831 | if ($$.isBarType(id) && removeNull) {
|
7832 | var ind = {};
|
7833 |
|
7834 |
|
7835 | $$.getAllValuesOnIndex(index, !0).forEach(function (v, i) {
|
7836 | _newArrowCheck(this, _this3);
|
7837 | ind[v.id] = i;
|
7838 | ind.__max__ = i;
|
7839 | }.bind(this));
|
7840 | return ind;
|
7841 | }
|
7842 | return notEmpty(xs) ? indices[xs[id]] : indices;
|
7843 | },
|
7844 | |
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 |
|
7850 | getIndicesMax: function getIndicesMax(indices) {
|
7851 | var _this4 = this;
|
7852 | return notEmpty(this.config.data_xs) ?
|
7853 |
|
7854 | Object.keys(indices).map(function (v) {
|
7855 | _newArrowCheck(this, _this4);
|
7856 | return indices[v].__max__ || 0;
|
7857 | }.bind(this)).reduce(function (acc, curr) {
|
7858 | _newArrowCheck(this, _this4);
|
7859 | return acc + curr;
|
7860 | }.bind(this)) : indices.__max__;
|
7861 | },
|
7862 | getShapeX: function getShapeX(offset, indices, isSub) {
|
7863 | var _this5 = this,
|
7864 | $$ = this,
|
7865 | config = $$.config,
|
7866 | scale = $$.scale,
|
7867 | currScale = isSub ? scale.subX : scale.zoom || scale.x,
|
7868 | barOverlap = config.bar_overlap,
|
7869 | barPadding = config.bar_padding,
|
7870 | sum = function (p, c) {
|
7871 | _newArrowCheck(this, _this5);
|
7872 | return p + c;
|
7873 | }.bind(this),
|
7874 | halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
|
7875 | return function (d) {
|
7876 | _newArrowCheck(this, _this5);
|
7877 | var ind = $$.getIndices(indices, d, "getShapeX"),
|
7878 | index = d.id in ind ? ind[d.id] : 0,
|
7879 | targetsNum = (ind.__max__ || 0) + 1,
|
7880 | x = 0;
|
7881 | if (notEmpty(d.x)) {
|
7882 | var xPos = currScale(d.x, !0);
|
7883 | if (halfWidth) {
|
7884 | var offsetWidth = offset[d.id] || offset._$width;
|
7885 | x = barOverlap ? xPos - offsetWidth / 2 : xPos - offsetWidth + offset._$total.slice(0, index + 1).reduce(sum) - halfWidth;
|
7886 | } else {
|
7887 | x = xPos - (isNumber(offset) ? offset : offset._$width) * (targetsNum / 2 - (barOverlap ? 1 : index));
|
7888 | }
|
7889 | }
|
7890 |
|
7891 |
|
7892 | if (offset && x && targetsNum > 1 && barPadding) {
|
7893 | if (index) {
|
7894 | x += barPadding * index;
|
7895 | }
|
7896 | if (targetsNum > 2) {
|
7897 | x -= (targetsNum - 1) * barPadding / 2;
|
7898 | } else if (targetsNum === 2) {
|
7899 | x -= barPadding / 2;
|
7900 | }
|
7901 | }
|
7902 | return x;
|
7903 | }.bind(this);
|
7904 | },
|
7905 | getShapeY: function getShapeY(isSub) {
|
7906 | var _this6 = this,
|
7907 | $$ = this,
|
7908 | isStackNormalized = $$.isStackNormalized();
|
7909 | return function (d) {
|
7910 | _newArrowCheck(this, _this6);
|
7911 | var value = d.value;
|
7912 | if (isNumber(d)) {
|
7913 | value = d;
|
7914 | } else if (isStackNormalized) {
|
7915 | value = $$.getRatio("index", d, !0);
|
7916 | } else if ($$.isBubbleZType(d)) {
|
7917 | value = $$.getBubbleZData(d.value, "y");
|
7918 | } else if ($$.isBarRangeType(d)) {
|
7919 |
|
7920 | value = value[1];
|
7921 | }
|
7922 | return $$.getYScaleById(d.id, isSub)(value);
|
7923 | }.bind(this);
|
7924 | },
|
7925 | |
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 | getShapeYMin: function getShapeYMin(id) {
|
7932 | var $$ = this,
|
7933 | axisId = $$.axis.getId(id),
|
7934 | scale = $$.scale[axisId],
|
7935 | _scale$domain = scale.domain(),
|
7936 | yMin = _scale$domain[0],
|
7937 | inverted = $$.config["axis_" + axisId + "_inverted"];
|
7938 | return !$$.isGrouped(id) && !inverted && yMin > 0 ? yMin : 0;
|
7939 | },
|
7940 | |
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 | getShapeOffsetData: function getShapeOffsetData(typeFilter) {
|
7947 | var _this7 = this,
|
7948 | $$ = this,
|
7949 | targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),
|
7950 | isStackNormalized = $$.isStackNormalized(),
|
7951 | shapeOffsetTargets = targets.map(function (target) {
|
7952 | var _this8 = this;
|
7953 | _newArrowCheck(this, _this7);
|
7954 | var rowValues = target.values,
|
7955 | values = {};
|
7956 | if ($$.isStepType(target)) {
|
7957 | rowValues = $$.convertValuesToStep(rowValues);
|
7958 | }
|
7959 | var rowValueMapByXValue = rowValues.reduce(function (out, d) {
|
7960 | _newArrowCheck(this, _this8);
|
7961 | var key = +d.x;
|
7962 | out[key] = d;
|
7963 | values[key] = isStackNormalized ? $$.getRatio("index", d, !0) : d.value;
|
7964 | return out;
|
7965 | }.bind(this), {});
|
7966 | return {
|
7967 | id: target.id,
|
7968 | rowValues: rowValues,
|
7969 | rowValueMapByXValue: rowValueMapByXValue,
|
7970 | values: values
|
7971 | };
|
7972 | }.bind(this)),
|
7973 | indexMapByTargetId = targets.reduce(function (out, _ref, index) {
|
7974 | var id = _ref.id;
|
7975 | _newArrowCheck(this, _this7);
|
7976 | out[id] = index;
|
7977 | return out;
|
7978 | }.bind(this), {});
|
7979 | return {
|
7980 | indexMapByTargetId: indexMapByTargetId,
|
7981 | shapeOffsetTargets: shapeOffsetTargets
|
7982 | };
|
7983 | },
|
7984 | getShapeOffset: function getShapeOffset(typeFilter, indices, isSub) {
|
7985 | var _this9 = this,
|
7986 | $$ = this,
|
7987 | _$$$getShapeOffsetDat = $$.getShapeOffsetData(typeFilter),
|
7988 | shapeOffsetTargets = _$$$getShapeOffsetDat.shapeOffsetTargets,
|
7989 | indexMapByTargetId = _$$$getShapeOffsetDat.indexMapByTargetId,
|
7990 | groupsZeroAs = $$.config.data_groupsZeroAs;
|
7991 | return function (d, idx) {
|
7992 | var _this10 = this;
|
7993 | _newArrowCheck(this, _this9);
|
7994 | var id = d.id,
|
7995 | value = d.value,
|
7996 | x = d.x,
|
7997 | ind = $$.getIndices(indices, d),
|
7998 | scale = $$.getYScaleById(id, isSub);
|
7999 | if ($$.isBarRangeType(d)) {
|
8000 |
|
8001 | return scale(value[0]);
|
8002 | }
|
8003 | var dataXAsNumber = +x,
|
8004 | y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id)),
|
8005 | offset = y0;
|
8006 | shapeOffsetTargets.filter(function (t) {
|
8007 | _newArrowCheck(this, _this10);
|
8008 | return t.id !== id && ind[t.id] === ind[id];
|
8009 | }.bind(this)).forEach(function (t) {
|
8010 | _newArrowCheck(this, _this10);
|
8011 | var tid = t.id,
|
8012 | rowValueMapByXValue = t.rowValueMapByXValue,
|
8013 | rowValues = t.rowValues,
|
8014 | tvalues = t.values;
|
8015 |
|
8016 |
|
8017 | if (indexMapByTargetId[tid] < indexMapByTargetId[id]) {
|
8018 | var _row,
|
8019 | rValue = tvalues[dataXAsNumber],
|
8020 | row = rowValues[idx];
|
8021 |
|
8022 | if (!row || +row.x !== dataXAsNumber) {
|
8023 | row = rowValueMapByXValue[dataXAsNumber];
|
8024 | }
|
8025 | if (((_row = row) == null ? void 0 : _row.value) * value >= 0 && isNumber(rValue)) {
|
8026 | var addOffset = value === 0 ? groupsZeroAs === "positive" && rValue > 0 || groupsZeroAs === "negative" && rValue < 0 : !0;
|
8027 | if (addOffset) {
|
8028 | offset += scale(rValue) - y0;
|
8029 | }
|
8030 | }
|
8031 | }
|
8032 | }.bind(this));
|
8033 | return offset;
|
8034 | }.bind(this);
|
8035 | },
|
8036 | getBarW: function getBarW(type, axis, targetsNum) {
|
8037 | var _this11 = this,
|
8038 | $$ = this,
|
8039 | config = $$.config,
|
8040 | org = $$.org,
|
8041 | scale = $$.scale,
|
8042 | maxDataCount = $$.getMaxDataCount(),
|
8043 | isGrouped = type === "bar" && config.data_groups.length,
|
8044 | configName = type + "_width",
|
8045 | tickInterval = scale.zoom && !$$.axis.isCategorized() ? org.xDomain.map(function (v) {
|
8046 | _newArrowCheck(this, _this11);
|
8047 | return scale.zoom(v);
|
8048 | }.bind(this)).reduce(function (a, c) {
|
8049 | _newArrowCheck(this, _this11);
|
8050 | return Math.abs(a) + c;
|
8051 | }.bind(this)) / maxDataCount : axis.tickInterval(maxDataCount),
|
8052 | getWidth = function (id) {
|
8053 | _newArrowCheck(this, _this11);
|
8054 | var width = id ? config[configName][id] : config[configName],
|
8055 | ratio = id ? width.ratio : config[configName + "_ratio"],
|
8056 | max = id ? width.max : config[configName + "_max"],
|
8057 | w = isNumber(width) ? width : targetsNum ? tickInterval * ratio / targetsNum : 0;
|
8058 | return max && w > max ? max : w;
|
8059 | }.bind(this),
|
8060 | result = getWidth();
|
8061 | if (!isGrouped && isObjectType(config[configName])) {
|
8062 | result = {
|
8063 | _$width: result,
|
8064 | _$total: []
|
8065 | };
|
8066 | $$.filterTargetsToShow($$.data.targets).forEach(function (v) {
|
8067 | _newArrowCheck(this, _this11);
|
8068 | if (config[configName][v.id]) {
|
8069 | result[v.id] = getWidth(v.id);
|
8070 | result._$total.push(result[v.id] || result._$width);
|
8071 | }
|
8072 | }.bind(this));
|
8073 | }
|
8074 | return result;
|
8075 | },
|
8076 | |
8077 |
|
8078 |
|
8079 |
|
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 | getShapeByIndex: function getShapeByIndex(shapeName, i, id) {
|
8085 | var _this12 = this,
|
8086 | $$ = this,
|
8087 | $el = $$.$el,
|
8088 | suffix = isValue(i) ? "-" + i : "",
|
8089 | shape = $el[shapeName];
|
8090 |
|
8091 | if (shape && !shape.empty()) {
|
8092 | shape = shape.filter(function (d) {
|
8093 | _newArrowCheck(this, _this12);
|
8094 | return id ? d.id === id : !0;
|
8095 | }.bind(this)).filter(function (d) {
|
8096 | _newArrowCheck(this, _this12);
|
8097 | return isValue(i) ? d.index === i : !0;
|
8098 | }.bind(this));
|
8099 | } else {
|
8100 | shape = (id ? $el.main.selectAll("." + classes[shapeName + "s"] + $$.getTargetSelectorSuffix(id)) : $el.main).selectAll("." + classes[shapeName] + suffix);
|
8101 | }
|
8102 | return shape;
|
8103 | },
|
8104 | isWithinShape: function isWithinShape(that, d) {
|
8105 | var $$ = this,
|
8106 | shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that),
|
8107 | isWithin;
|
8108 | if (!$$.isTargetToShow(d.id)) {
|
8109 | isWithin = !1;
|
8110 | } else if ($$.hasValidPointType != null && $$.hasValidPointType(that.nodeName)) {
|
8111 | isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScaleById(d.id)(d.value)) : $$.isWithinCircle(that, $$.isBubbleType(d) ? $$.pointSelectR(d) * 1.5 : 0);
|
8112 | } else if (that.nodeName === "path") {
|
8113 | isWithin = shape.classed(classes.bar) ? $$.isWithinBar(that) : !0;
|
8114 | }
|
8115 | return isWithin;
|
8116 | },
|
8117 | getInterpolate: function getInterpolate(d) {
|
8118 | var $$ = this,
|
8119 | interpolation = $$.getInterpolateType(d);
|
8120 | return {
|
8121 | "basis": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasis,
|
8122 | "basis-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasisClosed,
|
8123 | "basis-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasisOpen,
|
8124 | "bundle": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBundle,
|
8125 | "cardinal": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCardinal,
|
8126 | "cardinal-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCardinalClosed,
|
8127 | "cardinal-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCardinalOpen,
|
8128 | "catmull-rom": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCatmullRom,
|
8129 | "catmull-rom-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCatmullRomClosed,
|
8130 | "catmull-rom-open": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveCatmullRomOpen,
|
8131 | "monotone-x": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveMonotoneX,
|
8132 | "monotone-y": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveMonotoneY,
|
8133 | "natural": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveNatural,
|
8134 | "linear-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveLinearClosed,
|
8135 | "linear": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveLinear,
|
8136 | "step": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveStep,
|
8137 | "step-after": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveStepAfter,
|
8138 | "step-before": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveStepBefore
|
8139 | }[interpolation];
|
8140 | },
|
8141 | getInterpolateType: function getInterpolateType(d) {
|
8142 | var $$ = this,
|
8143 | config = $$.config,
|
8144 | type = config.spline_interpolation_type,
|
8145 | interpolation = $$.isInterpolationType(type) ? type : "cardinal";
|
8146 | return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? config.line_step_type : "linear";
|
8147 | },
|
8148 | isWithinBar: function isWithinBar(that) {
|
8149 | var mouse = getPointer(this.state.event, that),
|
8150 | list = getRectSegList(that),
|
8151 | _list = list,
|
8152 | seg0 = _list[0],
|
8153 | seg1 = _list[1],
|
8154 | x = Math.min(seg0.x, seg1.x),
|
8155 | y = Math.min(seg0.y, seg1.y),
|
8156 | offset = this.config.bar_sensitivity,
|
8157 | _that$getBBox = that.getBBox(),
|
8158 | width = _that$getBBox.width,
|
8159 | height = _that$getBBox.height,
|
8160 | isWithin = x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
|
8161 | return isWithin;
|
8162 | }
|
8163 | });
|
8164 | ;
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 |
|
8170 |
|
8171 |
|
8172 |
|
8173 | var size = ({
|
8174 | |
8175 |
|
8176 |
|
8177 |
|
8178 | setContainerSize: function setContainerSize() {
|
8179 | var $$ = this,
|
8180 | state = $$.state;
|
8181 | state.current.width = $$.getCurrentWidth();
|
8182 | state.current.height = $$.getCurrentHeight();
|
8183 | },
|
8184 | getCurrentWidth: function getCurrentWidth() {
|
8185 | var $$ = this;
|
8186 | return $$.config.size_width || $$.getParentWidth();
|
8187 | },
|
8188 | getCurrentHeight: function getCurrentHeight() {
|
8189 | var $$ = this,
|
8190 | config = $$.config,
|
8191 | h = config.size_height || $$.getParentHeight();
|
8192 | return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1);
|
8193 | },
|
8194 | getCurrentPaddingTop: function getCurrentPaddingTop() {
|
8195 | var $$ = this,
|
8196 | config = $$.config,
|
8197 | hasAxis = $$.state.hasAxis,
|
8198 | $el = $$.$el,
|
8199 | axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
8200 | padding = isValue(config.padding_top) ? config.padding_top : 0;
|
8201 | if ($el.title && $el.title.node()) {
|
8202 | padding += $$.getTitlePadding();
|
8203 | }
|
8204 | if (axesLen && config.axis_rotated) {
|
8205 | padding += $$.getHorizontalAxisHeight("y2") * axesLen;
|
8206 | }
|
8207 | return padding;
|
8208 | },
|
8209 | getCurrentPaddingBottom: function getCurrentPaddingBottom() {
|
8210 | var $$ = this,
|
8211 | config = $$.config,
|
8212 | hasAxis = $$.state.hasAxis,
|
8213 | axisId = config.axis_rotated ? "y" : "x",
|
8214 | axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
8215 | padding = isValue(config.padding_bottom) ? config.padding_bottom : 0;
|
8216 | return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
8217 | },
|
8218 | getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
|
8219 | var $$ = this,
|
8220 | config = $$.config,
|
8221 | hasAxis = $$.state.hasAxis,
|
8222 | isRotated = config.axis_rotated,
|
8223 | axisId = isRotated ? "x" : "y",
|
8224 | axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
8225 | axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0,
|
8226 | padding;
|
8227 | if (isValue(config.padding_left)) {
|
8228 | padding = config.padding_left;
|
8229 | } else if (hasAxis && isRotated) {
|
8230 | padding = !config.axis_x_show ? 1 : Math.max(ceil10(axisWidth), 40);
|
8231 | } else if (hasAxis && (!config.axis_y_show || config.axis_y_inner)) {
|
8232 |
|
8233 | padding = $$.axis.getAxisLabelPosition("y").isOuter ? 30 : 1;
|
8234 | } else {
|
8235 | padding = ceil10(axisWidth);
|
8236 | }
|
8237 | return padding + axisWidth * axesLen;
|
8238 | },
|
8239 | getCurrentPaddingRight: function getCurrentPaddingRight(withXAxisTickTextOverflow) {
|
8240 | if (withXAxisTickTextOverflow === void 0) {
|
8241 | withXAxisTickTextOverflow = !1;
|
8242 | }
|
8243 | var $$ = this,
|
8244 | config = $$.config,
|
8245 | hasAxis = $$.state.hasAxis,
|
8246 | legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
8247 | axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
8248 | axisWidth = hasAxis ? $$.getAxisWidthByAxisId("y2") : 0,
|
8249 | xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(10) : 0,
|
8250 | padding;
|
8251 | if (isValue(config.padding_right)) {
|
8252 | padding = config.padding_right + 1;
|
8253 | } else if ($$.axis && config.axis_rotated) {
|
8254 | padding = 10 + legendWidthOnRight;
|
8255 | } else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) {
|
8256 |
|
8257 | padding = Math.max(2 + legendWidthOnRight + ($$.axis.getAxisLabelPosition("y2").isOuter ? 20 : 0), xAxisTickTextOverflow);
|
8258 | } else {
|
8259 | padding = Math.max(ceil10(axisWidth) + legendWidthOnRight, xAxisTickTextOverflow);
|
8260 | }
|
8261 | return padding + axisWidth * axesLen;
|
8262 | },
|
8263 | |
8264 |
|
8265 |
|
8266 |
|
8267 |
|
8268 |
|
8269 | getParentRectValue: function getParentRectValue(key) {
|
8270 | var offsetName = "offset" + capitalize(key),
|
8271 | parent = this.$el.chart.node(),
|
8272 | v = 0;
|
8273 | while (v < 30 && parent && parent.tagName !== "BODY") {
|
8274 | try {
|
8275 | v = parent.getBoundingClientRect()[key];
|
8276 | } catch (e) {
|
8277 | if (offsetName in parent) {
|
8278 |
|
8279 |
|
8280 | v = parent[offsetName];
|
8281 | }
|
8282 | }
|
8283 | parent = parent.parentNode;
|
8284 | }
|
8285 |
|
8286 |
|
8287 |
|
8288 | var bodySize = browser_doc.body[offsetName];
|
8289 | v > bodySize && (v = bodySize);
|
8290 | return v;
|
8291 | },
|
8292 | getParentWidth: function getParentWidth() {
|
8293 | return this.getParentRectValue("width");
|
8294 | },
|
8295 | getParentHeight: function getParentHeight() {
|
8296 | var h = this.$el.chart.style("height"),
|
8297 | height = 0;
|
8298 | if (h) {
|
8299 | height = /px$/.test(h) ? parseInt(h, 10) : this.getParentRectValue("height");
|
8300 | }
|
8301 | return height;
|
8302 | },
|
8303 | getSvgLeft: function getSvgLeft(withoutRecompute) {
|
8304 | var $$ = this,
|
8305 | config = $$.config,
|
8306 | $el = $$.$el,
|
8307 | hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner,
|
8308 | leftAxisClass = config.axis_rotated ? $AXIS.axisX : $AXIS.axisY,
|
8309 | leftAxis = $el.main.select("." + leftAxisClass).node(),
|
8310 | svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {
|
8311 | right: 0
|
8312 | },
|
8313 | chartRect = $el.chart.node().getBoundingClientRect(),
|
8314 | hasArc = $$.hasArcType(),
|
8315 | svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));
|
8316 | return svgLeft > 0 ? svgLeft : 0;
|
8317 | },
|
8318 | updateDimension: function updateDimension(withoutAxis) {
|
8319 | var $$ = this,
|
8320 | config = $$.config,
|
8321 | hasAxis = $$.state.hasAxis,
|
8322 | $el = $$.$el;
|
8323 | if (hasAxis && !withoutAxis && $$.axis.x && config.axis_rotated) {
|
8324 | var _$$$axis$subX;
|
8325 | (_$$$axis$subX = $$.axis.subX) == null ? void 0 : _$$$axis$subX.create($el.axis.subX);
|
8326 | }
|
8327 |
|
8328 |
|
8329 | $$.updateScales(withoutAxis);
|
8330 | $$.updateSvgSize();
|
8331 | $$.transformAll(!1);
|
8332 | },
|
8333 | updateSvgSize: function updateSvgSize() {
|
8334 | var $$ = this,
|
8335 | _$$$state = $$.state,
|
8336 | clip = _$$$state.clip,
|
8337 | current = _$$$state.current,
|
8338 | hasAxis = _$$$state.hasAxis,
|
8339 | width = _$$$state.width,
|
8340 | height = _$$$state.height,
|
8341 | svg = $$.$el.svg;
|
8342 | svg.attr("width", current.width).attr("height", current.height);
|
8343 | if (hasAxis) {
|
8344 | var brush = svg.select("." + $SUBCHART.brush + " .overlay"),
|
8345 | brushSize = {
|
8346 | width: 0,
|
8347 | height: 0
|
8348 | };
|
8349 | if (brush.size()) {
|
8350 | brushSize.width = +brush.attr("width");
|
8351 | brushSize.height = +brush.attr("height");
|
8352 | }
|
8353 | svg.selectAll(["#" + clip.id, "#" + clip.idGrid]).select("rect").attr("width", width).attr("height", height);
|
8354 | svg.select("#" + clip.idXAxis).select("rect").call($$.setXAxisClipPath.bind($$));
|
8355 | svg.select("#" + clip.idYAxis).select("rect").call($$.setYAxisClipPath.bind($$));
|
8356 | clip.idSubchart && svg.select("#" + clip.idSubchart).select("rect").attr("width", width).attr("height", brushSize.height);
|
8357 | }
|
8358 | },
|
8359 | |
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 |
|
8365 |
|
8366 | getResettedPadding: function getResettedPadding(v) {
|
8367 | var _this = this,
|
8368 | $$ = this,
|
8369 | config = $$.config,
|
8370 | isNum = isNumber(v),
|
8371 | p = isNum ? 0 : {};
|
8372 | if (config.padding === !1) {
|
8373 | isNum || Object.keys(v).forEach(function (key) {
|
8374 | _newArrowCheck(this, _this);
|
8375 |
|
8376 | p[key] = !isEmpty(config.data_labels) && config.data_labels !== !1 && key === "top" ? v[key] : 0;
|
8377 | }.bind(this));
|
8378 | } else {
|
8379 | p = v;
|
8380 | }
|
8381 | return p;
|
8382 | },
|
8383 | |
8384 |
|
8385 |
|
8386 |
|
8387 |
|
8388 | updateSizes: function updateSizes(isInit) {
|
8389 | var $$ = this,
|
8390 | config = $$.config,
|
8391 | state = $$.state,
|
8392 | legend = $$.$el.legend,
|
8393 | isRotated = config.axis_rotated,
|
8394 | hasArc = $$.hasArcType();
|
8395 | isInit || $$.setContainerSize();
|
8396 | var currLegend = {
|
8397 | width: legend ? $$.getLegendWidth() : 0,
|
8398 | height: legend ? $$.getLegendHeight() : 0
|
8399 | };
|
8400 | if (!hasArc && config.axis_x_show && config.axis_x_tick_autorotate) {
|
8401 | $$.updateXAxisTickClip();
|
8402 | }
|
8403 | var legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height,
|
8404 | xAxisHeight = isRotated || hasArc ? 0 : $$.getHorizontalAxisHeight("x"),
|
8405 | subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
8406 | subchartHeight = config.subchart_show && !hasArc ? config.subchart_size_height + subchartXAxisHeight : 0;
|
8407 |
|
8408 | state.margin = !hasArc && isRotated ? {
|
8409 | top: $$.getHorizontalAxisHeight("y2") + $$.getCurrentPaddingTop(),
|
8410 | right: hasArc ? 0 : $$.getCurrentPaddingRight(!0),
|
8411 | bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
8412 | left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
|
8413 | } : {
|
8414 | top: 4 + $$.getCurrentPaddingTop(),
|
8415 |
|
8416 | right: hasArc ? 0 : $$.getCurrentPaddingRight(!0),
|
8417 | bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
8418 | left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
8419 | };
|
8420 | state.margin = $$.getResettedPadding(state.margin);
|
8421 |
|
8422 |
|
8423 | state.margin2 = isRotated ? {
|
8424 | top: state.margin.top,
|
8425 | right: NaN,
|
8426 | bottom: 20 + legendHeightForBottom,
|
8427 | left: $$.state.rotatedPadding.left
|
8428 | } : {
|
8429 | top: state.current.height - subchartHeight - legendHeightForBottom,
|
8430 | right: NaN,
|
8431 | bottom: subchartXAxisHeight + legendHeightForBottom,
|
8432 | left: state.margin.left
|
8433 | };
|
8434 |
|
8435 |
|
8436 | state.margin3 = {
|
8437 | top: 0,
|
8438 | right: NaN,
|
8439 | bottom: 0,
|
8440 | left: 0
|
8441 | };
|
8442 | $$.updateSizeForLegend == null ? void 0 : $$.updateSizeForLegend(currLegend);
|
8443 | state.width = state.current.width - state.margin.left - state.margin.right;
|
8444 | state.height = state.current.height - state.margin.top - state.margin.bottom;
|
8445 | if (state.width < 0) {
|
8446 | state.width = 0;
|
8447 | }
|
8448 | if (state.height < 0) {
|
8449 | state.height = 0;
|
8450 | }
|
8451 | state.width2 = isRotated ? state.margin.left - state.rotatedPadding.left - state.rotatedPadding.right : state.width;
|
8452 | state.height2 = isRotated ? state.height : state.current.height - state.margin2.top - state.margin2.bottom;
|
8453 | if (state.width2 < 0) {
|
8454 | state.width2 = 0;
|
8455 | }
|
8456 | if (state.height2 < 0) {
|
8457 | state.height2 = 0;
|
8458 | }
|
8459 |
|
8460 |
|
8461 | var hasGauge = $$.hasType("gauge"),
|
8462 | isLegendRight = config.legend_show && state.isLegendRight;
|
8463 | state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
|
8464 | state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
|
8465 | if (hasGauge && !config.gauge_fullCircle) {
|
8466 | state.arcHeight += state.height - $$.getPaddingBottomForGauge();
|
8467 | }
|
8468 | $$.updateRadius == null ? void 0 : $$.updateRadius();
|
8469 | if (state.isLegendRight && hasArc) {
|
8470 | state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
|
8471 | }
|
8472 | }
|
8473 | });
|
8474 | ;
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 | var style = ({
|
8483 | |
8484 |
|
8485 |
|
8486 |
|
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 | setCssRule: function setCssRule(withShape, selector, props, propsFn) {
|
8493 | var _this = this,
|
8494 | $$ = this,
|
8495 | config = $$.config,
|
8496 | _$$$state = $$.state,
|
8497 | cssRule = _$$$state.cssRule,
|
8498 | style = _$$$state.style;
|
8499 | return config.boost_useCssRule ? function (selection) {
|
8500 | var _this2 = this;
|
8501 | _newArrowCheck(this, _this);
|
8502 | selection.each(function (d) {
|
8503 | var _this3 = this;
|
8504 | _newArrowCheck(this, _this2);
|
8505 | var res = propsFn && (propsFn == null ? void 0 : propsFn.call($$, d)),
|
8506 | shapeSelector = "" + (withShape ? "." + ($SHAPE.shapes + $$.getTargetSelectorSuffix(d.id)) : "") + selector;
|
8507 | selector in cssRule && style.sheet.deleteRule(cssRule[shapeSelector]);
|
8508 | $$.state.cssRule[shapeSelector] = addCssRules(style, shapeSelector, props.filter(Boolean).map(function (v) {
|
8509 | _newArrowCheck(this, _this3);
|
8510 | return isString(res) && v.indexOf(":") === -1 ? v + ": " + res : v || "";
|
8511 | }.bind(this)));
|
8512 | }.bind(this));
|
8513 | }.bind(this) : function () {
|
8514 | _newArrowCheck(this, _this);
|
8515 | }.bind(this);
|
8516 | },
|
8517 | |
8518 |
|
8519 |
|
8520 |
|
8521 |
|
8522 |
|
8523 | getStylePropValue: function getStylePropValue(v) {
|
8524 | var useCssRule = this.config.boost_useCssRule;
|
8525 | return useCssRule ? null : isFunction(v) ? v.bind(this) : v;
|
8526 | }
|
8527 | });
|
8528 | ;
|
8529 |
|
8530 |
|
8531 |
|
8532 |
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 |
|
8540 |
|
8541 |
|
8542 |
|
8543 |
|
8544 | function getRotateAnchor(angle) {
|
8545 | var anchor = "middle";
|
8546 | if (angle > 0 && angle <= 170) {
|
8547 | anchor = "end";
|
8548 | } else if (angle > 190 && angle <= 360) {
|
8549 | anchor = "start";
|
8550 | }
|
8551 | return anchor;
|
8552 | }
|
8553 |
|
8554 |
|
8555 |
|
8556 |
|
8557 |
|
8558 |
|
8559 |
|
8560 |
|
8561 |
|
8562 |
|
8563 |
|
8564 |
|
8565 |
|
8566 | function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
8567 | var _$$$getCandlestickDat,
|
8568 | $$ = this,
|
8569 | value = d.value,
|
8570 | isCandlestickType = $$.isCandlestickType(d),
|
8571 | isNegative = isNumber(value) && value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp),
|
8572 | x = pos.x,
|
8573 | y = pos.y,
|
8574 | gap = 4,
|
8575 | doubleGap = 8;
|
8576 | if (isRotated) {
|
8577 | if (anchor === "start") {
|
8578 | x += isNegative ? 0 : doubleGap;
|
8579 | y += gap;
|
8580 | } else if (anchor === "middle") {
|
8581 | x += doubleGap;
|
8582 | y -= doubleGap;
|
8583 | } else if (anchor === "end") {
|
8584 | isNegative && (x -= doubleGap);
|
8585 | y += gap;
|
8586 | }
|
8587 | } else {
|
8588 | if (anchor === "start") {
|
8589 | x += gap;
|
8590 | isNegative && (y += doubleGap * 2);
|
8591 | } else if (anchor === "middle") {
|
8592 | y -= doubleGap;
|
8593 | } else if (anchor === "end") {
|
8594 | x -= gap;
|
8595 | isNegative && (y += doubleGap * 2);
|
8596 | }
|
8597 | if (isInverted) {
|
8598 | y += isNegative ? -17 : isCandlestickType ? 13 : 7;
|
8599 | }
|
8600 | }
|
8601 | return {
|
8602 | x: x,
|
8603 | y: y
|
8604 | };
|
8605 | }
|
8606 | var internals_text = ({
|
8607 | opacityForText: function opacityForText(d) {
|
8608 | var $$ = this;
|
8609 | return $$.isBarType(d) && !$$.meetsLabelThreshold(Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel ? null : "0";
|
8610 | },
|
8611 | |
8612 |
|
8613 |
|
8614 |
|
8615 | initText: function initText() {
|
8616 | var $el = this.$el;
|
8617 | $el.main.select("." + $COMMON.chart).append("g").attr("class", $TEXT.chartTexts);
|
8618 | },
|
8619 | |
8620 |
|
8621 |
|
8622 |
|
8623 |
|
8624 | updateTargetsForText: function updateTargetsForText(targets) {
|
8625 | var _this = this,
|
8626 | $$ = this,
|
8627 | classChartText = $$.getChartClass("Text"),
|
8628 | classTexts = $$.getClass("texts", "id"),
|
8629 | classFocus = $$.classFocus.bind($$),
|
8630 | mainTextUpdate = $$.$el.main.select("." + $TEXT.chartTexts).selectAll("." + $TEXT.chartText).data(targets).attr("class", function (d) {
|
8631 | _newArrowCheck(this, _this);
|
8632 | return classChartText(d) + classFocus(d);
|
8633 | }.bind(this)),
|
8634 | mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).call($$.setCssRule(!0, " ." + $TEXT.text, ["fill", "pointer-events:none"], $$.updateTextColor));
|
8635 | mainTextEnter.append("g").attr("class", classTexts);
|
8636 | },
|
8637 | |
8638 |
|
8639 |
|
8640 |
|
8641 | updateText: function updateText() {
|
8642 | var _this2 = this,
|
8643 | $$ = this,
|
8644 | $el = $$.$el,
|
8645 | $T = $$.$T,
|
8646 | config = $$.config,
|
8647 | classText = $$.getClass("text", "index"),
|
8648 | text = $el.main.selectAll("." + $TEXT.texts).selectAll("." + $TEXT.text).data($$.labelishData.bind($$));
|
8649 | $T(text.exit()).style("fill-opacity", "0").remove();
|
8650 | $el.text = text.enter().append("text").merge(text).attr("class", classText).attr("text-anchor", function (d) {
|
8651 | _newArrowCheck(this, _this2);
|
8652 |
|
8653 | var isEndAnchor = d.value < 0;
|
8654 | if ($$.isCandlestickType(d)) {
|
8655 | var data = $$.getCandlestickData(d);
|
8656 | isEndAnchor = !(data != null && data._isUp);
|
8657 | }
|
8658 | return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle";
|
8659 | }.bind(this)).style("fill", $$.getStylePropValue($$.updateTextColor)).style("fill-opacity", "0").each(function (d, i, texts) {
|
8660 | var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
8661 | value = d.value;
|
8662 | if ($$.isBubbleZType(d)) {
|
8663 | value = $$.getBubbleZData(value, "z");
|
8664 | } else if ($$.isCandlestickType(d)) {
|
8665 | var data = $$.getCandlestickData(d);
|
8666 | if (data) {
|
8667 | value = data.close;
|
8668 | }
|
8669 | }
|
8670 | value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
8671 | if (isNumber(value)) {
|
8672 | this.textContent = value;
|
8673 | } else {
|
8674 | setTextValue(node, value);
|
8675 | }
|
8676 | });
|
8677 | },
|
8678 | updateTextColor: function updateTextColor(d) {
|
8679 | var $$ = this,
|
8680 | config = $$.config,
|
8681 | labelColors = config.data_labels_colors,
|
8682 | defaultColor = $$.isArcType(d) && !$$.isRadarType(d) ? null : $$.color(d),
|
8683 | color;
|
8684 | if (isString(labelColors)) {
|
8685 | color = labelColors;
|
8686 | } else if (isObject(labelColors)) {
|
8687 | var _ref = d.data || d,
|
8688 | id = _ref.id;
|
8689 | color = labelColors[id];
|
8690 | } else if (isFunction(labelColors)) {
|
8691 | color = labelColors.bind($$.api)(defaultColor, d);
|
8692 | }
|
8693 | if ($$.isCandlestickType(d) && !isFunction(labelColors)) {
|
8694 | var value = $$.getCandlestickData(d);
|
8695 | if (!(value != null && value._isUp)) {
|
8696 | var downColor = config.candlestick_color_down;
|
8697 | color = isObject(downColor) ? downColor[d.id] : downColor;
|
8698 | }
|
8699 | }
|
8700 | return color || defaultColor;
|
8701 | },
|
8702 | |
8703 |
|
8704 |
|
8705 |
|
8706 |
|
8707 |
|
8708 | updateTextBacgroundColor: function updateTextBacgroundColor(d) {
|
8709 | var $$ = this,
|
8710 | $el = $$.$el,
|
8711 | config = $$.config,
|
8712 | backgroundColor = config.data_labels_backgroundColors,
|
8713 | color = "";
|
8714 | if (isString(backgroundColor) || isObject(backgroundColor)) {
|
8715 | var id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix("id" in d ? d.id : d.data.id),
|
8716 | filter = $el.defs.select(["filter[id*='labels-bg", "']"].join(id));
|
8717 | if (filter.size()) {
|
8718 | color = "url(#" + filter.attr("id") + ")";
|
8719 | }
|
8720 | }
|
8721 | return color || null;
|
8722 | },
|
8723 | |
8724 |
|
8725 |
|
8726 |
|
8727 |
|
8728 |
|
8729 |
|
8730 |
|
8731 |
|
8732 | redrawText: function redrawText(getX, getY, forFlow, withTransition) {
|
8733 | var $$ = this,
|
8734 | $T = $$.$T,
|
8735 | axis = $$.axis,
|
8736 | config = $$.config,
|
8737 | t = getRandom(!0),
|
8738 | isRotated = config.axis_rotated,
|
8739 | angle = config.data_labels.rotate,
|
8740 | anchorString = getRotateAnchor(angle),
|
8741 | rotateString = angle ? "rotate(" + angle + ")" : "";
|
8742 | $$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBacgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
|
8743 |
|
8744 | var node = $T(this, !!(withTransition && this.getAttribute("x")), t),
|
8745 | isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"],
|
8746 | pos = {
|
8747 | x: getX.bind(this)(d, i),
|
8748 | y: getY.bind(this)(d, i)
|
8749 | };
|
8750 | if (angle) {
|
8751 | pos = setRotatePos.bind($$)(d, pos, anchorString, isRotated, isInverted);
|
8752 | node.attr("text-anchor", anchorString);
|
8753 | }
|
8754 |
|
8755 |
|
8756 | if (this.childElementCount || angle) {
|
8757 | node.attr("transform", "translate(" + pos.x + " " + pos.y + ") " + rotateString);
|
8758 | } else {
|
8759 | node.attr("x", pos.x).attr("y", pos.y);
|
8760 | }
|
8761 | });
|
8762 |
|
8763 |
|
8764 |
|
8765 | return !0;
|
8766 | },
|
8767 | |
8768 |
|
8769 |
|
8770 |
|
8771 |
|
8772 |
|
8773 |
|
8774 | getTextRect: function getTextRect(element, className) {
|
8775 | var _this3 = this,
|
8776 | $$ = this,
|
8777 | base = element.node ? element.node() : element;
|
8778 | if (!/text/i.test(base.tagName)) {
|
8779 | base = base.querySelector("text");
|
8780 | }
|
8781 | var text = base.textContent,
|
8782 | cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_"),
|
8783 | rect = $$.cache.get(cacheKey);
|
8784 | if (!rect) {
|
8785 | $$.$el.svg.append("text").style("visibility", "hidden").style("font", (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(base).style("font")).classed(className, !0).text(text).call(function (v) {
|
8786 | _newArrowCheck(this, _this3);
|
8787 | rect = getBoundingRect(v.node());
|
8788 | }.bind(this)).remove();
|
8789 | $$.cache.add(cacheKey, rect);
|
8790 | }
|
8791 | return rect;
|
8792 | },
|
8793 | |
8794 |
|
8795 |
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 | generateXYForText: function generateXYForText(indices, forX) {
|
8801 | var _this4 = this,
|
8802 | $$ = this,
|
8803 | types = Object.keys(indices),
|
8804 | points = {},
|
8805 | getter = forX ? $$.getXForText : $$.getYForText;
|
8806 | $$.hasType("radar") && types.push("radar");
|
8807 | types.forEach(function (v) {
|
8808 | _newArrowCheck(this, _this4);
|
8809 | points[v] = $$["generateGet" + capitalize(v) + "Points"](indices[v], !1);
|
8810 | }.bind(this));
|
8811 | return function (d, i) {
|
8812 | var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || "line";
|
8813 | return getter.call($$, points[type](d, i), d, this);
|
8814 | };
|
8815 | },
|
8816 | |
8817 |
|
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 |
|
8823 |
|
8824 | getCenteredTextPos: function getCenteredTextPos(d, points, textElement) {
|
8825 | var $$ = this,
|
8826 | config = $$.config,
|
8827 | isRotated = config.axis_rotated;
|
8828 | if (config.data_labels.centered && $$.isBarType(d)) {
|
8829 | var _rect = getBoundingRect(textElement),
|
8830 | isPositive = d.value >= 0;
|
8831 | if (isRotated) {
|
8832 | var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + _rect.width / 2;
|
8833 | return isPositive ? -w - 3 : w + 2;
|
8834 | } else {
|
8835 | var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + _rect.height / 2;
|
8836 | return isPositive ? h : -h - 2;
|
8837 | }
|
8838 | }
|
8839 | return 0;
|
8840 | },
|
8841 | |
8842 |
|
8843 |
|
8844 |
|
8845 |
|
8846 |
|
8847 |
|
8848 | getTextPos: function getTextPos(id, type) {
|
8849 | var pos = this.config.data_labels_position;
|
8850 | return (id in pos ? pos[id] : pos)[type] || 0;
|
8851 | },
|
8852 | |
8853 |
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 | getXForText: function getXForText(points, d, textElement) {
|
8861 | var $$ = this,
|
8862 | config = $$.config,
|
8863 | state = $$.state,
|
8864 | isRotated = config.axis_rotated,
|
8865 | xPos = points[0][0];
|
8866 | if ($$.isCandlestickType(d)) {
|
8867 | if (isRotated) {
|
8868 | var _$$$getCandlestickDat2;
|
8869 | xPos = (_$$$getCandlestickDat2 = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat2._isUp ? points[2][2] + 4 : points[2][1] - 4;
|
8870 | } else {
|
8871 | xPos += (points[1][0] - xPos) / 2;
|
8872 | }
|
8873 | } else {
|
8874 | if (isRotated) {
|
8875 | var padding = $$.isBarType(d) ? 4 : 6;
|
8876 | xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1);
|
8877 | } else {
|
8878 | xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : xPos;
|
8879 | }
|
8880 | }
|
8881 |
|
8882 |
|
8883 | if (d.value === null) {
|
8884 | if (xPos > state.width) {
|
8885 | var _getBoundingRect = getBoundingRect(textElement),
|
8886 | width = _getBoundingRect.width;
|
8887 | xPos = state.width - width;
|
8888 | } else if (xPos < 0) {
|
8889 | xPos = 4;
|
8890 | }
|
8891 | }
|
8892 | if (isRotated) {
|
8893 | xPos += $$.getCenteredTextPos(d, points, textElement);
|
8894 | }
|
8895 | return xPos + $$.getTextPos(d.id, "x");
|
8896 | },
|
8897 | |
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 | getYForText: function getYForText(points, d, textElement) {
|
8906 | var $$ = this,
|
8907 | axis = $$.axis,
|
8908 | config = $$.config,
|
8909 | state = $$.state,
|
8910 | isRotated = config.axis_rotated,
|
8911 | isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"],
|
8912 | isBarType = $$.isBarType(d),
|
8913 | r = config.point_r,
|
8914 | rect = getBoundingRect(textElement),
|
8915 | value = d.value,
|
8916 | baseY = 3,
|
8917 | yPos;
|
8918 | if ($$.isCandlestickType(d)) {
|
8919 | value = $$.getCandlestickData(d);
|
8920 | if (isRotated) {
|
8921 | yPos = points[0][0];
|
8922 | yPos += (points[1][0] - yPos) / 2 + baseY;
|
8923 | } else {
|
8924 | yPos = value && value._isUp ? points[2][2] - baseY : points[2][1] + baseY * 4;
|
8925 | if (isInverted) {
|
8926 | yPos += 15 * (value._isUp ? 1 : -1);
|
8927 | }
|
8928 | }
|
8929 | } else {
|
8930 | if (isRotated) {
|
8931 | yPos = (points[0][0] + points[2][0] + rect.height * .6) / 2;
|
8932 | } else {
|
8933 | yPos = points[2][1];
|
8934 | if (isNumber(r) && r > 5 && ($$.isLineType(d) || $$.isScatterType(d))) {
|
8935 | baseY += config.point_r / 2.3;
|
8936 | }
|
8937 | if (value < 0 || value === 0 && !state.hasPositiveValue && state.hasNegativeValue) {
|
8938 | yPos += isInverted ? isBarType ? -3 : -5 : rect.height + (isBarType ? -baseY : baseY);
|
8939 | } else {
|
8940 | var diff = -baseY * 2;
|
8941 | if (isBarType) {
|
8942 | diff = -baseY;
|
8943 | } else if ($$.isBubbleType(d)) {
|
8944 | diff = baseY;
|
8945 | }
|
8946 | if (isInverted) {
|
8947 | diff = isBarType ? 10 : 15;
|
8948 | }
|
8949 | yPos += diff;
|
8950 | }
|
8951 | }
|
8952 | }
|
8953 |
|
8954 |
|
8955 | if (d.value === null && !isRotated) {
|
8956 | var boxHeight = rect.height;
|
8957 | if (yPos < boxHeight) {
|
8958 | yPos = boxHeight;
|
8959 | } else if (yPos > state.height) {
|
8960 | yPos = state.height - 4;
|
8961 | }
|
8962 | }
|
8963 | if (!isRotated) {
|
8964 | yPos += $$.getCenteredTextPos(d, points, textElement);
|
8965 | }
|
8966 | return yPos + $$.getTextPos(d.id, "y");
|
8967 | },
|
8968 | |
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 | markOverlapped: function markOverlapped(id, $$, selector) {
|
8977 | var _this5 = this,
|
8978 | textNodes = $$.$el.arcs.selectAll(selector),
|
8979 | filteredTextNodes = textNodes.filter(function (node) {
|
8980 | _newArrowCheck(this, _this5);
|
8981 | return node.data.id !== id;
|
8982 | }.bind(this)),
|
8983 | textNode = textNodes.filter(function (node) {
|
8984 | _newArrowCheck(this, _this5);
|
8985 | return node.data.id === id;
|
8986 | }.bind(this)),
|
8987 | translate = getTranslation(textNode.node()),
|
8988 | calcHypo = function (x, y) {
|
8989 | _newArrowCheck(this, _this5);
|
8990 | return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
8991 | }.bind(this);
|
8992 | textNode.node() && filteredTextNodes.each(function () {
|
8993 | var coordinate = getTranslation(this),
|
8994 | filteredTextNode = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
8995 | nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode,
|
8996 | overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength()),
|
8997 | overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < parseInt(textNode.style("font-size"), 10);
|
8998 | filteredTextNode.classed($TEXT.TextOverlapping, overlapsX && overlapsY);
|
8999 | });
|
9000 | },
|
9001 | |
9002 |
|
9003 |
|
9004 |
|
9005 |
|
9006 |
|
9007 |
|
9008 | undoMarkOverlapped: function undoMarkOverlapped($$, selector) {
|
9009 | $$.$el.arcs.selectAll(selector).each(function () {
|
9010 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.selectAll)([this, this.previousSibling]).classed($TEXT.TextOverlapping, !1);
|
9011 | });
|
9012 | },
|
9013 | |
9014 |
|
9015 |
|
9016 |
|
9017 |
|
9018 |
|
9019 |
|
9020 | meetsLabelThreshold: function meetsLabelThreshold(ratio, type) {
|
9021 | if (ratio === void 0) {
|
9022 | ratio = 0;
|
9023 | }
|
9024 | var $$ = this,
|
9025 | config = $$.config,
|
9026 | threshold = config[type + "_label_threshold"] || 0;
|
9027 | return ratio >= threshold;
|
9028 | }
|
9029 | });
|
9030 | ;
|
9031 |
|
9032 |
|
9033 |
|
9034 |
|
9035 |
|
9036 |
|
9037 |
|
9038 |
|
9039 |
|
9040 |
|
9041 |
|
9042 |
|
9043 |
|
9044 |
|
9045 | function getTextPos(pos, width) {
|
9046 | if (pos === void 0) {
|
9047 | pos = "left";
|
9048 | }
|
9049 | var isNum = isNumber(width),
|
9050 | position;
|
9051 | if (pos.indexOf("center") > -1) {
|
9052 | position = isNum ? width / 2 : "middle";
|
9053 | } else if (pos.indexOf("right") > -1) {
|
9054 | position = isNum ? width : "end";
|
9055 | } else {
|
9056 | position = isNum ? 0 : "start";
|
9057 | }
|
9058 | return position;
|
9059 | }
|
9060 | var internals_title = ({
|
9061 | |
9062 |
|
9063 |
|
9064 |
|
9065 | initTitle: function initTitle() {
|
9066 | var $$ = this,
|
9067 | config = $$.config,
|
9068 | $el = $$.$el;
|
9069 | if (config.title_text) {
|
9070 | $el.title = $el.svg.append("g");
|
9071 | var text = $el.title.append("text").style("text-anchor", getTextPos(config.title_position)).attr("class", $TEXT.title);
|
9072 | setTextValue(text, config.title_text, [.3, 1.5]);
|
9073 | }
|
9074 | },
|
9075 | |
9076 |
|
9077 |
|
9078 |
|
9079 | redrawTitle: function redrawTitle() {
|
9080 | var $$ = this,
|
9081 | config = $$.config,
|
9082 | current = $$.state.current,
|
9083 | title = $$.$el.title;
|
9084 | if (title) {
|
9085 | var y = $$.yForTitle.call($$);
|
9086 | if (/g/i.test(title.node().tagName)) {
|
9087 | title.attr("transform", "translate(" + getTextPos(config.title_position, current.width) + ", " + y + ")");
|
9088 | } else {
|
9089 | title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
9090 | }
|
9091 | }
|
9092 | },
|
9093 | |
9094 |
|
9095 |
|
9096 |
|
9097 |
|
9098 | xForTitle: function xForTitle() {
|
9099 | var $$ = this,
|
9100 | config = $$.config,
|
9101 | current = $$.state.current,
|
9102 | position = config.title_position || "left",
|
9103 | textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width,
|
9104 | x;
|
9105 | if (/(right|center)/.test(position)) {
|
9106 | x = current.width - textRectWidth;
|
9107 | if (position.indexOf("right") >= 0) {
|
9108 | x = current.width - textRectWidth - config.title_padding.right;
|
9109 | } else if (position.indexOf("center") >= 0) {
|
9110 | x = (current.width - textRectWidth) / 2;
|
9111 | }
|
9112 | } else {
|
9113 |
|
9114 | x = config.title_padding.left || 0;
|
9115 | }
|
9116 | return x;
|
9117 | },
|
9118 | |
9119 |
|
9120 |
|
9121 |
|
9122 |
|
9123 | yForTitle: function yForTitle() {
|
9124 | var $$ = this;
|
9125 | return ($$.config.title_padding.top || 0) + $$.getTextRect($$.$el.title, $TEXT.title).height;
|
9126 | },
|
9127 | |
9128 |
|
9129 |
|
9130 |
|
9131 |
|
9132 | getTitlePadding: function getTitlePadding() {
|
9133 | var $$ = this;
|
9134 | return $$.yForTitle() + ($$.config.title_padding.bottom || 0);
|
9135 | }
|
9136 | });
|
9137 | ;
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 |
|
9143 |
|
9144 |
|
9145 |
|
9146 |
|
9147 | var internals_tooltip = ({
|
9148 | |
9149 |
|
9150 |
|
9151 |
|
9152 | initTooltip: function initTooltip() {
|
9153 | var $$ = this,
|
9154 | config = $$.config,
|
9155 | $el = $$.$el;
|
9156 | $el.tooltip = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(config.tooltip_contents.bindto);
|
9157 | if ($el.tooltip.empty()) {
|
9158 | $el.tooltip = $el.chart.append("div").attr("class", $TOOLTIP.tooltipContainer).style("position", "absolute").style("pointer-events", "none").style("display", "none");
|
9159 | }
|
9160 | $$.bindTooltipResizePos();
|
9161 | },
|
9162 | initShowTooltip: function initShowTooltip() {
|
9163 | var _this = this,
|
9164 | $$ = this,
|
9165 | config = $$.config,
|
9166 | $el = $$.$el,
|
9167 | _$$$state = $$.state,
|
9168 | hasAxis = _$$$state.hasAxis,
|
9169 | hasRadar = _$$$state.hasRadar;
|
9170 |
|
9171 | if (config.tooltip_init_show) {
|
9172 | var _$$$axis,
|
9173 | _$$$axis2,
|
9174 | isArc = !(hasAxis && hasRadar);
|
9175 | if ((_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() && isString(config.tooltip_init_x)) {
|
9176 | var targets = $$.data.targets[0],
|
9177 | i,
|
9178 | val;
|
9179 | config.tooltip_init_x = parseDate.call($$, config.tooltip_init_x);
|
9180 | for (i = 0; val = targets.values[i]; i++) {
|
9181 | if (val.x - config.tooltip_init_x === 0) {
|
9182 | break;
|
9183 | }
|
9184 | }
|
9185 | config.tooltip_init_x = i;
|
9186 | }
|
9187 | var data = $$.data.targets.map(function (d) {
|
9188 | _newArrowCheck(this, _this);
|
9189 | var x = isArc ? 0 : config.tooltip_init_x;
|
9190 | return $$.addName(d.values[x]);
|
9191 | }.bind(this));
|
9192 | if (isArc) {
|
9193 | data = [data[config.tooltip_init_x]];
|
9194 | }
|
9195 | $el.tooltip.html($$.getTooltipHTML(data, (_$$$axis2 = $$.axis) == null ? void 0 : _$$$axis2.getXAxisTickFormat(), $$.getDefaultValueFormat(), $$.color));
|
9196 | if (!config.tooltip_contents.bindto) {
|
9197 | $el.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", null);
|
9198 | }
|
9199 | }
|
9200 | },
|
9201 | |
9202 |
|
9203 |
|
9204 |
|
9205 |
|
9206 |
|
9207 | getTooltipHTML: function getTooltipHTML() {
|
9208 | var $$ = this,
|
9209 | api = $$.api,
|
9210 | config = $$.config;
|
9211 | return isFunction(config.tooltip_contents) ? config.tooltip_contents.bind(api).apply(void 0, arguments) : $$.getTooltipContent.apply($$, arguments);
|
9212 | },
|
9213 | |
9214 |
|
9215 |
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 | getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) {
|
9223 | var _this2 = this,
|
9224 | $$ = this,
|
9225 | api = $$.api,
|
9226 | config = $$.config,
|
9227 | state = $$.state,
|
9228 | _map = ["title", "name", "value"].map(function (v) {
|
9229 | _newArrowCheck(this, _this2);
|
9230 | var fn = config["tooltip_format_" + v];
|
9231 | return isFunction(fn) ? fn.bind(api) : fn;
|
9232 | }.bind(this)),
|
9233 | titleFormat = _map[0],
|
9234 | nameFormat = _map[1],
|
9235 | valueFormat = _map[2];
|
9236 | titleFormat = titleFormat || defaultTitleFormat;
|
9237 | nameFormat = nameFormat || function (name) {
|
9238 | _newArrowCheck(this, _this2);
|
9239 | return name;
|
9240 | }.bind(this);
|
9241 | valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) {
|
9242 | _newArrowCheck(this, _this2);
|
9243 | return (ratio * 100).toFixed(2) + "%";
|
9244 | }.bind(this) : defaultValueFormat);
|
9245 | var order = config.tooltip_order,
|
9246 | getRowValue = function (row) {
|
9247 | _newArrowCheck(this, _this2);
|
9248 | return $$.axis && $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row);
|
9249 | }.bind(this),
|
9250 | getBgColor = $$.levelColor ? function (row) {
|
9251 | _newArrowCheck(this, _this2);
|
9252 | return $$.levelColor(row.value);
|
9253 | }.bind(this) : function (row) {
|
9254 | _newArrowCheck(this, _this2);
|
9255 | return color(row);
|
9256 | }.bind(this),
|
9257 | contents = config.tooltip_contents,
|
9258 | tplStr = contents.template,
|
9259 | targetIds = $$.mapToTargetIds();
|
9260 | if (order === null && config.data_groups.length) {
|
9261 |
|
9262 | var ids = $$.orderTargets($$.data.targets).map(function (i2) {
|
9263 | _newArrowCheck(this, _this2);
|
9264 | return i2.id;
|
9265 | }.bind(this)).reverse();
|
9266 | d.sort(function (a, b) {
|
9267 | _newArrowCheck(this, _this2);
|
9268 | var v1 = a ? a.value : null,
|
9269 | v2 = b ? b.value : null;
|
9270 | if (v1 > 0 && v2 > 0) {
|
9271 | v1 = a.id ? ids.indexOf(a.id) : null;
|
9272 | v2 = b.id ? ids.indexOf(b.id) : null;
|
9273 | }
|
9274 | return v1 - v2;
|
9275 | }.bind(this));
|
9276 | } else if (/^(asc|desc)$/.test(order)) {
|
9277 | d.sort(function (a, b) {
|
9278 | _newArrowCheck(this, _this2);
|
9279 | var v1 = a ? getRowValue(a) : null,
|
9280 | v2 = b ? getRowValue(b) : null;
|
9281 | return order === "asc" ? v1 - v2 : v2 - v1;
|
9282 | }.bind(this));
|
9283 | } else if (isFunction(order)) {
|
9284 | d.sort(order.bind(api));
|
9285 | }
|
9286 | var tpl = $$.getTooltipContentTemplate(tplStr),
|
9287 | len = d.length,
|
9288 | text,
|
9289 | row,
|
9290 | param,
|
9291 | value,
|
9292 | i;
|
9293 | for (i = 0; i < len; i++) {
|
9294 | row = d[i];
|
9295 | if (!row || !(getRowValue(row) || getRowValue(row) === 0)) {
|
9296 | continue;
|
9297 | }
|
9298 | if (isUndefined(text)) {
|
9299 | var title = (state.hasAxis || state.hasRadar) && sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
9300 | text = tplProcess(tpl[0], {
|
9301 | CLASS_TOOLTIP: $TOOLTIP.tooltip,
|
9302 | TITLE: isValue(title) ? tplStr ? title : "<tr><th colspan=\"2\">" + title + "</th></tr>" : ""
|
9303 | });
|
9304 | }
|
9305 | if (!row.ratio && $$.$el.arcs) {
|
9306 | row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path." + $ARC.arc + "-" + row.id).data()[0]);
|
9307 | }
|
9308 | param = [row.ratio, row.id, row.index, d];
|
9309 | value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(param)));
|
9310 | if ($$.isAreaRangeType(row)) {
|
9311 | var _map2 = ["high", "low"].map(function (v) {
|
9312 | _newArrowCheck(this, _this2);
|
9313 | return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v)].concat(param)));
|
9314 | }.bind(this)),
|
9315 | high = _map2[0],
|
9316 | low = _map2[1];
|
9317 | value = "<b>Mid:</b> " + value + " <b>High:</b> " + high + " <b>Low:</b> " + low;
|
9318 | } else if ($$.isCandlestickType(row)) {
|
9319 | var _map3 = ["open", "high", "low", "close", "volume"].map(function (v) {
|
9320 | _newArrowCheck(this, _this2);
|
9321 | return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v, "candlestick")].concat(param)));
|
9322 | }.bind(this)),
|
9323 | open = _map3[0],
|
9324 | _high = _map3[1],
|
9325 | _low = _map3[2],
|
9326 | close = _map3[3],
|
9327 | volume = _map3[4];
|
9328 | value = "<b>Open:</b> " + open + " <b>High:</b> " + _high + " <b>Low:</b> " + _low + " <b>Close:</b> " + close + (volume ? " <b>Volume:</b> " + volume : "");
|
9329 | } else if ($$.isBarRangeType(row)) {
|
9330 | var _row$value = row.value,
|
9331 | start = _row$value[0],
|
9332 | end = _row$value[1];
|
9333 | value = valueFormat(start) + " ~ " + valueFormat(end);
|
9334 | }
|
9335 | if (value !== undefined) {
|
9336 | var _ret = function () {
|
9337 | var _this3 = this;
|
9338 |
|
9339 | if (row.name === null) {
|
9340 | return "continue";
|
9341 | }
|
9342 | var name = sanitise(nameFormat.apply(void 0, [row.name].concat(param))),
|
9343 | color = getBgColor(row),
|
9344 | contentValue = {
|
9345 | CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
9346 | COLOR: tplStr || !$$.patterns ? color : "<svg><rect style=\"fill:" + color + "\" width=\"10\" height=\"10\"></rect></svg>",
|
9347 | NAME: name,
|
9348 | VALUE: value
|
9349 | };
|
9350 | if (tplStr && isObject(contents.text)) {
|
9351 | var index = targetIds.indexOf(row.id);
|
9352 | Object.keys(contents.text).forEach(function (key) {
|
9353 | _newArrowCheck(this, _this3);
|
9354 | contentValue[key] = contents.text[key][index];
|
9355 | }.bind(this));
|
9356 | }
|
9357 | text += tplProcess(tpl[1], contentValue);
|
9358 | }();
|
9359 | if (_ret === "continue") continue;
|
9360 | }
|
9361 | }
|
9362 | return text + "</table>";
|
9363 | },
|
9364 | |
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 | getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) {
|
9371 | return (tplStr || "<table class=\"{=CLASS_TOOLTIP}\"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class=\"{=CLASS_TOOLTIP_NAME}\">\n\t\t\t\t\t<td class=\"name\">" + (this.patterns ? "{=COLOR}" : "<span style=\"background-color:{=COLOR}\"></span>") + "{=NAME}</td>\n\t\t\t\t\t<td class=\"value\">{=VALUE}</td>\n\t\t\t\t</tr>}}\n\t\t\t</tbody></table>").replace(/(\r?\n|\t)/g, "").split(/{{(.*)}}/);
|
9372 | },
|
9373 | |
9374 |
|
9375 |
|
9376 |
|
9377 |
|
9378 |
|
9379 |
|
9380 |
|
9381 |
|
9382 | tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) {
|
9383 | var _this4 = this,
|
9384 | $$ = this,
|
9385 | config = $$.config,
|
9386 | scale = $$.scale,
|
9387 | state = $$.state,
|
9388 | _state = state,
|
9389 | width = _state.width,
|
9390 | height = _state.height,
|
9391 | current = _state.current,
|
9392 | isLegendRight = _state.isLegendRight,
|
9393 | inputType = _state.inputType,
|
9394 | event = _state.event,
|
9395 | hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
9396 | svgLeft = $$.getSvgLeft(!0),
|
9397 | chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
|
9398 | chartLeft = $$.getCurrentPaddingLeft(!0),
|
9399 | _getPointer = getPointer(event, element),
|
9400 | x = _getPointer[0],
|
9401 | y = _getPointer[1];
|
9402 |
|
9403 | if ($$.hasArcType()) {
|
9404 | var raw = inputType === "touch" || $$.hasType("radar");
|
9405 | if (!raw) {
|
9406 | y += hasGauge ? height : height / 2;
|
9407 | x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
|
9408 | }
|
9409 | } else {
|
9410 | var dataScale = scale.x(dataToShow[0].x);
|
9411 | if (config.axis_rotated) {
|
9412 | y = dataScale + 20;
|
9413 | x += svgLeft + 100;
|
9414 | chartRight -= svgLeft;
|
9415 | } else {
|
9416 | y -= 5;
|
9417 | x = svgLeft + chartLeft + 20 + ($$.scale.zoom ? x : dataScale);
|
9418 | }
|
9419 | }
|
9420 |
|
9421 |
|
9422 | if (x + tWidth + 15 > chartRight) {
|
9423 | x -= tWidth + chartLeft;
|
9424 | }
|
9425 | if (y + tHeight > current.height) {
|
9426 | y -= hasGauge ? tHeight * 3 : tHeight + 30;
|
9427 | }
|
9428 | var pos = {
|
9429 | top: y,
|
9430 | left: x
|
9431 | };
|
9432 |
|
9433 |
|
9434 | Object.keys(pos).forEach(function (v) {
|
9435 | _newArrowCheck(this, _this4);
|
9436 | if (pos[v] < 0) {
|
9437 | pos[v] = 0;
|
9438 | }
|
9439 | }.bind(this));
|
9440 | return pos;
|
9441 | },
|
9442 | |
9443 |
|
9444 |
|
9445 |
|
9446 |
|
9447 |
|
9448 | showTooltip: function showTooltip(selectedData, eventRect) {
|
9449 | var _this5 = this,
|
9450 | $$ = this,
|
9451 | config = $$.config,
|
9452 | scale = $$.scale,
|
9453 | state = $$.state,
|
9454 | tooltip = $$.$el.tooltip,
|
9455 | bindto = config.tooltip_contents.bindto,
|
9456 | dataToShow = selectedData.filter(function (d) {
|
9457 | _newArrowCheck(this, _this5);
|
9458 | return d && isValue($$.getBaseValue(d));
|
9459 | }.bind(this));
|
9460 | if (!tooltip || dataToShow.length === 0 || !config.tooltip_show) {
|
9461 | return;
|
9462 | }
|
9463 | var datum = tooltip.datum(),
|
9464 | _ref = datum || {},
|
9465 | _ref$width = _ref.width,
|
9466 | width = _ref$width === void 0 ? 0 : _ref$width,
|
9467 | _ref$height = _ref.height,
|
9468 | height = _ref$height === void 0 ? 0 : _ref$height,
|
9469 | dataStr = JSON.stringify(selectedData);
|
9470 | if (!datum || datum.current !== dataStr) {
|
9471 | var index = selectedData.concat().sort()[0].index;
|
9472 | callFn(config.tooltip_onshow, $$.api, selectedData);
|
9473 |
|
9474 |
|
9475 | tooltip.html($$.getTooltipHTML(selectedData,
|
9476 |
|
9477 | $$.axis ? $$.axis.getXAxisTickFormat() : $$.categoryName.bind($$),
|
9478 |
|
9479 | $$.getDefaultValueFormat(),
|
9480 |
|
9481 | $$.color
|
9482 | )).style("display", null).style("visibility", null)
|
9483 | .datum(datum = {
|
9484 | index: index,
|
9485 | current: dataStr,
|
9486 | width: width = tooltip.property("offsetWidth"),
|
9487 | height: height = tooltip.property("offsetHeight")
|
9488 | });
|
9489 | callFn(config.tooltip_onshown, $$.api, selectedData);
|
9490 | $$._handleLinkedCharts(!0, index);
|
9491 | }
|
9492 | if (!bindto) {
|
9493 | var _config$tooltip_posit,
|
9494 | _selectedData$filter,
|
9495 | fnPos = ((_config$tooltip_posit = config.tooltip_position) == null ? void 0 : _config$tooltip_posit.bind($$.api)) || $$.tooltipPosition.bind($$),
|
9496 | _getPointer2 = getPointer(state.event, eventRect),
|
9497 | x = _getPointer2[0],
|
9498 | y = _getPointer2[1],
|
9499 | currPos = {
|
9500 | x: x,
|
9501 | y: y
|
9502 | },
|
9503 | data = (_selectedData$filter = selectedData.filter(Boolean)) == null ? void 0 : _selectedData$filter.shift();
|
9504 | if (scale.x && data && "x" in data) {
|
9505 | currPos.xAxis = scale.x(data.x);
|
9506 | }
|
9507 |
|
9508 |
|
9509 | var pos = fnPos(dataToShow, width, height, eventRect, currPos);
|
9510 | ["top", "left"].forEach(function (v) {
|
9511 | _newArrowCheck(this, _this5);
|
9512 | var value = pos[v];
|
9513 | tooltip.style(v, value + "px");
|
9514 |
|
9515 |
|
9516 | if (v === "left" && !datum.xPosInPercent) {
|
9517 | datum.xPosInPercent = value / state.current.width * 100;
|
9518 | }
|
9519 | }.bind(this));
|
9520 | }
|
9521 | },
|
9522 | |
9523 |
|
9524 |
|
9525 |
|
9526 | bindTooltipResizePos: function bindTooltipResizePos() {
|
9527 | var _this6 = this,
|
9528 | $$ = this,
|
9529 | resizeFunction = $$.resizeFunction,
|
9530 | state = $$.state,
|
9531 | tooltip = $$.$el.tooltip;
|
9532 | resizeFunction.add(function () {
|
9533 | _newArrowCheck(this, _this6);
|
9534 | if (tooltip.style("display") === "block") {
|
9535 | var current = state.current,
|
9536 | _tooltip$datum = tooltip.datum(),
|
9537 | width = _tooltip$datum.width,
|
9538 | xPosInPercent = _tooltip$datum.xPosInPercent,
|
9539 | _value = current.width / 100 * xPosInPercent,
|
9540 | diff = current.width - (_value + width);
|
9541 |
|
9542 | if (diff < 0) {
|
9543 | _value += diff;
|
9544 | }
|
9545 | tooltip.style("left", _value + "px");
|
9546 | }
|
9547 | }.bind(this));
|
9548 | },
|
9549 | |
9550 |
|
9551 |
|
9552 |
|
9553 |
|
9554 | hideTooltip: function hideTooltip(force) {
|
9555 | var $$ = this,
|
9556 | api = $$.api,
|
9557 | config = $$.config,
|
9558 | tooltip = $$.$el.tooltip;
|
9559 | if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
9560 | var selectedData = JSON.parse(tooltip.datum().current);
|
9561 | callFn(config.tooltip_onhide, api, selectedData);
|
9562 |
|
9563 |
|
9564 | tooltip.style("display", "none").style("visibility", "hidden")
|
9565 | .datum(null);
|
9566 | callFn(config.tooltip_onhidden, api, selectedData);
|
9567 | }
|
9568 | },
|
9569 | |
9570 |
|
9571 |
|
9572 |
|
9573 |
|
9574 |
|
9575 | _handleLinkedCharts: function _handleLinkedCharts(show, index) {
|
9576 | var _this7 = this,
|
9577 | $$ = this,
|
9578 | charts = $$.charts,
|
9579 | config = $$.config,
|
9580 | event = $$.state.event;
|
9581 |
|
9582 |
|
9583 | if (event != null && event.isTrusted && config.tooltip_linked && charts.length > 1) {
|
9584 | var linkedName = config.tooltip_linked_name;
|
9585 | charts.filter(function (c) {
|
9586 | _newArrowCheck(this, _this7);
|
9587 | return c !== $$.api;
|
9588 | }.bind(this)).forEach(function (c) {
|
9589 | _newArrowCheck(this, _this7);
|
9590 | var _c$internal = c.internal,
|
9591 | config = _c$internal.config,
|
9592 | $el = _c$internal.$el,
|
9593 | isLinked = config.tooltip_linked,
|
9594 | name = config.tooltip_linked_name,
|
9595 | isInDom = browser_doc.body.contains($el.chart.node());
|
9596 | if (isLinked && linkedName === name && isInDom) {
|
9597 | var data = $el.tooltip.data()[0],
|
9598 | isNotSameIndex = index !== (data == null ? void 0 : data.index);
|
9599 | try {
|
9600 | c.tooltip[show && isNotSameIndex ? "show" : "hide"]({
|
9601 | index: index
|
9602 | });
|
9603 | } catch (e) {}
|
9604 | }
|
9605 | }.bind(this));
|
9606 | }
|
9607 | }
|
9608 | });
|
9609 | ;
|
9610 |
|
9611 |
|
9612 |
|
9613 |
|
9614 |
|
9615 |
|
9616 | var transform = ({
|
9617 | getTranslate: function getTranslate(target, index) {
|
9618 | if (index === void 0) {
|
9619 | index = 0;
|
9620 | }
|
9621 | var $$ = this,
|
9622 | config = $$.config,
|
9623 | state = $$.state,
|
9624 | isRotated = config.axis_rotated,
|
9625 | padding = 0,
|
9626 | x,
|
9627 | y;
|
9628 | if (index && /^(x|y2?)$/.test(target)) {
|
9629 | padding = $$.getAxisSize(target) * index;
|
9630 | }
|
9631 | if (target === "main") {
|
9632 | x = asHalfPixel(state.margin.left);
|
9633 | y = asHalfPixel(state.margin.top);
|
9634 | } else if (target === "context") {
|
9635 | x = asHalfPixel(state.margin2.left);
|
9636 | y = asHalfPixel(state.margin2.top);
|
9637 | } else if (target === "legend") {
|
9638 | x = state.margin3.left;
|
9639 | y = state.margin3.top;
|
9640 | } else if (target === "x") {
|
9641 | x = isRotated ? -padding : 0;
|
9642 | y = isRotated ? 0 : state.height + padding;
|
9643 | } else if (target === "y") {
|
9644 | x = isRotated ? 0 : -padding;
|
9645 | y = isRotated ? state.height + padding : 0;
|
9646 | } else if (target === "y2") {
|
9647 | x = isRotated ? 0 : state.width + padding;
|
9648 | y = isRotated ? 1 - padding : 0;
|
9649 | } else if (target === "subX") {
|
9650 | x = 0;
|
9651 | y = isRotated ? 0 : state.height2;
|
9652 | } else if (target === "arc") {
|
9653 | x = state.arcWidth / 2;
|
9654 | y = state.arcHeight / 2;
|
9655 | } else if (target === "polar") {
|
9656 | x = state.arcWidth / 2;
|
9657 | y = state.arcHeight / 2;
|
9658 | } else if (target === "radar") {
|
9659 | var _$$$getRadarSize = $$.getRadarSize(),
|
9660 | width = _$$$getRadarSize[0];
|
9661 | x = state.width / 2 - width;
|
9662 | y = asHalfPixel(state.margin.top);
|
9663 | }
|
9664 | return "translate(" + x + ", " + y + ")";
|
9665 | },
|
9666 | transformMain: function transformMain(withTransition, transitions) {
|
9667 | var $$ = this,
|
9668 | main = $$.$el.main,
|
9669 | $T = $$.$T,
|
9670 | xAxis = transitions != null && transitions.axisX ? transitions.axisX : $T(main.select("." + $AXIS.axisX), withTransition),
|
9671 | yAxis = transitions != null && transitions.axisY ? transitions.axisY : $T(main.select("." + $AXIS.axisY), withTransition),
|
9672 | y2Axis = transitions != null && transitions.axisY2 ? transitions.axisY2 : $T(main.select("." + $AXIS.axisY2), withTransition);
|
9673 | $T(main, withTransition).attr("transform", $$.getTranslate("main"));
|
9674 | xAxis.attr("transform", $$.getTranslate("x"));
|
9675 | yAxis.attr("transform", $$.getTranslate("y"));
|
9676 | y2Axis.attr("transform", $$.getTranslate("y2"));
|
9677 | main.select("." + $ARC.chartArcs).attr("transform", $$.getTranslate("arc"));
|
9678 | },
|
9679 | transformAll: function transformAll(withTransition, transitions) {
|
9680 | var $$ = this,
|
9681 | config = $$.config,
|
9682 | hasAxis = $$.state.hasAxis,
|
9683 | $el = $$.$el;
|
9684 | $$.transformMain(withTransition, transitions);
|
9685 | hasAxis && config.subchart_show && $$.transformContext(withTransition, transitions);
|
9686 | $el.legend && $$.transformLegend(withTransition);
|
9687 | }
|
9688 | });
|
9689 | ;
|
9690 |
|
9691 |
|
9692 |
|
9693 |
|
9694 |
|
9695 |
|
9696 |
|
9697 | var type = ({
|
9698 | setTargetType: function setTargetType(targetIds, type) {
|
9699 | var _this = this,
|
9700 | $$ = this,
|
9701 | config = $$.config,
|
9702 | withoutFadeIn = $$.state.withoutFadeIn;
|
9703 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
9704 | _newArrowCheck(this, _this);
|
9705 | withoutFadeIn[id] = type === config.data_types[id];
|
9706 | config.data_types[id] = type;
|
9707 | }.bind(this));
|
9708 | if (!targetIds) {
|
9709 | config.data_type = type;
|
9710 | }
|
9711 | },
|
9712 | |
9713 |
|
9714 |
|
9715 |
|
9716 | updateTypesElements: function updateTypesElements() {
|
9717 | var _this2 = this,
|
9718 | $$ = this,
|
9719 | current = $$.state.current;
|
9720 | Object.keys(TYPE).forEach(function (v) {
|
9721 | _newArrowCheck(this, _this2);
|
9722 | var t = TYPE[v],
|
9723 | has = $$.hasType(t, null, !0),
|
9724 | idx = current.types.indexOf(t);
|
9725 | if (idx === -1 && has) {
|
9726 | current.types.push(t);
|
9727 | } else if (idx > -1 && !has) {
|
9728 | current.types.splice(idx, 1);
|
9729 | }
|
9730 | }.bind(this));
|
9731 |
|
9732 |
|
9733 | $$.setChartElements();
|
9734 | },
|
9735 | |
9736 |
|
9737 |
|
9738 |
|
9739 |
|
9740 |
|
9741 |
|
9742 |
|
9743 | hasType: function hasType(type, targetsValue, checkFromData) {
|
9744 | var _current$types,
|
9745 | _this3 = this;
|
9746 | if (checkFromData === void 0) {
|
9747 | checkFromData = !1;
|
9748 | }
|
9749 | var $$ = this,
|
9750 | config = $$.config,
|
9751 | current = $$.state.current,
|
9752 | types = config.data_types,
|
9753 | targets = targetsValue || $$.data.targets,
|
9754 | has = !1;
|
9755 | if (!checkFromData && ((_current$types = current.types) == null ? void 0 : _current$types.indexOf(type)) > -1) {
|
9756 | has = !0;
|
9757 | } else if (targets != null && targets.length) {
|
9758 | targets.forEach(function (target) {
|
9759 | _newArrowCheck(this, _this3);
|
9760 | var t = types[target.id];
|
9761 | if (t === type || !t && type === "line") {
|
9762 | has = !0;
|
9763 | }
|
9764 | }.bind(this));
|
9765 | } else if (Object.keys(types).length) {
|
9766 | Object.keys(types).forEach(function (id) {
|
9767 | _newArrowCheck(this, _this3);
|
9768 | if (types[id] === type) {
|
9769 | has = !0;
|
9770 | }
|
9771 | }.bind(this));
|
9772 | } else {
|
9773 | has = config.data_type === type;
|
9774 | }
|
9775 | return has;
|
9776 | },
|
9777 | |
9778 |
|
9779 |
|
9780 |
|
9781 |
|
9782 |
|
9783 |
|
9784 |
|
9785 | hasTypeOf: function hasTypeOf(type, targets, exclude) {
|
9786 | var _this4 = this;
|
9787 | if (exclude === void 0) {
|
9788 | exclude = [];
|
9789 | }
|
9790 | if (type in TYPE_BY_CATEGORY) {
|
9791 | return !TYPE_BY_CATEGORY[type].filter(function (v) {
|
9792 | _newArrowCheck(this, _this4);
|
9793 | return exclude.indexOf(v) === -1;
|
9794 | }.bind(this)).every(function (v) {
|
9795 | _newArrowCheck(this, _this4);
|
9796 | return !this.hasType(v, targets);
|
9797 | }.bind(this));
|
9798 | }
|
9799 | return !1;
|
9800 | },
|
9801 | |
9802 |
|
9803 |
|
9804 |
|
9805 |
|
9806 |
|
9807 |
|
9808 | isTypeOf: function isTypeOf(d, type) {
|
9809 | var id = isString(d) ? d : d.id,
|
9810 | dataType = this.config.data_types[id] || this.config.data_type;
|
9811 | return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
9812 | },
|
9813 | hasPointType: function hasPointType() {
|
9814 | var $$ = this;
|
9815 | return $$.hasTypeOf("Line") || $$.hasType("bubble") || $$.hasType("scatter");
|
9816 | },
|
9817 | |
9818 |
|
9819 |
|
9820 |
|
9821 |
|
9822 |
|
9823 |
|
9824 | hasArcType: function hasArcType(targets, exclude) {
|
9825 | return this.hasTypeOf("Arc", targets, exclude);
|
9826 | },
|
9827 | hasMultiArcGauge: function hasMultiArcGauge() {
|
9828 | return this.hasType("gauge") && this.config.gauge_type === "multi";
|
9829 | },
|
9830 | isLineType: function isLineType(d) {
|
9831 | var id = isString(d) ? d : d.id;
|
9832 | return !this.config.data_types[id] || this.isTypeOf(id, TYPE_BY_CATEGORY.Line);
|
9833 | },
|
9834 | isStepType: function isStepType(d) {
|
9835 | return this.isTypeOf(d, TYPE_BY_CATEGORY.Step);
|
9836 | },
|
9837 | isSplineType: function isSplineType(d) {
|
9838 | return this.isTypeOf(d, TYPE_BY_CATEGORY.Spline);
|
9839 | },
|
9840 | isAreaType: function isAreaType(d) {
|
9841 | return this.isTypeOf(d, TYPE_BY_CATEGORY.Area);
|
9842 | },
|
9843 | isAreaRangeType: function isAreaRangeType(d) {
|
9844 | return this.isTypeOf(d, TYPE_BY_CATEGORY.AreaRange);
|
9845 | },
|
9846 | isBarType: function isBarType(d) {
|
9847 | return this.isTypeOf(d, "bar");
|
9848 | },
|
9849 | isBubbleType: function isBubbleType(d) {
|
9850 | return this.isTypeOf(d, "bubble");
|
9851 | },
|
9852 | isCandlestickType: function isCandlestickType(d) {
|
9853 | return this.isTypeOf(d, "candlestick");
|
9854 | },
|
9855 | isScatterType: function isScatterType(d) {
|
9856 | return this.isTypeOf(d, "scatter");
|
9857 | },
|
9858 | isPieType: function isPieType(d) {
|
9859 | return this.isTypeOf(d, "pie");
|
9860 | },
|
9861 | isGaugeType: function isGaugeType(d) {
|
9862 | return this.isTypeOf(d, "gauge");
|
9863 | },
|
9864 | isDonutType: function isDonutType(d) {
|
9865 | return this.isTypeOf(d, "donut");
|
9866 | },
|
9867 | isPolarType: function isPolarType(d) {
|
9868 | return this.isTypeOf(d, "polar");
|
9869 | },
|
9870 | isRadarType: function isRadarType(d) {
|
9871 | return this.isTypeOf(d, "radar");
|
9872 | },
|
9873 | isArcType: function isArcType(d) {
|
9874 | return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
|
9875 | },
|
9876 |
|
9877 | isCirclePoint: function isCirclePoint(node) {
|
9878 | var config = this.config,
|
9879 | pattern = config.point_pattern,
|
9880 | isCircle = !1;
|
9881 | if ((node == null ? void 0 : node.tagName) === "circle") {
|
9882 | isCircle = !0;
|
9883 | } else {
|
9884 | isCircle = config.point_type === "circle" && (!pattern || isArray(pattern) && pattern.length === 0);
|
9885 | }
|
9886 | return isCircle;
|
9887 | },
|
9888 | lineData: function lineData(d) {
|
9889 | return this.isLineType(d) ? [d] : [];
|
9890 | },
|
9891 | arcData: function arcData(d) {
|
9892 | return this.isArcType(d.data) ? [d] : [];
|
9893 | },
|
9894 | |
9895 |
|
9896 |
|
9897 |
|
9898 |
|
9899 |
|
9900 | labelishData: function labelishData(d) {
|
9901 | var _this5 = this;
|
9902 | return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isCandlestickType(d) || this.isRadarType(d) ? d.values.filter(function (v) {
|
9903 | _newArrowCheck(this, _this5);
|
9904 | return isNumber(v.value) || !!v.value;
|
9905 | }.bind(this)) : [];
|
9906 | },
|
9907 | barLineBubbleData: function barLineBubbleData(d) {
|
9908 | return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
|
9909 | },
|
9910 |
|
9911 | isInterpolationType: function isInterpolationType(type) {
|
9912 | 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;
|
9913 | }
|
9914 | });
|
9915 | ;
|
9916 |
|
9917 |
|
9918 |
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 |
|
9924 |
|
9925 |
|
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 |
|
9935 |
|
9936 |
|
9937 |
|
9938 |
|
9939 |
|
9940 |
|
9941 |
|
9942 |
|
9943 |
|
9944 |
|
9945 |
|
9946 |
|
9947 |
|
9948 |
|
9949 |
|
9950 |
|
9951 |
|
9952 |
|
9953 |
|
9954 |
|
9955 |
|
9956 |
|
9957 |
|
9958 |
|
9959 |
|
9960 |
|
9961 |
|
9962 |
|
9963 |
|
9964 |
|
9965 |
|
9966 | var ChartInternal = function () {
|
9967 |
|
9968 |
|
9969 |
|
9970 |
|
9971 |
|
9972 |
|
9973 |
|
9974 |
|
9975 |
|
9976 |
|
9977 |
|
9978 |
|
9979 |
|
9980 |
|
9981 |
|
9982 |
|
9983 |
|
9984 |
|
9985 |
|
9986 |
|
9987 | function ChartInternal(api) {
|
9988 | this.api = void 0;
|
9989 | this.config = void 0;
|
9990 | this.cache = void 0;
|
9991 | this.$el = void 0;
|
9992 | this.state = void 0;
|
9993 | this.charts = void 0;
|
9994 | this.data = {
|
9995 | xs: {},
|
9996 | targets: []
|
9997 | };
|
9998 | this.axis = void 0;
|
9999 | this.scale = {
|
10000 | x: null,
|
10001 | y: null,
|
10002 | y2: null,
|
10003 | subX: null,
|
10004 | subY: null,
|
10005 | subY2: null,
|
10006 | zoom: null
|
10007 | };
|
10008 | this.org = {
|
10009 | xScale: null,
|
10010 | xDomain: null
|
10011 | };
|
10012 | this.color = void 0;
|
10013 | this.patterns = void 0;
|
10014 | this.levelColor = void 0;
|
10015 | this.point = void 0;
|
10016 | this.brush = void 0;
|
10017 | this.format = {
|
10018 | extraLineClasses: null,
|
10019 | xAxisTick: null,
|
10020 | dataTime: null,
|
10021 |
|
10022 | defaultAxisTime: null,
|
10023 |
|
10024 | axisTime: null
|
10025 | };
|
10026 |
|
10027 | var $$ = this;
|
10028 | $$.api = api;
|
10029 | $$.config = new Options();
|
10030 | $$.cache = new Cache();
|
10031 | var store = new Store();
|
10032 | $$.$el = store.getStore("element");
|
10033 | $$.state = store.getStore("state");
|
10034 | $$.$T = $$.$T.bind($$);
|
10035 | }
|
10036 |
|
10037 | |
10038 |
|
10039 |
|
10040 |
|
10041 |
|
10042 |
|
10043 |
|
10044 |
|
10045 | var _proto = ChartInternal.prototype;
|
10046 | _proto.$T = function $T(selection, force, name) {
|
10047 | var config = this.config,
|
10048 | state = this.state,
|
10049 | duration = config.transition_duration,
|
10050 | subchart = config.subchart_show,
|
10051 | t = selection;
|
10052 | if (t) {
|
10053 |
|
10054 | if ("tagName" in t) {
|
10055 | t = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(t);
|
10056 | }
|
10057 |
|
10058 |
|
10059 |
|
10060 |
|
10061 |
|
10062 |
|
10063 | var transit = (force !== !1 && duration || force) && (!state.zooming || state.dragging) && !state.resizing && state.rendered && !subchart;
|
10064 | t = transit ? t.transition(name).duration(duration) : t;
|
10065 | }
|
10066 | return t;
|
10067 | };
|
10068 | _proto.beforeInit = function beforeInit() {
|
10069 | var $$ = this;
|
10070 | $$.callPluginHook("$beforeInit");
|
10071 |
|
10072 |
|
10073 | callFn($$.config.onbeforeinit, $$.api);
|
10074 | };
|
10075 | _proto.afterInit = function afterInit() {
|
10076 | var $$ = this;
|
10077 | $$.callPluginHook("$afterInit");
|
10078 |
|
10079 |
|
10080 | callFn($$.config.onafterinit, $$.api);
|
10081 | };
|
10082 | _proto.init = function init() {
|
10083 | var $$ = this,
|
10084 | config = $$.config,
|
10085 | state = $$.state,
|
10086 | $el = $$.$el,
|
10087 | useCssRule = config.boost_useCssRule;
|
10088 | checkModuleImport($$);
|
10089 | state.hasAxis = !$$.hasArcType();
|
10090 | state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
10091 |
|
10092 |
|
10093 | state.datetimeId = "bb-" + +new Date() * getRandom();
|
10094 | if (useCssRule) {
|
10095 |
|
10096 | var styleEl = browser_doc.createElement("style");
|
10097 |
|
10098 |
|
10099 | styleEl.type = "text/css";
|
10100 | browser_doc.head.appendChild(styleEl);
|
10101 | state.style = {
|
10102 | rootSelctor: "." + state.datetimeId,
|
10103 | sheet: styleEl.sheet
|
10104 | };
|
10105 |
|
10106 |
|
10107 | $el.style = styleEl;
|
10108 | }
|
10109 | var bindto = {
|
10110 | element: config.bindto,
|
10111 | classname: "bb"
|
10112 | };
|
10113 | if (isObject(config.bindto)) {
|
10114 | bindto.element = config.bindto.element || "#chart";
|
10115 | bindto.classname = config.bindto.classname || bindto.classname;
|
10116 | }
|
10117 |
|
10118 |
|
10119 | $el.chart = isFunction(bindto.element.node) ? config.bindto.element : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(bindto.element || []);
|
10120 | if ($el.chart.empty()) {
|
10121 | $el.chart = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.body.appendChild(browser_doc.createElement("div")));
|
10122 | }
|
10123 | $el.chart.html("").classed(bindto.classname, !0).classed(state.datetimeId, useCssRule).style("position", "relative");
|
10124 | $$.initParams();
|
10125 | $$.initToRender();
|
10126 | }
|
10127 |
|
10128 | |
10129 |
|
10130 |
|
10131 |
|
10132 | ;
|
10133 | _proto.initToRender = function initToRender(forced) {
|
10134 | var _this = this,
|
10135 | $$ = this,
|
10136 | config = $$.config,
|
10137 | state = $$.state,
|
10138 | chart = $$.$el.chart,
|
10139 | isHidden = function () {
|
10140 | _newArrowCheck(this, _this);
|
10141 | return chart.style("display") === "none" || chart.style("visibility") === "hidden";
|
10142 | }.bind(this),
|
10143 | isLazy = config.render.lazy || isHidden(),
|
10144 | MutationObserver = win.MutationObserver;
|
10145 | if (isLazy && MutationObserver && config.render.observe !== !1 && !forced) {
|
10146 | new MutationObserver(function (mutation, observer) {
|
10147 | _newArrowCheck(this, _this);
|
10148 | if (!isHidden()) {
|
10149 | observer.disconnect();
|
10150 | state.rendered || $$.initToRender(!0);
|
10151 | }
|
10152 | }.bind(this)).observe(chart.node(), {
|
10153 | attributes: !0,
|
10154 | attributeFilter: ["class", "style"]
|
10155 | });
|
10156 | }
|
10157 | if (!isLazy || forced) {
|
10158 | $$.convertData(config, function (res) {
|
10159 | _newArrowCheck(this, _this);
|
10160 | $$.initWithData(res);
|
10161 | $$.afterInit();
|
10162 | }.bind(this));
|
10163 | }
|
10164 | };
|
10165 | _proto.initParams = function initParams() {
|
10166 | var _this2 = this,
|
10167 | $$ = this,
|
10168 | config = $$.config,
|
10169 | format = $$.format,
|
10170 | state = $$.state,
|
10171 | isRotated = config.axis_rotated;
|
10172 |
|
10173 | $$.color = $$.generateColor();
|
10174 | $$.levelColor = $$.generateLevelColor();
|
10175 |
|
10176 |
|
10177 | if (config.padding === !1) {
|
10178 | config.axis_x_show = !1;
|
10179 | config.axis_y_show = !1;
|
10180 | config.axis_y2_show = !1;
|
10181 | config.subchart_show = !1;
|
10182 | }
|
10183 | if ($$.hasPointType()) {
|
10184 | $$.point = $$.generatePoint();
|
10185 | }
|
10186 | if (state.hasAxis) {
|
10187 | $$.initClip();
|
10188 | format.extraLineClasses = $$.generateExtraLineClass();
|
10189 | format.dataTime = config.data_xLocaltime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeParse : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcParse;
|
10190 | format.axisTime = config.axis_x_localtime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeFormat : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcFormat;
|
10191 | var isDragZoom = $$.config.zoom_enabled && $$.config.zoom_type === "drag";
|
10192 | format.defaultAxisTime = function (d) {
|
10193 | _newArrowCheck(this, _this2);
|
10194 | var _$$$scale = $$.scale,
|
10195 | x = _$$$scale.x,
|
10196 | zoom = _$$$scale.zoom,
|
10197 | isZoomed = isDragZoom ? zoom : zoom && x.orgDomain().toString() !== zoom.domain().toString(),
|
10198 | 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";
|
10199 | return format.axisTime(specifier)(d);
|
10200 | }.bind(this);
|
10201 | }
|
10202 | state.isLegendRight = config.legend_position === "right";
|
10203 | state.isLegendInset = config.legend_position === "inset";
|
10204 | state.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right";
|
10205 | state.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left";
|
10206 | state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
|
10207 | state.rotatedPadding.right = isRotated && !config.axis_x_show ? 0 : 30;
|
10208 | state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
|
10209 | };
|
10210 | _proto.initWithData = function initWithData(data) {
|
10211 | var _this3 = this,
|
10212 | $$ = this,
|
10213 | config = $$.config,
|
10214 | scale = $$.scale,
|
10215 | state = $$.state,
|
10216 | $el = $$.$el,
|
10217 | org = $$.org,
|
10218 | hasAxis = state.hasAxis,
|
10219 | hasInteraction = config.interaction_enabled,
|
10220 | hasPolar = $$.hasType("polar");
|
10221 |
|
10222 |
|
10223 |
|
10224 | if (hasAxis) {
|
10225 | $$.axis = $$.getAxisInstance();
|
10226 | config.zoom_enabled && $$.initZoom();
|
10227 | }
|
10228 |
|
10229 |
|
10230 | $$.data.xs = {};
|
10231 | $$.data.targets = $$.convertDataToTargets(data);
|
10232 | if (config.data_filter) {
|
10233 | $$.data.targets = $$.data.targets.filter(config.data_filter.bind($$.api));
|
10234 | }
|
10235 |
|
10236 |
|
10237 | if (config.data_hide) {
|
10238 | $$.addHiddenTargetIds(config.data_hide === !0 ? $$.mapToIds($$.data.targets) : config.data_hide);
|
10239 | }
|
10240 | if (config.legend_hide) {
|
10241 | $$.addHiddenLegendIds(config.legend_hide === !0 ? $$.mapToIds($$.data.targets) : config.legend_hide);
|
10242 | }
|
10243 |
|
10244 |
|
10245 | $$.updateSizes();
|
10246 | $$.updateScales(!0);
|
10247 |
|
10248 |
|
10249 | var x = scale.x,
|
10250 | y = scale.y,
|
10251 | y2 = scale.y2,
|
10252 | subX = scale.subX,
|
10253 | subY = scale.subY,
|
10254 | subY2 = scale.subY2;
|
10255 |
|
10256 |
|
10257 | if (x) {
|
10258 | x.domain(sortValue($$.getXDomain($$.data.targets)));
|
10259 | subX.domain(x.domain());
|
10260 |
|
10261 |
|
10262 | org.xDomain = x.domain();
|
10263 | }
|
10264 | if (y) {
|
10265 | y.domain($$.getYDomain($$.data.targets, "y"));
|
10266 | subY.domain(y.domain());
|
10267 | }
|
10268 | if (y2) {
|
10269 | y2.domain($$.getYDomain($$.data.targets, "y2"));
|
10270 | subY2 && subY2.domain(y2.domain());
|
10271 | }
|
10272 |
|
10273 |
|
10274 | $el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block");
|
10275 | if (hasInteraction && state.inputType) {
|
10276 | var isTouch = state.inputType === "touch",
|
10277 | onclick = config.onclick,
|
10278 | onover = config.onover,
|
10279 | onout = config.onout;
|
10280 | $el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(isTouch ? "touchstart" : "mouseenter", (onover == null ? void 0 : onover.bind($$.api)) || null).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
|
10281 | }
|
10282 | config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
10283 |
|
10284 |
|
10285 | var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
10286 | if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
10287 | $el.defs = $el.svg.append("defs");
|
10288 | if (hasAxis) {
|
10289 | ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
10290 | _newArrowCheck(this, _this3);
|
10291 | $$.appendClip($el.defs, state.clip[v]);
|
10292 | }.bind(this));
|
10293 | }
|
10294 |
|
10295 |
|
10296 | $$.generateDataLabelBackgroundColorFilter();
|
10297 |
|
10298 |
|
10299 | if (hasColorPatterns) {
|
10300 | $$.patterns.forEach(function (p) {
|
10301 | var _this4 = this;
|
10302 | _newArrowCheck(this, _this3);
|
10303 | return $el.defs.append(function () {
|
10304 | _newArrowCheck(this, _this4);
|
10305 | return p.node;
|
10306 | }.bind(this));
|
10307 | }.bind(this));
|
10308 | }
|
10309 | }
|
10310 | $$.updateSvgSize();
|
10311 |
|
10312 |
|
10313 | $$.bindResize();
|
10314 |
|
10315 |
|
10316 | var main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", $$.getTranslate("main"));
|
10317 | $el.main = main;
|
10318 |
|
10319 |
|
10320 | config.subchart_show && $$.initSubchart();
|
10321 | config.tooltip_show && $$.initTooltip();
|
10322 | config.title_text && $$.initTitle();
|
10323 | config.legend_show && $$.initLegend();
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 | if (config.data_empty_label_text) {
|
10329 | main.append("text").attr("class", $TEXT.text + " " + $COMMON.empty).attr("text-anchor", "middle")
|
10330 | .attr("dominant-baseline", "middle");
|
10331 | }
|
10332 |
|
10333 | if (hasAxis) {
|
10334 |
|
10335 | config.regions.length && $$.initRegion();
|
10336 |
|
10337 |
|
10338 | config.clipPath || $$.axis.init();
|
10339 | }
|
10340 |
|
10341 |
|
10342 | main.append("g").classed($COMMON.chart, !0).attr("clip-path", hasAxis ? state.clip.path : null);
|
10343 | $$.callPluginHook("$init");
|
10344 | if (hasAxis) {
|
10345 | var _$$$axis;
|
10346 |
|
10347 | hasInteraction && ($$.initEventRect == null ? void 0 : $$.initEventRect());
|
10348 |
|
10349 |
|
10350 | $$.initGrid();
|
10351 |
|
10352 |
|
10353 | config.clipPath && ((_$$$axis = $$.axis) == null ? void 0 : _$$$axis.init());
|
10354 | }
|
10355 | $$.initChartElements();
|
10356 |
|
10357 |
|
10358 | $$.updateTargets($$.data.targets);
|
10359 |
|
10360 |
|
10361 | $$.updateDimension();
|
10362 |
|
10363 |
|
10364 | callFn(config.oninit, $$.api);
|
10365 |
|
10366 |
|
10367 | $$.setBackground();
|
10368 | $$.redraw({
|
10369 | withTransition: !1,
|
10370 | withTransform: !0,
|
10371 | withUpdateXDomain: !0,
|
10372 | withUpdateOrgXDomain: !0,
|
10373 | withTransitionForAxis: !1,
|
10374 | initializing: !0
|
10375 | });
|
10376 |
|
10377 |
|
10378 | if (config.data_onmin || config.data_onmax) {
|
10379 | var minMax = $$.getMinMaxData();
|
10380 | callFn(config.data_onmin, $$.api, minMax.min);
|
10381 | callFn(config.data_onmax, $$.api, minMax.max);
|
10382 | }
|
10383 | config.tooltip_show && $$.initShowTooltip();
|
10384 | state.rendered = !0;
|
10385 | }
|
10386 |
|
10387 | |
10388 |
|
10389 |
|
10390 | ;
|
10391 | _proto.initChartElements = function initChartElements() {
|
10392 | var _this5 = this,
|
10393 | $$ = this,
|
10394 | _$$$state = $$.state,
|
10395 | hasAxis = _$$$state.hasAxis,
|
10396 | hasRadar = _$$$state.hasRadar,
|
10397 | types = [];
|
10398 | if (hasAxis) {
|
10399 | ["bar", "bubble", "candlestick", "line"].forEach(function (v) {
|
10400 | _newArrowCheck(this, _this5);
|
10401 | var name = capitalize(v);
|
10402 | if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
|
10403 | types.push(name);
|
10404 | }
|
10405 | }.bind(this));
|
10406 | } else {
|
10407 | var hasPolar = $$.hasType("polar");
|
10408 | if (!hasRadar) {
|
10409 | types.push("Arc", "Pie");
|
10410 | }
|
10411 | if ($$.hasType("gauge")) {
|
10412 | types.push("Gauge");
|
10413 | } else if (hasRadar) {
|
10414 | types.push("Radar");
|
10415 | } else if (hasPolar) {
|
10416 | types.push("Polar");
|
10417 | }
|
10418 | }
|
10419 | types.forEach(function (v) {
|
10420 | _newArrowCheck(this, _this5);
|
10421 | $$["init" + v]();
|
10422 | }.bind(this));
|
10423 | notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"]) && $$.initText();
|
10424 | }
|
10425 |
|
10426 | |
10427 |
|
10428 |
|
10429 | ;
|
10430 | _proto.setChartElements = function setChartElements() {
|
10431 | var $$ = this,
|
10432 | _$$$$el = $$.$el,
|
10433 | chart = _$$$$el.chart,
|
10434 | svg = _$$$$el.svg,
|
10435 | defs = _$$$$el.defs,
|
10436 | main = _$$$$el.main,
|
10437 | tooltip = _$$$$el.tooltip,
|
10438 | legend = _$$$$el.legend,
|
10439 | title = _$$$$el.title,
|
10440 | grid = _$$$$el.grid,
|
10441 | arc = _$$$$el.arcs,
|
10442 | circles = _$$$$el.circle,
|
10443 | bars = _$$$$el.bar,
|
10444 | candlestick = _$$$$el.candlestick,
|
10445 | lines = _$$$$el.line,
|
10446 | areas = _$$$$el.area,
|
10447 | texts = _$$$$el.text;
|
10448 | $$.api.$ = {
|
10449 | chart: chart,
|
10450 | svg: svg,
|
10451 | defs: defs,
|
10452 | main: main,
|
10453 | tooltip: tooltip,
|
10454 | legend: legend,
|
10455 | title: title,
|
10456 | grid: grid,
|
10457 | arc: arc,
|
10458 | circles: circles,
|
10459 | bar: {
|
10460 | bars: bars
|
10461 | },
|
10462 | candlestick: candlestick,
|
10463 | line: {
|
10464 | lines: lines,
|
10465 | areas: areas
|
10466 | },
|
10467 | text: {
|
10468 | texts: texts
|
10469 | }
|
10470 | };
|
10471 | }
|
10472 |
|
10473 | |
10474 |
|
10475 |
|
10476 | ;
|
10477 | _proto.setBackground = function setBackground() {
|
10478 | var $$ = this,
|
10479 | bg = $$.config.background,
|
10480 | state = $$.state,
|
10481 | svg = $$.$el.svg;
|
10482 | if (notEmpty(bg)) {
|
10483 | var element = svg.select("g").insert(bg.imgUrl ? "image" : "rect", ":first-child");
|
10484 | if (bg.imgUrl) {
|
10485 | element.attr("href", bg.imgUrl);
|
10486 | } else if (bg.color) {
|
10487 | element.style("fill", bg.color).attr("clip-path", state.clip.path);
|
10488 | }
|
10489 | element.attr("class", bg.class || null).attr("width", "100%").attr("height", "100%");
|
10490 | }
|
10491 | }
|
10492 |
|
10493 | |
10494 |
|
10495 |
|
10496 |
|
10497 | ;
|
10498 | _proto.updateTargets = function updateTargets(targets) {
|
10499 | var _this6 = this,
|
10500 | $$ = this,
|
10501 | _$$$state2 = $$.state,
|
10502 | hasAxis = _$$$state2.hasAxis,
|
10503 | hasRadar = _$$$state2.hasRadar,
|
10504 | helper = function (type) {
|
10505 | _newArrowCheck(this, _this6);
|
10506 | return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
|
10507 | }.bind(this);
|
10508 |
|
10509 | $$.updateTargetsForText(targets);
|
10510 | if (hasAxis) {
|
10511 | ["bar", "candlestick", "line"].forEach(function (v) {
|
10512 | _newArrowCheck(this, _this6);
|
10513 | var name = capitalize(v);
|
10514 | if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
|
10515 | helper(name);
|
10516 | }
|
10517 | }.bind(this));
|
10518 |
|
10519 |
|
10520 | $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
|
10521 |
|
10522 |
|
10523 | } else if ($$.hasArcType(targets)) {
|
10524 | var type = "Arc";
|
10525 | if (hasRadar) {
|
10526 | type = "Radar";
|
10527 | } else if ($$.hasType("polar")) {
|
10528 | type = "Polar";
|
10529 | }
|
10530 | helper(type);
|
10531 | }
|
10532 |
|
10533 |
|
10534 | var hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
|
10535 | if (hasPointType) {
|
10536 | $$.updateTargetForCircle == null ? void 0 : $$.updateTargetForCircle();
|
10537 | }
|
10538 |
|
10539 |
|
10540 | $$.filterTargetsToShowAtInit(hasPointType);
|
10541 | }
|
10542 |
|
10543 | |
10544 |
|
10545 |
|
10546 |
|
10547 | ;
|
10548 | _proto.filterTargetsToShowAtInit = function filterTargetsToShowAtInit(hasPointType) {
|
10549 | var _this7 = this;
|
10550 | if (hasPointType === void 0) {
|
10551 | hasPointType = !1;
|
10552 | }
|
10553 | var $$ = this,
|
10554 | svg = $$.$el.svg,
|
10555 | $T = $$.$T,
|
10556 | selector = "." + $COMMON.target;
|
10557 | if (hasPointType) {
|
10558 | selector += ", ." + $CIRCLE.chartCircles + " > ." + $CIRCLE.circles;
|
10559 | }
|
10560 | $T(svg.selectAll(selector).filter(function (d) {
|
10561 | _newArrowCheck(this, _this7);
|
10562 | return $$.isTargetToShow(d.id);
|
10563 | }.bind(this))).style("opacity", null);
|
10564 | };
|
10565 | _proto.getWithOption = function getWithOption(options) {
|
10566 | var _this8 = this,
|
10567 | withOptions = {
|
10568 | Dimension: !0,
|
10569 | EventRect: !0,
|
10570 | Legend: !1,
|
10571 | Subchart: !0,
|
10572 | Transform: !1,
|
10573 | Transition: !0,
|
10574 | TrimXDomain: !0,
|
10575 | UpdateXAxis: "UpdateXDomain",
|
10576 | UpdateXDomain: !1,
|
10577 | UpdateOrgXDomain: !1,
|
10578 | TransitionForExit: "Transition",
|
10579 | TransitionForAxis: "Transition",
|
10580 | Y: !0
|
10581 | };
|
10582 | Object.keys(withOptions).forEach(function (key) {
|
10583 | _newArrowCheck(this, _this8);
|
10584 | var defVal = withOptions[key];
|
10585 | if (isString(defVal)) {
|
10586 | defVal = withOptions[defVal];
|
10587 | }
|
10588 | withOptions[key] = getOption(options, "with" + key, defVal);
|
10589 | }.bind(this));
|
10590 | return withOptions;
|
10591 | };
|
10592 | _proto.initialOpacity = function initialOpacity(d) {
|
10593 | var $$ = this,
|
10594 | withoutFadeIn = $$.state.withoutFadeIn,
|
10595 | r = $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
|
10596 | return r;
|
10597 | };
|
10598 | _proto.bindResize = function bindResize() {
|
10599 | var _this9 = this,
|
10600 | $$ = this,
|
10601 | config = $$.config,
|
10602 | state = $$.state,
|
10603 | resizeFunction = generateResize(config.resize_timer),
|
10604 | list = [];
|
10605 | list.push(function () {
|
10606 | _newArrowCheck(this, _this9);
|
10607 | return callFn(config.onresize, $$.api);
|
10608 | }.bind(this));
|
10609 | if (config.resize_auto) {
|
10610 | list.push(function () {
|
10611 | _newArrowCheck(this, _this9);
|
10612 | state.resizing = !0;
|
10613 |
|
10614 |
|
10615 | if (config.legend_show) {
|
10616 | $$.updateSizes();
|
10617 | $$.updateLegend();
|
10618 | }
|
10619 | $$.api.flush(!1);
|
10620 | }.bind(this));
|
10621 | }
|
10622 | list.push(function () {
|
10623 | _newArrowCheck(this, _this9);
|
10624 | callFn(config.onresized, $$.api);
|
10625 | state.resizing = !1;
|
10626 | }.bind(this));
|
10627 |
|
10628 |
|
10629 | list.forEach(function (v) {
|
10630 | _newArrowCheck(this, _this9);
|
10631 | return resizeFunction.add(v);
|
10632 | }.bind(this));
|
10633 | $$.resizeFunction = resizeFunction;
|
10634 |
|
10635 |
|
10636 | win.addEventListener("resize", $$.resizeFunction = resizeFunction);
|
10637 | }
|
10638 |
|
10639 | |
10640 |
|
10641 |
|
10642 |
|
10643 |
|
10644 | ;
|
10645 | _proto.callPluginHook = function callPluginHook(phase) {
|
10646 | for (var _this10 = this, _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
10647 | args[_key - 1] = arguments[_key];
|
10648 | }
|
10649 | this.config.plugins.forEach(function (v) {
|
10650 | _newArrowCheck(this, _this10);
|
10651 | if (phase === "$beforeInit") {
|
10652 | v.$$ = this;
|
10653 | this.api.plugins.push(v);
|
10654 | }
|
10655 | v[phase].apply(v, args);
|
10656 | }.bind(this));
|
10657 | };
|
10658 | return ChartInternal;
|
10659 | }();
|
10660 |
|
10661 | extend(ChartInternal.prototype, [
|
10662 |
|
10663 | convert, data_data, load, category, internals_class, internals_color, domain, interactions_interaction, format, internals_legend, redraw, scale, shape, size, style, internals_text, internals_title, internals_tooltip, transform, type]);
|
10664 | ;
|
10665 |
|
10666 |
|
10667 |
|
10668 |
|
10669 |
|
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 |
|
10675 |
|
10676 | function loadConfig(config) {
|
10677 | var _this = this,
|
10678 | thisConfig = this.config,
|
10679 | target,
|
10680 | keys,
|
10681 | read,
|
10682 | find = function () {
|
10683 | _newArrowCheck(this, _this);
|
10684 | var key = keys.shift();
|
10685 | if (key && target && isObjectType(target) && key in target) {
|
10686 | target = target[key];
|
10687 | return find();
|
10688 | } else if (!key) {
|
10689 | return target;
|
10690 | }
|
10691 | return undefined;
|
10692 | }.bind(this);
|
10693 | Object.keys(thisConfig).forEach(function (key) {
|
10694 | _newArrowCheck(this, _this);
|
10695 | target = config;
|
10696 | keys = key.split("_");
|
10697 | read = find();
|
10698 | if (isDefined(read)) {
|
10699 | thisConfig[key] = read;
|
10700 | }
|
10701 | }.bind(this));
|
10702 |
|
10703 |
|
10704 | if (this.api) {
|
10705 | this.state.orgConfig = config;
|
10706 | }
|
10707 | }
|
10708 | ;
|
10709 |
|
10710 |
|
10711 |
|
10712 |
|
10713 |
|
10714 |
|
10715 |
|
10716 | var chart = ({
|
10717 | |
10718 |
|
10719 |
|
10720 |
|
10721 |
|
10722 |
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 | resize: function resize(size) {
|
10733 | var $$ = this.internal,
|
10734 | config = $$.config,
|
10735 | state = $$.state;
|
10736 | if (state.rendered) {
|
10737 | config.size_width = size ? size.width : null;
|
10738 | config.size_height = size ? size.height : null;
|
10739 | state.resizing = !0;
|
10740 | this.flush(!1);
|
10741 | $$.resizeFunction();
|
10742 | }
|
10743 | },
|
10744 | |
10745 |
|
10746 |
|
10747 |
|
10748 |
|
10749 |
|
10750 |
|
10751 |
|
10752 |
|
10753 |
|
10754 |
|
10755 |
|
10756 |
|
10757 | flush: function flush(soft) {
|
10758 | var $$ = this.internal,
|
10759 | state = $$.state,
|
10760 | zoomResetBtn = $$.$el.zoomResetBtn;
|
10761 | if (state.rendered) {
|
10762 |
|
10763 |
|
10764 | if (state.resizing) {
|
10765 | var _$$$brush;
|
10766 |
|
10767 | (_$$$brush = $$.brush) == null ? void 0 : _$$$brush.updateResize();
|
10768 | } else {
|
10769 | var _$$$axis;
|
10770 |
|
10771 | (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.setOrient();
|
10772 | }
|
10773 |
|
10774 |
|
10775 |
|
10776 | zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none");
|
10777 | $$.scale.zoom = null;
|
10778 | soft ? $$.redraw({
|
10779 | withTransform: !0,
|
10780 | withUpdateXDomain: !0,
|
10781 | withUpdateOrgXDomain: !0,
|
10782 | withLegend: !0
|
10783 | }) : $$.updateAndRedraw({
|
10784 | withLegend: !0,
|
10785 | withTransition: !1,
|
10786 | withTransitionForTransform: !1
|
10787 | });
|
10788 |
|
10789 |
|
10790 | if (!state.resizing && $$.brush) {
|
10791 | $$.brush.getSelection().call($$.brush.move);
|
10792 | $$.unselectRect();
|
10793 | }
|
10794 | } else {
|
10795 | $$.initToRender(!0);
|
10796 | }
|
10797 | },
|
10798 | |
10799 |
|
10800 |
|
10801 |
|
10802 |
|
10803 |
|
10804 |
|
10805 |
|
10806 |
|
10807 | destroy: function destroy() {
|
10808 | var _this = this,
|
10809 | $$ = this.internal,
|
10810 | _$$$$el = $$.$el,
|
10811 | chart = _$$$$el.chart,
|
10812 | style = _$$$$el.style,
|
10813 | svg = _$$$$el.svg;
|
10814 | if (notEmpty($$)) {
|
10815 | $$.callPluginHook("$willDestroy");
|
10816 | $$.charts.splice($$.charts.indexOf(this), 1);
|
10817 |
|
10818 |
|
10819 | $$.unbindAllEvents();
|
10820 |
|
10821 |
|
10822 | svg.select("*").interrupt();
|
10823 | $$.resizeFunction.clear();
|
10824 | win.removeEventListener("resize", $$.resizeFunction);
|
10825 | chart.classed("bb", !1).style("position", null).selectChildren().remove();
|
10826 |
|
10827 |
|
10828 | style && style.parentNode.removeChild(style);
|
10829 |
|
10830 |
|
10831 | Object.keys(this).forEach(function (key) {
|
10832 | var _this2 = this;
|
10833 | _newArrowCheck(this, _this);
|
10834 | key === "internal" && Object.keys($$).forEach(function (k) {
|
10835 | _newArrowCheck(this, _this2);
|
10836 | $$[k] = null;
|
10837 | }.bind(this));
|
10838 | this[key] = null;
|
10839 | delete this[key];
|
10840 | }.bind(this));
|
10841 |
|
10842 |
|
10843 | for (var key in this) {
|
10844 | this[key] = function () {
|
10845 | _newArrowCheck(this, _this);
|
10846 | }.bind(this);
|
10847 | }
|
10848 | }
|
10849 | return null;
|
10850 | },
|
10851 | |
10852 |
|
10853 |
|
10854 |
|
10855 |
|
10856 |
|
10857 |
|
10858 |
|
10859 |
|
10860 |
|
10861 |
|
10862 |
|
10863 |
|
10864 |
|
10865 |
|
10866 |
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 |
|
10872 |
|
10873 |
|
10874 |
|
10875 |
|
10876 |
|
10877 | config: function (name, value, redraw) {
|
10878 | var $$ = this.internal,
|
10879 | config = $$.config,
|
10880 | state = $$.state,
|
10881 | key = name == null ? void 0 : name.replace(/\./g, "_"),
|
10882 | res;
|
10883 | if (name && key in config) {
|
10884 | if (isDefined(value)) {
|
10885 | config[key] = value;
|
10886 | res = value;
|
10887 | redraw && this.flush();
|
10888 | } else {
|
10889 | res = config[key];
|
10890 | }
|
10891 | } else {
|
10892 | res = state.orgConfig;
|
10893 | }
|
10894 | return res;
|
10895 | }
|
10896 | });
|
10897 | ;
|
10898 |
|
10899 |
|
10900 |
|
10901 |
|
10902 | var api_color = ({
|
10903 | |
10904 |
|
10905 |
|
10906 |
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 |
|
10912 |
|
10913 | color: function color(id) {
|
10914 | return this.internal.color(id);
|
10915 | }
|
10916 | });
|
10917 | ;
|
10918 |
|
10919 |
|
10920 |
|
10921 |
|
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 |
|
10933 |
|
10934 |
|
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 |
|
10941 |
|
10942 |
|
10943 | function api_data_data(targetIds) {
|
10944 | var _this = this,
|
10945 | targets = this.internal.data.targets;
|
10946 | if (!isUndefined(targetIds)) {
|
10947 | var ids = isArray(targetIds) ? targetIds : [targetIds];
|
10948 | return targets.filter(function (t) {
|
10949 | var _this2 = this;
|
10950 | _newArrowCheck(this, _this);
|
10951 | return ids.some(function (v) {
|
10952 | _newArrowCheck(this, _this2);
|
10953 | return v === t.id;
|
10954 | }.bind(this));
|
10955 | }.bind(this));
|
10956 | }
|
10957 | return targets;
|
10958 | }
|
10959 | extend(api_data_data, {
|
10960 | |
10961 |
|
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 |
|
10967 |
|
10968 |
|
10969 |
|
10970 |
|
10971 |
|
10972 |
|
10973 |
|
10974 |
|
10975 |
|
10976 |
|
10977 |
|
10978 | shown: function shown(targetIds) {
|
10979 | return this.internal.filterTargetsToShow(this.data(targetIds));
|
10980 | },
|
10981 | |
10982 |
|
10983 |
|
10984 |
|
10985 |
|
10986 |
|
10987 |
|
10988 |
|
10989 |
|
10990 |
|
10991 |
|
10992 |
|
10993 |
|
10994 | values: function (targetIds, flat) {
|
10995 | var _this3 = this;
|
10996 | if (flat === void 0) {
|
10997 | flat = !0;
|
10998 | }
|
10999 | var values = null;
|
11000 | if (targetIds) {
|
11001 | var targets = this.data(targetIds);
|
11002 | if (isArray(targets)) {
|
11003 | values = [];
|
11004 | targets.forEach(function (v) {
|
11005 | var _this4 = this;
|
11006 | _newArrowCheck(this, _this3);
|
11007 | var dataValue = v.values.map(function (d) {
|
11008 | _newArrowCheck(this, _this4);
|
11009 | return d.value;
|
11010 | }.bind(this));
|
11011 | flat ? values = values.concat(dataValue) : values.push(dataValue);
|
11012 | }.bind(this));
|
11013 | }
|
11014 | }
|
11015 | return values;
|
11016 | },
|
11017 | |
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 |
|
11025 |
|
11026 |
|
11027 |
|
11028 |
|
11029 |
|
11030 |
|
11031 |
|
11032 |
|
11033 |
|
11034 |
|
11035 | names: function names(_names) {
|
11036 | var $$ = this.internal;
|
11037 | return $$.updateDataAttributes("names", _names);
|
11038 | },
|
11039 | |
11040 |
|
11041 |
|
11042 |
|
11043 |
|
11044 |
|
11045 |
|
11046 |
|
11047 |
|
11048 |
|
11049 |
|
11050 |
|
11051 |
|
11052 |
|
11053 |
|
11054 |
|
11055 |
|
11056 |
|
11057 | colors: function colors(_colors) {
|
11058 | return this.internal.updateDataAttributes("colors", _colors);
|
11059 | },
|
11060 | |
11061 |
|
11062 |
|
11063 |
|
11064 |
|
11065 |
|
11066 |
|
11067 |
|
11068 |
|
11069 |
|
11070 |
|
11071 |
|
11072 |
|
11073 |
|
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 | axes: function axes(_axes) {
|
11080 | return this.internal.updateDataAttributes("axes", _axes);
|
11081 | },
|
11082 | |
11083 |
|
11084 |
|
11085 |
|
11086 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 |
|
11092 |
|
11093 | min: function min() {
|
11094 | return this.internal.getMinMaxData().min;
|
11095 | },
|
11096 | |
11097 |
|
11098 |
|
11099 |
|
11100 |
|
11101 |
|
11102 |
|
11103 |
|
11104 |
|
11105 |
|
11106 |
|
11107 | max: function max() {
|
11108 | return this.internal.getMinMaxData().max;
|
11109 | }
|
11110 | });
|
11111 | var api_data = ({
|
11112 | data: api_data_data
|
11113 | });
|
11114 | ;
|
11115 |
|
11116 | var export_this = undefined;
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 |
|
11128 |
|
11129 |
|
11130 |
|
11131 | var b64EncodeUnicode = function (str) {
|
11132 | var _this2 = this;
|
11133 | _newArrowCheck(this, export_this);
|
11134 | return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) {
|
11135 | _newArrowCheck(this, _this2);
|
11136 | return String.fromCharCode(+("0x" + p));
|
11137 | }.bind(this)));
|
11138 | }.bind(undefined);
|
11139 |
|
11140 |
|
11141 |
|
11142 |
|
11143 |
|
11144 |
|
11145 |
|
11146 |
|
11147 |
|
11148 | function nodeToSvgDataUrl(node, option, orgSize) {
|
11149 | var _this3 = this,
|
11150 | _ref = option || orgSize,
|
11151 | width = _ref.width,
|
11152 | height = _ref.height,
|
11153 | serializer = new XMLSerializer(),
|
11154 | clone = node.cloneNode(!0),
|
11155 | cssText = getCssRules(toArray(browser_doc.styleSheets)).filter(function (r) {
|
11156 | _newArrowCheck(this, _this3);
|
11157 | return r.cssText;
|
11158 | }.bind(this)).map(function (r) {
|
11159 | _newArrowCheck(this, _this3);
|
11160 | return r.cssText;
|
11161 | }.bind(this));
|
11162 | clone.setAttribute("xmlns", external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.xhtml);
|
11163 | var nodeXml = serializer.serializeToString(clone),
|
11164 | style = browser_doc.createElement("style");
|
11165 | style.appendChild(browser_doc.createTextNode(cssText.join("\n")));
|
11166 | var styleXml = serializer.serializeToString(style),
|
11167 | dataStr = ("<svg xmlns=\"" + external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg + "\" width=\"" + width + "\" height=\"" + height + "\" \n\t\tviewBox=\"0 0 " + orgSize.width + " " + orgSize.height + "\" \n\t\tpreserveAspectRatio=\"" + ((option == null ? void 0 : option.preserveAspectRatio) === !1 ? "none" : "xMinYMid meet") + "\">\n\t\t\t<foreignObject width=\"100%\" height=\"100%\">\n\t\t\t\t" + styleXml + "\n\t\t\t\t" + nodeXml.replace(/(url\()[^#]+/g, "$1") + "\n\t\t\t</foreignObject></svg>").replace("/\n/g", "%0A");
|
11168 |
|
11169 | return "data:image/svg+xml;base64," + b64EncodeUnicode(dataStr);
|
11170 | }
|
11171 | var api_export = ({
|
11172 | |
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 |
|
11178 |
|
11179 |
|
11180 |
|
11181 |
|
11182 |
|
11183 |
|
11184 |
|
11185 |
|
11186 |
|
11187 |
|
11188 |
|
11189 |
|
11190 |
|
11191 |
|
11192 |
|
11193 |
|
11194 |
|
11195 |
|
11196 |
|
11197 |
|
11198 |
|
11199 |
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 |
|
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 |
|
11210 |
|
11211 |
|
11212 |
|
11213 | export: function _export(option, callback) {
|
11214 | var _this4 = this,
|
11215 | $$ = this.internal,
|
11216 | state = $$.state,
|
11217 | chart = $$.$el.chart,
|
11218 | _state$current = state.current,
|
11219 | width = _state$current.width,
|
11220 | height = _state$current.height,
|
11221 | opt = mergeObj({
|
11222 | width: width,
|
11223 | height: height,
|
11224 | preserveAspectRatio: !0,
|
11225 | mimeType: "image/png"
|
11226 | }, option),
|
11227 | svgDataUrl = nodeToSvgDataUrl(chart.node(), opt, {
|
11228 | width: width,
|
11229 | height: height
|
11230 | });
|
11231 | if (callback && isFunction(callback)) {
|
11232 | var img = new Image();
|
11233 | img.crossOrigin = "Anonymous";
|
11234 | img.onload = function () {
|
11235 | _newArrowCheck(this, _this4);
|
11236 | var canvas = browser_doc.createElement("canvas"),
|
11237 | ctx = canvas.getContext("2d");
|
11238 | canvas.width = opt.width || width;
|
11239 | canvas.height = opt.height || height;
|
11240 | ctx.drawImage(img, 0, 0);
|
11241 | callback.bind(this)(canvas.toDataURL(opt.mimeType));
|
11242 | }.bind(this);
|
11243 | img.src = svgDataUrl;
|
11244 | }
|
11245 | return svgDataUrl;
|
11246 | }
|
11247 | });
|
11248 | ;
|
11249 |
|
11250 |
|
11251 |
|
11252 |
|
11253 |
|
11254 |
|
11255 |
|
11256 | var api_focus = ({
|
11257 | |
11258 |
|
11259 |
|
11260 |
|
11261 |
|
11262 |
|
11263 |
|
11264 |
|
11265 |
|
11266 |
|
11267 |
|
11268 |
|
11269 |
|
11270 |
|
11271 |
|
11272 |
|
11273 |
|
11274 | focus: function focus(targetIdsValue) {
|
11275 | var _this = this,
|
11276 | $$ = this.internal,
|
11277 | state = $$.state,
|
11278 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
11279 | candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
11280 | this.revert();
|
11281 | this.defocus();
|
11282 | candidates.classed($FOCUS.focused, !0).classed($FOCUS.defocused, !1);
|
11283 | if ($$.hasArcType() && !state.hasRadar) {
|
11284 | $$.expandArc(targetIds);
|
11285 | $$.hasType("gauge") && $$.markOverlapped(targetIdsValue, $$, "." + $GAUGE.gaugeValue);
|
11286 | }
|
11287 | $$.toggleFocusLegend(targetIds, !0);
|
11288 | state.focusedTargetIds = targetIds;
|
11289 | state.defocusedTargetIds = state.defocusedTargetIds.filter(function (id) {
|
11290 | _newArrowCheck(this, _this);
|
11291 | return targetIds.indexOf(id) < 0;
|
11292 | }.bind(this));
|
11293 | },
|
11294 | |
11295 |
|
11296 |
|
11297 |
|
11298 |
|
11299 |
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 |
|
11305 |
|
11306 |
|
11307 |
|
11308 |
|
11309 |
|
11310 |
|
11311 | defocus: function defocus(targetIdsValue) {
|
11312 | var _this2 = this,
|
11313 | $$ = this.internal,
|
11314 | state = $$.state,
|
11315 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
11316 | candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
11317 | candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
|
11318 | if ($$.hasArcType(null, ["polar"])) {
|
11319 | $$.unexpandArc(targetIds);
|
11320 | $$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
|
11321 | }
|
11322 | $$.toggleFocusLegend(targetIds, !1);
|
11323 | state.focusedTargetIds = state.focusedTargetIds.filter(function (id) {
|
11324 | _newArrowCheck(this, _this2);
|
11325 | return targetIds.indexOf(id) < 0;
|
11326 | }.bind(this));
|
11327 | state.defocusedTargetIds = targetIds;
|
11328 | },
|
11329 | |
11330 |
|
11331 |
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 |
|
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 |
|
11346 | revert: function revert(targetIdsValue) {
|
11347 | var $$ = this.internal,
|
11348 | config = $$.config,
|
11349 | state = $$.state,
|
11350 | $el = $$.$el,
|
11351 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
11352 | candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
11353 |
|
11354 |
|
11355 | candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
|
11356 | $$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
11357 | if (config.legend_show) {
|
11358 | $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
11359 | $el.legend.selectAll($$.selectorLegends(targetIds)).filter(function () {
|
11360 | return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused);
|
11361 | }).classed($FOCUS.legendItemFocused, !1);
|
11362 | }
|
11363 | state.focusedTargetIds = [];
|
11364 | state.defocusedTargetIds = [];
|
11365 | }
|
11366 | });
|
11367 | ;
|
11368 |
|
11369 |
|
11370 |
|
11371 |
|
11372 |
|
11373 |
|
11374 |
|
11375 |
|
11376 | var legend_legend = {
|
11377 | |
11378 |
|
11379 |
|
11380 |
|
11381 |
|
11382 |
|
11383 |
|
11384 |
|
11385 |
|
11386 |
|
11387 |
|
11388 |
|
11389 |
|
11390 |
|
11391 |
|
11392 |
|
11393 |
|
11394 |
|
11395 |
|
11396 | show: function show(targetIds) {
|
11397 | var $$ = this.internal;
|
11398 | $$.showLegend($$.mapToTargetIds(targetIds));
|
11399 | $$.updateAndRedraw({
|
11400 | withLegend: !0
|
11401 | });
|
11402 | },
|
11403 | |
11404 |
|
11405 |
|
11406 |
|
11407 |
|
11408 |
|
11409 |
|
11410 |
|
11411 |
|
11412 |
|
11413 |
|
11414 |
|
11415 |
|
11416 |
|
11417 |
|
11418 |
|
11419 |
|
11420 |
|
11421 |
|
11422 | hide: function hide(targetIds) {
|
11423 | var $$ = this.internal;
|
11424 | $$.hideLegend($$.mapToTargetIds(targetIds));
|
11425 | $$.updateAndRedraw({
|
11426 | withLegend: !0
|
11427 | });
|
11428 | }
|
11429 | };
|
11430 | var api_legend = ({
|
11431 | legend: legend_legend
|
11432 | });
|
11433 | ;
|
11434 |
|
11435 |
|
11436 |
|
11437 |
|
11438 |
|
11439 |
|
11440 |
|
11441 | var api_load = ({
|
11442 | |
11443 |
|
11444 |
|
11445 |
|
11446 |
|
11447 |
|
11448 |
|
11449 |
|
11450 |
|
11451 |
|
11452 |
|
11453 |
|
11454 |
|
11455 |
|
11456 |
|
11457 |
|
11458 |
|
11459 |
|
11460 |
|
11461 |
|
11462 |
|
11463 |
|
11464 |
|
11465 |
|
11466 |
|
11467 |
|
11468 |
|
11469 |
|
11470 |
|
11471 |
|
11472 |
|
11473 |
|
11474 |
|
11475 |
|
11476 |
|
11477 |
|
11478 |
|
11479 |
|
11480 |
|
11481 |
|
11482 |
|
11483 |
|
11484 |
|
11485 |
|
11486 |
|
11487 |
|
11488 |
|
11489 |
|
11490 |
|
11491 |
|
11492 |
|
11493 |
|
11494 |
|
11495 |
|
11496 |
|
11497 |
|
11498 |
|
11499 |
|
11500 |
|
11501 |
|
11502 |
|
11503 |
|
11504 |
|
11505 |
|
11506 |
|
11507 |
|
11508 |
|
11509 |
|
11510 |
|
11511 |
|
11512 |
|
11513 |
|
11514 |
|
11515 |
|
11516 |
|
11517 |
|
11518 |
|
11519 |
|
11520 |
|
11521 |
|
11522 |
|
11523 |
|
11524 |
|
11525 |
|
11526 |
|
11527 |
|
11528 |
|
11529 |
|
11530 |
|
11531 |
|
11532 |
|
11533 |
|
11534 |
|
11535 |
|
11536 |
|
11537 |
|
11538 |
|
11539 |
|
11540 |
|
11541 |
|
11542 |
|
11543 |
|
11544 |
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 |
|
11550 |
|
11551 |
|
11552 |
|
11553 |
|
11554 |
|
11555 |
|
11556 |
|
11557 |
|
11558 |
|
11559 |
|
11560 |
|
11561 |
|
11562 |
|
11563 |
|
11564 |
|
11565 |
|
11566 |
|
11567 |
|
11568 |
|
11569 |
|
11570 |
|
11571 | load: function load(args) {
|
11572 | var _this = this,
|
11573 | $$ = this.internal,
|
11574 | config = $$.config;
|
11575 |
|
11576 | args.xs && $$.addXs(args.xs);
|
11577 |
|
11578 |
|
11579 | "names" in args && this.data.names(args.names);
|
11580 |
|
11581 |
|
11582 | "classes" in args && Object.keys(args.classes).forEach(function (id) {
|
11583 | _newArrowCheck(this, _this);
|
11584 | config.data_classes[id] = args.classes[id];
|
11585 | }.bind(this));
|
11586 |
|
11587 |
|
11588 | if ("categories" in args && $$.axis.isCategorized()) {
|
11589 | config.axis_x_categories = args.categories;
|
11590 | }
|
11591 |
|
11592 |
|
11593 | "axes" in args && Object.keys(args.axes).forEach(function (id) {
|
11594 | _newArrowCheck(this, _this);
|
11595 | config.data_axes[id] = args.axes[id];
|
11596 | }.bind(this));
|
11597 |
|
11598 |
|
11599 | "colors" in args && Object.keys(args.colors).forEach(function (id) {
|
11600 | _newArrowCheck(this, _this);
|
11601 | config.data_colors[id] = args.colors[id];
|
11602 | }.bind(this));
|
11603 |
|
11604 |
|
11605 | if ("unload" in args && args.unload !== !1) {
|
11606 |
|
11607 | $$.unload($$.mapToTargetIds(args.unload === !0 ? null : args.unload), function () {
|
11608 | var _this2 = this;
|
11609 | _newArrowCheck(this, _this);
|
11610 |
|
11611 |
|
11612 | win.requestIdleCallback(function () {
|
11613 | _newArrowCheck(this, _this2);
|
11614 | return $$.loadFromArgs(args);
|
11615 | }.bind(this));
|
11616 | }.bind(this));
|
11617 | } else {
|
11618 | $$.loadFromArgs(args);
|
11619 | }
|
11620 | },
|
11621 | |
11622 |
|
11623 |
|
11624 |
|
11625 |
|
11626 |
|
11627 |
|
11628 |
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 |
|
11642 |
|
11643 |
|
11644 | unload: function unload(argsValue) {
|
11645 | var _this3 = this,
|
11646 | $$ = this.internal,
|
11647 | args = argsValue || {};
|
11648 | if (isArray(args)) {
|
11649 | args = {
|
11650 | ids: args
|
11651 | };
|
11652 | } else if (isString(args)) {
|
11653 | args = {
|
11654 | ids: [args]
|
11655 | };
|
11656 | }
|
11657 | var ids = $$.mapToTargetIds(args.ids);
|
11658 | $$.unload(ids, function () {
|
11659 | _newArrowCheck(this, _this3);
|
11660 | $$.redraw({
|
11661 | withUpdateOrgXDomain: !0,
|
11662 | withUpdateXDomain: !0,
|
11663 | withLegend: !0
|
11664 | });
|
11665 | $$.cache.remove(ids);
|
11666 | args.done && args.done.call(this);
|
11667 | }.bind(this));
|
11668 | }
|
11669 | });
|
11670 | ;
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 |
|
11676 |
|
11677 |
|
11678 |
|
11679 |
|
11680 |
|
11681 |
|
11682 |
|
11683 |
|
11684 |
|
11685 | function showHide(show, targetIdsValue, options) {
|
11686 | var _this = this,
|
11687 | $$ = this.internal,
|
11688 | targetIds = $$.mapToTargetIds(targetIdsValue),
|
11689 | hiddenIds = $$.state.hiddenTargetIds.map(function (v) {
|
11690 | _newArrowCheck(this, _this);
|
11691 | return targetIds.indexOf(v) > -1 && v;
|
11692 | }.bind(this)).filter(Boolean);
|
11693 | $$.state.toggling = !0;
|
11694 | $$[(show ? "remove" : "add") + "HiddenTargetIds"](targetIds);
|
11695 | var targets = $$.$el.svg.selectAll($$.selectorTargets(targetIds)),
|
11696 | opacity = show ? null : "0";
|
11697 | if (show && hiddenIds.length) {
|
11698 | targets.style("display", null);
|
11699 | callFn($$.config.data_onshown, this, hiddenIds);
|
11700 | }
|
11701 | $$.$T(targets).style("opacity", opacity, "important").call(endall, function () {
|
11702 | _newArrowCheck(this, _this);
|
11703 |
|
11704 | if (!show && hiddenIds.length === 0) {
|
11705 | targets.style("display", "none");
|
11706 | callFn($$.config.data_onhidden, this, targetIds);
|
11707 | }
|
11708 | targets.style("opacity", opacity);
|
11709 | }.bind(this));
|
11710 | options.withLegend && $$[(show ? "show" : "hide") + "Legend"](targetIds);
|
11711 | $$.redraw({
|
11712 | withUpdateOrgXDomain: !0,
|
11713 | withUpdateXDomain: !0,
|
11714 | withLegend: !0
|
11715 | });
|
11716 | $$.state.toggling = !1;
|
11717 | }
|
11718 | var show = ({
|
11719 | |
11720 |
|
11721 |
|
11722 |
|
11723 |
|
11724 |
|
11725 |
|
11726 |
|
11727 |
|
11728 |
|
11729 |
|
11730 |
|
11731 |
|
11732 |
|
11733 |
|
11734 |
|
11735 |
|
11736 |
|
11737 |
|
11738 | show: function show(targetIdsValue, options) {
|
11739 | if (options === void 0) {
|
11740 | options = {};
|
11741 | }
|
11742 | showHide.call(this, !0, targetIdsValue, options);
|
11743 | },
|
11744 | |
11745 |
|
11746 |
|
11747 |
|
11748 |
|
11749 |
|
11750 |
|
11751 |
|
11752 |
|
11753 |
|
11754 |
|
11755 |
|
11756 |
|
11757 |
|
11758 |
|
11759 |
|
11760 |
|
11761 |
|
11762 |
|
11763 | hide: function hide(targetIdsValue, options) {
|
11764 | if (options === void 0) {
|
11765 | options = {};
|
11766 | }
|
11767 | showHide.call(this, !1, targetIdsValue, options);
|
11768 | },
|
11769 | |
11770 |
|
11771 |
|
11772 |
|
11773 |
|
11774 |
|
11775 |
|
11776 |
|
11777 |
|
11778 |
|
11779 |
|
11780 |
|
11781 |
|
11782 |
|
11783 |
|
11784 |
|
11785 |
|
11786 |
|
11787 |
|
11788 | toggle: function toggle(targetIds, options) {
|
11789 | var _this2 = this;
|
11790 | if (options === void 0) {
|
11791 | options = {};
|
11792 | }
|
11793 | var $$ = this.internal,
|
11794 | targets = {
|
11795 | show: [],
|
11796 | hide: []
|
11797 | };
|
11798 |
|
11799 | $$.mapToTargetIds(targetIds).forEach(function (id) {
|
11800 | _newArrowCheck(this, _this2);
|
11801 | return targets[$$.isTargetToShow(id) ? "hide" : "show"].push(id);
|
11802 | }.bind(this));
|
11803 |
|
11804 |
|
11805 |
|
11806 | targets.show.length && this.show(targets.show, options);
|
11807 | targets.hide.length && setTimeout(function () {
|
11808 | _newArrowCheck(this, _this2);
|
11809 | return this.hide(targets.hide, options);
|
11810 | }.bind(this), 0);
|
11811 | }
|
11812 | });
|
11813 | ;
|
11814 |
|
11815 |
|
11816 |
|
11817 |
|
11818 |
|
11819 |
|
11820 |
|
11821 |
|
11822 |
|
11823 |
|
11824 |
|
11825 | var tooltip_tooltip = {
|
11826 | |
11827 |
|
11828 |
|
11829 |
|
11830 |
|
11831 |
|
11832 |
|
11833 |
|
11834 |
|
11835 |
|
11836 |
|
11837 |
|
11838 |
|
11839 |
|
11840 |
|
11841 |
|
11842 |
|
11843 |
|
11844 |
|
11845 |
|
11846 |
|
11847 |
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 |
|
11855 |
|
11856 |
|
11857 |
|
11858 |
|
11859 |
|
11860 |
|
11861 |
|
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 |
|
11867 |
|
11868 |
|
11869 |
|
11870 |
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 |
|
11876 | show: function show(args) {
|
11877 | var _this = this,
|
11878 | $$ = this.internal,
|
11879 | config = $$.config,
|
11880 | inputType = $$.state.inputType,
|
11881 | index,
|
11882 | mouse;
|
11883 |
|
11884 | if (args.mouse) {
|
11885 | mouse = args.mouse;
|
11886 | }
|
11887 |
|
11888 |
|
11889 | if (args.data) {
|
11890 | var data = args.data,
|
11891 | y = $$.getYScaleById(data.id)(data.value);
|
11892 | if ($$.isMultipleX()) {
|
11893 |
|
11894 | mouse = [$$.scale.x(data.x), y];
|
11895 | } else {
|
11896 | if (!config.tooltip_grouped) {
|
11897 | mouse = [0, y];
|
11898 | }
|
11899 | index = isValue(data.index) ? data.index : $$.getIndexByX(data.x);
|
11900 | }
|
11901 | } else if (isDefined(args.x)) {
|
11902 | index = $$.getIndexByX(args.x);
|
11903 | } else if (isDefined(args.index)) {
|
11904 | index = args.index;
|
11905 | }
|
11906 | (inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach(function (eventName) {
|
11907 | _newArrowCheck(this, _this);
|
11908 | $$.dispatchEvent(eventName, index, mouse);
|
11909 | }.bind(this));
|
11910 | },
|
11911 | |
11912 |
|
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 | hide: function hide() {
|
11918 | var _this2 = this,
|
11919 | $$ = this.internal,
|
11920 | inputType = $$.state.inputType,
|
11921 | tooltip = $$.$el.tooltip,
|
11922 | data = tooltip == null ? void 0 : tooltip.datum();
|
11923 | if (data) {
|
11924 | var index = JSON.parse(data.current)[0].index;
|
11925 |
|
11926 |
|
11927 | (inputType === "mouse" ? ["mouseout"] : ["touchend"]).forEach(function (eventName) {
|
11928 | _newArrowCheck(this, _this2);
|
11929 | $$.dispatchEvent(eventName, index);
|
11930 | }.bind(this));
|
11931 | }
|
11932 |
|
11933 |
|
11934 | inputType === "touch" && $$.callOverOutForTouch();
|
11935 | $$.hideTooltip(!0);
|
11936 | $$.hideGridFocus();
|
11937 | $$.unexpandCircles == null ? void 0 : $$.unexpandCircles();
|
11938 | $$.expandBarTypeShapes(!1);
|
11939 | }
|
11940 | };
|
11941 | var api_tooltip = ({
|
11942 | tooltip: tooltip_tooltip
|
11943 | });
|
11944 | ;
|
11945 |
|
11946 |
|
11947 |
|
11948 |
|
11949 |
|
11950 |
|
11951 |
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 |
|
11962 |
|
11963 |
|
11964 |
|
11965 |
|
11966 |
|
11967 |
|
11968 |
|
11969 |
|
11970 |
|
11971 |
|
11972 |
|
11973 |
|
11974 |
|
11975 |
|
11976 |
|
11977 |
|
11978 |
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 |
|
11985 |
|
11986 |
|
11987 |
|
11988 |
|
11989 |
|
11990 |
|
11991 |
|
11992 |
|
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 |
|
12000 |
|
12001 |
|
12002 |
|
12003 |
|
12004 |
|
12005 |
|
12006 |
|
12007 |
|
12008 |
|
12009 |
|
12010 |
|
12011 |
|
12012 |
|
12013 |
|
12014 |
|
12015 |
|
12016 |
|
12017 |
|
12018 |
|
12019 |
|
12020 |
|
12021 |
|
12022 | var Chart = function Chart(options) {
|
12023 | this.plugins = [];
|
12024 | this.internal = void 0;
|
12025 | var $$ = new ChartInternal(this);
|
12026 | this.internal = $$;
|
12027 |
|
12028 |
|
12029 | (function bindThis(fn, target, argThis) {
|
12030 | var _this = this;
|
12031 | Object.keys(fn).forEach(function (key) {
|
12032 | _newArrowCheck(this, _this);
|
12033 | var isFunc = isFunction(fn[key]),
|
12034 | isChild = target !== argThis,
|
12035 | isNotNil = notEmpty(fn[key]),
|
12036 | hasChild = isNotNil && Object.keys(fn[key]).length > 0;
|
12037 | if (isFunc && (!isChild && hasChild || isChild)) {
|
12038 | target[key] = fn[key].bind(argThis);
|
12039 | } else if (isNotNil && !isFunc) {
|
12040 | target[key] = {};
|
12041 | } else {
|
12042 | target[key] = fn[key];
|
12043 | }
|
12044 | hasChild && bindThis(fn[key], target[key], argThis);
|
12045 | }.bind(this));
|
12046 | })(Chart.prototype, this, this);
|
12047 | loadConfig.call($$, options);
|
12048 | $$.beforeInit();
|
12049 | $$.init();
|
12050 | };
|
12051 |
|
12052 | extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_legend, api_load, show, api_tooltip]);
|
12053 | ;
|
12054 |
|
12055 |
|
12056 |
|
12057 |
|
12058 |
|
12059 |
|
12060 |
|
12061 |
|
12062 |
|
12063 |
|
12064 |
|
12065 |
|
12066 |
|
12067 | function setMinMax($$, type, value) {
|
12068 | var _this = this,
|
12069 | config = $$.config,
|
12070 | helper = function (key, value) {
|
12071 | _newArrowCheck(this, _this);
|
12072 | var v = isNumber(value) ? value : value === !1 ? undefined : null;
|
12073 | if (v !== null) {
|
12074 | config["axis_" + key + "_" + type] = v;
|
12075 | }
|
12076 | }.bind(this);
|
12077 | if (isDefined(value)) {
|
12078 | if (isObjectType(value)) {
|
12079 | Object.keys(value).forEach(function (key) {
|
12080 | _newArrowCheck(this, _this);
|
12081 | helper(key, value[key]);
|
12082 | }.bind(this));
|
12083 | } else if (isNumber(value) || value === !1) {
|
12084 |
|
12085 | ["y", "y2"].forEach(function (key) {
|
12086 | _newArrowCheck(this, _this);
|
12087 | helper(key, value);
|
12088 | }.bind(this));
|
12089 | }
|
12090 | $$.redraw({
|
12091 | withUpdateOrgXDomain: !0,
|
12092 | withUpdateXDomain: !0
|
12093 | });
|
12094 | }
|
12095 | }
|
12096 |
|
12097 |
|
12098 |
|
12099 |
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 | function axis_getMinMax($$, type) {
|
12105 | var config = $$.config;
|
12106 | return {
|
12107 | x: config["axis_x_" + type],
|
12108 | y: config["axis_y_" + type],
|
12109 | y2: config["axis_y2_" + type]
|
12110 | };
|
12111 | }
|
12112 |
|
12113 |
|
12114 |
|
12115 |
|
12116 |
|
12117 | var axis = {
|
12118 | |
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 |
|
12130 |
|
12131 |
|
12132 |
|
12133 |
|
12134 |
|
12135 |
|
12136 |
|
12137 |
|
12138 |
|
12139 |
|
12140 |
|
12141 |
|
12142 |
|
12143 | labels: function labels(_labels) {
|
12144 | var _this2 = this,
|
12145 | $$ = this.internal,
|
12146 | labelText;
|
12147 | if (_labels) {
|
12148 | Object.keys(_labels).forEach(function (axisId) {
|
12149 | _newArrowCheck(this, _this2);
|
12150 | $$.axis.setLabelText(axisId, _labels[axisId]);
|
12151 | }.bind(this));
|
12152 | $$.axis.updateLabels();
|
12153 | }
|
12154 | ["x", "y", "y2"].forEach(function (v) {
|
12155 | _newArrowCheck(this, _this2);
|
12156 | var text = $$.axis.getLabelText(v);
|
12157 | if (text) {
|
12158 | labelText || (labelText = {});
|
12159 | labelText[v] = text;
|
12160 | }
|
12161 | }.bind(this));
|
12162 | return labelText;
|
12163 | },
|
12164 | |
12165 |
|
12166 |
|
12167 |
|
12168 |
|
12169 |
|
12170 |
|
12171 |
|
12172 |
|
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 |
|
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 |
|
12184 |
|
12185 |
|
12186 |
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 | min: function min(_min) {
|
12194 | var $$ = this.internal;
|
12195 | return isValue(_min) || _min === !1 ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
|
12196 | },
|
12197 | |
12198 |
|
12199 |
|
12200 |
|
12201 |
|
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 |
|
12215 |
|
12216 |
|
12217 |
|
12218 |
|
12219 |
|
12220 |
|
12221 |
|
12222 |
|
12223 |
|
12224 |
|
12225 |
|
12226 | max: function max(_max) {
|
12227 | var $$ = this.internal;
|
12228 | return isValue(_max) || _max === !1 ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
|
12229 | },
|
12230 | |
12231 |
|
12232 |
|
12233 |
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 |
|
12251 |
|
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 |
|
12257 |
|
12258 |
|
12259 |
|
12260 |
|
12261 |
|
12262 |
|
12263 |
|
12264 |
|
12265 |
|
12266 |
|
12267 |
|
12268 |
|
12269 |
|
12270 |
|
12271 |
|
12272 | range: function range(_range) {
|
12273 | var axis = this.axis;
|
12274 | if (arguments.length) {
|
12275 | var min = _range.min,
|
12276 | max = _range.max;
|
12277 | isDefined(max) && axis.max(max);
|
12278 | isDefined(min) && axis.min(min);
|
12279 | } else {
|
12280 | return {
|
12281 | max: axis.max(),
|
12282 | min: axis.min()
|
12283 | };
|
12284 | }
|
12285 | return undefined;
|
12286 | }
|
12287 | };
|
12288 | var api_axis = ({
|
12289 | axis: axis
|
12290 | });
|
12291 | ;
|
12292 |
|
12293 |
|
12294 |
|
12295 |
|
12296 | var api_category = ({
|
12297 | |
12298 |
|
12299 |
|
12300 |
|
12301 |
|
12302 |
|
12303 |
|
12304 |
|
12305 |
|
12306 |
|
12307 |
|
12308 | category: function category(i, _category) {
|
12309 | var $$ = this.internal,
|
12310 | config = $$.config;
|
12311 | if (arguments.length > 1) {
|
12312 | config.axis_x_categories[i] = _category;
|
12313 | $$.redraw();
|
12314 | }
|
12315 | return config.axis_x_categories[i];
|
12316 | },
|
12317 | |
12318 |
|
12319 |
|
12320 |
|
12321 |
|
12322 |
|
12323 |
|
12324 |
|
12325 |
|
12326 |
|
12327 |
|
12328 |
|
12329 | categories: function categories(_categories) {
|
12330 | var $$ = this.internal,
|
12331 | config = $$.config;
|
12332 | if (!arguments.length) {
|
12333 | return config.axis_x_categories;
|
12334 | }
|
12335 | config.axis_x_categories = _categories;
|
12336 | $$.redraw();
|
12337 | return config.axis_x_categories;
|
12338 | }
|
12339 | });
|
12340 | ;
|
12341 |
|
12342 |
|
12343 |
|
12344 |
|
12345 |
|
12346 |
|
12347 |
|
12348 |
|
12349 |
|
12350 |
|
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 | function xgrids(grids) {
|
12362 | var $$ = this.internal,
|
12363 | config = $$.config;
|
12364 | if (!grids) {
|
12365 | return config.grid_x_lines;
|
12366 | }
|
12367 | config.grid_x_lines = grids;
|
12368 | $$.redrawWithoutRescale();
|
12369 | return config.grid_x_lines;
|
12370 | }
|
12371 | extend(xgrids, {
|
12372 | |
12373 |
|
12374 |
|
12375 |
|
12376 |
|
12377 |
|
12378 |
|
12379 |
|
12380 |
|
12381 |
|
12382 |
|
12383 |
|
12384 |
|
12385 |
|
12386 |
|
12387 |
|
12388 |
|
12389 |
|
12390 |
|
12391 |
|
12392 | add: function add(grids) {
|
12393 | return this.xgrids(this.internal.config.grid_x_lines.concat(grids || []));
|
12394 | },
|
12395 | |
12396 |
|
12397 |
|
12398 |
|
12399 |
|
12400 |
|
12401 |
|
12402 |
|
12403 |
|
12404 |
|
12405 |
|
12406 |
|
12407 |
|
12408 |
|
12409 |
|
12410 |
|
12411 |
|
12412 |
|
12413 |
|
12414 | remove: function remove(params) {
|
12415 |
|
12416 | this.internal.removeGridLines(params, !0);
|
12417 | }
|
12418 | });
|
12419 | var grid_x = ({
|
12420 | xgrids: xgrids
|
12421 | });
|
12422 | ;
|
12423 |
|
12424 |
|
12425 |
|
12426 |
|
12427 |
|
12428 |
|
12429 |
|
12430 |
|
12431 |
|
12432 |
|
12433 |
|
12434 |
|
12435 |
|
12436 |
|
12437 |
|
12438 |
|
12439 |
|
12440 |
|
12441 |
|
12442 |
|
12443 |
|
12444 | function ygrids(grids) {
|
12445 | var $$ = this.internal,
|
12446 | config = $$.config;
|
12447 | if (!grids) {
|
12448 | return config.grid_y_lines;
|
12449 | }
|
12450 | config.grid_y_lines = grids;
|
12451 | $$.redrawWithoutRescale();
|
12452 | return config.grid_y_lines;
|
12453 | }
|
12454 | extend(ygrids, {
|
12455 | |
12456 |
|
12457 |
|
12458 |
|
12459 |
|
12460 |
|
12461 |
|
12462 |
|
12463 |
|
12464 |
|
12465 |
|
12466 |
|
12467 |
|
12468 |
|
12469 |
|
12470 |
|
12471 |
|
12472 |
|
12473 |
|
12474 |
|
12475 | add: function add(grids) {
|
12476 | return this.ygrids(this.internal.config.grid_y_lines.concat(grids || []));
|
12477 | },
|
12478 | |
12479 |
|
12480 |
|
12481 |
|
12482 |
|
12483 |
|
12484 |
|
12485 |
|
12486 |
|
12487 |
|
12488 |
|
12489 |
|
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 |
|
12497 |
|
12498 |
|
12499 | remove: function remove(params) {
|
12500 |
|
12501 | this.internal.removeGridLines(params, !1);
|
12502 | }
|
12503 | });
|
12504 | var grid_y = ({
|
12505 | ygrids: ygrids
|
12506 | });
|
12507 | ;
|
12508 |
|
12509 |
|
12510 |
|
12511 |
|
12512 |
|
12513 | var group = ({
|
12514 | |
12515 |
|
12516 |
|
12517 |
|
12518 |
|
12519 |
|
12520 |
|
12521 |
|
12522 |
|
12523 |
|
12524 |
|
12525 |
|
12526 |
|
12527 | groups: function groups(_groups) {
|
12528 | var $$ = this.internal,
|
12529 | config = $$.config;
|
12530 | if (isUndefined(_groups)) {
|
12531 | return config.data_groups;
|
12532 | }
|
12533 | config.data_groups = _groups;
|
12534 | $$.redraw();
|
12535 | return config.data_groups;
|
12536 | }
|
12537 | });
|
12538 | ;
|
12539 |
|
12540 |
|
12541 |
|
12542 |
|
12543 |
|
12544 |
|
12545 |
|
12546 |
|
12547 |
|
12548 |
|
12549 |
|
12550 |
|
12551 |
|
12552 |
|
12553 |
|
12554 |
|
12555 |
|
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 | function regions(regions) {
|
12561 | var $$ = this.internal,
|
12562 | config = $$.config;
|
12563 | if (!regions) {
|
12564 | return config.regions;
|
12565 | }
|
12566 | config.regions = regions;
|
12567 | $$.redrawWithoutRescale();
|
12568 | return regions;
|
12569 | }
|
12570 | extend(regions, {
|
12571 | |
12572 |
|
12573 |
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 |
|
12581 |
|
12582 |
|
12583 |
|
12584 |
|
12585 |
|
12586 |
|
12587 |
|
12588 |
|
12589 |
|
12590 |
|
12591 | add: function add(regions) {
|
12592 | var $$ = this.internal,
|
12593 | config = $$.config;
|
12594 | if (!regions) {
|
12595 | return config.regions;
|
12596 | }
|
12597 | config.regions = config.regions.concat(regions);
|
12598 | $$.redrawWithoutRescale();
|
12599 | return config.regions;
|
12600 | },
|
12601 | |
12602 |
|
12603 |
|
12604 |
|
12605 |
|
12606 |
|
12607 |
|
12608 |
|
12609 |
|
12610 |
|
12611 |
|
12612 |
|
12613 |
|
12614 |
|
12615 |
|
12616 |
|
12617 |
|
12618 |
|
12619 |
|
12620 | remove: function remove(optionsValue) {
|
12621 | var _this = this,
|
12622 | $$ = this.internal,
|
12623 | config = $$.config,
|
12624 | $T = $$.$T,
|
12625 | options = optionsValue || {},
|
12626 | classes = getOption(options, "classes", [$REGION.region]),
|
12627 | regions = $$.$el.main.select("." + $REGION.regions).selectAll(classes.map(function (c) {
|
12628 | _newArrowCheck(this, _this);
|
12629 | return "." + c;
|
12630 | }.bind(this)));
|
12631 | $T(regions).style("opacity", "0").remove();
|
12632 | regions = config.regions;
|
12633 | if (Object.keys(options).length) {
|
12634 | regions = regions.filter(function (region) {
|
12635 | var _this2 = this;
|
12636 | _newArrowCheck(this, _this);
|
12637 | var found = !1;
|
12638 | if (!region.class) {
|
12639 | return !0;
|
12640 | }
|
12641 | region.class.split(" ").forEach(function (c) {
|
12642 | _newArrowCheck(this, _this2);
|
12643 | if (classes.indexOf(c) >= 0) {
|
12644 | found = !0;
|
12645 | }
|
12646 | }.bind(this));
|
12647 | return !found;
|
12648 | }.bind(this));
|
12649 | config.regions = regions;
|
12650 | } else {
|
12651 | config.regions = [];
|
12652 | }
|
12653 | return regions;
|
12654 | }
|
12655 | });
|
12656 | var api_regions = ({
|
12657 | regions: regions
|
12658 | });
|
12659 | ;
|
12660 |
|
12661 |
|
12662 |
|
12663 |
|
12664 |
|
12665 | var x = ({
|
12666 | |
12667 |
|
12668 |
|
12669 |
|
12670 |
|
12671 |
|
12672 |
|
12673 |
|
12674 |
|
12675 |
|
12676 |
|
12677 |
|
12678 |
|
12679 |
|
12680 | x: function x(_x) {
|
12681 | var $$ = this.internal,
|
12682 | axis = $$.axis,
|
12683 | data = $$.data,
|
12684 | isCategorized = axis.isCustomX() && axis.isCategorized();
|
12685 | if (isArray(_x)) {
|
12686 | if (isCategorized) {
|
12687 | this.categories(_x);
|
12688 | } else {
|
12689 | $$.updateTargetX(data.targets, _x);
|
12690 | $$.redraw({
|
12691 | withUpdateOrgXDomain: !0,
|
12692 | withUpdateXDomain: !0
|
12693 | });
|
12694 | }
|
12695 | }
|
12696 | return isCategorized ? this.categories() : data.xs;
|
12697 | },
|
12698 | |
12699 |
|
12700 |
|
12701 |
|
12702 |
|
12703 |
|
12704 |
|
12705 |
|
12706 |
|
12707 |
|
12708 |
|
12709 |
|
12710 |
|
12711 |
|
12712 |
|
12713 |
|
12714 |
|
12715 | xs: function xs(_xs) {
|
12716 | var $$ = this.internal;
|
12717 | if (isObject(_xs)) {
|
12718 | $$.updateTargetXs($$.data.targets, _xs);
|
12719 | $$.redraw({
|
12720 | withUpdateOrgXDomain: !0,
|
12721 | withUpdateXDomain: !0
|
12722 | });
|
12723 | }
|
12724 | return $$.data.xs;
|
12725 | }
|
12726 | });
|
12727 | ;
|
12728 |
|
12729 |
|
12730 |
|
12731 |
|
12732 |
|
12733 |
|
12734 | var flow = ({
|
12735 | |
12736 |
|
12737 |
|
12738 |
|
12739 |
|
12740 |
|
12741 |
|
12742 |
|
12743 |
|
12744 |
|
12745 |
|
12746 |
|
12747 |
|
12748 |
|
12749 |
|
12750 |
|
12751 |
|
12752 |
|
12753 |
|
12754 |
|
12755 |
|
12756 |
|
12757 |
|
12758 |
|
12759 |
|
12760 |
|
12761 |
|
12762 |
|
12763 |
|
12764 |
|
12765 |
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 |
|
12772 |
|
12773 |
|
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 | flow: function flow(args) {
|
12785 | var _this = this,
|
12786 | $$ = this.internal,
|
12787 | data;
|
12788 | if (args.json || args.rows || args.columns) {
|
12789 | $$.convertData(args, function (res) {
|
12790 | _newArrowCheck(this, _this);
|
12791 | data = res;
|
12792 | _();
|
12793 | }.bind(this));
|
12794 | }
|
12795 |
|
12796 | |
12797 |
|
12798 |
|
12799 |
|
12800 | function _() {
|
12801 | var _this2 = this,
|
12802 | domain,
|
12803 | length = 0,
|
12804 | tail = 0,
|
12805 | diff,
|
12806 | to;
|
12807 | if ($$.state.redrawing || !data || !isTabVisible()) {
|
12808 | return;
|
12809 | }
|
12810 | var notfoundIds = [],
|
12811 | orgDataCount = $$.getMaxDataCount(),
|
12812 | targets = $$.convertDataToTargets(data, !0),
|
12813 | isTimeSeries = $$.axis.isTimeSeries();
|
12814 |
|
12815 | $$.data.targets.forEach(function (t) {
|
12816 | _newArrowCheck(this, _this2);
|
12817 | var found = !1;
|
12818 | for (var i = 0; i < targets.length; i++) {
|
12819 | if (t.id === targets[i].id) {
|
12820 | found = !0;
|
12821 | if (t.values[t.values.length - 1]) {
|
12822 | tail = t.values[t.values.length - 1].index + 1;
|
12823 | }
|
12824 | length = targets[i].values.length;
|
12825 | for (var j = 0; j < length; j++) {
|
12826 | targets[i].values[j].index = tail + j;
|
12827 | if (!isTimeSeries) {
|
12828 | targets[i].values[j].x = tail + j;
|
12829 | }
|
12830 | }
|
12831 | t.values = t.values.concat(targets[i].values);
|
12832 | targets.splice(i, 1);
|
12833 | break;
|
12834 | }
|
12835 | }
|
12836 | found || notfoundIds.push(t.id);
|
12837 | }.bind(this));
|
12838 |
|
12839 |
|
12840 | $$.data.targets.forEach(function (t) {
|
12841 | _newArrowCheck(this, _this2);
|
12842 | for (var i = 0; i < notfoundIds.length; i++) {
|
12843 | if (t.id === notfoundIds[i]) {
|
12844 | tail = t.values[t.values.length - 1].index + 1;
|
12845 | for (var j = 0; j < length; j++) {
|
12846 | t.values.push({
|
12847 | id: t.id,
|
12848 | index: tail + j,
|
12849 | x: isTimeSeries ? $$.getOtherTargetX(tail + j) : tail + j,
|
12850 | value: null
|
12851 | });
|
12852 | }
|
12853 | }
|
12854 | }
|
12855 | }.bind(this));
|
12856 |
|
12857 |
|
12858 | if ($$.data.targets.length) {
|
12859 | targets.forEach(function (t) {
|
12860 | var _this3 = this;
|
12861 | _newArrowCheck(this, _this2);
|
12862 | var missing = [];
|
12863 | for (var i = $$.data.targets[0].values[0].index; i < tail; i++) {
|
12864 | missing.push({
|
12865 | id: t.id,
|
12866 | index: i,
|
12867 | x: isTimeSeries ? $$.getOtherTargetX(i) : i,
|
12868 | value: null
|
12869 | });
|
12870 | }
|
12871 | t.values.forEach(function (v) {
|
12872 | _newArrowCheck(this, _this3);
|
12873 | v.index += tail;
|
12874 | if (!isTimeSeries) {
|
12875 | v.x += tail;
|
12876 | }
|
12877 | }.bind(this));
|
12878 | t.values = missing.concat(t.values);
|
12879 | }.bind(this));
|
12880 | }
|
12881 | $$.data.targets = $$.data.targets.concat(targets);
|
12882 |
|
12883 |
|
12884 |
|
12885 | var baseTarget = $$.data.targets[0],
|
12886 | baseValue = baseTarget.values[0];
|
12887 |
|
12888 | if (isDefined(args.to)) {
|
12889 | length = 0;
|
12890 | to = isTimeSeries ? parseDate.call($$, args.to) : args.to;
|
12891 | baseTarget.values.forEach(function (v) {
|
12892 | _newArrowCheck(this, _this2);
|
12893 | v.x < to && length++;
|
12894 | }.bind(this));
|
12895 | } else if (isDefined(args.length)) {
|
12896 | length = args.length;
|
12897 | }
|
12898 |
|
12899 |
|
12900 | if (!orgDataCount) {
|
12901 | if (isTimeSeries) {
|
12902 | diff = baseTarget.values.length > 1 ? baseTarget.values[baseTarget.values.length - 1].x - baseValue.x : baseValue.x - $$.getXDomain($$.data.targets)[0];
|
12903 | } else {
|
12904 | diff = 1;
|
12905 | }
|
12906 | domain = [baseValue.x - diff, baseValue.x];
|
12907 | } else if (orgDataCount === 1 && isTimeSeries) {
|
12908 | diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2;
|
12909 | domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)];
|
12910 | }
|
12911 | domain && $$.updateXDomain(null, !0, !0, !1, domain);
|
12912 |
|
12913 |
|
12914 | $$.updateTargets($$.data.targets);
|
12915 |
|
12916 |
|
12917 | $$.redraw({
|
12918 | flow: {
|
12919 | index: baseValue.index,
|
12920 | length: length,
|
12921 | duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,
|
12922 | done: args.done,
|
12923 | orgDataCount: orgDataCount
|
12924 | },
|
12925 | withLegend: !0,
|
12926 | withTransition: orgDataCount > 1,
|
12927 | withTrimXDomain: !1,
|
12928 | withUpdateXAxis: !0
|
12929 | });
|
12930 | }
|
12931 | }
|
12932 | });
|
12933 |
|
12934 | var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(10);
|
12935 | ;
|
12936 |
|
12937 |
|
12938 |
|
12939 |
|
12940 |
|
12941 |
|
12942 |
|
12943 |
|
12944 | var AxisRendererHelper = function () {
|
12945 | function AxisRendererHelper(owner) {
|
12946 | this.owner = void 0;
|
12947 | this.config = void 0;
|
12948 | this.scale = void 0;
|
12949 | var scale = getScale(),
|
12950 | config = owner.config,
|
12951 | params = owner.params;
|
12952 | this.owner = owner;
|
12953 | this.config = config;
|
12954 | this.scale = scale;
|
12955 | if (config.noTransition || !params.config.transition_duration) {
|
12956 | config.withoutTransition = !0;
|
12957 | }
|
12958 |
|
12959 |
|
12960 | config.range = this.scaleExtent((params.orgXScale || scale).range());
|
12961 | }
|
12962 |
|
12963 | |
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 |
|
12969 | AxisRendererHelper.getSizeFor1Char = function getSizeFor1Char(node) {
|
12970 | var _this = this,
|
12971 | size = {
|
12972 | w: 5.5,
|
12973 | h: 11.5
|
12974 | };
|
12975 | node.empty() || node.select("text").text("0").call(function (el) {
|
12976 | _newArrowCheck(this, _this);
|
12977 | try {
|
12978 | var _el$node$getBBox = el.node().getBBox(),
|
12979 | width = _el$node$getBBox.width,
|
12980 | height = _el$node$getBBox.height;
|
12981 | if (width && height) {
|
12982 | size.w = width;
|
12983 | size.h = height;
|
12984 | }
|
12985 | } catch (e) {} finally {
|
12986 | el.text("");
|
12987 | }
|
12988 | }.bind(this));
|
12989 | this.getSizeFor1Char = function () {
|
12990 | _newArrowCheck(this, _this);
|
12991 | return size;
|
12992 | }.bind(this);
|
12993 | return size;
|
12994 | }
|
12995 |
|
12996 | |
12997 |
|
12998 |
|
12999 |
|
13000 |
|
13001 | ;
|
13002 | var _proto = AxisRendererHelper.prototype;
|
13003 | _proto.getTickTransformSetter = function getTickTransformSetter(id) {
|
13004 | var _this2 = this,
|
13005 | config = this.config,
|
13006 | fn = id === "x" ? function (value) {
|
13007 | _newArrowCheck(this, _this2);
|
13008 | return "translate(" + (value + config.tickOffset) + ",0)";
|
13009 | }.bind(this) : function (value) {
|
13010 | _newArrowCheck(this, _this2);
|
13011 | return "translate(0," + value + ")";
|
13012 | }.bind(this);
|
13013 | return function (selection, scale) {
|
13014 | var _this3 = this;
|
13015 | _newArrowCheck(this, _this2);
|
13016 | selection.attr("transform", function (d) {
|
13017 | _newArrowCheck(this, _this3);
|
13018 | return isValue(d) ? fn(Math.ceil(scale(d))) : null;
|
13019 | }.bind(this));
|
13020 | }.bind(this);
|
13021 | };
|
13022 | _proto.scaleExtent = function scaleExtent(domain) {
|
13023 | var start = domain[0],
|
13024 | stop = domain[domain.length - 1];
|
13025 | return start < stop ? [start, stop] : [stop, start];
|
13026 | };
|
13027 | _proto.generateTicks = function generateTicks(scale, isYAxes) {
|
13028 | var _this4 = this,
|
13029 | tickStepSize = this.owner.params.tickStepSize,
|
13030 | _scale$domain = scale.domain(),
|
13031 | start = _scale$domain[0],
|
13032 | end = _scale$domain[1],
|
13033 | ticks = [];
|
13034 |
|
13035 | if (isYAxes && tickStepSize) {
|
13036 | var interval = Math.round(start);
|
13037 | while (interval <= end) {
|
13038 | ticks.push(interval);
|
13039 | interval += tickStepSize;
|
13040 | }
|
13041 | } else if (scale.ticks) {
|
13042 | var tickArguments = this.config.tickArguments;
|
13043 |
|
13044 |
|
13045 | if (scale.type === "log" && !tickArguments) {
|
13046 |
|
13047 |
|
13048 | var s = getScale("_log").domain([start > 0 ? start : 1, end]).range(scale.range());
|
13049 | ticks = s.ticks();
|
13050 | for (var cnt = end.toFixed().length; ticks.length > 15; cnt--) {
|
13051 | ticks = s.ticks(cnt);
|
13052 | }
|
13053 | ticks.splice(0, 1, start);
|
13054 | ticks.splice(ticks.length - 1, 1, end);
|
13055 | } else {
|
13056 | ticks = scale.ticks.apply(scale, this.config.tickArguments || []);
|
13057 | }
|
13058 | ticks = ticks.map(function (v) {
|
13059 | _newArrowCheck(this, _this4);
|
13060 |
|
13061 | var r = isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v;
|
13062 | return r;
|
13063 | }.bind(this));
|
13064 | } else {
|
13065 | for (var i = Math.ceil(start); i < end; i++) {
|
13066 | ticks.push(i);
|
13067 | }
|
13068 | if (ticks.length > 0 && ticks[0] > 0) {
|
13069 | ticks.unshift(ticks[0] - (ticks[1] - ticks[0]));
|
13070 | }
|
13071 | }
|
13072 | return ticks;
|
13073 | };
|
13074 | _proto.copyScale = function copyScale() {
|
13075 | var newScale = this.scale.copy();
|
13076 | if (!newScale.domain().length) {
|
13077 | newScale.domain(this.scale.domain());
|
13078 | }
|
13079 | newScale.type = this.scale.type;
|
13080 | return newScale;
|
13081 | };
|
13082 | _proto.textFormatted = function textFormatted(v) {
|
13083 | var tickFormat = this.config.tickFormat,
|
13084 | value = /\d+\.\d+0{5,}\d$/.test(v) ? +(v + "").replace(/0+\d$/, "") : v,
|
13085 | formatted = tickFormat ? tickFormat(value) : value;
|
13086 |
|
13087 |
|
13088 | return isDefined(formatted) ? formatted : "";
|
13089 | };
|
13090 | _proto.transitionise = function transitionise(selection) {
|
13091 | var config = this.config,
|
13092 | transitionSelection = selection;
|
13093 | if (config.withoutTransition) {
|
13094 | transitionSelection = selection.interrupt();
|
13095 | } else if (config.transition || !this.owner.params.noTransition) {
|
13096 |
|
13097 |
|
13098 | try {
|
13099 | transitionSelection = selection.transition(config.transition);
|
13100 | } catch (e) {}
|
13101 | }
|
13102 | return transitionSelection;
|
13103 | };
|
13104 | return AxisRendererHelper;
|
13105 | }();
|
13106 |
|
13107 | ;
|
13108 |
|
13109 |
|
13110 |
|
13111 |
|
13112 |
|
13113 |
|
13114 |
|
13115 |
|
13116 |
|
13117 | var AxisRenderer = function () {
|
13118 | function AxisRenderer(params) {
|
13119 | if (params === void 0) {
|
13120 | params = {};
|
13121 | }
|
13122 | this.helper = void 0;
|
13123 | this.config = void 0;
|
13124 | this.params = void 0;
|
13125 | this.g = void 0;
|
13126 | this.generatedTicks = void 0;
|
13127 | var config = {
|
13128 | innerTickSize: 6,
|
13129 | outerTickSize: params.outerTick ? 6 : 0,
|
13130 | orient: "bottom",
|
13131 | range: [],
|
13132 | tickArguments: null,
|
13133 | tickCentered: null,
|
13134 | tickCulling: !0,
|
13135 | tickFormat: null,
|
13136 | tickLength: 9,
|
13137 | tickOffset: 0,
|
13138 | tickPadding: 3,
|
13139 | tickValues: null,
|
13140 | transition: null,
|
13141 | noTransition: params.noTransition
|
13142 | };
|
13143 | config.tickLength = Math.max(config.innerTickSize, 0) + config.tickPadding;
|
13144 | this.config = config;
|
13145 | this.params = params;
|
13146 | this.helper = new AxisRendererHelper(this);
|
13147 | }
|
13148 |
|
13149 | |
13150 |
|
13151 |
|
13152 |
|
13153 |
|
13154 | var _proto = AxisRenderer.prototype;
|
13155 | _proto.create = function create(g) {
|
13156 | var ctx = this,
|
13157 | config = ctx.config,
|
13158 | helper = ctx.helper,
|
13159 | params = ctx.params,
|
13160 | scale = helper.scale,
|
13161 | orient = config.orient,
|
13162 | splitTickText = this.splitTickText.bind(ctx),
|
13163 | isLeftRight = /^(left|right)$/.test(orient),
|
13164 | isTopBottom = /^(top|bottom)$/.test(orient),
|
13165 | tickTransform = helper.getTickTransformSetter(isTopBottom ? "x" : "y"),
|
13166 | axisPx = tickTransform === helper.axisX ? "y" : "x",
|
13167 | sign = /^(top|left)$/.test(orient) ? -1 : 1,
|
13168 | rotate = params.tickTextRotate;
|
13169 | this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range());
|
13170 | var innerTickSize = config.innerTickSize,
|
13171 | tickLength = config.tickLength,
|
13172 | range = config.range,
|
13173 | id = params.id,
|
13174 | tickTextPos = id && /^(x|y|y2)$/.test(id) ? params.config["axis_" + id + "_tick_text_position"] : {
|
13175 | x: 0,
|
13176 | y: 0
|
13177 | },
|
13178 | prefix = id === "subX" ? "subchart_axis_x" : "axis_" + id,
|
13179 | axisShow = params.config[prefix + "_show"],
|
13180 | tickShow = {
|
13181 | tick: axisShow ? params.config[prefix + "_tick_show"] : !1,
|
13182 | text: axisShow ? params.config[prefix + "_tick_text_show"] : !1
|
13183 | },
|
13184 | $g;
|
13185 | g.each(function () {
|
13186 | var _this = this,
|
13187 | g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
13188 | scale0 = this.__chart__ || scale,
|
13189 | scale1 = helper.copyScale();
|
13190 | $g = g;
|
13191 | this.__chart__ = scale1;
|
13192 | config.tickOffset = params.isCategory ? Math.ceil((scale1(1) - scale1(0)) / 2) : 0;
|
13193 |
|
13194 |
|
13195 | var path = g.selectAll(".domain").data([0]);
|
13196 |
|
13197 |
|
13198 | path.enter().append("path").attr("class", "domain")
|
13199 |
|
13200 | .merge(path).attr("d", function () {
|
13201 | _newArrowCheck(this, _this);
|
13202 | var outerTickSized = config.outerTickSize * sign;
|
13203 | return isTopBottom ? "M" + range[0] + "," + outerTickSized + "V0H" + range[1] + "V" + outerTickSized : "M" + outerTickSized + "," + range[0] + "H0V" + range[1] + "H" + outerTickSized;
|
13204 | }.bind(this));
|
13205 | if (tickShow.tick || tickShow.text) {
|
13206 |
|
13207 | var ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight);
|
13208 |
|
13209 |
|
13210 | ctx.generatedTicks = ticks;
|
13211 |
|
13212 |
|
13213 | var tick = g.selectAll(".tick").data(ticks, scale1),
|
13214 | tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick"),
|
13215 | tickExit = tick.exit().remove();
|
13216 |
|
13217 | tick = tickEnter.merge(tick);
|
13218 | tickShow.tick && tickEnter.append("line");
|
13219 | tickShow.text && tickEnter.append("text");
|
13220 | var sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tick),
|
13221 | counts = [],
|
13222 | tspan = tick.select("text").selectAll("tspan").data(function (d, index) {
|
13223 | var _this2 = this;
|
13224 | _newArrowCheck(this, _this);
|
13225 | var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)];
|
13226 | counts[index] = split.length;
|
13227 | return split.map(function (splitted) {
|
13228 | _newArrowCheck(this, _this2);
|
13229 | return {
|
13230 | index: index,
|
13231 | splitted: splitted
|
13232 | };
|
13233 | }.bind(this));
|
13234 | }.bind(this));
|
13235 | tspan.exit().remove();
|
13236 | tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) {
|
13237 | _newArrowCheck(this, _this);
|
13238 | return d.splitted;
|
13239 | }.bind(this));
|
13240 |
|
13241 |
|
13242 | tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", function () {
|
13243 | _newArrowCheck(this, _this);
|
13244 | var dx = 0;
|
13245 | if (/(top|bottom)/.test(orient) && rotate) {
|
13246 | dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1);
|
13247 | }
|
13248 | return dx + (tickTextPos.x || 0);
|
13249 | }.bind(this)()).attr("dy", function (d, i) {
|
13250 | _newArrowCheck(this, _this);
|
13251 | var dy = 0;
|
13252 | if (orient !== "top") {
|
13253 | dy = sizeFor1Char.h;
|
13254 | if (i === 0) {
|
13255 | dy = isLeftRight ? -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) : tickTextPos.y === 0 ? ".71em" : 0;
|
13256 | }
|
13257 | }
|
13258 | return isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || ".71em";
|
13259 | }.bind(this));
|
13260 | var lineUpdate = tick.select("line"),
|
13261 | textUpdate = tick.select("text");
|
13262 | tickEnter.select("line").attr(axisPx + "2", innerTickSize * sign);
|
13263 | tickEnter.select("text").attr(axisPx, tickLength * sign);
|
13264 | ctx.setTickLineTextPosition(lineUpdate, textUpdate);
|
13265 |
|
13266 |
|
13267 | if (params.tickTitle) {
|
13268 | var title = textUpdate.select("title");
|
13269 | (title.empty() ? textUpdate.append("title") : title).text(function (index) {
|
13270 | _newArrowCheck(this, _this);
|
13271 | return params.tickTitle[index];
|
13272 | }.bind(this));
|
13273 | }
|
13274 | if (scale1.bandwidth) {
|
13275 | var x = scale1,
|
13276 | dx = x.bandwidth() / 2;
|
13277 | scale0 = function (d) {
|
13278 | _newArrowCheck(this, _this);
|
13279 | return x(d) + dx;
|
13280 | }.bind(this);
|
13281 | scale1 = scale0;
|
13282 | } else if (scale0.bandwidth) {
|
13283 | scale0 = scale1;
|
13284 | } else {
|
13285 | tickTransform(tickExit, scale1);
|
13286 | }
|
13287 |
|
13288 |
|
13289 |
|
13290 | tick = params.owner.state.flowing ? helper.transitionise(tick) : params.owner.$T(tick);
|
13291 | tickTransform(tickEnter, scale0);
|
13292 | tickTransform(tick.style("opacity", null), scale1);
|
13293 | }
|
13294 | });
|
13295 | this.g = $g;
|
13296 | }
|
13297 |
|
13298 | |
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 | ;
|
13304 | _proto.getGeneratedTicks = function getGeneratedTicks(count) {
|
13305 | var _this$generatedTicks,
|
13306 | len = ((_this$generatedTicks = this.generatedTicks) == null ? void 0 : _this$generatedTicks.length) - 1,
|
13307 | res = this.generatedTicks,
|
13308 | _this3 = this;
|
13309 | if (len > count) {
|
13310 | var interval = Math.round(len / count + .1);
|
13311 | res = this.generatedTicks.map(function (v, i) {
|
13312 | _newArrowCheck(this, _this3);
|
13313 | return i % interval === 0 ? v : null;
|
13314 | }.bind(this)).filter(function (v) {
|
13315 | _newArrowCheck(this, _this3);
|
13316 | return v !== null;
|
13317 | }.bind(this)).splice(0, count);
|
13318 | }
|
13319 | return res;
|
13320 | }
|
13321 |
|
13322 | |
13323 |
|
13324 |
|
13325 |
|
13326 | ;
|
13327 | _proto.getTickXY = function getTickXY() {
|
13328 | var config = this.config,
|
13329 | pos = {
|
13330 | x: 0,
|
13331 | y: 0
|
13332 | };
|
13333 | if (this.params.isCategory) {
|
13334 | pos.x = config.tickCentered ? 0 : config.tickOffset;
|
13335 | pos.y = config.tickCentered ? config.tickOffset : 0;
|
13336 | }
|
13337 | return pos;
|
13338 | }
|
13339 |
|
13340 | |
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 | ;
|
13346 | _proto.getTickSize = function getTickSize(d) {
|
13347 | var scale = this.helper.scale,
|
13348 | config = this.config,
|
13349 | _config2 = config,
|
13350 | innerTickSize = _config2.innerTickSize,
|
13351 | range = _config2.range,
|
13352 | tickPosition = scale(d) + (config.tickCentered ? 0 : config.tickOffset);
|
13353 | return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;
|
13354 | }
|
13355 |
|
13356 | |
13357 |
|
13358 |
|
13359 |
|
13360 |
|
13361 | ;
|
13362 | _proto.setTickLineTextPosition = function setTickLineTextPosition(lineUpdate, textUpdate) {
|
13363 | var _this4 = this,
|
13364 | tickPos = this.getTickXY(),
|
13365 | _this$config = this.config,
|
13366 | innerTickSize = _this$config.innerTickSize,
|
13367 | orient = _this$config.orient,
|
13368 | tickLength = _this$config.tickLength,
|
13369 | tickOffset = _this$config.tickOffset,
|
13370 | rotate = this.params.tickTextRotate,
|
13371 | textAnchorForText = function (r) {
|
13372 | _newArrowCheck(this, _this4);
|
13373 | var value = ["start", "end"];
|
13374 | orient === "top" && value.reverse();
|
13375 | return !r ? "middle" : value[r > 0 ? 0 : 1];
|
13376 | }.bind(this),
|
13377 | textTransform = function (r) {
|
13378 | _newArrowCheck(this, _this4);
|
13379 | return r ? "rotate(" + r + ")" : null;
|
13380 | }.bind(this),
|
13381 | yForText = function (r) {
|
13382 | _newArrowCheck(this, _this4);
|
13383 | var r2 = r / (orient === "bottom" ? 15 : 23);
|
13384 | return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
|
13385 | }.bind(this);
|
13386 | switch (orient) {
|
13387 | case "bottom":
|
13388 | lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", this.getTickSize.bind(this));
|
13389 | textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).attr("transform", textTransform(rotate));
|
13390 | break;
|
13391 | case "top":
|
13392 | lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
|
13393 | textUpdate.attr("x", 0).attr("y", -yForText(rotate) * 2).style("text-anchor", textAnchorForText(rotate)).attr("transform", textTransform(rotate));
|
13394 | break;
|
13395 | case "left":
|
13396 | lineUpdate.attr("x2", -innerTickSize).attr("y1", tickPos.y).attr("y2", tickPos.y);
|
13397 | textUpdate.attr("x", -tickLength).attr("y", tickOffset).style("text-anchor", "end");
|
13398 | break;
|
13399 | case "right":
|
13400 | lineUpdate.attr("x2", innerTickSize).attr("y2", 0);
|
13401 | textUpdate.attr("x", tickLength).attr("y", 0).style("text-anchor", "start");
|
13402 | }
|
13403 | }
|
13404 |
|
13405 |
|
13406 | ;
|
13407 | _proto.splitTickText = function splitTickText(d, scale, ticks, isLeftRight, charWidth) {
|
13408 | var params = this.params,
|
13409 | tickText = this.helper.textFormatted(d),
|
13410 | splitted = isString(tickText) && tickText.indexOf("\n") > -1 ? tickText.split("\n") : [];
|
13411 | if (splitted.length) {
|
13412 | return splitted;
|
13413 | }
|
13414 | if (isArray(tickText)) {
|
13415 | return tickText;
|
13416 | }
|
13417 | var tickWidth = params.tickWidth;
|
13418 | if (!tickWidth || tickWidth <= 0) {
|
13419 | tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110;
|
13420 | }
|
13421 |
|
13422 |
|
13423 |
|
13424 | function split(splitted, text) {
|
13425 | var subtext, spaceIndex, textWidth;
|
13426 | for (var i = 1; i < text.length; i++) {
|
13427 | if (text.charAt(i) === " ") {
|
13428 | spaceIndex = i;
|
13429 | }
|
13430 | subtext = text.substr(0, i + 1);
|
13431 | textWidth = charWidth * subtext.length;
|
13432 |
|
13433 |
|
13434 | if (tickWidth < textWidth) {
|
13435 | return split(splitted.concat(text.substr(0, spaceIndex || i)), text.slice(spaceIndex ? spaceIndex + 1 : i));
|
13436 | }
|
13437 | }
|
13438 | return splitted.concat(text);
|
13439 | }
|
13440 | return split(splitted, tickText + "");
|
13441 | };
|
13442 | _proto.scale = function scale(x) {
|
13443 | if (!arguments.length) {
|
13444 | return this.helper.scale;
|
13445 | }
|
13446 | this.helper.scale = x;
|
13447 | return this;
|
13448 | };
|
13449 | _proto.orient = function orient(x) {
|
13450 | if (!arguments.length) {
|
13451 | return this.config.orient;
|
13452 | }
|
13453 | this.config.orient = x in {
|
13454 | top: 1,
|
13455 | right: 1,
|
13456 | bottom: 1,
|
13457 | left: 1
|
13458 | } ? x + "" : "bottom";
|
13459 | return this;
|
13460 | };
|
13461 | _proto.tickFormat = function tickFormat(format) {
|
13462 | var config = this.config;
|
13463 | if (!arguments.length) {
|
13464 | return config.tickFormat;
|
13465 | }
|
13466 | config.tickFormat = format;
|
13467 | return this;
|
13468 | };
|
13469 | _proto.tickCentered = function tickCentered(isCentered) {
|
13470 | var config = this.config;
|
13471 | if (!arguments.length) {
|
13472 | return config.tickCentered;
|
13473 | }
|
13474 | config.tickCentered = isCentered;
|
13475 | return this;
|
13476 | }
|
13477 |
|
13478 | |
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 | ;
|
13484 | _proto.tickOffset = function tickOffset() {
|
13485 | return this.config.tickOffset;
|
13486 | }
|
13487 |
|
13488 | |
13489 |
|
13490 |
|
13491 |
|
13492 |
|
13493 | ;
|
13494 | _proto.tickInterval = function tickInterval(size) {
|
13495 | var _this5 = this,
|
13496 | _this$config2 = this.config,
|
13497 | outerTickSize = _this$config2.outerTickSize,
|
13498 | tickOffset = _this$config2.tickOffset,
|
13499 | tickValues = _this$config2.tickValues,
|
13500 | interval;
|
13501 | if (this.params.isCategory) {
|
13502 | interval = tickOffset * 2;
|
13503 | } else {
|
13504 | var length = this.g.select("path.domain").node().getTotalLength() - outerTickSize * 2;
|
13505 | interval = length / (size || this.g.selectAll("line").size());
|
13506 |
|
13507 |
|
13508 | var intervalByValue = tickValues ? tickValues.map(function (v, i, arr) {
|
13509 | _newArrowCheck(this, _this5);
|
13510 | var next = i + 1;
|
13511 | return next < arr.length ? this.helper.scale(arr[next]) - this.helper.scale(v) : null;
|
13512 | }.bind(this)).filter(Boolean) : [];
|
13513 | interval = Math.min.apply(Math, intervalByValue.concat([interval]));
|
13514 | }
|
13515 | return interval === Infinity ? 0 : interval;
|
13516 | };
|
13517 | _proto.ticks = function ticks() {
|
13518 | for (var config = this.config, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
13519 | args[_key] = arguments[_key];
|
13520 | }
|
13521 | if (!args.length) {
|
13522 | return config.tickArguments;
|
13523 | }
|
13524 | config.tickArguments = toArray(args);
|
13525 | return this;
|
13526 | };
|
13527 | _proto.tickCulling = function tickCulling(culling) {
|
13528 | var config = this.config;
|
13529 | if (!arguments.length) {
|
13530 | return config.tickCulling;
|
13531 | }
|
13532 | config.tickCulling = culling;
|
13533 | return this;
|
13534 | };
|
13535 | _proto.tickValues = function tickValues(x) {
|
13536 | var _this6 = this,
|
13537 | config = this.config;
|
13538 | if (isFunction(x)) {
|
13539 | config.tickValues = function () {
|
13540 | _newArrowCheck(this, _this6);
|
13541 | return x(this.helper.scale.domain());
|
13542 | }.bind(this);
|
13543 | } else {
|
13544 | if (!arguments.length) {
|
13545 | return config.tickValues;
|
13546 | }
|
13547 | config.tickValues = x;
|
13548 | }
|
13549 | return this;
|
13550 | };
|
13551 | _proto.setTransition = function setTransition(t) {
|
13552 | this.config.transition = t;
|
13553 | return this;
|
13554 | };
|
13555 | return AxisRenderer;
|
13556 | }();
|
13557 |
|
13558 | ;
|
13559 |
|
13560 |
|
13561 |
|
13562 |
|
13563 |
|
13564 |
|
13565 |
|
13566 |
|
13567 |
|
13568 |
|
13569 | var Axis = ({
|
13570 | getAxisInstance: function getAxisInstance() {
|
13571 | return this.axis || new Axis_Axis(this);
|
13572 | }
|
13573 | });
|
13574 | var Axis_Axis = function () {
|
13575 | function Axis(owner) {
|
13576 | this.owner = void 0;
|
13577 | this.x = void 0;
|
13578 | this.subX = void 0;
|
13579 | this.y = void 0;
|
13580 | this.y2 = void 0;
|
13581 | this.axesList = {};
|
13582 | this.tick = {
|
13583 | x: null,
|
13584 | y: null,
|
13585 | y2: null
|
13586 | };
|
13587 | this.xs = [];
|
13588 | this.orient = {
|
13589 | x: "bottom",
|
13590 | y: "left",
|
13591 | y2: "right",
|
13592 | subX: "bottom"
|
13593 | };
|
13594 | this.owner = owner;
|
13595 | this.setOrient();
|
13596 | }
|
13597 | var _proto = Axis.prototype;
|
13598 | _proto.getAxisClassName = function getAxisClassName(id) {
|
13599 | return $AXIS.axis + " " + $AXIS["axis" + capitalize(id)];
|
13600 | };
|
13601 | _proto.isHorizontal = function isHorizontal($$, forHorizontal) {
|
13602 | var isRotated = $$.config.axis_rotated;
|
13603 | return forHorizontal ? isRotated : !isRotated;
|
13604 | };
|
13605 | _proto.isCategorized = function isCategorized() {
|
13606 | var _this$owner = this.owner,
|
13607 | config = _this$owner.config,
|
13608 | state = _this$owner.state;
|
13609 | return config.axis_x_type.indexOf("category") >= 0 || state.hasRadar;
|
13610 | };
|
13611 | _proto.isCustomX = function isCustomX() {
|
13612 | var config = this.owner.config;
|
13613 | return !this.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));
|
13614 | };
|
13615 | _proto.isTimeSeries = function isTimeSeries(id) {
|
13616 | if (id === void 0) {
|
13617 | id = "x";
|
13618 | }
|
13619 | return this.owner.config["axis_" + id + "_type"] === "timeseries";
|
13620 | };
|
13621 | _proto.isLog = function isLog(id) {
|
13622 | if (id === void 0) {
|
13623 | id = "x";
|
13624 | }
|
13625 | return this.owner.config["axis_" + id + "_type"] === "log";
|
13626 | };
|
13627 | _proto.isTimeSeriesY = function isTimeSeriesY() {
|
13628 | return this.isTimeSeries("y");
|
13629 | };
|
13630 | _proto.getAxisType = function getAxisType(id) {
|
13631 | if (id === void 0) {
|
13632 | id = "x";
|
13633 | }
|
13634 | var type = "linear";
|
13635 | if (this.isTimeSeries(id)) {
|
13636 | type = this.owner.config.axis_x_localtime ? "time" : "utc";
|
13637 | } else if (this.isLog(id)) {
|
13638 | type = "log";
|
13639 | }
|
13640 | return type;
|
13641 | };
|
13642 | _proto.init = function init() {
|
13643 | var _this = this,
|
13644 | $$ = this.owner,
|
13645 | config = $$.config,
|
13646 | _$$$$el = $$.$el,
|
13647 | main = _$$$$el.main,
|
13648 | axis = _$$$$el.axis,
|
13649 | clip = $$.state.clip,
|
13650 | isRotated = config.axis_rotated,
|
13651 | target = ["x", "y"];
|
13652 | config.axis_y2_show && target.push("y2");
|
13653 | target.forEach(function (v) {
|
13654 | var _this2 = this;
|
13655 | _newArrowCheck(this, _this);
|
13656 | var classAxis = this.getAxisClassName(v),
|
13657 | classLabel = $AXIS["axis" + v.toUpperCase() + "Label"];
|
13658 | axis[v] = main.append("g").attr("class", classAxis).attr("clip-path", function () {
|
13659 | _newArrowCheck(this, _this2);
|
13660 | var res = null;
|
13661 | if (v === "x") {
|
13662 | res = clip.pathXAxis;
|
13663 | } else if (v === "y") {
|
13664 |
|
13665 | res = clip.pathYAxis;
|
13666 | }
|
13667 | return res;
|
13668 | }.bind(this)).attr("transform", $$.getTranslate(v)).style("visibility", config["axis_" + v + "_show"] ? null : "hidden");
|
13669 | axis[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", function () {
|
13670 | _newArrowCheck(this, _this2);
|
13671 | return this.textAnchorForAxisLabel(v);
|
13672 | }.bind(this));
|
13673 | this.generateAxes(v);
|
13674 | }.bind(this));
|
13675 | }
|
13676 |
|
13677 | |
13678 |
|
13679 |
|
13680 | ;
|
13681 | _proto.setOrient = function setOrient() {
|
13682 | var $$ = this.owner,
|
13683 | _$$$config = $$.config,
|
13684 | isRotated = _$$$config.axis_rotated,
|
13685 | yInner = _$$$config.axis_y_inner,
|
13686 | y2Inner = _$$$config.axis_y2_inner;
|
13687 | this.orient = {
|
13688 | x: isRotated ? "left" : "bottom",
|
13689 | y: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
|
13690 | y2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right",
|
13691 | subX: isRotated ? "left" : "bottom"
|
13692 | };
|
13693 | }
|
13694 |
|
13695 | |
13696 |
|
13697 |
|
13698 |
|
13699 |
|
13700 | ;
|
13701 | _proto.generateAxes = function generateAxes(id) {
|
13702 | var _this3 = this,
|
13703 | $$ = this.owner,
|
13704 | config = $$.config,
|
13705 | axes = [],
|
13706 | axesConfig = config["axis_" + id + "_axes"],
|
13707 | isRotated = config.axis_rotated,
|
13708 | d3Axis;
|
13709 | if (id === "x") {
|
13710 | 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;
|
13711 | } else if (id === "y") {
|
13712 | 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;
|
13713 | } else if (id === "y2") {
|
13714 | 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;
|
13715 | }
|
13716 | if (axesConfig.length) {
|
13717 | axesConfig.forEach(function (v) {
|
13718 | var _this4 = this;
|
13719 | _newArrowCheck(this, _this3);
|
13720 | var tick = v.tick || {},
|
13721 | scale = $$.scale[id].copy();
|
13722 | v.domain && scale.domain(v.domain);
|
13723 | axes.push(d3Axis(scale).ticks(tick.count).tickFormat(isFunction(tick.format) ? tick.format.bind($$.api) : function (x) {
|
13724 | _newArrowCheck(this, _this4);
|
13725 | return x;
|
13726 | }.bind(this)).tickValues(tick.values).tickSizeOuter(tick.outer === !1 ? 0 : 6));
|
13727 | }.bind(this));
|
13728 | }
|
13729 | this.axesList[id] = axes;
|
13730 | }
|
13731 |
|
13732 | |
13733 |
|
13734 |
|
13735 | ;
|
13736 | _proto.updateAxes = function updateAxes() {
|
13737 | var _this5 = this,
|
13738 | $$ = this.owner,
|
13739 | config = $$.config,
|
13740 | main = $$.$el.main,
|
13741 | $T = $$.$T;
|
13742 | Object.keys(this.axesList).forEach(function (id) {
|
13743 | var _this6 = this;
|
13744 | _newArrowCheck(this, _this5);
|
13745 | var axesConfig = config["axis_" + id + "_axes"],
|
13746 | scale = $$.scale[id].copy(),
|
13747 | range = scale.range();
|
13748 | this.axesList[id].forEach(function (v, i) {
|
13749 | var _this7 = this;
|
13750 | _newArrowCheck(this, _this6);
|
13751 | var axisRange = v.scale().range();
|
13752 |
|
13753 |
|
13754 |
|
13755 | if (!range.every(function (v, i) {
|
13756 | _newArrowCheck(this, _this7);
|
13757 | return v === axisRange[i];
|
13758 | }.bind(this))) {
|
13759 | v.scale().range(range);
|
13760 | }
|
13761 | var className = this.getAxisClassName(id) + "-" + (i + 1),
|
13762 | g = main.select("." + className.replace(/\s/, "."));
|
13763 | if (g.empty()) {
|
13764 | g = main.append("g").attr("class", className).style("visibility", config["axis_" + id + "_show"] ? null : "hidden").call(v);
|
13765 | } else {
|
13766 | axesConfig[i].domain && scale.domain(axesConfig[i].domain);
|
13767 | $T(g).call(v.scale(scale));
|
13768 | }
|
13769 | g.attr("transform", $$.getTranslate(id, i + 1));
|
13770 | }.bind(this));
|
13771 | }.bind(this));
|
13772 | }
|
13773 |
|
13774 | |
13775 |
|
13776 |
|
13777 |
|
13778 |
|
13779 |
|
13780 |
|
13781 |
|
13782 | ;
|
13783 | _proto.setAxis = function setAxis(id, scale, outerTick, noTransition) {
|
13784 | var $$ = this.owner;
|
13785 | if (id !== "subX") {
|
13786 | this.tick[id] = this.getTickValues(id);
|
13787 | }
|
13788 |
|
13789 |
|
13790 | this[id] = this.getAxis(id, scale, outerTick,
|
13791 |
|
13792 |
|
13793 | id === "x" && ($$.scale.zoom || $$.config.subchart_show || $$.state.resizing) ? !0 : noTransition);
|
13794 | }
|
13795 |
|
13796 |
|
13797 | ;
|
13798 | _proto.getAxis = function getAxis(id, scale, outerTick, noTransition, noTickTextRotate) {
|
13799 | var _this8 = this,
|
13800 | $$ = this.owner,
|
13801 | config = $$.config,
|
13802 | isX = /^(x|subX)$/.test(id),
|
13803 | type = isX ? "x" : id,
|
13804 | isCategory = isX && this.isCategorized(),
|
13805 | orient = this.orient[id],
|
13806 | tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type),
|
13807 | tickFormat;
|
13808 | if (isX) {
|
13809 | tickFormat = id === "subX" ? $$.format.subXAxisTick : $$.format.xAxisTick;
|
13810 | } else {
|
13811 | var fn = config["axis_" + id + "_tick_format"];
|
13812 | if (isFunction(fn)) {
|
13813 | tickFormat = fn.bind($$.api);
|
13814 | }
|
13815 | }
|
13816 | var tickValues = this.tick[type],
|
13817 | axisParams = mergeObj({
|
13818 | outerTick: outerTick,
|
13819 | noTransition: noTransition,
|
13820 | config: config,
|
13821 | id: id,
|
13822 | tickTextRotate: tickTextRotate,
|
13823 | owner: $$
|
13824 | }, isX && {
|
13825 | isCategory: isCategory,
|
13826 | tickMultiline: config.axis_x_tick_multiline,
|
13827 | tickWidth: config.axis_x_tick_width,
|
13828 | tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
13829 | orgXScale: $$.scale.x
|
13830 | });
|
13831 | if (!isX) {
|
13832 | axisParams.tickStepSize = config["axis_" + type + "_tick_stepSize"];
|
13833 | }
|
13834 | var axis = new AxisRenderer(axisParams).scale(isX && $$.scale.zoom || scale).orient(orient);
|
13835 | if (isX && this.isTimeSeries() && tickValues && !isFunction(tickValues)) {
|
13836 | var _fn = parseDate.bind($$);
|
13837 | tickValues = tickValues.map(function (v) {
|
13838 | _newArrowCheck(this, _this8);
|
13839 | return _fn(v);
|
13840 | }.bind(this));
|
13841 | } else if (!isX && this.isTimeSeriesY()) {
|
13842 |
|
13843 | axis.ticks(config.axis_y_tick_time_value);
|
13844 | tickValues = null;
|
13845 | }
|
13846 | tickValues && axis.tickValues(tickValues);
|
13847 |
|
13848 |
|
13849 | axis.tickFormat(tickFormat || !isX && $$.isStackNormalized() && function (x) {
|
13850 | _newArrowCheck(this, _this8);
|
13851 | return x + "%";
|
13852 | }.bind(this));
|
13853 | if (isCategory) {
|
13854 | axis.tickCentered(config.axis_x_tick_centered);
|
13855 | if (isEmpty(config.axis_x_tick_culling)) {
|
13856 | config.axis_x_tick_culling = !1;
|
13857 | }
|
13858 | }
|
13859 | var tickCount = config["axis_" + type + "_tick_count"];
|
13860 | tickCount && axis.ticks(tickCount);
|
13861 | return axis;
|
13862 | };
|
13863 | _proto.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {
|
13864 | var $$ = this.owner,
|
13865 | config = $$.config,
|
13866 | fit = config.axis_x_tick_fit,
|
13867 | count = config.axis_x_tick_count,
|
13868 | values;
|
13869 | if (fit || count && fit) {
|
13870 | values = $$.mapTargetsToUniqueXs(targets);
|
13871 |
|
13872 |
|
13873 | if (this.isCategorized() && count > values.length) {
|
13874 | count = values.length;
|
13875 | }
|
13876 | values = this.generateTickValues(values, count, this.isTimeSeries());
|
13877 | }
|
13878 | if (axis) {
|
13879 | axis.tickValues(values);
|
13880 | } else if (this.x) {
|
13881 | var _this$subX;
|
13882 | this.x.tickValues(values);
|
13883 | (_this$subX = this.subX) == null ? void 0 : _this$subX.tickValues(values);
|
13884 | }
|
13885 | return values;
|
13886 | };
|
13887 | _proto.getId = function getId(id) {
|
13888 | var _this$owner2 = this.owner,
|
13889 | config = _this$owner2.config,
|
13890 | scale = _this$owner2.scale,
|
13891 | axis = config.data_axes[id];
|
13892 |
|
13893 | if (!axis || !scale[axis]) {
|
13894 | axis = "y";
|
13895 | }
|
13896 | return axis;
|
13897 | };
|
13898 | _proto.getXAxisTickFormat = function getXAxisTickFormat(forSubchart) {
|
13899 | var _this9 = this,
|
13900 | $$ = this.owner,
|
13901 | config = $$.config,
|
13902 | format = $$.format,
|
13903 | tickFormat = forSubchart ? config.subchart_axis_x_tick_format || config.axis_x_tick_format : config.axis_x_tick_format,
|
13904 | isTimeSeries = this.isTimeSeries(),
|
13905 | isCategorized = this.isCategorized(),
|
13906 | currFormat;
|
13907 | if (tickFormat) {
|
13908 | if (isFunction(tickFormat)) {
|
13909 | currFormat = tickFormat.bind($$.api);
|
13910 | } else if (isTimeSeries) {
|
13911 | currFormat = function (date) {
|
13912 | _newArrowCheck(this, _this9);
|
13913 | return date ? format.axisTime(tickFormat)(date) : "";
|
13914 | }.bind(this);
|
13915 | }
|
13916 | } else {
|
13917 | currFormat = isTimeSeries ? format.defaultAxisTime : isCategorized ? $$.categoryName : function (v) {
|
13918 | _newArrowCheck(this, _this9);
|
13919 | return v < 0 ? v.toFixed(0) : v;
|
13920 | }.bind(this);
|
13921 | }
|
13922 | return isFunction(currFormat) ? function (v) {
|
13923 | _newArrowCheck(this, _this9);
|
13924 | return currFormat.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]);
|
13925 | }.bind(this) : currFormat;
|
13926 | };
|
13927 | _proto.getTickValues = function getTickValues(id) {
|
13928 | var $$ = this.owner,
|
13929 | tickValues = $$.config["axis_" + id + "_tick_values"],
|
13930 | axis = $$[id + "Axis"];
|
13931 | return (isFunction(tickValues) ? tickValues.call($$.api) : tickValues) || (axis ? axis.tickValues() : undefined);
|
13932 | };
|
13933 | _proto.getLabelOptionByAxisId = function getLabelOptionByAxisId(id) {
|
13934 | return this.owner.config["axis_" + id + "_label"];
|
13935 | };
|
13936 | _proto.getLabelText = function getLabelText(id) {
|
13937 | var option = this.getLabelOptionByAxisId(id);
|
13938 | return isString(option) ? option : option ? option.text : null;
|
13939 | };
|
13940 | _proto.setLabelText = function setLabelText(id, text) {
|
13941 | var $$ = this.owner,
|
13942 | config = $$.config,
|
13943 | option = this.getLabelOptionByAxisId(id);
|
13944 | if (isString(option)) {
|
13945 | config["axis_" + id + "_label"] = text;
|
13946 | } else if (option) {
|
13947 | option.text = text;
|
13948 | }
|
13949 | };
|
13950 | _proto.getLabelPosition = function getLabelPosition(id, defaultPosition) {
|
13951 | var _this10 = this,
|
13952 | isRotated = this.owner.config.axis_rotated,
|
13953 | option = this.getLabelOptionByAxisId(id),
|
13954 | position = isObjectType(option) && option.position ? option.position : defaultPosition[+!isRotated],
|
13955 | has = function (v) {
|
13956 | _newArrowCheck(this, _this10);
|
13957 | return !!~position.indexOf(v);
|
13958 | }.bind(this);
|
13959 | return {
|
13960 | isInner: has("inner"),
|
13961 | isOuter: has("outer"),
|
13962 | isLeft: has("left"),
|
13963 | isCenter: has("center"),
|
13964 | isRight: has("right"),
|
13965 | isTop: has("top"),
|
13966 | isMiddle: has("middle"),
|
13967 | isBottom: has("bottom")
|
13968 | };
|
13969 | };
|
13970 | _proto.getAxisLabelPosition = function getAxisLabelPosition(id) {
|
13971 | return this.getLabelPosition(id, id === "x" ? ["inner-top", "inner-right"] : ["inner-right", "inner-top"]);
|
13972 | };
|
13973 | _proto.getLabelPositionById = function getLabelPositionById(id) {
|
13974 | return this.getAxisLabelPosition(id);
|
13975 | };
|
13976 | _proto.xForAxisLabel = function xForAxisLabel(id) {
|
13977 | var $$ = this.owner,
|
13978 | _$$$state = $$.state,
|
13979 | width = _$$$state.width,
|
13980 | height = _$$$state.height,
|
13981 | position = this.getAxisLabelPosition(id),
|
13982 | x = position.isMiddle ? -height / 2 : 0;
|
13983 | if (this.isHorizontal($$, id !== "x")) {
|
13984 | x = position.isLeft ? 0 : position.isCenter ? width / 2 : width;
|
13985 | } else if (position.isBottom) {
|
13986 | x = -height;
|
13987 | }
|
13988 | return x;
|
13989 | };
|
13990 | _proto.dxForAxisLabel = function dxForAxisLabel(id) {
|
13991 | var $$ = this.owner,
|
13992 | position = this.getAxisLabelPosition(id),
|
13993 | dx = position.isBottom ? "0.5em" : "0";
|
13994 | if (this.isHorizontal($$, id !== "x")) {
|
13995 | dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
|
13996 | } else if (position.isTop) {
|
13997 | dx = "-0.5em";
|
13998 | }
|
13999 | return dx;
|
14000 | };
|
14001 | _proto.textAnchorForAxisLabel = function textAnchorForAxisLabel(id) {
|
14002 | var $$ = this.owner,
|
14003 | position = this.getAxisLabelPosition(id),
|
14004 | anchor = position.isMiddle ? "middle" : "end";
|
14005 | if (this.isHorizontal($$, id !== "x")) {
|
14006 | anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end";
|
14007 | } else if (position.isBottom) {
|
14008 | anchor = "start";
|
14009 | }
|
14010 | return anchor;
|
14011 | };
|
14012 | _proto.dyForAxisLabel = function dyForAxisLabel(id) {
|
14013 | var $$ = this.owner,
|
14014 | config = $$.config,
|
14015 | isRotated = config.axis_rotated,
|
14016 | isInner = this.getAxisLabelPosition(id).isInner,
|
14017 | tickRotate = config["axis_" + id + "_tick_rotate"] ? $$.getHorizontalAxisHeight(id) : 0,
|
14018 | maxTickWidth = this.getMaxTickWidth(id),
|
14019 | dy;
|
14020 | if (id === "x") {
|
14021 | var xHeight = config.axis_x_height;
|
14022 | if (isRotated) {
|
14023 | dy = isInner ? "1.2em" : -25 - maxTickWidth;
|
14024 | } else if (isInner) {
|
14025 | dy = "-0.5em";
|
14026 | } else if (xHeight) {
|
14027 | dy = xHeight - 10;
|
14028 | } else if (tickRotate) {
|
14029 | dy = tickRotate - 10;
|
14030 | } else {
|
14031 | dy = "3em";
|
14032 | }
|
14033 | } else {
|
14034 | dy = {
|
14035 | y: ["-0.5em", 10, "3em", "1.2em", 10],
|
14036 | y2: ["1.2em", -20, "-2.2em", "-0.5em", 15]
|
14037 | }[id];
|
14038 | if (isRotated) {
|
14039 | if (isInner) {
|
14040 | dy = dy[0];
|
14041 | } else if (tickRotate) {
|
14042 | dy = tickRotate * (id === "y2" ? -1 : 1) - dy[1];
|
14043 | } else {
|
14044 | dy = dy[2];
|
14045 | }
|
14046 | } else {
|
14047 | dy = isInner ? dy[3] : (dy[4] + (config["axis_" + id + "_inner"] ? 0 : maxTickWidth + dy[4])) * (id === "y" ? -1 : 1);
|
14048 | }
|
14049 | }
|
14050 | return dy;
|
14051 | };
|
14052 | _proto.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) {
|
14053 | var _this11 = this,
|
14054 | $$ = this.owner,
|
14055 | config = $$.config,
|
14056 | current = $$.state.current,
|
14057 | _$$$$el2 = $$.$el,
|
14058 | svg = _$$$$el2.svg,
|
14059 | chart = _$$$$el2.chart,
|
14060 | currentTickMax = current.maxTickWidths[id],
|
14061 | maxWidth = 0;
|
14062 | if (withoutRecompute || !config["axis_" + id + "_show"] || $$.filterTargetsToShow().length === 0) {
|
14063 | return currentTickMax.size;
|
14064 | }
|
14065 | if (svg) {
|
14066 | var isYAxis = /^y2?$/.test(id),
|
14067 | targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
14068 | _scale = $$.scale[id].copy().domain($$["get" + (isYAxis ? "Y" : "X") + "Domain"](targetsToShow, id)),
|
14069 | domain = _scale.domain(),
|
14070 | isDomainSame = domain[0] === domain[1] && domain.every(function (v) {
|
14071 | _newArrowCheck(this, _this11);
|
14072 | return v > 0;
|
14073 | }.bind(this)),
|
14074 | isCurrentMaxTickDomainSame = isArray(currentTickMax.domain) && currentTickMax.domain[0] === currentTickMax.domain[1] && currentTickMax.domain.every(function (v) {
|
14075 | _newArrowCheck(this, _this11);
|
14076 | return v > 0;
|
14077 | }.bind(this));
|
14078 |
|
14079 | if (isDomainSame || isCurrentMaxTickDomainSame) {
|
14080 | return currentTickMax.size;
|
14081 | } else {
|
14082 | currentTickMax.domain = domain;
|
14083 | }
|
14084 |
|
14085 |
|
14086 | if (!isYAxis) {
|
14087 | currentTickMax.ticks.splice(0);
|
14088 | }
|
14089 | var axis = this.getAxis(id, _scale, !1, !1, !0),
|
14090 | tickCount = config["axis_" + id + "_tick_count"],
|
14091 | tickValues = config["axis_" + id + "_tick_values"];
|
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 | if (!tickValues && tickCount) {
|
14097 | axis.tickValues(this.generateTickValues(domain, tickCount, isYAxis ? this.isTimeSeriesY() : this.isTimeSeries()));
|
14098 | }
|
14099 | isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
|
14100 | var dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0");
|
14101 | axis.create(dummy);
|
14102 | dummy.selectAll("text").each(function (d, i) {
|
14103 | var currentTextWidth = this.getBoundingClientRect().width;
|
14104 | maxWidth = Math.max(maxWidth, currentTextWidth);
|
14105 |
|
14106 | if (!isYAxis) {
|
14107 | currentTickMax.ticks[i] = currentTextWidth;
|
14108 | }
|
14109 | });
|
14110 | dummy.remove();
|
14111 | }
|
14112 | if (maxWidth > 0) {
|
14113 | currentTickMax.size = maxWidth;
|
14114 | }
|
14115 | return currentTickMax.size;
|
14116 | };
|
14117 | _proto.getXAxisTickTextY2Overflow = function getXAxisTickTextY2Overflow(defaultPadding) {
|
14118 | var $$ = this.owner,
|
14119 | axis = $$.axis,
|
14120 | config = $$.config,
|
14121 | state = $$.state,
|
14122 | xAxisTickRotate = $$.getAxisTickRotate("x");
|
14123 | if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
|
14124 | var widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingLeft(),
|
14125 | maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding),
|
14126 | xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
|
14127 |
|
14128 |
|
14129 | return Math.min(xAxisTickTextY2Overflow, widthWithoutCurrentPaddingLeft / 2);
|
14130 | }
|
14131 | return 0;
|
14132 | };
|
14133 | _proto.getXAxisTickMaxOverflow = function getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft) {
|
14134 | var $$ = this.owner,
|
14135 | axis = $$.axis,
|
14136 | config = $$.config,
|
14137 | state = $$.state,
|
14138 | isTimeSeries = axis.isTimeSeries(),
|
14139 | tickTextWidths = state.current.maxTickWidths.x.ticks,
|
14140 | tickCount = tickTextWidths.length,
|
14141 | _state$axis$x$padding = state.axis.x.padding,
|
14142 | left = _state$axis$x$padding.left,
|
14143 | right = _state$axis$x$padding.right,
|
14144 | maxOverflow = 0,
|
14145 | remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0);
|
14146 | for (var i = 0; i < tickCount; i++) {
|
14147 | var tickIndex = i + 1,
|
14148 | rotatedTickTextWidth = Math.cos(Math.PI * xAxisTickRotate / 180) * tickTextWidths[i],
|
14149 | ticksBeforeTickText = tickIndex - (isTimeSeries ? 1 : .5) + left;
|
14150 |
|
14151 | if (ticksBeforeTickText <= 0) {
|
14152 | continue;
|
14153 | }
|
14154 | var xAxisLengthWithoutTickTextWidth = widthWithoutCurrentPaddingLeft - rotatedTickTextWidth,
|
14155 | tickLength = xAxisLengthWithoutTickTextWidth / ticksBeforeTickText,
|
14156 | remainingTicks = remaining - tickIndex,
|
14157 | paddingRightLength = right * tickLength,
|
14158 | remainingTickWidth = remainingTicks * tickLength + paddingRightLength,
|
14159 | overflow = rotatedTickTextWidth - tickLength / 2 - remainingTickWidth;
|
14160 | maxOverflow = Math.max(maxOverflow, overflow);
|
14161 | }
|
14162 | var filteredTargets = $$.filterTargetsToShow($$.data.targets),
|
14163 | tickOffset = 0;
|
14164 | if (!isTimeSeries && config.axis_x_tick_count <= filteredTargets.length && filteredTargets[0].values.length) {
|
14165 | var _scale2 = getScale($$.axis.getAxisType("x"), 0, widthWithoutCurrentPaddingLeft - maxOverflow).domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]);
|
14166 | tickOffset = Math.ceil((_scale2(1) - _scale2(0)) / 2);
|
14167 | }
|
14168 | return maxOverflow + tickOffset;
|
14169 | };
|
14170 | _proto.updateLabels = function updateLabels(withTransition) {
|
14171 | var _this12 = this,
|
14172 | $$ = this.owner,
|
14173 | main = $$.$el.main,
|
14174 | $T = $$.$T,
|
14175 | labels = {
|
14176 | x: main.select("." + $AXIS.axisX + " ." + $AXIS.axisXLabel),
|
14177 | y: main.select("." + $AXIS.axisY + " ." + $AXIS.axisYLabel),
|
14178 | y2: main.select("." + $AXIS.axisY2 + " ." + $AXIS.axisY2Label)
|
14179 | };
|
14180 | Object.keys(labels).filter(function (id) {
|
14181 | _newArrowCheck(this, _this12);
|
14182 | return !labels[id].empty();
|
14183 | }.bind(this)).forEach(function (v) {
|
14184 | var _this13 = this;
|
14185 | _newArrowCheck(this, _this12);
|
14186 | var node = labels[v];
|
14187 |
|
14188 |
|
14189 | $T(node, withTransition).attr("x", function () {
|
14190 | _newArrowCheck(this, _this13);
|
14191 | return this.xForAxisLabel(v);
|
14192 | }.bind(this)).attr("dx", function () {
|
14193 | _newArrowCheck(this, _this13);
|
14194 | return this.dxForAxisLabel(v);
|
14195 | }.bind(this)).attr("dy", function () {
|
14196 | _newArrowCheck(this, _this13);
|
14197 | return this.dyForAxisLabel(v);
|
14198 | }.bind(this)).text(function () {
|
14199 | _newArrowCheck(this, _this13);
|
14200 | return this.getLabelText(v);
|
14201 | }.bind(this));
|
14202 | }.bind(this));
|
14203 | }
|
14204 |
|
14205 | |
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 |
|
14211 |
|
14212 |
|
14213 | ;
|
14214 | _proto.getPadding = function getPadding(padding, key, defaultValue, domainLength) {
|
14215 | var p = isNumber(padding) ? padding : padding[key];
|
14216 | if (!isValue(p)) {
|
14217 | return defaultValue;
|
14218 | }
|
14219 | return this.owner.convertPixelToScale(/(bottom|top)/.test(key) ? "y" : "x", p, domainLength);
|
14220 | };
|
14221 | _proto.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) {
|
14222 | var _this14 = this,
|
14223 | tickValues = values;
|
14224 | if (tickCount) {
|
14225 | var targetCount = isFunction(tickCount) ? tickCount() : tickCount;
|
14226 |
|
14227 |
|
14228 | if (targetCount === 1) {
|
14229 | tickValues = [values[0]];
|
14230 | } else if (targetCount === 2) {
|
14231 | tickValues = [values[0], values[values.length - 1]];
|
14232 | } else if (targetCount > 2) {
|
14233 | var isCategorized = this.isCategorized(),
|
14234 | count = targetCount - 2,
|
14235 | start = values[0],
|
14236 | end = values[values.length - 1],
|
14237 | tickValue;
|
14238 |
|
14239 | tickValues = [start];
|
14240 | for (var i = 0; i < count; i++) {
|
14241 | tickValue = +start + (end - start) / (count + 1) * (i + 1);
|
14242 | tickValues.push(forTimeSeries ? new Date(tickValue) : isCategorized ? Math.round(tickValue) : tickValue);
|
14243 | }
|
14244 | tickValues.push(end);
|
14245 | }
|
14246 | }
|
14247 | if (!forTimeSeries) {
|
14248 | tickValues = tickValues.sort(function (a, b) {
|
14249 | _newArrowCheck(this, _this14);
|
14250 | return a - b;
|
14251 | }.bind(this));
|
14252 | }
|
14253 | return tickValues;
|
14254 | };
|
14255 | _proto.generateTransitions = function generateTransitions(withTransition) {
|
14256 | var _this15 = this,
|
14257 | $$ = this.owner,
|
14258 | axis = $$.$el.axis,
|
14259 | $T = $$.$T,
|
14260 | _map = ["x", "y", "y2", "subX"].map(function (v) {
|
14261 | _newArrowCheck(this, _this15);
|
14262 | return $T(axis[v], withTransition);
|
14263 | }.bind(this)),
|
14264 | axisX = _map[0],
|
14265 | axisY = _map[1],
|
14266 | axisY2 = _map[2],
|
14267 | axisSubX = _map[3];
|
14268 | return {
|
14269 | axisX: axisX,
|
14270 | axisY: axisY,
|
14271 | axisY2: axisY2,
|
14272 | axisSubX: axisSubX
|
14273 | };
|
14274 | };
|
14275 | _proto.redraw = function redraw(transitions, isHidden, isInit) {
|
14276 | var _this16 = this,
|
14277 | $$ = this.owner,
|
14278 | config = $$.config,
|
14279 | $el = $$.$el,
|
14280 | opacity = isHidden ? "0" : null;
|
14281 | ["x", "y", "y2", "subX"].forEach(function (id) {
|
14282 | _newArrowCheck(this, _this16);
|
14283 | var axis = this[id],
|
14284 | $axis = $el.axis[id];
|
14285 | if (axis && $axis) {
|
14286 | if (!isInit && !config.transition_duration) {
|
14287 | axis.config.withoutTransition = !0;
|
14288 | }
|
14289 | $axis.style("opacity", opacity);
|
14290 | axis.create(transitions["axis" + capitalize(id)]);
|
14291 | }
|
14292 | }.bind(this));
|
14293 | this.updateAxes();
|
14294 | }
|
14295 |
|
14296 | |
14297 |
|
14298 |
|
14299 |
|
14300 |
|
14301 |
|
14302 |
|
14303 |
|
14304 | ;
|
14305 | _proto.redrawAxis = function redrawAxis(targetsToShow, wth, transitions, flow, isInit) {
|
14306 | var _this17 = this,
|
14307 | $$ = this.owner,
|
14308 | config = $$.config,
|
14309 | scale = $$.scale,
|
14310 | $el = $$.$el,
|
14311 | hasZoom = !!scale.zoom,
|
14312 | xDomainForZoom;
|
14313 | if (!hasZoom && this.isCategorized() && targetsToShow.length === 0) {
|
14314 | scale.x.domain([0, $el.axis.x.selectAll(".tick").size()]);
|
14315 | }
|
14316 | if (scale.x && targetsToShow.length) {
|
14317 | hasZoom || $$.updateXDomain(targetsToShow, wth.UpdateXDomain, wth.UpdateOrgXDomain, wth.TrimXDomain);
|
14318 | if (!config.axis_x_tick_values) {
|
14319 | this.updateXAxisTickValues(targetsToShow);
|
14320 | }
|
14321 | } else if (this.x) {
|
14322 | var _this$subX2;
|
14323 | this.x.tickValues([]);
|
14324 | (_this$subX2 = this.subX) == null ? void 0 : _this$subX2.tickValues([]);
|
14325 | }
|
14326 | if (config.zoom_rescale && !flow) {
|
14327 | xDomainForZoom = scale.x.orgDomain();
|
14328 | }
|
14329 | ["y", "y2"].forEach(function (key) {
|
14330 | var _this18 = this;
|
14331 | _newArrowCheck(this, _this17);
|
14332 | var prefix = "axis_" + key + "_",
|
14333 | axisScale = scale[key];
|
14334 | if (axisScale) {
|
14335 | var tickValues = config[prefix + "tick_values"],
|
14336 | tickCount = config[prefix + "tick_count"];
|
14337 | axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
14338 | if (!tickValues && tickCount) {
|
14339 | var axis = $$.axis[key],
|
14340 | domain = axisScale.domain();
|
14341 | axis.tickValues(this.generateTickValues(domain, domain.every(function (v) {
|
14342 | _newArrowCheck(this, _this18);
|
14343 | return v === 0;
|
14344 | }.bind(this)) ? 1 : tickCount, this.isTimeSeriesY()));
|
14345 | }
|
14346 | }
|
14347 | }.bind(this));
|
14348 |
|
14349 |
|
14350 | this.redraw(transitions, $$.hasArcType(), isInit);
|
14351 |
|
14352 |
|
14353 | this.updateLabels(wth.Transition);
|
14354 |
|
14355 |
|
14356 | if ((wth.UpdateXDomain || wth.UpdateXAxis || wth.Y) && targetsToShow.length) {
|
14357 | this.setCulling();
|
14358 | }
|
14359 |
|
14360 |
|
14361 | if (wth.Y) {
|
14362 | var _scale$subY, _scale$subY2;
|
14363 | (_scale$subY = scale.subY) == null ? void 0 : _scale$subY.domain($$.getYDomain(targetsToShow, "y"));
|
14364 | (_scale$subY2 = scale.subY2) == null ? void 0 : _scale$subY2.domain($$.getYDomain(targetsToShow, "y2"));
|
14365 | }
|
14366 | }
|
14367 |
|
14368 | |
14369 |
|
14370 |
|
14371 | ;
|
14372 | _proto.setCulling = function setCulling() {
|
14373 | var _this19 = this,
|
14374 | $$ = this.owner,
|
14375 | config = $$.config,
|
14376 | _$$$state2 = $$.state,
|
14377 | clip = _$$$state2.clip,
|
14378 | current = _$$$state2.current,
|
14379 | $el = $$.$el;
|
14380 | ["subX", "x", "y", "y2"].forEach(function (type) {
|
14381 | _newArrowCheck(this, _this19);
|
14382 | var axis = $el.axis[type],
|
14383 | id = type === "subX" ? "x" : type,
|
14384 | cullingOptionPrefix = "axis_" + id + "_tick_culling",
|
14385 | toCull = config[cullingOptionPrefix];
|
14386 | if (axis && toCull) {
|
14387 | var tickNodes = axis.selectAll(".tick"),
|
14388 | tickValues = sortValue(tickNodes.data()),
|
14389 | tickSize = tickValues.length,
|
14390 | cullingMax = config[cullingOptionPrefix + "_max"],
|
14391 | lines = config[cullingOptionPrefix + "_lines"],
|
14392 | intervalForCulling;
|
14393 | if (tickSize) {
|
14394 | for (var i = 1; i < tickSize; i++) {
|
14395 | if (tickSize / i < cullingMax) {
|
14396 | intervalForCulling = i;
|
14397 | break;
|
14398 | }
|
14399 | }
|
14400 | tickNodes.each(function (d) {
|
14401 | var node = lines ? this.querySelector("text") : this;
|
14402 | if (node) {
|
14403 | node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
|
14404 | }
|
14405 | });
|
14406 | } else {
|
14407 | tickNodes.style("display", null);
|
14408 | }
|
14409 |
|
14410 |
|
14411 | if (type === "x") {
|
14412 | var clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null;
|
14413 | $el.svg.selectAll("." + $AXIS.axisX + " .tick text").attr("clip-path", clipPath);
|
14414 | }
|
14415 | }
|
14416 | }.bind(this));
|
14417 | };
|
14418 | return Axis;
|
14419 | }();
|
14420 | ;
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 |
|
14426 |
|
14427 |
|
14428 | var eventrect = ({
|
14429 | |
14430 |
|
14431 |
|
14432 |
|
14433 |
|
14434 | initEventRect: function initEventRect() {
|
14435 | var $$ = this;
|
14436 | $$.$el.main.select("." + $COMMON.chart).append("g").attr("class", $EVENT.eventRects).style("fill-opacity", "0");
|
14437 | },
|
14438 | |
14439 |
|
14440 |
|
14441 |
|
14442 | redrawEventRect: function redrawEventRect() {
|
14443 | var $$ = this,
|
14444 | config = $$.config,
|
14445 | state = $$.state,
|
14446 | $el = $$.$el,
|
14447 | isMultipleX = $$.isMultipleX();
|
14448 | if ($el.eventRect) {
|
14449 | $$.updateEventRect($el.eventRect, !0);
|
14450 | } else {
|
14451 | var eventRects = $$.$el.main.select("." + $EVENT.eventRects).style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? config.axis_rotated ? "ns-resize" : "ew-resize" : null).classed($EVENT.eventRectsMultiple, isMultipleX).classed($EVENT.eventRectsSingle, !isMultipleX),
|
14452 | eventRectUpdate = eventRects.selectAll("." + $EVENT.eventRect).data([0]).enter().append("rect");
|
14453 | $$.updateEventRect(eventRectUpdate);
|
14454 |
|
14455 |
|
14456 | isMultipleX ? $$.generateEventRectsForMultipleXs(eventRectUpdate) : $$.generateEventRectsForSingleX(eventRectUpdate);
|
14457 |
|
14458 |
|
14459 | eventRectUpdate.call($$.getDraggableSelection());
|
14460 | $el.eventRect = eventRectUpdate;
|
14461 | if ($$.state.inputType === "touch" && !$el.svg.on("touchstart.eventRect") && !$$.hasArcType()) {
|
14462 | $$.bindTouchOnEventRect(isMultipleX);
|
14463 | }
|
14464 | }
|
14465 | if (!isMultipleX) {
|
14466 |
|
14467 | var xAxisTickValues = $$.getMaxDataCountTarget();
|
14468 |
|
14469 |
|
14470 | $$.updateDataIndexByX(xAxisTickValues);
|
14471 | $$.updateXs(xAxisTickValues);
|
14472 | $$.updatePointClass == null ? void 0 : $$.updatePointClass(!0);
|
14473 | state.eventReceiver.data = xAxisTickValues;
|
14474 | }
|
14475 | $$.updateEventRectData();
|
14476 | },
|
14477 | bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) {
|
14478 | var _this = this,
|
14479 | $$ = this,
|
14480 | config = $$.config,
|
14481 | state = $$.state,
|
14482 | _$$$$el = $$.$el,
|
14483 | eventRect = _$$$$el.eventRect,
|
14484 | svg = _$$$$el.svg,
|
14485 | selectRect = function (context) {
|
14486 | _newArrowCheck(this, _this);
|
14487 | if (isMultipleX) {
|
14488 | $$.selectRectForMultipleXs(context);
|
14489 | } else {
|
14490 | var index = $$.getDataIndexFromEvent(state.event);
|
14491 | $$.callOverOutForTouch(index);
|
14492 | index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index);
|
14493 | }
|
14494 | }.bind(this),
|
14495 | unselectRect = function () {
|
14496 | _newArrowCheck(this, _this);
|
14497 | $$.unselectRect();
|
14498 | $$.callOverOutForTouch();
|
14499 | }.bind(this),
|
14500 | preventDefault = config.interaction_inputType_touch.preventDefault,
|
14501 | isPrevented = isboolean(preventDefault) && preventDefault || !1,
|
14502 | preventThreshold = !isNaN(preventDefault) && preventDefault || null,
|
14503 | startPx,
|
14504 | preventEvent = function (event) {
|
14505 | _newArrowCheck(this, _this);
|
14506 | var eventType = event.type,
|
14507 | touch = event.changedTouches[0],
|
14508 | currentXY = touch["client" + (config.axis_rotated ? "Y" : "X")];
|
14509 |
|
14510 | if (eventType === "touchstart") {
|
14511 | if (isPrevented) {
|
14512 | event.preventDefault();
|
14513 | } else if (preventThreshold !== null) {
|
14514 | startPx = currentXY;
|
14515 | }
|
14516 | } else if (eventType === "touchmove") {
|
14517 | if (isPrevented || startPx === !0 || preventThreshold !== null && Math.abs(startPx - currentXY) >= preventThreshold) {
|
14518 |
|
14519 | startPx = !0;
|
14520 | event.preventDefault();
|
14521 | }
|
14522 | }
|
14523 | }.bind(this);
|
14524 |
|
14525 | eventRect.on("touchstart", function (event) {
|
14526 | _newArrowCheck(this, _this);
|
14527 | state.event = event;
|
14528 | $$.updateEventRect();
|
14529 | }.bind(this)).on("touchstart.eventRect touchmove.eventRect", function (event) {
|
14530 | _newArrowCheck(this, _this);
|
14531 | state.event = event;
|
14532 | if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
14533 |
|
14534 | if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
|
14535 | return;
|
14536 | }
|
14537 | preventEvent(event);
|
14538 | selectRect(eventRect.node());
|
14539 | } else {
|
14540 | unselectRect();
|
14541 | }
|
14542 | }.bind(this), !0).on("touchend.eventRect", function (event) {
|
14543 | _newArrowCheck(this, _this);
|
14544 | state.event = event;
|
14545 | if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
14546 | if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
|
14547 | state.cancelClick && (state.cancelClick = !1);
|
14548 | }
|
14549 | }
|
14550 | }.bind(this), !0);
|
14551 | svg.on("touchstart", function (event) {
|
14552 | _newArrowCheck(this, _this);
|
14553 | state.event = event;
|
14554 | var target = event.target;
|
14555 | if (target && target !== eventRect.node()) {
|
14556 | unselectRect();
|
14557 | }
|
14558 | }.bind(this));
|
14559 | },
|
14560 | |
14561 |
|
14562 |
|
14563 |
|
14564 |
|
14565 |
|
14566 | updateEventRect: function updateEventRect(eventRect, force) {
|
14567 | var _this2 = this;
|
14568 | if (force === void 0) {
|
14569 | force = !1;
|
14570 | }
|
14571 | var $$ = this,
|
14572 | state = $$.state,
|
14573 | $el = $$.$el,
|
14574 | _state = state,
|
14575 | eventReceiver = _state.eventReceiver,
|
14576 | width = _state.width,
|
14577 | height = _state.height,
|
14578 | rendered = _state.rendered,
|
14579 | resizing = _state.resizing,
|
14580 | rectElement = eventRect || $el.eventRect,
|
14581 | updateClientRect = function () {
|
14582 | _newArrowCheck(this, _this2);
|
14583 | eventReceiver && (eventReceiver.rect = rectElement.node().getBoundingClientRect());
|
14584 | }.bind(this);
|
14585 | if (!rendered || resizing || force) {
|
14586 | rectElement.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
|
14587 |
|
14588 |
|
14589 | if (!rendered) {
|
14590 | rectElement.attr("class", $EVENT.eventRect);
|
14591 | }
|
14592 | }
|
14593 | updateClientRect();
|
14594 | },
|
14595 | |
14596 |
|
14597 |
|
14598 |
|
14599 | updateEventRectData: function updateEventRectData() {
|
14600 | var _this3 = this,
|
14601 | $$ = this,
|
14602 | config = $$.config,
|
14603 | scale = $$.scale,
|
14604 | state = $$.state,
|
14605 | xScale = scale.zoom || scale.x,
|
14606 | isRotated = config.axis_rotated,
|
14607 | x,
|
14608 | y,
|
14609 | w,
|
14610 | h;
|
14611 | if ($$.isMultipleX()) {
|
14612 |
|
14613 | x = 0;
|
14614 | y = 0;
|
14615 | w = state.width;
|
14616 | h = state.height;
|
14617 | } else {
|
14618 | var rectW, rectX;
|
14619 | if ($$.axis.isCategorized()) {
|
14620 | rectW = $$.getEventRectWidth();
|
14621 | rectX = function (d) {
|
14622 | _newArrowCheck(this, _this3);
|
14623 | return xScale(d.x) - rectW / 2;
|
14624 | }.bind(this);
|
14625 | } else {
|
14626 | var getPrevNextX = function (_ref) {
|
14627 | var index = _ref.index;
|
14628 | _newArrowCheck(this, _this3);
|
14629 | return {
|
14630 | prev: $$.getPrevX(index),
|
14631 | next: $$.getNextX(index)
|
14632 | };
|
14633 | }.bind(this);
|
14634 | rectW = function (d) {
|
14635 | var _this4 = this;
|
14636 | _newArrowCheck(this, _this3);
|
14637 | var x = getPrevNextX(d),
|
14638 | xDomain = xScale.domain(),
|
14639 | val;
|
14640 |
|
14641 | if (x.prev === null && x.next === null) {
|
14642 | val = isRotated ? state.height : state.width;
|
14643 | } else if (x.prev === null) {
|
14644 | val = (xScale(x.next) + xScale(d.x)) / 2;
|
14645 | } else if (x.next === null) {
|
14646 | val = xScale(xDomain[1]) - (xScale(x.prev) + xScale(d.x)) / 2;
|
14647 | } else {
|
14648 | Object.keys(x).forEach(function (key, i) {
|
14649 | var _x$key;
|
14650 | _newArrowCheck(this, _this4);
|
14651 | x[key] = (_x$key = x[key]) != null ? _x$key : xDomain[i];
|
14652 | }.bind(this));
|
14653 | val = Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2);
|
14654 | }
|
14655 | return val;
|
14656 | }.bind(this);
|
14657 | rectX = function (d) {
|
14658 | _newArrowCheck(this, _this3);
|
14659 | var x = getPrevNextX(d),
|
14660 | val;
|
14661 |
|
14662 | if (x.prev === null && x.next === null) {
|
14663 | val = 0;
|
14664 | } else if (x.prev === null) {
|
14665 | val = xScale(xScale.domain()[0]);
|
14666 | } else {
|
14667 | val = (xScale(d.x) + xScale(x.prev)) / 2;
|
14668 | }
|
14669 | return val;
|
14670 | }.bind(this);
|
14671 | }
|
14672 | x = isRotated ? 0 : rectX;
|
14673 | y = isRotated ? rectX : 0;
|
14674 | w = isRotated ? state.width : rectW;
|
14675 | h = isRotated ? rectW : state.height;
|
14676 | }
|
14677 | var eventReceiver = state.eventReceiver,
|
14678 | call = function (fn, v) {
|
14679 | _newArrowCheck(this, _this3);
|
14680 | return isFunction(fn) ? fn(v) : fn;
|
14681 | }.bind(this);
|
14682 |
|
14683 | eventReceiver.coords.splice(eventReceiver.data.length);
|
14684 | eventReceiver.data.forEach(function (d, i) {
|
14685 | _newArrowCheck(this, _this3);
|
14686 | eventReceiver.coords[i] = {
|
14687 | x: call(x, d),
|
14688 | y: call(y, d),
|
14689 | w: call(w, d),
|
14690 | h: call(h, d)
|
14691 | };
|
14692 | }.bind(this));
|
14693 | },
|
14694 | selectRectForMultipleXs: function selectRectForMultipleXs(context) {
|
14695 | var _this5 = this,
|
14696 | $$ = this,
|
14697 | config = $$.config,
|
14698 | state = $$.state,
|
14699 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
14700 |
|
14701 | if (state.dragging || $$.hasArcType(targetsToShow)) {
|
14702 | return;
|
14703 | }
|
14704 | var mouse = getPointer(state.event, context),
|
14705 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
14706 | if (state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
|
14707 | config.data_onout.call($$.api, state.mouseover);
|
14708 | state.mouseover = undefined;
|
14709 | }
|
14710 | if (!closest) {
|
14711 | $$.unselectRect();
|
14712 | return;
|
14713 | }
|
14714 | var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x),
|
14715 | selectedData = sameXData.map(function (d) {
|
14716 | _newArrowCheck(this, _this5);
|
14717 | return $$.addName(d);
|
14718 | }.bind(this));
|
14719 | $$.showTooltip(selectedData, context);
|
14720 |
|
14721 |
|
14722 | $$.setExpand(closest.index, closest.id, !0);
|
14723 |
|
14724 |
|
14725 | $$.showGridFocus(selectedData);
|
14726 |
|
14727 |
|
14728 | if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
14729 | $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", "pointer");
|
14730 | if (!state.mouseover) {
|
14731 | config.data_onover.call($$.api, closest);
|
14732 | state.mouseover = closest;
|
14733 | }
|
14734 | }
|
14735 | },
|
14736 | |
14737 |
|
14738 |
|
14739 |
|
14740 | unselectRect: function unselectRect() {
|
14741 | var $$ = this,
|
14742 | config = $$.config,
|
14743 | _$$$$el2 = $$.$el,
|
14744 | circle = _$$$$el2.circle,
|
14745 | tooltip = _$$$$el2.tooltip;
|
14746 | $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", null);
|
14747 | $$.hideGridFocus();
|
14748 | if (tooltip) {
|
14749 | $$.hideTooltip();
|
14750 | $$._handleLinkedCharts(!1);
|
14751 | }
|
14752 | circle && !config.point_focus_only && $$.unexpandCircles();
|
14753 | $$.expandBarTypeShapes(!1);
|
14754 | },
|
14755 | |
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 | generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) {
|
14763 | var _this6 = this,
|
14764 | $$ = this,
|
14765 | config = $$.config,
|
14766 | state = $$.state,
|
14767 | eventReceiver = state.eventReceiver,
|
14768 | rect = eventRectEnter.style("cursor", config.data_selection_enabled && config.data_selection_grouped ? "pointer" : null).on("click", function (event) {
|
14769 | state.event = event;
|
14770 | var currentIdx = eventReceiver.currentIdx,
|
14771 | data = eventReceiver.data,
|
14772 | d = data[currentIdx === -1 ? $$.getDataIndexFromEvent(event) : currentIdx];
|
14773 | $$.clickHandlerForSingleX.bind(this)(d, $$);
|
14774 | });
|
14775 | if (state.inputType === "mouse") {
|
14776 | var getData = function (event) {
|
14777 | _newArrowCheck(this, _this6);
|
14778 | var index = event ? $$.getDataIndexFromEvent(event) : eventReceiver.currentIdx;
|
14779 | return index > -1 ? eventReceiver.data[index] : null;
|
14780 | }.bind(this);
|
14781 | rect.on("mouseover", function (event) {
|
14782 | _newArrowCheck(this, _this6);
|
14783 | state.event = event;
|
14784 | $$.updateEventRect();
|
14785 | }.bind(this)).on("mousemove", function (event) {
|
14786 | var d = getData(event);
|
14787 | state.event = event;
|
14788 | if (!d) {
|
14789 | return;
|
14790 | }
|
14791 | var index = d.index,
|
14792 | stepType = config.line_step_type;
|
14793 |
|
14794 | if (config.line_step_tooltipMatch && $$.hasType("step") && /^step\-(before|after)$/.test(stepType)) {
|
14795 | var scale = $$.scale.zoom || $$.scale.x,
|
14796 | xs = $$.axis.xs[index],
|
14797 | inverted = scale.invert(getPointer(event, this)[0]);
|
14798 | if (stepType === "step-after" && inverted < xs) {
|
14799 | index -= 1;
|
14800 | } else if (stepType === "step-before" && inverted > xs) {
|
14801 | index += 1;
|
14802 | }
|
14803 | }
|
14804 |
|
14805 |
|
14806 | if (state.dragging || state.flowing || $$.hasArcType() || config.tooltip_grouped && index === eventReceiver.currentIdx) {
|
14807 | return;
|
14808 | }
|
14809 | if (index !== eventReceiver.currentIdx) {
|
14810 | $$.setOverOut(!1, eventReceiver.currentIdx);
|
14811 | eventReceiver.currentIdx = index;
|
14812 | }
|
14813 | index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, rect, index);
|
14814 |
|
14815 |
|
14816 |
|
14817 | $$.setOverOut(index !== -1, index);
|
14818 | }).on("mouseout", function (event) {
|
14819 | _newArrowCheck(this, _this6);
|
14820 | state.event = event;
|
14821 |
|
14822 |
|
14823 | if (!config || $$.hasArcType() || eventReceiver.currentIdx === -1) {
|
14824 | return;
|
14825 | }
|
14826 | $$.unselectRect();
|
14827 | $$.setOverOut(!1, eventReceiver.currentIdx);
|
14828 |
|
14829 |
|
14830 | eventReceiver.currentIdx = -1;
|
14831 | }.bind(this));
|
14832 | }
|
14833 | return rect;
|
14834 | },
|
14835 | clickHandlerForSingleX: function clickHandlerForSingleX(d, ctx) {
|
14836 | var $$ = ctx,
|
14837 | config = $$.config,
|
14838 | state = $$.state,
|
14839 | main = $$.$el.main;
|
14840 | if (!d || $$.hasArcType() || state.cancelClick) {
|
14841 | state.cancelClick && (state.cancelClick = !1);
|
14842 | return;
|
14843 | }
|
14844 | var index = d.index;
|
14845 | main.selectAll("." + $SHAPE.shape + "-" + index).each(function (d2) {
|
14846 | if (config.data_selection_grouped || $$.isWithinShape(this, d2)) {
|
14847 | $$.toggleShape == null ? void 0 : $$.toggleShape(this, d2, index);
|
14848 | config.data_onclick.bind($$.api)(d2, this);
|
14849 | }
|
14850 | });
|
14851 | },
|
14852 | |
14853 |
|
14854 |
|
14855 |
|
14856 |
|
14857 |
|
14858 | generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) {
|
14859 | var _this7 = this,
|
14860 | $$ = this,
|
14861 | state = $$.state;
|
14862 | eventRectEnter.on("click", function (event) {
|
14863 | state.event = event;
|
14864 | $$.clickHandlerForMultipleXS.bind(this)($$);
|
14865 | });
|
14866 | if (state.inputType === "mouse") {
|
14867 | eventRectEnter.on("mouseover mousemove", function (event) {
|
14868 | state.event = event;
|
14869 | $$.selectRectForMultipleXs(this);
|
14870 | }).on("mouseout", function (event) {
|
14871 | _newArrowCheck(this, _this7);
|
14872 | state.event = event;
|
14873 |
|
14874 |
|
14875 | if (!$$.config || $$.hasArcType()) {
|
14876 | return;
|
14877 | }
|
14878 | $$.unselectRect();
|
14879 | }.bind(this));
|
14880 | }
|
14881 | },
|
14882 | clickHandlerForMultipleXS: function clickHandlerForMultipleXS(ctx) {
|
14883 | var $$ = ctx,
|
14884 | config = $$.config,
|
14885 | state = $$.state,
|
14886 | targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
14887 | if ($$.hasArcType(targetsToShow)) {
|
14888 | return;
|
14889 | }
|
14890 | var mouse = getPointer(state.event, this),
|
14891 | closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
14892 | if (!closest) {
|
14893 | return;
|
14894 | }
|
14895 |
|
14896 |
|
14897 | if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
14898 | $$.$el.main.selectAll("." + $SHAPE.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll("." + $SHAPE.shape + "-" + closest.index).each(function () {
|
14899 | if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
|
14900 | $$.toggleShape == null ? void 0 : $$.toggleShape(this, closest, closest.index);
|
14901 | config.data_onclick.bind($$.api)(closest, this);
|
14902 | }
|
14903 | });
|
14904 | }
|
14905 | }
|
14906 | });
|
14907 |
|
14908 | var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack_require__(11);
|
14909 | ;
|
14910 |
|
14911 |
|
14912 |
|
14913 |
|
14914 |
|
14915 |
|
14916 |
|
14917 |
|
14918 |
|
14919 | var interactions_flow = ({
|
14920 | |
14921 |
|
14922 |
|
14923 |
|
14924 |
|
14925 |
|
14926 | generateFlow: function generateFlow(args) {
|
14927 | var $$ = this,
|
14928 | data = $$.data,
|
14929 | state = $$.state,
|
14930 | $el = $$.$el;
|
14931 | return function () {
|
14932 | var _this = this,
|
14933 | flowLength = args.flow.length;
|
14934 |
|
14935 | state.flowing = !0;
|
14936 |
|
14937 |
|
14938 | data.targets.forEach(function (d) {
|
14939 | _newArrowCheck(this, _this);
|
14940 | d.values.splice(0, flowLength);
|
14941 | }.bind(this));
|
14942 |
|
14943 |
|
14944 | if ($$.updateXGrid) {
|
14945 | $$.updateXGrid(!0);
|
14946 | }
|
14947 |
|
14948 |
|
14949 | var elements = {};
|
14950 | ["axis.x", "grid.x", "gridLines.x", "region.list", "text", "bar", "line", "area", "circle"].forEach(function (v) {
|
14951 | var _node;
|
14952 | _newArrowCheck(this, _this);
|
14953 | var name = v.split("."),
|
14954 | node = $el[name[0]];
|
14955 | if (node && name.length > 1) {
|
14956 | node = node[name[1]];
|
14957 | }
|
14958 | if ((_node = node) != null && _node.size()) {
|
14959 | elements[v] = node;
|
14960 | }
|
14961 | }.bind(this));
|
14962 | $$.hideGridFocus();
|
14963 | $$.setFlowList(elements, args);
|
14964 | };
|
14965 | },
|
14966 | |
14967 |
|
14968 |
|
14969 |
|
14970 |
|
14971 |
|
14972 | setFlowList: function setFlowList(elements, args) {
|
14973 | var _this2 = this,
|
14974 | $$ = this,
|
14975 | flow = args.flow,
|
14976 | targets = args.targets,
|
14977 | _flow = flow,
|
14978 | _flow$duration = _flow.duration,
|
14979 | duration = _flow$duration === void 0 ? args.duration : _flow$duration,
|
14980 | flowIndex = _flow.index,
|
14981 | flowLength = _flow.length,
|
14982 | orgDataCount = _flow.orgDataCount,
|
14983 | transform = $$.getFlowTransform(targets, orgDataCount, flowIndex, flowLength),
|
14984 | wait = generateWait(),
|
14985 | n;
|
14986 | wait.add(Object.keys(elements).map(function (v) {
|
14987 | var _this3 = this;
|
14988 | _newArrowCheck(this, _this2);
|
14989 | n = elements[v].transition().ease(external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_.easeLinear).duration(duration);
|
14990 | if (v === "axis.x") {
|
14991 | n = n.call(function (g) {
|
14992 | _newArrowCheck(this, _this3);
|
14993 | $$.axis.x.setTransition(g).create(g);
|
14994 | }.bind(this));
|
14995 | } else if (v === "region.list") {
|
14996 | n = n.filter($$.isRegionOnX).attr("transform", transform);
|
14997 | } else {
|
14998 | n = n.attr("transform", transform);
|
14999 | }
|
15000 | return n;
|
15001 | }.bind(this)));
|
15002 | n.call(wait, function () {
|
15003 | _newArrowCheck(this, _this2);
|
15004 | $$.cleanUpFlow(elements, args);
|
15005 | }.bind(this));
|
15006 | },
|
15007 | |
15008 |
|
15009 |
|
15010 |
|
15011 |
|
15012 |
|
15013 | cleanUpFlow: function cleanUpFlow(elements, args) {
|
15014 | var _this4 = this,
|
15015 | $$ = this,
|
15016 | config = $$.config,
|
15017 | state = $$.state,
|
15018 | svg = $$.$el.svg,
|
15019 | isRotated = config.axis_rotated,
|
15020 | flow = args.flow,
|
15021 | shape = args.shape,
|
15022 | xv = args.xv,
|
15023 | _shape$pos = shape.pos,
|
15024 | cx = _shape$pos.cx,
|
15025 | cy = _shape$pos.cy,
|
15026 | xForText = _shape$pos.xForText,
|
15027 | yForText = _shape$pos.yForText,
|
15028 | _flow2 = flow,
|
15029 | _flow2$done = _flow2.done,
|
15030 | done = _flow2$done === void 0 ? function () {
|
15031 | _newArrowCheck(this, _this4);
|
15032 | }.bind(this) : _flow2$done,
|
15033 | flowLength = _flow2.length;
|
15034 |
|
15035 | if (flowLength) {
|
15036 | ["circle", "text", "shape", "eventRect"].forEach(function (v) {
|
15037 | _newArrowCheck(this, _this4);
|
15038 | var target = [];
|
15039 | for (var i = 0; i < flowLength; i++) {
|
15040 | target.push("." + classes[v] + "-" + i);
|
15041 | }
|
15042 | svg.selectAll("." + classes[v + "s"])
|
15043 | .selectAll(target).remove();
|
15044 | }.bind(this));
|
15045 | svg.select("." + classes.xgrid).remove();
|
15046 | }
|
15047 |
|
15048 |
|
15049 | Object.keys(elements).forEach(function (v) {
|
15050 | var _this5 = this;
|
15051 | _newArrowCheck(this, _this4);
|
15052 | var n = elements[v];
|
15053 | if (v !== "axis.x") {
|
15054 | n.attr("transform", null);
|
15055 | }
|
15056 | if (v === "grid.x") {
|
15057 | n.attr(state.xgridAttr);
|
15058 | } else if (v === "gridLines.x") {
|
15059 | n.attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? state.width : xv);
|
15060 | } else if (v === "gridLines.x") {
|
15061 | n.select("line").attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? state.width : xv);
|
15062 | n.select("text").attr("x", isRotated ? state.width : 0).attr("y", xv);
|
15063 | } else if (/^(area|bar|line)$/.test(v)) {
|
15064 | n.attr("d", shape.type[v]);
|
15065 | } else if (v === "text") {
|
15066 | n.attr("x", xForText).attr("y", yForText).style("fill-opacity", $$.opacityForText.bind($$));
|
15067 | } else if (v === "circle") {
|
15068 | if ($$.isCirclePoint()) {
|
15069 | n.attr("cx", cx).attr("cy", cy);
|
15070 | } else {
|
15071 | var xFunc = function (d) {
|
15072 | _newArrowCheck(this, _this5);
|
15073 | return cx(d) - config.point_r;
|
15074 | }.bind(this),
|
15075 | yFunc = function (d) {
|
15076 | _newArrowCheck(this, _this5);
|
15077 | return cy(d) - config.point_r;
|
15078 | }.bind(this);
|
15079 | n.attr("x", xFunc).attr("y", yFunc).attr("cx", cx)
|
15080 | .attr("cy", cy);
|
15081 | }
|
15082 | } else if (v === "region.list") {
|
15083 | n.select("rect").filter($$.isRegionOnX).attr("x", $$.regionX.bind($$)).attr("width", $$.regionWidth.bind($$));
|
15084 | }
|
15085 | }.bind(this));
|
15086 | config.interaction_enabled && $$.redrawEventRect();
|
15087 |
|
15088 |
|
15089 | done.call($$.api);
|
15090 | state.flowing = !1;
|
15091 | },
|
15092 | |
15093 |
|
15094 |
|
15095 |
|
15096 |
|
15097 |
|
15098 |
|
15099 |
|
15100 |
|
15101 | getFlowTransform: function getFlowTransform(targets, orgDataCount, flowIndex, flowLength) {
|
15102 | var _flowStart,
|
15103 | _flowEnd,
|
15104 | $$ = this,
|
15105 | data = $$.data,
|
15106 | x = $$.scale.x,
|
15107 | dataValues = data.targets[0].values,
|
15108 | flowStart = $$.getValueOnIndex(dataValues, flowIndex),
|
15109 | flowEnd = $$.getValueOnIndex(dataValues, flowIndex + flowLength),
|
15110 | translateX,
|
15111 | orgDomain = x.domain(),
|
15112 | domain = $$.updateXDomain(targets, !0, !0);
|
15113 |
|
15114 | if (!orgDataCount) {
|
15115 |
|
15116 | if (dataValues.length !== 1) {
|
15117 | translateX = x(orgDomain[0]) - x(domain[0]);
|
15118 | } else {
|
15119 | if ($$.axis.isTimeSeries()) {
|
15120 | flowStart = $$.getValueOnIndex(dataValues, 0);
|
15121 | flowEnd = $$.getValueOnIndex(dataValues, dataValues.length - 1);
|
15122 | translateX = x(flowStart.x) - x(flowEnd.x);
|
15123 | } else {
|
15124 | translateX = diffDomain(domain) / 2;
|
15125 | }
|
15126 | }
|
15127 | } else if (orgDataCount === 1 || ((_flowStart = flowStart) == null ? void 0 : _flowStart.x) === ((_flowEnd = flowEnd) == null ? void 0 : _flowEnd.x)) {
|
15128 | translateX = x(orgDomain[0]) - x(domain[0]);
|
15129 | } else {
|
15130 | var _flowStart2;
|
15131 | translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(((_flowStart2 = flowStart) == null ? void 0 : _flowStart2.x) || 0) - x(flowEnd.x);
|
15132 | }
|
15133 | var scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
15134 | return "translate(" + translateX + ",0) scale(" + scaleX + ",1)";
|
15135 | }
|
15136 | });
|
15137 | ;
|
15138 |
|
15139 |
|
15140 |
|
15141 |
|
15142 |
|
15143 | var clip = ({
|
15144 | initClip: function initClip() {
|
15145 | var $$ = this,
|
15146 | clip = $$.state.clip;
|
15147 |
|
15148 | clip.id = $$.state.datetimeId + "-clip";
|
15149 | clip.idXAxis = clip.id + "-xaxis";
|
15150 | clip.idYAxis = clip.id + "-yaxis";
|
15151 | clip.idGrid = clip.id + "-grid";
|
15152 |
|
15153 |
|
15154 | clip.path = $$.getClipPath(clip.id);
|
15155 | clip.pathXAxis = $$.getClipPath(clip.idXAxis);
|
15156 | clip.pathYAxis = $$.getClipPath(clip.idYAxis);
|
15157 | clip.pathGrid = $$.getClipPath(clip.idGrid);
|
15158 | },
|
15159 | getClipPath: function getClipPath(id) {
|
15160 | var $$ = this,
|
15161 | config = $$.config;
|
15162 | if (!config.clipPath && /-clip$/.test(id) || !config.axis_x_clipPath && /-clip-xaxis$/.test(id) || !config.axis_y_clipPath && /-clip-yaxis$/.test(id)) {
|
15163 | return null;
|
15164 | }
|
15165 | var isIE9 = win.navigator ? win.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0 : !1;
|
15166 | return "url(" + (isIE9 ? "" : browser_doc.URL.split("#")[0]) + "#" + id + ")";
|
15167 | },
|
15168 | appendClip: function appendClip(parent, id) {
|
15169 | id && parent.append("clipPath").attr("id", id).append("rect");
|
15170 | },
|
15171 | |
15172 |
|
15173 |
|
15174 |
|
15175 |
|
15176 | setXAxisClipPath: function setXAxisClipPath(node) {
|
15177 | var $$ = this,
|
15178 | config = $$.config,
|
15179 | _$$$state = $$.state,
|
15180 | margin = _$$$state.margin,
|
15181 | width = _$$$state.width,
|
15182 | height = _$$$state.height,
|
15183 | isRotated = config.axis_rotated,
|
15184 | left = Math.max(30, margin.left) - (isRotated ? 0 : 20),
|
15185 | x = isRotated ? -(1 + left) : -(left - 1),
|
15186 | y = -Math.max(15, margin.top),
|
15187 | w = isRotated ? margin.left + 20 : width + 10 + left,
|
15188 | h = (isRotated ? margin.top + height + 10 : margin.bottom) + 20;
|
15189 | node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
15190 | },
|
15191 | |
15192 |
|
15193 |
|
15194 |
|
15195 |
|
15196 | setYAxisClipPath: function setYAxisClipPath(node) {
|
15197 | var $$ = this,
|
15198 | config = $$.config,
|
15199 | _$$$state2 = $$.state,
|
15200 | margin = _$$$state2.margin,
|
15201 | width = _$$$state2.width,
|
15202 | height = _$$$state2.height,
|
15203 | isRotated = config.axis_rotated,
|
15204 | left = Math.max(30, margin.left) - (isRotated ? 20 : 0),
|
15205 | isInner = config.axis_y_inner,
|
15206 | x = isInner ? -1 : isRotated ? -(1 + left) : -(left - 1),
|
15207 | y = -(isRotated ? 20 : margin.top),
|
15208 | w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0),
|
15209 | h = (isRotated ? margin.bottom : margin.top + height) + 10;
|
15210 | node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
15211 | },
|
15212 | updateXAxisTickClip: function updateXAxisTickClip() {
|
15213 | var $$ = this,
|
15214 | config = $$.config,
|
15215 | _$$$state3 = $$.state,
|
15216 | clip = _$$$state3.clip,
|
15217 | xAxisHeight = _$$$state3.xAxisHeight,
|
15218 | defs = $$.$el.defs,
|
15219 | newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
15220 | if (defs && !clip.idXAxisTickTexts) {
|
15221 | var clipId = clip.id + "-xaxisticktexts";
|
15222 | $$.appendClip(defs, clipId);
|
15223 | clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
15224 | clip.idXAxisTickTexts = clipId;
|
15225 | }
|
15226 | if (!config.axis_x_tick_multiline && $$.getAxisTickRotate("x") && newXAxisHeight !== xAxisHeight) {
|
15227 | $$.setXAxisTickClipWidth();
|
15228 | $$.setXAxisTickTextClipPathWidth();
|
15229 | }
|
15230 | $$.state.xAxisHeight = newXAxisHeight;
|
15231 | },
|
15232 | setXAxisTickClipWidth: function setXAxisTickClipWidth() {
|
15233 | var $$ = this,
|
15234 | config = $$.config,
|
15235 | maxTickWidths = $$.state.current.maxTickWidths,
|
15236 | xAxisTickRotate = $$.getAxisTickRotate("x");
|
15237 | if (!config.axis_x_tick_multiline && xAxisTickRotate) {
|
15238 | var sinRotation = Math.sin(Math.PI / 180 * Math.abs(xAxisTickRotate));
|
15239 | maxTickWidths.x.clipPath = ($$.getHorizontalAxisHeight("x") - 20) / sinRotation;
|
15240 | } else {
|
15241 | maxTickWidths.x.clipPath = null;
|
15242 | }
|
15243 | },
|
15244 | setXAxisTickTextClipPathWidth: function setXAxisTickTextClipPathWidth() {
|
15245 | var $$ = this,
|
15246 | _$$$state4 = $$.state,
|
15247 | clip = _$$$state4.clip,
|
15248 | current = _$$$state4.current,
|
15249 | svg = $$.$el.svg;
|
15250 | if (svg) {
|
15251 | svg.select("#" + clip.idXAxisTickTexts + " rect").attr("width", current.maxTickWidths.x.clipPath).attr("height", 30);
|
15252 | }
|
15253 | }
|
15254 | });
|
15255 | ;
|
15256 |
|
15257 | var grid_this = undefined;
|
15258 |
|
15259 |
|
15260 |
|
15261 |
|
15262 |
|
15263 |
|
15264 |
|
15265 |
|
15266 |
|
15267 | var getGridTextAnchor = function (d) {
|
15268 | _newArrowCheck(this, grid_this);
|
15269 | return isValue(d.position) || "end";
|
15270 | }.bind(undefined),
|
15271 | getGridTextDx = function (d) {
|
15272 | _newArrowCheck(this, grid_this);
|
15273 | return d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
15274 | }.bind(undefined);
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 |
|
15282 |
|
15283 | function getGridTextX(isX, width, height) {
|
15284 | var _this2 = this;
|
15285 | return function (d) {
|
15286 | _newArrowCheck(this, _this2);
|
15287 | var x = isX ? 0 : width;
|
15288 | if (d.position === "start") {
|
15289 | x = isX ? -height : 0;
|
15290 | } else if (d.position === "middle") {
|
15291 | x = (isX ? -height : width) / 2;
|
15292 | }
|
15293 | return x;
|
15294 | }.bind(this);
|
15295 | }
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 |
|
15302 |
|
15303 | function smoothLines(el, type) {
|
15304 | if (type === "grid") {
|
15305 | el.each(function () {
|
15306 | var _this3 = this,
|
15307 | g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
15308 | ["x1", "x2", "y1", "y2"].forEach(function (v) {
|
15309 | _newArrowCheck(this, _this3);
|
15310 | return g.attr(v, Math.ceil(+g.attr(v)));
|
15311 | }.bind(this));
|
15312 | });
|
15313 | }
|
15314 | }
|
15315 | var grid = ({
|
15316 | hasGrid: function hasGrid() {
|
15317 | var _this4 = this,
|
15318 | config = this.config;
|
15319 | return ["x", "y"].some(function (v) {
|
15320 | _newArrowCheck(this, _this4);
|
15321 | return config["grid_" + v + "_show"] || config["grid_" + v + "_lines"].length;
|
15322 | }.bind(this));
|
15323 | },
|
15324 | initGrid: function initGrid() {
|
15325 | var $$ = this;
|
15326 | $$.hasGrid() && $$.initGridLines();
|
15327 | $$.initFocusGrid();
|
15328 | },
|
15329 | initGridLines: function initGridLines() {
|
15330 | var $$ = this,
|
15331 | config = $$.config,
|
15332 | clip = $$.state.clip,
|
15333 | $el = $$.$el;
|
15334 | if (config.grid_x_lines.length || config.grid_y_lines.length) {
|
15335 | $el.gridLines.main = $el.main.insert("g", "." + $COMMON.chart + (config.grid_lines_front ? " + *" : "")).attr("clip-path", clip.pathGrid).attr("class", $GRID.grid + " " + $GRID.gridLines);
|
15336 | $el.gridLines.main.append("g").attr("class", $GRID.xgridLines);
|
15337 | $el.gridLines.main.append("g").attr("class", $GRID.ygridLines);
|
15338 | $el.gridLines.x = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.selectAll)([]);
|
15339 | }
|
15340 | },
|
15341 | updateXGrid: function updateXGrid(withoutUpdate) {
|
15342 | var _this5 = this,
|
15343 | $$ = this,
|
15344 | config = $$.config,
|
15345 | scale = $$.scale,
|
15346 | state = $$.state,
|
15347 | _$$$$el = $$.$el,
|
15348 | main = _$$$$el.main,
|
15349 | grid = _$$$$el.grid,
|
15350 | isRotated = config.axis_rotated,
|
15351 | xgridData = $$.generateGridData(config.grid_x_type, scale.x),
|
15352 | tickOffset = $$.axis.isCategorized() ? $$.axis.x.tickOffset() : 0,
|
15353 | pos = function (d) {
|
15354 | _newArrowCheck(this, _this5);
|
15355 | return (scale.zoom || scale.x)(d) + tickOffset * (isRotated ? -1 : 1);
|
15356 | }.bind(this);
|
15357 | state.xgridAttr = isRotated ? {
|
15358 | "x1": 0,
|
15359 | "x2": state.width,
|
15360 | "y1": pos,
|
15361 | "y2": pos
|
15362 | } : {
|
15363 | "x1": pos,
|
15364 | "x2": pos,
|
15365 | "y1": 0,
|
15366 | "y2": state.height
|
15367 | };
|
15368 | grid.x = main.select("." + $GRID.xgrids).selectAll("." + $GRID.xgrid).data(xgridData);
|
15369 | grid.x.exit().remove();
|
15370 | grid.x = grid.x.enter().append("line").attr("class", $GRID.xgrid).merge(grid.x);
|
15371 | if (!withoutUpdate) {
|
15372 | grid.x.each(function () {
|
15373 | var _this6 = this,
|
15374 | grid = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
15375 | Object.keys(state.xgridAttr).forEach(function (id) {
|
15376 | var _this7 = this;
|
15377 | _newArrowCheck(this, _this6);
|
15378 | grid.attr(id, state.xgridAttr[id]).style("opacity", function () {
|
15379 | _newArrowCheck(this, _this7);
|
15380 | return grid.attr(isRotated ? "y1" : "x1") === (isRotated ? state.height : 0) ? "0" : null;
|
15381 | }.bind(this));
|
15382 | }.bind(this));
|
15383 | });
|
15384 | }
|
15385 | },
|
15386 | updateYGrid: function updateYGrid() {
|
15387 | var _this8 = this,
|
15388 | $$ = this,
|
15389 | axis = $$.axis,
|
15390 | config = $$.config,
|
15391 | scale = $$.scale,
|
15392 | state = $$.state,
|
15393 | _$$$$el2 = $$.$el,
|
15394 | grid = _$$$$el2.grid,
|
15395 | main = _$$$$el2.main,
|
15396 | isRotated = config.axis_rotated,
|
15397 | pos = function (d) {
|
15398 | _newArrowCheck(this, _this8);
|
15399 | return Math.ceil(scale.y(d));
|
15400 | }.bind(this),
|
15401 | gridValues = axis.y.getGeneratedTicks(config.grid_y_ticks) || $$.scale.y.ticks(config.grid_y_ticks);
|
15402 | grid.y = main.select("." + $GRID.ygrids).selectAll("." + $GRID.ygrid).data(gridValues);
|
15403 | grid.y.exit().remove();
|
15404 | grid.y = grid.y.enter().append("line").attr("class", $GRID.ygrid).merge(grid.y);
|
15405 | grid.y.attr("x1", isRotated ? pos : 0).attr("x2", isRotated ? pos : state.width).attr("y1", isRotated ? 0 : pos).attr("y2", isRotated ? state.height : pos);
|
15406 | smoothLines(grid.y, "grid");
|
15407 | },
|
15408 | updateGrid: function updateGrid() {
|
15409 | var $$ = this,
|
15410 | _$$$$el3 = $$.$el,
|
15411 | grid = _$$$$el3.grid,
|
15412 | gridLines = _$$$$el3.gridLines;
|
15413 | gridLines.main || $$.initGridLines();
|
15414 |
|
15415 |
|
15416 | grid.main.style("visibility", $$.hasArcType() ? "hidden" : null);
|
15417 | $$.hideGridFocus();
|
15418 | $$.updateXGridLines();
|
15419 | $$.updateYGridLines();
|
15420 | },
|
15421 | |
15422 |
|
15423 |
|
15424 |
|
15425 | updateXGridLines: function updateXGridLines() {
|
15426 | var _this9 = this,
|
15427 | $$ = this,
|
15428 | config = $$.config,
|
15429 | _$$$$el4 = $$.$el,
|
15430 | gridLines = _$$$$el4.gridLines,
|
15431 | main = _$$$$el4.main,
|
15432 | $T = $$.$T,
|
15433 | isRotated = config.axis_rotated;
|
15434 | config.grid_x_show && $$.updateXGrid();
|
15435 | var xLines = main.select("." + $GRID.xgridLines).selectAll("." + $GRID.xgridLine).data(config.grid_x_lines);
|
15436 |
|
15437 |
|
15438 | $T(xLines.exit()).style("opacity", "0").remove();
|
15439 |
|
15440 |
|
15441 | var xgridLine = xLines.enter().append("g");
|
15442 | xgridLine.append("line").style("opacity", "0");
|
15443 | xgridLine.append("text").attr("transform", isRotated ? "" : "rotate(-90)").attr("dy", -5).style("opacity", "0");
|
15444 | xLines = xgridLine.merge(xLines);
|
15445 | $T(xLines.attr("class", function (d) {
|
15446 | _newArrowCheck(this, _this9);
|
15447 | return ($GRID.xgridLine + " " + (d.class || "")).trim();
|
15448 | }.bind(this)).select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx)).text(function (d) {
|
15449 | _newArrowCheck(this, _this9);
|
15450 | return d.text;
|
15451 | }.bind(this)).style("opacity", null);
|
15452 | gridLines.x = xLines;
|
15453 | },
|
15454 | |
15455 |
|
15456 |
|
15457 |
|
15458 | updateYGridLines: function updateYGridLines() {
|
15459 | var _this10 = this,
|
15460 | $$ = this,
|
15461 | config = $$.config,
|
15462 | _$$$state = $$.state,
|
15463 | width = _$$$state.width,
|
15464 | height = _$$$state.height,
|
15465 | $el = $$.$el,
|
15466 | $T = $$.$T,
|
15467 | isRotated = config.axis_rotated;
|
15468 | config.grid_y_show && $$.updateYGrid();
|
15469 | var ygridLines = $el.main.select("." + $GRID.ygridLines).selectAll("." + $GRID.ygridLine).data(config.grid_y_lines);
|
15470 |
|
15471 |
|
15472 | $T(ygridLines.exit()).style("opacity", "0").remove();
|
15473 |
|
15474 |
|
15475 | var ygridLine = ygridLines.enter().append("g");
|
15476 | ygridLine.append("line").style("opacity", "0");
|
15477 | ygridLine.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0");
|
15478 | ygridLines = ygridLine.merge(ygridLines);
|
15479 |
|
15480 |
|
15481 | var yv = $$.yv.bind($$);
|
15482 | $T(ygridLines.attr("class", function (d) {
|
15483 | _newArrowCheck(this, _this10);
|
15484 | return ($GRID.ygridLine + " " + (d.class || "")).trim();
|
15485 | }.bind(this)).select("line")).attr("x1", isRotated ? yv : 0).attr("x2", isRotated ? yv : width).attr("y1", isRotated ? 0 : yv).attr("y2", isRotated ? height : yv).style("opacity", null);
|
15486 | $T(ygridLines.select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx)).attr("dy", -5).attr("x", getGridTextX(isRotated, width, height)).attr("y", yv).text(function (d) {
|
15487 | _newArrowCheck(this, _this10);
|
15488 | return d.text;
|
15489 | }.bind(this)).style("opacity", null);
|
15490 | $el.gridLines.y = ygridLines;
|
15491 | },
|
15492 | redrawGrid: function redrawGrid(withTransition) {
|
15493 | var _this11 = this,
|
15494 | $$ = this,
|
15495 | isRotated = $$.config.axis_rotated,
|
15496 | _$$$state2 = $$.state,
|
15497 | width = _$$$state2.width,
|
15498 | height = _$$$state2.height,
|
15499 | gridLines = $$.$el.gridLines,
|
15500 | $T = $$.$T,
|
15501 | xv = $$.xv.bind($$),
|
15502 | lines = gridLines.x.select("line"),
|
15503 | texts = gridLines.x.select("text");
|
15504 | lines = $T(lines, withTransition).attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? width : xv).attr("y1", isRotated ? xv : 0).attr("y2", isRotated ? xv : height);
|
15505 | texts = $T(texts, withTransition).attr("x", getGridTextX(!isRotated, width, height)).attr("y", xv).text(function (d) {
|
15506 | _newArrowCheck(this, _this11);
|
15507 | return d.text;
|
15508 | }.bind(this));
|
15509 | return [lines.style("opacity", null), texts.style("opacity", null)];
|
15510 | },
|
15511 | initFocusGrid: function initFocusGrid() {
|
15512 | var $$ = this,
|
15513 | config = $$.config,
|
15514 | clip = $$.state.clip,
|
15515 | $el = $$.$el,
|
15516 | isFront = config.grid_front,
|
15517 | className = "." + (isFront && $el.gridLines.main ? $GRID.gridLines : $COMMON.chart) + (isFront ? " + *" : ""),
|
15518 | grid = $el.main.insert("g", className).attr("clip-path", clip.pathGrid).attr("class", $GRID.grid);
|
15519 | $el.grid.main = grid;
|
15520 | config.grid_x_show && grid.append("g").attr("class", $GRID.xgrids);
|
15521 | config.grid_y_show && grid.append("g").attr("class", $GRID.ygrids);
|
15522 | if (config.interaction_enabled && config.grid_focus_show) {
|
15523 | grid.append("g").attr("class", $FOCUS.xgridFocus).append("line").attr("class", $FOCUS.xgridFocus);
|
15524 |
|
15525 |
|
15526 | if (config.grid_focus_y && !config.tooltip_grouped) {
|
15527 | grid.append("g").attr("class", $FOCUS.ygridFocus).append("line").attr("class", $FOCUS.ygridFocus);
|
15528 | }
|
15529 | }
|
15530 | },
|
15531 | |
15532 |
|
15533 |
|
15534 |
|
15535 |
|
15536 | showGridFocus: function showGridFocus(data) {
|
15537 | var _this12 = this,
|
15538 | $$ = this,
|
15539 | config = $$.config,
|
15540 | _$$$state3 = $$.state,
|
15541 | width = _$$$state3.width,
|
15542 | height = _$$$state3.height,
|
15543 | isRotated = config.axis_rotated,
|
15544 | focusEl = $$.$el.main.selectAll("line." + $FOCUS.xgridFocus + ", line." + $FOCUS.ygridFocus),
|
15545 | dataToShow = (data || [focusEl.datum()]).filter(function (d) {
|
15546 | _newArrowCheck(this, _this12);
|
15547 | return d && isValue($$.getBaseValue(d));
|
15548 | }.bind(this));
|
15549 |
|
15550 | if (!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType()) {
|
15551 | return;
|
15552 | }
|
15553 | var isEdge = config.grid_focus_edge && !config.tooltip_grouped,
|
15554 | xx = $$.xx.bind($$);
|
15555 | focusEl.style("visibility", null).data(dataToShow.concat(dataToShow)).each(function (d) {
|
15556 | var _this13 = this,
|
15557 | el = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
15558 | pos = {
|
15559 | x: xx(d),
|
15560 | y: $$.getYScaleById(d.id)(d.value)
|
15561 | },
|
15562 | xy;
|
15563 | if (el.classed($FOCUS.xgridFocus)) {
|
15564 |
|
15565 | xy = isRotated ? [null,
|
15566 |
|
15567 | pos.x,
|
15568 |
|
15569 | isEdge ? pos.y : width,
|
15570 |
|
15571 | pos.x
|
15572 | ] : [pos.x, isEdge ? pos.y : null, pos.x, height];
|
15573 | } else {
|
15574 | var isY2 = $$.axis.getId(d.id) === "y2";
|
15575 | xy = isRotated ? [pos.y,
|
15576 |
|
15577 | isEdge && !isY2 ? pos.x : null,
|
15578 |
|
15579 | pos.y,
|
15580 |
|
15581 | isEdge && isY2 ? pos.x : height
|
15582 | ] : [isEdge && isY2 ? pos.x : null, pos.y, isEdge && !isY2 ? pos.x : width, pos.y];
|
15583 | }
|
15584 | ["x1", "y1", "x2", "y2"].forEach(function (v, i) {
|
15585 | _newArrowCheck(this, _this13);
|
15586 | return el.attr(v, xy[i]);
|
15587 | }.bind(this));
|
15588 | });
|
15589 | smoothLines(focusEl, "grid");
|
15590 | $$.showCircleFocus == null ? void 0 : $$.showCircleFocus(data);
|
15591 | },
|
15592 | hideGridFocus: function hideGridFocus() {
|
15593 | var $$ = this,
|
15594 | _$$$state4 = $$.state,
|
15595 | inputType = _$$$state4.inputType,
|
15596 | resizing = _$$$state4.resizing,
|
15597 | main = $$.$el.main;
|
15598 | if (inputType === "mouse" || !resizing) {
|
15599 | main.selectAll("line." + $FOCUS.xgridFocus + ", line." + $FOCUS.ygridFocus).style("visibility", "hidden");
|
15600 | $$.hideCircleFocus == null ? void 0 : $$.hideCircleFocus();
|
15601 | }
|
15602 | },
|
15603 | updateGridFocus: function updateGridFocus() {
|
15604 | var $$ = this,
|
15605 | _$$$state5 = $$.state,
|
15606 | inputType = _$$$state5.inputType,
|
15607 | width = _$$$state5.width,
|
15608 | height = _$$$state5.height,
|
15609 | resizing = _$$$state5.resizing,
|
15610 | grid = $$.$el.grid,
|
15611 | xgridFocus = grid.main.select("line." + $FOCUS.xgridFocus);
|
15612 | if (inputType === "touch") {
|
15613 | if (xgridFocus.empty()) {
|
15614 | resizing && ($$.showCircleFocus == null ? void 0 : $$.showCircleFocus());
|
15615 | } else {
|
15616 | $$.showGridFocus();
|
15617 | }
|
15618 | } else {
|
15619 | var _isRotated = $$.config.axis_rotated;
|
15620 | xgridFocus.attr("x1", _isRotated ? 0 : -10).attr("x2", _isRotated ? width : -10).attr("y1", _isRotated ? -10 : 0).attr("y2", _isRotated ? -10 : height);
|
15621 | }
|
15622 |
|
15623 |
|
15624 |
|
15625 | return !0;
|
15626 | },
|
15627 | generateGridData: function generateGridData(type, scale) {
|
15628 | var _this14 = this,
|
15629 | $$ = this,
|
15630 | tickNum = $$.$el.main.select("." + $AXIS.axisX).selectAll(".tick").size(),
|
15631 | gridData = [];
|
15632 | if (type === "year") {
|
15633 | var xDomain = $$.getXDomain(),
|
15634 | _xDomain$map = xDomain.map(function (v) {
|
15635 | _newArrowCheck(this, _this14);
|
15636 | return v.getFullYear();
|
15637 | }.bind(this)),
|
15638 | firstYear = _xDomain$map[0],
|
15639 | lastYear = _xDomain$map[1];
|
15640 | for (var i = firstYear; i <= lastYear; i++) {
|
15641 | gridData.push(new Date(i + "-01-01 00:00:00"));
|
15642 | }
|
15643 | } else {
|
15644 | gridData = scale.ticks(10);
|
15645 | if (gridData.length > tickNum) {
|
15646 |
|
15647 | gridData = gridData.filter(function (d) {
|
15648 | _newArrowCheck(this, _this14);
|
15649 | return (d + "").indexOf(".") < 0;
|
15650 | }.bind(this));
|
15651 | }
|
15652 | }
|
15653 | return gridData;
|
15654 | },
|
15655 | getGridFilterToRemove: function getGridFilterToRemove(params) {
|
15656 | var _this15 = this;
|
15657 | return params ? function (line) {
|
15658 | var _this16 = this;
|
15659 | _newArrowCheck(this, _this15);
|
15660 | var found = !1;
|
15661 | (isArray(params) ? params.concat() : [params]).forEach(function (param) {
|
15662 | _newArrowCheck(this, _this16);
|
15663 | if ("value" in param && line.value === param.value || "class" in param && line.class === param.class) {
|
15664 | found = !0;
|
15665 | }
|
15666 | }.bind(this));
|
15667 | return found;
|
15668 | }.bind(this) : function () {
|
15669 | _newArrowCheck(this, _this15);
|
15670 | return !0;
|
15671 | }.bind(this);
|
15672 | },
|
15673 | removeGridLines: function removeGridLines(params, forX) {
|
15674 | var _this17 = this,
|
15675 | $$ = this,
|
15676 | config = $$.config,
|
15677 | $T = $$.$T,
|
15678 | toRemove = $$.getGridFilterToRemove(params),
|
15679 | toShow = function (line) {
|
15680 | _newArrowCheck(this, _this17);
|
15681 | return !toRemove(line);
|
15682 | }.bind(this),
|
15683 | classLines = forX ? $GRID.xgridLines : $GRID.ygridLines,
|
15684 | classLine = forX ? $GRID.xgridLine : $GRID.ygridLine;
|
15685 | $T($$.$el.main.select("." + classLines).selectAll("." + classLine).filter(toRemove)).style("opacity", "0").remove();
|
15686 | var gridLines = "grid_" + (forX ? "x" : "y") + "_lines";
|
15687 | config[gridLines] = config[gridLines].filter(toShow);
|
15688 | }
|
15689 | });
|
15690 | ;
|
15691 |
|
15692 |
|
15693 |
|
15694 |
|
15695 |
|
15696 |
|
15697 |
|
15698 |
|
15699 | var region = ({
|
15700 | initRegion: function initRegion() {
|
15701 | var $$ = this,
|
15702 | $el = $$.$el;
|
15703 | $el.region.main = $el.main.insert("g", ":first-child").attr("clip-path", $$.state.clip.path).attr("class", $REGION.regions);
|
15704 | },
|
15705 | updateRegion: function updateRegion() {
|
15706 | var $$ = this,
|
15707 | config = $$.config,
|
15708 | region = $$.$el.region,
|
15709 | $T = $$.$T;
|
15710 | if (!region.main) {
|
15711 | $$.initRegion();
|
15712 | }
|
15713 |
|
15714 |
|
15715 | region.main.style("visibility", $$.hasArcType() ? "hidden" : null);
|
15716 |
|
15717 |
|
15718 | var list = region.main.selectAll("." + $REGION.region).data(config.regions);
|
15719 | $T(list.exit()).style("opacity", "0").remove();
|
15720 | list = list.enter().append("g").merge(list).attr("class", $$.classRegion.bind($$));
|
15721 | list.append("rect").style("fill-opacity", "0");
|
15722 | region.list = list;
|
15723 | },
|
15724 | redrawRegion: function redrawRegion(withTransition) {
|
15725 | var _this = this,
|
15726 | $$ = this,
|
15727 | region = $$.$el.region,
|
15728 | $T = $$.$T,
|
15729 | regions = region.list.select("rect");
|
15730 | regions = $T(regions, withTransition).attr("x", $$.regionX.bind($$)).attr("y", $$.regionY.bind($$)).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$));
|
15731 | return [regions.style("fill-opacity", function (d) {
|
15732 | _newArrowCheck(this, _this);
|
15733 | return isValue(d.opacity) ? d.opacity : null;
|
15734 | }.bind(this)).on("end", function () {
|
15735 |
|
15736 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode).selectAll("rect:not([x])").remove();
|
15737 | })];
|
15738 | },
|
15739 | getRegionXY: function getRegionXY(type, d) {
|
15740 | var $$ = this,
|
15741 | config = $$.config,
|
15742 | scale = $$.scale,
|
15743 | isRotated = config.axis_rotated,
|
15744 | isX = type === "x",
|
15745 | key = "start",
|
15746 | currScale,
|
15747 | pos = 0;
|
15748 | if (d.axis === "y" || d.axis === "y2") {
|
15749 | if (!isX) {
|
15750 | key = "end";
|
15751 | }
|
15752 | if ((isX ? isRotated : !isRotated) && key in d) {
|
15753 | currScale = scale[d.axis];
|
15754 | pos = currScale(d[key]);
|
15755 | }
|
15756 | } else if ((isX ? !isRotated : isRotated) && key in d) {
|
15757 | currScale = scale.zoom || scale.x;
|
15758 | pos = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
|
15759 | }
|
15760 | return pos;
|
15761 | },
|
15762 | regionX: function regionX(d) {
|
15763 | return this.getRegionXY("x", d);
|
15764 | },
|
15765 | regionY: function regionY(d) {
|
15766 | return this.getRegionXY("y", d);
|
15767 | },
|
15768 | getRegionSize: function getRegionSize(type, d) {
|
15769 | var $$ = this,
|
15770 | config = $$.config,
|
15771 | scale = $$.scale,
|
15772 | state = $$.state,
|
15773 | isRotated = config.axis_rotated,
|
15774 | isWidth = type === "width",
|
15775 | start = $$[isWidth ? "regionX" : "regionY"](d),
|
15776 | currScale,
|
15777 | key = "end",
|
15778 | end = state[type];
|
15779 | if (d.axis === "y" || d.axis === "y2") {
|
15780 | if (!isWidth) {
|
15781 | key = "start";
|
15782 | }
|
15783 | if ((isWidth ? isRotated : !isRotated) && key in d) {
|
15784 | currScale = scale[d.axis];
|
15785 | end = currScale(d[key]);
|
15786 | }
|
15787 | } else if ((isWidth ? !isRotated : isRotated) && key in d) {
|
15788 | currScale = scale.zoom || scale.x;
|
15789 | end = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
|
15790 | }
|
15791 | return end < start ? 0 : end - start;
|
15792 | },
|
15793 | regionWidth: function regionWidth(d) {
|
15794 | return this.getRegionSize("width", d);
|
15795 | },
|
15796 | regionHeight: function regionHeight(d) {
|
15797 | return this.getRegionSize("height", d);
|
15798 | },
|
15799 | isRegionOnX: function isRegionOnX(d) {
|
15800 | return !d.axis || d.axis === "x";
|
15801 | }
|
15802 | });
|
15803 | ;
|
15804 |
|
15805 |
|
15806 |
|
15807 |
|
15808 |
|
15809 | var size_axis = ({
|
15810 | |
15811 |
|
15812 |
|
15813 |
|
15814 |
|
15815 |
|
15816 | getAxisSize: function getAxisSize(id) {
|
15817 | var $$ = this,
|
15818 | isRotated = $$.config.axis_rotated;
|
15819 | return isRotated && id === "x" || !isRotated && /y2?/.test(id) ? $$.getAxisWidthByAxisId(id, !0) : $$.getHorizontalAxisHeight(id);
|
15820 | },
|
15821 | getAxisWidthByAxisId: function getAxisWidthByAxisId(id, withoutRecompute) {
|
15822 | var $$ = this;
|
15823 | if ($$.axis) {
|
15824 | var _$$$axis,
|
15825 | position = (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.getLabelPositionById(id),
|
15826 | width = $$.axis.getMaxTickWidth(id, withoutRecompute),
|
15827 | gap = width === 0 ? .5 : 0;
|
15828 | return width + (position.isInner ? 20 + gap : 40);
|
15829 | } else {
|
15830 | return 40;
|
15831 | }
|
15832 | },
|
15833 | getHorizontalAxisHeight: function getHorizontalAxisHeight(id) {
|
15834 | var $$ = this,
|
15835 | config = $$.config,
|
15836 | state = $$.state,
|
15837 | _state = state,
|
15838 | current = _state.current,
|
15839 | rotatedPadding = _state.rotatedPadding,
|
15840 | isLegendRight = _state.isLegendRight,
|
15841 | isLegendInset = _state.isLegendInset,
|
15842 | isRotated = config.axis_rotated,
|
15843 | h = 30;
|
15844 | if (id === "x" && !config.axis_x_show) {
|
15845 | return 8;
|
15846 | }
|
15847 | if (id === "x" && config.axis_x_height) {
|
15848 | return config.axis_x_height;
|
15849 | }
|
15850 | if (id === "y" && !config.axis_y_show) {
|
15851 | return config.legend_show && !isLegendRight && !isLegendInset ? 10 : 1;
|
15852 | }
|
15853 | if (id === "y2" && !config.axis_y2_show) {
|
15854 | return rotatedPadding.top;
|
15855 | }
|
15856 | var rotate = $$.getAxisTickRotate(id);
|
15857 |
|
15858 |
|
15859 | if ((id === "x" && !isRotated || /y2?/.test(id) && isRotated) && rotate) {
|
15860 | h = 30 + $$.axis.getMaxTickWidth(id) * Math.cos(Math.PI * (90 - Math.abs(rotate)) / 180);
|
15861 | if (!config.axis_x_tick_multiline && current.height) {
|
15862 | if (h > current.height / 2) {
|
15863 | h = current.height / 2;
|
15864 | }
|
15865 | }
|
15866 | }
|
15867 | return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
|
15868 | },
|
15869 | getEventRectWidth: function getEventRectWidth() {
|
15870 | return Math.max(0, this.axis.x.tickInterval());
|
15871 | },
|
15872 | |
15873 |
|
15874 |
|
15875 |
|
15876 |
|
15877 |
|
15878 | getAxisTickRotate: function getAxisTickRotate(id) {
|
15879 | var $$ = this,
|
15880 | axis = $$.axis,
|
15881 | config = $$.config,
|
15882 | state = $$.state,
|
15883 | $el = $$.$el,
|
15884 | rotate = config["axis_" + id + "_tick_rotate"];
|
15885 | if (id === "x") {
|
15886 | var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries();
|
15887 | if (config.axis_x_tick_fit && allowedXAxisTypes) {
|
15888 | var xTickCount = config.axis_x_tick_count,
|
15889 | currentXTicksLength = state.current.maxTickWidths.x.ticks.length,
|
15890 | tickCount = 0;
|
15891 | if (xTickCount) {
|
15892 | tickCount = xTickCount > currentXTicksLength ? currentXTicksLength : xTickCount;
|
15893 | } else if (currentXTicksLength) {
|
15894 | tickCount = currentXTicksLength;
|
15895 | }
|
15896 | if (tickCount !== state.axis.x.tickCount) {
|
15897 | var targets = $$.data.targets;
|
15898 | state.axis.x.padding = $$.getXDomainPadding([$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")], tickCount);
|
15899 | }
|
15900 | state.axis.x.tickCount = tickCount;
|
15901 | }
|
15902 | if ($el.svg && config.axis_x_tick_fit && !config.axis_x_tick_multiline && !config.axis_x_tick_culling && config.axis_x_tick_autorotate && allowedXAxisTypes) {
|
15903 | rotate = $$.needToRotateXAxisTickTexts() ? config.axis_x_tick_rotate : 0;
|
15904 | }
|
15905 | }
|
15906 | return rotate;
|
15907 | },
|
15908 | |
15909 |
|
15910 |
|
15911 |
|
15912 |
|
15913 | needToRotateXAxisTickTexts: function needToRotateXAxisTickTexts() {
|
15914 | var $$ = this,
|
15915 | _$$$state = $$.state,
|
15916 | axis = _$$$state.axis,
|
15917 | current = _$$$state.current,
|
15918 | xAxisLength = current.width - $$.getCurrentPaddingLeft(!1) - $$.getCurrentPaddingRight(),
|
15919 | tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right,
|
15920 | maxTickWidth = $$.axis.getMaxTickWidth("x"),
|
15921 | tickLength = tickCountWithPadding ? xAxisLength / tickCountWithPadding : 0;
|
15922 | return maxTickWidth > tickLength;
|
15923 | }
|
15924 | });
|
15925 | ;
|
15926 |
|
15927 |
|
15928 |
|
15929 |
|
15930 |
|
15931 |
|
15932 |
|
15933 | var data_axis = ({
|
15934 | |
15935 |
|
15936 |
|
15937 |
|
15938 |
|
15939 |
|
15940 |
|
15941 |
|
15942 |
|
15943 |
|
15944 |
|
15945 |
|
15946 |
|
15947 |
|
15948 |
|
15949 | data_xs: {},
|
15950 | |
15951 |
|
15952 |
|
15953 |
|
15954 |
|
15955 |
|
15956 |
|
15957 |
|
15958 |
|
15959 |
|
15960 |
|
15961 |
|
15962 |
|
15963 |
|
15964 |
|
15965 |
|
15966 |
|
15967 |
|
15968 |
|
15969 |
|
15970 |
|
15971 |
|
15972 |
|
15973 | data_xFormat: "%Y-%m-%d",
|
15974 | |
15975 |
|
15976 |
|
15977 |
|
15978 |
|
15979 |
|
15980 |
|
15981 |
|
15982 |
|
15983 |
|
15984 |
|
15985 | data_xLocaltime: !0,
|
15986 | |
15987 |
|
15988 |
|
15989 |
|
15990 |
|
15991 |
|
15992 |
|
15993 |
|
15994 |
|
15995 |
|
15996 |
|
15997 | data_xSort: !0,
|
15998 | |
15999 |
|
16000 |
|
16001 |
|
16002 |
|
16003 |
|
16004 |
|
16005 |
|
16006 |
|
16007 |
|
16008 |
|
16009 |
|
16010 |
|
16011 |
|
16012 |
|
16013 | data_axes: {},
|
16014 | |
16015 |
|
16016 |
|
16017 |
|
16018 |
|
16019 |
|
16020 |
|
16021 |
|
16022 |
|
16023 |
|
16024 |
|
16025 |
|
16026 |
|
16027 |
|
16028 |
|
16029 |
|
16030 |
|
16031 |
|
16032 |
|
16033 |
|
16034 |
|
16035 |
|
16036 |
|
16037 |
|
16038 |
|
16039 |
|
16040 |
|
16041 |
|
16042 | data_regions: {},
|
16043 | |
16044 |
|
16045 |
|
16046 |
|
16047 |
|
16048 |
|
16049 |
|
16050 |
|
16051 |
|
16052 |
|
16053 |
|
16054 |
|
16055 |
|
16056 |
|
16057 |
|
16058 |
|
16059 |
|
16060 |
|
16061 | data_stack_normalize: !1
|
16062 | });
|
16063 | ;
|
16064 |
|
16065 |
|
16066 |
|
16067 |
|
16068 |
|
16069 |
|
16070 |
|
16071 | var axis_x = ({
|
16072 | |
16073 |
|
16074 |
|
16075 |
|
16076 |
|
16077 |
|
16078 |
|
16079 |
|
16080 |
|
16081 |
|
16082 |
|
16083 | axis_x_clipPath: !0,
|
16084 | |
16085 |
|
16086 |
|
16087 |
|
16088 |
|
16089 |
|
16090 |
|
16091 |
|
16092 |
|
16093 |
|
16094 |
|
16095 |
|
16096 |
|
16097 | axis_x_show: !0,
|
16098 | |
16099 |
|
16100 |
|
16101 |
|
16102 |
|
16103 |
|
16104 |
|
16105 |
|
16106 |
|
16107 |
|
16108 |
|
16109 |
|
16110 |
|
16111 |
|
16112 |
|
16113 |
|
16114 |
|
16115 |
|
16116 |
|
16117 |
|
16118 |
|
16119 |
|
16120 |
|
16121 |
|
16122 |
|
16123 |
|
16124 |
|
16125 |
|
16126 | axis_x_type: "indexed",
|
16127 | |
16128 |
|
16129 |
|
16130 |
|
16131 |
|
16132 |
|
16133 |
|
16134 |
|
16135 |
|
16136 |
|
16137 |
|
16138 |
|
16139 |
|
16140 |
|
16141 | axis_x_localtime: !0,
|
16142 | |
16143 |
|
16144 |
|
16145 |
|
16146 |
|
16147 |
|
16148 |
|
16149 |
|
16150 |
|
16151 |
|
16152 |
|
16153 |
|
16154 |
|
16155 |
|
16156 | axis_x_categories: [],
|
16157 | |
16158 |
|
16159 |
|
16160 |
|
16161 |
|
16162 |
|
16163 |
|
16164 |
|
16165 |
|
16166 |
|
16167 |
|
16168 |
|
16169 |
|
16170 |
|
16171 |
|
16172 | axis_x_tick_centered: !1,
|
16173 | |
16174 |
|
16175 |
|
16176 |
|
16177 |
|
16178 |
|
16179 |
|
16180 |
|
16181 |
|
16182 |
|
16183 |
|
16184 |
|
16185 |
|
16186 |
|
16187 |
|
16188 |
|
16189 |
|
16190 |
|
16191 |
|
16192 |
|
16193 |
|
16194 |
|
16195 |
|
16196 |
|
16197 |
|
16198 |
|
16199 |
|
16200 | axis_x_tick_format: undefined,
|
16201 | |
16202 |
|
16203 |
|
16204 |
|
16205 |
|
16206 |
|
16207 |
|
16208 |
|
16209 |
|
16210 |
|
16211 |
|
16212 |
|
16213 |
|
16214 |
|
16215 |
|
16216 |
|
16217 |
|
16218 |
|
16219 |
|
16220 |
|
16221 | axis_x_tick_culling: {},
|
16222 | |
16223 |
|
16224 |
|
16225 |
|
16226 |
|
16227 |
|
16228 |
|
16229 |
|
16230 |
|
16231 |
|
16232 |
|
16233 |
|
16234 |
|
16235 |
|
16236 |
|
16237 |
|
16238 |
|
16239 | axis_x_tick_culling_max: 10,
|
16240 | |
16241 |
|
16242 |
|
16243 |
|
16244 |
|
16245 |
|
16246 |
|
16247 |
|
16248 |
|
16249 |
|
16250 |
|
16251 |
|
16252 |
|
16253 |
|
16254 |
|
16255 |
|
16256 |
|
16257 | axis_x_tick_culling_lines: !0,
|
16258 | |
16259 |
|
16260 |
|
16261 |
|
16262 |
|
16263 |
|
16264 |
|
16265 |
|
16266 |
|
16267 |
|
16268 |
|
16269 |
|
16270 |
|
16271 |
|
16272 |
|
16273 |
|
16274 | axis_x_tick_count: undefined,
|
16275 | |
16276 |
|
16277 |
|
16278 |
|
16279 |
|
16280 |
|
16281 |
|
16282 |
|
16283 |
|
16284 |
|
16285 |
|
16286 |
|
16287 |
|
16288 |
|
16289 |
|
16290 |
|
16291 | axis_x_tick_show: !0,
|
16292 | |
16293 |
|
16294 |
|
16295 |
|
16296 |
|
16297 |
|
16298 |
|
16299 |
|
16300 |
|
16301 |
|
16302 |
|
16303 |
|
16304 |
|
16305 |
|
16306 |
|
16307 |
|
16308 |
|
16309 |
|
16310 | axis_x_tick_text_show: !0,
|
16311 | |
16312 |
|
16313 |
|
16314 |
|
16315 |
|
16316 |
|
16317 |
|
16318 |
|
16319 |
|
16320 |
|
16321 |
|
16322 |
|
16323 |
|
16324 |
|
16325 |
|
16326 |
|
16327 |
|
16328 |
|
16329 |
|
16330 |
|
16331 | axis_x_tick_text_position: {
|
16332 | x: 0,
|
16333 | y: 0
|
16334 | },
|
16335 | |
16336 |
|
16337 |
|
16338 |
|
16339 |
|
16340 |
|
16341 |
|
16342 |
|
16343 |
|
16344 |
|
16345 |
|
16346 |
|
16347 |
|
16348 |
|
16349 |
|
16350 |
|
16351 |
|
16352 |
|
16353 |
|
16354 | axis_x_tick_fit: !0,
|
16355 | |
16356 |
|
16357 |
|
16358 |
|
16359 |
|
16360 |
|
16361 |
|
16362 |
|
16363 |
|
16364 |
|
16365 |
|
16366 |
|
16367 |
|
16368 |
|
16369 |
|
16370 |
|
16371 |
|
16372 |
|
16373 |
|
16374 |
|
16375 |
|
16376 |
|
16377 | axis_x_tick_values: null,
|
16378 | |
16379 |
|
16380 |
|
16381 |
|
16382 |
|
16383 |
|
16384 |
|
16385 |
|
16386 |
|
16387 |
|
16388 |
|
16389 |
|
16390 |
|
16391 |
|
16392 |
|
16393 |
|
16394 |
|
16395 |
|
16396 |
|
16397 |
|
16398 |
|
16399 |
|
16400 |
|
16401 |
|
16402 |
|
16403 |
|
16404 |
|
16405 | axis_x_tick_autorotate: !1,
|
16406 | |
16407 |
|
16408 |
|
16409 |
|
16410 |
|
16411 |
|
16412 |
|
16413 |
|
16414 |
|
16415 |
|
16416 |
|
16417 |
|
16418 |
|
16419 |
|
16420 |
|
16421 |
|
16422 |
|
16423 |
|
16424 |
|
16425 | axis_x_tick_rotate: 0,
|
16426 | |
16427 |
|
16428 |
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 | axis_x_tick_outer: !0,
|
16442 | |
16443 |
|
16444 |
|
16445 |
|
16446 |
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 |
|
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 |
|
16461 |
|
16462 |
|
16463 |
|
16464 |
|
16465 |
|
16466 |
|
16467 |
|
16468 |
|
16469 |
|
16470 | axis_x_tick_multiline: !0,
|
16471 | |
16472 |
|
16473 |
|
16474 |
|
16475 |
|
16476 |
|
16477 |
|
16478 |
|
16479 |
|
16480 |
|
16481 |
|
16482 |
|
16483 |
|
16484 |
|
16485 |
|
16486 |
|
16487 |
|
16488 | axis_x_tick_width: null,
|
16489 | |
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 |
|
16495 |
|
16496 |
|
16497 |
|
16498 |
|
16499 |
|
16500 |
|
16501 |
|
16502 |
|
16503 |
|
16504 |
|
16505 | axis_x_tick_tooltip: !1,
|
16506 | |
16507 |
|
16508 |
|
16509 |
|
16510 |
|
16511 |
|
16512 |
|
16513 |
|
16514 |
|
16515 |
|
16516 |
|
16517 |
|
16518 |
|
16519 |
|
16520 |
|
16521 |
|
16522 |
|
16523 |
|
16524 |
|
16525 |
|
16526 |
|
16527 |
|
16528 |
|
16529 | axis_x_max: undefined,
|
16530 | |
16531 |
|
16532 |
|
16533 |
|
16534 |
|
16535 |
|
16536 |
|
16537 |
|
16538 |
|
16539 |
|
16540 |
|
16541 |
|
16542 |
|
16543 |
|
16544 |
|
16545 |
|
16546 |
|
16547 |
|
16548 |
|
16549 |
|
16550 |
|
16551 |
|
16552 |
|
16553 | axis_x_min: undefined,
|
16554 | |
16555 |
|
16556 |
|
16557 |
|
16558 |
|
16559 |
|
16560 |
|
16561 |
|
16562 |
|
16563 |
|
16564 |
|
16565 |
|
16566 |
|
16567 |
|
16568 |
|
16569 |
|
16570 |
|
16571 |
|
16572 |
|
16573 |
|
16574 |
|
16575 |
|
16576 |
|
16577 |
|
16578 |
|
16579 |
|
16580 |
|
16581 |
|
16582 |
|
16583 |
|
16584 |
|
16585 |
|
16586 |
|
16587 |
|
16588 |
|
16589 |
|
16590 |
|
16591 |
|
16592 |
|
16593 |
|
16594 |
|
16595 |
|
16596 | axis_x_padding: {},
|
16597 | |
16598 |
|
16599 |
|
16600 |
|
16601 |
|
16602 |
|
16603 |
|
16604 |
|
16605 |
|
16606 |
|
16607 |
|
16608 |
|
16609 |
|
16610 |
|
16611 | axis_x_height: undefined,
|
16612 | |
16613 |
|
16614 |
|
16615 |
|
16616 |
|
16617 |
|
16618 |
|
16619 |
|
16620 |
|
16621 |
|
16622 |
|
16623 |
|
16624 |
|
16625 |
|
16626 |
|
16627 |
|
16628 |
|
16629 |
|
16630 |
|
16631 |
|
16632 |
|
16633 |
|
16634 |
|
16635 |
|
16636 |
|
16637 |
|
16638 |
|
16639 |
|
16640 | axis_x_extent: undefined,
|
16641 | |
16642 |
|
16643 |
|
16644 |
|
16645 |
|
16646 |
|
16647 |
|
16648 |
|
16649 |
|
16650 |
|
16651 |
|
16652 |
|
16653 |
|
16654 |
|
16655 |
|
16656 |
|
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 |
|
16663 |
|
16664 |
|
16665 |
|
16666 |
|
16667 |
|
16668 |
|
16669 |
|
16670 |
|
16671 |
|
16672 |
|
16673 |
|
16674 |
|
16675 |
|
16676 |
|
16677 |
|
16678 |
|
16679 |
|
16680 |
|
16681 |
|
16682 | axis_x_label: {},
|
16683 | |
16684 |
|
16685 |
|
16686 |
|
16687 |
|
16688 |
|
16689 |
|
16690 |
|
16691 |
|
16692 |
|
16693 |
|
16694 |
|
16695 |
|
16696 |
|
16697 |
|
16698 |
|
16699 |
|
16700 |
|
16701 |
|
16702 |
|
16703 |
|
16704 |
|
16705 |
|
16706 |
|
16707 |
|
16708 |
|
16709 |
|
16710 |
|
16711 |
|
16712 |
|
16713 |
|
16714 |
|
16715 |
|
16716 |
|
16717 |
|
16718 |
|
16719 |
|
16720 | axis_x_axes: []
|
16721 | });
|
16722 | ;
|
16723 |
|
16724 |
|
16725 |
|
16726 |
|
16727 |
|
16728 |
|
16729 |
|
16730 | var y = ({
|
16731 | |
16732 |
|
16733 |
|
16734 |
|
16735 |
|
16736 |
|
16737 |
|
16738 |
|
16739 |
|
16740 |
|
16741 |
|
16742 | axis_y_clipPath: !0,
|
16743 | |
16744 |
|
16745 |
|
16746 |
|
16747 |
|
16748 |
|
16749 |
|
16750 |
|
16751 |
|
16752 |
|
16753 |
|
16754 |
|
16755 |
|
16756 | axis_y_show: !0,
|
16757 | |
16758 |
|
16759 |
|
16760 |
|
16761 |
|
16762 |
|
16763 |
|
16764 |
|
16765 |
|
16766 |
|
16767 |
|
16768 |
|
16769 |
|
16770 |
|
16771 |
|
16772 |
|
16773 |
|
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 |
|
16782 | axis_y_type: "indexed",
|
16783 | |
16784 |
|
16785 |
|
16786 |
|
16787 |
|
16788 |
|
16789 |
|
16790 |
|
16791 |
|
16792 |
|
16793 |
|
16794 |
|
16795 |
|
16796 |
|
16797 | axis_y_max: undefined,
|
16798 | |
16799 |
|
16800 |
|
16801 |
|
16802 |
|
16803 |
|
16804 |
|
16805 |
|
16806 |
|
16807 |
|
16808 |
|
16809 |
|
16810 |
|
16811 |
|
16812 |
|
16813 | axis_y_min: undefined,
|
16814 | |
16815 |
|
16816 |
|
16817 |
|
16818 |
|
16819 |
|
16820 |
|
16821 |
|
16822 |
|
16823 |
|
16824 |
|
16825 |
|
16826 |
|
16827 |
|
16828 | axis_y_inverted: !1,
|
16829 | |
16830 |
|
16831 |
|
16832 |
|
16833 |
|
16834 |
|
16835 |
|
16836 |
|
16837 |
|
16838 |
|
16839 |
|
16840 |
|
16841 |
|
16842 | axis_y_center: undefined,
|
16843 | |
16844 |
|
16845 |
|
16846 |
|
16847 |
|
16848 |
|
16849 |
|
16850 |
|
16851 |
|
16852 |
|
16853 |
|
16854 |
|
16855 |
|
16856 | axis_y_inner: !1,
|
16857 | |
16858 |
|
16859 |
|
16860 |
|
16861 |
|
16862 |
|
16863 |
|
16864 |
|
16865 |
|
16866 |
|
16867 |
|
16868 |
|
16869 |
|
16870 |
|
16871 |
|
16872 |
|
16873 |
|
16874 |
|
16875 |
|
16876 |
|
16877 |
|
16878 |
|
16879 |
|
16880 |
|
16881 | axis_y_label: {},
|
16882 | |
16883 |
|
16884 |
|
16885 |
|
16886 |
|
16887 |
|
16888 |
|
16889 |
|
16890 |
|
16891 |
|
16892 |
|
16893 |
|
16894 |
|
16895 |
|
16896 |
|
16897 |
|
16898 |
|
16899 |
|
16900 | axis_y_tick_format: undefined,
|
16901 | |
16902 |
|
16903 |
|
16904 |
|
16905 |
|
16906 |
|
16907 |
|
16908 |
|
16909 |
|
16910 |
|
16911 |
|
16912 |
|
16913 |
|
16914 |
|
16915 |
|
16916 |
|
16917 |
|
16918 |
|
16919 |
|
16920 | axis_y_tick_culling: !1,
|
16921 | |
16922 |
|
16923 |
|
16924 |
|
16925 |
|
16926 |
|
16927 |
|
16928 |
|
16929 |
|
16930 |
|
16931 |
|
16932 |
|
16933 |
|
16934 |
|
16935 |
|
16936 |
|
16937 |
|
16938 | axis_y_tick_culling_max: 5,
|
16939 | |
16940 |
|
16941 |
|
16942 |
|
16943 |
|
16944 |
|
16945 |
|
16946 |
|
16947 |
|
16948 |
|
16949 |
|
16950 |
|
16951 |
|
16952 |
|
16953 |
|
16954 |
|
16955 |
|
16956 | axis_y_tick_culling_lines: !0,
|
16957 | |
16958 |
|
16959 |
|
16960 |
|
16961 |
|
16962 |
|
16963 |
|
16964 |
|
16965 |
|
16966 |
|
16967 |
|
16968 |
|
16969 |
|
16970 |
|
16971 |
|
16972 | axis_y_tick_outer: !0,
|
16973 | |
16974 |
|
16975 |
|
16976 |
|
16977 |
|
16978 |
|
16979 |
|
16980 |
|
16981 |
|
16982 |
|
16983 |
|
16984 |
|
16985 |
|
16986 |
|
16987 |
|
16988 |
|
16989 |
|
16990 |
|
16991 |
|
16992 |
|
16993 | axis_y_tick_values: null,
|
16994 | |
16995 |
|
16996 |
|
16997 |
|
16998 |
|
16999 |
|
17000 |
|
17001 |
|
17002 |
|
17003 |
|
17004 |
|
17005 |
|
17006 |
|
17007 |
|
17008 |
|
17009 |
|
17010 |
|
17011 | axis_y_tick_rotate: 0,
|
17012 | |
17013 |
|
17014 |
|
17015 |
|
17016 |
|
17017 |
|
17018 |
|
17019 |
|
17020 |
|
17021 |
|
17022 |
|
17023 |
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 | axis_y_tick_count: undefined,
|
17029 | |
17030 |
|
17031 |
|
17032 |
|
17033 |
|
17034 |
|
17035 |
|
17036 |
|
17037 |
|
17038 |
|
17039 |
|
17040 |
|
17041 |
|
17042 |
|
17043 |
|
17044 |
|
17045 | axis_y_tick_show: !0,
|
17046 | |
17047 |
|
17048 |
|
17049 |
|
17050 |
|
17051 |
|
17052 |
|
17053 |
|
17054 |
|
17055 |
|
17056 |
|
17057 |
|
17058 |
|
17059 |
|
17060 |
|
17061 |
|
17062 |
|
17063 |
|
17064 | axis_y_tick_stepSize: null,
|
17065 | |
17066 |
|
17067 |
|
17068 |
|
17069 |
|
17070 |
|
17071 |
|
17072 |
|
17073 |
|
17074 |
|
17075 |
|
17076 |
|
17077 |
|
17078 |
|
17079 |
|
17080 |
|
17081 |
|
17082 |
|
17083 | axis_y_tick_text_show: !0,
|
17084 | |
17085 |
|
17086 |
|
17087 |
|
17088 |
|
17089 |
|
17090 |
|
17091 |
|
17092 |
|
17093 |
|
17094 |
|
17095 |
|
17096 |
|
17097 |
|
17098 |
|
17099 |
|
17100 |
|
17101 |
|
17102 |
|
17103 |
|
17104 | axis_y_tick_text_position: {
|
17105 | x: 0,
|
17106 | y: 0
|
17107 | },
|
17108 | |
17109 |
|
17110 |
|
17111 |
|
17112 |
|
17113 |
|
17114 |
|
17115 |
|
17116 |
|
17117 |
|
17118 |
|
17119 |
|
17120 |
|
17121 |
|
17122 |
|
17123 |
|
17124 |
|
17125 |
|
17126 |
|
17127 |
|
17128 |
|
17129 |
|
17130 |
|
17131 | axis_y_tick_time_value: undefined,
|
17132 | |
17133 |
|
17134 |
|
17135 |
|
17136 |
|
17137 |
|
17138 |
|
17139 |
|
17140 |
|
17141 |
|
17142 |
|
17143 |
|
17144 |
|
17145 |
|
17146 |
|
17147 |
|
17148 |
|
17149 |
|
17150 |
|
17151 |
|
17152 |
|
17153 |
|
17154 |
|
17155 |
|
17156 |
|
17157 | axis_y_padding: {},
|
17158 | |
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 |
|
17164 |
|
17165 |
|
17166 |
|
17167 |
|
17168 |
|
17169 |
|
17170 |
|
17171 |
|
17172 | axis_y_default: undefined,
|
17173 | |
17174 |
|
17175 |
|
17176 |
|
17177 |
|
17178 |
|
17179 |
|
17180 |
|
17181 |
|
17182 |
|
17183 |
|
17184 |
|
17185 |
|
17186 |
|
17187 |
|
17188 |
|
17189 |
|
17190 |
|
17191 |
|
17192 |
|
17193 |
|
17194 |
|
17195 |
|
17196 |
|
17197 |
|
17198 |
|
17199 |
|
17200 |
|
17201 |
|
17202 |
|
17203 |
|
17204 |
|
17205 |
|
17206 |
|
17207 |
|
17208 |
|
17209 |
|
17210 | axis_y_axes: []
|
17211 | });
|
17212 | ;
|
17213 |
|
17214 |
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 | var y2 = ({
|
17221 | |
17222 |
|
17223 |
|
17224 |
|
17225 |
|
17226 |
|
17227 |
|
17228 |
|
17229 |
|
17230 |
|
17231 |
|
17232 |
|
17233 |
|
17234 |
|
17235 |
|
17236 |
|
17237 | axis_y2_show: !1,
|
17238 | |
17239 |
|
17240 |
|
17241 |
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 |
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 |
|
17256 |
|
17257 |
|
17258 |
|
17259 |
|
17260 |
|
17261 |
|
17262 |
|
17263 | axis_y2_type: "indexed",
|
17264 | |
17265 |
|
17266 |
|
17267 |
|
17268 |
|
17269 |
|
17270 |
|
17271 |
|
17272 |
|
17273 |
|
17274 |
|
17275 |
|
17276 |
|
17277 | axis_y2_max: undefined,
|
17278 | |
17279 |
|
17280 |
|
17281 |
|
17282 |
|
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 |
|
17290 |
|
17291 | axis_y2_min: undefined,
|
17292 | |
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 |
|
17298 |
|
17299 |
|
17300 |
|
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 |
|
17306 | axis_y2_inverted: !1,
|
17307 | |
17308 |
|
17309 |
|
17310 |
|
17311 |
|
17312 |
|
17313 |
|
17314 |
|
17315 |
|
17316 |
|
17317 |
|
17318 |
|
17319 |
|
17320 | axis_y2_center: undefined,
|
17321 | |
17322 |
|
17323 |
|
17324 |
|
17325 |
|
17326 |
|
17327 |
|
17328 |
|
17329 |
|
17330 |
|
17331 |
|
17332 |
|
17333 |
|
17334 | axis_y2_inner: !1,
|
17335 | |
17336 |
|
17337 |
|
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 |
|
17357 |
|
17358 |
|
17359 | axis_y2_label: {},
|
17360 | |
17361 |
|
17362 |
|
17363 |
|
17364 |
|
17365 |
|
17366 |
|
17367 |
|
17368 |
|
17369 |
|
17370 |
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 |
|
17376 |
|
17377 | axis_y2_tick_format: undefined,
|
17378 | |
17379 |
|
17380 |
|
17381 |
|
17382 |
|
17383 |
|
17384 |
|
17385 |
|
17386 |
|
17387 |
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 | axis_y2_tick_culling: !1,
|
17398 | |
17399 |
|
17400 |
|
17401 |
|
17402 |
|
17403 |
|
17404 |
|
17405 |
|
17406 |
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 |
|
17412 |
|
17413 |
|
17414 |
|
17415 | axis_y2_tick_culling_max: 5,
|
17416 | |
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 |
|
17426 |
|
17427 |
|
17428 |
|
17429 |
|
17430 |
|
17431 |
|
17432 |
|
17433 | axis_y2_tick_culling_lines: !0,
|
17434 | |
17435 |
|
17436 |
|
17437 |
|
17438 |
|
17439 |
|
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 |
|
17446 |
|
17447 |
|
17448 |
|
17449 | axis_y2_tick_outer: !0,
|
17450 | |
17451 |
|
17452 |
|
17453 |
|
17454 |
|
17455 |
|
17456 |
|
17457 |
|
17458 |
|
17459 |
|
17460 |
|
17461 |
|
17462 |
|
17463 |
|
17464 |
|
17465 |
|
17466 |
|
17467 |
|
17468 |
|
17469 |
|
17470 | axis_y2_tick_values: null,
|
17471 | |
17472 |
|
17473 |
|
17474 |
|
17475 |
|
17476 |
|
17477 |
|
17478 |
|
17479 |
|
17480 |
|
17481 |
|
17482 |
|
17483 |
|
17484 |
|
17485 |
|
17486 |
|
17487 |
|
17488 | axis_y2_tick_rotate: 0,
|
17489 | |
17490 |
|
17491 |
|
17492 |
|
17493 |
|
17494 |
|
17495 |
|
17496 |
|
17497 |
|
17498 |
|
17499 |
|
17500 |
|
17501 |
|
17502 |
|
17503 |
|
17504 |
|
17505 | axis_y2_tick_count: undefined,
|
17506 | |
17507 |
|
17508 |
|
17509 |
|
17510 |
|
17511 |
|
17512 |
|
17513 |
|
17514 |
|
17515 |
|
17516 |
|
17517 |
|
17518 |
|
17519 |
|
17520 |
|
17521 |
|
17522 | axis_y2_tick_show: !0,
|
17523 | |
17524 |
|
17525 |
|
17526 |
|
17527 |
|
17528 |
|
17529 |
|
17530 |
|
17531 |
|
17532 |
|
17533 |
|
17534 |
|
17535 |
|
17536 |
|
17537 |
|
17538 |
|
17539 |
|
17540 |
|
17541 | axis_y2_tick_stepSize: null,
|
17542 | |
17543 |
|
17544 |
|
17545 |
|
17546 |
|
17547 |
|
17548 |
|
17549 |
|
17550 |
|
17551 |
|
17552 |
|
17553 |
|
17554 |
|
17555 |
|
17556 |
|
17557 |
|
17558 |
|
17559 |
|
17560 | axis_y2_tick_text_show: !0,
|
17561 | |
17562 |
|
17563 |
|
17564 |
|
17565 |
|
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 |
|
17571 |
|
17572 |
|
17573 |
|
17574 |
|
17575 |
|
17576 |
|
17577 |
|
17578 |
|
17579 |
|
17580 |
|
17581 | axis_y2_tick_text_position: {
|
17582 | x: 0,
|
17583 | y: 0
|
17584 | },
|
17585 | |
17586 |
|
17587 |
|
17588 |
|
17589 |
|
17590 |
|
17591 |
|
17592 |
|
17593 |
|
17594 |
|
17595 |
|
17596 |
|
17597 |
|
17598 |
|
17599 |
|
17600 |
|
17601 |
|
17602 |
|
17603 |
|
17604 |
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 | axis_y2_padding: {},
|
17610 | |
17611 |
|
17612 |
|
17613 |
|
17614 |
|
17615 |
|
17616 |
|
17617 |
|
17618 |
|
17619 |
|
17620 |
|
17621 |
|
17622 |
|
17623 |
|
17624 | axis_y2_default: undefined,
|
17625 | |
17626 |
|
17627 |
|
17628 |
|
17629 |
|
17630 |
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 |
|
17637 |
|
17638 |
|
17639 |
|
17640 |
|
17641 |
|
17642 |
|
17643 |
|
17644 |
|
17645 |
|
17646 |
|
17647 |
|
17648 |
|
17649 |
|
17650 |
|
17651 |
|
17652 |
|
17653 |
|
17654 |
|
17655 |
|
17656 |
|
17657 |
|
17658 |
|
17659 |
|
17660 |
|
17661 |
|
17662 | axis_y2_axes: []
|
17663 | });
|
17664 | ;
|
17665 |
|
17666 | function axis_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
17667 | function axis_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? axis_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : axis_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
17668 |
|
17669 |
|
17670 |
|
17671 |
|
17672 |
|
17673 |
|
17674 |
|
17675 |
|
17676 |
|
17677 |
|
17678 |
|
17679 | var axis_axis = (axis_objectSpread(axis_objectSpread(axis_objectSpread({
|
17680 | |
17681 |
|
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 |
|
17688 |
|
17689 |
|
17690 |
|
17691 | axis_rotated: !1
|
17692 | }, axis_x), y), y2));
|
17693 | ;
|
17694 |
|
17695 |
|
17696 |
|
17697 |
|
17698 |
|
17699 |
|
17700 |
|
17701 |
|
17702 | var common_grid = ({
|
17703 | |
17704 |
|
17705 |
|
17706 |
|
17707 |
|
17708 |
|
17709 |
|
17710 |
|
17711 |
|
17712 |
|
17713 |
|
17714 |
|
17715 |
|
17716 |
|
17717 |
|
17718 |
|
17719 |
|
17720 |
|
17721 |
|
17722 |
|
17723 |
|
17724 |
|
17725 |
|
17726 |
|
17727 |
|
17728 |
|
17729 |
|
17730 |
|
17731 |
|
17732 |
|
17733 |
|
17734 |
|
17735 |
|
17736 |
|
17737 |
|
17738 |
|
17739 |
|
17740 |
|
17741 |
|
17742 |
|
17743 |
|
17744 |
|
17745 |
|
17746 |
|
17747 |
|
17748 |
|
17749 |
|
17750 |
|
17751 |
|
17752 |
|
17753 |
|
17754 |
|
17755 |
|
17756 |
|
17757 |
|
17758 |
|
17759 |
|
17760 |
|
17761 | grid_x_show: !1,
|
17762 | grid_x_type: "tick",
|
17763 | grid_x_lines: [],
|
17764 | grid_y_show: !1,
|
17765 | grid_y_lines: [],
|
17766 | grid_y_ticks: undefined,
|
17767 | grid_focus_edge: !1,
|
17768 | grid_focus_show: !0,
|
17769 | grid_focus_y: !1,
|
17770 | grid_front: !1,
|
17771 | grid_lines_front: !0
|
17772 | });
|
17773 | ;
|
17774 |
|
17775 |
|
17776 |
|
17777 |
|
17778 |
|
17779 |
|
17780 |
|
17781 |
|
17782 |
|
17783 |
|
17784 |
|
17785 |
|
17786 |
|
17787 |
|
17788 |
|
17789 |
|
17790 |
|
17791 |
|
17792 |
|
17793 |
|
17794 |
|
17795 |
|
17796 |
|
17797 |
|
17798 |
|
17799 |
|
17800 |
|
17801 |
|
17802 |
|
17803 |
|
17804 | var api = [api_axis, api_category, grid_x, grid_y, flow, group, api_regions, x];
|
17805 | var internal = [Axis, clip, eventrect, interactions_flow, grid, region, size_axis];
|
17806 | var options = [data_axis, axis_axis, common_grid];
|
17807 |
|
17808 | var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(12);
|
17809 | ;
|
17810 |
|
17811 |
|
17812 |
|
17813 |
|
17814 |
|
17815 |
|
17816 |
|
17817 |
|
17818 |
|
17819 |
|
17820 |
|
17821 | var arc = ({
|
17822 | initPie: function initPie() {
|
17823 | var _this2 = this,
|
17824 | $$ = this,
|
17825 | config = $$.config,
|
17826 | dataType = config.data_type,
|
17827 | padding = config[dataType + "_padding"],
|
17828 | startingAngle = config[dataType + "_startingAngle"] || 0,
|
17829 | padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
|
17830 | $$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
|
17831 | var _this3 = this;
|
17832 | _newArrowCheck(this, _this2);
|
17833 | return d.values.reduce(function (a, b) {
|
17834 | _newArrowCheck(this, _this3);
|
17835 | return a + b.value;
|
17836 | }.bind(this), 0);
|
17837 | }.bind(this)).sort($$.getSortCompareFn.bind($$)(!0));
|
17838 | },
|
17839 | updateRadius: function updateRadius() {
|
17840 | var $$ = this,
|
17841 | config = $$.config,
|
17842 | state = $$.state,
|
17843 | dataType = config.data_type,
|
17844 | padding = config[dataType + "_padding"],
|
17845 | w = config.gauge_width || config.donut_width,
|
17846 | gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
17847 |
|
17848 | state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() && config.gauge_label_show ? .85 : 1);
|
17849 | state.radius = state.radiusExpanded * .95;
|
17850 | state.innerRadiusRatio = w ? (state.radius - w) / state.radius : .6;
|
17851 | state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
|
17852 | var innerRadius = config.pie_innerRadius || (padding ? padding * (state.innerRadiusRatio + .1) : 0);
|
17853 |
|
17854 |
|
17855 | state.outerRadius = config.pie_outerRadius;
|
17856 | state.innerRadius = $$.hasType("donut") || $$.hasType("gauge") ? state.radius * state.innerRadiusRatio : innerRadius;
|
17857 | },
|
17858 | |
17859 |
|
17860 |
|
17861 |
|
17862 |
|
17863 |
|
17864 | getRadius: function getRadius(d) {
|
17865 | var $$ = this,
|
17866 | data = d == null ? void 0 : d.data,
|
17867 | _$$$state = $$.state,
|
17868 | innerRadius = _$$$state.innerRadius,
|
17869 | outerRadius = _$$$state.outerRadius;
|
17870 | if (!isNumber(innerRadius) && data) {
|
17871 | innerRadius = innerRadius[data.id] || 0;
|
17872 | }
|
17873 | if (isObject(outerRadius) && data && data.id in outerRadius) {
|
17874 | outerRadius = outerRadius[data.id];
|
17875 | } else if (!isNumber(outerRadius)) {
|
17876 | outerRadius = $$.state.radius;
|
17877 | }
|
17878 | return {
|
17879 | innerRadius: innerRadius,
|
17880 | outerRadius: outerRadius
|
17881 | };
|
17882 | },
|
17883 | updateArc: function updateArc() {
|
17884 | var $$ = this;
|
17885 | $$.updateRadius();
|
17886 | $$.svgArc = $$.getSvgArc();
|
17887 | $$.svgArcExpanded = $$.getSvgArcExpanded();
|
17888 | },
|
17889 | getArcLength: function getArcLength() {
|
17890 | var $$ = this,
|
17891 | config = $$.config,
|
17892 | arcLengthInPercent = config.gauge_arcLength * 3.6,
|
17893 | len = 2 * (arcLengthInPercent / 360);
|
17894 | if (arcLengthInPercent < -360) {
|
17895 | len = -2;
|
17896 | } else if (arcLengthInPercent > 360) {
|
17897 | len = 2;
|
17898 | }
|
17899 | return len * Math.PI;
|
17900 | },
|
17901 | getStartAngle: function getStartAngle() {
|
17902 | var $$ = this,
|
17903 | config = $$.config,
|
17904 | isFullCircle = config.gauge_fullCircle,
|
17905 | defaultStartAngle = -1 * Math.PI / 2,
|
17906 | defaultEndAngle = Math.PI / 2,
|
17907 | startAngle = config.gauge_startingAngle;
|
17908 | if (!isFullCircle && startAngle <= defaultStartAngle) {
|
17909 | startAngle = defaultStartAngle;
|
17910 | } else if (!isFullCircle && startAngle >= defaultEndAngle) {
|
17911 | startAngle = defaultEndAngle;
|
17912 | } else if (startAngle > Math.PI || startAngle < -1 * Math.PI) {
|
17913 | startAngle = Math.PI;
|
17914 | }
|
17915 | return startAngle;
|
17916 | },
|
17917 | updateAngle: function updateAngle(dValue) {
|
17918 | var _this4 = this,
|
17919 | $$ = this,
|
17920 | config = $$.config,
|
17921 | state = $$.state,
|
17922 | pie = $$.pie,
|
17923 | d = dValue,
|
17924 | found = !1;
|
17925 | if (!config) {
|
17926 | return null;
|
17927 | }
|
17928 | var gStart = $$.getStartAngle(),
|
17929 | radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2;
|
17930 | if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
|
17931 | var min = config.gauge_min,
|
17932 | max = config.gauge_max,
|
17933 | totalSum = $$.getTotalDataSum(state.rendered);
|
17934 | pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - min) / (max - min)) + gStart);
|
17935 | }
|
17936 | pie($$.filterTargetsToShow()).forEach(function (t, i) {
|
17937 | _newArrowCheck(this, _this4);
|
17938 | if (!found && t.data.id === d.data.id) {
|
17939 | found = !0;
|
17940 | d = t;
|
17941 | d.index = i;
|
17942 | }
|
17943 | }.bind(this));
|
17944 | if (isNaN(d.startAngle)) {
|
17945 | d.startAngle = 0;
|
17946 | }
|
17947 | if (isNaN(d.endAngle)) {
|
17948 | d.endAngle = d.startAngle;
|
17949 | }
|
17950 | if (d.data && $$.hasMultiArcGauge()) {
|
17951 | var gMin = config.gauge_min,
|
17952 | gMax = config.gauge_max,
|
17953 | gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : gMax - gMin;
|
17954 | d.startAngle = gStart;
|
17955 | d.endAngle = gStart + radius / (gMax - gMin) * gValue;
|
17956 | }
|
17957 | return found ? d : null;
|
17958 | },
|
17959 | getSvgArc: function getSvgArc() {
|
17960 | var _this5 = this,
|
17961 | $$ = this,
|
17962 | state = $$.state,
|
17963 | singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
17964 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
17965 | hasPolar = $$.hasType("polar"),
|
17966 | arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
17967 | _newArrowCheck(this, _this5);
|
17968 | var _$$$getRadius = $$.getRadius(d),
|
17969 | innerRadius = _$$$getRadius.innerRadius;
|
17970 | return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
17971 | }.bind(this)).outerRadius(function (d) {
|
17972 | _newArrowCheck(this, _this5);
|
17973 | var _$$$getRadius2 = $$.getRadius(d),
|
17974 | outerRadius = _$$$getRadius2.outerRadius,
|
17975 | radius = outerRadius;
|
17976 | if (hasMultiArcGauge) {
|
17977 | radius = state.radius - singleArcWidth * d.index;
|
17978 | } else if (hasPolar) {
|
17979 | radius = $$.getPolarOuterRadius(d, outerRadius);
|
17980 | }
|
17981 | return radius;
|
17982 | }.bind(this)),
|
17983 | newArc = function (d, withoutUpdate) {
|
17984 | var path = "M 0 0";
|
17985 | if (d.value || d.data) {
|
17986 | var updated = !withoutUpdate && $$.updateAngle(d);
|
17987 | if (withoutUpdate) {
|
17988 | path = arc(d);
|
17989 | } else if (updated) {
|
17990 | path = arc(updated);
|
17991 | }
|
17992 | }
|
17993 | return path;
|
17994 | };
|
17995 |
|
17996 | newArc.centroid = arc.centroid;
|
17997 | return newArc;
|
17998 | },
|
17999 | getSvgArcExpanded: function getSvgArcExpanded(rate) {
|
18000 | var _this6 = this,
|
18001 | $$ = this,
|
18002 | state = $$.state,
|
18003 | newRate = rate || 1,
|
18004 | singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
18005 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
18006 | expandWidth = Math.min(state.radiusExpanded * newRate - state.radius, singleArcWidth * .8 - (1 - newRate) * 100),
|
18007 | arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
18008 | _newArrowCheck(this, _this6);
|
18009 | return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : $$.getRadius(d).innerRadius;
|
18010 | }.bind(this)).outerRadius(function (d) {
|
18011 | _newArrowCheck(this, _this6);
|
18012 | var radius;
|
18013 | if (hasMultiArcGauge) {
|
18014 | radius = state.radius - singleArcWidth * d.index + expandWidth;
|
18015 | } else {
|
18016 | var _$$$getRadius3 = $$.getRadius(d),
|
18017 | outerRadius = _$$$getRadius3.outerRadius,
|
18018 | radiusExpanded = state.radiusExpanded;
|
18019 | if (state.radius !== outerRadius) {
|
18020 | radiusExpanded -= Math.abs(state.radius - outerRadius);
|
18021 | }
|
18022 | radius = radiusExpanded * newRate;
|
18023 | }
|
18024 | return radius;
|
18025 | }.bind(this));
|
18026 | return function (d) {
|
18027 | var updated = $$.updateAngle(d);
|
18028 | return updated ? arc(updated) : "M 0 0";
|
18029 | };
|
18030 | },
|
18031 | getArc: function getArc(d, withoutUpdate, force) {
|
18032 | return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
18033 | },
|
18034 | |
18035 |
|
18036 |
|
18037 |
|
18038 |
|
18039 |
|
18040 | transformForArcLabel: function transformForArcLabel(d) {
|
18041 | var _this7 = this,
|
18042 | $$ = this,
|
18043 | config = $$.config,
|
18044 | radiusExpanded = $$.state.radiusExpanded,
|
18045 | updated = $$.updateAngle(d),
|
18046 | translate = "";
|
18047 | if (updated) {
|
18048 | if ($$.hasMultiArcGauge()) {
|
18049 | var y1 = Math.sin(updated.endAngle - Math.PI / 2),
|
18050 | x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + 25),
|
18051 | y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
18052 | translate = "translate(" + x + "," + y + ")";
|
18053 | } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
18054 | var _filter$map,
|
18055 | _$$$getRadius4 = $$.getRadius(d),
|
18056 | outerRadius = _$$$getRadius4.outerRadius;
|
18057 | if ($$.hasType("polar")) {
|
18058 | outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
18059 | }
|
18060 | var c = this.svgArc.centroid(updated),
|
18061 | _c$map = c.map(function (v) {
|
18062 | _newArrowCheck(this, _this7);
|
18063 | return isNaN(v) ? 0 : v;
|
18064 | }.bind(this)),
|
18065 | x = _c$map[0],
|
18066 | y = _c$map[1],
|
18067 | h = Math.sqrt(x * x + y * y),
|
18068 | ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
18069 | _newArrowCheck(this, _this7);
|
18070 | return config[v + "_label_ratio"];
|
18071 | }.bind(this))) == null ? void 0 : _filter$map[0];
|
18072 | if (ratio) {
|
18073 | ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
18074 | } else {
|
18075 | ratio = outerRadius && (h ? (36 / outerRadius > .375 ? 1.175 - 36 / outerRadius : .8) * outerRadius / h : 0);
|
18076 | }
|
18077 | translate = "translate(" + x * ratio + "," + y * ratio + ")";
|
18078 | }
|
18079 | }
|
18080 | return translate;
|
18081 | },
|
18082 | convertToArcData: function convertToArcData(d) {
|
18083 | return this.addName({
|
18084 | id: d.data ? d.data.id : d.id,
|
18085 | value: d.value,
|
18086 | ratio: this.getRatio("arc", d),
|
18087 | index: d.index
|
18088 | });
|
18089 | },
|
18090 | textForArcLabel: function textForArcLabel(selection) {
|
18091 | var $$ = this,
|
18092 | hasGauge = $$.hasType("gauge");
|
18093 | if ($$.shouldShowArcLabel()) {
|
18094 | selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) {
|
18095 | var _filter,
|
18096 | node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
18097 | updated = $$.updateAngle(d),
|
18098 | ratio = $$.getRatio("arc", updated),
|
18099 | isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
|
18100 | if (isUnderThreshold) {
|
18101 | var value = (updated || d).value,
|
18102 | text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
18103 | setTextValue(node, text, [-1, 1], hasGauge);
|
18104 | } else {
|
18105 | node.text("");
|
18106 | }
|
18107 | });
|
18108 | }
|
18109 | },
|
18110 | expandArc: function expandArc(targetIds) {
|
18111 | var _this8 = this,
|
18112 | $$ = this,
|
18113 | transiting = $$.state.transiting,
|
18114 | $el = $$.$el;
|
18115 |
|
18116 | if (transiting) {
|
18117 | var interval = setInterval(function () {
|
18118 | _newArrowCheck(this, _this8);
|
18119 | if (!transiting) {
|
18120 | clearInterval(interval);
|
18121 | $el.legend.selectAll("." + $FOCUS.legendItemFocused).size() > 0 && $$.expandArc(targetIds);
|
18122 | }
|
18123 | }.bind(this), 10);
|
18124 | return;
|
18125 | }
|
18126 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
18127 | $el.svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).each(function (d) {
|
18128 | if (!$$.shouldExpand(d.data.id)) {
|
18129 | return;
|
18130 | }
|
18131 | var expandDuration = $$.getExpandConfig(d.data.id, "duration"),
|
18132 | svgArcExpandedSub = $$.getSvgArcExpanded($$.getExpandConfig(d.data.id, "rate"));
|
18133 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).selectAll("path").transition().duration(expandDuration).attr("d", $$.svgArcExpanded).transition().duration(expandDuration * 2).attr("d", svgArcExpandedSub);
|
18134 | });
|
18135 | },
|
18136 | unexpandArc: function unexpandArc(targetIds) {
|
18137 | var _this9 = this,
|
18138 | $$ = this,
|
18139 | transiting = $$.state.transiting,
|
18140 | svg = $$.$el.svg;
|
18141 | if (transiting) {
|
18142 | return;
|
18143 | }
|
18144 | var newTargetIds = $$.mapToTargetIds(targetIds);
|
18145 | svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).selectAll("path").transition().duration(function (d) {
|
18146 | _newArrowCheck(this, _this9);
|
18147 | return $$.getExpandConfig(d.data.id, "duration");
|
18148 | }.bind(this)).attr("d", $$.svgArc);
|
18149 | svg.selectAll("" + $ARC.arc).style("opacity", null);
|
18150 | },
|
18151 | |
18152 |
|
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 |
|
18158 | getExpandConfig: function getExpandConfig(id, key) {
|
18159 | var $$ = this,
|
18160 | config = $$.config,
|
18161 | type;
|
18162 | if ($$.isDonutType(id)) {
|
18163 | type = "donut";
|
18164 | } else if ($$.isGaugeType(id)) {
|
18165 | type = "gauge";
|
18166 | } else if ($$.isPieType(id)) {
|
18167 | type = "pie";
|
18168 | }
|
18169 | return type ? config[type + "_expand_" + key] : {
|
18170 | duration: 50,
|
18171 | rate: .98
|
18172 | }[key];
|
18173 | },
|
18174 | shouldExpand: function shouldExpand(id) {
|
18175 | var $$ = this,
|
18176 | config = $$.config;
|
18177 | return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
|
18178 | },
|
18179 | shouldShowArcLabel: function shouldShowArcLabel() {
|
18180 | var _this10 = this,
|
18181 | $$ = this,
|
18182 | config = $$.config;
|
18183 | return ["donut", "gauge", "pie", "polar"].some(function (v) {
|
18184 | _newArrowCheck(this, _this10);
|
18185 | return $$.hasType(v) && config[v + "_label_show"];
|
18186 | }.bind(this));
|
18187 | },
|
18188 | getArcLabelFormat: function getArcLabelFormat() {
|
18189 | var _this11 = this,
|
18190 | $$ = this,
|
18191 | config = $$.config,
|
18192 | format = function (v) {
|
18193 | _newArrowCheck(this, _this11);
|
18194 | return v;
|
18195 | }.bind(this);
|
18196 | ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
|
18197 | _newArrowCheck(this, _this11);
|
18198 | format = config[v + "_label_format"];
|
18199 | }.bind(this));
|
18200 | return isFunction(format) ? format.bind($$.api) : format;
|
18201 | },
|
18202 | getArcTitle: function getArcTitle() {
|
18203 | var $$ = this,
|
18204 | type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
|
18205 | return type ? $$.config[type + "_title"] : "";
|
18206 | },
|
18207 | updateTargetsForArc: function updateTargetsForArc(targets) {
|
18208 | var _this12 = this,
|
18209 | $$ = this,
|
18210 | $el = $$.$el,
|
18211 | hasGauge = $$.hasType("gauge"),
|
18212 | classChartArc = $$.getChartClass("Arc"),
|
18213 | classArcs = $$.getClass("arcs", !0),
|
18214 | classFocus = $$.classFocus.bind($$),
|
18215 | chartArcs = $el.main.select("." + $ARC.chartArcs),
|
18216 | mainPieUpdate = chartArcs.selectAll("." + $ARC.chartArc).data($$.pie(targets)).attr("class", function (d) {
|
18217 | _newArrowCheck(this, _this12);
|
18218 | return classChartArc(d) + classFocus(d.data);
|
18219 | }.bind(this)),
|
18220 | mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc).call(this.setCssRule(!1, "." + $ARC.chartArcs + " text", ["pointer-events:none", "text-anchor:middle"]));
|
18221 | mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate);
|
18222 | mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : ".35em").style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
|
18223 | $el.text = chartArcs.selectAll("." + $COMMON.target + " text");
|
18224 |
|
18225 |
|
18226 | },
|
18227 | initArc: function initArc() {
|
18228 | var $$ = this,
|
18229 | $el = $$.$el;
|
18230 | $el.arcs = $el.main.select("." + $COMMON.chart).append("g").attr("class", $ARC.chartArcs).attr("transform", $$.getTranslate("arc"));
|
18231 | $$.setArcTitle();
|
18232 | },
|
18233 | |
18234 |
|
18235 |
|
18236 |
|
18237 | setArcTitle: function setArcTitle() {
|
18238 | var $$ = this,
|
18239 | title = $$.getArcTitle(),
|
18240 | hasGauge = $$.hasType("gauge");
|
18241 | if (title) {
|
18242 | var text = $$.$el.arcs.append("text").attr("class", hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle).style("text-anchor", "middle");
|
18243 | hasGauge && text.attr("dy", "-0.3em");
|
18244 | setTextValue(text, title, hasGauge ? undefined : [-.6, 1.35], !0);
|
18245 | }
|
18246 | },
|
18247 | redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
18248 | var _this13 = this,
|
18249 | $$ = this,
|
18250 | config = $$.config,
|
18251 | state = $$.state,
|
18252 | main = $$.$el.main,
|
18253 | hasInteraction = config.interaction_enabled,
|
18254 | isSelectable = hasInteraction && config.data_selection_isselectable,
|
18255 | mainArc = main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arc).data($$.arcData.bind($$));
|
18256 | mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove();
|
18257 | mainArc = mainArc.enter().append("path").attr("class", $$.getClass("arc", !0)).style("fill", function (d) {
|
18258 | _newArrowCheck(this, _this13);
|
18259 | return $$.color(d.data);
|
18260 | }.bind(this)).style("cursor", function (d) {
|
18261 | _newArrowCheck(this, _this13);
|
18262 | return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null;
|
18263 | }.bind(this)).style("opacity", "0").each(function (d) {
|
18264 | if ($$.isGaugeType(d.data)) {
|
18265 | d.startAngle = config.gauge_startingAngle;
|
18266 | d.endAngle = config.gauge_startingAngle;
|
18267 | }
|
18268 | this._current = d;
|
18269 | }).merge(mainArc);
|
18270 | if ($$.hasType("gauge")) {
|
18271 | $$.updateGaugeMax();
|
18272 | $$.hasMultiArcGauge() && $$.redrawMultiArcGauge();
|
18273 | }
|
18274 | mainArc.attr("transform", function (d) {
|
18275 | _newArrowCheck(this, _this13);
|
18276 | return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
|
18277 | }.bind(this)).style("opacity", function (d) {
|
18278 | return d === this._current ? "0" : null;
|
18279 | }).each(function () {
|
18280 | _newArrowCheck(this, _this13);
|
18281 | state.transiting = !0;
|
18282 | }.bind(this)).transition().duration(duration).attrTween("d", function (d) {
|
18283 | var _this14 = this,
|
18284 | updated = $$.updateAngle(d);
|
18285 | if (!updated) {
|
18286 | return function () {
|
18287 | _newArrowCheck(this, _this14);
|
18288 | return "M 0 0";
|
18289 | }.bind(this);
|
18290 | }
|
18291 | if (isNaN(this._current.startAngle)) {
|
18292 | this._current.startAngle = 0;
|
18293 | }
|
18294 | if (isNaN(this._current.endAngle)) {
|
18295 | this._current.endAngle = this._current.startAngle;
|
18296 | }
|
18297 | var interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(this._current, updated);
|
18298 | this._current = interpolate(0);
|
18299 | return function (t) {
|
18300 | var interpolated = interpolate(t);
|
18301 | interpolated.data = d.data;
|
18302 |
|
18303 | return $$.getArc(interpolated, !0);
|
18304 | };
|
18305 | }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
|
18306 | _newArrowCheck(this, _this13);
|
18307 | var color;
|
18308 | if ($$.levelColor) {
|
18309 | color = $$.levelColor(d.data.values[0].value);
|
18310 |
|
18311 |
|
18312 | config.data_colors[d.data.id] = color;
|
18313 | } else {
|
18314 | color = $$.color(d.data);
|
18315 | }
|
18316 | return color;
|
18317 | }.bind(this))
|
18318 |
|
18319 | .style("opacity", null).call(endall, function () {
|
18320 | if ($$.levelColor) {
|
18321 | var path = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
18322 | d = path.datum();
|
18323 | $$.updateLegendItemColor(d.data.id, path.style("fill"));
|
18324 | }
|
18325 | state.transiting = !1;
|
18326 | callFn(config.onrendered, $$.api);
|
18327 | });
|
18328 |
|
18329 |
|
18330 | hasInteraction && $$.bindArcEvent(mainArc);
|
18331 | $$.hasType("polar") && $$.redrawPolar();
|
18332 | $$.hasType("gauge") && $$.redrawBackgroundArcs();
|
18333 | $$.redrawArcText(duration);
|
18334 | },
|
18335 | redrawBackgroundArcs: function redrawBackgroundArcs() {
|
18336 | var _this15 = this,
|
18337 | $$ = this,
|
18338 | config = $$.config,
|
18339 | state = $$.state,
|
18340 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
18341 | isFullCircle = config.gauge_fullCircle,
|
18342 | startAngle = $$.getStartAngle(),
|
18343 | endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1,
|
18344 | backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
|
18345 | if (hasMultiArcGauge) {
|
18346 | var index = 0;
|
18347 | backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets);
|
18348 | backgroundArc.enter().append("path").attr("class", function (d, i) {
|
18349 | _newArrowCheck(this, _this15);
|
18350 | return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i;
|
18351 | }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
|
18352 | var id = _ref2.id;
|
18353 | _newArrowCheck(this, _this15);
|
18354 | if (state.hiddenTargetIds.indexOf(id) >= 0) {
|
18355 | return "M 0 0";
|
18356 | }
|
18357 | var d = {
|
18358 | data: [{
|
18359 | value: config.gauge_max
|
18360 | }],
|
18361 | startAngle: startAngle,
|
18362 | endAngle: endAngle,
|
18363 | index: index++
|
18364 | };
|
18365 | return $$.getArc(d, !0, !0);
|
18366 | }.bind(this));
|
18367 | backgroundArc.exit().remove();
|
18368 | } else {
|
18369 | backgroundArc.attr("d", function () {
|
18370 | _newArrowCheck(this, _this15);
|
18371 | var d = {
|
18372 | data: [{
|
18373 | value: config.gauge_max
|
18374 | }],
|
18375 | startAngle: startAngle,
|
18376 | endAngle: endAngle
|
18377 | };
|
18378 | return $$.getArc(d, !0, !0);
|
18379 | }.bind(this));
|
18380 | }
|
18381 | },
|
18382 | bindArcEvent: function bindArcEvent(arc) {
|
18383 | var _this16 = this,
|
18384 | $$ = this,
|
18385 | config = $$.config,
|
18386 | state = $$.state,
|
18387 | isTouch = state.inputType === "touch",
|
18388 | isMouse = state.inputType === "mouse";
|
18389 |
|
18390 | function selectArc(_this, arcData, id) {
|
18391 |
|
18392 | $$.expandArc(id);
|
18393 | $$.api.focus(id);
|
18394 | $$.toggleFocusLegend(id, !0);
|
18395 | $$.showTooltip([arcData], _this);
|
18396 | }
|
18397 |
|
18398 |
|
18399 | function unselectArc(arcData) {
|
18400 | var id = (arcData == null ? void 0 : arcData.id) || undefined;
|
18401 | $$.unexpandArc(id);
|
18402 | $$.api.revert();
|
18403 | $$.revertLegend();
|
18404 | $$.hideTooltip();
|
18405 | }
|
18406 | arc.on("click", function (event, d, i) {
|
18407 | var updated = $$.updateAngle(d),
|
18408 | arcData;
|
18409 | if (updated) {
|
18410 | arcData = $$.convertToArcData(updated);
|
18411 | $$.toggleShape == null ? void 0 : $$.toggleShape(this, arcData, i);
|
18412 | config.data_onclick.bind($$.api)(arcData, this);
|
18413 | }
|
18414 | });
|
18415 |
|
18416 |
|
18417 | if (isMouse) {
|
18418 | arc.on("mouseover", function (event, d) {
|
18419 | var _arcData;
|
18420 | if (state.transiting) {
|
18421 |
|
18422 | return;
|
18423 | }
|
18424 | state.event = event;
|
18425 | var updated = $$.updateAngle(d),
|
18426 | arcData = updated ? $$.convertToArcData(updated) : null,
|
18427 | id = ((_arcData = arcData) == null ? void 0 : _arcData.id) || undefined;
|
18428 | selectArc(this, arcData, id);
|
18429 | $$.setOverOut(!0, arcData);
|
18430 | }).on("mouseout", function (event, d) {
|
18431 | _newArrowCheck(this, _this16);
|
18432 | if (state.transiting) {
|
18433 |
|
18434 | return;
|
18435 | }
|
18436 | state.event = event;
|
18437 | var updated = $$.updateAngle(d),
|
18438 | arcData = updated ? $$.convertToArcData(updated) : null;
|
18439 | unselectArc();
|
18440 | $$.setOverOut(!1, arcData);
|
18441 | }.bind(this)).on("mousemove", function (event, d) {
|
18442 | var updated = $$.updateAngle(d),
|
18443 | arcData = updated ? $$.convertToArcData(updated) : null;
|
18444 | state.event = event;
|
18445 | $$.showTooltip([arcData], this);
|
18446 | });
|
18447 | }
|
18448 |
|
18449 |
|
18450 | if (isTouch && $$.hasArcType() && !$$.radars) {
|
18451 | var getEventArc = function (event) {
|
18452 | _newArrowCheck(this, _this16);
|
18453 | var touch = event.changedTouches[0],
|
18454 | eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
|
18455 | return eventArc;
|
18456 | }.bind(this);
|
18457 | $$.$el.svg.on("touchstart touchmove", function (event) {
|
18458 | var _datum, _arcData2;
|
18459 | if (state.transiting) {
|
18460 |
|
18461 | return;
|
18462 | }
|
18463 | state.event = event;
|
18464 | var eventArc = getEventArc(event),
|
18465 | datum = eventArc.datum(),
|
18466 | updated = (_datum = datum) != null && _datum.data && datum.data.id ? $$.updateAngle(datum) : null,
|
18467 | arcData = updated ? $$.convertToArcData(updated) : null,
|
18468 | id = ((_arcData2 = arcData) == null ? void 0 : _arcData2.id) || undefined;
|
18469 | $$.callOverOutForTouch(arcData);
|
18470 | isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
18471 | });
|
18472 | }
|
18473 | },
|
18474 | redrawArcText: function redrawArcText(duration) {
|
18475 | var _this17 = this,
|
18476 | $$ = this,
|
18477 | config = $$.config,
|
18478 | state = $$.state,
|
18479 | _$$$$el = $$.$el,
|
18480 | main = _$$$$el.main,
|
18481 | arcs = _$$$$el.arcs,
|
18482 | hasGauge = $$.hasType("gauge"),
|
18483 | hasMultiArcGauge = $$.hasMultiArcGauge(),
|
18484 | text;
|
18485 |
|
18486 | if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
18487 | text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
|
18488 | _newArrowCheck(this, _this17);
|
18489 | return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null;
|
18490 | }.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
|
18491 | _newArrowCheck(this, _this17);
|
18492 | return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
|
18493 | }.bind(this)).transition().duration(duration).style("opacity", function (d) {
|
18494 | _newArrowCheck(this, _this17);
|
18495 | return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0";
|
18496 | }.bind(this));
|
18497 | hasMultiArcGauge && text.attr("dy", "-.1em");
|
18498 | }
|
18499 | main.select("." + $ARC.chartArcsTitle).style("opacity", $$.hasType("donut") || hasGauge ? null : "0");
|
18500 | if (hasGauge) {
|
18501 | var _text,
|
18502 | isFullCircle = config.gauge_fullCircle;
|
18503 | isFullCircle && ((_text = text) == null ? void 0 : _text.attr("dy", "" + (hasMultiArcGauge ? 0 : Math.round(state.radius / 14))));
|
18504 | if (config.gauge_label_show) {
|
18505 | arcs.select("." + $GAUGE.chartArcsGaugeUnit).attr("dy", (isFullCircle ? 1.5 : .75) + "em").text(config.gauge_units);
|
18506 | arcs.select("." + $GAUGE.chartArcsGaugeMin).attr("dx", -1 * (state.innerRadius + (state.radius - state.innerRadius) / (isFullCircle ? 1 : 2)) + "px").attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_min, !1));
|
18507 |
|
18508 |
|
18509 | isFullCircle || arcs.select("." + $GAUGE.chartArcsGaugeMax).attr("dx", state.innerRadius + (state.radius - state.innerRadius) / 2 + "px").attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0));
|
18510 | }
|
18511 | }
|
18512 | }
|
18513 | });
|
18514 | ;
|
18515 |
|
18516 |
|
18517 |
|
18518 |
|
18519 |
|
18520 |
|
18521 |
|
18522 |
|
18523 |
|
18524 | var shape_area = ({
|
18525 | initArea: function initArea(mainLine) {
|
18526 | var $$ = this,
|
18527 | config = $$.config;
|
18528 | mainLine.insert("g", "." + (config.area_front ? $CIRCLE.circles : $LINE.lines)).attr("class", $$.getClass("areas", !0));
|
18529 | },
|
18530 | |
18531 |
|
18532 |
|
18533 |
|
18534 |
|
18535 |
|
18536 | updateAreaColor: function updateAreaColor(d) {
|
18537 | var $$ = this;
|
18538 | return $$.config.area_linearGradient ? $$.getGradienColortUrl(d.id) : $$.color(d);
|
18539 | },
|
18540 | |
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 | updateArea: function updateArea(withTransition, isSub) {
|
18547 | if (isSub === void 0) {
|
18548 | isSub = !1;
|
18549 | }
|
18550 | var $$ = this,
|
18551 | config = $$.config,
|
18552 | state = $$.state,
|
18553 | $el = $$.$el,
|
18554 | $T = $$.$T,
|
18555 | $root = isSub ? $el.subchart : $el;
|
18556 | config.area_linearGradient && $$.updateLinearGradient();
|
18557 | var area = $root.main.selectAll("." + $AREA.areas).selectAll("." + $AREA.area).data($$.lineData.bind($$));
|
18558 | $T(area.exit(), withTransition).style("opacity", "0").remove();
|
18559 | $root.area = area.enter().append("path").attr("class", $$.getClass("area", !0)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () {
|
18560 | state.orgAreaOpacity = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).style("opacity");
|
18561 | return "0";
|
18562 | }).merge(area);
|
18563 | area.style("opacity", state.orgAreaOpacity);
|
18564 | },
|
18565 | |
18566 |
|
18567 |
|
18568 |
|
18569 |
|
18570 |
|
18571 |
|
18572 | redrawArea: function redrawArea(drawFn, withTransition, isSub) {
|
18573 | var _this = this;
|
18574 | if (isSub === void 0) {
|
18575 | isSub = !1;
|
18576 | }
|
18577 | var $$ = this,
|
18578 | _ref = isSub ? this.$el.subchart : this.$el,
|
18579 | area = _ref.area,
|
18580 | orgAreaOpacity = $$.state.orgAreaOpacity;
|
18581 | return [$$.$T(area, withTransition, getRandom()).attr("d", drawFn).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function (d) {
|
18582 | _newArrowCheck(this, _this);
|
18583 | return ($$.isAreaRangeType(d) ? orgAreaOpacity / 1.75 : orgAreaOpacity) + "";
|
18584 | }.bind(this))];
|
18585 | },
|
18586 | |
18587 |
|
18588 |
|
18589 |
|
18590 |
|
18591 |
|
18592 |
|
18593 | generateDrawArea: function generateDrawArea(areaIndices, isSub) {
|
18594 | var _this2 = this,
|
18595 | $$ = this,
|
18596 | config = $$.config,
|
18597 | lineConnectNull = config.line_connectNull,
|
18598 | isRotated = config.axis_rotated,
|
18599 | getPoints = $$.generateGetAreaPoints(areaIndices, isSub),
|
18600 | yScale = $$.getYScaleById.bind($$),
|
18601 | xValue = function (d) {
|
18602 | _newArrowCheck(this, _this2);
|
18603 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
18604 | }.bind(this),
|
18605 | value0 = function (d, i) {
|
18606 | _newArrowCheck(this, _this2);
|
18607 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : $$.getShapeYMin(d.id));
|
18608 | }.bind(this),
|
18609 | value1 = function (d, i) {
|
18610 | _newArrowCheck(this, _this2);
|
18611 | return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d.value);
|
18612 | }.bind(this);
|
18613 | return function (d) {
|
18614 | var _this3 = this;
|
18615 | _newArrowCheck(this, _this2);
|
18616 | var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
18617 | x0 = 0,
|
18618 | y0 = 0,
|
18619 | path;
|
18620 | if ($$.isAreaType(d)) {
|
18621 | var area = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.area)();
|
18622 | area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? $$.state.height : value0).y1(value1);
|
18623 | if (!lineConnectNull) {
|
18624 | area = area.defined(function (d) {
|
18625 | _newArrowCheck(this, _this3);
|
18626 | return $$.getBaseValue(d) !== null;
|
18627 | }.bind(this));
|
18628 | }
|
18629 | if ($$.isStepType(d)) {
|
18630 | values = $$.convertValuesToStep(values);
|
18631 | }
|
18632 | path = area.curve($$.getCurve(d))(values);
|
18633 | } else {
|
18634 | if (values[0]) {
|
18635 | x0 = $$.scale.x(values[0].x);
|
18636 | y0 = $$.getYScaleById(d.id)(values[0].value);
|
18637 | }
|
18638 | path = isRotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0;
|
18639 | }
|
18640 | return path || "M 0 0";
|
18641 | }.bind(this);
|
18642 | },
|
18643 | generateGetAreaPoints: function generateGetAreaPoints(areaIndices, isSub) {
|
18644 |
|
18645 | var $$ = this,
|
18646 | config = $$.config,
|
18647 | x = $$.getShapeX(0, areaIndices, isSub),
|
18648 | y = $$.getShapeY(!!isSub),
|
18649 | areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, isSub),
|
18650 | yScale = $$.getYScaleById.bind($$);
|
18651 | return function (d, i) {
|
18652 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
18653 | offset = areaOffset(d, i) || y0,
|
18654 | posX = x(d),
|
18655 | value = d.value,
|
18656 | posY = y(d);
|
18657 |
|
18658 | if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
|
18659 | posY = y0;
|
18660 | }
|
18661 |
|
18662 |
|
18663 | return [[posX, offset], [posX, posY - (y0 - offset)], [posX, posY - (y0 - offset)],
|
18664 |
|
18665 | [posX, offset]
|
18666 | ];
|
18667 | };
|
18668 | }
|
18669 | });
|
18670 | ;
|
18671 |
|
18672 |
|
18673 |
|
18674 |
|
18675 |
|
18676 |
|
18677 |
|
18678 |
|
18679 | var bar = ({
|
18680 | initBar: function initBar() {
|
18681 | var $el = this.$el,
|
18682 | config = this.config,
|
18683 | clip = this.state.clip;
|
18684 | $el.bar = $el.main.select("." + $COMMON.chart)
|
18685 |
|
18686 | .insert("g", ":first-child").attr("class", $BAR.chartBars).call(this.setCssRule(!1, "." + $BAR.chartBars, ["pointer-events:none"]));
|
18687 |
|
18688 |
|
18689 |
|
18690 | if (config.clipPath === !1 && (config.bar_radius || config.bar_radius_ratio)) {
|
18691 | $el.bar.attr("clip-path", clip.pathXAxis.replace(/#[^)]*/, "#" + clip.id));
|
18692 | }
|
18693 | },
|
18694 | updateTargetsForBar: function updateTargetsForBar(targets) {
|
18695 | var _this = this,
|
18696 | $$ = this,
|
18697 | config = $$.config,
|
18698 | $el = $$.$el,
|
18699 | classChartBar = $$.getChartClass("Bar"),
|
18700 | classBars = $$.getClass("bars", !0),
|
18701 | classFocus = $$.classFocus.bind($$),
|
18702 | isSelectable = config.interaction_enabled && config.data_selection_isselectable;
|
18703 | if (!$el.bar) {
|
18704 | $$.initBar();
|
18705 | }
|
18706 | var mainBarUpdate = $$.$el.main.select("." + $BAR.chartBars).selectAll("." + $BAR.chartBar).data(
|
18707 |
|
18708 | targets.filter(function (v) {
|
18709 | var _this2 = this;
|
18710 | _newArrowCheck(this, _this);
|
18711 | return v.values.some(function (d) {
|
18712 | _newArrowCheck(this, _this2);
|
18713 | return isNumber(d.value) || $$.isBarRangeType(d);
|
18714 | }.bind(this));
|
18715 | }.bind(this))).attr("class", function (d) {
|
18716 | _newArrowCheck(this, _this);
|
18717 | return classChartBar(d) + classFocus(d);
|
18718 | }.bind(this)),
|
18719 | mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", $$.getStylePropValue("none"));
|
18720 |
|
18721 | mainBarEnter.append("g").attr("class", classBars).style("cursor", function (d) {
|
18722 | _newArrowCheck(this, _this);
|
18723 | return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null;
|
18724 | }.bind(this)).call($$.setCssRule(!0, " ." + $BAR.bar, ["fill"], $$.color));
|
18725 | },
|
18726 | |
18727 |
|
18728 |
|
18729 |
|
18730 |
|
18731 |
|
18732 | updateBar: function updateBar(withTransition, isSub) {
|
18733 | if (isSub === void 0) {
|
18734 | isSub = !1;
|
18735 | }
|
18736 | var $$ = this,
|
18737 | config = $$.config,
|
18738 | $el = $$.$el,
|
18739 | $T = $$.$T,
|
18740 | $root = isSub ? $el.subchart : $el,
|
18741 | classBar = $$.getClass("bar", !0),
|
18742 | initialOpacity = $$.initialOpacity.bind($$);
|
18743 | config.bar_linearGradient && $$.updateLinearGradient();
|
18744 | var bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$));
|
18745 | $T(bar.exit(), withTransition).style("opacity", "0").remove();
|
18746 | $root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.updateBarColor.bind($$)).merge(bar).style("opacity", initialOpacity);
|
18747 | },
|
18748 | |
18749 |
|
18750 |
|
18751 |
|
18752 |
|
18753 |
|
18754 | updateBarColor: function updateBarColor(d) {
|
18755 | var $$ = this,
|
18756 | fn = $$.getStylePropValue($$.color);
|
18757 | return $$.config.bar_linearGradient ? $$.getGradienColortUrl(d.id) : fn ? fn(d) : null;
|
18758 | },
|
18759 | |
18760 |
|
18761 |
|
18762 |
|
18763 |
|
18764 |
|
18765 |
|
18766 |
|
18767 | redrawBar: function redrawBar(drawFn, withTransition, isSub) {
|
18768 | var _this3 = this;
|
18769 | if (isSub === void 0) {
|
18770 | isSub = !1;
|
18771 | }
|
18772 | var $$ = this,
|
18773 | _ref = isSub ? $$.$el.subchart : $$.$el,
|
18774 | bar = _ref.bar;
|
18775 | return [$$.$T(bar, withTransition, getRandom()).attr("d", function (d) {
|
18776 | _newArrowCheck(this, _this3);
|
18777 | return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d);
|
18778 | }.bind(this)).style("fill", $$.updateBarColor.bind($$)).style("opacity", null)];
|
18779 | },
|
18780 | |
18781 |
|
18782 |
|
18783 |
|
18784 |
|
18785 |
|
18786 |
|
18787 |
|
18788 |
|
18789 |
|
18790 |
|
18791 |
|
18792 |
|
18793 |
|
18794 |
|
18795 |
|
18796 |
|
18797 |
|
18798 |
|
18799 |
|
18800 | generateDrawBar: function generateDrawBar(barIndices, isSub) {
|
18801 | var _this4 = this,
|
18802 | $$ = this,
|
18803 | config = $$.config,
|
18804 | getPoints = $$.generateGetBarPoints(barIndices, isSub),
|
18805 | isRotated = config.axis_rotated,
|
18806 | barRadius = config.bar_radius,
|
18807 | barRadiusRatio = config.bar_radius_ratio,
|
18808 | getRadius = isNumber(barRadius) && barRadius > 0 ? function () {
|
18809 | _newArrowCheck(this, _this4);
|
18810 | return barRadius;
|
18811 | }.bind(this) : isNumber(barRadiusRatio) ? function (w) {
|
18812 | _newArrowCheck(this, _this4);
|
18813 | return w * barRadiusRatio;
|
18814 | }.bind(this) : null;
|
18815 | return function (d, i) {
|
18816 | _newArrowCheck(this, _this4);
|
18817 |
|
18818 | var points = getPoints(d, i),
|
18819 | indexX = +isRotated,
|
18820 | indexY = +!indexX,
|
18821 | isNegative = d.value < 0,
|
18822 | pathRadius = ["", ""],
|
18823 | radius = 0,
|
18824 | isGrouped = $$.isGrouped(d.id),
|
18825 | isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : !1;
|
18826 | if (getRadius && (!isGrouped || isRadiusData)) {
|
18827 | var index = isRotated ? indexY : indexX,
|
18828 | barW = points[2][index] - points[0][index];
|
18829 | radius = getRadius(barW);
|
18830 | var arc = "a" + radius + "," + radius + " " + (isNegative ? "1 0 0" : "0 0 1") + " ";
|
18831 | pathRadius[+!isRotated] = "" + arc + radius + "," + radius;
|
18832 | pathRadius[+isRotated] = "" + arc + [-radius, radius][isRotated ? "sort" : "reverse"]();
|
18833 | isNegative && pathRadius.reverse();
|
18834 | }
|
18835 |
|
18836 |
|
18837 |
|
18838 | var path = isRotated ? "H" + (points[1][indexX] - radius) + " " + pathRadius[0] + "V" + (points[2][indexY] - radius) + " " + pathRadius[1] + "H" + points[3][indexX] : "V" + (points[1][indexY] + (isNegative ? -radius : radius)) + " " + pathRadius[0] + "H" + (points[2][indexX] - radius) + " " + pathRadius[1] + "V" + points[3][indexY];
|
18839 | return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
|
18840 | }.bind(this);
|
18841 | },
|
18842 | |
18843 |
|
18844 |
|
18845 |
|
18846 |
|
18847 | isStackingRadiusData: function isStackingRadiusData(d) {
|
18848 | var _this5 = this,
|
18849 | $$ = this,
|
18850 | $el = $$.$el,
|
18851 | config = $$.config,
|
18852 | data = $$.data,
|
18853 | state = $$.state,
|
18854 | id = d.id,
|
18855 | index = d.index,
|
18856 | value = d.value;
|
18857 |
|
18858 | if (state.hiddenTargetIds.indexOf(id) > -1) {
|
18859 | var target = $el.bar.filter(function (d) {
|
18860 | _newArrowCheck(this, _this5);
|
18861 | return d.id === id && d.value === value;
|
18862 | }.bind(this));
|
18863 | return !target.empty() && /a\d+/i.test(target.attr("d"));
|
18864 | }
|
18865 |
|
18866 |
|
18867 | var keys = config.data_groups.find(function (v) {
|
18868 | _newArrowCheck(this, _this5);
|
18869 | return v.indexOf(id) > -1;
|
18870 | }.bind(this)),
|
18871 | sortedList = $$.orderTargets($$.filterTargetsToShow(data.targets.filter($$.isBarType, $$))).filter(function (v) {
|
18872 | _newArrowCheck(this, _this5);
|
18873 | return keys.indexOf(v.id) > -1;
|
18874 | }.bind(this)),
|
18875 | sortedIds = sortedList.map(function (v) {
|
18876 | var _this6 = this;
|
18877 | _newArrowCheck(this, _this5);
|
18878 | return v.values.filter(function (v2) {
|
18879 | _newArrowCheck(this, _this6);
|
18880 | return v2.index === index && (isNumber(value) && value > 0 ? v2.value > 0 : v2.value < 0);
|
18881 | }.bind(this))[0];
|
18882 | }.bind(this)).filter(Boolean).map(function (v) {
|
18883 | _newArrowCheck(this, _this5);
|
18884 | return v.id;
|
18885 | }.bind(this));
|
18886 |
|
18887 | return value !== 0 && sortedIds.indexOf(id) === sortedIds.length - 1;
|
18888 | },
|
18889 | |
18890 |
|
18891 |
|
18892 |
|
18893 |
|
18894 |
|
18895 |
|
18896 | generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) {
|
18897 | var _this7 = this,
|
18898 | $$ = this,
|
18899 | config = $$.config,
|
18900 | axis = isSub ? $$.axis.subX : $$.axis.x,
|
18901 | barTargetsNum = $$.getIndicesMax(barIndices) + 1,
|
18902 | barW = $$.getBarW("bar", axis, barTargetsNum),
|
18903 | barX = $$.getShapeX(barW, barIndices, !!isSub),
|
18904 | barY = $$.getShapeY(!!isSub),
|
18905 | barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),
|
18906 | yScale = $$.getYScaleById.bind($$);
|
18907 | return function (d, i) {
|
18908 | _newArrowCheck(this, _this7);
|
18909 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
18910 | offset = barOffset(d, i) || y0,
|
18911 | width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
18912 | value = d.value,
|
18913 | posX = barX(d),
|
18914 | posY = barY(d);
|
18915 |
|
18916 | if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
|
18917 | posY = y0;
|
18918 | }
|
18919 | if (!$$.isBarRangeType(d)) {
|
18920 | posY -= y0 - offset;
|
18921 | }
|
18922 | var startPosX = posX + width;
|
18923 |
|
18924 |
|
18925 | return [[posX, offset], [posX, posY], [startPosX, posY], [startPosX, offset]];
|
18926 | }.bind(this);
|
18927 | }
|
18928 | });
|
18929 | ;
|
18930 |
|
18931 |
|
18932 | function candlestick_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
18933 | function candlestick_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? candlestick_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : candlestick_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
18934 |
|
18935 |
|
18936 |
|
18937 |
|
18938 |
|
18939 |
|
18940 |
|
18941 | var candlestick = ({
|
18942 | initCandlestick: function initCandlestick() {
|
18943 | var $el = this.$el;
|
18944 | $el.candlestick = $el.main.select("." + $COMMON.chart)
|
18945 |
|
18946 | .append("g").attr("class", $CANDLESTICK.chartCandlesticks);
|
18947 | },
|
18948 | |
18949 |
|
18950 |
|
18951 |
|
18952 |
|
18953 |
|
18954 | updateTargetsForCandlestick: function updateTargetsForCandlestick(targets) {
|
18955 | var _this = this,
|
18956 | $$ = this,
|
18957 | $el = $$.$el,
|
18958 | classChart = $$.getChartClass("Candlestick"),
|
18959 | classFocus = $$.classFocus.bind($$);
|
18960 | if (!$el.candlestick) {
|
18961 | $$.initCandlestick();
|
18962 | }
|
18963 | var mainUpdate = $$.$el.main.select("." + $CANDLESTICK.chartCandlesticks).selectAll("." + $CANDLESTICK.chartCandlestick).data(targets).attr("class", function (d) {
|
18964 | _newArrowCheck(this, _this);
|
18965 | return classChart(d) + classFocus(d);
|
18966 | }.bind(this));
|
18967 | mainUpdate.enter().append("g").attr("class", classChart).style("pointer-events", "none");
|
18968 | },
|
18969 | |
18970 |
|
18971 |
|
18972 |
|
18973 |
|
18974 |
|
18975 | updateCandlestick: function updateCandlestick(withTransition, isSub) {
|
18976 | var _this2 = this;
|
18977 | if (isSub === void 0) {
|
18978 | isSub = !1;
|
18979 | }
|
18980 | var $$ = this,
|
18981 | $el = $$.$el,
|
18982 | $T = $$.$T,
|
18983 | $root = isSub ? $el.subchart : $el,
|
18984 | classSetter = $$.getClass("candlestick", !0),
|
18985 | initialOpacity = $$.initialOpacity.bind($$),
|
18986 | candlestick = $root.main.selectAll("." + $CANDLESTICK.chartCandlestick).selectAll("." + $CANDLESTICK.candlestick).data($$.labelishData.bind($$));
|
18987 | $T(candlestick.exit(), withTransition).style("opacity", "0").remove();
|
18988 | var candlestickEnter = candlestick.enter().filter(function (d) {
|
18989 | _newArrowCheck(this, _this2);
|
18990 | return d.value;
|
18991 | }.bind(this)).append("g").attr("class", classSetter);
|
18992 | candlestickEnter.append("line");
|
18993 | candlestickEnter.append("path");
|
18994 | if (!$root.candlestick) {
|
18995 | $root.candlestick = {};
|
18996 | }
|
18997 | $root.candlestick = candlestick.merge(candlestickEnter).style("opacity", initialOpacity);
|
18998 | },
|
18999 | |
19000 |
|
19001 |
|
19002 |
|
19003 |
|
19004 |
|
19005 |
|
19006 | generateDrawCandlestick: function generateDrawCandlestick(indices, isSub) {
|
19007 | var _this3 = this,
|
19008 | $$ = this,
|
19009 | config = $$.config,
|
19010 | getPoints = $$.generateGetCandlestickPoints(indices, isSub),
|
19011 | isRotated = config.axis_rotated,
|
19012 | downColor = config.candlestick_color_down;
|
19013 | return function (d, i, g) {
|
19014 | var _value,
|
19015 | _this4 = this;
|
19016 | _newArrowCheck(this, _this3);
|
19017 | var points = getPoints(d, i),
|
19018 | value = $$.getCandlestickData(d),
|
19019 | isUp = (_value = value) == null ? void 0 : _value._isUp,
|
19020 | indexX = +isRotated;
|
19021 | if (g.classed) {
|
19022 | g.classed($CANDLESTICK[isUp ? "valueUp" : "valueDown"], !0);
|
19023 | }
|
19024 | var path = isRotated ? "H" + points[1][1] + " V" + points[1][0] + " H" + points[0][1] : "V" + points[1][1] + " H" + points[1][0] + " V" + points[0][1];
|
19025 | g.select("path").attr("d", "M" + points[0][indexX] + "," + points[0][+!indexX] + path + "z").style("fill", function (d) {
|
19026 | _newArrowCheck(this, _this4);
|
19027 | var color = isUp ? $$.color(d) : isObject(downColor) ? downColor[d.id] : downColor;
|
19028 | return color || $$.color(d);
|
19029 | }.bind(this));
|
19030 |
|
19031 |
|
19032 | var line = g.select("line"),
|
19033 | pos = isRotated ? {
|
19034 | x1: points[2][1],
|
19035 | x2: points[2][2],
|
19036 | y1: points[2][0],
|
19037 | y2: points[2][0]
|
19038 | } : {
|
19039 | x1: points[2][0],
|
19040 | x2: points[2][0],
|
19041 | y1: points[2][1],
|
19042 | y2: points[2][2]
|
19043 | };
|
19044 | for (var x in pos) {
|
19045 | line.attr(x, pos[x]);
|
19046 | }
|
19047 | }.bind(this);
|
19048 | },
|
19049 | |
19050 |
|
19051 |
|
19052 |
|
19053 |
|
19054 |
|
19055 | generateGetCandlestickPoints: function generateGetCandlestickPoints(indices, isSub) {
|
19056 | var _this5 = this;
|
19057 | if (isSub === void 0) {
|
19058 | isSub = !1;
|
19059 | }
|
19060 | var $$ = this,
|
19061 | config = $$.config,
|
19062 | axis = isSub ? $$.axis.subX : $$.axis.x,
|
19063 | targetsNum = $$.getIndicesMax(indices) + 1,
|
19064 | barW = $$.getBarW("candlestick", axis, targetsNum),
|
19065 | x = $$.getShapeX(barW, indices, !!isSub),
|
19066 | y = $$.getShapeY(!!isSub),
|
19067 | shapeOffset = $$.getShapeOffset($$.isBarType, indices, !!isSub),
|
19068 | yScale = $$.getYScaleById.bind($$);
|
19069 | return function (d, i) {
|
19070 | _newArrowCheck(this, _this5);
|
19071 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
19072 | offset = shapeOffset(d, i) || y0,
|
19073 | width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
19074 | value = $$.getCandlestickData(d),
|
19075 | points;
|
19076 | if (value) {
|
19077 | var posX = {
|
19078 | start: x(d),
|
19079 | end: 0
|
19080 | };
|
19081 | posX.end = posX.start + width;
|
19082 | var posY = {
|
19083 | start: y(value.open),
|
19084 | end: y(value.close)
|
19085 | },
|
19086 | posLine = {
|
19087 | x: posX.start + width / 2,
|
19088 | high: y(value.high),
|
19089 | low: y(value.low)
|
19090 | };
|
19091 |
|
19092 | if (config.axis_rotated && (d.value > 0 && posY.start < y0 || d.value < 0 && y0 < posY.start)) {
|
19093 | posY.start = y0;
|
19094 | }
|
19095 | posY.start -= y0 - offset;
|
19096 | points = [[posX.start, posY.start], [posX.end, posY.end], [posLine.x, posLine.low, posLine.high]];
|
19097 | } else {
|
19098 | points = [[0, 0], [0, 0], [0, 0, 0]];
|
19099 | }
|
19100 | return points;
|
19101 | }.bind(this);
|
19102 | },
|
19103 | |
19104 |
|
19105 |
|
19106 |
|
19107 |
|
19108 |
|
19109 |
|
19110 | redrawCandlestick: function redrawCandlestick(drawFn, withTransition, isSub) {
|
19111 | if (isSub === void 0) {
|
19112 | isSub = !1;
|
19113 | }
|
19114 | var $$ = this,
|
19115 | $el = $$.$el,
|
19116 | $T = $$.$T,
|
19117 | _ref = isSub ? $el.subchart : $el,
|
19118 | candlestick = _ref.candlestick,
|
19119 | rand = getRandom(!0);
|
19120 | return [candlestick.each(function (d, i) {
|
19121 | var g = $T((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), withTransition, rand);
|
19122 | drawFn(d, i, g);
|
19123 | }).style("opacity", null)];
|
19124 | },
|
19125 | |
19126 |
|
19127 |
|
19128 |
|
19129 |
|
19130 |
|
19131 |
|
19132 | getCandlestickData: function getCandlestickData(_ref2) {
|
19133 | var value = _ref2.value,
|
19134 | d;
|
19135 | if (isArray(value)) {
|
19136 | var open = value[0],
|
19137 | high = value[1],
|
19138 | low = value[2],
|
19139 | close = value[3],
|
19140 | _value$ = value[4],
|
19141 | volume = _value$ === void 0 ? !1 : _value$;
|
19142 | d = {
|
19143 | open: open,
|
19144 | high: high,
|
19145 | low: low,
|
19146 | close: close
|
19147 | };
|
19148 | if (volume !== !1) {
|
19149 | d.volume = volume;
|
19150 | }
|
19151 | } else if (isObject(value)) {
|
19152 | d = candlestick_objectSpread({}, value);
|
19153 | }
|
19154 | if (d) {
|
19155 | d._isUp = d.close >= d.open;
|
19156 | }
|
19157 | return d || null;
|
19158 | }
|
19159 | });
|
19160 | ;
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 |
|
19166 |
|
19167 |
|
19168 |
|
19169 | var gauge = ({
|
19170 | initGauge: function initGauge() {
|
19171 | var _this = this,
|
19172 | $$ = this,
|
19173 | config = $$.config,
|
19174 | arcs = $$.$el.arcs,
|
19175 | appendText = function (className) {
|
19176 | _newArrowCheck(this, _this);
|
19177 | arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none");
|
19178 | }.bind(this);
|
19179 | if ($$.hasType("gauge")) {
|
19180 | var hasMulti = $$.hasMultiArcGauge();
|
19181 | arcs.append(hasMulti ? "g" : "path").attr("class", $ARC.chartArcsBackground).style("fill", !hasMulti && config.gauge_background || null);
|
19182 | config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit);
|
19183 | if (config.gauge_label_show) {
|
19184 | appendText($GAUGE.chartArcsGaugeMin);
|
19185 | config.gauge_fullCircle || appendText($GAUGE.chartArcsGaugeMax);
|
19186 | }
|
19187 | }
|
19188 | },
|
19189 | updateGaugeMax: function updateGaugeMax() {
|
19190 | var $$ = this,
|
19191 | config = $$.config,
|
19192 | state = $$.state,
|
19193 | hasMultiGauge = $$.hasMultiArcGauge(),
|
19194 | max = hasMultiGauge ? $$.getMinMaxData().max[0].value : $$.getTotalDataSum(state.rendered);
|
19195 |
|
19196 | if (max + config.gauge_min * (config.gauge_min > 0 ? -1 : 1) > config.gauge_max) {
|
19197 | config.gauge_max = max - config.gauge_min;
|
19198 | }
|
19199 | },
|
19200 | redrawMultiArcGauge: function redrawMultiArcGauge() {
|
19201 | var _this2 = this,
|
19202 | $$ = this,
|
19203 | config = $$.config,
|
19204 | state = $$.state,
|
19205 | $el = $$.$el,
|
19206 | hiddenTargetIds = $$.state.hiddenTargetIds,
|
19207 | arcLabelLines = $el.main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arcLabelLine).data($$.arcData.bind($$)),
|
19208 | mainArcLabelLine = arcLabelLines.enter().append("rect").attr("class", function (d) {
|
19209 | _newArrowCheck(this, _this2);
|
19210 | return $ARC.arcLabelLine + " " + $COMMON.target + " " + $COMMON.target + "-" + d.data.id;
|
19211 | }.bind(this)).merge(arcLabelLines);
|
19212 | mainArcLabelLine.style("fill", function (d) {
|
19213 | _newArrowCheck(this, _this2);
|
19214 | return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data);
|
19215 | }.bind(this)).style("display", config.gauge_label_show ? null : "none").each(function (d) {
|
19216 | var lineLength = 0,
|
19217 | lineThickness = 2,
|
19218 | x = 0,
|
19219 | y = 0,
|
19220 | transform = "";
|
19221 | if (hiddenTargetIds.indexOf(d.data.id) < 0) {
|
19222 | var updated = $$.updateAngle(d),
|
19223 | innerLineLength = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length * (updated.index + 1),
|
19224 | lineAngle = updated.endAngle - Math.PI / 2,
|
19225 | arcInnerRadius = state.radius - innerLineLength,
|
19226 | linePositioningAngle = lineAngle - (arcInnerRadius === 0 ? 0 : 1 / arcInnerRadius);
|
19227 | lineLength = state.radiusExpanded - state.radius + innerLineLength;
|
19228 | x = Math.cos(linePositioningAngle) * arcInnerRadius;
|
19229 | y = Math.sin(linePositioningAngle) * arcInnerRadius;
|
19230 | transform = "rotate(" + lineAngle * 180 / Math.PI + ", " + x + ", " + y + ")";
|
19231 | }
|
19232 | (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr("x", x).attr("y", y).attr("width", lineLength).attr("height", lineThickness).attr("transform", transform).style("stroke-dasharray", "0, " + (lineLength + lineThickness) + ", 0");
|
19233 | });
|
19234 | },
|
19235 | textForGaugeMinMax: function textForGaugeMinMax(value, isMax) {
|
19236 | var $$ = this,
|
19237 | config = $$.config,
|
19238 | format = config.gauge_label_extents;
|
19239 | return isFunction(format) ? format.bind($$.api)(value, isMax) : value;
|
19240 | },
|
19241 | getGaugeLabelHeight: function getGaugeLabelHeight() {
|
19242 | var config = this.config;
|
19243 | return this.config.gauge_label_show && !config.gauge_fullCircle ? 20 : 0;
|
19244 | },
|
19245 | getPaddingBottomForGauge: function getPaddingBottomForGauge() {
|
19246 | var $$ = this;
|
19247 | return $$.getGaugeLabelHeight() * ($$.config.gauge_label_show ? 2 : 2.5);
|
19248 | }
|
19249 | });
|
19250 | ;
|
19251 |
|
19252 |
|
19253 |
|
19254 |
|
19255 |
|
19256 |
|
19257 |
|
19258 | var bubble = ({
|
19259 | |
19260 |
|
19261 |
|
19262 |
|
19263 | initBubble: function initBubble() {
|
19264 | var $$ = this,
|
19265 | config = $$.config;
|
19266 | if ($$.hasType("bubble")) {
|
19267 | config.point_show = !0;
|
19268 | config.point_type = "circle";
|
19269 | config.point_sensitivity = 25;
|
19270 | }
|
19271 | },
|
19272 | |
19273 |
|
19274 |
|
19275 |
|
19276 |
|
19277 | getBaseLength: function getBaseLength() {
|
19278 | var $$ = this,
|
19279 | _$$$state = $$.state,
|
19280 | width = _$$$state.width,
|
19281 | height = _$$$state.height,
|
19282 | cacheKey = KEY.bubbleBaseLength,
|
19283 | baseLength = $$.cache.get(cacheKey);
|
19284 | if (!baseLength) {
|
19285 | $$.cache.add(cacheKey, baseLength = getMinMax("min", [width, height]));
|
19286 | }
|
19287 | return baseLength;
|
19288 | },
|
19289 | |
19290 |
|
19291 |
|
19292 |
|
19293 |
|
19294 |
|
19295 | getBubbleR: function getBubbleR(d) {
|
19296 | var _this = this,
|
19297 | $$ = this,
|
19298 | maxR = $$.config.bubble_maxR;
|
19299 | if (isFunction(maxR)) {
|
19300 | maxR = maxR.bind($$.api)(d);
|
19301 | } else if (!isNumber(maxR)) {
|
19302 | maxR = $$.getBaseLength() / ($$.getMaxDataCount() * 2) + 12;
|
19303 | }
|
19304 | var max = getMinMax("max", $$.getMinMaxData().max.map(function (d) {
|
19305 | _newArrowCheck(this, _this);
|
19306 | return $$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "y") : isObject(d.value) ? d.value.mid : d.value;
|
19307 | }.bind(this))),
|
19308 | maxArea = maxR * maxR * Math.PI,
|
19309 | area = ($$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "z") : d.value) * (maxArea / max);
|
19310 | return Math.sqrt(area / Math.PI);
|
19311 | },
|
19312 | |
19313 |
|
19314 |
|
19315 |
|
19316 |
|
19317 |
|
19318 |
|
19319 | getBubbleZData: function getBubbleZData(d, type) {
|
19320 | return isObject(d) ? d[type] : d[type === "y" ? 0 : 1];
|
19321 | }
|
19322 | });
|
19323 | ;
|
19324 |
|
19325 |
|
19326 |
|
19327 |
|
19328 |
|
19329 |
|
19330 |
|
19331 |
|
19332 |
|
19333 | var line = ({
|
19334 | initLine: function initLine() {
|
19335 | var $el = this.$el;
|
19336 | $el.line = $el.main.select("." + $COMMON.chart).append("g").attr("class", $LINE.chartLines).call(this.setCssRule(!1, "." + $LINE.chartLines, ["pointer-events:none"]));
|
19337 | },
|
19338 | updateTargetsForLine: function updateTargetsForLine(t) {
|
19339 | var _this = this,
|
19340 | $$ = this,
|
19341 | _$$$$el = $$.$el,
|
19342 | area = _$$$$el.area,
|
19343 | line = _$$$$el.line,
|
19344 | main = _$$$$el.main,
|
19345 | classChartLine = $$.getChartClass("Line"),
|
19346 | classLines = $$.getClass("lines", !0),
|
19347 | classFocus = $$.classFocus.bind($$);
|
19348 | if (!line) {
|
19349 | $$.initLine();
|
19350 | }
|
19351 | var targets = t.filter(function (d) {
|
19352 | _newArrowCheck(this, _this);
|
19353 | return !($$.isScatterType(d) || $$.isBubbleType(d));
|
19354 | }.bind(this)),
|
19355 | mainLineUpdate = main.select("." + $LINE.chartLines).selectAll("." + $LINE.chartLine).data(targets).attr("class", function (d) {
|
19356 | _newArrowCheck(this, _this);
|
19357 | return classChartLine(d) + classFocus(d);
|
19358 | }.bind(this)),
|
19359 | mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", $$.getStylePropValue("none"));
|
19360 |
|
19361 | mainLineEnter.append("g").attr("class", classLines);
|
19362 |
|
19363 |
|
19364 | if ($$.hasTypeOf("Area")) {
|
19365 | var mainLine = (!area && mainLineEnter.empty() ? mainLineUpdate : mainLineEnter).filter($$.isAreaType.bind($$));
|
19366 | $$.initArea(mainLine);
|
19367 | }
|
19368 | $$.updateTargetForCircle(targets, mainLineEnter);
|
19369 | },
|
19370 | |
19371 |
|
19372 |
|
19373 |
|
19374 |
|
19375 |
|
19376 | updateLine: function updateLine(withTransition, isSub) {
|
19377 | var _this2 = this;
|
19378 | if (isSub === void 0) {
|
19379 | isSub = !1;
|
19380 | }
|
19381 | var $$ = this,
|
19382 | extraLineClasses = $$.format.extraLineClasses,
|
19383 | $el = $$.$el,
|
19384 | $T = $$.$T,
|
19385 | $root = isSub ? $el.subchart : $el,
|
19386 | line = $root.main.selectAll("." + $LINE.lines).selectAll("." + $LINE.line).data($$.lineData.bind($$));
|
19387 | $T(line.exit(), withTransition).style("opacity", "0").remove();
|
19388 | $root.line = line.enter().append("path").attr("class", function (d) {
|
19389 | _newArrowCheck(this, _this2);
|
19390 | return $$.getClass("line", !0)(d) + " " + (extraLineClasses(d) || "");
|
19391 | }.bind(this)).style("stroke", $$.color).merge(line).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) {
|
19392 | _newArrowCheck(this, _this2);
|
19393 | return $$.isStepType(d) ? "crispEdges" : "";
|
19394 | }.bind(this)).attr("transform", null);
|
19395 | },
|
19396 | |
19397 |
|
19398 |
|
19399 |
|
19400 |
|
19401 |
|
19402 |
|
19403 | redrawLine: function redrawLine(drawFn, withTransition, isSub) {
|
19404 | if (isSub === void 0) {
|
19405 | isSub = !1;
|
19406 | }
|
19407 | var $$ = this,
|
19408 | $el = $$.$el,
|
19409 | $T = $$.$T,
|
19410 | _ref = isSub ? $el.subchart : $el,
|
19411 | line = _ref.line;
|
19412 | return [$T(line, withTransition, getRandom()).attr("d", drawFn).style("stroke", this.color).style("opacity", null)];
|
19413 | },
|
19414 | |
19415 |
|
19416 |
|
19417 |
|
19418 |
|
19419 |
|
19420 | getCurve: function getCurve(d) {
|
19421 | var _this3 = this,
|
19422 | $$ = this,
|
19423 | isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d);
|
19424 |
|
19425 |
|
19426 | return isRotatedStepType ? function (context) {
|
19427 | _newArrowCheck(this, _this3);
|
19428 | var step = $$.getInterpolate(d)(context);
|
19429 |
|
19430 |
|
19431 | step.orgPoint = step.point;
|
19432 |
|
19433 |
|
19434 | step.pointRotated = function (x, y) {
|
19435 | this._point === 1 && (this._point = 2);
|
19436 | var y1 = this._y * (1 - this._t) + y * this._t;
|
19437 | this._context.lineTo(this._x, y1);
|
19438 | this._context.lineTo(x, y1);
|
19439 | this._x = x;
|
19440 | this._y = y;
|
19441 | };
|
19442 | step.point = function (x, y) {
|
19443 | this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
|
19444 | };
|
19445 | return step;
|
19446 | }.bind(this) : $$.getInterpolate(d);
|
19447 | },
|
19448 | generateDrawLine: function generateDrawLine(lineIndices, isSub) {
|
19449 | var _this4 = this,
|
19450 | $$ = this,
|
19451 | config = $$.config,
|
19452 | scale = $$.scale,
|
19453 | lineConnectNull = config.line_connectNull,
|
19454 | isRotated = config.axis_rotated,
|
19455 | getPoints = $$.generateGetLinePoints(lineIndices, isSub),
|
19456 | yScale = $$.getYScaleById.bind($$),
|
19457 | xValue = function (d) {
|
19458 | _newArrowCheck(this, _this4);
|
19459 | return (isSub ? $$.subxx : $$.xx).call($$, d);
|
19460 | }.bind(this),
|
19461 | yValue = function (d, i) {
|
19462 | _newArrowCheck(this, _this4);
|
19463 | return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.getBaseValue(d));
|
19464 | }.bind(this),
|
19465 | line = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.line)();
|
19466 | line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);
|
19467 | if (!lineConnectNull) {
|
19468 | line = line.defined(function (d) {
|
19469 | _newArrowCheck(this, _this4);
|
19470 | return $$.getBaseValue(d) !== null;
|
19471 | }.bind(this));
|
19472 | }
|
19473 | var x = isSub ? scale.subX : scale.x;
|
19474 | return function (d) {
|
19475 | _newArrowCheck(this, _this4);
|
19476 | var y = yScale(d.id, isSub),
|
19477 | values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
19478 | x0 = 0,
|
19479 | y0 = 0,
|
19480 | path;
|
19481 | if ($$.isLineType(d)) {
|
19482 | var regions = config.data_regions[d.id];
|
19483 | if (regions) {
|
19484 | path = $$.lineWithRegions(values, scale.zoom || x, y, regions);
|
19485 | } else {
|
19486 | if ($$.isStepType(d)) {
|
19487 | values = $$.convertValuesToStep(values);
|
19488 | }
|
19489 | path = line.curve($$.getCurve(d))(values);
|
19490 | }
|
19491 | } else {
|
19492 | if (values[0]) {
|
19493 | x0 = x(values[0].x);
|
19494 | y0 = y(values[0].value);
|
19495 | }
|
19496 | path = isRotated ? "M " + y0 + " " + x0 : "M " + x0 + " " + y0;
|
19497 | }
|
19498 | return path || "M 0 0";
|
19499 | }.bind(this);
|
19500 | },
|
19501 | lineWithRegions: function lineWithRegions(d, x, y, _regions) {
|
19502 | var _this5 = this,
|
19503 | $$ = this,
|
19504 | config = $$.config,
|
19505 | isRotated = config.axis_rotated,
|
19506 | isTimeSeries = $$.axis.isTimeSeries(),
|
19507 | xOffset = $$.axis.isCategorized() ? .5 : 0,
|
19508 | regions = [],
|
19509 | dasharray = "2 2",
|
19510 | xp,
|
19511 | yp,
|
19512 | diff,
|
19513 | diffx2,
|
19514 | isWithinRegions = function (withinX, withinRegions) {
|
19515 | _newArrowCheck(this, _this5);
|
19516 | for (var i = 0, reg; reg = withinRegions[i]; i++) {
|
19517 | if (reg.start < withinX && withinX <= reg.end) {
|
19518 | return reg.style;
|
19519 | }
|
19520 | }
|
19521 | return !1;
|
19522 | }.bind(this);
|
19523 |
|
19524 | if (isDefined(_regions)) {
|
19525 | var getValue = function (v, def) {
|
19526 | _newArrowCheck(this, _this5);
|
19527 | return isUndefined(v) ? def : isTimeSeries ? parseDate.call($$, v) : v;
|
19528 | }.bind(this);
|
19529 | for (var i = 0, reg; reg = _regions[i]; i++) {
|
19530 | var start = getValue(reg.start, d[0].x),
|
19531 | end = getValue(reg.end, d[d.length - 1].x),
|
19532 | style = reg.style || {
|
19533 | dasharray: dasharray
|
19534 | };
|
19535 | regions[i] = {
|
19536 | start: start,
|
19537 | end: end,
|
19538 | style: style
|
19539 | };
|
19540 | }
|
19541 | }
|
19542 |
|
19543 |
|
19544 | var xValue = isRotated ? function (dt) {
|
19545 | _newArrowCheck(this, _this5);
|
19546 | return y(dt.value);
|
19547 | }.bind(this) : function (dt) {
|
19548 | _newArrowCheck(this, _this5);
|
19549 | return x(dt.x);
|
19550 | }.bind(this),
|
19551 | yValue = isRotated ? function (dt) {
|
19552 | _newArrowCheck(this, _this5);
|
19553 | return x(dt.x);
|
19554 | }.bind(this) : function (dt) {
|
19555 | _newArrowCheck(this, _this5);
|
19556 | return y(dt.value);
|
19557 | }.bind(this),
|
19558 | generateM = function (points) {
|
19559 | _newArrowCheck(this, _this5);
|
19560 | return "M" + points[0][0] + "," + points[0][1] + "L" + points[1][0] + "," + points[1][1];
|
19561 | }.bind(this),
|
19562 | sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) {
|
19563 | _newArrowCheck(this, _this5);
|
19564 | var x0 = d0.x.getTime(),
|
19565 | xDiff = d1.x - d0.x,
|
19566 | xv0 = new Date(x0 + xDiff * k),
|
19567 | xv1 = new Date(x0 + xDiff * (k + timeseriesDiff)),
|
19568 | points = isRotated ? [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] : [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
|
19569 | return generateM(points);
|
19570 | }.bind(this) : function (d0, d1, k, otherDiff) {
|
19571 | _newArrowCheck(this, _this5);
|
19572 | 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))]];
|
19573 | return generateM(points);
|
19574 | }.bind(this),
|
19575 | axisType = {
|
19576 | x: $$.axis.getAxisType("x"),
|
19577 | y: $$.axis.getAxisType("y")
|
19578 | },
|
19579 | path = "";
|
19580 | for (var _i = 0, data; data = d[_i]; _i++) {
|
19581 | var prevData = d[_i - 1],
|
19582 | hasPrevData = prevData && isValue(prevData.value),
|
19583 | style = isWithinRegions(data.x, regions);
|
19584 |
|
19585 | if (!isValue(data.value)) {
|
19586 | continue;
|
19587 | }
|
19588 |
|
19589 |
|
19590 | if (isUndefined(regions) || !style || !hasPrevData) {
|
19591 | path += "" + (_i && hasPrevData ? "L" : "M") + xValue(data) + "," + yValue(data);
|
19592 | } else if (hasPrevData) {
|
19593 | try {
|
19594 | style = style.dasharray.split(" ");
|
19595 | } catch (e) {
|
19596 | style = dasharray.split(" ");
|
19597 | }
|
19598 |
|
19599 |
|
19600 | xp = getScale(axisType.x, prevData.x + xOffset, data.x + xOffset);
|
19601 | yp = getScale(axisType.y, prevData.value, data.value);
|
19602 | var dx = x(data.x) - x(prevData.x),
|
19603 | dy = y(data.value) - y(prevData.value),
|
19604 | dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
|
19605 | diff = style[0] / dd;
|
19606 | diffx2 = diff * style[1];
|
19607 | for (var j = diff; j <= 1; j += diffx2) {
|
19608 | path += sWithRegion(prevData, data, j, diff);
|
19609 |
|
19610 |
|
19611 | if (j + diffx2 >= 1) {
|
19612 | path += sWithRegion(prevData, data, 1, 0);
|
19613 | }
|
19614 | }
|
19615 | }
|
19616 | }
|
19617 | return path;
|
19618 | },
|
19619 | isWithinStep: function isWithinStep(that, y) {
|
19620 | return Math.abs(y - getPointer(this.state.event, that)[1]) < 30;
|
19621 | },
|
19622 | shouldDrawPointsForLine: function shouldDrawPointsForLine(d) {
|
19623 | var linePoint = this.config.line_point;
|
19624 | return linePoint === !0 || isArray(linePoint) && linePoint.indexOf(d.id) !== -1;
|
19625 | }
|
19626 | });
|
19627 | ;
|
19628 |
|
19629 | var point_this = undefined;
|
19630 |
|
19631 |
|
19632 |
|
19633 |
|
19634 |
|
19635 |
|
19636 |
|
19637 |
|
19638 | var getTransitionName = function () {
|
19639 | _newArrowCheck(this, point_this);
|
19640 | return getRandom();
|
19641 | }.bind(undefined);
|
19642 | var point = ({
|
19643 | hasValidPointType: function hasValidPointType(type) {
|
19644 | return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type);
|
19645 | },
|
19646 | hasValidPointDrawMethods: function hasValidPointDrawMethods(type) {
|
19647 | var pointType = type || this.config.point_type;
|
19648 | return isObjectType(pointType) && isFunction(pointType.create) && isFunction(pointType.update);
|
19649 | },
|
19650 | initialOpacityForCircle: function initialOpacityForCircle(d) {
|
19651 | var config = this.config,
|
19652 | withoutFadeIn = this.state.withoutFadeIn,
|
19653 | opacity = config.point_opacity;
|
19654 | if (isUndefined(opacity)) {
|
19655 | opacity = this.getBaseValue(d) !== null && withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0";
|
19656 | }
|
19657 | return opacity;
|
19658 | },
|
19659 | opacityForCircle: function opacityForCircle(d) {
|
19660 | var config = this.config,
|
19661 | opacity = config.point_opacity;
|
19662 | if (isUndefined(opacity)) {
|
19663 | opacity = config.point_show && !config.point_focus_only ? null : "0";
|
19664 | opacity = isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0";
|
19665 | }
|
19666 | return opacity;
|
19667 | },
|
19668 | initCircle: function initCircle() {
|
19669 | var $$ = this,
|
19670 | main = $$.$el.main;
|
19671 | $$.point = $$.generatePoint();
|
19672 | if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select("." + $CIRCLE.chartCircles).empty()) {
|
19673 | main.select("." + $COMMON.chart).append("g").attr("class", $CIRCLE.chartCircles);
|
19674 | }
|
19675 | },
|
19676 | updateTargetForCircle: function updateTargetForCircle(targetsValue, enterNodeValue) {
|
19677 | var _this2 = this,
|
19678 | $$ = this,
|
19679 | config = $$.config,
|
19680 | data = $$.data,
|
19681 | $el = $$.$el,
|
19682 | selectionEnabled = config.interaction_enabled && config.data_selection_enabled,
|
19683 | isSelectable = selectionEnabled && config.data_selection_isselectable,
|
19684 | classCircles = $$.getClass("circles", !0);
|
19685 | if (!config.point_show) {
|
19686 | return;
|
19687 | }
|
19688 | $el.circle || $$.initCircle();
|
19689 | var targets = targetsValue,
|
19690 | enterNode = enterNodeValue;
|
19691 |
|
19692 | if (!targets) {
|
19693 | targets = data.targets.filter(function (d) {
|
19694 | _newArrowCheck(this, _this2);
|
19695 | return this.isScatterType(d) || this.isBubbleType(d);
|
19696 | }.bind(this));
|
19697 | var mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets);
|
19698 | mainCircle.exit().remove();
|
19699 | enterNode = mainCircle.enter();
|
19700 | }
|
19701 |
|
19702 |
|
19703 | selectionEnabled && enterNode.append("g").attr("class", function (d) {
|
19704 | _newArrowCheck(this, _this2);
|
19705 | return $$.generateClass($SELECT.selectedCircles, d.id);
|
19706 | }.bind(this));
|
19707 | enterNode.append("g").attr("class", classCircles).call(function (selection) {
|
19708 | _newArrowCheck(this, _this2);
|
19709 | $$.setCssRule(!0, "." + $CIRCLE.circles, ["cursor:pointer"], isSelectable)(selection);
|
19710 | $$.setCssRule(!0, " ." + $CIRCLE.circle, ["fill", "stroke"], $$.color)(selection);
|
19711 | }.bind(this)).style("opacity", function () {
|
19712 | var parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode);
|
19713 |
|
19714 |
|
19715 | return parent.attr("class").indexOf($CIRCLE.chartCircles) > -1 ? "0" : null;
|
19716 | });
|
19717 |
|
19718 |
|
19719 | selectionEnabled && targets.forEach(function (t) {
|
19720 | var _this3 = this;
|
19721 | _newArrowCheck(this, _this2);
|
19722 | $el.main.selectAll("." + $SELECT.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll("" + $SELECT.selectedCircle).each(function (d) {
|
19723 | _newArrowCheck(this, _this3);
|
19724 | d.value = t.values[d.index].value;
|
19725 | }.bind(this));
|
19726 | }.bind(this));
|
19727 | },
|
19728 | updateCircle: function updateCircle(isSub) {
|
19729 | var _this4 = this;
|
19730 | if (isSub === void 0) {
|
19731 | isSub = !1;
|
19732 | }
|
19733 | var $$ = this,
|
19734 | config = $$.config,
|
19735 | state = $$.state,
|
19736 | $el = $$.$el,
|
19737 | focusOnly = config.point_focus_only,
|
19738 | $root = isSub ? $el.subchart : $el;
|
19739 | if (config.point_show && !state.toggling) {
|
19740 | var circles = $root.main.selectAll("." + $CIRCLE.circles).selectAll("." + $CIRCLE.circle).data(function (d) {
|
19741 | _newArrowCheck(this, _this4);
|
19742 | return $$.isLineType(d) && $$.shouldDrawPointsForLine(d) || $$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ? focusOnly ? [d.values[0]] : d.values : [];
|
19743 | }.bind(this));
|
19744 | circles.exit().remove();
|
19745 | circles.enter().filter(Boolean).append($$.point("create", this, $$.pointR.bind($$), $$.getStylePropValue($$.color)));
|
19746 | $root.circle = $root.main.selectAll("." + $CIRCLE.circles + " ." + $CIRCLE.circle).style("stroke", $$.getStylePropValue($$.color)).style("opacity", $$.initialOpacityForCircle.bind($$));
|
19747 | }
|
19748 | },
|
19749 | redrawCircle: function redrawCircle(cx, cy, withTransition, flow, isSub) {
|
19750 | if (isSub === void 0) {
|
19751 | isSub = !1;
|
19752 | }
|
19753 | var $$ = this,
|
19754 | rendered = $$.state.rendered,
|
19755 | $el = $$.$el,
|
19756 | $T = $$.$T,
|
19757 | $root = isSub ? $el.subchart : $el,
|
19758 | selectedCircles = $root.main.selectAll("." + $SELECT.selectedCircle);
|
19759 | if (!$$.config.point_show) {
|
19760 | return [];
|
19761 | }
|
19762 | var fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), withTransition, flow, selectedCircles),
|
19763 | posAttr = $$.isCirclePoint() ? "c" : "",
|
19764 | t = getRandom(),
|
19765 | opacityStyleFn = $$.opacityForCircle.bind($$),
|
19766 | mainCircles = [];
|
19767 | $root.circle.each(function (d) {
|
19768 | var result = fn.bind(this)(d);
|
19769 | result = $T(result, withTransition || !rendered, t).style("opacity", opacityStyleFn);
|
19770 | mainCircles.push(result);
|
19771 | });
|
19772 | return [mainCircles, $T(selectedCircles, withTransition).attr(posAttr + "x", cx).attr(posAttr + "y", cy)];
|
19773 | },
|
19774 | |
19775 |
|
19776 |
|
19777 |
|
19778 |
|
19779 | showCircleFocus: function showCircleFocus(d) {
|
19780 | var $$ = this,
|
19781 | config = $$.config,
|
19782 | _$$$state = $$.state,
|
19783 | hasRadar = _$$$state.hasRadar,
|
19784 | resizing = _$$$state.resizing,
|
19785 | toggling = _$$$state.toggling,
|
19786 | transiting = _$$$state.transiting,
|
19787 | $el = $$.$el,
|
19788 | circle = $el.circle;
|
19789 | if (transiting === !1 && config.point_focus_only && circle) {
|
19790 | var cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$),
|
19791 | cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$),
|
19792 | withTransition = toggling || isUndefined(d),
|
19793 | fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), resizing ? !1 : withTransition);
|
19794 | if (d) {
|
19795 | circle = circle.filter(function (t) {
|
19796 | var _this5 = this,
|
19797 | data = d.filter(function (v) {
|
19798 | _newArrowCheck(this, _this5);
|
19799 | return v.id === t.id;
|
19800 | }.bind(this));
|
19801 | return data.length ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).datum(data[0]) : !1;
|
19802 | });
|
19803 | }
|
19804 | circle.attr("class", this.updatePointClass.bind(this)).style("opacity", null).each(function (d) {
|
19805 | var id = d.id,
|
19806 | index = d.index,
|
19807 | value = d.value,
|
19808 | visibility = "hidden";
|
19809 | if (isValue(value)) {
|
19810 | fn.bind(this)(d);
|
19811 | $$.expandCircles(index, id);
|
19812 | visibility = "";
|
19813 | }
|
19814 | this.style.visibility = visibility;
|
19815 | });
|
19816 | }
|
19817 | },
|
19818 | |
19819 |
|
19820 |
|
19821 |
|
19822 | hideCircleFocus: function hideCircleFocus() {
|
19823 | var $$ = this,
|
19824 | config = $$.config,
|
19825 | circle = $$.$el.circle;
|
19826 | if (config.point_focus_only && circle) {
|
19827 | $$.unexpandCircles();
|
19828 | circle.style("visibility", "hidden");
|
19829 | }
|
19830 | },
|
19831 | circleX: function circleX(d) {
|
19832 | return this.xx(d);
|
19833 | },
|
19834 | updateCircleY: function updateCircleY(isSub) {
|
19835 | var _this6 = this;
|
19836 | if (isSub === void 0) {
|
19837 | isSub = !1;
|
19838 | }
|
19839 | var $$ = this,
|
19840 | getPoints = $$.generateGetLinePoints($$.getShapeIndices($$.isLineType), isSub);
|
19841 | return function (d, i) {
|
19842 | _newArrowCheck(this, _this6);
|
19843 | var id = d.id;
|
19844 | return $$.isGrouped(id) ? getPoints(d, i)[0][1] : $$.getYScaleById(id, isSub)($$.getBaseValue(d));
|
19845 | }.bind(this);
|
19846 | },
|
19847 | expandCircles: function expandCircles(i, id, reset) {
|
19848 | var $$ = this,
|
19849 | r = $$.pointExpandedR.bind($$);
|
19850 | reset && $$.unexpandCircles();
|
19851 | var circles = $$.getShapeByIndex("circle", i, id).classed($COMMON.EXPANDED, !0),
|
19852 | scale = r(circles) / $$.config.point_r,
|
19853 | ratio = 1 - scale;
|
19854 | if ($$.isCirclePoint()) {
|
19855 | circles.attr("r", r);
|
19856 | } else {
|
19857 |
|
19858 | circles.each(function () {
|
19859 | var point = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
19860 | if (this.tagName === "circle") {
|
19861 | point.attr("r", r);
|
19862 | } else {
|
19863 | var _this$getBBox = this.getBBox(),
|
19864 | width = _this$getBBox.width,
|
19865 | height = _this$getBBox.height,
|
19866 | x = ratio * (+point.attr("x") + width / 2),
|
19867 | y = ratio * (+point.attr("y") + height / 2);
|
19868 | point.attr("transform", "translate(" + x + " " + y + ") scale(" + scale + ")");
|
19869 | }
|
19870 | });
|
19871 | }
|
19872 | },
|
19873 | unexpandCircles: function unexpandCircles(i) {
|
19874 | var $$ = this,
|
19875 | r = $$.pointR.bind($$),
|
19876 | circles = $$.getShapeByIndex("circle", i).filter(function () {
|
19877 | return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($COMMON.EXPANDED);
|
19878 | }).classed($COMMON.EXPANDED, !1);
|
19879 | circles.attr("r", r);
|
19880 | if (!$$.isCirclePoint()) {
|
19881 | var _scale = r(circles) / $$.config.point_r;
|
19882 | circles.attr("transform", _scale !== 1 ? "scale(" + _scale + ")" : null);
|
19883 | }
|
19884 | },
|
19885 | pointR: function (d) {
|
19886 | var $$ = this,
|
19887 | config = $$.config,
|
19888 | pointR = config.point_r,
|
19889 | r = pointR;
|
19890 | if ($$.isBubbleType(d)) {
|
19891 | r = $$.getBubbleR(d);
|
19892 | } else if (isFunction(pointR)) {
|
19893 | r = pointR.bind($$.api)(d);
|
19894 | }
|
19895 | return r;
|
19896 | },
|
19897 | pointExpandedR: function pointExpandedR(d) {
|
19898 | var $$ = this,
|
19899 | config = $$.config,
|
19900 | scale = $$.isBubbleType(d) ? 1.15 : 1.75;
|
19901 | return config.point_focus_expand_enabled ? config.point_focus_expand_r || $$.pointR(d) * scale : $$.pointR(d);
|
19902 | },
|
19903 | pointSelectR: function pointSelectR(d) {
|
19904 | var $$ = this,
|
19905 | selectR = $$.config.point_select_r;
|
19906 | return isFunction(selectR) ? selectR(d) : selectR || $$.pointR(d) * 4;
|
19907 | },
|
19908 | isWithinCircle: function isWithinCircle(node, r) {
|
19909 | var mouse = getPointer(this.state.event, node),
|
19910 | element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node),
|
19911 | prefix = this.isCirclePoint(node) ? "c" : "",
|
19912 | cx = +element.attr(prefix + "x"),
|
19913 | cy = +element.attr(prefix + "y");
|
19914 |
|
19915 | if (!(cx || cy) && node.nodeType === 1) {
|
19916 | var _getBoundingRect = getBoundingRect(node),
|
19917 | x = _getBoundingRect.x,
|
19918 | y = _getBoundingRect.y;
|
19919 | cx = x;
|
19920 | cy = y;
|
19921 | }
|
19922 | return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
|
19923 | },
|
19924 | insertPointInfoDefs: function insertPointInfoDefs(point, id) {
|
19925 | var _this7 = this,
|
19926 | $$ = this,
|
19927 | copyAttr = function (from, target) {
|
19928 | _newArrowCheck(this, _this7);
|
19929 | for (var attribs = from.attributes, i = 0, name; name = attribs[i]; i++) {
|
19930 | name = name.name;
|
19931 | target.setAttribute(name, from.getAttribute(name));
|
19932 | }
|
19933 | }.bind(this),
|
19934 | doc = new DOMParser().parseFromString(point, "image/svg+xml"),
|
19935 | node = doc.documentElement,
|
19936 | clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, node.nodeName.toLowerCase()),
|
19937 | _node$childNodes;
|
19938 | clone.id = id;
|
19939 | clone.style.fill = "inherit";
|
19940 | clone.style.stroke = "inherit";
|
19941 | copyAttr(node, clone);
|
19942 | if ((_node$childNodes = node.childNodes) != null && _node$childNodes.length) {
|
19943 | var parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(clone);
|
19944 | if ("innerHTML" in clone) {
|
19945 | parent.html(node.innerHTML);
|
19946 | } else {
|
19947 | toArray(node.childNodes).forEach(function (v) {
|
19948 | _newArrowCheck(this, _this7);
|
19949 | copyAttr(v, parent.append(v.tagName).node());
|
19950 | }.bind(this));
|
19951 | }
|
19952 | }
|
19953 | $$.$el.defs.node().appendChild(clone);
|
19954 | },
|
19955 | pointFromDefs: function pointFromDefs(id) {
|
19956 | return this.$el.defs.select("#" + id);
|
19957 | },
|
19958 | updatePointClass: function updatePointClass(d) {
|
19959 | var $$ = this,
|
19960 | circle = $$.$el.circle,
|
19961 | pointClass = !1;
|
19962 | if (isObject(d) || circle) {
|
19963 | pointClass = d === !0 ? circle.each(function (d) {
|
19964 | var className = $$.getClass("circle", !0)(d);
|
19965 | if (this.getAttribute("class").indexOf($COMMON.EXPANDED) > -1) {
|
19966 | className += " " + $COMMON.EXPANDED;
|
19967 | }
|
19968 | this.setAttribute("class", className);
|
19969 | }) : $$.getClass("circle", !0)(d);
|
19970 | }
|
19971 | return pointClass;
|
19972 | },
|
19973 | generateGetLinePoints: function generateGetLinePoints(lineIndices, isSub) {
|
19974 | var _this8 = this,
|
19975 | $$ = this,
|
19976 | config = $$.config,
|
19977 | x = $$.getShapeX(0, lineIndices, isSub),
|
19978 | y = $$.getShapeY(isSub),
|
19979 | lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub),
|
19980 | yScale = $$.getYScaleById.bind($$);
|
19981 | return function (d, i) {
|
19982 | _newArrowCheck(this, _this8);
|
19983 | var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
19984 | offset = lineOffset(d, i) || y0,
|
19985 | posX = x(d),
|
19986 | posY = y(d);
|
19987 |
|
19988 | if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
|
19989 | posY = y0;
|
19990 | }
|
19991 |
|
19992 |
|
19993 | var point = [posX, posY - (y0 - offset)];
|
19994 | return [point, point,
|
19995 |
|
19996 | point, point];
|
19997 | }.bind(this);
|
19998 | },
|
19999 | generatePoint: function generatePoint() {
|
20000 | var $$ = this,
|
20001 | config = $$.config,
|
20002 | datetimeId = $$.state.datetimeId,
|
20003 | ids = [],
|
20004 | pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
20005 | return function (method, context) {
|
20006 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
20007 | args[_key - 2] = arguments[_key];
|
20008 | }
|
20009 | return function (d) {
|
20010 | var _d$data,
|
20011 | id = $$.getTargetSelectorSuffix(d.id || ((_d$data = d.data) == null ? void 0 : _d$data.id) || d),
|
20012 | element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
20013 | ids.indexOf(id) < 0 && ids.push(id);
|
20014 | var point = pattern[ids.indexOf(id) % pattern.length];
|
20015 | if ($$.hasValidPointType(point)) {
|
20016 | point = $$[point];
|
20017 | } else if (!$$.hasValidPointDrawMethods(point)) {
|
20018 | var pointId = datetimeId + "-point" + id,
|
20019 | pointFromDefs = $$.pointFromDefs(pointId);
|
20020 | if (pointFromDefs.size() < 1) {
|
20021 | $$.insertPointInfoDefs(point, pointId);
|
20022 | }
|
20023 | if (method === "create") {
|
20024 | return $$.custom.create.bind(context).apply(void 0, [element, pointId].concat(args));
|
20025 | } else if (method === "update") {
|
20026 | return $$.custom.update.bind(context).apply(void 0, [element].concat(args));
|
20027 | }
|
20028 | }
|
20029 | return point[method].bind(context).apply(void 0, [element].concat(args));
|
20030 | };
|
20031 | };
|
20032 | },
|
20033 | custom: {
|
20034 | create: function create(element, id, fillStyleFn) {
|
20035 | return element.append("use").attr("xlink:href", "#" + id).attr("class", this.updatePointClass.bind(this)).style("fill", fillStyleFn).node();
|
20036 | },
|
20037 | update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
20038 | var _this9 = this,
|
20039 | $$ = this,
|
20040 | _element$node$getBBox = element.node().getBBox(),
|
20041 | width = _element$node$getBBox.width,
|
20042 | height = _element$node$getBBox.height,
|
20043 | xPosFn2 = function (d) {
|
20044 | _newArrowCheck(this, _this9);
|
20045 | return isValue(d.value) ? xPosFn(d) - width / 2 : 0;
|
20046 | }.bind(this),
|
20047 | yPosFn2 = function (d) {
|
20048 | _newArrowCheck(this, _this9);
|
20049 | return isValue(d.value) ? yPosFn(d) - height / 2 : 0;
|
20050 | }.bind(this),
|
20051 | mainCircles = element;
|
20052 | if (withTransition) {
|
20053 | flow && mainCircles.attr("x", xPosFn2);
|
20054 | mainCircles = $$.$T(mainCircles, withTransition, getTransitionName());
|
20055 | selectedCircles && $$.$T(selectedCircles, withTransition, getTransitionName());
|
20056 | }
|
20057 | return mainCircles.attr("x", xPosFn2).attr("y", yPosFn2).style("fill", fillStyleFn);
|
20058 | }
|
20059 | },
|
20060 |
|
20061 | circle: {
|
20062 | create: function create(element, sizeFn, fillStyleFn) {
|
20063 | return element.append("circle").attr("class", this.updatePointClass.bind(this)).attr("r", sizeFn).style("fill", fillStyleFn).node();
|
20064 | },
|
20065 | update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
20066 | var $$ = this,
|
20067 | mainCircles = element;
|
20068 |
|
20069 | if ($$.hasType("bubble")) {
|
20070 | mainCircles.attr("r", $$.pointR.bind($$));
|
20071 | }
|
20072 | if (withTransition) {
|
20073 | flow && mainCircles.attr("cx", xPosFn);
|
20074 | if (mainCircles.attr("cx")) {
|
20075 | mainCircles = $$.$T(mainCircles, withTransition, getTransitionName());
|
20076 | }
|
20077 | selectedCircles && $$.$T(mainCircles, withTransition, getTransitionName());
|
20078 | }
|
20079 | return mainCircles.attr("cx", xPosFn).attr("cy", yPosFn).style("fill", fillStyleFn);
|
20080 | }
|
20081 | },
|
20082 |
|
20083 | rectangle: {
|
20084 | create: function create(element, sizeFn, fillStyleFn) {
|
20085 | var _this10 = this,
|
20086 | rectSizeFn = function (d) {
|
20087 | _newArrowCheck(this, _this10);
|
20088 | return sizeFn(d) * 2;
|
20089 | }.bind(this);
|
20090 | return element.append("rect").attr("class", this.updatePointClass.bind(this)).attr("width", rectSizeFn).attr("height", rectSizeFn).style("fill", fillStyleFn).node();
|
20091 | },
|
20092 | update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
20093 | var _this11 = this,
|
20094 | $$ = this,
|
20095 | r = $$.config.point_r,
|
20096 | rectXPosFn = function (d) {
|
20097 | _newArrowCheck(this, _this11);
|
20098 | return xPosFn(d) - r;
|
20099 | }.bind(this),
|
20100 | rectYPosFn = function (d) {
|
20101 | _newArrowCheck(this, _this11);
|
20102 | return yPosFn(d) - r;
|
20103 | }.bind(this),
|
20104 | mainCircles = element;
|
20105 | if (withTransition) {
|
20106 | flow && mainCircles.attr("x", rectXPosFn);
|
20107 | mainCircles = $$.$T(mainCircles, withTransition, getTransitionName());
|
20108 | selectedCircles && $$.$T(selectedCircles, withTransition, getTransitionName());
|
20109 | }
|
20110 | return mainCircles.attr("x", rectXPosFn).attr("y", rectYPosFn).style("fill", fillStyleFn);
|
20111 | }
|
20112 | }
|
20113 | });
|
20114 | ;
|
20115 |
|
20116 |
|
20117 |
|
20118 |
|
20119 |
|
20120 |
|
20121 |
|
20122 |
|
20123 |
|
20124 |
|
20125 |
|
20126 |
|
20127 |
|
20128 | function getDataMax($$) {
|
20129 | var levelMax = $$.config.polar_level_max,
|
20130 | dataMax = $$.getMinMaxData().max[0].value;
|
20131 |
|
20132 | if (levelMax && levelMax > dataMax) {
|
20133 | dataMax = levelMax;
|
20134 | }
|
20135 | return dataMax;
|
20136 | }
|
20137 | var polar = ({
|
20138 | |
20139 |
|
20140 |
|
20141 |
|
20142 | initPolar: function initPolar() {
|
20143 | var $$ = this,
|
20144 | arcs = $$.$el.arcs,
|
20145 | config = $$.config,
|
20146 | levelTextShow = config.polar_level_text_show,
|
20147 | levelTextBgColor = config.polar_level_text_backgroundColor;
|
20148 |
|
20149 | arcs.levels = arcs.append("g").attr("class", $LEVEL.levels);
|
20150 |
|
20151 |
|
20152 | if (levelTextShow && levelTextBgColor) {
|
20153 | $$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
|
20154 | }
|
20155 | },
|
20156 | |
20157 |
|
20158 |
|
20159 |
|
20160 |
|
20161 |
|
20162 |
|
20163 | getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
|
20164 | var _d$data$values$0$valu,
|
20165 | dataMax = getDataMax(this);
|
20166 | return ((_d$data$values$0$valu = d == null ? void 0 : d.data.values[0].value) != null ? _d$data$values$0$valu : 0) / dataMax * outerRadius;
|
20167 | },
|
20168 | |
20169 |
|
20170 |
|
20171 |
|
20172 |
|
20173 | updateTargetsForPolar: function updateTargetsForPolar(targets) {
|
20174 |
|
20175 | this.updateTargetsForArc(targets);
|
20176 | },
|
20177 | |
20178 |
|
20179 |
|
20180 |
|
20181 | redrawPolar: function redrawPolar() {
|
20182 | var $$ = this,
|
20183 | config = $$.config;
|
20184 | config.polar_level_show && $$.updatePolarLevel();
|
20185 | },
|
20186 | |
20187 |
|
20188 |
|
20189 |
|
20190 | updatePolarLevel: function updatePolarLevel() {
|
20191 | var _this = this,
|
20192 | $$ = this,
|
20193 | config = $$.config,
|
20194 | state = $$.state,
|
20195 | levels = $$.$el.arcs.levels,
|
20196 | depth = config.polar_level_depth,
|
20197 | dataMax = getDataMax($$),
|
20198 | levelData = getRange(0, depth),
|
20199 | outerRadius = state.radius,
|
20200 | levelRatio = levelData.map(function (l) {
|
20201 | _newArrowCheck(this, _this);
|
20202 | return outerRadius * ((l + 1) / depth);
|
20203 | }.bind(this)),
|
20204 | levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
|
20205 | level = levels.selectAll("." + $LEVEL.level).data(levelData);
|
20206 | level.exit().remove();
|
20207 | var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
20208 | _newArrowCheck(this, _this);
|
20209 | return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
20210 | }.bind(this));
|
20211 |
|
20212 |
|
20213 | levelEnter.append("circle");
|
20214 | levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
|
20215 | _newArrowCheck(this, _this);
|
20216 | return levelRatio[d];
|
20217 | }.bind(this));
|
20218 | if (config.polar_level_text_show) {
|
20219 | var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
|
20220 | defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
|
20221 | levelEnter.append("text").style("text-anchor", "middle");
|
20222 | levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
|
20223 | _newArrowCheck(this, _this);
|
20224 | return -levelRatio[d] + 5;
|
20225 | }.bind(this)).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
|
20226 | _newArrowCheck(this, _this);
|
20227 | return levelTextFormat(dataMax / levelData.length * (d + 1));
|
20228 | }.bind(this));
|
20229 | }
|
20230 | }
|
20231 | });
|
20232 | ;
|
20233 |
|
20234 |
|
20235 |
|
20236 |
|
20237 |
|
20238 |
|
20239 |
|
20240 |
|
20241 |
|
20242 |
|
20243 |
|
20244 |
|
20245 |
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 |
|
20252 |
|
20253 |
|
20254 | function getPosition(isClockwise, type, edge, pos, range, ratio) {
|
20255 | var index = isClockwise && pos > 0 ? edge - pos : pos,
|
20256 | r = 2 * Math.PI,
|
20257 | func = type === "x" ? Math.sin : Math.cos;
|
20258 | return range * (1 - ratio * func(index * r / edge));
|
20259 | }
|
20260 |
|
20261 |
|
20262 | var cacheKey = KEY.radarPoints;
|
20263 | var radar = ({
|
20264 | initRadar: function initRadar() {
|
20265 | var $$ = this,
|
20266 | config = $$.config,
|
20267 | current = $$.state.current,
|
20268 | $el = $$.$el;
|
20269 | if ($$.hasType("radar")) {
|
20270 | $el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars);
|
20271 |
|
20272 |
|
20273 | $el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels);
|
20274 |
|
20275 |
|
20276 | $el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis);
|
20277 |
|
20278 |
|
20279 | $el.radar.shapes = $el.radar.append("g").attr("class", $SHAPE.shapes);
|
20280 | current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
|
20281 | }
|
20282 | },
|
20283 | getRadarSize: function getRadarSize() {
|
20284 | var $$ = this,
|
20285 | config = $$.config,
|
20286 | _$$$state = $$.state,
|
20287 | arcWidth = _$$$state.arcWidth,
|
20288 | arcHeight = _$$$state.arcHeight,
|
20289 | padding = config.axis_x_categories.length < 4 ? -20 : 10,
|
20290 | size = (Math.min(arcWidth, arcHeight) - padding) / 2;
|
20291 | return [size, size];
|
20292 | },
|
20293 | updateTargetsForRadar: function updateTargetsForRadar(targets) {
|
20294 | var _this = this,
|
20295 | $$ = this,
|
20296 | config = $$.config;
|
20297 | if (isEmpty(config.axis_x_categories)) {
|
20298 | config.axis_x_categories = getRange(0, getMinMax("max", targets.map(function (v) {
|
20299 | _newArrowCheck(this, _this);
|
20300 | return v.values.length;
|
20301 | }.bind(this))));
|
20302 | }
|
20303 | $$.generateRadarPoints();
|
20304 | },
|
20305 | getRadarPosition: function getRadarPosition(type, index, range, ratio) {
|
20306 | var _this2 = this,
|
20307 | $$ = this,
|
20308 | config = $$.config,
|
20309 | _$$$getRadarSize = $$.getRadarSize(),
|
20310 | width = _$$$getRadarSize[0],
|
20311 | height = _$$$getRadarSize[1],
|
20312 | edge = config.axis_x_categories.length,
|
20313 | isClockwise = config.radar_direction_clockwise,
|
20314 | pos = toArray(type).map(function (v) {
|
20315 | _newArrowCheck(this, _this2);
|
20316 | return getPosition(isClockwise, v, edge, index, isDefined(range) ? range : type === "x" ? width : height, isNumber(ratio) ? ratio : config.radar_size_ratio);
|
20317 | }.bind(this));
|
20318 | return pos.length === 1 ? pos[0] : pos;
|
20319 | },
|
20320 | |
20321 |
|
20322 |
|
20323 |
|
20324 | generateRadarPoints: function generateRadarPoints() {
|
20325 | var _this3 = this,
|
20326 | $$ = this,
|
20327 | targets = $$.data.targets,
|
20328 | _$$$getRadarSize2 = $$.getRadarSize(),
|
20329 | width = _$$$getRadarSize2[0],
|
20330 | height = _$$$getRadarSize2[1],
|
20331 | points = $$.cache.get(cacheKey) || {},
|
20332 | size = points._size;
|
20333 |
|
20334 | if (!size || size.width !== width && size.height !== height) {
|
20335 | targets.forEach(function (d) {
|
20336 | var _this4 = this;
|
20337 | _newArrowCheck(this, _this3);
|
20338 | points[d.id] = d.values.map(function (v, i) {
|
20339 | _newArrowCheck(this, _this4);
|
20340 | return $$.getRadarPosition(["x", "y"], i, undefined, $$.getRatio("radar", v));
|
20341 | }.bind(this));
|
20342 | }.bind(this));
|
20343 | points._size = {
|
20344 | width: width,
|
20345 | height: height
|
20346 | };
|
20347 | $$.cache.add(cacheKey, points);
|
20348 | }
|
20349 | },
|
20350 | redrawRadar: function redrawRadar() {
|
20351 | var $$ = this,
|
20352 | _$$$$el = $$.$el,
|
20353 | radar = _$$$$el.radar,
|
20354 | main = _$$$$el.main,
|
20355 | translate = $$.getTranslate("radar");
|
20356 |
|
20357 | if (translate) {
|
20358 | radar.attr("transform", translate);
|
20359 | main.select("." + $TEXT.chartTexts).attr("transform", translate);
|
20360 | $$.generateRadarPoints();
|
20361 | $$.updateRadarLevel();
|
20362 | $$.updateRadarAxes();
|
20363 | $$.updateRadarShape();
|
20364 | }
|
20365 | },
|
20366 | generateGetRadarPoints: function generateGetRadarPoints() {
|
20367 | var _this5 = this,
|
20368 | points = this.cache.get(cacheKey);
|
20369 | return function (d, i) {
|
20370 | _newArrowCheck(this, _this5);
|
20371 | var point = points[d.id][i];
|
20372 | return [point, point, point, point];
|
20373 | }.bind(this);
|
20374 | },
|
20375 | updateRadarLevel: function updateRadarLevel() {
|
20376 | var _this6 = this,
|
20377 | $$ = this,
|
20378 | config = $$.config,
|
20379 | state = $$.state,
|
20380 | radar = $$.$el.radar,
|
20381 | _$$$getRadarSize3 = $$.getRadarSize(),
|
20382 | width = _$$$getRadarSize3[0],
|
20383 | height = _$$$getRadarSize3[1],
|
20384 | depth = config.radar_level_depth,
|
20385 | edge = config.axis_x_categories.length,
|
20386 | showText = config.radar_level_text_show,
|
20387 | radarLevels = radar.levels,
|
20388 | levelData = getRange(0, depth),
|
20389 | radius = config.radar_size_ratio * Math.min(width, height),
|
20390 | levelRatio = levelData.map(function (l) {
|
20391 | _newArrowCheck(this, _this6);
|
20392 | return radius * ((l + 1) / depth);
|
20393 | }.bind(this)),
|
20394 | levelTextFormat = (config.radar_level_text_format || function () {}).bind($$.api),
|
20395 | points = levelData.map(function (v) {
|
20396 | var _this7 = this;
|
20397 | _newArrowCheck(this, _this6);
|
20398 | var range = levelRatio[v],
|
20399 | pos = getRange(0, edge).map(function (i) {
|
20400 | _newArrowCheck(this, _this7);
|
20401 | return $$.getRadarPosition(["x", "y"], i, range, 1).join(",");
|
20402 | }.bind(this));
|
20403 | return pos.join(" ");
|
20404 | }.bind(this)),
|
20405 | level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
|
20406 | level.exit().remove();
|
20407 | var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
20408 | _newArrowCheck(this, _this6);
|
20409 | return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
20410 | }.bind(this));
|
20411 | levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
|
20412 | if (showText) {
|
20413 | if (radarLevels.select("text").empty()) {
|
20414 | radarLevels.append("text").attr("dx", "-.5em").attr("dy", "-.7em").style("text-anchor", "end").text(function () {
|
20415 | _newArrowCheck(this, _this6);
|
20416 | return levelTextFormat(0);
|
20417 | }.bind(this));
|
20418 | }
|
20419 | levelEnter.append("text").attr("dx", "-.5em").style("text-anchor", "end").text(function (d) {
|
20420 | _newArrowCheck(this, _this6);
|
20421 | return levelTextFormat(state.current.dataMax / levelData.length * (d + 1));
|
20422 | }.bind(this));
|
20423 | }
|
20424 | levelEnter.merge(level).attr("transform", function (d) {
|
20425 | _newArrowCheck(this, _this6);
|
20426 | return "translate(" + (width - levelRatio[d]) + ", " + (height - levelRatio[d]) + ")";
|
20427 | }.bind(this)).selectAll("polygon").attr("points", function (d) {
|
20428 | _newArrowCheck(this, _this6);
|
20429 | return points[d];
|
20430 | }.bind(this));
|
20431 |
|
20432 |
|
20433 | if (showText) {
|
20434 | radarLevels.selectAll("text").attr("x", function (d) {
|
20435 | _newArrowCheck(this, _this6);
|
20436 | return isUndefined(d) ? width : points[d].split(",")[0];
|
20437 | }.bind(this)).attr("y", function (d) {
|
20438 | _newArrowCheck(this, _this6);
|
20439 | return isUndefined(d) ? height : 0;
|
20440 | }.bind(this));
|
20441 | }
|
20442 | },
|
20443 | updateRadarAxes: function updateRadarAxes() {
|
20444 | var _this8 = this,
|
20445 | $$ = this,
|
20446 | config = $$.config,
|
20447 | radar = $$.$el.radar,
|
20448 | _$$$getRadarSize4 = $$.getRadarSize(),
|
20449 | width = _$$$getRadarSize4[0],
|
20450 | height = _$$$getRadarSize4[1],
|
20451 | categories = config.axis_x_categories,
|
20452 | axis = radar.axes.selectAll("g").data(categories);
|
20453 | axis.exit().remove();
|
20454 | var axisEnter = axis.enter().append("g").attr("class", function (d, i) {
|
20455 | _newArrowCheck(this, _this8);
|
20456 | return $AXIS.axis + "-" + i;
|
20457 | }.bind(this));
|
20458 | config.radar_axis_line_show && axisEnter.append("line");
|
20459 | config.radar_axis_text_show && axisEnter.append("text");
|
20460 | axis = axisEnter.merge(axis);
|
20461 |
|
20462 |
|
20463 | if (config.radar_axis_line_show) {
|
20464 | axis.select("line").attr("x1", width).attr("y1", height).attr("x2", function (d, i) {
|
20465 | _newArrowCheck(this, _this8);
|
20466 | return $$.getRadarPosition("x", i);
|
20467 | }.bind(this)).attr("y2", function (d, i) {
|
20468 | _newArrowCheck(this, _this8);
|
20469 | return $$.getRadarPosition("y", i);
|
20470 | }.bind(this));
|
20471 | }
|
20472 |
|
20473 |
|
20474 | if (config.radar_axis_text_show) {
|
20475 | var _config$radar_axis_te = config.radar_axis_text_position,
|
20476 | _config$radar_axis_te2 = _config$radar_axis_te.x,
|
20477 | x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2,
|
20478 | _config$radar_axis_te3 = _config$radar_axis_te.y,
|
20479 | y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3;
|
20480 | axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
|
20481 | _newArrowCheck(this, _this8);
|
20482 | selection.each(function (d) {
|
20483 | setTextValue((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), d + "", [-.6, 1.2]);
|
20484 | });
|
20485 | }.bind(this)).datum(function (d, i) {
|
20486 | _newArrowCheck(this, _this8);
|
20487 | return {
|
20488 | index: i
|
20489 | };
|
20490 | }.bind(this)).attr("transform", function (d) {
|
20491 | if (isUndefined(this.width)) {
|
20492 |
|
20493 | this.width = this.getBoundingClientRect().width / 2;
|
20494 | }
|
20495 | var posX = $$.getRadarPosition("x", d.index, undefined, 1),
|
20496 | posY = Math.round($$.getRadarPosition("y", d.index, undefined, 1));
|
20497 | if (posX > width) {
|
20498 | posX += this.width + x;
|
20499 | } else if (Math.round(posX) < width) {
|
20500 | posX -= this.width + x;
|
20501 | }
|
20502 | if (posY > height) {
|
20503 |
|
20504 | if (posY / 2 === height && this.firstChild.tagName === "tspan") {
|
20505 | this.firstChild.setAttribute("dy", "0em");
|
20506 | }
|
20507 | posY += y;
|
20508 | } else if (posY < height) {
|
20509 | posY -= y;
|
20510 | }
|
20511 | return "translate(" + posX + " " + posY + ")";
|
20512 | });
|
20513 | }
|
20514 | $$.bindEvent();
|
20515 | },
|
20516 | bindEvent: function bindEvent() {
|
20517 | var _this9 = this,
|
20518 | $$ = this,
|
20519 | config = $$.config,
|
20520 | state = $$.state,
|
20521 | _$$$$el2 = $$.$el,
|
20522 | radar = _$$$$el2.radar,
|
20523 | svg = _$$$$el2.svg,
|
20524 | focusOnly = config.point_focus_only,
|
20525 | _state = state,
|
20526 | inputType = _state.inputType,
|
20527 | transiting = _state.transiting;
|
20528 | if (config.interaction_enabled) {
|
20529 | var isMouse = inputType === "mouse",
|
20530 | getIndex = function (event) {
|
20531 | _newArrowCheck(this, _this9);
|
20532 | var target = event.target;
|
20533 |
|
20534 |
|
20535 | if (/tspan/i.test(target.tagName)) {
|
20536 | target = target.parentNode;
|
20537 | }
|
20538 | var d = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
20539 | return d && Object.keys(d).length === 1 ? d.index : undefined;
|
20540 | }.bind(this),
|
20541 | hide = function (event) {
|
20542 | _newArrowCheck(this, _this9);
|
20543 | state.event = event;
|
20544 | var index = getIndex(event),
|
20545 | noIndex = isUndefined(index);
|
20546 | if (isMouse || noIndex) {
|
20547 | $$.hideTooltip();
|
20548 | focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles();
|
20549 | if (isMouse) {
|
20550 | $$.setOverOut(!1, index);
|
20551 | } else if (noIndex) {
|
20552 | $$.callOverOutForTouch();
|
20553 | }
|
20554 | }
|
20555 | }.bind(this);
|
20556 | radar.axes.selectAll("text").on(isMouse ? "mouseover " : "touchstart", function (event) {
|
20557 | _newArrowCheck(this, _this9);
|
20558 | if (transiting) {
|
20559 |
|
20560 | return;
|
20561 | }
|
20562 | state.event = event;
|
20563 | var index = getIndex(event);
|
20564 | $$.selectRectForSingle(svg.node(), null, index);
|
20565 | isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
|
20566 | }.bind(this)).on("mouseout", isMouse ? hide : null);
|
20567 | if (!isMouse) {
|
20568 | svg.on("touchstart", hide);
|
20569 | }
|
20570 | }
|
20571 | },
|
20572 | updateRadarShape: function updateRadarShape() {
|
20573 | var _this10 = this,
|
20574 | $$ = this,
|
20575 | targets = $$.data.targets.filter(function (d) {
|
20576 | _newArrowCheck(this, _this10);
|
20577 | return $$.isRadarType(d);
|
20578 | }.bind(this)),
|
20579 | points = $$.cache.get(cacheKey),
|
20580 | areas = $$.$el.radar.shapes.selectAll("polygon").data(targets),
|
20581 | areasEnter = areas.enter().append("g").attr("class", $$.getChartClass("Radar"));
|
20582 | $$.$T(areas.exit()).remove();
|
20583 | areasEnter.append("polygon").merge(areas).style("fill", $$.color).style("stroke", $$.color).attr("points", function (d) {
|
20584 | _newArrowCheck(this, _this10);
|
20585 | return points[d.id].join(" ");
|
20586 | }.bind(this));
|
20587 | $$.updateTargetForCircle(targets, areasEnter);
|
20588 | },
|
20589 | |
20590 |
|
20591 |
|
20592 |
|
20593 |
|
20594 |
|
20595 | radarCircleX: function radarCircleX(d) {
|
20596 | return this.cache.get(cacheKey)[d.id][d.index][0];
|
20597 | },
|
20598 | |
20599 |
|
20600 |
|
20601 |
|
20602 |
|
20603 |
|
20604 | radarCircleY: function radarCircleY(d) {
|
20605 | return this.cache.get(cacheKey)[d.id][d.index][1];
|
20606 | }
|
20607 | });
|
20608 | ;
|
20609 |
|
20610 |
|
20611 |
|
20612 |
|
20613 |
|
20614 |
|
20615 |
|
20616 | var common_point = ({
|
20617 | |
20618 |
|
20619 |
|
20620 |
|
20621 |
|
20622 |
|
20623 |
|
20624 |
|
20625 |
|
20626 |
|
20627 |
|
20628 |
|
20629 |
|
20630 |
|
20631 |
|
20632 |
|
20633 |
|
20634 |
|
20635 |
|
20636 |
|
20637 |
|
20638 |
|
20639 |
|
20640 |
|
20641 |
|
20642 |
|
20643 |
|
20644 |
|
20645 |
|
20646 |
|
20647 |
|
20648 |
|
20649 |
|
20650 |
|
20651 |
|
20652 |
|
20653 |
|
20654 |
|
20655 |
|
20656 |
|
20657 |
|
20658 |
|
20659 |
|
20660 |
|
20661 |
|
20662 |
|
20663 |
|
20664 |
|
20665 |
|
20666 |
|
20667 |
|
20668 |
|
20669 |
|
20670 |
|
20671 |
|
20672 |
|
20673 |
|
20674 |
|
20675 |
|
20676 |
|
20677 |
|
20678 |
|
20679 |
|
20680 |
|
20681 |
|
20682 |
|
20683 |
|
20684 |
|
20685 |
|
20686 |
|
20687 |
|
20688 |
|
20689 |
|
20690 |
|
20691 |
|
20692 |
|
20693 |
|
20694 |
|
20695 |
|
20696 |
|
20697 |
|
20698 | point_show: !0,
|
20699 | point_r: 2.5,
|
20700 | point_sensitivity: 10,
|
20701 | point_focus_expand_enabled: !0,
|
20702 | point_focus_expand_r: undefined,
|
20703 | point_focus_only: !1,
|
20704 | point_opacity: undefined,
|
20705 | point_pattern: [],
|
20706 | point_select_r: undefined,
|
20707 | point_type: "circle"
|
20708 | });
|
20709 | ;
|
20710 |
|
20711 |
|
20712 |
|
20713 |
|
20714 |
|
20715 |
|
20716 |
|
20717 | var Options_shape_area = ({
|
20718 | |
20719 |
|
20720 |
|
20721 |
|
20722 |
|
20723 |
|
20724 |
|
20725 |
|
20726 |
|
20727 |
|
20728 |
|
20729 |
|
20730 |
|
20731 |
|
20732 |
|
20733 |
|
20734 |
|
20735 |
|
20736 |
|
20737 |
|
20738 |
|
20739 |
|
20740 |
|
20741 |
|
20742 |
|
20743 |
|
20744 |
|
20745 |
|
20746 |
|
20747 |
|
20748 |
|
20749 |
|
20750 |
|
20751 |
|
20752 |
|
20753 |
|
20754 |
|
20755 |
|
20756 |
|
20757 |
|
20758 |
|
20759 |
|
20760 |
|
20761 |
|
20762 |
|
20763 |
|
20764 |
|
20765 |
|
20766 |
|
20767 |
|
20768 |
|
20769 |
|
20770 |
|
20771 |
|
20772 |
|
20773 | area_above: !1,
|
20774 | area_below: !1,
|
20775 | area_front: !0,
|
20776 | area_linearGradient: !1,
|
20777 | area_zerobased: !0
|
20778 | });
|
20779 | ;
|
20780 |
|
20781 |
|
20782 |
|
20783 |
|
20784 |
|
20785 |
|
20786 |
|
20787 | var shape_bar = ({
|
20788 | |
20789 |
|
20790 |
|
20791 |
|
20792 |
|
20793 |
|
20794 |
|
20795 |
|
20796 |
|
20797 |
|
20798 |
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 |
|
20807 |
|
20808 |
|
20809 |
|
20810 |
|
20811 |
|
20812 |
|
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 |
|
20818 |
|
20819 |
|
20820 |
|
20821 |
|
20822 |
|
20823 |
|
20824 |
|
20825 |
|
20826 |
|
20827 |
|
20828 |
|
20829 |
|
20830 |
|
20831 |
|
20832 |
|
20833 |
|
20834 |
|
20835 |
|
20836 |
|
20837 |
|
20838 |
|
20839 |
|
20840 |
|
20841 |
|
20842 |
|
20843 |
|
20844 |
|
20845 |
|
20846 |
|
20847 |
|
20848 |
|
20849 |
|
20850 |
|
20851 |
|
20852 |
|
20853 |
|
20854 |
|
20855 |
|
20856 |
|
20857 |
|
20858 |
|
20859 |
|
20860 |
|
20861 |
|
20862 |
|
20863 |
|
20864 |
|
20865 |
|
20866 |
|
20867 |
|
20868 |
|
20869 |
|
20870 |
|
20871 |
|
20872 |
|
20873 |
|
20874 |
|
20875 |
|
20876 |
|
20877 |
|
20878 |
|
20879 |
|
20880 |
|
20881 |
|
20882 |
|
20883 |
|
20884 |
|
20885 |
|
20886 |
|
20887 |
|
20888 |
|
20889 |
|
20890 |
|
20891 |
|
20892 |
|
20893 |
|
20894 | bar_label_threshold: 0,
|
20895 | bar_linearGradient: !1,
|
20896 | bar_indices_removeNull: !1,
|
20897 | bar_overlap: !1,
|
20898 | bar_padding: 0,
|
20899 | bar_radius: undefined,
|
20900 | bar_radius_ratio: undefined,
|
20901 | bar_sensitivity: 2,
|
20902 | bar_width: undefined,
|
20903 | bar_width_ratio: .6,
|
20904 | bar_width_max: undefined,
|
20905 | bar_zerobased: !0
|
20906 | });
|
20907 | ;
|
20908 |
|
20909 |
|
20910 |
|
20911 |
|
20912 |
|
20913 |
|
20914 |
|
20915 | var shape_bubble = ({
|
20916 | |
20917 |
|
20918 |
|
20919 |
|
20920 |
|
20921 |
|
20922 |
|
20923 |
|
20924 |
|
20925 |
|
20926 |
|
20927 |
|
20928 |
|
20929 |
|
20930 |
|
20931 |
|
20932 |
|
20933 |
|
20934 |
|
20935 |
|
20936 |
|
20937 |
|
20938 |
|
20939 | bubble_maxR: 35,
|
20940 | bubble_zerobased: !1
|
20941 | });
|
20942 | ;
|
20943 |
|
20944 |
|
20945 |
|
20946 |
|
20947 |
|
20948 |
|
20949 |
|
20950 | var shape_candlestick = ({
|
20951 | |
20952 |
|
20953 |
|
20954 |
|
20955 |
|
20956 |
|
20957 |
|
20958 |
|
20959 |
|
20960 |
|
20961 |
|
20962 |
|
20963 |
|
20964 |
|
20965 |
|
20966 |
|
20967 |
|
20968 |
|
20969 |
|
20970 |
|
20971 |
|
20972 |
|
20973 |
|
20974 |
|
20975 |
|
20976 |
|
20977 |
|
20978 |
|
20979 |
|
20980 |
|
20981 |
|
20982 |
|
20983 |
|
20984 |
|
20985 |
|
20986 |
|
20987 |
|
20988 |
|
20989 |
|
20990 |
|
20991 |
|
20992 |
|
20993 |
|
20994 |
|
20995 |
|
20996 |
|
20997 |
|
20998 | candlestick_width: undefined,
|
20999 | candlestick_width_ratio: .6,
|
21000 | candlestick_width_max: undefined,
|
21001 | candlestick_color_down: "red"
|
21002 | });
|
21003 | ;
|
21004 |
|
21005 |
|
21006 |
|
21007 |
|
21008 |
|
21009 |
|
21010 |
|
21011 | var shape_line = ({
|
21012 | |
21013 |
|
21014 |
|
21015 |
|
21016 |
|
21017 |
|
21018 |
|
21019 |
|
21020 |
|
21021 |
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 |
|
21027 |
|
21028 |
|
21029 |
|
21030 |
|
21031 |
|
21032 |
|
21033 |
|
21034 |
|
21035 |
|
21036 |
|
21037 |
|
21038 |
|
21039 |
|
21040 |
|
21041 |
|
21042 |
|
21043 |
|
21044 |
|
21045 |
|
21046 |
|
21047 |
|
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 |
|
21054 | line_connectNull: !1,
|
21055 | line_step_type: "step",
|
21056 | line_step_tooltipMatch: !1,
|
21057 | line_zerobased: !1,
|
21058 | line_classes: undefined,
|
21059 | line_point: !0
|
21060 | });
|
21061 | ;
|
21062 |
|
21063 |
|
21064 |
|
21065 |
|
21066 |
|
21067 |
|
21068 |
|
21069 | var scatter = ({
|
21070 | |
21071 |
|
21072 |
|
21073 |
|
21074 |
|
21075 |
|
21076 |
|
21077 |
|
21078 |
|
21079 |
|
21080 |
|
21081 |
|
21082 |
|
21083 |
|
21084 |
|
21085 |
|
21086 |
|
21087 |
|
21088 |
|
21089 |
|
21090 |
|
21091 |
|
21092 |
|
21093 |
|
21094 |
|
21095 | scatter_zerobased: !1
|
21096 | });
|
21097 | ;
|
21098 |
|
21099 |
|
21100 |
|
21101 |
|
21102 |
|
21103 |
|
21104 |
|
21105 | var spline = ({
|
21106 | |
21107 |
|
21108 |
|
21109 |
|
21110 |
|
21111 |
|
21112 |
|
21113 |
|
21114 |
|
21115 |
|
21116 |
|
21117 |
|
21118 |
|
21119 |
|
21120 |
|
21121 |
|
21122 |
|
21123 |
|
21124 |
|
21125 |
|
21126 |
|
21127 |
|
21128 |
|
21129 |
|
21130 |
|
21131 |
|
21132 |
|
21133 |
|
21134 |
|
21135 |
|
21136 |
|
21137 |
|
21138 |
|
21139 |
|
21140 |
|
21141 | spline_interpolation_type: "cardinal"
|
21142 | });
|
21143 | ;
|
21144 |
|
21145 |
|
21146 |
|
21147 |
|
21148 |
|
21149 |
|
21150 |
|
21151 | var donut = ({
|
21152 | |
21153 |
|
21154 |
|
21155 |
|
21156 |
|
21157 |
|
21158 |
|
21159 |
|
21160 |
|
21161 |
|
21162 |
|
21163 |
|
21164 |
|
21165 |
|
21166 |
|
21167 |
|
21168 |
|
21169 |
|
21170 |
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 |
|
21176 |
|
21177 |
|
21178 |
|
21179 |
|
21180 |
|
21181 |
|
21182 |
|
21183 |
|
21184 |
|
21185 |
|
21186 |
|
21187 |
|
21188 |
|
21189 |
|
21190 |
|
21191 |
|
21192 |
|
21193 |
|
21194 |
|
21195 |
|
21196 |
|
21197 |
|
21198 |
|
21199 |
|
21200 |
|
21201 |
|
21202 |
|
21203 |
|
21204 |
|
21205 |
|
21206 |
|
21207 |
|
21208 |
|
21209 |
|
21210 |
|
21211 |
|
21212 |
|
21213 | donut_label_show: !0,
|
21214 | donut_label_format: undefined,
|
21215 | donut_label_threshold: .05,
|
21216 | donut_label_ratio: undefined,
|
21217 | donut_width: undefined,
|
21218 | donut_title: "",
|
21219 | donut_expand: {},
|
21220 | donut_expand_rate: .98,
|
21221 | donut_expand_duration: 50,
|
21222 | donut_padAngle: 0,
|
21223 | donut_startingAngle: 0
|
21224 | });
|
21225 | ;
|
21226 |
|
21227 |
|
21228 |
|
21229 |
|
21230 |
|
21231 |
|
21232 |
|
21233 | var shape_gauge = ({
|
21234 | |
21235 |
|
21236 |
|
21237 |
|
21238 |
|
21239 |
|
21240 |
|
21241 |
|
21242 |
|
21243 |
|
21244 |
|
21245 |
|
21246 |
|
21247 |
|
21248 |
|
21249 |
|
21250 |
|
21251 |
|
21252 |
|
21253 |
|
21254 |
|
21255 |
|
21256 |
|
21257 |
|
21258 |
|
21259 |
|
21260 |
|
21261 |
|
21262 |
|
21263 |
|
21264 |
|
21265 |
|
21266 |
|
21267 |
|
21268 |
|
21269 |
|
21270 |
|
21271 |
|
21272 |
|
21273 |
|
21274 |
|
21275 |
|
21276 |
|
21277 |
|
21278 |
|
21279 |
|
21280 |
|
21281 |
|
21282 |
|
21283 |
|
21284 |
|
21285 |
|
21286 |
|
21287 |
|
21288 |
|
21289 |
|
21290 |
|
21291 |
|
21292 |
|
21293 |
|
21294 |
|
21295 |
|
21296 |
|
21297 |
|
21298 |
|
21299 |
|
21300 |
|
21301 |
|
21302 |
|
21303 |
|
21304 |
|
21305 |
|
21306 |
|
21307 |
|
21308 |
|
21309 |
|
21310 |
|
21311 |
|
21312 |
|
21313 |
|
21314 |
|
21315 |
|
21316 |
|
21317 |
|
21318 |
|
21319 |
|
21320 |
|
21321 |
|
21322 |
|
21323 |
|
21324 |
|
21325 |
|
21326 |
|
21327 |
|
21328 |
|
21329 | gauge_background: "",
|
21330 | gauge_fullCircle: !1,
|
21331 | gauge_label_show: !0,
|
21332 | gauge_label_format: undefined,
|
21333 | gauge_label_extents: undefined,
|
21334 | gauge_label_threshold: 0,
|
21335 | gauge_min: 0,
|
21336 | gauge_max: 100,
|
21337 | gauge_type: "single",
|
21338 | gauge_startingAngle: -1 * Math.PI / 2,
|
21339 | gauge_arcLength: 100,
|
21340 | gauge_title: "",
|
21341 | gauge_units: undefined,
|
21342 | gauge_width: undefined,
|
21343 | gauge_arcs_minWidth: 5,
|
21344 | gauge_expand: {},
|
21345 | gauge_expand_rate: .98,
|
21346 | gauge_expand_duration: 50
|
21347 | });
|
21348 | ;
|
21349 |
|
21350 |
|
21351 |
|
21352 |
|
21353 |
|
21354 |
|
21355 |
|
21356 | var pie = ({
|
21357 | |
21358 |
|
21359 |
|
21360 |
|
21361 |
|
21362 |
|
21363 |
|
21364 |
|
21365 |
|
21366 |
|
21367 |
|
21368 |
|
21369 |
|
21370 |
|
21371 |
|
21372 |
|
21373 |
|
21374 |
|
21375 |
|
21376 |
|
21377 |
|
21378 |
|
21379 |
|
21380 |
|
21381 |
|
21382 |
|
21383 |
|
21384 |
|
21385 |
|
21386 |
|
21387 |
|
21388 |
|
21389 |
|
21390 |
|
21391 |
|
21392 |
|
21393 |
|
21394 |
|
21395 |
|
21396 |
|
21397 |
|
21398 |
|
21399 |
|
21400 |
|
21401 |
|
21402 |
|
21403 |
|
21404 |
|
21405 |
|
21406 |
|
21407 |
|
21408 |
|
21409 |
|
21410 |
|
21411 |
|
21412 |
|
21413 |
|
21414 |
|
21415 |
|
21416 |
|
21417 |
|
21418 |
|
21419 |
|
21420 |
|
21421 |
|
21422 |
|
21423 |
|
21424 |
|
21425 |
|
21426 |
|
21427 |
|
21428 |
|
21429 |
|
21430 |
|
21431 |
|
21432 |
|
21433 |
|
21434 |
|
21435 | pie_label_show: !0,
|
21436 | pie_label_format: undefined,
|
21437 | pie_label_threshold: .05,
|
21438 | pie_label_ratio: undefined,
|
21439 | pie_expand: {},
|
21440 | pie_expand_rate: .98,
|
21441 | pie_expand_duration: 50,
|
21442 | pie_innerRadius: 0,
|
21443 | pie_outerRadius: undefined,
|
21444 | pie_padAngle: 0,
|
21445 | pie_padding: 0,
|
21446 | pie_startingAngle: 0
|
21447 | });
|
21448 | ;
|
21449 |
|
21450 | var polar_this = undefined;
|
21451 |
|
21452 |
|
21453 |
|
21454 |
|
21455 |
|
21456 |
|
21457 |
|
21458 | var shape_polar = ({
|
21459 | |
21460 |
|
21461 |
|
21462 |
|
21463 |
|
21464 |
|
21465 |
|
21466 |
|
21467 |
|
21468 |
|
21469 |
|
21470 |
|
21471 |
|
21472 |
|
21473 |
|
21474 |
|
21475 |
|
21476 |
|
21477 |
|
21478 |
|
21479 |
|
21480 |
|
21481 |
|
21482 |
|
21483 |
|
21484 |
|
21485 |
|
21486 |
|
21487 |
|
21488 |
|
21489 |
|
21490 |
|
21491 |
|
21492 |
|
21493 |
|
21494 |
|
21495 |
|
21496 |
|
21497 |
|
21498 |
|
21499 |
|
21500 |
|
21501 |
|
21502 |
|
21503 |
|
21504 |
|
21505 |
|
21506 |
|
21507 |
|
21508 |
|
21509 |
|
21510 |
|
21511 |
|
21512 |
|
21513 |
|
21514 |
|
21515 |
|
21516 |
|
21517 |
|
21518 | polar_label_show: !0,
|
21519 | polar_label_format: undefined,
|
21520 | polar_label_threshold: .05,
|
21521 | polar_label_ratio: undefined,
|
21522 | polar_level_depth: 3,
|
21523 | polar_level_max: undefined,
|
21524 | polar_level_show: !0,
|
21525 | polar_level_text_backgroundColor: "#fff",
|
21526 | polar_level_text_format: function polar_level_text_format(x) {
|
21527 | _newArrowCheck(this, polar_this);
|
21528 | return x % 1 === 0 ? x : x.toFixed(2);
|
21529 | }.bind(undefined),
|
21530 | polar_level_text_show: !0,
|
21531 | polar_padAngle: 0,
|
21532 | polar_padding: 0,
|
21533 | polar_startingAngle: 0
|
21534 | });
|
21535 | ;
|
21536 |
|
21537 | var radar_this = undefined;
|
21538 |
|
21539 |
|
21540 |
|
21541 |
|
21542 |
|
21543 |
|
21544 |
|
21545 | var shape_radar = ({
|
21546 | |
21547 |
|
21548 |
|
21549 |
|
21550 |
|
21551 |
|
21552 |
|
21553 |
|
21554 |
|
21555 |
|
21556 |
|
21557 |
|
21558 |
|
21559 |
|
21560 |
|
21561 |
|
21562 |
|
21563 |
|
21564 |
|
21565 |
|
21566 |
|
21567 |
|
21568 |
|
21569 |
|
21570 |
|
21571 |
|
21572 |
|
21573 |
|
21574 |
|
21575 |
|
21576 |
|
21577 |
|
21578 |
|
21579 |
|
21580 |
|
21581 |
|
21582 |
|
21583 |
|
21584 |
|
21585 |
|
21586 |
|
21587 |
|
21588 |
|
21589 |
|
21590 |
|
21591 |
|
21592 |
|
21593 |
|
21594 |
|
21595 |
|
21596 |
|
21597 |
|
21598 |
|
21599 |
|
21600 |
|
21601 |
|
21602 | radar_axis_max: undefined,
|
21603 | radar_axis_line_show: !0,
|
21604 | radar_axis_text_show: !0,
|
21605 | radar_axis_text_position: {},
|
21606 | radar_level_depth: 3,
|
21607 | radar_level_show: !0,
|
21608 | radar_level_text_format: function radar_level_text_format(x) {
|
21609 | _newArrowCheck(this, radar_this);
|
21610 | return x % 1 === 0 ? x : x.toFixed(2);
|
21611 | }.bind(undefined),
|
21612 | radar_level_text_show: !0,
|
21613 | radar_size_ratio: .87,
|
21614 | radar_direction_clockwise: !1
|
21615 | });
|
21616 | ;
|
21617 |
|
21618 | var shape_this = undefined;
|
21619 |
|
21620 |
|
21621 |
|
21622 |
|
21623 |
|
21624 |
|
21625 |
|
21626 |
|
21627 |
|
21628 |
|
21629 |
|
21630 |
|
21631 |
|
21632 |
|
21633 |
|
21634 |
|
21635 |
|
21636 |
|
21637 |
|
21638 |
|
21639 |
|
21640 |
|
21641 |
|
21642 |
|
21643 |
|
21644 |
|
21645 |
|
21646 |
|
21647 |
|
21648 |
|
21649 |
|
21650 |
|
21651 |
|
21652 |
|
21653 |
|
21654 |
|
21655 |
|
21656 |
|
21657 |
|
21658 |
|
21659 |
|
21660 |
|
21661 |
|
21662 |
|
21663 |
|
21664 |
|
21665 |
|
21666 |
|
21667 |
|
21668 | function extendAxis(module, option) {
|
21669 | extend(ChartInternal.prototype, internal.concat(module));
|
21670 | extend(Chart.prototype, api);
|
21671 | Options.setOptions(options.concat(option || []));
|
21672 | }
|
21673 |
|
21674 |
|
21675 |
|
21676 |
|
21677 |
|
21678 |
|
21679 |
|
21680 | function extendLine(module, option) {
|
21681 | extendAxis([point, line].concat(module || []));
|
21682 | Options.setOptions([common_point, shape_line].concat(option || []));
|
21683 | }
|
21684 |
|
21685 |
|
21686 |
|
21687 |
|
21688 |
|
21689 |
|
21690 |
|
21691 | function extendArc(module, option) {
|
21692 | extend(ChartInternal.prototype, [arc].concat(module || []));
|
21693 | Options.setOptions(option);
|
21694 | }
|
21695 |
|
21696 |
|
21697 | var _area = function area() {
|
21698 | var _this2 = this;
|
21699 | _newArrowCheck(this, shape_this);
|
21700 | return extendLine(shape_area, [Options_shape_area]), (_area = function () {
|
21701 | _newArrowCheck(this, _this2);
|
21702 | return TYPE.AREA;
|
21703 | }.bind(this))();
|
21704 | }.bind(undefined),
|
21705 | areaLineRange = function () {
|
21706 | var _this3 = this;
|
21707 | _newArrowCheck(this, shape_this);
|
21708 | return extendLine(shape_area, [Options_shape_area]), (areaLineRange = function () {
|
21709 | _newArrowCheck(this, _this3);
|
21710 | return TYPE.AREA_LINE_RANGE;
|
21711 | }.bind(this))();
|
21712 | }.bind(undefined),
|
21713 | areaSpline = function () {
|
21714 | var _this4 = this;
|
21715 | _newArrowCheck(this, shape_this);
|
21716 | return extendLine(shape_area, [Options_shape_area, spline]), (areaSpline = function () {
|
21717 | _newArrowCheck(this, _this4);
|
21718 | return TYPE.AREA_SPLINE;
|
21719 | }.bind(this))();
|
21720 | }.bind(undefined),
|
21721 | areaSplineRange = function () {
|
21722 | var _this5 = this;
|
21723 | _newArrowCheck(this, shape_this);
|
21724 | return extendLine(shape_area, [Options_shape_area, spline]), (areaSplineRange = function () {
|
21725 | _newArrowCheck(this, _this5);
|
21726 | return TYPE.AREA_SPLINE_RANGE;
|
21727 | }.bind(this))();
|
21728 | }.bind(undefined),
|
21729 | areaStep = function () {
|
21730 | var _this6 = this;
|
21731 | _newArrowCheck(this, shape_this);
|
21732 | return extendLine(shape_area, [Options_shape_area]), (areaStep = function () {
|
21733 | _newArrowCheck(this, _this6);
|
21734 | return TYPE.AREA_STEP;
|
21735 | }.bind(this))();
|
21736 | }.bind(undefined),
|
21737 | resolver_shape_line = function () {
|
21738 | var _this7 = this;
|
21739 | _newArrowCheck(this, shape_this);
|
21740 | return extendLine(), (resolver_shape_line = function () {
|
21741 | _newArrowCheck(this, _this7);
|
21742 | return TYPE.LINE;
|
21743 | }.bind(this))();
|
21744 | }.bind(undefined),
|
21745 | shape_spline = function () {
|
21746 | var _this8 = this;
|
21747 | _newArrowCheck(this, shape_this);
|
21748 | return extendLine(undefined, [spline]), (shape_spline = function () {
|
21749 | _newArrowCheck(this, _this8);
|
21750 | return TYPE.SPLINE;
|
21751 | }.bind(this))();
|
21752 | }.bind(undefined),
|
21753 | step = function () {
|
21754 | var _this9 = this;
|
21755 | _newArrowCheck(this, shape_this);
|
21756 | return extendLine(), (step = function () {
|
21757 | _newArrowCheck(this, _this9);
|
21758 | return TYPE.STEP;
|
21759 | }.bind(this))();
|
21760 | }.bind(undefined),
|
21761 | shape_donut = function () {
|
21762 | var _this10 = this;
|
21763 | _newArrowCheck(this, shape_this);
|
21764 | return extendArc(undefined, [donut]), (shape_donut = function () {
|
21765 | _newArrowCheck(this, _this10);
|
21766 | return TYPE.DONUT;
|
21767 | }.bind(this))();
|
21768 | }.bind(undefined),
|
21769 | resolver_shape_gauge = function () {
|
21770 | var _this11 = this;
|
21771 | _newArrowCheck(this, shape_this);
|
21772 | return extendArc([gauge], [shape_gauge]), (resolver_shape_gauge = function () {
|
21773 | _newArrowCheck(this, _this11);
|
21774 | return TYPE.GAUGE;
|
21775 | }.bind(this))();
|
21776 | }.bind(undefined),
|
21777 | shape_pie = function () {
|
21778 | var _this12 = this;
|
21779 | _newArrowCheck(this, shape_this);
|
21780 | return extendArc(undefined, [pie]), (shape_pie = function () {
|
21781 | _newArrowCheck(this, _this12);
|
21782 | return TYPE.PIE;
|
21783 | }.bind(this))();
|
21784 | }.bind(undefined),
|
21785 | resolver_shape_polar = function () {
|
21786 | var _this13 = this;
|
21787 | _newArrowCheck(this, shape_this);
|
21788 | return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
|
21789 | _newArrowCheck(this, _this13);
|
21790 | return TYPE.POLAR;
|
21791 | }.bind(this))();
|
21792 | }.bind(undefined),
|
21793 | resolver_shape_radar = function () {
|
21794 | var _this14 = this;
|
21795 | _newArrowCheck(this, shape_this);
|
21796 | return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
|
21797 | _newArrowCheck(this, _this14);
|
21798 | return TYPE.RADAR;
|
21799 | }.bind(this))();
|
21800 | }.bind(undefined),
|
21801 | resolver_shape_bar = function () {
|
21802 | var _this15 = this;
|
21803 | _newArrowCheck(this, shape_this);
|
21804 | return extendAxis([bar], shape_bar), (resolver_shape_bar = function () {
|
21805 | _newArrowCheck(this, _this15);
|
21806 | return TYPE.BAR;
|
21807 | }.bind(this))();
|
21808 | }.bind(undefined),
|
21809 | resolver_shape_bubble = function () {
|
21810 | var _this16 = this;
|
21811 | _newArrowCheck(this, shape_this);
|
21812 | return extendAxis([point, bubble], [shape_bubble, common_point]), (resolver_shape_bubble = function () {
|
21813 | _newArrowCheck(this, _this16);
|
21814 | return TYPE.BUBBLE;
|
21815 | }.bind(this))();
|
21816 | }.bind(undefined),
|
21817 | resolver_shape_candlestick = function () {
|
21818 | var _this17 = this;
|
21819 | _newArrowCheck(this, shape_this);
|
21820 | return extendAxis([candlestick], [shape_candlestick]), (resolver_shape_candlestick = function () {
|
21821 | _newArrowCheck(this, _this17);
|
21822 | return TYPE.CANDLESTICK;
|
21823 | }.bind(this))();
|
21824 | }.bind(undefined),
|
21825 | shape_scatter = function () {
|
21826 | var _this18 = this;
|
21827 | _newArrowCheck(this, shape_this);
|
21828 | return extendAxis([point], [common_point, scatter]), (shape_scatter = function () {
|
21829 | _newArrowCheck(this, _this18);
|
21830 | return TYPE.SCATTER;
|
21831 | }.bind(this))();
|
21832 | }.bind(undefined);
|
21833 | ;
|
21834 |
|
21835 |
|
21836 |
|
21837 |
|
21838 |
|
21839 |
|
21840 |
|
21841 |
|
21842 | var selection = ({
|
21843 | |
21844 |
|
21845 |
|
21846 |
|
21847 |
|
21848 |
|
21849 |
|
21850 |
|
21851 |
|
21852 |
|
21853 |
|
21854 |
|
21855 |
|
21856 |
|
21857 |
|
21858 |
|
21859 | selected: function selected(targetId) {
|
21860 | var _this = this,
|
21861 | $$ = this.internal,
|
21862 | dataPoint = [];
|
21863 | $$.$el.main.selectAll("." + ($SHAPE.shapes + $$.getTargetSelectorSuffix(targetId))).selectAll("." + $SHAPE.shape).filter(function () {
|
21864 | return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($SELECT.SELECTED);
|
21865 | }).each(function (d) {
|
21866 | _newArrowCheck(this, _this);
|
21867 | return dataPoint.push(d);
|
21868 | }.bind(this));
|
21869 | return dataPoint;
|
21870 | },
|
21871 | |
21872 |
|
21873 |
|
21874 |
|
21875 |
|
21876 |
|
21877 |
|
21878 |
|
21879 |
|
21880 |
|
21881 |
|
21882 |
|
21883 |
|
21884 |
|
21885 |
|
21886 |
|
21887 |
|
21888 |
|
21889 |
|
21890 |
|
21891 |
|
21892 |
|
21893 |
|
21894 |
|
21895 | select: function select(ids, indices, resetOther) {
|
21896 | var $$ = this.internal,
|
21897 | config = $$.config,
|
21898 | $el = $$.$el;
|
21899 | if (!config.data_selection_enabled) {
|
21900 | return;
|
21901 | }
|
21902 | $el.main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).each(function (d, i) {
|
21903 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
21904 | id = d.data ? d.data.id : d.id,
|
21905 | toggle = $$.getToggle(this, d).bind($$),
|
21906 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
21907 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
21908 | isSelected = shape.classed($SELECT.SELECTED);
|
21909 |
|
21910 | if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
21911 | return;
|
21912 | }
|
21913 | if (isTargetId && isTargetIndex) {
|
21914 | if (config.data_selection_isselectable.bind($$.api)(d) && !isSelected) {
|
21915 | toggle(!0, shape.classed($SELECT.SELECTED, !0), d, i);
|
21916 | }
|
21917 | } else if (isDefined(resetOther) && resetOther && isSelected) {
|
21918 | toggle(!1, shape.classed($SELECT.SELECTED, !1), d, i);
|
21919 | }
|
21920 | });
|
21921 | },
|
21922 | |
21923 |
|
21924 |
|
21925 |
|
21926 |
|
21927 |
|
21928 |
|
21929 |
|
21930 |
|
21931 |
|
21932 |
|
21933 |
|
21934 |
|
21935 |
|
21936 |
|
21937 |
|
21938 |
|
21939 | unselect: function unselect(ids, indices) {
|
21940 | var $$ = this.internal,
|
21941 | config = $$.config,
|
21942 | $el = $$.$el;
|
21943 | if (!config.data_selection_enabled) {
|
21944 | return;
|
21945 | }
|
21946 | $el.main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).each(function (d, i) {
|
21947 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
21948 | id = d.data ? d.data.id : d.id,
|
21949 | toggle = $$.getToggle(this, d).bind($$),
|
21950 | isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
21951 | isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
21952 | isSelected = shape.classed($SELECT.SELECTED);
|
21953 |
|
21954 | if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
21955 | return;
|
21956 | }
|
21957 | if (isTargetId && isTargetIndex && config.data_selection_isselectable.bind($$.api)(d) && isSelected) {
|
21958 | toggle(!1, shape.classed($SELECT.SELECTED, !1), d, i);
|
21959 | }
|
21960 | });
|
21961 | }
|
21962 | });
|
21963 | ;
|
21964 |
|
21965 |
|
21966 |
|
21967 |
|
21968 |
|
21969 | var subchart = ({
|
21970 | subchart: {
|
21971 | |
21972 |
|
21973 |
|
21974 |
|
21975 |
|
21976 |
|
21977 |
|
21978 |
|
21979 |
|
21980 |
|
21981 |
|
21982 |
|
21983 |
|
21984 |
|
21985 |
|
21986 |
|
21987 |
|
21988 |
|
21989 |
|
21990 |
|
21991 |
|
21992 |
|
21993 |
|
21994 | show: function () {
|
21995 | var $$ = this.internal,
|
21996 | subchart = $$.$el.subchart,
|
21997 | config = $$.config,
|
21998 | show = config.subchart_show;
|
21999 | if (!show) {
|
22000 | var _$target, _subchart$main2;
|
22001 |
|
22002 | $$.unbindZoomEvent();
|
22003 | config.subchart_show = !show;
|
22004 | subchart.main || $$.initSubchart();
|
22005 | var $target = subchart.main.selectAll("." + $COMMON.target);
|
22006 |
|
22007 |
|
22008 | if ($$.data.targets.length !== $target.size()) {
|
22009 | var _subchart$main;
|
22010 | $$.updateSizes();
|
22011 | $$.updateTargetsForSubchart($$.data.targets);
|
22012 | $target = (_subchart$main = subchart.main) == null ? void 0 : _subchart$main.selectAll("." + $COMMON.target);
|
22013 | }
|
22014 | (_$target = $target) == null ? void 0 : _$target.style("opacity", null);
|
22015 | (_subchart$main2 = subchart.main) == null ? void 0 : _subchart$main2.style("display", null);
|
22016 | this.resize();
|
22017 | }
|
22018 | },
|
22019 | |
22020 |
|
22021 |
|
22022 |
|
22023 |
|
22024 |
|
22025 |
|
22026 |
|
22027 |
|
22028 | hide: function hide() {
|
22029 | var $$ = this.internal,
|
22030 | main = $$.$el.subchart.main,
|
22031 | config = $$.config;
|
22032 | if (config.subchart_show && (main == null ? void 0 : main.style("display")) !== "none") {
|
22033 | config.subchart_show = !1;
|
22034 | main.style("display", "none");
|
22035 | this.resize();
|
22036 | }
|
22037 | },
|
22038 | |
22039 |
|
22040 |
|
22041 |
|
22042 |
|
22043 |
|
22044 |
|
22045 |
|
22046 |
|
22047 |
|
22048 |
|
22049 | toggle: function toggle() {
|
22050 | var $$ = this.internal,
|
22051 | config = $$.config;
|
22052 | this.subchart[config.subchart_show ? "hide" : "show"]();
|
22053 | }
|
22054 | }
|
22055 | });
|
22056 |
|
22057 | var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(13);
|
22058 | ;
|
22059 |
|
22060 |
|
22061 |
|
22062 |
|
22063 |
|
22064 |
|
22065 |
|
22066 |
|
22067 |
|
22068 |
|
22069 |
|
22070 |
|
22071 |
|
22072 |
|
22073 |
|
22074 |
|
22075 | function withinRange(domain, current, range) {
|
22076 | var _this = this,
|
22077 | min = range[0],
|
22078 | max = range[1];
|
22079 | return domain.every(function (v, i) {
|
22080 | var _this2 = this;
|
22081 | _newArrowCheck(this, _this);
|
22082 | return (i === 0 ? v >= min : v <= max) && !domain.every(function (v, i) {
|
22083 | _newArrowCheck(this, _this2);
|
22084 | return v === current[i];
|
22085 | }.bind(this));
|
22086 | }.bind(this));
|
22087 | }
|
22088 |
|
22089 |
|
22090 |
|
22091 |
|
22092 |
|
22093 |
|
22094 |
|
22095 |
|
22096 |
|
22097 |
|
22098 |
|
22099 |
|
22100 |
|
22101 |
|
22102 |
|
22103 |
|
22104 |
|
22105 |
|
22106 |
|
22107 |
|
22108 |
|
22109 | var zoom = function (domainValue) {
|
22110 | var _this3 = this,
|
22111 | $$ = this.internal,
|
22112 | $el = $$.$el,
|
22113 | axis = $$.axis,
|
22114 | config = $$.config,
|
22115 | org = $$.org,
|
22116 | scale = $$.scale,
|
22117 | isRotated = config.axis_rotated,
|
22118 | isCategorized = axis.isCategorized(),
|
22119 | domain = domainValue;
|
22120 | if (config.zoom_enabled && domain) {
|
22121 | if (axis.isTimeSeries()) {
|
22122 | domain = domain.map(function (x) {
|
22123 | _newArrowCheck(this, _this3);
|
22124 | return parseDate.bind($$)(x);
|
22125 | }.bind(this));
|
22126 | }
|
22127 | if (withinRange(domain, $$.getZoomDomain(!0), $$.getZoomDomain())) {
|
22128 | if (isCategorized) {
|
22129 | domain = domain.map(function (v, i) {
|
22130 | _newArrowCheck(this, _this3);
|
22131 | return +v + (i === 0 ? 0 : 1);
|
22132 | }.bind(this));
|
22133 | }
|
22134 |
|
22135 |
|
22136 | $$.api.tooltip.hide();
|
22137 | if (config.subchart_show) {
|
22138 | var x = scale.zoom || scale.x;
|
22139 | $$.brush.getSelection().call($$.brush.move, domain.map(x));
|
22140 |
|
22141 | } else {
|
22142 | var _d3ZoomIdentity$scale,
|
22143 | _x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x,
|
22144 | translate = [-_x(domain[0]), 0],
|
22145 | transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(_x.range()[1] / (_x(domain[1]) - _x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate);
|
22146 | $el.eventRect.call($$.zoom.transform, transform);
|
22147 | }
|
22148 | $$.setZoomResetButton();
|
22149 | }
|
22150 | } else {
|
22151 | domain = scale.zoom ? scale.zoom.domain() : scale.x.orgDomain();
|
22152 | }
|
22153 | return domain;
|
22154 | };
|
22155 | extend(zoom, {
|
22156 | |
22157 |
|
22158 |
|
22159 |
|
22160 |
|
22161 |
|
22162 |
|
22163 |
|
22164 |
|
22165 |
|
22166 |
|
22167 |
|
22168 |
|
22169 |
|
22170 |
|
22171 |
|
22172 |
|
22173 |
|
22174 | enable: function enable(enabled) {
|
22175 | var $$ = this.internal,
|
22176 | config = $$.config;
|
22177 | if (/^(drag|wheel)$/.test(enabled)) {
|
22178 | config.zoom_type = enabled;
|
22179 | }
|
22180 | config.zoom_enabled = !!enabled;
|
22181 | if (!$$.zoom) {
|
22182 | $$.initZoom();
|
22183 | $$.bindZoomEvent();
|
22184 | } else if (enabled === !1) {
|
22185 | $$.bindZoomEvent(!1);
|
22186 | }
|
22187 | $$.updateAndRedraw();
|
22188 | },
|
22189 | |
22190 |
|
22191 |
|
22192 |
|
22193 |
|
22194 |
|
22195 |
|
22196 |
|
22197 |
|
22198 |
|
22199 |
|
22200 | max: function max(_max) {
|
22201 | var $$ = this.internal,
|
22202 | config = $$.config,
|
22203 | xDomain = $$.org.xDomain;
|
22204 | if (_max === 0 || _max) {
|
22205 | config.zoom_x_max = getMinMax("max", [xDomain[1], _max]);
|
22206 | }
|
22207 | return config.zoom_x_max;
|
22208 | },
|
22209 | |
22210 |
|
22211 |
|
22212 |
|
22213 |
|
22214 |
|
22215 |
|
22216 |
|
22217 |
|
22218 |
|
22219 |
|
22220 | min: function min(_min) {
|
22221 | var $$ = this.internal,
|
22222 | config = $$.config,
|
22223 | xDomain = $$.org.xDomain;
|
22224 | if (_min === 0 || _min) {
|
22225 | config.zoom_x_min = getMinMax("min", [xDomain[0], _min]);
|
22226 | }
|
22227 | return config.zoom_x_min;
|
22228 | },
|
22229 | |
22230 |
|
22231 |
|
22232 |
|
22233 |
|
22234 |
|
22235 |
|
22236 |
|
22237 |
|
22238 |
|
22239 |
|
22240 |
|
22241 |
|
22242 |
|
22243 |
|
22244 |
|
22245 |
|
22246 | range: function range(_range) {
|
22247 | var zoom = this.zoom;
|
22248 | if (isObject(_range)) {
|
22249 | var min = _range.min,
|
22250 | max = _range.max;
|
22251 | isDefined(min) && zoom.min(min);
|
22252 | isDefined(max) && zoom.max(max);
|
22253 | }
|
22254 | return {
|
22255 | min: zoom.min(),
|
22256 | max: zoom.max()
|
22257 | };
|
22258 | }
|
22259 | });
|
22260 | var api_zoom = ({
|
22261 | zoom: zoom,
|
22262 | |
22263 |
|
22264 |
|
22265 |
|
22266 |
|
22267 |
|
22268 |
|
22269 |
|
22270 |
|
22271 | unzoom: function unzoom() {
|
22272 | var $$ = this.internal,
|
22273 | config = $$.config,
|
22274 | _$$$$el = $$.$el,
|
22275 | eventRect = _$$$$el.eventRect,
|
22276 | zoomResetBtn = _$$$$el.zoomResetBtn;
|
22277 | if ($$.scale.zoom) {
|
22278 | config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity);
|
22279 | $$.updateZoom(!0);
|
22280 | zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none");
|
22281 |
|
22282 |
|
22283 | if ((0,external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomTransform)(eventRect.node()) !== external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity) {
|
22284 | $$.zoom.transform(eventRect, external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity);
|
22285 | }
|
22286 | }
|
22287 | }
|
22288 | });
|
22289 | ;
|
22290 |
|
22291 |
|
22292 |
|
22293 |
|
22294 |
|
22295 |
|
22296 |
|
22297 |
|
22298 |
|
22299 |
|
22300 |
|
22301 |
|
22302 | var drag = ({
|
22303 | |
22304 |
|
22305 |
|
22306 |
|
22307 |
|
22308 |
|
22309 | drag: function drag(mouse) {
|
22310 | var _this = this,
|
22311 | $$ = this,
|
22312 | config = $$.config,
|
22313 | state = $$.state,
|
22314 | main = $$.$el.main,
|
22315 | isSelectionGrouped = config.data_selection_grouped,
|
22316 | isSelectable = config.interaction_enabled && config.data_selection_isselectable;
|
22317 | if ($$.hasArcType() || !config.data_selection_enabled ||
|
22318 |
|
22319 | config.zoom_enabled && !$$.zoom.altDomain ||
|
22320 |
|
22321 | !config.data_selection_multiple
|
22322 | ) {
|
22323 | return;
|
22324 | }
|
22325 | var _ref = state.dragStart || [0, 0],
|
22326 | sx = _ref[0],
|
22327 | sy = _ref[1],
|
22328 | mx = mouse[0],
|
22329 | my = mouse[1],
|
22330 | minX = Math.min(sx, mx),
|
22331 | maxX = Math.max(sx, mx),
|
22332 | minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my),
|
22333 | maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
|
22334 | main.select("." + $DRAG.dragarea).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY);
|
22335 |
|
22336 |
|
22337 | main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).filter(function (d) {
|
22338 | _newArrowCheck(this, _this);
|
22339 | return isSelectable == null ? void 0 : isSelectable.bind($$.api)(d);
|
22340 | }.bind(this)).each(function (d, i) {
|
22341 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
22342 | isSelected = shape.classed($SELECT.SELECTED),
|
22343 | isIncluded = shape.classed($DRAG.INCLUDED),
|
22344 | isWithin = !1,
|
22345 | toggle;
|
22346 | if (shape.classed($CIRCLE.circle)) {
|
22347 | var x = +shape.attr("cx") * 1,
|
22348 | y = +shape.attr("cy") * 1;
|
22349 | toggle = $$.togglePoint;
|
22350 | isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
22351 | } else if (shape.classed($BAR.bar)) {
|
22352 | var _getPathBox = getPathBox(this),
|
22353 | _x = _getPathBox.x,
|
22354 | y = _getPathBox.y,
|
22355 | width = _getPathBox.width,
|
22356 | height = _getPathBox.height;
|
22357 | toggle = $$.togglePath;
|
22358 | isWithin = !(maxX < _x || _x + width < minX) && !(maxY < y || y + height < minY);
|
22359 | } else {
|
22360 |
|
22361 | return;
|
22362 | }
|
22363 |
|
22364 |
|
22365 | if (isWithin ^ isIncluded) {
|
22366 | shape.classed($DRAG.INCLUDED, !isIncluded);
|
22367 |
|
22368 | shape.classed($SELECT.SELECTED, !isSelected);
|
22369 | toggle.call($$, !isSelected, shape, d, i);
|
22370 | }
|
22371 | });
|
22372 | },
|
22373 | |
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 |
|
22379 | dragstart: function dragstart(mouse) {
|
22380 | var $$ = this,
|
22381 | config = $$.config,
|
22382 | state = $$.state,
|
22383 | main = $$.$el.main;
|
22384 | if ($$.hasArcType() || !config.data_selection_enabled) {
|
22385 | return;
|
22386 | }
|
22387 | state.dragStart = mouse;
|
22388 | main.select("." + $COMMON.chart).append("rect").attr("class", $DRAG.dragarea).style("opacity", "0.1");
|
22389 | $$.setDragStatus(!0);
|
22390 | },
|
22391 | |
22392 |
|
22393 |
|
22394 |
|
22395 |
|
22396 | dragend: function dragend() {
|
22397 | var $$ = this,
|
22398 | config = $$.config,
|
22399 | main = $$.$el.main,
|
22400 | $T = $$.$T;
|
22401 | if ($$.hasArcType() || !config.data_selection_enabled) {
|
22402 |
|
22403 | return;
|
22404 | }
|
22405 | $T(main.select("." + $DRAG.dragarea)).style("opacity", "0").remove();
|
22406 | main.selectAll("." + $SHAPE.shape).classed($DRAG.INCLUDED, !1);
|
22407 | $$.setDragStatus(!1);
|
22408 | }
|
22409 | });
|
22410 | ;
|
22411 |
|
22412 |
|
22413 | function selection_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
22414 | function selection_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? selection_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : selection_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22415 |
|
22416 |
|
22417 |
|
22418 |
|
22419 |
|
22420 |
|
22421 |
|
22422 |
|
22423 | var internals_selection = (selection_objectSpread(selection_objectSpread({}, drag), {}, {
|
22424 | |
22425 |
|
22426 |
|
22427 |
|
22428 |
|
22429 |
|
22430 |
|
22431 | selectPoint: function selectPoint(target, d, i) {
|
22432 | var _this = this,
|
22433 | $$ = this,
|
22434 | config = $$.config,
|
22435 | main = $$.$el.main,
|
22436 | $T = $$.$T,
|
22437 | isRotated = config.axis_rotated,
|
22438 | cx = (isRotated ? $$.circleY : $$.circleX).bind($$),
|
22439 | cy = (isRotated ? $$.circleX : $$.circleY).bind($$),
|
22440 | r = $$.pointSelectR.bind($$);
|
22441 | callFn(config.data_onselected, $$.api, d, target.node());
|
22442 |
|
22443 |
|
22444 | $T(main.select("." + $SELECT.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll("." + $SELECT.selectedCircle + "-" + i).data([d]).enter().append("circle").attr("class", function () {
|
22445 | _newArrowCheck(this, _this);
|
22446 | return $$.generateClass($SELECT.selectedCircle, i);
|
22447 | }.bind(this)).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", function (d2) {
|
22448 | _newArrowCheck(this, _this);
|
22449 | return $$.pointSelectR(d2) * 1.4;
|
22450 | }.bind(this))).attr("r", r);
|
22451 | },
|
22452 | |
22453 |
|
22454 |
|
22455 |
|
22456 |
|
22457 |
|
22458 |
|
22459 | unselectPoint: function unselectPoint(target, d, i) {
|
22460 | var $$ = this,
|
22461 | config = $$.config,
|
22462 | main = $$.$el.main,
|
22463 | $T = $$.$T;
|
22464 | callFn(config.data_onunselected, $$.api, d, target.node());
|
22465 |
|
22466 |
|
22467 | $T(main.select("." + $SELECT.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll("." + $SELECT.selectedCircle + "-" + i)).attr("r", 0).remove();
|
22468 | },
|
22469 | |
22470 |
|
22471 |
|
22472 |
|
22473 |
|
22474 |
|
22475 |
|
22476 |
|
22477 | togglePoint: function togglePoint(selected, target, d, i) {
|
22478 | var method = (selected ? "" : "un") + "selectPoint";
|
22479 | this[method](target, d, i);
|
22480 | },
|
22481 | |
22482 |
|
22483 |
|
22484 |
|
22485 |
|
22486 |
|
22487 | selectPath: function selectPath(target, d) {
|
22488 | var $$ = this,
|
22489 | config = $$.config;
|
22490 | callFn(config.data_onselected, $$.api, d, target.node());
|
22491 | if (config.interaction_brighten) {
|
22492 | target.style("filter", "brightness(1.25)");
|
22493 | }
|
22494 | },
|
22495 | |
22496 |
|
22497 |
|
22498 |
|
22499 |
|
22500 |
|
22501 | unselectPath: function unselectPath(target, d) {
|
22502 | var $$ = this,
|
22503 | config = $$.config;
|
22504 | callFn(config.data_onunselected, $$.api, d, target.node());
|
22505 | if (config.interaction_brighten) {
|
22506 | target.style("filter", null);
|
22507 | }
|
22508 | },
|
22509 | |
22510 |
|
22511 |
|
22512 |
|
22513 |
|
22514 |
|
22515 |
|
22516 |
|
22517 | togglePath: function togglePath(selected, target, d, i) {
|
22518 | this[(selected ? "" : "un") + "selectPath"](target, d, i);
|
22519 | },
|
22520 | |
22521 |
|
22522 |
|
22523 |
|
22524 |
|
22525 |
|
22526 |
|
22527 | getToggle: function getToggle(that, d) {
|
22528 | var _this2 = this,
|
22529 | $$ = this;
|
22530 | return that.nodeName === "path" ? $$.togglePath : $$.isStepType(d) ? function () {
|
22531 | _newArrowCheck(this, _this2);
|
22532 | }.bind(this) :
|
22533 |
|
22534 | $$.togglePoint;
|
22535 | },
|
22536 | |
22537 |
|
22538 |
|
22539 |
|
22540 |
|
22541 |
|
22542 |
|
22543 | toggleShape: function toggleShape(that, d, i) {
|
22544 | var $$ = this,
|
22545 | config = $$.config,
|
22546 | main = $$.$el.main;
|
22547 | if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
22548 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that),
|
22549 | isSelected = shape.classed($SELECT.SELECTED),
|
22550 | toggle = $$.getToggle(that, d).bind($$),
|
22551 | toggledShape;
|
22552 | if (!config.data_selection_multiple) {
|
22553 | var selector = "." + $SHAPE.shapes;
|
22554 | if (config.data_selection_grouped) {
|
22555 | selector += $$.getTargetSelectorSuffix(d.id);
|
22556 | }
|
22557 | main.selectAll(selector).selectAll("." + $SHAPE.shape).each(function (d, i) {
|
22558 | var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
22559 | if (shape.classed($SELECT.SELECTED)) {
|
22560 | toggledShape = shape;
|
22561 | toggle(!1, shape.classed($SELECT.SELECTED, !1), d, i);
|
22562 | }
|
22563 | });
|
22564 | }
|
22565 | if (!toggledShape || toggledShape.node() !== shape.node()) {
|
22566 | shape.classed($SELECT.SELECTED, !isSelected);
|
22567 | toggle(!isSelected, shape, d, i);
|
22568 | }
|
22569 | }
|
22570 | }
|
22571 | }));
|
22572 | ;
|
22573 |
|
22574 |
|
22575 |
|
22576 |
|
22577 |
|
22578 |
|
22579 |
|
22580 |
|
22581 |
|
22582 | var interactions_subchart = ({
|
22583 | |
22584 |
|
22585 |
|
22586 |
|
22587 | initBrush: function initBrush() {
|
22588 | var _this = this,
|
22589 | $$ = this,
|
22590 | config = $$.config,
|
22591 | scale = $$.scale,
|
22592 | subchart = $$.$el.subchart,
|
22593 | isRotated = config.axis_rotated,
|
22594 | lastDomain,
|
22595 | timeout;
|
22596 |
|
22597 | $$.brush = (isRotated ? (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushY)() : (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushX)()).handleSize(5);
|
22598 | var getBrushSize = function () {
|
22599 | _newArrowCheck(this, _this);
|
22600 | var brush = $$.$el.svg.select("." + classes.brush + " .overlay"),
|
22601 | brushSize = {
|
22602 | width: 0,
|
22603 | height: 0
|
22604 | };
|
22605 | if (brush.size()) {
|
22606 | brushSize.width = +brush.attr("width");
|
22607 | brushSize.height = +brush.attr("height");
|
22608 | }
|
22609 | return brushSize[isRotated ? "width" : "height"];
|
22610 | }.bind(this);
|
22611 |
|
22612 |
|
22613 | $$.brush.on("start brush end", function (event) {
|
22614 | var _this2 = this;
|
22615 | _newArrowCheck(this, _this);
|
22616 | var selection = event.selection,
|
22617 | target = event.target,
|
22618 | type = event.type;
|
22619 | if (type === "start") {
|
22620 | $$.state.inputType === "touch" && $$.hideTooltip();
|
22621 | }
|
22622 | if (/(start|brush)/.test(type)) {
|
22623 | $$.redrawForBrush();
|
22624 | }
|
22625 | if (type === "end") {
|
22626 | lastDomain = scale.x.orgDomain();
|
22627 | }
|
22628 |
|
22629 |
|
22630 | if (target != null && target.handle) {
|
22631 | if (selection === null) {
|
22632 | $$.brush.handle.attr("display", "none");
|
22633 | } else {
|
22634 | $$.brush.handle.attr("display", null).attr("transform", function (d, i) {
|
22635 | _newArrowCheck(this, _this2);
|
22636 | var pos = isRotated ? [33, selection[i] - (i === 0 ? 30 : 24)] : [selection[i], 3];
|
22637 | return "translate(" + pos + ")";
|
22638 | }.bind(this));
|
22639 | }
|
22640 | }
|
22641 | }.bind(this));
|
22642 | $$.brush.updateResize = function () {
|
22643 | var _this3 = this;
|
22644 | timeout && clearTimeout(timeout);
|
22645 | timeout = setTimeout(function () {
|
22646 | _newArrowCheck(this, _this3);
|
22647 | var selection = this.getSelection();
|
22648 | lastDomain && (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection.node()) && this.move(selection, lastDomain.map(scale.subX.orgScale()));
|
22649 | }.bind(this), 0);
|
22650 | };
|
22651 | $$.brush.update = function () {
|
22652 | var _this4 = this,
|
22653 | extent = this.extent()();
|
22654 | if (extent[1].filter(function (v) {
|
22655 | _newArrowCheck(this, _this4);
|
22656 | return isNaN(v);
|
22657 | }.bind(this)).length === 0) {
|
22658 | var _subchart$main;
|
22659 | (_subchart$main = subchart.main) == null ? void 0 : _subchart$main.select("." + classes.brush).call(this);
|
22660 | }
|
22661 | return this;
|
22662 | };
|
22663 |
|
22664 |
|
22665 | $$.brush.scale = function (scale) {
|
22666 | var _this5 = this,
|
22667 | h = config.subchart_size_height || getBrushSize(),
|
22668 | extent = $$.getExtent();
|
22669 | if (!extent && scale.range) {
|
22670 | extent = [[0, 0], [scale.range()[1], h]];
|
22671 | } else if (isArray(extent)) {
|
22672 | extent = extent.map(function (v, i) {
|
22673 | _newArrowCheck(this, _this5);
|
22674 | return [v, i > 0 ? h : i];
|
22675 | }.bind(this));
|
22676 | }
|
22677 |
|
22678 |
|
22679 | isRotated && extent[1].reverse();
|
22680 | this.extent(extent);
|
22681 |
|
22682 |
|
22683 |
|
22684 | this.update();
|
22685 | };
|
22686 | $$.brush.getSelection = function () {
|
22687 | _newArrowCheck(this, _this);
|
22688 | return (
|
22689 |
|
22690 | subchart.main ? subchart.main.select("." + classes.brush) : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)([])
|
22691 | );
|
22692 | }.bind(this);
|
22693 | },
|
22694 | |
22695 |
|
22696 |
|
22697 |
|
22698 | initSubchart: function initSubchart() {
|
22699 | var _this6 = this,
|
22700 | $$ = this,
|
22701 | config = $$.config,
|
22702 | _$$$state = $$.state,
|
22703 | clip = _$$$state.clip,
|
22704 | hasAxis = _$$$state.hasAxis,
|
22705 | _$$$$el = $$.$el,
|
22706 | defs = _$$$$el.defs,
|
22707 | svg = _$$$$el.svg,
|
22708 | subchart = _$$$$el.subchart,
|
22709 | axis = _$$$$el.axis;
|
22710 | if (!hasAxis) {
|
22711 | return;
|
22712 | }
|
22713 | var visibility = config.subchart_show ? null : "hidden",
|
22714 | clipId = clip.id + "-subchart",
|
22715 | clipPath = $$.getClipPath(clipId);
|
22716 | clip.idSubchart = clipId;
|
22717 | $$.appendClip(defs, clipId);
|
22718 | $$.initBrush();
|
22719 | subchart.main = svg.append("g").classed(classes.subchart, !0).attr("transform", $$.getTranslate("context"));
|
22720 | var main = subchart.main;
|
22721 | main.style("visibility", visibility);
|
22722 |
|
22723 |
|
22724 | main.append("g").attr("clip-path", clipPath).attr("class", classes.chart);
|
22725 |
|
22726 |
|
22727 | ["bar", "line", "bubble", "candlestick", "scatter"].forEach(function (v) {
|
22728 | _newArrowCheck(this, _this6);
|
22729 | var type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
|
22730 | if ($$.hasType(v) || $$.hasTypeOf(type)) {
|
22731 | var chart = main.select("." + classes.chart),
|
22732 | chartClassName = classes["chart" + type + "s"];
|
22733 | if (chart.select("." + chartClassName).empty()) {
|
22734 | chart.append("g").attr("class", chartClassName);
|
22735 | }
|
22736 | }
|
22737 | }.bind(this));
|
22738 |
|
22739 |
|
22740 | var brush = main.append("g").attr("clip-path", clipPath).attr("class", classes.brush).call($$.brush);
|
22741 | config.subchart_showHandle && $$.addBrushHandle(brush);
|
22742 |
|
22743 |
|
22744 |
|
22745 | axis.subX = main.append("g").attr("class", classes.axisX).attr("transform", $$.getTranslate("subX")).attr("clip-path", config.axis_rotated ? "" : clip.pathXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden");
|
22746 | },
|
22747 | |
22748 |
|
22749 |
|
22750 |
|
22751 |
|
22752 |
|
22753 | addBrushHandle: function addBrushHandle(brush) {
|
22754 | var _this7 = this,
|
22755 | $$ = this,
|
22756 | config = $$.config,
|
22757 | isRotated = config.axis_rotated,
|
22758 | initRange = config.subchart_init_range,
|
22759 | path = isRotated ? ["M 5.2491724,29.749209 a 6,6 0 0 0 -5.50000003,-6.5 H -5.7508276 a 6,6 0 0 0 -6.0000004,6.5 z m -5.00000003,-2 H -6.7508276 m 6.99999997,-2 H -6.7508276Z", "M 5.2491724,23.249172 a 6,-6 0 0 1 -5.50000003,6.5 H -5.7508276 a 6,-6 0 0 1 -6.0000004,-6.5 z m -5.00000003,2 H -6.7508276 m 6.99999997,2 H -6.7508276Z"] : ["M 0 18 A 6 6 0 0 0 -6.5 23.5 V 29 A 6 6 0 0 0 0 35 Z M -2 23 V 30 M -4 23 V 30Z", "M 0 18 A 6 6 0 0 1 6.5 23.5 V 29 A 6 6 0 0 1 0 35 Z M 2 23 V 30 M 4 23 V 30Z"];
|
22760 | $$.brush.handle = brush.selectAll(".handle--custom").data(isRotated ? [{
|
22761 | type: "n"
|
22762 | }, {
|
22763 | type: "s"
|
22764 | }] : [{
|
22765 | type: "w"
|
22766 | }, {
|
22767 | type: "e"
|
22768 | }]).enter().append("path").attr("class", "handle--custom").attr("cursor", (isRotated ? "ns" : "ew") + "-resize").attr("d", function (d) {
|
22769 | _newArrowCheck(this, _this7);
|
22770 | return path[+/[se]/.test(d.type)];
|
22771 | }.bind(this)).attr("display", initRange ? null : "none");
|
22772 | },
|
22773 | |
22774 |
|
22775 |
|
22776 |
|
22777 |
|
22778 | updateTargetsForSubchart: function updateTargetsForSubchart(targets) {
|
22779 | var _this8 = this,
|
22780 | $$ = this,
|
22781 | config = $$.config,
|
22782 | state = $$.state,
|
22783 | main = $$.$el.subchart.main;
|
22784 | if (config.subchart_show) {
|
22785 | ["bar", "line", "bubble", "candlestick", "scatter"].filter(function (v) {
|
22786 | _newArrowCheck(this, _this8);
|
22787 | return $$.hasType(v) || $$.hasTypeOf(capitalize(v));
|
22788 | }.bind(this)).forEach(function (v) {
|
22789 | _newArrowCheck(this, _this8);
|
22790 | var isPointType = /^(bubble|scatter)$/.test(v),
|
22791 | name = capitalize(isPointType ? "circle" : v),
|
22792 | chartClass = $$.getChartClass(name, !0),
|
22793 | shapeClass = $$.getClass(isPointType ? "circles" : v + "s", !0),
|
22794 | shapeChart = main.select("." + classes["chart" + (name + "s")]);
|
22795 | if (isPointType) {
|
22796 | var circle = shapeChart.selectAll("." + classes.circles).data(targets.filter($$["is" + capitalize(v) + "Type"].bind($$))).attr("class", shapeClass);
|
22797 | circle.exit().remove();
|
22798 | circle.enter().append("g").attr("class", shapeClass);
|
22799 | } else {
|
22800 | var shapeUpdate = shapeChart.selectAll("." + classes["chart" + name]).attr("class", chartClass).data(targets.filter($$["is" + name + "Type"].bind($$))),
|
22801 | shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass);
|
22802 | shapeUpdate.exit().remove();
|
22803 |
|
22804 |
|
22805 | v === "line" && $$.hasTypeOf("Area") && shapeEnter.append("g").attr("class", $$.getClass("areas", !0));
|
22806 | }
|
22807 | }.bind(this));
|
22808 |
|
22809 |
|
22810 | main.selectAll("." + classes.brush + " rect").attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? state.width2 : state.height2);
|
22811 | }
|
22812 | },
|
22813 | |
22814 |
|
22815 |
|
22816 |
|
22817 |
|
22818 |
|
22819 |
|
22820 | redrawSubchart: function redrawSubchart(withSubchart, duration, shape) {
|
22821 | var _this9 = this,
|
22822 | $$ = this,
|
22823 | config = $$.config,
|
22824 | main = $$.$el.subchart.main,
|
22825 | state = $$.state,
|
22826 | withTransition = !!duration;
|
22827 | main.style("visibility", config.subchart_show ? null : "hidden");
|
22828 |
|
22829 |
|
22830 | if (config.subchart_show) {
|
22831 | var _state$event;
|
22832 |
|
22833 | if (((_state$event = state.event) == null ? void 0 : _state$event.type) === "zoom") {
|
22834 | $$.brush.update();
|
22835 | }
|
22836 |
|
22837 |
|
22838 | if (withSubchart) {
|
22839 | var initRange = config.subchart_init_range;
|
22840 |
|
22841 |
|
22842 | brushEmpty($$) || $$.brush.update();
|
22843 | Object.keys(shape.type).forEach(function (v) {
|
22844 | _newArrowCheck(this, _this9);
|
22845 | var name = capitalize(v),
|
22846 | drawFn = $$["generateDraw" + name](shape.indices[v], !0);
|
22847 |
|
22848 | $$["update" + name](withTransition, !0);
|
22849 | $$["redraw" + name](drawFn, withTransition, !0);
|
22850 | }.bind(this));
|
22851 | if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
22852 | var cx = shape.pos.cx,
|
22853 | cy = $$.updateCircleY(!0);
|
22854 | $$.updateCircle(!0);
|
22855 | $$.redrawCircle(cx, cy, withTransition, undefined, !0);
|
22856 | }
|
22857 | !state.rendered && initRange && $$.brush.move($$.brush.getSelection(), initRange.map($$.scale.x));
|
22858 | }
|
22859 | }
|
22860 | },
|
22861 | |
22862 |
|
22863 |
|
22864 |
|
22865 | redrawForBrush: function redrawForBrush() {
|
22866 | var $$ = this,
|
22867 | _$$$config = $$.config,
|
22868 | onBrush = _$$$config.subchart_onbrush,
|
22869 | withY = _$$$config.zoom_rescale,
|
22870 | scale = $$.scale;
|
22871 | $$.redraw({
|
22872 | withTransition: !1,
|
22873 | withY: withY,
|
22874 | withSubchart: !1,
|
22875 | withUpdateXDomain: !0,
|
22876 | withDimension: !1
|
22877 | });
|
22878 | onBrush.bind($$.api)(scale.x.orgDomain());
|
22879 | },
|
22880 | |
22881 |
|
22882 |
|
22883 |
|
22884 |
|
22885 |
|
22886 | transformContext: function transformContext(withTransition, transitions) {
|
22887 | var $$ = this,
|
22888 | subchart = $$.$el.subchart,
|
22889 | $T = $$.$T,
|
22890 | subXAxis = transitions != null && transitions.axisSubX ? transitions.axisSubX : $T(subchart.main.select("." + classes.axisX), withTransition);
|
22891 | subchart.main.attr("transform", $$.getTranslate("context"));
|
22892 | subXAxis.attr("transform", $$.getTranslate("subX"));
|
22893 | },
|
22894 | |
22895 |
|
22896 |
|
22897 |
|
22898 |
|
22899 | getExtent: function getExtent() {
|
22900 | var _this10 = this,
|
22901 | $$ = this,
|
22902 | config = $$.config,
|
22903 | scale = $$.scale,
|
22904 | extent = config.axis_x_extent;
|
22905 | if (extent) {
|
22906 | if (isFunction(extent)) {
|
22907 | extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX);
|
22908 | } else if ($$.axis.isTimeSeries() && extent.every(isNaN)) {
|
22909 | var fn = parseDate.bind($$);
|
22910 | extent = extent.map(function (v) {
|
22911 | _newArrowCheck(this, _this10);
|
22912 | return scale.subX(fn(v));
|
22913 | }.bind(this));
|
22914 | }
|
22915 | }
|
22916 | return extent;
|
22917 | }
|
22918 | });
|
22919 | ;
|
22920 |
|
22921 |
|
22922 |
|
22923 |
|
22924 |
|
22925 |
|
22926 |
|
22927 |
|
22928 |
|
22929 | var interactions_zoom = ({
|
22930 | |
22931 |
|
22932 |
|
22933 |
|
22934 | initZoom: function initZoom() {
|
22935 | var $$ = this;
|
22936 | $$.scale.zoom = null;
|
22937 | $$.generateZoom();
|
22938 | $$.initZoomBehaviour();
|
22939 | },
|
22940 | |
22941 |
|
22942 |
|
22943 |
|
22944 |
|
22945 | bindZoomEvent: function bindZoomEvent(bind) {
|
22946 | if (bind === void 0) {
|
22947 | bind = !0;
|
22948 | }
|
22949 | var $$ = this,
|
22950 | config = $$.config,
|
22951 | zoomEnabled = config.zoom_enabled;
|
22952 | if (zoomEnabled && bind) {
|
22953 |
|
22954 | config.subchart_show || $$.bindZoomOnEventRect();
|
22955 | } else if (bind === !1) {
|
22956 | $$.api.unzoom();
|
22957 | $$.unbindZoomEvent();
|
22958 | }
|
22959 | },
|
22960 | |
22961 |
|
22962 |
|
22963 |
|
22964 | generateZoom: function generateZoom() {
|
22965 | var _this = this,
|
22966 | $$ = this,
|
22967 | config = $$.config,
|
22968 | org = $$.org,
|
22969 | scale = $$.scale,
|
22970 | zoom = (0,external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoom)().duration(0).on("start", $$.onZoomStart.bind($$)).on("zoom", $$.onZoom.bind($$)).on("end", $$.onZoomEnd.bind($$));
|
22971 |
|
22972 |
|
22973 | zoom.orgScaleExtent = function () {
|
22974 | _newArrowCheck(this, _this);
|
22975 | var extent = config.zoom_extent || [1, 10];
|
22976 | return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])];
|
22977 | }.bind(this);
|
22978 |
|
22979 |
|
22980 | zoom.updateScaleExtent = function () {
|
22981 | var ratio = diffDomain($$.scale.x.orgDomain()) / diffDomain($$.getZoomDomain()),
|
22982 | extent = this.orgScaleExtent();
|
22983 | this.scaleExtent([extent[0] * ratio, extent[1] * ratio]);
|
22984 | return this;
|
22985 | };
|
22986 |
|
22987 | |
22988 |
|
22989 |
|
22990 |
|
22991 |
|
22992 |
|
22993 |
|
22994 | zoom.updateTransformScale = function (transform, correctTransform) {
|
22995 | var _org$xScale;
|
22996 | _newArrowCheck(this, _this);
|
22997 | var isRotated = config.axis_rotated;
|
22998 |
|
22999 |
|
23000 | (_org$xScale = org.xScale) == null ? void 0 : _org$xScale.range(scale.x.range());
|
23001 |
|
23002 |
|
23003 | var newScale = transform[isRotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x),
|
23004 | domain = $$.trimXDomain(newScale.domain()),
|
23005 | rescale = config.zoom_rescale;
|
23006 | newScale.domain(domain, org.xDomain);
|
23007 |
|
23008 |
|
23009 |
|
23010 | if (correctTransform) {
|
23011 | var t = newScale(scale.x.domain()[0]),
|
23012 | tX = isRotated ? transform.x : t,
|
23013 | tY = isRotated ? t : transform.y;
|
23014 | $$.$el.eventRect.property("__zoom", external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.translate(tX, tY).scale(transform.k));
|
23015 | }
|
23016 | if (!$$.state.xTickOffset) {
|
23017 | $$.state.xTickOffset = $$.axis.x.tickOffset();
|
23018 | }
|
23019 | scale.zoom = $$.getCustomizedScale(newScale);
|
23020 | $$.axis.x.scale(scale.zoom);
|
23021 | if (rescale) {
|
23022 |
|
23023 | org.xScale || (org.xScale = scale.x.copy());
|
23024 | scale.x.domain(domain);
|
23025 | }
|
23026 | }.bind(this);
|
23027 |
|
23028 | |
23029 |
|
23030 |
|
23031 |
|
23032 |
|
23033 |
|
23034 | zoom.getDomain = function () {
|
23035 | _newArrowCheck(this, _this);
|
23036 | var domain = scale[scale.zoom ? "zoom" : "subX"].domain(),
|
23037 | isCategorized = $$.axis.isCategorized();
|
23038 | if (isCategorized) {
|
23039 | domain[1] -= 2;
|
23040 | }
|
23041 | return domain;
|
23042 | }.bind(this);
|
23043 | $$.zoom = zoom;
|
23044 | },
|
23045 | |
23046 |
|
23047 |
|
23048 |
|
23049 |
|
23050 | onZoomStart: function onZoomStart(event) {
|
23051 | var $$ = this,
|
23052 | sourceEvent = event.sourceEvent;
|
23053 | if (sourceEvent) {
|
23054 | $$.zoom.startEvent = sourceEvent;
|
23055 | $$.state.zooming = !0;
|
23056 | callFn($$.config.zoom_onzoomstart, $$.api, event);
|
23057 | }
|
23058 | },
|
23059 | |
23060 |
|
23061 |
|
23062 |
|
23063 |
|
23064 | onZoom: function onZoom(event) {
|
23065 | var _this2 = this,
|
23066 | $$ = this,
|
23067 | config = $$.config,
|
23068 | scale = $$.scale,
|
23069 | state = $$.state,
|
23070 | org = $$.org,
|
23071 | sourceEvent = event.sourceEvent,
|
23072 | isUnZoom = (event == null ? void 0 : event.transform) === external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity;
|
23073 | if (!config.zoom_enabled || $$.filterTargetsToShow($$.data.targets).length === 0 || !scale.zoom && (sourceEvent == null ? void 0 : sourceEvent.type.indexOf("touch")) > -1 && (sourceEvent == null ? void 0 : sourceEvent.touches.length) === 1) {
|
23074 | return;
|
23075 | }
|
23076 | if (event.sourceEvent) {
|
23077 | state.zooming = !0;
|
23078 | }
|
23079 | var isMousemove = (sourceEvent == null ? void 0 : sourceEvent.type) === "mousemove",
|
23080 | isZoomOut = (sourceEvent == null ? void 0 : sourceEvent.wheelDelta) < 0,
|
23081 | transform = event.transform;
|
23082 | if (!isMousemove && isZoomOut && scale.x.domain().every(function (v, i) {
|
23083 | _newArrowCheck(this, _this2);
|
23084 | return v !== org.xDomain[i];
|
23085 | }.bind(this))) {
|
23086 | scale.x.domain(org.xDomain);
|
23087 | }
|
23088 | $$.zoom.updateTransformScale(transform, config.zoom_type === "wheel" && sourceEvent);
|
23089 |
|
23090 |
|
23091 |
|
23092 |
|
23093 | var doTransition = config.transition_duration > 0 && !config.subchart_show && (state.dragging || isUnZoom || !event.sourceEvent);
|
23094 | $$.redraw({
|
23095 | withTransition: doTransition,
|
23096 | withY: config.zoom_rescale,
|
23097 | withSubchart: !1,
|
23098 | withEventRect: !1,
|
23099 | withDimension: !1
|
23100 | });
|
23101 | $$.state.cancelClick = isMousemove;
|
23102 |
|
23103 |
|
23104 | isUnZoom || callFn(config.zoom_onzoom, $$.api, $$.zoom.getDomain());
|
23105 | },
|
23106 | |
23107 |
|
23108 |
|
23109 |
|
23110 |
|
23111 | onZoomEnd: function onZoomEnd(event) {
|
23112 | var _startEvent,
|
23113 | $$ = this,
|
23114 | config = $$.config,
|
23115 | state = $$.state,
|
23116 | startEvent = $$.zoom.startEvent,
|
23117 | e = event == null ? void 0 : event.sourceEvent,
|
23118 | isUnZoom = (event == null ? void 0 : event.transform) === external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity;
|
23119 | if (((_startEvent = startEvent) == null ? void 0 : _startEvent.type.indexOf("touch")) > -1) {
|
23120 | var _e, _e$changedTouches;
|
23121 | startEvent = startEvent.changedTouches[0];
|
23122 | e = (_e = e) == null ? void 0 : (_e$changedTouches = _e.changedTouches) == null ? void 0 : _e$changedTouches[0];
|
23123 | }
|
23124 |
|
23125 |
|
23126 | if (config.zoom_type === "drag" && e && startEvent.clientX === e.clientX && startEvent.clientY === e.clientY) {
|
23127 | return;
|
23128 | }
|
23129 | $$.redrawEventRect();
|
23130 | $$.updateZoom();
|
23131 | state.zooming = !1;
|
23132 |
|
23133 |
|
23134 | !isUnZoom && (e || state.dragging) && callFn(config.zoom_onzoomend, $$.api, $$.zoom.getDomain());
|
23135 | },
|
23136 | |
23137 |
|
23138 |
|
23139 |
|
23140 |
|
23141 | updateZoom: function updateZoom(force) {
|
23142 | var $$ = this,
|
23143 | _$$$scale = $$.scale,
|
23144 | subX = _$$$scale.subX,
|
23145 | x = _$$$scale.x,
|
23146 | zoom = _$$$scale.zoom;
|
23147 | if (zoom) {
|
23148 | var zoomDomain = zoom.domain(),
|
23149 | xDomain = subX.domain(),
|
23150 | delta = .015,
|
23151 | isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
|
23152 |
|
23153 | if (force || isfullyShown) {
|
23154 | $$.axis.x.scale(subX);
|
23155 | x.domain(subX.orgDomain());
|
23156 | $$.scale.zoom = null;
|
23157 | }
|
23158 | }
|
23159 | },
|
23160 | |
23161 |
|
23162 |
|
23163 |
|
23164 | bindZoomOnEventRect: function bindZoomOnEventRect() {
|
23165 | var _this3 = this,
|
23166 | $$ = this,
|
23167 | config = $$.config,
|
23168 | eventRect = $$.$el.eventRect,
|
23169 | behaviour = config.zoom_type === "drag" ? $$.zoomBehaviour : $$.zoom;
|
23170 |
|
23171 |
|
23172 | $$.$el.svg.on("wheel", function () {
|
23173 | _newArrowCheck(this, _this3);
|
23174 | }.bind(this));
|
23175 | eventRect.call(behaviour).on("dblclick.zoom", null);
|
23176 | },
|
23177 | |
23178 |
|
23179 |
|
23180 |
|
23181 | initZoomBehaviour: function initZoomBehaviour() {
|
23182 | var _this4 = this,
|
23183 | $$ = this,
|
23184 | config = $$.config,
|
23185 | state = $$.state,
|
23186 | isRotated = config.axis_rotated,
|
23187 | start = 0,
|
23188 | end = 0,
|
23189 | zoomRect,
|
23190 | prop = {
|
23191 | axis: isRotated ? "y" : "x",
|
23192 | attr: isRotated ? "height" : "width",
|
23193 | index: isRotated ? 1 : 0
|
23194 | };
|
23195 | $$.zoomBehaviour = (0,external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_.drag)().clickDistance(4).on("start", function (event) {
|
23196 | state.event = event;
|
23197 | $$.setDragStatus(!0);
|
23198 | $$.unselectRect();
|
23199 | if (!zoomRect) {
|
23200 | zoomRect = $$.$el.main.append("rect").attr("clip-path", state.clip.path).attr("class", $ZOOM.zoomBrush).attr("width", isRotated ? state.width : 0).attr("height", isRotated ? 0 : state.height);
|
23201 | }
|
23202 | start = getPointer(event, this)[prop.index];
|
23203 | end = start;
|
23204 | zoomRect.attr(prop.axis, start).attr(prop.attr, 0);
|
23205 | $$.onZoomStart(event);
|
23206 | }).on("drag", function (event) {
|
23207 | end = getPointer(event, this)[prop.index];
|
23208 | zoomRect.attr(prop.axis, Math.min(start, end)).attr(prop.attr, Math.abs(end - start));
|
23209 | }).on("end", function (event) {
|
23210 | var _this5 = this;
|
23211 | _newArrowCheck(this, _this4);
|
23212 | var scale = $$.scale.zoom || $$.scale.x;
|
23213 | state.event = event;
|
23214 | zoomRect.attr(prop.axis, 0).attr(prop.attr, 0);
|
23215 | if (start > end) {
|
23216 | var _ref = [end, start];
|
23217 | start = _ref[0];
|
23218 | end = _ref[1];
|
23219 | }
|
23220 | if (start < 0) {
|
23221 | end += Math.abs(start);
|
23222 | start = 0;
|
23223 | }
|
23224 | if (start !== end) {
|
23225 | $$.api.zoom([start, end].map(function (v) {
|
23226 | _newArrowCheck(this, _this5);
|
23227 | return scale.invert(v);
|
23228 | }.bind(this)));
|
23229 | }
|
23230 | $$.setDragStatus(!1);
|
23231 | }.bind(this));
|
23232 | },
|
23233 | setZoomResetButton: function setZoomResetButton() {
|
23234 | var $$ = this,
|
23235 | config = $$.config,
|
23236 | $el = $$.$el,
|
23237 | resetButton = config.zoom_resetButton;
|
23238 | if (resetButton && config.zoom_type === "drag") {
|
23239 | if (!$el.zoomResetBtn) {
|
23240 | $el.zoomResetBtn = $$.$el.chart.append("div").classed($COMMON.button, !0).append("span").on("click", function () {
|
23241 | isFunction(resetButton.onclick) && resetButton.onclick.bind($$.api)(this);
|
23242 | $$.api.unzoom();
|
23243 | }).classed($ZOOM.buttonZoomReset, !0).text(resetButton.text || "Reset Zoom");
|
23244 | } else {
|
23245 | $el.zoomResetBtn.style("display", null);
|
23246 | }
|
23247 | }
|
23248 | }
|
23249 | });
|
23250 | ;
|
23251 |
|
23252 | var selection_this = undefined;
|
23253 |
|
23254 |
|
23255 |
|
23256 |
|
23257 |
|
23258 |
|
23259 |
|
23260 | var data_selection = ({
|
23261 | |
23262 |
|
23263 |
|
23264 |
|
23265 |
|
23266 |
|
23267 |
|
23268 |
|
23269 |
|
23270 |
|
23271 |
|
23272 |
|
23273 |
|
23274 |
|
23275 |
|
23276 |
|
23277 |
|
23278 |
|
23279 |
|
23280 |
|
23281 |
|
23282 |
|
23283 |
|
23284 |
|
23285 |
|
23286 |
|
23287 |
|
23288 | data_selection_enabled: !1,
|
23289 | |
23290 |
|
23291 |
|
23292 |
|
23293 |
|
23294 |
|
23295 |
|
23296 |
|
23297 |
|
23298 |
|
23299 |
|
23300 |
|
23301 |
|
23302 |
|
23303 | data_selection_grouped: !1,
|
23304 | |
23305 |
|
23306 |
|
23307 |
|
23308 |
|
23309 |
|
23310 |
|
23311 |
|
23312 |
|
23313 |
|
23314 |
|
23315 |
|
23316 |
|
23317 |
|
23318 | data_selection_isselectable: function data_selection_isselectable() {
|
23319 | _newArrowCheck(this, selection_this);
|
23320 | return !0;
|
23321 | }.bind(undefined),
|
23322 | |
23323 |
|
23324 |
|
23325 |
|
23326 |
|
23327 |
|
23328 |
|
23329 |
|
23330 |
|
23331 |
|
23332 |
|
23333 |
|
23334 |
|
23335 |
|
23336 | data_selection_multiple: !0,
|
23337 | |
23338 |
|
23339 |
|
23340 |
|
23341 |
|
23342 |
|
23343 |
|
23344 |
|
23345 |
|
23346 |
|
23347 |
|
23348 |
|
23349 |
|
23350 |
|
23351 |
|
23352 | data_selection_draggable: !1,
|
23353 | |
23354 |
|
23355 |
|
23356 |
|
23357 |
|
23358 |
|
23359 |
|
23360 |
|
23361 |
|
23362 |
|
23363 |
|
23364 |
|
23365 |
|
23366 |
|
23367 |
|
23368 | data_onselected: function data_onselected() {
|
23369 | _newArrowCheck(this, selection_this);
|
23370 | }.bind(undefined),
|
23371 | |
23372 |
|
23373 |
|
23374 |
|
23375 |
|
23376 |
|
23377 |
|
23378 |
|
23379 |
|
23380 |
|
23381 |
|
23382 |
|
23383 |
|
23384 |
|
23385 |
|
23386 | data_onunselected: function data_onunselected() {
|
23387 | _newArrowCheck(this, selection_this);
|
23388 | }.bind(undefined)
|
23389 | });
|
23390 | ;
|
23391 |
|
23392 | var subchart_this = undefined;
|
23393 |
|
23394 |
|
23395 |
|
23396 |
|
23397 |
|
23398 |
|
23399 |
|
23400 | var interaction_subchart = ({
|
23401 | |
23402 |
|
23403 |
|
23404 |
|
23405 |
|
23406 |
|
23407 |
|
23408 |
|
23409 |
|
23410 |
|
23411 |
|
23412 |
|
23413 |
|
23414 |
|
23415 |
|
23416 |
|
23417 |
|
23418 |
|
23419 |
|
23420 |
|
23421 |
|
23422 |
|
23423 |
|
23424 |
|
23425 |
|
23426 |
|
23427 |
|
23428 |
|
23429 |
|
23430 |
|
23431 |
|
23432 |
|
23433 |
|
23434 |
|
23435 |
|
23436 |
|
23437 |
|
23438 |
|
23439 |
|
23440 |
|
23441 |
|
23442 |
|
23443 |
|
23444 |
|
23445 |
|
23446 |
|
23447 |
|
23448 |
|
23449 |
|
23450 |
|
23451 |
|
23452 |
|
23453 |
|
23454 |
|
23455 | subchart_show: !1,
|
23456 | subchart_showHandle: !1,
|
23457 | subchart_size_height: 60,
|
23458 | subchart_axis_x_show: !0,
|
23459 | subchart_axis_x_tick_show: !0,
|
23460 | subchart_axis_x_tick_format: undefined,
|
23461 | subchart_axis_x_tick_text_show: !0,
|
23462 | subchart_init_range: undefined,
|
23463 | subchart_onbrush: function subchart_onbrush() {
|
23464 | _newArrowCheck(this, subchart_this);
|
23465 | }.bind(undefined)
|
23466 | });
|
23467 | ;
|
23468 |
|
23469 |
|
23470 |
|
23471 |
|
23472 |
|
23473 |
|
23474 |
|
23475 | var interaction_zoom = ({
|
23476 | |
23477 |
|
23478 |
|
23479 |
|
23480 |
|
23481 |
|
23482 |
|
23483 |
|
23484 |
|
23485 |
|
23486 |
|
23487 |
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 |
|
23493 |
|
23494 |
|
23495 |
|
23496 |
|
23497 |
|
23498 |
|
23499 |
|
23500 |
|
23501 |
|
23502 |
|
23503 |
|
23504 |
|
23505 |
|
23506 |
|
23507 |
|
23508 |
|
23509 |
|
23510 |
|
23511 |
|
23512 |
|
23513 |
|
23514 |
|
23515 |
|
23516 |
|
23517 |
|
23518 |
|
23519 |
|
23520 |
|
23521 |
|
23522 |
|
23523 |
|
23524 |
|
23525 |
|
23526 |
|
23527 |
|
23528 |
|
23529 |
|
23530 |
|
23531 |
|
23532 |
|
23533 |
|
23534 |
|
23535 |
|
23536 |
|
23537 |
|
23538 |
|
23539 |
|
23540 |
|
23541 |
|
23542 | zoom_enabled: !1,
|
23543 | zoom_type: "wheel",
|
23544 | zoom_extent: undefined,
|
23545 | zoom_privileged: !1,
|
23546 | zoom_rescale: !1,
|
23547 | zoom_onzoom: undefined,
|
23548 | zoom_onzoomstart: undefined,
|
23549 | zoom_onzoomend: undefined,
|
23550 | zoom_resetButton: !0,
|
23551 | zoom_x_min: undefined,
|
23552 | zoom_x_max: undefined
|
23553 | });
|
23554 | ;
|
23555 |
|
23556 | var interaction_this = undefined;
|
23557 |
|
23558 |
|
23559 |
|
23560 |
|
23561 |
|
23562 |
|
23563 |
|
23564 |
|
23565 |
|
23566 |
|
23567 |
|
23568 |
|
23569 |
|
23570 |
|
23571 |
|
23572 |
|
23573 |
|
23574 |
|
23575 |
|
23576 |
|
23577 |
|
23578 |
|
23579 |
|
23580 |
|
23581 | var _selectionModule = function selectionModule() {
|
23582 | var _this2 = this;
|
23583 | _newArrowCheck(this, interaction_this);
|
23584 | extend(ChartInternal.prototype, internals_selection);
|
23585 | extend(Chart.prototype, selection);
|
23586 | Options.setOptions([data_selection]);
|
23587 | return (_selectionModule = function () {
|
23588 | _newArrowCheck(this, _this2);
|
23589 | return !0;
|
23590 | }.bind(this))();
|
23591 | }.bind(undefined),
|
23592 | subchartModule = function () {
|
23593 | var _this3 = this;
|
23594 | _newArrowCheck(this, interaction_this);
|
23595 | extend(ChartInternal.prototype, interactions_subchart);
|
23596 | extend(Chart.prototype, subchart);
|
23597 | Options.setOptions([interaction_subchart]);
|
23598 | return (subchartModule = function () {
|
23599 | _newArrowCheck(this, _this3);
|
23600 | return !0;
|
23601 | }.bind(this))();
|
23602 | }.bind(undefined),
|
23603 | zoomModule = function () {
|
23604 | var _this4 = this;
|
23605 | _newArrowCheck(this, interaction_this);
|
23606 | extend(ChartInternal.prototype, interactions_zoom);
|
23607 | extend(Chart.prototype, api_zoom);
|
23608 | Options.setOptions([interaction_zoom]);
|
23609 | return (zoomModule = function () {
|
23610 | _newArrowCheck(this, _this4);
|
23611 | return !0;
|
23612 | }.bind(this))();
|
23613 | }.bind(undefined);
|
23614 | ;
|
23615 |
|
23616 |
|
23617 |
|
23618 |
|
23619 |
|
23620 |
|
23621 |
|
23622 |
|
23623 |
|
23624 | var _defaults = {},
|
23625 | bb = {
|
23626 | |
23627 |
|
23628 |
|
23629 |
|
23630 |
|
23631 |
|
23632 |
|
23633 | version: "3.6.3",
|
23634 | |
23635 |
|
23636 |
|
23637 |
|
23638 |
|
23639 |
|
23640 |
|
23641 |
|
23642 |
|
23643 |
|
23644 |
|
23645 |
|
23646 |
|
23647 |
|
23648 |
|
23649 |
|
23650 |
|
23651 |
|
23652 |
|
23653 |
|
23654 |
|
23655 |
|
23656 |
|
23657 |
|
23658 |
|
23659 |
|
23660 |
|
23661 |
|
23662 |
|
23663 |
|
23664 |
|
23665 |
|
23666 |
|
23667 |
|
23668 |
|
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 |
|
23681 |
|
23682 |
|
23683 |
|
23684 |
|
23685 |
|
23686 |
|
23687 |
|
23688 |
|
23689 |
|
23690 |
|
23691 |
|
23692 |
|
23693 |
|
23694 |
|
23695 |
|
23696 |
|
23697 |
|
23698 |
|
23699 |
|
23700 |
|
23701 |
|
23702 |
|
23703 |
|
23704 | generate: function generate(config) {
|
23705 | var options = mergeObj({}, _defaults, config),
|
23706 | inst = new Chart(options);
|
23707 | inst.internal.charts = this.instance;
|
23708 | this.instance.push(inst);
|
23709 | return inst;
|
23710 | },
|
23711 | |
23712 |
|
23713 |
|
23714 |
|
23715 |
|
23716 |
|
23717 |
|
23718 |
|
23719 |
|
23720 |
|
23721 |
|
23722 |
|
23723 |
|
23724 |
|
23725 |
|
23726 |
|
23727 |
|
23728 |
|
23729 |
|
23730 |
|
23731 |
|
23732 |
|
23733 | defaults: function defaults(options) {
|
23734 | if (isObject(options)) {
|
23735 | _defaults = options;
|
23736 | }
|
23737 | return _defaults;
|
23738 | },
|
23739 | |
23740 |
|
23741 |
|
23742 |
|
23743 |
|
23744 |
|
23745 |
|
23746 |
|
23747 |
|
23748 |
|
23749 |
|
23750 | instance: [],
|
23751 | |
23752 |
|
23753 |
|
23754 |
|
23755 |
|
23756 |
|
23757 |
|
23758 |
|
23759 | plugin: {}
|
23760 | };
|
23761 |
|
23762 |
|
23763 |
|
23764 |
|
23765 | ;
|
23766 |
|
23767 | var src_this = undefined;
|
23768 |
|
23769 |
|
23770 |
|
23771 |
|
23772 |
|
23773 |
|
23774 |
|
23775 |
|
23776 | Object.keys(resolver_shape_namespaceObject).forEach(function (v) {
|
23777 | _newArrowCheck(this, src_this);
|
23778 | return resolver_shape_namespaceObject[v]();
|
23779 | }.bind(undefined));
|
23780 |
|
23781 |
|
23782 | Object.keys(resolver_interaction_namespaceObject).forEach(function (v) {
|
23783 | _newArrowCheck(this, src_this);
|
23784 | return resolver_interaction_namespaceObject[v]();
|
23785 | }.bind(undefined));
|
23786 |
|
23787 | }();
|
23788 | return __webpack_exports__;
|
23789 | })()
|
23790 | ;
|
23791 | }); |
\ | No newline at end of file |