billboard.js 3.14.3 → 3.15.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +155 -102
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +1367 -1014
- package/dist/billboard.pkgd.min.js +14 -14
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -9
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1204 -914
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -5
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1205 -915
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -7
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1206 -916
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1207 -917
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1215 -918
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +6 -6
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +555 -482
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +4 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -88
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +13 -86
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -83
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +7 -70
- package/package.json +28 -28
- package/src/Chart/api/chart.ts +2 -0
- package/src/Chart/api/regions.ts +2 -2
- package/src/ChartInternal/Axis/Axis.ts +68 -60
- package/src/ChartInternal/ChartInternal.ts +9 -4
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/internals/region.ts +69 -56
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/main.ts +32 -11
- package/types/options.d.ts +3 -1
- package/types/types.d.ts +0 -14
package/dist-esm/billboard.js
CHANGED
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.15.0-next.2
|
|
9
9
|
*/
|
|
10
10
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
11
11
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
12
12
|
import { brushSelection, brushY, brushX } from 'd3-brush';
|
|
13
|
-
import { csvParseRows,
|
|
13
|
+
import { csvParse, csvParseRows, tsvParse, tsvParseRows } from 'd3-dsv';
|
|
14
14
|
import { drag as drag$1 } from 'd3-drag';
|
|
15
|
-
import { scaleOrdinal, scaleLinear,
|
|
15
|
+
import { scaleOrdinal, scaleLinear, scaleUtc, scaleTime, scaleLog, scaleSymlog } from 'd3-scale';
|
|
16
16
|
import { transition } from 'd3-transition';
|
|
17
|
-
import {
|
|
17
|
+
import { curveStepBefore, curveStepAfter, curveStep, curveLinear, curveLinearClosed, curveNatural, curveMonotoneY, curveMonotoneX, curveCatmullRomOpen, curveCatmullRomClosed, curveCatmullRom, curveCardinalOpen, curveCardinalClosed, curveCardinal, curveBundle, curveBasisOpen, curveBasisClosed, curveBasis, arc, pie as pie$1, area as area$1, line as line$1 } from 'd3-shape';
|
|
18
18
|
import { axisLeft, axisBottom, axisTop, axisRight } from 'd3-axis';
|
|
19
19
|
import { easeLinear } from 'd3-ease';
|
|
20
20
|
import { interpolate } from 'd3-interpolate';
|
|
21
|
-
import {
|
|
21
|
+
import { treemapResquarify, treemapSquarify, treemapSliceDice, treemapSlice, treemapDice, treemapBinary, treemap as treemap$1, hierarchy } from 'd3-hierarchy';
|
|
22
22
|
import { zoomIdentity, zoomTransform, zoom as zoom$2 } from 'd3-zoom';
|
|
23
23
|
|
|
24
24
|
/******************************************************************************
|
|
@@ -690,6 +690,7 @@ var main = {
|
|
|
690
690
|
* - **NOTE:** Available options
|
|
691
691
|
* - true: Enables automatic resize.
|
|
692
692
|
* - false: Disables automatic resize.
|
|
693
|
+
* - "parent": Enables automatic resize when the parent node is resized.
|
|
693
694
|
* - "viewBox": Enables automatic resize, and size will be fixed based on the viewbox.
|
|
694
695
|
* @property {boolean|number} [resize.timer=true] Set resize timer option.
|
|
695
696
|
* - **NOTE:** Available options
|
|
@@ -697,11 +698,15 @@ var main = {
|
|
|
697
698
|
* - true: `setTimeout()`
|
|
698
699
|
* - false: `requestIdleCallback()`
|
|
699
700
|
* - Given number(delay in ms) value, resize function will be triggered using `setTimeout()` with given delay.
|
|
700
|
-
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.
|
|
701
|
+
* @see [Demo: resize "parent"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeParent)
|
|
702
|
+
* @see [Demo: resize "viewBox"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
|
|
701
703
|
* @example
|
|
702
704
|
* resize: {
|
|
703
705
|
* auto: false,
|
|
704
706
|
*
|
|
707
|
+
* // set resize based on parent node width value
|
|
708
|
+
* auto: "parent",
|
|
709
|
+
*
|
|
705
710
|
* // set resize based on viewBox value
|
|
706
711
|
* auto: "viewBox",
|
|
707
712
|
*
|
|
@@ -910,17 +915,32 @@ var main = {
|
|
|
910
915
|
render: {},
|
|
911
916
|
/**
|
|
912
917
|
* Show rectangles inside the chart.<br><br>
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
* If
|
|
917
|
-
* If
|
|
918
|
-
* If class is set, the region element will have it as class.
|
|
918
|
+
* - **NOTE:**<br>
|
|
919
|
+
* - axis must be x, y or y2. start and end should be the value where regions start and end.
|
|
920
|
+
* - If not specified, the edge values will be used.
|
|
921
|
+
* - If timeseries x axis, date string, Date object and unixtime integer can be used.
|
|
922
|
+
* - If category x axis, category name can be used for start and end.
|
|
923
|
+
* - If class is set, the region element will have it as class.
|
|
924
|
+
*
|
|
925
|
+
* This option accept array of object with below values:
|
|
926
|
+
* - `axis {string}`: 'x', 'y', or 'y2'
|
|
927
|
+
* - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
|
|
928
|
+
* - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
|
|
929
|
+
* - `[class] {string}`: Class value to apply to the region.
|
|
930
|
+
* - `[label] {object}` Lable text option.
|
|
931
|
+
* - `text {string}`: Text value.
|
|
932
|
+
* - `x {number}`: x Position.
|
|
933
|
+
* - `y {number}`: y Position.
|
|
934
|
+
* - `center {string}`: Align label at the center. Allowed values are 'x', 'y', 'xy'.
|
|
935
|
+
* - `color {string}`: Color string.
|
|
936
|
+
* - `rotated (boolean)`: Whether rotate label or not.
|
|
919
937
|
* @name regions
|
|
920
938
|
* @memberof Options
|
|
921
939
|
* @type {Array}
|
|
922
940
|
* @default []
|
|
923
|
-
* @see [Demo](https://naver.github.io/billboard.js/demo/#Region.
|
|
941
|
+
* @see [Demo: Regions](https://naver.github.io/billboard.js/demo/#Region.Region)
|
|
942
|
+
* @see [Demo: Regions Timeseries](https://naver.github.io/billboard.js/demo/#Region.RegionWithTimeseries)
|
|
943
|
+
* @see [Demo: Regions Label](https://naver.github.io/billboard.js/demo/#Region.RegionLabel)
|
|
924
944
|
* @example
|
|
925
945
|
* regions: [
|
|
926
946
|
* {
|
|
@@ -932,6 +952,7 @@ var main = {
|
|
|
932
952
|
* text: "Region Text",
|
|
933
953
|
* x: 5, // position relative of the initial x coordinate
|
|
934
954
|
* y: 5, // position relative of the initial y coordinate
|
|
955
|
+
* center: "xy", // center text label in both direction.
|
|
935
956
|
* color: "red", // color string
|
|
936
957
|
* rotated: true // make text to show in vertical or horizontal
|
|
937
958
|
* }
|
|
@@ -2174,10 +2195,10 @@ function getGlobal() {
|
|
|
2174
2195
|
* @private
|
|
2175
2196
|
*/
|
|
2176
2197
|
function getFallback(w) {
|
|
2177
|
-
var hasRAF = typeof (w === null || w ===
|
|
2178
|
-
typeof (w === null || w ===
|
|
2179
|
-
var hasRIC = typeof (w === null || w ===
|
|
2180
|
-
typeof (w === null || w ===
|
|
2198
|
+
var hasRAF = typeof (w === null || w === void 0 ? void 0 : w.requestAnimationFrame) === "function" &&
|
|
2199
|
+
typeof (w === null || w === void 0 ? void 0 : w.cancelAnimationFrame) === "function";
|
|
2200
|
+
var hasRIC = typeof (w === null || w === void 0 ? void 0 : w.requestIdleCallback) === "function" &&
|
|
2201
|
+
typeof (w === null || w === void 0 ? void 0 : w.cancelIdleCallback) === "function";
|
|
2181
2202
|
var request = function (cb) { return setTimeout(cb, 1); };
|
|
2182
2203
|
var cancel = function (id) { return clearTimeout(id); };
|
|
2183
2204
|
return [
|
|
@@ -2188,7 +2209,7 @@ function getFallback(w) {
|
|
|
2188
2209
|
];
|
|
2189
2210
|
}
|
|
2190
2211
|
var win = getGlobal();
|
|
2191
|
-
var doc = win === null || win ===
|
|
2212
|
+
var doc = win === null || win === void 0 ? void 0 : win.document;
|
|
2192
2213
|
var _a = getFallback(win), requestAnimationFrame = _a[0], requestIdleCallback = _a[2];
|
|
2193
2214
|
|
|
2194
2215
|
var isValue = function (v) { return v || v === 0; };
|
|
@@ -2220,7 +2241,7 @@ var isArray = function (arr) { return Array.isArray(arr); };
|
|
|
2220
2241
|
* @returns {boolean}
|
|
2221
2242
|
* @private
|
|
2222
2243
|
*/
|
|
2223
|
-
var isObject = function (obj) { return obj && !(obj === null || obj ===
|
|
2244
|
+
var isObject = function (obj) { return obj && !(obj === null || obj === void 0 ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj); };
|
|
2224
2245
|
/**
|
|
2225
2246
|
* Get specified key value from object
|
|
2226
2247
|
* If default value is given, will return if given key value not found
|
|
@@ -2308,8 +2329,8 @@ function sanitize(str) {
|
|
|
2308
2329
|
* @private
|
|
2309
2330
|
*/
|
|
2310
2331
|
function setTextValue(node, text, dy, toMiddle) {
|
|
2311
|
-
if (dy ===
|
|
2312
|
-
if (toMiddle ===
|
|
2332
|
+
if (dy === void 0) { dy = [-1, 1]; }
|
|
2333
|
+
if (toMiddle === void 0) { toMiddle = false; }
|
|
2313
2334
|
if (!node || !isString(text)) {
|
|
2314
2335
|
return;
|
|
2315
2336
|
}
|
|
@@ -2382,7 +2403,7 @@ function getPathBox(path) {
|
|
|
2382
2403
|
function getPointer(event, element) {
|
|
2383
2404
|
var _a;
|
|
2384
2405
|
var touches = event &&
|
|
2385
|
-
((_a = (event.touches || (event.sourceEvent && event.sourceEvent.touches))) === null || _a ===
|
|
2406
|
+
((_a = (event.touches || (event.sourceEvent && event.sourceEvent.touches))) === null || _a === void 0 ? void 0 : _a[0]);
|
|
2386
2407
|
var pointer$1 = [0, 0];
|
|
2387
2408
|
try {
|
|
2388
2409
|
pointer$1 = pointer(touches || event, element);
|
|
@@ -2431,9 +2452,9 @@ function getBoundingRect(node) {
|
|
|
2431
2452
|
* @private
|
|
2432
2453
|
*/
|
|
2433
2454
|
function getRandom(asStr, min, max) {
|
|
2434
|
-
if (asStr ===
|
|
2435
|
-
if (min ===
|
|
2436
|
-
if (max ===
|
|
2455
|
+
if (asStr === void 0) { asStr = true; }
|
|
2456
|
+
if (min === void 0) { min = 0; }
|
|
2457
|
+
if (max === void 0) { max = 10000; }
|
|
2437
2458
|
var crpt = win.crypto || win.msCrypto;
|
|
2438
2459
|
var rand = crpt ?
|
|
2439
2460
|
min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) :
|
|
@@ -2455,7 +2476,7 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
2455
2476
|
return -1;
|
|
2456
2477
|
}
|
|
2457
2478
|
var mid = Math.floor((start + end) / 2);
|
|
2458
|
-
var _a = arr[mid], x = _a.x, _b = _a.w, w = _b ===
|
|
2479
|
+
var _a = arr[mid], x = _a.x, _b = _a.w, w = _b === void 0 ? 0 : _b;
|
|
2459
2480
|
if (isRotated) {
|
|
2460
2481
|
x = arr[mid].y;
|
|
2461
2482
|
w = arr[mid].h;
|
|
@@ -2515,7 +2536,7 @@ function deepClone() {
|
|
|
2515
2536
|
* @private
|
|
2516
2537
|
*/
|
|
2517
2538
|
function extend(target, source) {
|
|
2518
|
-
if (target ===
|
|
2539
|
+
if (target === void 0) { target = {}; }
|
|
2519
2540
|
if (isArray(source)) {
|
|
2520
2541
|
source.forEach(function (v) { return extend(target, v); });
|
|
2521
2542
|
}
|
|
@@ -2543,7 +2564,7 @@ var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.slice
|
|
|
2543
2564
|
* @private
|
|
2544
2565
|
*/
|
|
2545
2566
|
function camelize(str, separator) {
|
|
2546
|
-
if (separator ===
|
|
2567
|
+
if (separator === void 0) { separator = "-"; }
|
|
2547
2568
|
return str.split(separator)
|
|
2548
2569
|
.map(function (v, i) { return (i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase()); })
|
|
2549
2570
|
.join("");
|
|
@@ -2564,7 +2585,7 @@ var toArray = function (v) { return [].slice.call(v); };
|
|
|
2564
2585
|
* @private
|
|
2565
2586
|
*/
|
|
2566
2587
|
function addCssRules(style, selector, prop) {
|
|
2567
|
-
var _a = style.rootSelector, rootSelector = _a ===
|
|
2588
|
+
var _a = style.rootSelector, rootSelector = _a === void 0 ? "" : _a, sheet = style.sheet;
|
|
2568
2589
|
var getSelector = function (s) {
|
|
2569
2590
|
return s
|
|
2570
2591
|
.replace(/\s?(bb-)/g, ".$1")
|
|
@@ -2589,7 +2610,7 @@ function getCssRules(styleSheets) {
|
|
|
2589
2610
|
}
|
|
2590
2611
|
}
|
|
2591
2612
|
catch (e) {
|
|
2592
|
-
(_a = win.console) === null || _a ===
|
|
2613
|
+
(_a = win.console) === null || _a === void 0 ? void 0 : _a.warn("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
|
|
2593
2614
|
}
|
|
2594
2615
|
});
|
|
2595
2616
|
return rules;
|
|
@@ -2603,8 +2624,8 @@ function getCssRules(styleSheets) {
|
|
|
2603
2624
|
function getScrollPosition(node) {
|
|
2604
2625
|
var _a, _b, _c, _d, _e, _f;
|
|
2605
2626
|
return {
|
|
2606
|
-
x: ((_b = (_a = win.pageXOffset) !== null && _a !==
|
|
2607
|
-
y: ((_e = (_d = win.pageYOffset) !== null && _d !==
|
|
2627
|
+
x: ((_b = (_a = win.pageXOffset) !== null && _a !== void 0 ? _a : win.scrollX) !== null && _b !== void 0 ? _b : 0) + ((_c = node.scrollLeft) !== null && _c !== void 0 ? _c : 0),
|
|
2628
|
+
y: ((_e = (_d = win.pageYOffset) !== null && _d !== void 0 ? _d : win.scrollY) !== null && _e !== void 0 ? _e : 0) + ((_f = node.scrollTop) !== null && _f !== void 0 ? _f : 0)
|
|
2608
2629
|
};
|
|
2609
2630
|
}
|
|
2610
2631
|
/**
|
|
@@ -2616,12 +2637,12 @@ function getScrollPosition(node) {
|
|
|
2616
2637
|
* @returns {object}
|
|
2617
2638
|
*/
|
|
2618
2639
|
function getTransformCTM(node, x, y, inverse) {
|
|
2619
|
-
if (x ===
|
|
2620
|
-
if (y ===
|
|
2621
|
-
if (inverse ===
|
|
2640
|
+
if (x === void 0) { x = 0; }
|
|
2641
|
+
if (y === void 0) { y = 0; }
|
|
2642
|
+
if (inverse === void 0) { inverse = true; }
|
|
2622
2643
|
var point = new DOMPoint(x, y);
|
|
2623
2644
|
var screen = node.getScreenCTM();
|
|
2624
|
-
var res = point.matrixTransform(inverse ? screen === null || screen ===
|
|
2645
|
+
var res = point.matrixTransform(inverse ? screen === null || screen === void 0 ? void 0 : screen.inverse() : screen);
|
|
2625
2646
|
if (inverse === false) {
|
|
2626
2647
|
var rect = node.getBoundingClientRect();
|
|
2627
2648
|
res.x -= rect.x;
|
|
@@ -2691,7 +2712,7 @@ function mergeObj(target) {
|
|
|
2691
2712
|
}
|
|
2692
2713
|
});
|
|
2693
2714
|
}
|
|
2694
|
-
return mergeObj.apply(
|
|
2715
|
+
return mergeObj.apply(void 0, __spreadArray([target], objectN, false));
|
|
2695
2716
|
}
|
|
2696
2717
|
/**
|
|
2697
2718
|
* Sort value
|
|
@@ -2701,7 +2722,7 @@ function mergeObj(target) {
|
|
|
2701
2722
|
* @private
|
|
2702
2723
|
*/
|
|
2703
2724
|
function sortValue(data, isAsc) {
|
|
2704
|
-
if (isAsc ===
|
|
2725
|
+
if (isAsc === void 0) { isAsc = true; }
|
|
2705
2726
|
var fn;
|
|
2706
2727
|
if (data[0] instanceof Date) {
|
|
2707
2728
|
fn = isAsc ? function (a, b) { return a - b; } : function (a, b) { return b - a; };
|
|
@@ -2747,7 +2768,7 @@ function getMinMax$1(type, data) {
|
|
|
2747
2768
|
* @private
|
|
2748
2769
|
*/
|
|
2749
2770
|
var getRange = function (start, end, step) {
|
|
2750
|
-
if (step ===
|
|
2771
|
+
if (step === void 0) { step = 1; }
|
|
2751
2772
|
var res = [];
|
|
2752
2773
|
var n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
2753
2774
|
for (var i = start; i < n; i++) {
|
|
@@ -2777,7 +2798,7 @@ var emulateEvent = {
|
|
|
2777
2798
|
catch (_a) {
|
|
2778
2799
|
// Polyfills DOM4 MouseEvent
|
|
2779
2800
|
return function (el, eventType, params) {
|
|
2780
|
-
if (params ===
|
|
2801
|
+
if (params === void 0) { params = getParams(); }
|
|
2781
2802
|
var mouseEvent = doc.createEvent("MouseEvent");
|
|
2782
2803
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
2783
2804
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
@@ -2836,7 +2857,7 @@ function parseDate(date) {
|
|
|
2836
2857
|
var _b = this, config = _b.config, format = _b.format;
|
|
2837
2858
|
// if fails to parse, try by new Date()
|
|
2838
2859
|
// https://github.com/naver/billboard.js/issues/1714
|
|
2839
|
-
parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) !== null && _a !==
|
|
2860
|
+
parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) !== null && _a !== void 0 ? _a : new Date(date);
|
|
2840
2861
|
}
|
|
2841
2862
|
else if (isNumber(date) && !isNaN(date)) {
|
|
2842
2863
|
parsedDate = new Date(+date);
|
|
@@ -2864,7 +2885,7 @@ function hasViewBox(svg) {
|
|
|
2864
2885
|
* @returns {boolean}
|
|
2865
2886
|
*/
|
|
2866
2887
|
function hasStyle(node, condition, all) {
|
|
2867
|
-
if (all ===
|
|
2888
|
+
if (all === void 0) { all = false; }
|
|
2868
2889
|
var isD3Node = !!node.node;
|
|
2869
2890
|
var has = false;
|
|
2870
2891
|
for (var _i = 0, _a = Object.entries(condition); _i < _a.length; _i++) {
|
|
@@ -2882,7 +2903,7 @@ function hasStyle(node, condition, all) {
|
|
|
2882
2903
|
* @private
|
|
2883
2904
|
*/
|
|
2884
2905
|
function isTabVisible() {
|
|
2885
|
-
return (doc === null || doc ===
|
|
2906
|
+
return (doc === null || doc === void 0 ? void 0 : doc.hidden) === false || (doc === null || doc === void 0 ? void 0 : doc.visibilityState) === "visible";
|
|
2886
2907
|
}
|
|
2887
2908
|
/**
|
|
2888
2909
|
* Get the current input type
|
|
@@ -2894,7 +2915,7 @@ function isTabVisible() {
|
|
|
2894
2915
|
function convertInputType(mouse, touch) {
|
|
2895
2916
|
var DocumentTouch = win.DocumentTouch, matchMedia = win.matchMedia, navigator = win.navigator;
|
|
2896
2917
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer#coarse
|
|
2897
|
-
var hasPointerCoarse = matchMedia === null || matchMedia ===
|
|
2918
|
+
var hasPointerCoarse = matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:coarse)").matches;
|
|
2898
2919
|
var hasTouch = false;
|
|
2899
2920
|
if (touch) {
|
|
2900
2921
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
@@ -2921,7 +2942,7 @@ function convertInputType(mouse, touch) {
|
|
|
2921
2942
|
}
|
|
2922
2943
|
// For non-touch device, media feature condition is: '(pointer:coarse) = false' and '(pointer:fine) = true'
|
|
2923
2944
|
// https://github.com/naver/billboard.js/issues/3854#issuecomment-2404183158
|
|
2924
|
-
var hasMouse = mouse && !hasPointerCoarse && (matchMedia === null || matchMedia ===
|
|
2945
|
+
var hasMouse = mouse && !hasPointerCoarse && (matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:fine)").matches);
|
|
2925
2946
|
// fallback to 'mouse' if no input type is detected.
|
|
2926
2947
|
return (hasMouse && "mouse") || (hasTouch && "touch") || "mouse";
|
|
2927
2948
|
}
|
|
@@ -3231,7 +3252,7 @@ var Cache = /** @class */ (function () {
|
|
|
3231
3252
|
* @private
|
|
3232
3253
|
*/
|
|
3233
3254
|
Cache.prototype.add = function (key, value, isDataType) {
|
|
3234
|
-
if (isDataType ===
|
|
3255
|
+
if (isDataType === void 0) { isDataType = false; }
|
|
3235
3256
|
this.cache[key] = isDataType ? this.cloneTarget(value) : value;
|
|
3236
3257
|
return this.cache[key];
|
|
3237
3258
|
};
|
|
@@ -3253,11 +3274,11 @@ var Cache = /** @class */ (function () {
|
|
|
3253
3274
|
* @private
|
|
3254
3275
|
*/
|
|
3255
3276
|
Cache.prototype.get = function (key, isDataType) {
|
|
3256
|
-
if (isDataType ===
|
|
3277
|
+
if (isDataType === void 0) { isDataType = false; }
|
|
3257
3278
|
// when is isDataType, key should be string array
|
|
3258
3279
|
if (isDataType && Array.isArray(key)) {
|
|
3259
3280
|
var targets = [];
|
|
3260
|
-
for (var i = 0, id =
|
|
3281
|
+
for (var i = 0, id = void 0; (id = key[i]); i++) {
|
|
3261
3282
|
if (id in this.cache) {
|
|
3262
3283
|
targets.push(this.cloneTarget(this.cache[id]));
|
|
3263
3284
|
}
|
|
@@ -3437,7 +3458,7 @@ function checkModuleImport(ctx) {
|
|
|
3437
3458
|
function logError(head, tail, info) {
|
|
3438
3459
|
var _a;
|
|
3439
3460
|
var prefix = "[billboard.js]";
|
|
3440
|
-
var hasConsole = (_a = win.console) === null || _a ===
|
|
3461
|
+
var hasConsole = (_a = win.console) === null || _a === void 0 ? void 0 : _a.error;
|
|
3441
3462
|
if (hasConsole) {
|
|
3442
3463
|
var tailMsg = ["background:red;color:white;display:block;font-size:15px", tail] ;
|
|
3443
3464
|
console.error.apply(console, __spreadArray(["\u274C ".concat(prefix, " ").concat(head), "background:red;color:white;display:block;font-size:15px"], tailMsg, false));
|
|
@@ -3497,8 +3518,8 @@ function generateWait() {
|
|
|
3497
3518
|
function loop() {
|
|
3498
3519
|
var _a;
|
|
3499
3520
|
var done = 0;
|
|
3500
|
-
for (var i = 0, t =
|
|
3501
|
-
if (t === true || ((_a = t.empty) === null || _a ===
|
|
3521
|
+
for (var i = 0, t = void 0; (t = transitionsToWait[i]); i++) {
|
|
3522
|
+
if (t === true || ((_a = t.empty) === null || _a === void 0 ? void 0 : _a.call(t))) {
|
|
3502
3523
|
done++;
|
|
3503
3524
|
continue;
|
|
3504
3525
|
}
|
|
@@ -3517,7 +3538,7 @@ function generateWait() {
|
|
|
3517
3538
|
return done === transitionsToWait.length;
|
|
3518
3539
|
}
|
|
3519
3540
|
runUntil(function () {
|
|
3520
|
-
callback === null || callback ===
|
|
3541
|
+
callback === null || callback === void 0 ? void 0 : callback();
|
|
3521
3542
|
}, loop);
|
|
3522
3543
|
};
|
|
3523
3544
|
f.add = function (t) {
|
|
@@ -3546,7 +3567,7 @@ function getObjectURL(fn, depsFn) {
|
|
|
3546
3567
|
if (!(key in blob)) {
|
|
3547
3568
|
// Web Worker body
|
|
3548
3569
|
blob[key] = new win.Blob([
|
|
3549
|
-
"".concat((_a = depsFn === null || depsFn ===
|
|
3570
|
+
"".concat((_a = depsFn === null || depsFn === void 0 ? void 0 : depsFn.map(String).join(";")) !== null && _a !== void 0 ? _a : "", "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (").concat(fnString, ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};")
|
|
3550
3571
|
], {
|
|
3551
3572
|
type: "text/javascript"
|
|
3552
3573
|
});
|
|
@@ -3592,13 +3613,13 @@ function getWorker(src) {
|
|
|
3592
3613
|
* @private
|
|
3593
3614
|
*/
|
|
3594
3615
|
function runWorker(useWorker, fn, callback, depsFn) {
|
|
3595
|
-
if (useWorker ===
|
|
3616
|
+
if (useWorker === void 0) { useWorker = true; }
|
|
3596
3617
|
var runFn = function () {
|
|
3597
3618
|
var args = [];
|
|
3598
3619
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3599
3620
|
args[_i] = arguments[_i];
|
|
3600
3621
|
}
|
|
3601
|
-
var res = fn.apply(
|
|
3622
|
+
var res = fn.apply(void 0, args);
|
|
3602
3623
|
callback(res);
|
|
3603
3624
|
};
|
|
3604
3625
|
if (win.Worker && useWorker) {
|
|
@@ -3730,7 +3751,7 @@ function json(json, keysParam) {
|
|
|
3730
3751
|
Object.keys(json).forEach(function (key) {
|
|
3731
3752
|
var _a;
|
|
3732
3753
|
var tmp = json[key].concat();
|
|
3733
|
-
(_a = tmp.unshift) === null || _a ===
|
|
3754
|
+
(_a = tmp.unshift) === null || _a === void 0 ? void 0 : _a.call(tmp, key);
|
|
3734
3755
|
newRows.push(tmp);
|
|
3735
3756
|
});
|
|
3736
3757
|
data = columns(newRows);
|
|
@@ -3748,7 +3769,7 @@ function json(json, keysParam) {
|
|
|
3748
3769
|
* @private
|
|
3749
3770
|
*/
|
|
3750
3771
|
function url(url, mimeType, headers, keys, done) {
|
|
3751
|
-
if (mimeType ===
|
|
3772
|
+
if (mimeType === void 0) { mimeType = "csv"; }
|
|
3752
3773
|
var req = new XMLHttpRequest();
|
|
3753
3774
|
var converter = { csv: csv, tsv: tsv, json: json };
|
|
3754
3775
|
req.open("GET", url);
|
|
@@ -3816,8 +3837,8 @@ function tsv(tsv) {
|
|
|
3816
3837
|
* @private
|
|
3817
3838
|
*/
|
|
3818
3839
|
function getDataKeyForJson(keysParam, config) {
|
|
3819
|
-
var keys = keysParam || (config === null || config ===
|
|
3820
|
-
if (keys === null || keys ===
|
|
3840
|
+
var keys = keysParam || (config === null || config === void 0 ? void 0 : config.data_keys);
|
|
3841
|
+
if (keys === null || keys === void 0 ? void 0 : keys.x) {
|
|
3821
3842
|
config.data_x = keys.x;
|
|
3822
3843
|
}
|
|
3823
3844
|
return keys;
|
|
@@ -3975,7 +3996,7 @@ var dataConvert = {
|
|
|
3975
3996
|
// indexing each value
|
|
3976
3997
|
t.values.forEach(function (v, i) { return (v.index = i); });
|
|
3977
3998
|
// this needs to be sorted because its index and value.index is identical
|
|
3978
|
-
(_a = $$.data.xs[t.id]) === null || _a ===
|
|
3999
|
+
(_a = $$.data.xs[t.id]) === null || _a === void 0 ? void 0 : _a.sort(function (v1, v2) { return v1 - v2; });
|
|
3979
4000
|
});
|
|
3980
4001
|
// cache information about values
|
|
3981
4002
|
state.hasNegativeValue = $$.hasNegativeValueInTargets(targets);
|
|
@@ -4102,7 +4123,7 @@ var data$1 = {
|
|
|
4102
4123
|
* @private
|
|
4103
4124
|
*/
|
|
4104
4125
|
getAllValuesOnIndex: function (index, filterNull) {
|
|
4105
|
-
if (filterNull ===
|
|
4126
|
+
if (filterNull === void 0) { filterNull = false; }
|
|
4106
4127
|
var $$ = this;
|
|
4107
4128
|
var value = $$.filterTargetsToShow($$.data.targets)
|
|
4108
4129
|
.map(function (t) { return $$.addName($$.getValueOnIndex(t.values, index)); });
|
|
@@ -4133,12 +4154,12 @@ var data$1 = {
|
|
|
4133
4154
|
generateTargetX: function (rawX, id, index) {
|
|
4134
4155
|
var $$ = this;
|
|
4135
4156
|
var axis = $$.axis;
|
|
4136
|
-
var x = (axis === null || axis ===
|
|
4137
|
-
if (axis === null || axis ===
|
|
4157
|
+
var x = (axis === null || axis === void 0 ? void 0 : axis.isCategorized()) ? index : (rawX || index);
|
|
4158
|
+
if (axis === null || axis === void 0 ? void 0 : axis.isTimeSeries()) {
|
|
4138
4159
|
var fn = parseDate.bind($$);
|
|
4139
4160
|
x = rawX ? fn(rawX) : fn($$.getXValue(id, index));
|
|
4140
4161
|
}
|
|
4141
|
-
else if ((axis === null || axis ===
|
|
4162
|
+
else if ((axis === null || axis === void 0 ? void 0 : axis.isCustomX()) && !(axis === null || axis === void 0 ? void 0 : axis.isCategorized())) {
|
|
4142
4163
|
x = isValue(rawX) ? +rawX : $$.getXValue(id, index);
|
|
4143
4164
|
}
|
|
4144
4165
|
return x;
|
|
@@ -4330,7 +4351,7 @@ var data$1 = {
|
|
|
4330
4351
|
},
|
|
4331
4352
|
hasTarget: function (targets, id) {
|
|
4332
4353
|
var ids = this.mapToIds(targets);
|
|
4333
|
-
for (var i = 0, val =
|
|
4354
|
+
for (var i = 0, val = void 0; (val = ids[i]); i++) {
|
|
4334
4355
|
if (val === id) {
|
|
4335
4356
|
return true;
|
|
4336
4357
|
}
|
|
@@ -4351,9 +4372,9 @@ var data$1 = {
|
|
|
4351
4372
|
var $$ = this;
|
|
4352
4373
|
var axis = $$.axis;
|
|
4353
4374
|
var xs = [];
|
|
4354
|
-
if (targets === null || targets ===
|
|
4375
|
+
if (targets === null || targets === void 0 ? void 0 : targets.length) {
|
|
4355
4376
|
xs = getUnique(mergeArray(targets.map(function (t) { return t.values.map(function (v) { return +v.x; }); })));
|
|
4356
|
-
xs = (axis === null || axis ===
|
|
4377
|
+
xs = (axis === null || axis === void 0 ? void 0 : axis.isTimeSeries()) ? xs.map(function (x) { return new Date(+x); }) : xs.map(Number);
|
|
4357
4378
|
}
|
|
4358
4379
|
return sortValue(xs);
|
|
4359
4380
|
},
|
|
@@ -4486,7 +4507,7 @@ var data$1 = {
|
|
|
4486
4507
|
* @private
|
|
4487
4508
|
*/
|
|
4488
4509
|
getSortCompareFn: function (isReversed) {
|
|
4489
|
-
if (isReversed ===
|
|
4510
|
+
if (isReversed === void 0) { isReversed = false; }
|
|
4490
4511
|
var $$ = this;
|
|
4491
4512
|
var config = $$.config;
|
|
4492
4513
|
var order = config.data_order;
|
|
@@ -4570,7 +4591,7 @@ var data$1 = {
|
|
|
4570
4591
|
if (hasViewBox($el.svg)) {
|
|
4571
4592
|
var pos = [point, 0];
|
|
4572
4593
|
isRotated && pos.reverse();
|
|
4573
|
-
point = getTransformCTM.apply(
|
|
4594
|
+
point = getTransformCTM.apply(void 0, __spreadArray([$el.eventRect.node()], pos, false))[isRotated ? "y" : "x"];
|
|
4574
4595
|
}
|
|
4575
4596
|
else {
|
|
4576
4597
|
point -= isRotated ? rect.top : rect.left;
|
|
@@ -4731,9 +4752,9 @@ var data$1 = {
|
|
|
4731
4752
|
return current;
|
|
4732
4753
|
},
|
|
4733
4754
|
getRangedData: function (d, key, type) {
|
|
4734
|
-
if (key ===
|
|
4735
|
-
if (type ===
|
|
4736
|
-
var value = d === null || d ===
|
|
4755
|
+
if (key === void 0) { key = ""; }
|
|
4756
|
+
if (type === void 0) { type = "areaRange"; }
|
|
4757
|
+
var value = d === null || d === void 0 ? void 0 : d.value;
|
|
4737
4758
|
if (isArray(value)) {
|
|
4738
4759
|
if (type === "bar") {
|
|
4739
4760
|
return value.reduce(function (a, c) { return c - a; });
|
|
@@ -4777,7 +4798,7 @@ var data$1 = {
|
|
|
4777
4798
|
* @private
|
|
4778
4799
|
*/
|
|
4779
4800
|
getRatio: function (type, d, asPercent) {
|
|
4780
|
-
if (asPercent ===
|
|
4801
|
+
if (asPercent === void 0) { asPercent = false; }
|
|
4781
4802
|
var $$ = this;
|
|
4782
4803
|
var config = $$.config, state = $$.state;
|
|
4783
4804
|
var api = $$.api;
|
|
@@ -4883,7 +4904,7 @@ var data$1 = {
|
|
|
4883
4904
|
getDataById: function (id) {
|
|
4884
4905
|
var _a;
|
|
4885
4906
|
var d = this.cache.get(id) || this.api.data(id);
|
|
4886
|
-
return (_a = d === null || d ===
|
|
4907
|
+
return (_a = d === null || d === void 0 ? void 0 : d[0]) !== null && _a !== void 0 ? _a : d;
|
|
4887
4908
|
}
|
|
4888
4909
|
};
|
|
4889
4910
|
|
|
@@ -4898,11 +4919,11 @@ var data$1 = {
|
|
|
4898
4919
|
* @private
|
|
4899
4920
|
*/
|
|
4900
4921
|
function callDone(fn, resizeAfter) {
|
|
4901
|
-
if (resizeAfter ===
|
|
4922
|
+
if (resizeAfter === void 0) { resizeAfter = false; }
|
|
4902
4923
|
var $$ = this;
|
|
4903
4924
|
var api = $$.api;
|
|
4904
4925
|
resizeAfter && $$.api.flush(true);
|
|
4905
|
-
fn === null || fn ===
|
|
4926
|
+
fn === null || fn === void 0 ? void 0 : fn.call(api);
|
|
4906
4927
|
}
|
|
4907
4928
|
var dataLoad = {
|
|
4908
4929
|
load: function (rawTargets, args) {
|
|
@@ -4924,7 +4945,7 @@ var dataLoad = {
|
|
|
4924
4945
|
if (args.type || args.types) {
|
|
4925
4946
|
targets.forEach(function (t) {
|
|
4926
4947
|
var _a;
|
|
4927
|
-
var type = ((_a = args.types) === null || _a ===
|
|
4948
|
+
var type = ((_a = args.types) === null || _a === void 0 ? void 0 : _a[t.id]) || args.type;
|
|
4928
4949
|
$$.setTargetType(t.id, type);
|
|
4929
4950
|
});
|
|
4930
4951
|
}
|
|
@@ -5000,7 +5021,7 @@ var dataLoad = {
|
|
|
5000
5021
|
var _a;
|
|
5001
5022
|
var $$ = this;
|
|
5002
5023
|
var state = $$.state, $el = $$.$el, $T = $$.$T;
|
|
5003
|
-
var hasLegendDefsPoint = !!((_a = $$.hasLegendDefsPoint) === null || _a ===
|
|
5024
|
+
var hasLegendDefsPoint = !!((_a = $$.hasLegendDefsPoint) === null || _a === void 0 ? void 0 : _a.call($$));
|
|
5004
5025
|
var done = customDoneCb;
|
|
5005
5026
|
var targetIds = rawTargetIds;
|
|
5006
5027
|
// reset internally cached data
|
|
@@ -5032,7 +5053,7 @@ var dataLoad = {
|
|
|
5032
5053
|
// Remove target
|
|
5033
5054
|
$$.data.targets = $$.data.targets.filter(function (t) { return t.id !== id; });
|
|
5034
5055
|
// Remove custom point def element
|
|
5035
|
-
hasLegendDefsPoint && ((_a = $el.defs) === null || _a ===
|
|
5056
|
+
hasLegendDefsPoint && ((_a = $el.defs) === null || _a === void 0 ? void 0 : _a.select("#".concat($$.getDefsPointId(suffixId))).remove());
|
|
5036
5057
|
});
|
|
5037
5058
|
// since treemap uses different data types, it needs to be transformed
|
|
5038
5059
|
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
@@ -5072,7 +5093,7 @@ var interaction = {
|
|
|
5072
5093
|
* @private
|
|
5073
5094
|
*/
|
|
5074
5095
|
expandBarTypeShapes: function (expand, i, id, reset) {
|
|
5075
|
-
if (expand ===
|
|
5096
|
+
if (expand === void 0) { expand = true; }
|
|
5076
5097
|
var $$ = this;
|
|
5077
5098
|
["bar", "candlestick"]
|
|
5078
5099
|
.filter(function (v) { return $$.$el[v]; })
|
|
@@ -5189,15 +5210,15 @@ var interaction = {
|
|
|
5189
5210
|
* @param {Array} mouse x and y coordinate value
|
|
5190
5211
|
*/
|
|
5191
5212
|
dispatchEvent: function (type, index, mouse) {
|
|
5192
|
-
var _a, _b;
|
|
5213
|
+
var _a, _b, _c;
|
|
5193
5214
|
var $$ = this;
|
|
5194
|
-
var config = $$.config,
|
|
5195
|
-
var element = (_b = (((hasFunnel || hasTreemap) && eventReceiver.rect) ||
|
|
5196
|
-
(hasRadar && radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text"))) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) === null || _a ===
|
|
5215
|
+
var config = $$.config, _d = $$.state, eventReceiver = _d.eventReceiver, hasAxis = _d.hasAxis, hasFunnel = _d.hasFunnel, hasRadar = _d.hasRadar, hasTreemap = _d.hasTreemap, _e = $$.$el, eventRect = _e.eventRect, funnel = _e.funnel, radar = _e.radar, svg = _e.svg, treemap = _e.treemap;
|
|
5216
|
+
var element = (_c = (_b = (((hasFunnel || hasTreemap) && eventReceiver.rect) ||
|
|
5217
|
+
(hasRadar && radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text"))) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) === null || _a === void 0 ? void 0 : _a.call($$, index))))) === null || _b === void 0 ? void 0 : _b.node) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5197
5218
|
if (element) {
|
|
5198
5219
|
var isMultipleX = $$.isMultipleX();
|
|
5199
5220
|
var isRotated = config.axis_rotated;
|
|
5200
|
-
var
|
|
5221
|
+
var _f = element.getBoundingClientRect(), width = _f.width, left = _f.left, top_1 = _f.top;
|
|
5201
5222
|
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
5202
5223
|
var coords = eventReceiver.coords[index];
|
|
5203
5224
|
if (coords) {
|
|
@@ -5228,7 +5249,7 @@ var interaction = {
|
|
|
5228
5249
|
};
|
|
5229
5250
|
// for funnel and treemap event bound to <g> node
|
|
5230
5251
|
if (hasFunnel || hasTreemap) {
|
|
5231
|
-
element = (funnel !== null && funnel !==
|
|
5252
|
+
element = (funnel !== null && funnel !== void 0 ? funnel : treemap).node();
|
|
5232
5253
|
}
|
|
5233
5254
|
emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](element, type, params);
|
|
5234
5255
|
}
|
|
@@ -5243,8 +5264,8 @@ var interaction = {
|
|
|
5243
5264
|
unbindZoomEvent: function () {
|
|
5244
5265
|
var $$ = this;
|
|
5245
5266
|
var _a = $$.$el, eventRect = _a.eventRect, zoomResetBtn = _a.zoomResetBtn;
|
|
5246
|
-
eventRect === null || eventRect ===
|
|
5247
|
-
zoomResetBtn === null || zoomResetBtn ===
|
|
5267
|
+
eventRect === null || eventRect === void 0 ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
|
5268
|
+
zoomResetBtn === null || zoomResetBtn === void 0 ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
|
5248
5269
|
},
|
|
5249
5270
|
/**
|
|
5250
5271
|
* Unbind all attached events
|
|
@@ -5276,14 +5297,14 @@ var interaction = {
|
|
|
5276
5297
|
[
|
|
5277
5298
|
svg,
|
|
5278
5299
|
eventRect,
|
|
5279
|
-
region === null || region ===
|
|
5280
|
-
brush === null || brush ===
|
|
5281
|
-
arcs === null || arcs ===
|
|
5282
|
-
legend === null || legend ===
|
|
5300
|
+
region === null || region === void 0 ? void 0 : region.list,
|
|
5301
|
+
brush === null || brush === void 0 ? void 0 : brush.getSelection(),
|
|
5302
|
+
arcs === null || arcs === void 0 ? void 0 : arcs.selectAll("path"),
|
|
5303
|
+
legend === null || legend === void 0 ? void 0 : legend.selectAll("g"),
|
|
5283
5304
|
treemap
|
|
5284
5305
|
]
|
|
5285
|
-
.forEach(function (v) { return v === null || v ===
|
|
5286
|
-
(_a = $$.unbindZoomEvent) === null || _a ===
|
|
5306
|
+
.forEach(function (v) { return v === null || v === void 0 ? void 0 : v.on(list, null); });
|
|
5307
|
+
(_a = $$.unbindZoomEvent) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
5287
5308
|
}
|
|
5288
5309
|
};
|
|
5289
5310
|
|
|
@@ -5301,7 +5322,7 @@ var category = {
|
|
|
5301
5322
|
categoryName: function (i) {
|
|
5302
5323
|
var _a;
|
|
5303
5324
|
var axis_x_categories = this.config.axis_x_categories;
|
|
5304
|
-
return (_a = axis_x_categories === null || axis_x_categories ===
|
|
5325
|
+
return (_a = axis_x_categories === null || axis_x_categories === void 0 ? void 0 : axis_x_categories[i]) !== null && _a !== void 0 ? _a : i;
|
|
5305
5326
|
}
|
|
5306
5327
|
};
|
|
5307
5328
|
|
|
@@ -5347,7 +5368,7 @@ var classModule = {
|
|
|
5347
5368
|
var ids = [];
|
|
5348
5369
|
return function (d) {
|
|
5349
5370
|
var _a;
|
|
5350
|
-
var id = d.id || ((_a = d.data) === null || _a ===
|
|
5371
|
+
var id = d.id || ((_a = d.data) === null || _a === void 0 ? void 0 : _a.id) || d;
|
|
5351
5372
|
if (ids.indexOf(id) < 0) {
|
|
5352
5373
|
ids.push(id);
|
|
5353
5374
|
}
|
|
@@ -5381,8 +5402,8 @@ var classModule = {
|
|
|
5381
5402
|
.replace(/[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, "-"); // eslint-disable-line no-control-regex
|
|
5382
5403
|
},
|
|
5383
5404
|
selectorTarget: function (id, prefix, postfix) {
|
|
5384
|
-
if (prefix ===
|
|
5385
|
-
if (postfix ===
|
|
5405
|
+
if (prefix === void 0) { prefix = ""; }
|
|
5406
|
+
if (postfix === void 0) { postfix = ""; }
|
|
5386
5407
|
var target = this.getTargetSelectorSuffix(id);
|
|
5387
5408
|
// select target & circle
|
|
5388
5409
|
return "".concat(prefix, ".").concat(CLASS.target + target, " ").concat(postfix, ", ").concat(prefix, ".").concat(CLASS.circles + target, " ").concat(postfix);
|
|
@@ -5397,7 +5418,7 @@ var classModule = {
|
|
|
5397
5418
|
},
|
|
5398
5419
|
selectorLegends: function (ids) {
|
|
5399
5420
|
var _this = this;
|
|
5400
|
-
return (ids === null || ids ===
|
|
5421
|
+
return (ids === null || ids === void 0 ? void 0 : ids.length) ? ids.map(function (id) { return _this.selectorLegend(id); }) : null;
|
|
5401
5422
|
}
|
|
5402
5423
|
};
|
|
5403
5424
|
|
|
@@ -5494,7 +5515,7 @@ var color = {
|
|
|
5494
5515
|
return function (d) {
|
|
5495
5516
|
var _a;
|
|
5496
5517
|
var id = d.id ||
|
|
5497
|
-
((_a = d.data) === null || _a ===
|
|
5518
|
+
((_a = d.data) === null || _a === void 0 ? void 0 : _a.id) ||
|
|
5498
5519
|
d;
|
|
5499
5520
|
var isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id];
|
|
5500
5521
|
var color;
|
|
@@ -5551,7 +5572,7 @@ var color = {
|
|
|
5551
5572
|
* @private
|
|
5552
5573
|
*/
|
|
5553
5574
|
generateTextBGColorFilter: function (color, attr) {
|
|
5554
|
-
if (attr ===
|
|
5575
|
+
if (attr === void 0) { attr = {
|
|
5555
5576
|
x: 0,
|
|
5556
5577
|
y: 0,
|
|
5557
5578
|
width: 1,
|
|
@@ -5608,7 +5629,7 @@ var color = {
|
|
|
5608
5629
|
stops: []
|
|
5609
5630
|
};
|
|
5610
5631
|
if (radialGradient) {
|
|
5611
|
-
var _a = radialGradient.cx, cx = _a ===
|
|
5632
|
+
var _a = radialGradient.cx, cx = _a === void 0 ? 0.3 : _a, _b = radialGradient.cy, cy = _b === void 0 ? 0.3 : _b, _c = radialGradient.r, r = _c === void 0 ? 0.7 : _c, _d = radialGradient.stops, stops = _d === void 0 ? [[0.1, color_1, 0], [0.9, color_1, 1]] : _d;
|
|
5612
5633
|
gradient_1.stops = stops;
|
|
5613
5634
|
gradient_1.defs = defs.append("radialGradient")
|
|
5614
5635
|
.attr("id", "".concat(id))
|
|
@@ -5618,7 +5639,7 @@ var color = {
|
|
|
5618
5639
|
}
|
|
5619
5640
|
else {
|
|
5620
5641
|
var isRotated = config.axis_rotated;
|
|
5621
|
-
var _e = config["".concat(supportedType, "_linearGradient")], _f = _e.x, x = _f ===
|
|
5642
|
+
var _e = config["".concat(supportedType, "_linearGradient")], _f = _e.x, x = _f === void 0 ? isRotated ? [1, 0] : [0, 0] : _f, _g = _e.y, y = _g === void 0 ? isRotated ? [0, 0] : [0, 1] : _g, _h = _e.stops, stops = _h === void 0 ? [[0, color_1, 1], [1, color_1, 0]] : _h;
|
|
5622
5643
|
gradient_1.stops = stops;
|
|
5623
5644
|
gradient_1.defs = defs.append("linearGradient")
|
|
5624
5645
|
.attr("id", "".concat(id))
|
|
@@ -5730,7 +5751,7 @@ var domain = {
|
|
|
5730
5751
|
if ($$.isStackNormalized()) {
|
|
5731
5752
|
return [0, 100];
|
|
5732
5753
|
}
|
|
5733
|
-
var isLog = (scale === null || scale ===
|
|
5754
|
+
var isLog = (scale === null || scale === void 0 ? void 0 : scale[axisId]) && scale[axisId].type === "log";
|
|
5734
5755
|
var targetsByAxisId = targets.filter(function (t) { return axis.getId(t.id) === axisId; });
|
|
5735
5756
|
var yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId;
|
|
5736
5757
|
if (yTargets.length === 0) { // use domain of the other axis if target of axisId is none
|
|
@@ -5830,7 +5851,7 @@ var domain = {
|
|
|
5830
5851
|
var configValue = $$.config["axis_x_".concat(type)];
|
|
5831
5852
|
var dataValue = getMinMax$1(type, targets.map(function (t) { return getMinMax$1(type, t.values.map(function (v) { return v.x; })); }));
|
|
5832
5853
|
var value = isObject(configValue) ? configValue.value : configValue;
|
|
5833
|
-
value = isDefined(value) && ((_a = $$.axis) === null || _a ===
|
|
5854
|
+
value = isDefined(value) && ((_a = $$.axis) === null || _a === void 0 ? void 0 : _a.isTimeSeries()) ? parseDate.bind(this)(value) : value;
|
|
5834
5855
|
if (isObject(configValue) && configValue.fit && ((type === "min" && value < dataValue) || (type === "max" && value > dataValue))) {
|
|
5835
5856
|
value = undefined;
|
|
5836
5857
|
}
|
|
@@ -5863,7 +5884,7 @@ var domain = {
|
|
|
5863
5884
|
}
|
|
5864
5885
|
var _a = isNumber(padding) ?
|
|
5865
5886
|
{ left: padding, right: padding } :
|
|
5866
|
-
padding, _b = _a.left, left = _b ===
|
|
5887
|
+
padding, _b = _a.left, left = _b === void 0 ? defaultValue : _b, _c = _a.right, right = _c === void 0 ? defaultValue : _c;
|
|
5867
5888
|
// when the unit is pixel, convert pixels to axis scale value
|
|
5868
5889
|
if (padding.unit === "px") {
|
|
5869
5890
|
var domainLength = Math.abs(diff + (diff * 0.2));
|
|
@@ -5894,7 +5915,7 @@ var domain = {
|
|
|
5894
5915
|
$$.getXDomainMinMax(targets, "min"),
|
|
5895
5916
|
$$.getXDomainMinMax(targets, "max")
|
|
5896
5917
|
];
|
|
5897
|
-
var _a = domain[0], min = _a ===
|
|
5918
|
+
var _a = domain[0], min = _a === void 0 ? 0 : _a, _b = domain[1], max = _b === void 0 ? 0 : _b;
|
|
5898
5919
|
if (x.type !== "log") {
|
|
5899
5920
|
var isCategorized = axis.isCategorized();
|
|
5900
5921
|
var isTimeSeries = axis.isTimeSeries();
|
|
@@ -5934,7 +5955,7 @@ var domain = {
|
|
|
5934
5955
|
org.xDomain = x.domain();
|
|
5935
5956
|
// zoomEnabled && $$.zoom.updateScaleExtent();
|
|
5936
5957
|
subX.domain(x.domain());
|
|
5937
|
-
(_a = $$.brush) === null || _a ===
|
|
5958
|
+
(_a = $$.brush) === null || _a === void 0 ? void 0 : _a.scale(subX);
|
|
5938
5959
|
}
|
|
5939
5960
|
if (withUpdateXDomain) {
|
|
5940
5961
|
var domainValue = domain || (!$$.brush || brushEmpty($$)) ?
|
|
@@ -5979,8 +6000,8 @@ var domain = {
|
|
|
5979
6000
|
* @private
|
|
5980
6001
|
*/
|
|
5981
6002
|
getZoomDomain: function (type, getCurrent) {
|
|
5982
|
-
if (type ===
|
|
5983
|
-
if (getCurrent ===
|
|
6003
|
+
if (type === void 0) { type = "zoom"; }
|
|
6004
|
+
if (getCurrent === void 0) { getCurrent = false; }
|
|
5984
6005
|
var $$ = this;
|
|
5985
6006
|
var config = $$.config, scale = $$.scale, org = $$.org;
|
|
5986
6007
|
var _a = getCurrent && scale[type] ? scale[type].domain() : org.xDomain, min = _a[0], max = _a[1];
|
|
@@ -6044,7 +6065,7 @@ var domain = {
|
|
|
6044
6065
|
* @private
|
|
6045
6066
|
*/
|
|
6046
6067
|
withinRange: function (domain, current, range) {
|
|
6047
|
-
if (current ===
|
|
6068
|
+
if (current === void 0) { current = [0, 0]; }
|
|
6048
6069
|
var $$ = this;
|
|
6049
6070
|
var isInverted = $$.config.axis_x_inverted;
|
|
6050
6071
|
var _a = range, min = _a[0], max = _a[1];
|
|
@@ -6164,9 +6185,9 @@ function getLegendColor(id) {
|
|
|
6164
6185
|
*/
|
|
6165
6186
|
function getFormattedText(id, formatted) {
|
|
6166
6187
|
var _a;
|
|
6167
|
-
if (formatted ===
|
|
6188
|
+
if (formatted === void 0) { formatted = true; }
|
|
6168
6189
|
var config = this.config;
|
|
6169
|
-
var text = (_a = config.data_names[id]) !== null && _a !==
|
|
6190
|
+
var text = (_a = config.data_names[id]) !== null && _a !== void 0 ? _a : id;
|
|
6170
6191
|
if (formatted && isFunction(config.legend_format)) {
|
|
6171
6192
|
text = config.legend_format(text, id !== text ? id : undefined);
|
|
6172
6193
|
}
|
|
@@ -6221,7 +6242,7 @@ var legend$1 = {
|
|
|
6221
6242
|
$$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
|
6222
6243
|
}
|
|
6223
6244
|
// toggle legend state
|
|
6224
|
-
(_a = $el.legend) === null || _a ===
|
|
6245
|
+
(_a = $el.legend) === null || _a === void 0 ? void 0 : _a.selectAll(".".concat($LEGEND.legendItem)).classed($LEGEND.legendItemHidden, function (id) {
|
|
6225
6246
|
var hide = !$$.isTargetToShow(id);
|
|
6226
6247
|
if (hide) {
|
|
6227
6248
|
this.style.opacity = null;
|
|
@@ -6372,7 +6393,7 @@ var legend$1 = {
|
|
|
6372
6393
|
var _a;
|
|
6373
6394
|
var $$ = this;
|
|
6374
6395
|
var _b = $$.state, current = _b.current, isLegendRight = _b.isLegendRight, legendItemHeight = _b.legendItemHeight, legendStep = _b.legendStep;
|
|
6375
|
-
var isFitPadding = ((_a = $$.config.padding) === null || _a ===
|
|
6396
|
+
var isFitPadding = ((_a = $$.config.padding) === null || _a === void 0 ? void 0 : _a.mode) === "fit";
|
|
6376
6397
|
var height = $$.config.legend_show ?
|
|
6377
6398
|
(isLegendRight ? current.height : (Math.max(isFitPadding ? 10 : 20, legendItemHeight)) * (legendStep + 1)) :
|
|
6378
6399
|
0;
|
|
@@ -6916,7 +6937,7 @@ var legend$1 = {
|
|
|
6916
6937
|
var redraw = {
|
|
6917
6938
|
redraw: function (options) {
|
|
6918
6939
|
var _a, _b, _c, _d;
|
|
6919
|
-
if (options ===
|
|
6940
|
+
if (options === void 0) { options = {}; }
|
|
6920
6941
|
var $$ = this;
|
|
6921
6942
|
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
6922
6943
|
var main = $el.main, treemap = $el.treemap;
|
|
@@ -6927,7 +6948,7 @@ var redraw = {
|
|
|
6927
6948
|
var duration = wth.Transition ? config.transition_duration : 0;
|
|
6928
6949
|
var durationForExit = wth.TransitionForExit ? duration : 0;
|
|
6929
6950
|
var durationForAxis = wth.TransitionForAxis ? duration : 0;
|
|
6930
|
-
var transitions = (_a = $$.axis) === null || _a ===
|
|
6951
|
+
var transitions = (_a = $$.axis) === null || _a === void 0 ? void 0 : _a.generateTransitions(durationForAxis);
|
|
6931
6952
|
$$.updateSizes(initializing);
|
|
6932
6953
|
// update legend and transform each g
|
|
6933
6954
|
if (wth.Legend && config.legend_show) {
|
|
@@ -6967,7 +6988,7 @@ var redraw = {
|
|
|
6967
6988
|
// event rects will redrawn when flow called
|
|
6968
6989
|
if (config.interaction_enabled && !flow && wth.EventRect) {
|
|
6969
6990
|
$$.redrawEventRect();
|
|
6970
|
-
(_b = $$.bindZoomEvent) === null || _b ===
|
|
6991
|
+
(_b = $$.bindZoomEvent) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
6971
6992
|
}
|
|
6972
6993
|
}
|
|
6973
6994
|
else {
|
|
@@ -6985,13 +7006,13 @@ var redraw = {
|
|
|
6985
7006
|
if (!state.resizing && !treemap && ($$.hasPointType() || state.hasRadar)) {
|
|
6986
7007
|
$$.updateCircle();
|
|
6987
7008
|
}
|
|
6988
|
-
else if ((_c = $$.hasLegendDefsPoint) === null || _c ===
|
|
7009
|
+
else if ((_c = $$.hasLegendDefsPoint) === null || _c === void 0 ? void 0 : _c.call($$)) {
|
|
6989
7010
|
$$.data.targets.forEach($$.point("create", this));
|
|
6990
7011
|
}
|
|
6991
7012
|
// text
|
|
6992
7013
|
$$.hasDataLabel() && !$$.hasArcType(null, ["radar"]) && $$.updateText();
|
|
6993
7014
|
// title
|
|
6994
|
-
(_d = $$.redrawTitle) === null || _d ===
|
|
7015
|
+
(_d = $$.redrawTitle) === null || _d === void 0 ? void 0 : _d.call($$);
|
|
6995
7016
|
initializing && $$.updateTypesElements();
|
|
6996
7017
|
$$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart);
|
|
6997
7018
|
$$.updateTooltipOnRedraw();
|
|
@@ -7030,7 +7051,7 @@ var redraw = {
|
|
|
7030
7051
|
state.redrawing = false;
|
|
7031
7052
|
callFn(config.onrendered, $$.api);
|
|
7032
7053
|
};
|
|
7033
|
-
{
|
|
7054
|
+
if (afterRedraw) {
|
|
7034
7055
|
// Only use transition when current tab is visible.
|
|
7035
7056
|
if (withTransition && redrawList.length) {
|
|
7036
7057
|
// Wait for end of transitions for callback
|
|
@@ -7087,7 +7108,7 @@ var redraw = {
|
|
|
7087
7108
|
return list;
|
|
7088
7109
|
},
|
|
7089
7110
|
updateAndRedraw: function (options) {
|
|
7090
|
-
if (options ===
|
|
7111
|
+
if (options === void 0) { options = {}; }
|
|
7091
7112
|
var $$ = this;
|
|
7092
7113
|
var config = $$.config, state = $$.state;
|
|
7093
7114
|
var transitions;
|
|
@@ -7129,7 +7150,7 @@ var redraw = {
|
|
|
7129
7150
|
* @private
|
|
7130
7151
|
*/
|
|
7131
7152
|
function getScale(type, min, max) {
|
|
7132
|
-
if (type ===
|
|
7153
|
+
if (type === void 0) { type = "linear"; }
|
|
7133
7154
|
var scale = ({
|
|
7134
7155
|
linear: scaleLinear,
|
|
7135
7156
|
log: scaleSymlog,
|
|
@@ -7139,7 +7160,7 @@ function getScale(type, min, max) {
|
|
|
7139
7160
|
})[type]();
|
|
7140
7161
|
scale.type = type;
|
|
7141
7162
|
/_?log/.test(type) && scale.clamp(true);
|
|
7142
|
-
return scale.range([min !== null && min !==
|
|
7163
|
+
return scale.range([min !== null && min !== void 0 ? min : 0, max !== null && max !== void 0 ? max : 1]);
|
|
7143
7164
|
}
|
|
7144
7165
|
var scale = {
|
|
7145
7166
|
/**
|
|
@@ -7181,8 +7202,8 @@ var scale = {
|
|
|
7181
7202
|
*/
|
|
7182
7203
|
getYScaleById: function (id, isSub) {
|
|
7183
7204
|
var _a;
|
|
7184
|
-
if (isSub ===
|
|
7185
|
-
var isY2 = ((_a = this.axis) === null || _a ===
|
|
7205
|
+
if (isSub === void 0) { isSub = false; }
|
|
7206
|
+
var isY2 = ((_a = this.axis) === null || _a === void 0 ? void 0 : _a.getId(id)) === "y2";
|
|
7186
7207
|
var key = isSub ? (isY2 ? "subY2" : "subY") : (isY2 ? "y2" : "y");
|
|
7187
7208
|
return this.scale[key];
|
|
7188
7209
|
},
|
|
@@ -7234,7 +7255,7 @@ var scale = {
|
|
|
7234
7255
|
*/
|
|
7235
7256
|
updateScales: function (isInit, updateXDomain) {
|
|
7236
7257
|
var _a, _b;
|
|
7237
|
-
if (updateXDomain ===
|
|
7258
|
+
if (updateXDomain === void 0) { updateXDomain = true; }
|
|
7238
7259
|
var $$ = this;
|
|
7239
7260
|
var axis = $$.axis, config = $$.config, format = $$.format, org = $$.org, scale = $$.scale, _c = $$.state, current = _c.current, width = _c.width, height = _c.height, width2 = _c.width2, height2 = _c.height2, hasAxis = _c.hasAxis, hasTreemap = _c.hasTreemap;
|
|
7240
7261
|
if (hasAxis) {
|
|
@@ -7255,12 +7276,12 @@ var scale = {
|
|
|
7255
7276
|
};
|
|
7256
7277
|
// update scales
|
|
7257
7278
|
// x Axis
|
|
7258
|
-
var xDomain = updateXDomain && ((_a = scale.x) === null || _a ===
|
|
7279
|
+
var xDomain = updateXDomain && ((_a = scale.x) === null || _a === void 0 ? void 0 : _a.orgDomain());
|
|
7259
7280
|
var xSubDomain = updateXDomain && org.xDomain;
|
|
7260
7281
|
scale.x = $$.getXScale(min.x, max.x, xDomain, function () { return axis.x.tickOffset(); });
|
|
7261
7282
|
scale.subX = $$.getXScale(min.x, max.x, xSubDomain, function (d) {
|
|
7262
7283
|
var _a;
|
|
7263
|
-
return (d % 1 ? 0 : ((_a = axis.subX) !== null && _a !==
|
|
7284
|
+
return (d % 1 ? 0 : ((_a = axis.subX) !== null && _a !== void 0 ? _a : axis.x).tickOffset());
|
|
7264
7285
|
});
|
|
7265
7286
|
format.xAxisTick = axis.getXAxisTickFormat();
|
|
7266
7287
|
format.subXAxisTick = axis.getXAxisTickFormat(true);
|
|
@@ -7286,7 +7307,7 @@ var scale = {
|
|
|
7286
7307
|
}
|
|
7287
7308
|
else {
|
|
7288
7309
|
// update for arc
|
|
7289
|
-
(_b = $$.updateArc) === null || _b ===
|
|
7310
|
+
(_b = $$.updateArc) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
7290
7311
|
}
|
|
7291
7312
|
},
|
|
7292
7313
|
/**
|
|
@@ -7401,7 +7422,7 @@ var size = {
|
|
|
7401
7422
|
var labelWidth = 0;
|
|
7402
7423
|
// if axis label position set to inner, exclude from the value
|
|
7403
7424
|
if (hasAxis && (isString(leftLabel) || isString(leftLabel.text) ||
|
|
7404
|
-
/^inner-/.test(leftLabel === null || leftLabel ===
|
|
7425
|
+
/^inner-/.test(leftLabel === null || leftLabel === void 0 ? void 0 : leftLabel.position))) {
|
|
7405
7426
|
var label = $el.main.select(".".concat(leftAxisClass, "-label"));
|
|
7406
7427
|
if (!label.empty()) {
|
|
7407
7428
|
labelWidth = label.node().getBoundingClientRect().left;
|
|
@@ -7419,7 +7440,7 @@ var size = {
|
|
|
7419
7440
|
var $$ = this;
|
|
7420
7441
|
var config = $$.config, hasAxis = $$.state.hasAxis, $el = $$.$el;
|
|
7421
7442
|
if (hasAxis && !withoutAxis && $$.axis.x && config.axis_rotated) {
|
|
7422
|
-
(_a = $$.axis.subX) === null || _a ===
|
|
7443
|
+
(_a = $$.axis.subX) === null || _a === void 0 ? void 0 : _a.create($el.axis.subX);
|
|
7423
7444
|
}
|
|
7424
7445
|
// pass 'withoutAxis' param to not animate at the init rendering
|
|
7425
7446
|
$$.updateScales(withoutAxis);
|
|
@@ -7471,12 +7492,12 @@ var size = {
|
|
|
7471
7492
|
*/
|
|
7472
7493
|
getCurrentPaddingByDirection: function (type, withoutRecompute, withXAxisTickTextOverflow) {
|
|
7473
7494
|
var _a;
|
|
7474
|
-
if (withoutRecompute ===
|
|
7475
|
-
if (withXAxisTickTextOverflow ===
|
|
7495
|
+
if (withoutRecompute === void 0) { withoutRecompute = false; }
|
|
7496
|
+
if (withXAxisTickTextOverflow === void 0) { withXAxisTickTextOverflow = false; }
|
|
7476
7497
|
var $$ = this;
|
|
7477
7498
|
var config = $$.config, $el = $$.$el, hasAxis = $$.state.hasAxis;
|
|
7478
7499
|
var isRotated = config.axis_rotated;
|
|
7479
|
-
var isFitPadding = ((_a = config.padding) === null || _a ===
|
|
7500
|
+
var isFitPadding = ((_a = config.padding) === null || _a === void 0 ? void 0 : _a.mode) === "fit";
|
|
7480
7501
|
var paddingOption = isNumber(config["padding_".concat(type)]) ?
|
|
7481
7502
|
config["padding_".concat(type)] :
|
|
7482
7503
|
undefined;
|
|
@@ -7504,7 +7525,7 @@ var size = {
|
|
|
7504
7525
|
}
|
|
7505
7526
|
var padding = hasAxis && isLeftRight && (isAxisInner || (isUndefined(paddingOption) && !isAxisShow)) ?
|
|
7506
7527
|
0 :
|
|
7507
|
-
(isFitPadding ? (isAxisShow ? axisSize : 0) + (paddingOption !== null && paddingOption !==
|
|
7528
|
+
(isFitPadding ? (isAxisShow ? axisSize : 0) + (paddingOption !== null && paddingOption !== void 0 ? paddingOption : 0) : (isUndefined(paddingOption) ? axisSize : paddingOption));
|
|
7508
7529
|
if (isLeftRight && hasAxis) {
|
|
7509
7530
|
if (axisId && (isFitPadding || isAxisInner) && config["axis_".concat(axisId, "_label")].text) {
|
|
7510
7531
|
padding += $$.axis.getAxisLabelPosition(axisId).isOuter ? defaultPadding : 0;
|
|
@@ -7540,7 +7561,7 @@ var size = {
|
|
|
7540
7561
|
return padding + (axisSize * axesLen) - gap;
|
|
7541
7562
|
},
|
|
7542
7563
|
getCurrentPadding: function (withXAxisTickTextOverflow) {
|
|
7543
|
-
if (withXAxisTickTextOverflow ===
|
|
7564
|
+
if (withXAxisTickTextOverflow === void 0) { withXAxisTickTextOverflow = false; }
|
|
7544
7565
|
var $$ = this;
|
|
7545
7566
|
var _a = ["top", "bottom", "left", "right"]
|
|
7546
7567
|
.map(function (v) { return $$.getCurrentPaddingByDirection(v, null, withXAxisTickTextOverflow); }), top = _a[0], bottom = _a[1], left = _a[2], right = _a[3];
|
|
@@ -7584,7 +7605,7 @@ var size = {
|
|
|
7584
7605
|
var config = $$.config, state = $$.state, legend = $$.$el.legend;
|
|
7585
7606
|
var isRotated = config.axis_rotated;
|
|
7586
7607
|
var isNonAxis = $$.hasArcType() || state.hasFunnel || state.hasTreemap;
|
|
7587
|
-
var isFitPadding = ((_a = config.padding) === null || _a ===
|
|
7608
|
+
var isFitPadding = ((_a = config.padding) === null || _a === void 0 ? void 0 : _a.mode) === "fit";
|
|
7588
7609
|
!isInit && $$.setContainerSize();
|
|
7589
7610
|
var currLegend = {
|
|
7590
7611
|
width: legend ? $$.getLegendWidth() : 0,
|
|
@@ -7648,7 +7669,7 @@ var size = {
|
|
|
7648
7669
|
bottom: 0,
|
|
7649
7670
|
left: 0
|
|
7650
7671
|
};
|
|
7651
|
-
(_b = $$.updateSizeForLegend) === null || _b ===
|
|
7672
|
+
(_b = $$.updateSizeForLegend) === null || _b === void 0 ? void 0 : _b.call($$, currLegend);
|
|
7652
7673
|
state.width = state.current.width - state.margin.left - state.margin.right;
|
|
7653
7674
|
state.height = state.current.height - state.margin.top - state.margin.bottom;
|
|
7654
7675
|
if (state.width < 0) {
|
|
@@ -7673,10 +7694,10 @@ var size = {
|
|
|
7673
7694
|
if ($$.hasArcType()) {
|
|
7674
7695
|
var hasGauge = $$.hasType("gauge");
|
|
7675
7696
|
var isLegendRight = config.legend_show && state.isLegendRight;
|
|
7676
|
-
var textWidth = (_c = (state.hasRadar && $$.cache.get(KEY.radarTextWidth))) !== null && _c !==
|
|
7697
|
+
var textWidth = (_c = (state.hasRadar && $$.cache.get(KEY.radarTextWidth))) !== null && _c !== void 0 ? _c : 0;
|
|
7677
7698
|
state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0) - textWidth;
|
|
7678
7699
|
state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
|
|
7679
|
-
if ((_d = config.arc_rangeText_values) === null || _d ===
|
|
7700
|
+
if ((_d = config.arc_rangeText_values) === null || _d === void 0 ? void 0 : _d.length) {
|
|
7680
7701
|
if (hasGauge) {
|
|
7681
7702
|
state.arcWidth -= 25;
|
|
7682
7703
|
state.arcHeight -= 10;
|
|
@@ -7690,7 +7711,7 @@ var size = {
|
|
|
7690
7711
|
if (hasGauge && !config.gauge_fullCircle) {
|
|
7691
7712
|
state.arcHeight += state.height - $$.getPaddingBottomForGauge();
|
|
7692
7713
|
}
|
|
7693
|
-
(_e = $$.updateRadius) === null || _e ===
|
|
7714
|
+
(_e = $$.updateRadius) === null || _e === void 0 ? void 0 : _e.call($$);
|
|
7694
7715
|
}
|
|
7695
7716
|
if (state.isLegendRight && isNonAxis) {
|
|
7696
7717
|
state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
|
|
@@ -7714,7 +7735,7 @@ var style = {
|
|
|
7714
7735
|
return config.boost_useCssRule ?
|
|
7715
7736
|
function (selection) {
|
|
7716
7737
|
selection.each(function (d) {
|
|
7717
|
-
var res = propsFn && (propsFn === null || propsFn ===
|
|
7738
|
+
var res = propsFn && (propsFn === null || propsFn === void 0 ? void 0 : propsFn.call($$, d));
|
|
7718
7739
|
var shapeSelector = "".concat(withShape ? ".".concat($SHAPE.shapes + $$.getTargetSelectorSuffix(d.id)) : "").concat(selector);
|
|
7719
7740
|
(selector in cssRule) && style.sheet.deleteRule(cssRule[shapeSelector]);
|
|
7720
7741
|
$$.state.cssRule[shapeSelector] = addCssRules(style, shapeSelector, props.filter(Boolean).map(function (v) { return (isString(res) && v.indexOf(":") === -1 ? "".concat(v, ": ").concat(res) : (v || "")); }));
|
|
@@ -7771,7 +7792,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
7771
7792
|
var $$ = this;
|
|
7772
7793
|
var value = d.value;
|
|
7773
7794
|
var isCandlestickType = $$.isCandlestickType(d);
|
|
7774
|
-
var isNegative = (isNumber(value) && value < 0) || (isCandlestickType && !((_a = $$.getCandlestickData(d)) === null || _a ===
|
|
7795
|
+
var isNegative = (isNumber(value) && value < 0) || (isCandlestickType && !((_a = $$.getCandlestickData(d)) === null || _a === void 0 ? void 0 : _a._isUp));
|
|
7775
7796
|
var x = pos.x, y = pos.y;
|
|
7776
7797
|
var gap = 4;
|
|
7777
7798
|
var doubleGap = gap * 2;
|
|
@@ -7820,7 +7841,7 @@ function getTextPos(d, type) {
|
|
|
7820
7841
|
var id = d.id, index = d.index, value = d.value;
|
|
7821
7842
|
return (_a = (isFunction(position) ?
|
|
7822
7843
|
position.bind(this.api)(type, value, id, index, this.$el.text) :
|
|
7823
|
-
(id in position ? position[id] : position)[type])) !== null && _a !==
|
|
7844
|
+
(id in position ? position[id] : position)[type])) !== null && _a !== void 0 ? _a : 0;
|
|
7824
7845
|
}
|
|
7825
7846
|
var text = {
|
|
7826
7847
|
opacityForText: function (d) {
|
|
@@ -7880,12 +7901,12 @@ var text = {
|
|
|
7880
7901
|
.merge(text)
|
|
7881
7902
|
.attr("class", classText)
|
|
7882
7903
|
.attr("text-anchor", function (d) {
|
|
7883
|
-
var isInverted = config["axis_".concat(axis === null || axis ===
|
|
7904
|
+
var isInverted = config["axis_".concat(axis === null || axis === void 0 ? void 0 : axis.getId(d.id), "_inverted")];
|
|
7884
7905
|
// when value is negative or
|
|
7885
7906
|
var isEndAnchor = isInverted ? d.value > 0 : d.value < 0;
|
|
7886
7907
|
if ($$.isCandlestickType(d)) {
|
|
7887
7908
|
var data = $$.getCandlestickData(d);
|
|
7888
|
-
isEndAnchor = !(data === null || data ===
|
|
7909
|
+
isEndAnchor = !(data === null || data === void 0 ? void 0 : data._isUp);
|
|
7889
7910
|
}
|
|
7890
7911
|
else if ($$.isTreemapType(d)) {
|
|
7891
7912
|
return labelsCentered ? "middle" : "start";
|
|
@@ -7937,7 +7958,7 @@ var text = {
|
|
|
7937
7958
|
}
|
|
7938
7959
|
if ($$.isCandlestickType(d) && !isFunction(labelColors)) {
|
|
7939
7960
|
var value = $$.getCandlestickData(d);
|
|
7940
|
-
if (!(value === null || value ===
|
|
7961
|
+
if (!(value === null || value === void 0 ? void 0 : value._isUp)) {
|
|
7941
7962
|
var downColor = config.candlestick_color_down;
|
|
7942
7963
|
color = isObject(downColor) ? downColor[d.id] : downColor;
|
|
7943
7964
|
}
|
|
@@ -7990,7 +8011,7 @@ var text = {
|
|
|
7990
8011
|
.each(function (d, i) {
|
|
7991
8012
|
// do not apply transition for newly added text elements
|
|
7992
8013
|
var node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t);
|
|
7993
|
-
var isInverted = config["axis_".concat(axis === null || axis ===
|
|
8014
|
+
var isInverted = config["axis_".concat(axis === null || axis === void 0 ? void 0 : axis.getId(d.id), "_inverted")];
|
|
7994
8015
|
var pos = {
|
|
7995
8016
|
x: getX.bind(this)(d, i),
|
|
7996
8017
|
y: getY.bind(this)(d, i)
|
|
@@ -8128,7 +8149,7 @@ var text = {
|
|
|
8128
8149
|
var xPos = points ? points[0][0] : 0;
|
|
8129
8150
|
if ($$.isCandlestickType(d)) {
|
|
8130
8151
|
if (isRotated) {
|
|
8131
|
-
xPos = ((_a = $$.getCandlestickData(d)) === null || _a ===
|
|
8152
|
+
xPos = ((_a = $$.getCandlestickData(d)) === null || _a === void 0 ? void 0 : _a._isUp) ? points[2][2] + 4 : points[2][1] - 4;
|
|
8132
8153
|
}
|
|
8133
8154
|
else {
|
|
8134
8155
|
xPos += (points[1][0] - xPos) / 2;
|
|
@@ -8174,7 +8195,7 @@ var text = {
|
|
|
8174
8195
|
var $$ = this;
|
|
8175
8196
|
var axis = $$.axis, config = $$.config, state = $$.state;
|
|
8176
8197
|
var isRotated = config.axis_rotated;
|
|
8177
|
-
var isInverted = config["axis_".concat(axis === null || axis ===
|
|
8198
|
+
var isInverted = config["axis_".concat(axis === null || axis === void 0 ? void 0 : axis.getId(d.id), "_inverted")];
|
|
8178
8199
|
var isBarType = $$.isBarType(d);
|
|
8179
8200
|
var isFunnelType = $$.isFunnelType(d);
|
|
8180
8201
|
var isTreemapType = $$.isTreemapType(d);
|
|
@@ -8286,7 +8307,7 @@ var text = {
|
|
|
8286
8307
|
* @private
|
|
8287
8308
|
*/
|
|
8288
8309
|
meetsLabelThreshold: function (ratio, type) {
|
|
8289
|
-
if (ratio ===
|
|
8310
|
+
if (ratio === void 0) { ratio = 0; }
|
|
8290
8311
|
var $$ = this;
|
|
8291
8312
|
var config = $$.config;
|
|
8292
8313
|
var threshold = config["".concat(type, "_label_threshold")] || 0;
|
|
@@ -8306,7 +8327,7 @@ var text = {
|
|
|
8306
8327
|
* @private
|
|
8307
8328
|
*/
|
|
8308
8329
|
function getTextXPos(pos, width) {
|
|
8309
|
-
if (pos ===
|
|
8330
|
+
if (pos === void 0) { pos = "left"; }
|
|
8310
8331
|
var isNum = isNumber(width);
|
|
8311
8332
|
var position;
|
|
8312
8333
|
if (pos.indexOf("center") > -1) {
|
|
@@ -8397,7 +8418,7 @@ var tooltip$1 = {
|
|
|
8397
8418
|
// Show tooltip if needed
|
|
8398
8419
|
if (config.tooltip_init_show) {
|
|
8399
8420
|
var isArc = !(hasAxis || hasRadar);
|
|
8400
|
-
if (((_b = $$.axis) === null || _b ===
|
|
8421
|
+
if (((_b = $$.axis) === null || _b === void 0 ? void 0 : _b.isTimeSeries()) && isString(config.tooltip_init_x)) {
|
|
8401
8422
|
config.tooltip_init_x = parseDate.call($$, config.tooltip_init_x);
|
|
8402
8423
|
}
|
|
8403
8424
|
$$.api.tooltip.show({
|
|
@@ -8407,7 +8428,7 @@ var tooltip$1 = {
|
|
|
8407
8428
|
});
|
|
8408
8429
|
var position = config.tooltip_init_position;
|
|
8409
8430
|
if (!config.tooltip_contents.bindto && !isEmpty(position)) {
|
|
8410
|
-
var _d = position.top, top_1 = _d ===
|
|
8431
|
+
var _d = position.top, top_1 = _d === void 0 ? 0 : _d, _e = position.left, left = _e === void 0 ? 50 : _e;
|
|
8411
8432
|
$el.tooltip.style("top", isString(top_1) ? top_1 : "".concat(top_1, "px"))
|
|
8412
8433
|
.style("left", isString(left) ? left : "".concat(left, "px"))
|
|
8413
8434
|
.style("display", null);
|
|
@@ -8427,7 +8448,7 @@ var tooltip$1 = {
|
|
|
8427
8448
|
}
|
|
8428
8449
|
var $$ = this;
|
|
8429
8450
|
var api = $$.api, config = $$.config;
|
|
8430
|
-
return isFunction(config.tooltip_contents) ? config.tooltip_contents.bind(api).apply(
|
|
8451
|
+
return isFunction(config.tooltip_contents) ? config.tooltip_contents.bind(api).apply(void 0, args) : $$.getTooltipContent.apply($$, args);
|
|
8431
8452
|
},
|
|
8432
8453
|
/**
|
|
8433
8454
|
* Returns the tooltip content(HTML string)
|
|
@@ -8453,14 +8474,14 @@ var tooltip$1 = {
|
|
|
8453
8474
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8454
8475
|
arg[_i] = arguments[_i];
|
|
8455
8476
|
}
|
|
8456
|
-
return sanitize((titleFn || defaultTitleFormat).apply(
|
|
8477
|
+
return sanitize((titleFn || defaultTitleFormat).apply(void 0, arg));
|
|
8457
8478
|
};
|
|
8458
8479
|
var nameFormat = function () {
|
|
8459
8480
|
var arg = [];
|
|
8460
8481
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8461
8482
|
arg[_i] = arguments[_i];
|
|
8462
8483
|
}
|
|
8463
|
-
return sanitize((nameFn || (function (name) { return name; })).apply(
|
|
8484
|
+
return sanitize((nameFn || (function (name) { return name; })).apply(void 0, arg));
|
|
8464
8485
|
};
|
|
8465
8486
|
var valueFormat = function () {
|
|
8466
8487
|
var arg = [];
|
|
@@ -8470,7 +8491,7 @@ var tooltip$1 = {
|
|
|
8470
8491
|
var fn = valueFn || (state.hasTreemap || $$.isStackNormalized() ?
|
|
8471
8492
|
function (v, ratio) { return "".concat((ratio * 100).toFixed(2), "%"); } :
|
|
8472
8493
|
defaultValueFormat);
|
|
8473
|
-
return sanitize(fn.apply(
|
|
8494
|
+
return sanitize(fn.apply(void 0, arg));
|
|
8474
8495
|
};
|
|
8475
8496
|
var order = config.tooltip_order;
|
|
8476
8497
|
var getRowValue = function (row) { return ($$.axis && $$.isBubbleZType(row) ?
|
|
@@ -8535,16 +8556,16 @@ var tooltip$1 = {
|
|
|
8535
8556
|
param = [row.ratio, row.id, row.index];
|
|
8536
8557
|
if ($$.isAreaRangeType(row)) {
|
|
8537
8558
|
var _c = ["high", "low"].map(function (v) {
|
|
8538
|
-
return valueFormat.apply(
|
|
8559
|
+
return valueFormat.apply(void 0, __spreadArray([$$.getRangedData(row, v)], param, false));
|
|
8539
8560
|
}), high = _c[0], low = _c[1];
|
|
8540
|
-
var mid = valueFormat.apply(
|
|
8561
|
+
var mid = valueFormat.apply(void 0, __spreadArray([getRowValue(row)], param, false));
|
|
8541
8562
|
value = "<b>Mid:</b> ".concat(mid, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low);
|
|
8542
8563
|
}
|
|
8543
8564
|
else if ($$.isCandlestickType(row)) {
|
|
8544
8565
|
var _d = ["open", "high", "low", "close", "volume"]
|
|
8545
8566
|
.map(function (v) {
|
|
8546
8567
|
var value = $$.getRangedData(row, v, "candlestick");
|
|
8547
|
-
return value ? valueFormat.apply(
|
|
8568
|
+
return value ? valueFormat.apply(void 0, __spreadArray([$$.getRangedData(row, v, "candlestick")], param, false)) :
|
|
8548
8569
|
undefined;
|
|
8549
8570
|
}), open_1 = _d[0], high = _d[1], low = _d[2], close_1 = _d[3], volume = _d[4];
|
|
8550
8571
|
value =
|
|
@@ -8555,14 +8576,14 @@ var tooltip$1 = {
|
|
|
8555
8576
|
value = "".concat(valueFormat(rangeValue, undefined, id, index));
|
|
8556
8577
|
}
|
|
8557
8578
|
else {
|
|
8558
|
-
value = valueFormat.apply(
|
|
8579
|
+
value = valueFormat.apply(void 0, __spreadArray([getRowValue(row)], param, false));
|
|
8559
8580
|
}
|
|
8560
8581
|
if (value !== undefined) {
|
|
8561
8582
|
// Skip elements when their name is set to null
|
|
8562
8583
|
if (row.name === null) {
|
|
8563
8584
|
return "continue";
|
|
8564
8585
|
}
|
|
8565
|
-
var name_1 = nameFormat.apply(
|
|
8586
|
+
var name_1 = nameFormat.apply(void 0, __spreadArray([(_a = row.name) !== null && _a !== void 0 ? _a : row.id], param, false));
|
|
8566
8587
|
var color_1 = getBgColor(row);
|
|
8567
8588
|
var contentValue_1 = {
|
|
8568
8589
|
CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
|
@@ -8609,17 +8630,17 @@ var tooltip$1 = {
|
|
|
8609
8630
|
var config = $$.config, scale = $$.scale, state = $$.state, _c = $$.$el, eventRect = _c.eventRect, tooltip = _c.tooltip, svg = _c.svg;
|
|
8610
8631
|
var bindto = config.tooltip_contents.bindto;
|
|
8611
8632
|
var isRotated = config.axis_rotated;
|
|
8612
|
-
var datum = tooltip === null || tooltip ===
|
|
8633
|
+
var datum = tooltip === null || tooltip === void 0 ? void 0 : tooltip.datum();
|
|
8613
8634
|
if (!bindto && datum) {
|
|
8614
|
-
var data = dataToShow !== null && dataToShow !==
|
|
8615
|
-
var _d = getPointer(state.event, eventTarget !== null && eventTarget !==
|
|
8635
|
+
var data = dataToShow !== null && dataToShow !== void 0 ? dataToShow : JSON.parse(datum.current);
|
|
8636
|
+
var _d = getPointer(state.event, eventTarget !== null && eventTarget !== void 0 ? eventTarget : eventRect === null || eventRect === void 0 ? void 0 : eventRect.node()), x = _d[0], y = _d[1]; // get mouse event position
|
|
8616
8637
|
var currPos = { x: x, y: y };
|
|
8617
8638
|
if (state.hasAxis && scale.x && datum && "x" in datum) {
|
|
8618
8639
|
var getYPos = function (value, id, axisId) {
|
|
8619
8640
|
var _a;
|
|
8620
|
-
if (value ===
|
|
8621
|
-
if (axisId ===
|
|
8622
|
-
var scaleFn = scale[id ? (_a = $$.axis) === null || _a ===
|
|
8641
|
+
if (value === void 0) { value = 0; }
|
|
8642
|
+
if (axisId === void 0) { axisId = "y"; }
|
|
8643
|
+
var scaleFn = scale[id ? (_a = $$.axis) === null || _a === void 0 ? void 0 : _a.getId(id) : axisId];
|
|
8623
8644
|
return scaleFn ?
|
|
8624
8645
|
scaleFn(value) + (isRotated ? state.margin.left : state.margin.top) :
|
|
8625
8646
|
0;
|
|
@@ -8634,9 +8655,9 @@ var tooltip$1 = {
|
|
|
8634
8655
|
currPos.yAxis = getYPos;
|
|
8635
8656
|
}
|
|
8636
8657
|
}
|
|
8637
|
-
var _e = datum.width, width = _e ===
|
|
8658
|
+
var _e = datum.width, width = _e === void 0 ? 0 : _e, _f = datum.height, height = _f === void 0 ? 0 : _f;
|
|
8638
8659
|
// Get tooltip position
|
|
8639
|
-
var pos_1 = (_b = (_a = config.tooltip_position) === null || _a ===
|
|
8660
|
+
var pos_1 = (_b = (_a = config.tooltip_position) === null || _a === void 0 ? void 0 : _a.bind($$.api)(data, width, height, eventRect === null || eventRect === void 0 ? void 0 : eventRect.node(), currPos)) !== null && _b !== void 0 ? _b : (hasViewBox(svg) ?
|
|
8640
8661
|
$$.getTooltipPositionViewBox.bind($$)(width, height, currPos) :
|
|
8641
8662
|
$$.getTooltipPosition.bind($$)(width, height, currPos));
|
|
8642
8663
|
["top", "left"].forEach(function (v) {
|
|
@@ -8662,7 +8683,7 @@ var tooltip$1 = {
|
|
|
8662
8683
|
var _c = $$.$el, eventRect = _c.eventRect, svg = _c.svg, config = $$.config, state = $$.state;
|
|
8663
8684
|
var isRotated = config.axis_rotated;
|
|
8664
8685
|
var hasArcType = $$.hasArcType() || state.hasFunnel || state.hasTreemap;
|
|
8665
|
-
var target = (_b = (_a = (hasArcType ? svg : eventRect)) === null || _a ===
|
|
8686
|
+
var target = (_b = (_a = (hasArcType ? svg : eventRect)) === null || _a === void 0 ? void 0 : _a.node()) !== null && _b !== void 0 ? _b : state.event.target;
|
|
8666
8687
|
var x = currPos.x, y = currPos.y;
|
|
8667
8688
|
if (state.hasAxis) {
|
|
8668
8689
|
x = isRotated ? x : currPos.xAxis;
|
|
@@ -8723,8 +8744,8 @@ var tooltip$1 = {
|
|
|
8723
8744
|
else if (hasArcType) {
|
|
8724
8745
|
var notTouch = inputType !== "touch";
|
|
8725
8746
|
if (notTouch) {
|
|
8726
|
-
var titlePadding = (_b = (_a = $$.getTitlePadding) === null || _a ===
|
|
8727
|
-
if (titlePadding && hasGauge && ((_c = config.arc_rangeText_values) === null || _c ===
|
|
8747
|
+
var titlePadding = (_b = (_a = $$.getTitlePadding) === null || _a === void 0 ? void 0 : _a.call($$)) !== null && _b !== void 0 ? _b : 0;
|
|
8748
|
+
if (titlePadding && hasGauge && ((_c = config.arc_rangeText_values) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
8728
8749
|
titlePadding += 10;
|
|
8729
8750
|
}
|
|
8730
8751
|
x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
|
|
@@ -8836,7 +8857,7 @@ var tooltip$1 = {
|
|
|
8836
8857
|
var $$ = this;
|
|
8837
8858
|
var api = $$.api, config = $$.config, tooltip = $$.$el.tooltip;
|
|
8838
8859
|
if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
|
8839
|
-
var selectedData = JSON.parse((_a = tooltip.datum().current) !== null && _a !==
|
|
8860
|
+
var selectedData = JSON.parse((_a = tooltip.datum().current) !== null && _a !== void 0 ? _a : {});
|
|
8840
8861
|
callFn(config.tooltip_onhide, api, selectedData);
|
|
8841
8862
|
// hide tooltip
|
|
8842
8863
|
tooltip
|
|
@@ -8857,7 +8878,7 @@ var tooltip$1 = {
|
|
|
8857
8878
|
var charts = $$.charts, config = $$.config, event = $$.state.event;
|
|
8858
8879
|
// Prevent propagation among instances if isn't instantiated from the user's event
|
|
8859
8880
|
// https://github.com/naver/billboard.js/issues/1979
|
|
8860
|
-
if ((event === null || event ===
|
|
8881
|
+
if ((event === null || event === void 0 ? void 0 : event.isTrusted) && config.tooltip_linked && charts.length > 1) {
|
|
8861
8882
|
var linkedName_1 = config.tooltip_linked_name;
|
|
8862
8883
|
charts
|
|
8863
8884
|
.filter(function (c) { return c !== $$.api; })
|
|
@@ -8868,7 +8889,7 @@ var tooltip$1 = {
|
|
|
8868
8889
|
var isInDom = doc.body.contains($el.chart.node());
|
|
8869
8890
|
if (isLinked && linkedName_1 === name && isInDom) {
|
|
8870
8891
|
var data = $el.tooltip.data()[0];
|
|
8871
|
-
var isNotSameIndex = index !== (data === null || data ===
|
|
8892
|
+
var isNotSameIndex = index !== (data === null || data === void 0 ? void 0 : data.index);
|
|
8872
8893
|
try {
|
|
8873
8894
|
c.tooltip[show && isNotSameIndex ? "show" : "hide"]({ index: index });
|
|
8874
8895
|
}
|
|
@@ -8889,15 +8910,15 @@ var tooltip$1 = {
|
|
|
8889
8910
|
var $$ = this;
|
|
8890
8911
|
var config = $$.config, _b = $$.$el, eventRect = _b.eventRect, svg = _b.svg, tooltip = _b.tooltip, _c = $$.state, event = _c.event, hasAxis = _c.hasAxis, hasRadar = _c.hasRadar, hasTreemap = _c.hasTreemap;
|
|
8891
8912
|
// Update tooltip, when tooltip is in shown state
|
|
8892
|
-
if ((tooltip === null || tooltip ===
|
|
8893
|
-
var rect = context !== null && context !==
|
|
8913
|
+
if ((tooltip === null || tooltip === void 0 ? void 0 : tooltip.style("display")) === "block" && event) {
|
|
8914
|
+
var rect = context !== null && context !== void 0 ? context : (_a = (hasRadar ? svg : eventRect)) === null || _a === void 0 ? void 0 : _a.node();
|
|
8894
8915
|
// for Axis based & Radar
|
|
8895
8916
|
if (hasAxis || hasRadar) {
|
|
8896
8917
|
if ($$.isMultipleX()) {
|
|
8897
8918
|
$$.selectRectForMultipleXs(rect, false);
|
|
8898
8919
|
}
|
|
8899
8920
|
else {
|
|
8900
|
-
var idx = index !== null && index !==
|
|
8921
|
+
var idx = index !== null && index !== void 0 ? index : $$.getDataIndexFromEvent(event);
|
|
8901
8922
|
if (index === -1) {
|
|
8902
8923
|
$$.api.tooltip.hide();
|
|
8903
8924
|
}
|
|
@@ -8916,7 +8937,7 @@ var tooltip$1 = {
|
|
|
8916
8937
|
if (data) {
|
|
8917
8938
|
var d = $$.hasArcType() ?
|
|
8918
8939
|
$$.convertToArcData($$.updateAngle(data)) :
|
|
8919
|
-
data === null || data ===
|
|
8940
|
+
data === null || data === void 0 ? void 0 : data.data;
|
|
8920
8941
|
hasTreemap && (target = svg.node());
|
|
8921
8942
|
d && $$.showTooltip([d], target);
|
|
8922
8943
|
}
|
|
@@ -8936,7 +8957,7 @@ var tooltip$1 = {
|
|
|
8936
8957
|
var transform = {
|
|
8937
8958
|
getTranslate: function (target, index) {
|
|
8938
8959
|
var _a;
|
|
8939
|
-
if (index ===
|
|
8960
|
+
if (index === void 0) { index = 0; }
|
|
8940
8961
|
var $$ = this;
|
|
8941
8962
|
var config = $$.config, state = $$.state;
|
|
8942
8963
|
var isRotated = config.axis_rotated;
|
|
@@ -8977,7 +8998,7 @@ var transform = {
|
|
|
8977
8998
|
else if (target === "arc") {
|
|
8978
8999
|
x = state.arcWidth / 2;
|
|
8979
9000
|
y = state.arcHeight / 2;
|
|
8980
|
-
if ((_a = config.arc_rangeText_values) === null || _a ===
|
|
9001
|
+
if ((_a = config.arc_rangeText_values) === null || _a === void 0 ? void 0 : _a.length) {
|
|
8981
9002
|
y += 5 + ($$.hasType("gauge") && config.title_text ? 10 : 0);
|
|
8982
9003
|
}
|
|
8983
9004
|
}
|
|
@@ -8995,13 +9016,13 @@ var transform = {
|
|
|
8995
9016
|
transformMain: function (withTransition, transitions) {
|
|
8996
9017
|
var $$ = this;
|
|
8997
9018
|
var main = $$.$el.main, $T = $$.$T;
|
|
8998
|
-
var xAxis = (transitions === null || transitions ===
|
|
9019
|
+
var xAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisX) ?
|
|
8999
9020
|
transitions.axisX :
|
|
9000
9021
|
$T(main.select(".".concat($AXIS.axisX)), withTransition);
|
|
9001
|
-
var yAxis = (transitions === null || transitions ===
|
|
9022
|
+
var yAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY) ?
|
|
9002
9023
|
transitions.axisY :
|
|
9003
9024
|
$T(main.select(".".concat($AXIS.axisY)), withTransition);
|
|
9004
|
-
var y2Axis = (transitions === null || transitions ===
|
|
9025
|
+
var y2Axis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY2) ?
|
|
9005
9026
|
transitions.axisY2 :
|
|
9006
9027
|
$T(main.select(".".concat($AXIS.axisY2)), withTransition);
|
|
9007
9028
|
$T(main, withTransition)
|
|
@@ -9078,16 +9099,16 @@ var typeInternals = {
|
|
|
9078
9099
|
*/
|
|
9079
9100
|
hasType: function (type, targetsValue, checkFromData) {
|
|
9080
9101
|
var _a;
|
|
9081
|
-
if (checkFromData ===
|
|
9102
|
+
if (checkFromData === void 0) { checkFromData = false; }
|
|
9082
9103
|
var $$ = this;
|
|
9083
9104
|
var config = $$.config, current = $$.state.current;
|
|
9084
9105
|
var types = config.data_types;
|
|
9085
9106
|
var targets = targetsValue || $$.data.targets;
|
|
9086
9107
|
var has = false;
|
|
9087
|
-
if (!checkFromData && ((_a = current.types) === null || _a ===
|
|
9108
|
+
if (!checkFromData && ((_a = current.types) === null || _a === void 0 ? void 0 : _a.indexOf(type)) > -1) {
|
|
9088
9109
|
has = true;
|
|
9089
9110
|
}
|
|
9090
|
-
else if (targets === null || targets ===
|
|
9111
|
+
else if (targets === null || targets === void 0 ? void 0 : targets.length) {
|
|
9091
9112
|
targets.forEach(function (target) {
|
|
9092
9113
|
var t = types[target.id];
|
|
9093
9114
|
if (t === type || (!t && type === "line")) {
|
|
@@ -9117,7 +9138,7 @@ var typeInternals = {
|
|
|
9117
9138
|
*/
|
|
9118
9139
|
hasTypeOf: function (type, targets, exclude) {
|
|
9119
9140
|
var _this = this;
|
|
9120
|
-
if (exclude ===
|
|
9141
|
+
if (exclude === void 0) { exclude = []; }
|
|
9121
9142
|
if (type in TYPE_BY_CATEGORY) {
|
|
9122
9143
|
return !TYPE_BY_CATEGORY[type]
|
|
9123
9144
|
.filter(function (v) { return exclude.indexOf(v) === -1; })
|
|
@@ -9135,7 +9156,7 @@ var typeInternals = {
|
|
|
9135
9156
|
isTypeOf: function (d, type) {
|
|
9136
9157
|
var _a;
|
|
9137
9158
|
var id = isString(d) ? d : d.id;
|
|
9138
|
-
var dataType = this.config && (((_a = this.config.data_types) === null || _a ===
|
|
9159
|
+
var dataType = this.config && (((_a = this.config.data_types) === null || _a === void 0 ? void 0 : _a[id]) || this.config.data_type);
|
|
9139
9160
|
return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
|
9140
9161
|
},
|
|
9141
9162
|
hasPointType: function () {
|
|
@@ -9217,7 +9238,7 @@ var typeInternals = {
|
|
|
9217
9238
|
var config = this.config;
|
|
9218
9239
|
var pattern = config.point_pattern;
|
|
9219
9240
|
var isCircle = false;
|
|
9220
|
-
if ((node === null || node ===
|
|
9241
|
+
if ((node === null || node === void 0 ? void 0 : node.tagName) === "circle") {
|
|
9221
9242
|
isCircle = true;
|
|
9222
9243
|
}
|
|
9223
9244
|
else {
|
|
@@ -9319,8 +9340,8 @@ var shape = {
|
|
|
9319
9340
|
}
|
|
9320
9341
|
});
|
|
9321
9342
|
if (!$$.hasArcType() || hasRadar || hasTreemap) {
|
|
9322
|
-
var cx =
|
|
9323
|
-
var cy =
|
|
9343
|
+
var cx = void 0;
|
|
9344
|
+
var cy = void 0;
|
|
9324
9345
|
// generate circle x/y functions depending on updated params
|
|
9325
9346
|
if (!hasTreemap) {
|
|
9326
9347
|
cx = hasRadar ? $$.radarCircleX : (isRotated ? $$.circleY : $$.circleX);
|
|
@@ -9367,18 +9388,18 @@ var shape = {
|
|
|
9367
9388
|
var _a;
|
|
9368
9389
|
var xKey = d.id in xs ? xs[d.id] : "";
|
|
9369
9390
|
var ind = xKey ? indices[xKey] : indices;
|
|
9370
|
-
for (var j = 0, groups =
|
|
9391
|
+
for (var j = 0, groups = void 0; (groups = config.data_groups[j]); j++) {
|
|
9371
9392
|
if (groups.indexOf(d.id) < 0) {
|
|
9372
9393
|
continue;
|
|
9373
9394
|
}
|
|
9374
|
-
for (var k = 0, key =
|
|
9395
|
+
for (var k = 0, key = void 0; (key = groups[k]); k++) {
|
|
9375
9396
|
if (key in ind) {
|
|
9376
9397
|
ind[d.id] = ind[key];
|
|
9377
9398
|
break;
|
|
9378
9399
|
}
|
|
9379
9400
|
// for same grouped data, add other data to same indices
|
|
9380
9401
|
if (d.id !== key && xKey) {
|
|
9381
|
-
ind[key] = (_a = ind[d.id]) !== null && _a !==
|
|
9402
|
+
ind[key] = (_a = ind[d.id]) !== null && _a !== void 0 ? _a : i[xKey];
|
|
9382
9403
|
}
|
|
9383
9404
|
}
|
|
9384
9405
|
}
|
|
@@ -9570,7 +9591,7 @@ var shape = {
|
|
|
9570
9591
|
if (!row || Number(row.x) !== dataXAsNumber) {
|
|
9571
9592
|
row = rowValueMapByXValue[dataXAsNumber];
|
|
9572
9593
|
}
|
|
9573
|
-
if ((row === null || row ===
|
|
9594
|
+
if ((row === null || row === void 0 ? void 0 : row.value) * value >= 0 && isNumber(rValue)) {
|
|
9574
9595
|
var addOffset = value === 0 ?
|
|
9575
9596
|
((groupsZeroAs === "positive" &&
|
|
9576
9597
|
rValue > 0) ||
|
|
@@ -9606,12 +9627,12 @@ var shape = {
|
|
|
9606
9627
|
var $$ = this;
|
|
9607
9628
|
var config = $$.config, org = $$.org, scale = $$.scale, state = $$.state;
|
|
9608
9629
|
var maxDataCount = $$.getMaxDataCount();
|
|
9609
|
-
var isGrouped = type === "bar" && ((_a = config.data_groups) === null || _a ===
|
|
9630
|
+
var isGrouped = type === "bar" && ((_a = config.data_groups) === null || _a === void 0 ? void 0 : _a.length);
|
|
9610
9631
|
var configName = "".concat(type, "_width");
|
|
9611
|
-
var k = ((_c = (_b = $$.getZoomTransform) === null || _b ===
|
|
9632
|
+
var k = ((_c = (_b = $$.getZoomTransform) === null || _b === void 0 ? void 0 : _b.call($$)) !== null && _c !== void 0 ? _c : { k: 1 }).k;
|
|
9612
9633
|
var xMinMax = [
|
|
9613
|
-
(_d = config.axis_x_min) !== null && _d !==
|
|
9614
|
-
(_e = config.axis_x_max) !== null && _e !==
|
|
9634
|
+
(_d = config.axis_x_min) !== null && _d !== void 0 ? _d : org.xDomain[0],
|
|
9635
|
+
(_e = config.axis_x_max) !== null && _e !== void 0 ? _e : org.xDomain[1]
|
|
9615
9636
|
].map($$.axis.isTimeSeries() ? parseDate.bind($$) : Number);
|
|
9616
9637
|
var tickInterval = axis.tickInterval(maxDataCount);
|
|
9617
9638
|
if (scale.zoom && !$$.axis.isCategorized() && k > 1) {
|
|
@@ -9678,7 +9699,7 @@ var shape = {
|
|
|
9678
9699
|
if (!$$.isTargetToShow(d.id)) {
|
|
9679
9700
|
isWithin = false;
|
|
9680
9701
|
}
|
|
9681
|
-
else if ((_a = $$.hasValidPointType) === null || _a ===
|
|
9702
|
+
else if ((_a = $$.hasValidPointType) === null || _a === void 0 ? void 0 : _a.call($$, that.nodeName)) {
|
|
9682
9703
|
isWithin = $$.isStepType(d) ?
|
|
9683
9704
|
$$.isWithinStep(that, $$.getYScaleById(d.id)($$.getBaseValue(d))) :
|
|
9684
9705
|
$$.isWithinCircle(that, $$.isBubbleType(d) ? $$.pointSelectR(d) * 1.5 : 0);
|
|
@@ -9925,7 +9946,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
9925
9946
|
config.axis_y2_show = false;
|
|
9926
9947
|
config.subchart_show = false;
|
|
9927
9948
|
}
|
|
9928
|
-
if ($$.hasPointType() || ((_a = $$.hasLegendDefsPoint) === null || _a ===
|
|
9949
|
+
if ($$.hasPointType() || ((_a = $$.hasLegendDefsPoint) === null || _a === void 0 ? void 0 : _a.call($$))) {
|
|
9929
9950
|
$$.point = $$.generatePoint();
|
|
9930
9951
|
}
|
|
9931
9952
|
if (state.hasAxis) {
|
|
@@ -10016,18 +10037,18 @@ var ChartInternal = /** @class */ (function () {
|
|
|
10016
10037
|
var isTouch = state.inputType === "touch";
|
|
10017
10038
|
var onclick_1 = config.onclick, onover = config.onover, onout = config.onout;
|
|
10018
10039
|
$el.svg
|
|
10019
|
-
.on("click", (onclick_1 === null || onclick_1 ===
|
|
10020
|
-
.on(isTouch ? "touchstart" : "mouseenter", (onover === null || onover ===
|
|
10021
|
-
.on(isTouch ? "touchend" : "mouseleave", (onout === null || onout ===
|
|
10040
|
+
.on("click", (onclick_1 === null || onclick_1 === void 0 ? void 0 : onclick_1.bind($$.api)) || null)
|
|
10041
|
+
.on(isTouch ? "touchstart" : "mouseenter", (onover === null || onover === void 0 ? void 0 : onover.bind($$.api)) || null)
|
|
10042
|
+
.on(isTouch ? "touchend" : "mouseleave", (onout === null || onout === void 0 ? void 0 : onout.bind($$.api)) || null);
|
|
10022
10043
|
}
|
|
10023
10044
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
10024
10045
|
// Define defs
|
|
10025
10046
|
var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
10026
10047
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap ||
|
|
10027
|
-
labelsBGColor || ((_a = $$.hasLegendDefsPoint) === null || _a ===
|
|
10048
|
+
labelsBGColor || ((_a = $$.hasLegendDefsPoint) === null || _a === void 0 ? void 0 : _a.call($$))) {
|
|
10028
10049
|
$el.defs = $el.svg.append("defs");
|
|
10029
10050
|
if (hasAxis) {
|
|
10030
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
10051
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(function (v) {
|
|
10031
10052
|
$$.appendClip($el.defs, state.clip[v]);
|
|
10032
10053
|
});
|
|
10033
10054
|
}
|
|
@@ -10073,11 +10094,11 @@ var ChartInternal = /** @class */ (function () {
|
|
|
10073
10094
|
$$.initChartElements();
|
|
10074
10095
|
if (hasAxis) {
|
|
10075
10096
|
// Cover whole with rects for events
|
|
10076
|
-
hasInteraction && ((_b = $$.initEventRect) === null || _b ===
|
|
10097
|
+
hasInteraction && ((_b = $$.initEventRect) === null || _b === void 0 ? void 0 : _b.call($$));
|
|
10077
10098
|
// Grids
|
|
10078
10099
|
$$.initGrid();
|
|
10079
10100
|
// Add Axis here, when clipPath is 'true'
|
|
10080
|
-
config.clipPath && ((_c = $$.axis) === null || _c ===
|
|
10101
|
+
config.clipPath && ((_c = $$.axis) === null || _c === void 0 ? void 0 : _c.init());
|
|
10081
10102
|
}
|
|
10082
10103
|
// Set targets
|
|
10083
10104
|
$$.updateTargets($$.data.targets);
|
|
@@ -10245,7 +10266,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
10245
10266
|
// Point types
|
|
10246
10267
|
var hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
|
|
10247
10268
|
if (hasPointType) {
|
|
10248
|
-
(_a = $$.updateTargetForCircle) === null || _a ===
|
|
10269
|
+
(_a = $$.updateTargetForCircle) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
10249
10270
|
}
|
|
10250
10271
|
// Fade-in each chart
|
|
10251
10272
|
$$.filterTargetsToShowAtInit(hasPointType);
|
|
@@ -10256,7 +10277,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
10256
10277
|
* @private
|
|
10257
10278
|
*/
|
|
10258
10279
|
ChartInternal.prototype.filterTargetsToShowAtInit = function (hasPointType) {
|
|
10259
|
-
if (hasPointType ===
|
|
10280
|
+
if (hasPointType === void 0) { hasPointType = false; }
|
|
10260
10281
|
var $$ = this;
|
|
10261
10282
|
var svg = $$.$el.svg, $T = $$.$T;
|
|
10262
10283
|
var selector = ".".concat($COMMON.target);
|
|
@@ -10302,11 +10323,11 @@ var ChartInternal = /** @class */ (function () {
|
|
|
10302
10323
|
};
|
|
10303
10324
|
ChartInternal.prototype.bindResize = function () {
|
|
10304
10325
|
var $$ = this;
|
|
10305
|
-
var config = $$.config, state = $$.state;
|
|
10326
|
+
var $el = $$.$el, config = $$.config, state = $$.state;
|
|
10306
10327
|
var resizeFunction = generateResize(config.resize_timer);
|
|
10307
10328
|
var list = [];
|
|
10308
10329
|
list.push(function () { return callFn(config.onresize, $$.api); });
|
|
10309
|
-
if (config.resize_auto
|
|
10330
|
+
if (/^(true|parent)$/.test(config.resize_auto)) {
|
|
10310
10331
|
list.push(function () {
|
|
10311
10332
|
state.resizing = true;
|
|
10312
10333
|
// https://github.com/naver/billboard.js/issues/2650
|
|
@@ -10325,7 +10346,13 @@ var ChartInternal = /** @class */ (function () {
|
|
|
10325
10346
|
list.forEach(function (v) { return resizeFunction.add(v); });
|
|
10326
10347
|
$$.resizeFunction = resizeFunction;
|
|
10327
10348
|
// attach resize event
|
|
10328
|
-
|
|
10349
|
+
if (config.resize_auto === "parent") {
|
|
10350
|
+
($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$)))
|
|
10351
|
+
.observe($el.chart.node().parentNode);
|
|
10352
|
+
}
|
|
10353
|
+
else {
|
|
10354
|
+
win.addEventListener("resize", $$.resizeFunction);
|
|
10355
|
+
}
|
|
10329
10356
|
};
|
|
10330
10357
|
/**
|
|
10331
10358
|
* Call plugin hook
|
|
@@ -10459,15 +10486,15 @@ var apiChart = {
|
|
|
10459
10486
|
if (state.rendered) {
|
|
10460
10487
|
// reset possible zoom scale when is called from resize event
|
|
10461
10488
|
if (state.resizing) { // arguments[1] is given when is called from resize
|
|
10462
|
-
(_a = $$.brush) === null || _a ===
|
|
10489
|
+
(_a = $$.brush) === null || _a === void 0 ? void 0 : _a.updateResize();
|
|
10463
10490
|
}
|
|
10464
10491
|
else {
|
|
10465
10492
|
// re-update config info
|
|
10466
|
-
(_b = $$.axis) === null || _b ===
|
|
10493
|
+
(_b = $$.axis) === null || _b === void 0 ? void 0 : _b.setOrient();
|
|
10467
10494
|
}
|
|
10468
10495
|
// hide possible reset zoom button
|
|
10469
10496
|
// https://github.com/naver/billboard.js/issues/2201
|
|
10470
|
-
zoomResetBtn === null || zoomResetBtn ===
|
|
10497
|
+
zoomResetBtn === null || zoomResetBtn === void 0 ? void 0 : zoomResetBtn.style("display", "none");
|
|
10471
10498
|
$$.scale.zoom = null;
|
|
10472
10499
|
soft ?
|
|
10473
10500
|
$$.redraw({
|
|
@@ -10502,8 +10529,9 @@ var apiChart = {
|
|
|
10502
10529
|
*/
|
|
10503
10530
|
destroy: function () {
|
|
10504
10531
|
var _this = this;
|
|
10532
|
+
var _a;
|
|
10505
10533
|
var $$ = this.internal;
|
|
10506
|
-
var
|
|
10534
|
+
var _b = $$.$el, chart = _b.chart, style = _b.style, svg = _b.svg;
|
|
10507
10535
|
if (notEmpty($$)) {
|
|
10508
10536
|
$$.callPluginHook("$willDestroy");
|
|
10509
10537
|
$$.charts.splice($$.charts.indexOf(this), 1);
|
|
@@ -10512,6 +10540,7 @@ var apiChart = {
|
|
|
10512
10540
|
// clear timers && pending transition
|
|
10513
10541
|
svg.select("*").interrupt();
|
|
10514
10542
|
$$.resizeFunction.clear();
|
|
10543
|
+
(_a = $$.resizeFunction.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
10515
10544
|
win.removeEventListener("resize", $$.resizeFunction);
|
|
10516
10545
|
chart.classed("bb", false)
|
|
10517
10546
|
.style("position", null)
|
|
@@ -10572,7 +10601,7 @@ var apiChart = {
|
|
|
10572
10601
|
config: function (name, value, redraw) {
|
|
10573
10602
|
var $$ = this.internal;
|
|
10574
10603
|
var config = $$.config, state = $$.state;
|
|
10575
|
-
var key = name === null || name ===
|
|
10604
|
+
var key = name === null || name === void 0 ? void 0 : name.replace(/\./g, "_");
|
|
10576
10605
|
var res;
|
|
10577
10606
|
if (name && key in config) {
|
|
10578
10607
|
if (isDefined(value)) {
|
|
@@ -10673,7 +10702,7 @@ extend(data, {
|
|
|
10673
10702
|
* // --> [10, 20, 30, 40]
|
|
10674
10703
|
*/
|
|
10675
10704
|
values: function (targetIds, flat) {
|
|
10676
|
-
if (flat ===
|
|
10705
|
+
if (flat === void 0) { flat = true; }
|
|
10677
10706
|
var values = null;
|
|
10678
10707
|
if (targetIds) {
|
|
10679
10708
|
var targets = this.data(targetIds);
|
|
@@ -10796,7 +10825,7 @@ var apiData = { data: data };
|
|
|
10796
10825
|
*/
|
|
10797
10826
|
var b64EncodeUnicode = function (str) {
|
|
10798
10827
|
var _a;
|
|
10799
|
-
return (_a = win.btoa) === null || _a ===
|
|
10828
|
+
return (_a = win.btoa) === null || _a === void 0 ? void 0 : _a.call(win, encodeURIComponent(str)
|
|
10800
10829
|
.replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x".concat(p))); }));
|
|
10801
10830
|
};
|
|
10802
10831
|
/**
|
|
@@ -10831,7 +10860,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
10831
10860
|
var styleXml = serializer.serializeToString(style);
|
|
10832
10861
|
// foreignObject not supported in IE11 and below
|
|
10833
10862
|
// https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx
|
|
10834
|
-
var dataStr = "<svg xmlns=\"".concat(namespaces.svg, "\" width=\"").concat(width, "\" height=\"").concat(height, "\" \n\t\tviewBox=\"0 0 ").concat(orgSize.width, " ").concat(orgSize.height, "\" \n\t\tpreserveAspectRatio=\"").concat((option === null || option ===
|
|
10863
|
+
var dataStr = "<svg xmlns=\"".concat(namespaces.svg, "\" width=\"").concat(width, "\" height=\"").concat(height, "\" \n\t\tviewBox=\"0 0 ").concat(orgSize.width, " ").concat(orgSize.height, "\" \n\t\tpreserveAspectRatio=\"").concat((option === null || option === void 0 ? void 0 : option.preserveAspectRatio) === false ? "none" : "xMinYMid meet", "\">\n\t\t\t<foreignObject width=\"100%\" height=\"100%\">\n\t\t\t\t").concat(styleXml, "\n\t\t\t\t").concat(nodeXml.replace(/(url\()[^#]+/g, "$1"), "\n\t\t\t</foreignObject></svg>");
|
|
10835
10864
|
return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr));
|
|
10836
10865
|
}
|
|
10837
10866
|
/**
|
|
@@ -11448,7 +11477,7 @@ function showHide(show, targetIdsValue, options) {
|
|
|
11448
11477
|
// https://github.com/naver/billboard.js/issues/1758
|
|
11449
11478
|
if (!show && hiddenIds.length === 0) {
|
|
11450
11479
|
targets.style("display", "none");
|
|
11451
|
-
callFn((_a = $$.config) === null || _a ===
|
|
11480
|
+
callFn((_a = $$.config) === null || _a === void 0 ? void 0 : _a.data_onhidden, _this, targetIds);
|
|
11452
11481
|
}
|
|
11453
11482
|
targets.style("opacity", opacity);
|
|
11454
11483
|
});
|
|
@@ -11481,7 +11510,7 @@ var apiShow = {
|
|
|
11481
11510
|
* chart.show(["data1", "data3"]);
|
|
11482
11511
|
*/
|
|
11483
11512
|
show: function (targetIdsValue, options) {
|
|
11484
|
-
if (options ===
|
|
11513
|
+
if (options === void 0) { options = {}; }
|
|
11485
11514
|
showHide.call(this, true, targetIdsValue, options);
|
|
11486
11515
|
},
|
|
11487
11516
|
/**
|
|
@@ -11504,7 +11533,7 @@ var apiShow = {
|
|
|
11504
11533
|
* chart.hide(["data1", "data3"]);
|
|
11505
11534
|
*/
|
|
11506
11535
|
hide: function (targetIdsValue, options) {
|
|
11507
|
-
if (options ===
|
|
11536
|
+
if (options === void 0) { options = {}; }
|
|
11508
11537
|
showHide.call(this, false, targetIdsValue, options);
|
|
11509
11538
|
},
|
|
11510
11539
|
/**
|
|
@@ -11528,7 +11557,7 @@ var apiShow = {
|
|
|
11528
11557
|
*/
|
|
11529
11558
|
toggle: function (targetIds, options) {
|
|
11530
11559
|
var _this = this;
|
|
11531
|
-
if (options ===
|
|
11560
|
+
if (options === void 0) { options = {}; }
|
|
11532
11561
|
var $$ = this.internal;
|
|
11533
11562
|
var targets = { show: [], hide: [] };
|
|
11534
11563
|
// sort show & hide target ids
|
|
@@ -11624,7 +11653,7 @@ var tooltip = {
|
|
|
11624
11653
|
// determine focus data
|
|
11625
11654
|
if (args.data) {
|
|
11626
11655
|
var data = args.data;
|
|
11627
|
-
var y = (_a = $$.getYScaleById(data.id)) === null || _a ===
|
|
11656
|
+
var y = (_a = $$.getYScaleById(data.id)) === null || _a === void 0 ? void 0 : _a(data.value);
|
|
11628
11657
|
if ((hasFunnel || hasTreemap) && data.id) {
|
|
11629
11658
|
var selector = $$.selectorTarget(data.id, undefined, ".".concat($SHAPE.shape));
|
|
11630
11659
|
eventReceiver.rect = $el.main.select(selector);
|
|
@@ -11637,8 +11666,8 @@ var tooltip = {
|
|
|
11637
11666
|
if (!config.tooltip_grouped) {
|
|
11638
11667
|
mouse = [0, y];
|
|
11639
11668
|
}
|
|
11640
|
-
index = (_b = data.index) !== null && _b !==
|
|
11641
|
-
(_c = $$.getArcElementByIdOrIndex(data.id)) === null || _c ===
|
|
11669
|
+
index = (_b = data.index) !== null && _b !== void 0 ? _b : ($$.hasArcType() && data.id ?
|
|
11670
|
+
(_c = $$.getArcElementByIdOrIndex(data.id)) === null || _c === void 0 ? void 0 : _c.datum().index :
|
|
11642
11671
|
$$.getIndexByX(data.x));
|
|
11643
11672
|
}
|
|
11644
11673
|
}
|
|
@@ -11662,7 +11691,7 @@ var tooltip = {
|
|
|
11662
11691
|
var _a, _b, _c;
|
|
11663
11692
|
var $$ = this.internal;
|
|
11664
11693
|
var inputType = $$.state.inputType, tooltip = $$.$el.tooltip;
|
|
11665
|
-
var data = tooltip === null || tooltip ===
|
|
11694
|
+
var data = tooltip === null || tooltip === void 0 ? void 0 : tooltip.datum();
|
|
11666
11695
|
if (data) {
|
|
11667
11696
|
var index_1 = JSON.parse(data.current)[0].index;
|
|
11668
11697
|
// make to finalize, possible pending event flow set from '.tooltip.show()' call
|
|
@@ -11673,9 +11702,9 @@ var tooltip = {
|
|
|
11673
11702
|
// reset last touch point index
|
|
11674
11703
|
inputType === "touch" && $$.callOverOutForTouch();
|
|
11675
11704
|
$$.hideTooltip(true);
|
|
11676
|
-
(_a = $$.hideGridFocus) === null || _a ===
|
|
11677
|
-
(_b = $$.unexpandCircles) === null || _b ===
|
|
11678
|
-
(_c = $$.expandBarTypeShapes) === null || _c ===
|
|
11705
|
+
(_a = $$.hideGridFocus) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
11706
|
+
(_b = $$.unexpandCircles) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
11707
|
+
(_c = $$.expandBarTypeShapes) === null || _c === void 0 ? void 0 : _c.call($$, false);
|
|
11679
11708
|
}
|
|
11680
11709
|
};
|
|
11681
11710
|
var apiTooltip = { tooltip: tooltip };
|
|
@@ -12528,7 +12557,7 @@ var apiGroup = {
|
|
|
12528
12557
|
* @private
|
|
12529
12558
|
*/
|
|
12530
12559
|
function regionsFn(regions, isAdd) {
|
|
12531
|
-
if (isAdd ===
|
|
12560
|
+
if (isAdd === void 0) { isAdd = false; }
|
|
12532
12561
|
var $$ = this.internal;
|
|
12533
12562
|
var config = $$.config;
|
|
12534
12563
|
var withTransition = config.transition_duration && isTabVisible();
|
|
@@ -12545,7 +12574,7 @@ function regionsFn(regions, isAdd) {
|
|
|
12545
12574
|
* @function regions
|
|
12546
12575
|
* @instance
|
|
12547
12576
|
* @memberof Chart
|
|
12548
|
-
* @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as regions.
|
|
12577
|
+
* @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as [regions](./Options.html#.regions) option.
|
|
12549
12578
|
* @returns {Array} regions
|
|
12550
12579
|
* @example
|
|
12551
12580
|
* // Show 2 regions
|
|
@@ -12573,7 +12602,7 @@ extend(regions, {
|
|
|
12573
12602
|
* @function regions․add
|
|
12574
12603
|
* @instance
|
|
12575
12604
|
* @memberof Chart
|
|
12576
|
-
* @param {Array|object} regions New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
|
|
12605
|
+
* @param {Array|object} regions New region will be added. The format of this argument is the same as [regions](./Options.html#.regions) and it's possible to give an Object if only one region will be added.
|
|
12577
12606
|
* @returns {Array} regions
|
|
12578
12607
|
* @example
|
|
12579
12608
|
* // Add a new region
|
|
@@ -12746,7 +12775,7 @@ var AxisRendererHelper = /** @class */ (function () {
|
|
|
12746
12775
|
* @private
|
|
12747
12776
|
*/
|
|
12748
12777
|
AxisRendererHelper.getSizeFor1Char = function (text, memoize) {
|
|
12749
|
-
if (memoize ===
|
|
12778
|
+
if (memoize === void 0) { memoize = true; }
|
|
12750
12779
|
// default size for one character
|
|
12751
12780
|
var size = {
|
|
12752
12781
|
w: 5.5,
|
|
@@ -12874,7 +12903,7 @@ var AxisRendererHelper = /** @class */ (function () {
|
|
|
12874
12903
|
|
|
12875
12904
|
var AxisRenderer = /** @class */ (function () {
|
|
12876
12905
|
function AxisRenderer(params) {
|
|
12877
|
-
if (params ===
|
|
12906
|
+
if (params === void 0) { params = {}; }
|
|
12878
12907
|
var config = {
|
|
12879
12908
|
innerTickSize: 6,
|
|
12880
12909
|
outerTickSize: params.outerTick ? 6 : 0,
|
|
@@ -13060,7 +13089,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
13060
13089
|
*/
|
|
13061
13090
|
AxisRenderer.prototype.getGeneratedTicks = function (count) {
|
|
13062
13091
|
var _a;
|
|
13063
|
-
var len = ((_a = this.generatedTicks) === null || _a ===
|
|
13092
|
+
var len = ((_a = this.generatedTicks) === null || _a === void 0 ? void 0 : _a.length) - 1;
|
|
13064
13093
|
var res = this.generatedTicks;
|
|
13065
13094
|
if (len > count) {
|
|
13066
13095
|
var interval_1 = Math.round((len / count) + 0.1);
|
|
@@ -13274,7 +13303,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
13274
13303
|
interval = tickOffset * 2;
|
|
13275
13304
|
}
|
|
13276
13305
|
else {
|
|
13277
|
-
var scale_1 = (_a = this.params.owner.scale.zoom) !== null && _a !==
|
|
13306
|
+
var scale_1 = (_a = this.params.owner.scale.zoom) !== null && _a !== void 0 ? _a : this.helper.scale;
|
|
13278
13307
|
var length_1 = this.g.select("path.domain")
|
|
13279
13308
|
.node()
|
|
13280
13309
|
.getTotalLength() - outerTickSize * 2;
|
|
@@ -13375,18 +13404,18 @@ var Axis = /** @class */ (function () {
|
|
|
13375
13404
|
return !this.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));
|
|
13376
13405
|
};
|
|
13377
13406
|
Axis.prototype.isTimeSeries = function (id) {
|
|
13378
|
-
if (id ===
|
|
13407
|
+
if (id === void 0) { id = "x"; }
|
|
13379
13408
|
return this.owner.config["axis_".concat(id, "_type")] === "timeseries";
|
|
13380
13409
|
};
|
|
13381
13410
|
Axis.prototype.isLog = function (id) {
|
|
13382
|
-
if (id ===
|
|
13411
|
+
if (id === void 0) { id = "x"; }
|
|
13383
13412
|
return this.owner.config["axis_".concat(id, "_type")] === "log";
|
|
13384
13413
|
};
|
|
13385
13414
|
Axis.prototype.isTimeSeriesY = function () {
|
|
13386
13415
|
return this.isTimeSeries("y");
|
|
13387
13416
|
};
|
|
13388
13417
|
Axis.prototype.getAxisType = function (id) {
|
|
13389
|
-
if (id ===
|
|
13418
|
+
if (id === void 0) { id = "x"; }
|
|
13390
13419
|
var type = "linear";
|
|
13391
13420
|
if (this.isTimeSeries(id)) {
|
|
13392
13421
|
type = this.owner.config.axis_x_localtime ? "time" : "utc";
|
|
@@ -13420,12 +13449,10 @@ var Axis = /** @class */ (function () {
|
|
|
13420
13449
|
var _this = this;
|
|
13421
13450
|
var $$ = this.owner;
|
|
13422
13451
|
var config = $$.config, _a = $$.$el, main = _a.main, axis = _a.axis, clip = $$.state.clip;
|
|
13423
|
-
var isRotated = config.axis_rotated;
|
|
13424
13452
|
var target = ["x", "y"];
|
|
13425
13453
|
config.axis_y2_show && target.push("y2");
|
|
13426
13454
|
target.forEach(function (v) {
|
|
13427
13455
|
var classAxis = _this.getAxisClassName(v);
|
|
13428
|
-
var classLabel = $AXIS["axis".concat(v.toUpperCase(), "Label")];
|
|
13429
13456
|
axis[v] = main.append("g")
|
|
13430
13457
|
.attr("class", classAxis)
|
|
13431
13458
|
.attr("clip-path", function () {
|
|
@@ -13440,13 +13467,8 @@ var Axis = /** @class */ (function () {
|
|
|
13440
13467
|
})
|
|
13441
13468
|
.attr("transform", $$.getTranslate(v))
|
|
13442
13469
|
.style("visibility", config["axis_".concat(v, "_show")] ? null : "hidden");
|
|
13443
|
-
axis[v].append("text")
|
|
13444
|
-
.attr("class", classLabel)
|
|
13445
|
-
.attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated])
|
|
13446
|
-
.style("text-anchor", function () { return _this.textAnchorForAxisLabel(v); });
|
|
13447
13470
|
_this.generateAxes(v);
|
|
13448
13471
|
});
|
|
13449
|
-
config.axis_tooltip && this.setAxisTooltip();
|
|
13450
13472
|
};
|
|
13451
13473
|
/**
|
|
13452
13474
|
* Set axis orient according option value
|
|
@@ -13638,7 +13660,7 @@ var Axis = /** @class */ (function () {
|
|
|
13638
13660
|
}
|
|
13639
13661
|
else if (this.x) {
|
|
13640
13662
|
this.x.tickValues(values);
|
|
13641
|
-
(_a = this.subX) === null || _a ===
|
|
13663
|
+
(_a = this.subX) === null || _a === void 0 ? void 0 : _a.tickValues(values);
|
|
13642
13664
|
}
|
|
13643
13665
|
return values;
|
|
13644
13666
|
};
|
|
@@ -13738,18 +13760,6 @@ var Axis = /** @class */ (function () {
|
|
|
13738
13760
|
}
|
|
13739
13761
|
return x;
|
|
13740
13762
|
};
|
|
13741
|
-
Axis.prototype.dxForAxisLabel = function (id) {
|
|
13742
|
-
var $$ = this.owner;
|
|
13743
|
-
var position = this.getAxisLabelPosition(id);
|
|
13744
|
-
var dx = position.isBottom ? "0.5em" : "0";
|
|
13745
|
-
if (this.isHorizontal($$, id !== "x")) {
|
|
13746
|
-
dx = position.isLeft ? "0.5em" : (position.isRight ? "-0.5em" : "0");
|
|
13747
|
-
}
|
|
13748
|
-
else if (position.isTop) {
|
|
13749
|
-
dx = "-0.5em";
|
|
13750
|
-
}
|
|
13751
|
-
return dx;
|
|
13752
|
-
};
|
|
13753
13763
|
Axis.prototype.textAnchorForAxisLabel = function (id) {
|
|
13754
13764
|
var $$ = this.owner;
|
|
13755
13765
|
var position = this.getAxisLabelPosition(id);
|
|
@@ -13762,6 +13772,18 @@ var Axis = /** @class */ (function () {
|
|
|
13762
13772
|
}
|
|
13763
13773
|
return anchor;
|
|
13764
13774
|
};
|
|
13775
|
+
Axis.prototype.dxForAxisLabel = function (id) {
|
|
13776
|
+
var $$ = this.owner;
|
|
13777
|
+
var position = this.getAxisLabelPosition(id);
|
|
13778
|
+
var dx = position.isBottom ? "0.5em" : "0";
|
|
13779
|
+
if (this.isHorizontal($$, id !== "x")) {
|
|
13780
|
+
dx = position.isLeft ? "0.5em" : (position.isRight ? "-0.5em" : "0");
|
|
13781
|
+
}
|
|
13782
|
+
else if (position.isTop) {
|
|
13783
|
+
dx = "-0.5em";
|
|
13784
|
+
}
|
|
13785
|
+
return dx;
|
|
13786
|
+
};
|
|
13765
13787
|
Axis.prototype.dyForAxisLabel = function (id) {
|
|
13766
13788
|
var $$ = this.owner;
|
|
13767
13789
|
var config = $$.config;
|
|
@@ -13948,24 +13970,37 @@ var Axis = /** @class */ (function () {
|
|
|
13948
13970
|
}
|
|
13949
13971
|
return maxOverflow + tickOffset;
|
|
13950
13972
|
};
|
|
13973
|
+
/**
|
|
13974
|
+
* Update axis label text
|
|
13975
|
+
* @param {boolean} withTransition Weather update with transition
|
|
13976
|
+
* @private
|
|
13977
|
+
*/
|
|
13951
13978
|
Axis.prototype.updateLabels = function (withTransition) {
|
|
13952
13979
|
var _this = this;
|
|
13953
13980
|
var $$ = this.owner;
|
|
13954
|
-
var main = $$.$el.main, $T = $$.$T;
|
|
13955
|
-
var
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13981
|
+
var config = $$.config, main = $$.$el.main, $T = $$.$T;
|
|
13982
|
+
var isRotated = config.axis_rotated;
|
|
13983
|
+
["x", "y", "y2"].forEach(function (id) {
|
|
13984
|
+
var text = _this.getLabelText(id);
|
|
13985
|
+
var selector = "axis".concat(capitalize(id));
|
|
13986
|
+
var classLabel = $AXIS["".concat(selector, "Label")];
|
|
13987
|
+
if (text) {
|
|
13988
|
+
var axisLabel = main.select("text.".concat(classLabel));
|
|
13989
|
+
// generate eleement if not exists
|
|
13990
|
+
if (axisLabel.empty()) {
|
|
13991
|
+
axisLabel = main.select("g.".concat($AXIS[selector]))
|
|
13992
|
+
.insert("text", ":first-child")
|
|
13993
|
+
.attr("class", classLabel)
|
|
13994
|
+
.attr("transform", ["rotate(-90)", null][id === "x" ? +!isRotated : +isRotated])
|
|
13995
|
+
.style("text-anchor", function () { return _this.textAnchorForAxisLabel(id); });
|
|
13996
|
+
}
|
|
13997
|
+
// @check $$.$T(node, withTransition)
|
|
13998
|
+
$T(axisLabel, withTransition)
|
|
13999
|
+
.attr("x", function () { return _this.xForAxisLabel(id); })
|
|
14000
|
+
.attr("dx", function () { return _this.dxForAxisLabel(id); })
|
|
14001
|
+
.attr("dy", function () { return _this.dyForAxisLabel(id); })
|
|
14002
|
+
.text(text);
|
|
14003
|
+
}
|
|
13969
14004
|
});
|
|
13970
14005
|
};
|
|
13971
14006
|
/**
|
|
@@ -14001,7 +14036,7 @@ var Axis = /** @class */ (function () {
|
|
|
14001
14036
|
var start = values[0];
|
|
14002
14037
|
var end = values[values.length - 1];
|
|
14003
14038
|
var interval = (end - start) / (count + 1);
|
|
14004
|
-
var tickValue =
|
|
14039
|
+
var tickValue = void 0;
|
|
14005
14040
|
// re-construct unique values
|
|
14006
14041
|
tickValues = [start];
|
|
14007
14042
|
for (var i = 0; i < count; i++) {
|
|
@@ -14026,7 +14061,7 @@ var Axis = /** @class */ (function () {
|
|
|
14026
14061
|
Axis.prototype.redraw = function (transitions, isHidden, isInit) {
|
|
14027
14062
|
var _this = this;
|
|
14028
14063
|
var $$ = this.owner;
|
|
14029
|
-
var config = $$.config, $el = $$.$el;
|
|
14064
|
+
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
14030
14065
|
var opacity = isHidden ? "0" : null;
|
|
14031
14066
|
["x", "y", "y2", "subX"].forEach(function (id) {
|
|
14032
14067
|
var axis = _this[id];
|
|
@@ -14040,6 +14075,7 @@ var Axis = /** @class */ (function () {
|
|
|
14040
14075
|
}
|
|
14041
14076
|
});
|
|
14042
14077
|
this.updateAxes();
|
|
14078
|
+
!state.rendered && config.axis_tooltip && this.setAxisTooltip();
|
|
14043
14079
|
};
|
|
14044
14080
|
/**
|
|
14045
14081
|
* Redraw axis
|
|
@@ -14069,7 +14105,7 @@ var Axis = /** @class */ (function () {
|
|
|
14069
14105
|
}
|
|
14070
14106
|
else if (this.x) {
|
|
14071
14107
|
this.x.tickValues([]);
|
|
14072
|
-
(_a = this.subX) === null || _a ===
|
|
14108
|
+
(_a = this.subX) === null || _a === void 0 ? void 0 : _a.tickValues([]);
|
|
14073
14109
|
}
|
|
14074
14110
|
if (config.zoom_rescale && !flow) {
|
|
14075
14111
|
xDomainForZoom = scale.x.orgDomain();
|
|
@@ -14098,8 +14134,8 @@ var Axis = /** @class */ (function () {
|
|
|
14098
14134
|
}
|
|
14099
14135
|
// Update sub domain
|
|
14100
14136
|
if (wth.Y) {
|
|
14101
|
-
(_b = scale.subY) === null || _b ===
|
|
14102
|
-
(_c = scale.subY2) === null || _c ===
|
|
14137
|
+
(_b = scale.subY) === null || _b === void 0 ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y"));
|
|
14138
|
+
(_c = scale.subY2) === null || _c === void 0 ? void 0 : _c.domain($$.getYDomain(targetsToShow, "y2"));
|
|
14103
14139
|
}
|
|
14104
14140
|
};
|
|
14105
14141
|
/**
|
|
@@ -14161,7 +14197,7 @@ var Axis = /** @class */ (function () {
|
|
|
14161
14197
|
var _a;
|
|
14162
14198
|
var $$ = this.owner;
|
|
14163
14199
|
var _b = $$.config, isRotated = _b.axis_rotated, axis_tooltip = _b.axis_tooltip, _c = $$.$el, axis = _c.axis, axisTooltip = _c.axisTooltip;
|
|
14164
|
-
var bgColor = (_a = axis_tooltip.backgroundColor) !== null && _a !==
|
|
14200
|
+
var bgColor = (_a = axis_tooltip.backgroundColor) !== null && _a !== void 0 ? _a : "black";
|
|
14165
14201
|
$$.generateTextBGColorFilter(bgColor, {
|
|
14166
14202
|
x: -0.15,
|
|
14167
14203
|
y: -0.2,
|
|
@@ -14170,16 +14206,18 @@ var Axis = /** @class */ (function () {
|
|
|
14170
14206
|
});
|
|
14171
14207
|
["x", "y", "y2"].forEach(function (v) {
|
|
14172
14208
|
var _a, _b, _c;
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14209
|
+
if (isString(bgColor) || bgColor[v]) {
|
|
14210
|
+
axisTooltip[v] = (_a = axis[v]) === null || _a === void 0 ? void 0 : _a.append("text").classed($AXIS["axis".concat(v.toUpperCase(), "Tooltip")], true).attr("filter", $$.updateTextBGColor({ id: v }, bgColor));
|
|
14211
|
+
if (isRotated) {
|
|
14212
|
+
var pos = v === "x" ? "x" : "y";
|
|
14213
|
+
var val = v === "y" ? "1.15em" : (v === "x" ? "-0.3em" : "-0.4em");
|
|
14214
|
+
(_b = axisTooltip[v]) === null || _b === void 0 ? void 0 : _b.attr(pos, val).attr("d".concat(v === "x" ? "y" : "x"), v === "x" ? "0.4em" : "-1.3em").style("text-anchor", v === "x" ? "end" : null);
|
|
14215
|
+
}
|
|
14216
|
+
else {
|
|
14217
|
+
var pos = v === "x" ? "y" : "x";
|
|
14218
|
+
var val = v === "x" ? "1.15em" : "".concat(v === "y" ? "-" : "", "0.4em");
|
|
14219
|
+
(_c = axisTooltip[v]) === null || _c === void 0 ? void 0 : _c.attr(pos, val).attr("d".concat(v === "x" ? "x" : "y"), v === "x" ? "-1em" : "0.3em").style("text-anchor", v === "y" ? "end" : null);
|
|
14220
|
+
}
|
|
14183
14221
|
}
|
|
14184
14222
|
});
|
|
14185
14223
|
};
|
|
@@ -14247,7 +14285,7 @@ var eventrect = {
|
|
|
14247
14285
|
// update data's index value to be alinged with the x Axis
|
|
14248
14286
|
$$.updateDataIndexByX(xAxisTickValues);
|
|
14249
14287
|
$$.updateXs(xAxisTickValues);
|
|
14250
|
-
(_a = $$.updatePointClass) === null || _a ===
|
|
14288
|
+
(_a = $$.updatePointClass) === null || _a === void 0 ? void 0 : _a.call($$, true);
|
|
14251
14289
|
state.eventReceiver.data = xAxisTickValues;
|
|
14252
14290
|
}
|
|
14253
14291
|
$$.updateEventRectData();
|
|
@@ -14341,7 +14379,7 @@ var eventrect = {
|
|
|
14341
14379
|
* @private
|
|
14342
14380
|
*/
|
|
14343
14381
|
updateEventRect: function (eventRect, force) {
|
|
14344
|
-
if (force ===
|
|
14382
|
+
if (force === void 0) { force = false; }
|
|
14345
14383
|
var $$ = this;
|
|
14346
14384
|
var state = $$.state, $el = $$.$el;
|
|
14347
14385
|
var eventReceiver = state.eventReceiver, width = state.width, height = state.height, rendered = state.rendered, resizing = state.resizing;
|
|
@@ -14377,10 +14415,10 @@ var eventrect = {
|
|
|
14377
14415
|
var $$ = this;
|
|
14378
14416
|
var isRebindCall = isBoolean(target);
|
|
14379
14417
|
var eventRect = isRebindCall ? $$.$el.eventRect : target;
|
|
14380
|
-
var unbindEvent = isRebindCall ? target !== (eventRect === null || eventRect ===
|
|
14418
|
+
var unbindEvent = isRebindCall ? target !== (eventRect === null || eventRect === void 0 ? void 0 : eventRect.datum().multipleX) : false;
|
|
14381
14419
|
if (eventRect) {
|
|
14382
14420
|
// release previous event listeners
|
|
14383
|
-
unbindEvent && (eventRect === null || eventRect ===
|
|
14421
|
+
unbindEvent && (eventRect === null || eventRect === void 0 ? void 0 : eventRect.on("mouseover mousemove mouseout click", null));
|
|
14384
14422
|
$$.isMultipleX() ?
|
|
14385
14423
|
$$.generateEventRectsForMultipleXs(eventRect) :
|
|
14386
14424
|
$$.generateEventRectsForSingleX(eventRect);
|
|
@@ -14410,7 +14448,7 @@ var eventrect = {
|
|
|
14410
14448
|
}
|
|
14411
14449
|
else {
|
|
14412
14450
|
var rectW_1;
|
|
14413
|
-
var rectX =
|
|
14451
|
+
var rectX = void 0;
|
|
14414
14452
|
if ($$.axis.isCategorized()) {
|
|
14415
14453
|
rectW_1 = $$.getEventRectWidth();
|
|
14416
14454
|
rectX = function (d) { return xScale(d.x) - (rectW_1 / 2); };
|
|
@@ -14440,7 +14478,7 @@ var eventrect = {
|
|
|
14440
14478
|
else {
|
|
14441
14479
|
Object.keys(x).forEach(function (key, i) {
|
|
14442
14480
|
var _a;
|
|
14443
|
-
x[key] = (_a = x[key]) !== null && _a !==
|
|
14481
|
+
x[key] = (_a = x[key]) !== null && _a !== void 0 ? _a : xDomain[i];
|
|
14444
14482
|
});
|
|
14445
14483
|
val = Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2);
|
|
14446
14484
|
}
|
|
@@ -14497,7 +14535,7 @@ var eventrect = {
|
|
|
14497
14535
|
var selectedData = $$.getAllValuesOnIndex(index);
|
|
14498
14536
|
if (isTooltipGrouped) {
|
|
14499
14537
|
$$.showTooltip(selectedData, context);
|
|
14500
|
-
(_a = $$.showGridFocus) === null || _a ===
|
|
14538
|
+
(_a = $$.showGridFocus) === null || _a === void 0 ? void 0 : _a.call($$, selectedData);
|
|
14501
14539
|
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
14502
14540
|
return;
|
|
14503
14541
|
}
|
|
@@ -14512,7 +14550,7 @@ var eventrect = {
|
|
|
14512
14550
|
return $$.isWithinShape(this, d);
|
|
14513
14551
|
});
|
|
14514
14552
|
if (shapeAtIndex.empty() && !isTooltipGrouped && config.interaction_onout) {
|
|
14515
|
-
(_b = $$.hideGridFocus) === null || _b ===
|
|
14553
|
+
(_b = $$.hideGridFocus) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
14516
14554
|
$$.hideTooltip();
|
|
14517
14555
|
!isSelectionGrouped && $$.setExpand(index);
|
|
14518
14556
|
}
|
|
@@ -14521,13 +14559,13 @@ var eventrect = {
|
|
|
14521
14559
|
var _a, _b;
|
|
14522
14560
|
var d = selected.data();
|
|
14523
14561
|
if (isSelectionEnabled &&
|
|
14524
|
-
(isSelectionGrouped || (isSelectable === null || isSelectable ===
|
|
14562
|
+
(isSelectionGrouped || (isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d)))) {
|
|
14525
14563
|
context.style.cursor = "pointer";
|
|
14526
14564
|
}
|
|
14527
14565
|
if (!isTooltipGrouped) {
|
|
14528
14566
|
$$.showTooltip(d, context);
|
|
14529
|
-
(_a = $$.showGridFocus) === null || _a ===
|
|
14530
|
-
(_b = $$.unexpandCircles) === null || _b ===
|
|
14567
|
+
(_a = $$.showGridFocus) === null || _a === void 0 ? void 0 : _a.call($$, d);
|
|
14568
|
+
(_b = $$.unexpandCircles) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
14531
14569
|
selected.each(function (d) { return $$.setExpand(index, d.id); });
|
|
14532
14570
|
}
|
|
14533
14571
|
});
|
|
@@ -14539,7 +14577,7 @@ var eventrect = {
|
|
|
14539
14577
|
* @private
|
|
14540
14578
|
*/
|
|
14541
14579
|
selectRectForMultipleXs: function (context, triggerEvent) {
|
|
14542
|
-
if (triggerEvent ===
|
|
14580
|
+
if (triggerEvent === void 0) { triggerEvent = true; }
|
|
14543
14581
|
var $$ = this;
|
|
14544
14582
|
var config = $$.config, state = $$.state;
|
|
14545
14583
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
@@ -14623,7 +14661,7 @@ var eventrect = {
|
|
|
14623
14661
|
state.event = event;
|
|
14624
14662
|
$$.updateEventRect();
|
|
14625
14663
|
Object.values($$.$el.axisTooltip)
|
|
14626
|
-
.forEach(function (v) { return v === null || v ===
|
|
14664
|
+
.forEach(function (v) { return v === null || v === void 0 ? void 0 : v.style("display", null); });
|
|
14627
14665
|
})
|
|
14628
14666
|
.on("mousemove", function (event) {
|
|
14629
14667
|
var d = getData_1(event);
|
|
@@ -14691,7 +14729,7 @@ var eventrect = {
|
|
|
14691
14729
|
.each(function (d2) {
|
|
14692
14730
|
var _a;
|
|
14693
14731
|
if (config.data_selection_grouped || $$.isWithinShape(this, d2)) {
|
|
14694
|
-
(_a = $$.toggleShape) === null || _a ===
|
|
14732
|
+
(_a = $$.toggleShape) === null || _a === void 0 ? void 0 : _a.call($$, this, d2, index);
|
|
14695
14733
|
config.data_onclick.bind($$.api)(d2, this);
|
|
14696
14734
|
}
|
|
14697
14735
|
});
|
|
@@ -14747,7 +14785,7 @@ var eventrect = {
|
|
|
14747
14785
|
.each(function () {
|
|
14748
14786
|
var _a;
|
|
14749
14787
|
if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
|
|
14750
|
-
(_a = $$.toggleShape) === null || _a ===
|
|
14788
|
+
(_a = $$.toggleShape) === null || _a === void 0 ? void 0 : _a.call($$, this, closest, closest.index);
|
|
14751
14789
|
config.data_onclick.bind($$.api)(closest, this);
|
|
14752
14790
|
}
|
|
14753
14791
|
});
|
|
@@ -14800,7 +14838,7 @@ var flow = {
|
|
|
14800
14838
|
if (node && name.length > 1) {
|
|
14801
14839
|
node = node[name[1]];
|
|
14802
14840
|
}
|
|
14803
|
-
if (node === null || node ===
|
|
14841
|
+
if (node === null || node === void 0 ? void 0 : node.size()) {
|
|
14804
14842
|
elements[v] = node;
|
|
14805
14843
|
}
|
|
14806
14844
|
});
|
|
@@ -14817,7 +14855,7 @@ var flow = {
|
|
|
14817
14855
|
setFlowList: function (elements, args) {
|
|
14818
14856
|
var $$ = this;
|
|
14819
14857
|
var flow = args.flow, targets = args.targets;
|
|
14820
|
-
var _a = flow.duration, duration = _a ===
|
|
14858
|
+
var _a = flow.duration, duration = _a === void 0 ? args.duration : _a, flowIndex = flow.index, flowLength = flow.length, orgDataCount = flow.orgDataCount;
|
|
14821
14859
|
var transform = $$.getFlowTransform(targets, orgDataCount, flowIndex, flowLength);
|
|
14822
14860
|
var wait = generateWait();
|
|
14823
14861
|
var n;
|
|
@@ -14856,7 +14894,7 @@ var flow = {
|
|
|
14856
14894
|
var isRotated = config.axis_rotated;
|
|
14857
14895
|
var flow = args.flow, shape = args.shape, xv = args.xv;
|
|
14858
14896
|
var _a = shape.pos, cx = _a.cx, cy = _a.cy, xForText = _a.xForText, yForText = _a.yForText;
|
|
14859
|
-
var _b = flow.done, done = _b ===
|
|
14897
|
+
var _b = flow.done, done = _b === void 0 ? function () { } : _b, flowLength = flow.length;
|
|
14860
14898
|
// Remove flowed elements
|
|
14861
14899
|
if (flowLength) {
|
|
14862
14900
|
["circle", "text", "shape", "eventRect"].forEach(function (v) {
|
|
@@ -14951,13 +14989,13 @@ var flow = {
|
|
|
14951
14989
|
}
|
|
14952
14990
|
}
|
|
14953
14991
|
}
|
|
14954
|
-
else if (orgDataCount === 1 || (flowStart === null || flowStart ===
|
|
14992
|
+
else if (orgDataCount === 1 || (flowStart === null || flowStart === void 0 ? void 0 : flowStart.x) === (flowEnd === null || flowEnd === void 0 ? void 0 : flowEnd.x)) {
|
|
14955
14993
|
translateX = x(orgDomain[0]) - x(domain[0]);
|
|
14956
14994
|
}
|
|
14957
14995
|
else {
|
|
14958
14996
|
translateX = $$.axis.isTimeSeries() ?
|
|
14959
14997
|
x(orgDomain[0]) - x(domain[0]) :
|
|
14960
|
-
x((flowStart === null || flowStart ===
|
|
14998
|
+
x((flowStart === null || flowStart === void 0 ? void 0 : flowStart.x) || 0) - x(flowEnd.x);
|
|
14961
14999
|
}
|
|
14962
15000
|
var scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
|
14963
15001
|
return "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
|
@@ -15263,7 +15301,7 @@ var grid = {
|
|
|
15263
15301
|
.attr("dy", -5))
|
|
15264
15302
|
.text(function (d) {
|
|
15265
15303
|
var _a;
|
|
15266
|
-
return (_a = d.text) !== null && _a !==
|
|
15304
|
+
return (_a = d.text) !== null && _a !== void 0 ? _a : this.remove();
|
|
15267
15305
|
});
|
|
15268
15306
|
gridLines[type] = lines;
|
|
15269
15307
|
},
|
|
@@ -15337,19 +15375,19 @@ var grid = {
|
|
|
15337
15375
|
var config = $$.config, format = $$.format, _c = $$.state, event = _c.event, width = _c.width, height = _c.height;
|
|
15338
15376
|
var isRotated = config.axis_rotated;
|
|
15339
15377
|
// get mouse event position
|
|
15340
|
-
var _d = getPointer(event, (_a = $$.$el.eventRect) === null || _a ===
|
|
15378
|
+
var _d = getPointer(event, (_a = $$.$el.eventRect) === null || _a === void 0 ? void 0 : _a.node()), x = _d[0], y = _d[1];
|
|
15341
15379
|
var pos = { x: x, y: y };
|
|
15342
15380
|
for (var _i = 0, _e = Object.entries($$.$el.axisTooltip); _i < _e.length; _i++) {
|
|
15343
15381
|
var _f = _e[_i], axis = _f[0], node = _f[1];
|
|
15344
15382
|
var attr = (axis === "x" && !isRotated) || (axis !== "x" && isRotated) ? "x" : "y";
|
|
15345
15383
|
var value = pos[attr];
|
|
15346
|
-
var scaleText = (_b = $$.scale[axis]) === null || _b ===
|
|
15384
|
+
var scaleText = (_b = $$.scale[axis]) === null || _b === void 0 ? void 0 : _b.invert(value);
|
|
15347
15385
|
if (scaleText) {
|
|
15348
15386
|
scaleText = axis === "x" && $$.axis.isTimeSeries() ?
|
|
15349
15387
|
format.xAxisTick(scaleText) :
|
|
15350
|
-
scaleText === null || scaleText ===
|
|
15388
|
+
scaleText === null || scaleText === void 0 ? void 0 : scaleText.toFixed(2);
|
|
15351
15389
|
// set position & its text value based on position
|
|
15352
|
-
node === null || node ===
|
|
15390
|
+
node === null || node === void 0 ? void 0 : node.attr(attr, value).text(scaleText);
|
|
15353
15391
|
}
|
|
15354
15392
|
}
|
|
15355
15393
|
$$.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility", null)
|
|
@@ -15375,7 +15413,7 @@ var grid = {
|
|
|
15375
15413
|
var $$ = this;
|
|
15376
15414
|
$$.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility", "hidden");
|
|
15377
15415
|
Object.values($$.$el.axisTooltip)
|
|
15378
|
-
.forEach(function (v) { return v === null || v ===
|
|
15416
|
+
.forEach(function (v) { return v === null || v === void 0 ? void 0 : v.style("display", "none"); });
|
|
15379
15417
|
},
|
|
15380
15418
|
/**
|
|
15381
15419
|
* Show grid focus line
|
|
@@ -15443,7 +15481,7 @@ var grid = {
|
|
|
15443
15481
|
.forEach(function (v, i) { return el.attr(v, xy[i]); });
|
|
15444
15482
|
});
|
|
15445
15483
|
smoothLines(focusEl);
|
|
15446
|
-
(_a = $$.showCircleFocus) === null || _a ===
|
|
15484
|
+
(_a = $$.showCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$, data);
|
|
15447
15485
|
},
|
|
15448
15486
|
hideGridFocus: function () {
|
|
15449
15487
|
var _a;
|
|
@@ -15452,7 +15490,7 @@ var grid = {
|
|
|
15452
15490
|
if (inputType === "mouse" || !resizing) {
|
|
15453
15491
|
main.selectAll("line.".concat($FOCUS.xgridFocus, ", line.").concat($FOCUS.ygridFocus))
|
|
15454
15492
|
.style("visibility", "hidden");
|
|
15455
|
-
(_a = $$.hideCircleFocus) === null || _a ===
|
|
15493
|
+
(_a = $$.hideCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
15456
15494
|
}
|
|
15457
15495
|
},
|
|
15458
15496
|
updateGridFocus: function () {
|
|
@@ -15462,7 +15500,7 @@ var grid = {
|
|
|
15462
15500
|
var xgridFocus = grid.main.select("line.".concat($FOCUS.xgridFocus));
|
|
15463
15501
|
if (inputType === "touch") {
|
|
15464
15502
|
if (xgridFocus.empty()) {
|
|
15465
|
-
resizing && ((_a = $$.showCircleFocus) === null || _a ===
|
|
15503
|
+
resizing && ((_a = $$.showCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$));
|
|
15466
15504
|
}
|
|
15467
15505
|
else {
|
|
15468
15506
|
$$.showGridFocus();
|
|
@@ -15572,7 +15610,7 @@ var region = {
|
|
|
15572
15610
|
region.list.each(function (d) {
|
|
15573
15611
|
var _a;
|
|
15574
15612
|
var g = select(this);
|
|
15575
|
-
if (g.select("text").empty() && ((_a = d.label) === null || _a ===
|
|
15613
|
+
if (g.select("text").empty() && ((_a = d.label) === null || _a === void 0 ? void 0 : _a.text)) {
|
|
15576
15614
|
select(this).append("text")
|
|
15577
15615
|
.style("opacity", "0");
|
|
15578
15616
|
}
|
|
@@ -15581,23 +15619,48 @@ var region = {
|
|
|
15581
15619
|
redrawRegion: function (withTransition) {
|
|
15582
15620
|
var $$ = this;
|
|
15583
15621
|
var region = $$.$el.region, $T = $$.$T;
|
|
15622
|
+
var regionX = $$.regionX.bind($$);
|
|
15623
|
+
var regionY = $$.regionY.bind($$);
|
|
15624
|
+
var attr = ["width", "height"];
|
|
15584
15625
|
var regions = region.list.select("rect");
|
|
15585
15626
|
var label = region.list.selectAll("text");
|
|
15586
15627
|
regions = $T(regions, withTransition)
|
|
15587
|
-
.attr("x",
|
|
15588
|
-
.attr("y",
|
|
15628
|
+
.attr("x", regionX)
|
|
15629
|
+
.attr("y", regionY)
|
|
15589
15630
|
.attr("width", $$.regionWidth.bind($$))
|
|
15590
15631
|
.attr("height", $$.regionHeight.bind($$));
|
|
15591
15632
|
label = $T(label, withTransition)
|
|
15633
|
+
.text(function (d) { var _a; return (_a = d.label) === null || _a === void 0 ? void 0 : _a.text; })
|
|
15634
|
+
.attr("transform", function (_a) {
|
|
15635
|
+
var label = _a.label;
|
|
15636
|
+
return label.rotated ? " rotate(-90)" : null;
|
|
15637
|
+
})
|
|
15592
15638
|
.attr("transform", function (d) {
|
|
15639
|
+
var _this = this;
|
|
15593
15640
|
var _a;
|
|
15594
|
-
var _b = (_a = d.label) !== null && _a !==
|
|
15595
|
-
|
|
15641
|
+
var _b = (_a = d.label) !== null && _a !== void 0 ? _a : {}, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d, _e = _b.center, center = _e === void 0 ? false : _e, _f = _b.rotated, rotated = _f === void 0 ? false : _f;
|
|
15642
|
+
var rect = this.previousElementSibling;
|
|
15643
|
+
var pos = { x: 0, y: 0 };
|
|
15644
|
+
if (isString(center)) {
|
|
15645
|
+
["x", "y"].forEach(function (v, i) {
|
|
15646
|
+
if (center.indexOf(v) > -1) {
|
|
15647
|
+
pos[v] =
|
|
15648
|
+
(+rect.getAttribute(attr[i]) - getBoundingRect(_this)[attr[i]]) / 2;
|
|
15649
|
+
}
|
|
15650
|
+
});
|
|
15651
|
+
}
|
|
15652
|
+
return "translate(".concat(regionX(d) + pos.x + x, ", ").concat(regionY(d) + pos.y + y, ")").concat(rotated ? " rotate(-90)" : "");
|
|
15653
|
+
})
|
|
15654
|
+
.attr("text-anchor", function (_a) {
|
|
15655
|
+
var label = _a.label;
|
|
15656
|
+
return (label === null || label === void 0 ? void 0 : label.rotated) ? "end" : null;
|
|
15596
15657
|
})
|
|
15597
|
-
.attr("text-anchor", function (d) { var _a; return (((_a = d.label) === null || _a === undefined ? undefined : _a.rotated) ? "end" : null); })
|
|
15598
15658
|
.attr("dy", "1em")
|
|
15599
|
-
.style("fill", function (
|
|
15600
|
-
|
|
15659
|
+
.style("fill", function (_a) {
|
|
15660
|
+
var _b;
|
|
15661
|
+
var label = _a.label;
|
|
15662
|
+
return (_b = label === null || label === void 0 ? void 0 : label.color) !== null && _b !== void 0 ? _b : null;
|
|
15663
|
+
});
|
|
15601
15664
|
return [
|
|
15602
15665
|
regions
|
|
15603
15666
|
.style("fill-opacity", function (d) { return (isValue(d.opacity) ? d.opacity : null); })
|
|
@@ -15610,64 +15673,62 @@ var region = {
|
|
|
15610
15673
|
label.style("opacity", null)
|
|
15611
15674
|
];
|
|
15612
15675
|
},
|
|
15613
|
-
getRegionXY: function (type, d) {
|
|
15614
|
-
var $$ = this;
|
|
15615
|
-
var config = $$.config, scale = $$.scale;
|
|
15616
|
-
var isRotated = config.axis_rotated;
|
|
15617
|
-
var isX = type === "x";
|
|
15618
|
-
var key = "start";
|
|
15619
|
-
var currScale;
|
|
15620
|
-
var pos = 0;
|
|
15621
|
-
if (d.axis === "y" || d.axis === "y2") {
|
|
15622
|
-
if (!isX) {
|
|
15623
|
-
key = "end";
|
|
15624
|
-
}
|
|
15625
|
-
if ((isX ? isRotated : !isRotated) && key in d) {
|
|
15626
|
-
currScale = scale[d.axis];
|
|
15627
|
-
pos = currScale(d[key]);
|
|
15628
|
-
}
|
|
15629
|
-
}
|
|
15630
|
-
else if ((isX ? !isRotated : isRotated) && key in d) {
|
|
15631
|
-
currScale = scale.zoom || scale.x;
|
|
15632
|
-
pos = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
|
|
15633
|
-
}
|
|
15634
|
-
return pos;
|
|
15635
|
-
},
|
|
15636
15676
|
regionX: function (d) {
|
|
15637
|
-
return this.
|
|
15677
|
+
return this.getRegionSize("x", d);
|
|
15638
15678
|
},
|
|
15639
15679
|
regionY: function (d) {
|
|
15640
|
-
return this.
|
|
15680
|
+
return this.getRegionSize("y", d);
|
|
15681
|
+
},
|
|
15682
|
+
regionWidth: function (d) {
|
|
15683
|
+
return this.getRegionSize("width", d);
|
|
15641
15684
|
},
|
|
15685
|
+
regionHeight: function (d) {
|
|
15686
|
+
return this.getRegionSize("height", d);
|
|
15687
|
+
},
|
|
15688
|
+
/**
|
|
15689
|
+
* Get Region size according start/end position
|
|
15690
|
+
* @param {string} type Type string
|
|
15691
|
+
* @param {ojbect} d Data object
|
|
15692
|
+
* @returns {number}
|
|
15693
|
+
* @private
|
|
15694
|
+
*/
|
|
15642
15695
|
getRegionSize: function (type, d) {
|
|
15643
15696
|
var $$ = this;
|
|
15644
15697
|
var config = $$.config, scale = $$.scale, state = $$.state;
|
|
15645
15698
|
var isRotated = config.axis_rotated;
|
|
15646
|
-
var
|
|
15647
|
-
var
|
|
15699
|
+
var isAxisType = /(x|y|y2)/.test(type);
|
|
15700
|
+
var isType = isAxisType ? type === "x" : type === "width";
|
|
15701
|
+
var start = !isAxisType && $$[isType ? "regionX" : "regionY"](d);
|
|
15702
|
+
var key = isAxisType ? "start" : "end";
|
|
15703
|
+
var pos = isAxisType ? 0 : state[type];
|
|
15648
15704
|
var currScale;
|
|
15649
|
-
var key = "end";
|
|
15650
|
-
var end = state[type];
|
|
15651
15705
|
if (d.axis === "y" || d.axis === "y2") {
|
|
15652
|
-
if (!
|
|
15706
|
+
if (!isAxisType && !isType) {
|
|
15653
15707
|
key = "start";
|
|
15654
15708
|
}
|
|
15655
|
-
if (
|
|
15709
|
+
else if (isAxisType && !isType) {
|
|
15710
|
+
key = "end";
|
|
15711
|
+
}
|
|
15712
|
+
if ((isType ? isRotated : !isRotated) && key in d) {
|
|
15656
15713
|
currScale = scale[d.axis];
|
|
15657
|
-
end = currScale(d[key]);
|
|
15658
15714
|
}
|
|
15659
15715
|
}
|
|
15660
|
-
else if ((
|
|
15716
|
+
else if ((isType ? !isRotated : isRotated) && key in d) {
|
|
15661
15717
|
currScale = scale.zoom || scale.x;
|
|
15662
|
-
end = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
|
|
15663
15718
|
}
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15719
|
+
if (currScale) {
|
|
15720
|
+
var offset = 0;
|
|
15721
|
+
pos = d[key];
|
|
15722
|
+
if ($$.axis.isTimeSeries(d.axis)) {
|
|
15723
|
+
pos = parseDate.call($$, pos);
|
|
15724
|
+
}
|
|
15725
|
+
else if (/(x|width)/.test(type) && $$.axis.isCategorized() && isNaN(pos)) {
|
|
15726
|
+
pos = config.axis_x_categories.indexOf(pos);
|
|
15727
|
+
offset = $$.axis.x.tickOffset() * (key === "start" ? -1 : 1);
|
|
15728
|
+
}
|
|
15729
|
+
pos = currScale(pos) + offset;
|
|
15730
|
+
}
|
|
15731
|
+
return isAxisType ? pos : pos < start ? 0 : pos - start;
|
|
15671
15732
|
},
|
|
15672
15733
|
isRegionOnX: function (d) {
|
|
15673
15734
|
return !d.axis || d.axis === "x";
|
|
@@ -15692,10 +15753,10 @@ var sizeAxis = {
|
|
|
15692
15753
|
var _a, _b;
|
|
15693
15754
|
var $$ = this;
|
|
15694
15755
|
if ($$.axis) {
|
|
15695
|
-
var position = (_a = $$.axis) === null || _a ===
|
|
15756
|
+
var position = (_a = $$.axis) === null || _a === void 0 ? void 0 : _a.getLabelPositionById(id);
|
|
15696
15757
|
var width = $$.axis.getMaxTickSize(id, withoutRecompute).width;
|
|
15697
15758
|
var gap = width === 0 ? 0.5 : 0;
|
|
15698
|
-
return width + (((_b = $$.config.padding) === null || _b ===
|
|
15759
|
+
return width + (((_b = $$.config.padding) === null || _b === void 0 ? void 0 : _b.mode) === "fit" ?
|
|
15699
15760
|
position.isInner ? (10 + gap) : 10 :
|
|
15700
15761
|
position.isInner ?
|
|
15701
15762
|
(20 + gap) :
|
|
@@ -15711,11 +15772,11 @@ var sizeAxis = {
|
|
|
15711
15772
|
var config = $$.config, state = $$.state;
|
|
15712
15773
|
var rotatedPadding = state.rotatedPadding, isLegendRight = state.isLegendRight, isLegendInset = state.isLegendInset;
|
|
15713
15774
|
var isRotated = config.axis_rotated;
|
|
15714
|
-
var isFitPadding = ((_a = config.padding) === null || _a ===
|
|
15775
|
+
var isFitPadding = ((_a = config.padding) === null || _a === void 0 ? void 0 : _a.mode) === "fit";
|
|
15715
15776
|
var isInner = config["axis_".concat(id, "_inner")];
|
|
15716
15777
|
var hasLabelText = config["axis_".concat(id, "_label")].text;
|
|
15717
15778
|
var defaultHeight = 13;
|
|
15718
|
-
var h = ((_b = config.padding) === null || _b ===
|
|
15779
|
+
var h = ((_b = config.padding) === null || _b === void 0 ? void 0 : _b.mode) === "fit" ?
|
|
15719
15780
|
(isInner && !hasLabelText ? (id === "y" ? 1 : 0) : 20) :
|
|
15720
15781
|
30;
|
|
15721
15782
|
if (id === "x" && !config.axis_x_show) {
|
|
@@ -17027,6 +17088,18 @@ var y = {
|
|
|
17027
17088
|
* y2 Axis config options
|
|
17028
17089
|
*/
|
|
17029
17090
|
var y2 = {
|
|
17091
|
+
/**
|
|
17092
|
+
* Set clip-path attribute for y2 axis element
|
|
17093
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
17094
|
+
* @name axis․y2․clipPath
|
|
17095
|
+
* @memberof Options
|
|
17096
|
+
* @type {boolean}
|
|
17097
|
+
* @default true
|
|
17098
|
+
* @example
|
|
17099
|
+
* // don't set 'clip-path' attribute
|
|
17100
|
+
* clipPath: false
|
|
17101
|
+
*/
|
|
17102
|
+
axis_y2_clipPath: true,
|
|
17030
17103
|
/**
|
|
17031
17104
|
* Show or hide y2 axis.
|
|
17032
17105
|
* - **NOTE**:
|
|
@@ -17808,7 +17881,7 @@ var options = {
|
|
|
17808
17881
|
* @private
|
|
17809
17882
|
*/
|
|
17810
17883
|
function getRadiusFn(expandRate) {
|
|
17811
|
-
if (expandRate ===
|
|
17884
|
+
if (expandRate === void 0) { expandRate = 0; }
|
|
17812
17885
|
var $$ = this;
|
|
17813
17886
|
var config = $$.config, state = $$.state;
|
|
17814
17887
|
var hasMultiArcGauge = $$.hasMultiArcGauge();
|
|
@@ -17866,7 +17939,7 @@ function getRadiusFn(expandRate) {
|
|
|
17866
17939
|
* @private
|
|
17867
17940
|
*/
|
|
17868
17941
|
corner: function (d, outerRadius) {
|
|
17869
|
-
var _a = config.arc_cornerRadius_ratio, ratio = _a ===
|
|
17942
|
+
var _a = config.arc_cornerRadius_ratio, ratio = _a === void 0 ? 0 : _a, _b = config.arc_cornerRadius, cornerRadius = _b === void 0 ? 0 : _b;
|
|
17870
17943
|
var id = d.data.id, value = d.value;
|
|
17871
17944
|
var corner = 0;
|
|
17872
17945
|
if (ratio) {
|
|
@@ -17890,7 +17963,7 @@ function getRadiusFn(expandRate) {
|
|
|
17890
17963
|
function getAttrTweenFn(fn) {
|
|
17891
17964
|
return function (d) {
|
|
17892
17965
|
var getAngleKeyValue = function (_a) {
|
|
17893
|
-
var _b = _a.startAngle, startAngle = _b ===
|
|
17966
|
+
var _b = _a.startAngle, startAngle = _b === void 0 ? 0 : _b, _c = _a.endAngle, endAngle = _c === void 0 ? 0 : _c, _d = _a.padAngle, padAngle = _d === void 0 ? 0 : _d;
|
|
17894
17967
|
return ({
|
|
17895
17968
|
startAngle: startAngle,
|
|
17896
17969
|
endAngle: endAngle,
|
|
@@ -17921,7 +17994,7 @@ var shapeArc = {
|
|
|
17921
17994
|
.startAngle(startingAngle)
|
|
17922
17995
|
.endAngle(startingAngle + (2 * Math.PI))
|
|
17923
17996
|
.padAngle(padAngle)
|
|
17924
|
-
.value(function (d) { var _a, _b; return (_b = (_a = d.values) === null || _a ===
|
|
17997
|
+
.value(function (d) { var _a, _b; return (_b = (_a = d.values) === null || _a === void 0 ? void 0 : _a.reduce(function (a, b) { return a + b.value; }, 0)) !== null && _b !== void 0 ? _b : d; })
|
|
17925
17998
|
.sort($$.getSortCompareFn.bind($$)(true));
|
|
17926
17999
|
},
|
|
17927
18000
|
updateRadius: function () {
|
|
@@ -17954,7 +18027,7 @@ var shapeArc = {
|
|
|
17954
18027
|
*/
|
|
17955
18028
|
getRadius: function (d) {
|
|
17956
18029
|
var $$ = this;
|
|
17957
|
-
var data = d === null || d ===
|
|
18030
|
+
var data = d === null || d === void 0 ? void 0 : d.data;
|
|
17958
18031
|
var _a = $$.state, innerRadius = _a.innerRadius, outerRadius = _a.outerRadius;
|
|
17959
18032
|
if (!isNumber(innerRadius) && data) {
|
|
17960
18033
|
innerRadius = innerRadius[data.id] || 0;
|
|
@@ -18014,7 +18087,7 @@ var shapeArc = {
|
|
|
18014
18087
|
*/
|
|
18015
18088
|
updateAngle: function (dValue, forRange) {
|
|
18016
18089
|
var _a;
|
|
18017
|
-
if (forRange ===
|
|
18090
|
+
if (forRange === void 0) { forRange = false; }
|
|
18018
18091
|
var $$ = this;
|
|
18019
18092
|
var config = $$.config, state = $$.state;
|
|
18020
18093
|
var hasGauge = forRange && $$.hasType("gauge");
|
|
@@ -18044,7 +18117,7 @@ var shapeArc = {
|
|
|
18044
18117
|
pie($$.filterTargetsToShow())
|
|
18045
18118
|
.forEach(function (t, i) {
|
|
18046
18119
|
var _a;
|
|
18047
|
-
if (!found && t.data.id === ((_a = d.data) === null || _a ===
|
|
18120
|
+
if (!found && t.data.id === ((_a = d.data) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
18048
18121
|
found = true;
|
|
18049
18122
|
d = t;
|
|
18050
18123
|
d.index = i;
|
|
@@ -18061,7 +18134,7 @@ var shapeArc = {
|
|
|
18061
18134
|
var gMin = config.gauge_min, gMax = config.gauge_max;
|
|
18062
18135
|
var max = forRange && !hasGauge ? $$.getTotalDataSum(state.rendered) : gMax;
|
|
18063
18136
|
var gTic = radius / (max - gMin);
|
|
18064
|
-
var value = (_a = d.value) !== null && _a !==
|
|
18137
|
+
var value = (_a = d.value) !== null && _a !== void 0 ? _a : 0;
|
|
18065
18138
|
var gValue = value < gMin ? 0 : value < max ? value - gMin : (max - gMin);
|
|
18066
18139
|
d.startAngle = gStart;
|
|
18067
18140
|
d.endAngle = gStart + gTic * gValue;
|
|
@@ -18078,7 +18151,7 @@ var shapeArc = {
|
|
|
18078
18151
|
var _a;
|
|
18079
18152
|
var path = "M 0 0";
|
|
18080
18153
|
if (d.value || d.data) {
|
|
18081
|
-
var data = withoutUpdate ? d : (_a = $$.updateAngle(d)) !== null && _a !==
|
|
18154
|
+
var data = withoutUpdate ? d : (_a = $$.updateAngle(d)) !== null && _a !== void 0 ? _a : null;
|
|
18082
18155
|
if (data) {
|
|
18083
18156
|
path = arc$1.cornerRadius(corner(data, outer(data)))(data);
|
|
18084
18157
|
}
|
|
@@ -18096,7 +18169,7 @@ var shapeArc = {
|
|
|
18096
18169
|
* @private
|
|
18097
18170
|
*/
|
|
18098
18171
|
getSvgArcExpanded: function (rate) {
|
|
18099
|
-
if (rate ===
|
|
18172
|
+
if (rate === void 0) { rate = 1; }
|
|
18100
18173
|
var $$ = this;
|
|
18101
18174
|
var _a = getRadiusFn.call($$, rate), inner = _a.inner, outer = _a.outer, corner = _a.corner;
|
|
18102
18175
|
var arc$1 = arc()
|
|
@@ -18125,7 +18198,7 @@ var shapeArc = {
|
|
|
18125
18198
|
var format = config.arc_rangeText_format;
|
|
18126
18199
|
var fixed = $$.hasType("gauge") && config.arc_rangeText_fixed;
|
|
18127
18200
|
var values = config.arc_rangeText_values;
|
|
18128
|
-
if (values === null || values ===
|
|
18201
|
+
if (values === null || values === void 0 ? void 0 : values.length) {
|
|
18129
18202
|
var isPercent_1 = config.arc_rangeText_unit === "%";
|
|
18130
18203
|
var totalSum_1 = $$.getTotalDataSum(state.rendered);
|
|
18131
18204
|
if (isPercent_1) {
|
|
@@ -18161,7 +18234,7 @@ var shapeArc = {
|
|
|
18161
18234
|
*/
|
|
18162
18235
|
transformForArcLabel: function (d, forRange) {
|
|
18163
18236
|
var _a, _b, _c;
|
|
18164
|
-
if (forRange ===
|
|
18237
|
+
if (forRange === void 0) { forRange = false; }
|
|
18165
18238
|
var $$ = this;
|
|
18166
18239
|
var config = $$.config, radiusExpanded = $$.state.radiusExpanded;
|
|
18167
18240
|
var updated = $$.updateAngle(d, forRange);
|
|
@@ -18178,8 +18251,8 @@ var shapeArc = {
|
|
|
18178
18251
|
var pos = isFunction(rangeTextPosition) ?
|
|
18179
18252
|
rangeTextPosition(rangeValues[d.index]) :
|
|
18180
18253
|
rangeTextPosition;
|
|
18181
|
-
x += (_a = pos === null || pos ===
|
|
18182
|
-
y += (_b = pos === null || pos ===
|
|
18254
|
+
x += (_a = pos === null || pos === void 0 ? void 0 : pos.x) !== null && _a !== void 0 ? _a : 0;
|
|
18255
|
+
y += (_b = pos === null || pos === void 0 ? void 0 : pos.y) !== null && _b !== void 0 ? _b : 0;
|
|
18183
18256
|
}
|
|
18184
18257
|
translate = "translate(".concat(x, ",").concat(y, ")");
|
|
18185
18258
|
}
|
|
@@ -18193,7 +18266,7 @@ var shapeArc = {
|
|
|
18193
18266
|
var h = Math.sqrt(x * x + y * y);
|
|
18194
18267
|
var ratio = (_c = ["donut", "gauge", "pie", "polar"]
|
|
18195
18268
|
.filter($$.hasType.bind($$))
|
|
18196
|
-
.map(function (v) { return config["".concat(v, "_label_ratio")]; })) === null || _c ===
|
|
18269
|
+
.map(function (v) { return config["".concat(v, "_label_ratio")]; })) === null || _c === void 0 ? void 0 : _c[0];
|
|
18197
18270
|
if (ratio) {
|
|
18198
18271
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
18199
18272
|
}
|
|
@@ -18230,7 +18303,7 @@ var shapeArc = {
|
|
|
18230
18303
|
var node = select(this);
|
|
18231
18304
|
var updated = $$.updateAngle(d);
|
|
18232
18305
|
var ratio = $$.getRatio("arc", updated);
|
|
18233
|
-
var isUnderThreshold = $$.meetsLabelThreshold(ratio, (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) === null || _a ===
|
|
18306
|
+
var isUnderThreshold = $$.meetsLabelThreshold(ratio, (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) === null || _a === void 0 ? void 0 : _a[0]);
|
|
18234
18307
|
if (isUnderThreshold) {
|
|
18235
18308
|
var value = (updated || d).value;
|
|
18236
18309
|
var text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
@@ -18446,7 +18519,7 @@ var shapeArc = {
|
|
|
18446
18519
|
.append("path")
|
|
18447
18520
|
.attr("class", $$.getClass("arc", true))
|
|
18448
18521
|
.style("fill", function (d) { return $$.color(d.data); })
|
|
18449
|
-
.style("cursor", function (d) { var _a; return (((_a = isSelectable === null || isSelectable ===
|
|
18522
|
+
.style("cursor", function (d) { var _a; return (((_a = isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind) === null || _a === void 0 ? void 0 : _a.call(isSelectable, $$.api)(d)) ? "pointer" : null); })
|
|
18450
18523
|
.style("opacity", "0")
|
|
18451
18524
|
.each(function (d) {
|
|
18452
18525
|
if ($$.isGaugeType(d.data)) {
|
|
@@ -18558,7 +18631,7 @@ var shapeArc = {
|
|
|
18558
18631
|
* @private
|
|
18559
18632
|
*/
|
|
18560
18633
|
$el.needle.updateHelper = function (v, updateConfig) {
|
|
18561
|
-
if (updateConfig ===
|
|
18634
|
+
if (updateConfig === void 0) { updateConfig = false; }
|
|
18562
18635
|
if ($el.needle.style("display") !== "none") {
|
|
18563
18636
|
$$.$T($el.needle)
|
|
18564
18637
|
.style("transform", "rotate(".concat($$.getNeedleAngle(v), "deg)"))
|
|
@@ -18689,7 +18762,7 @@ var shapeArc = {
|
|
|
18689
18762
|
var arcData;
|
|
18690
18763
|
if (updated) {
|
|
18691
18764
|
arcData = $$.convertToArcData(updated);
|
|
18692
|
-
(_a = $$.toggleShape) === null || _a ===
|
|
18765
|
+
(_a = $$.toggleShape) === null || _a === void 0 ? void 0 : _a.call($$, this, arcData, i);
|
|
18693
18766
|
config.data_onclick.bind($$.api)(arcData, this);
|
|
18694
18767
|
}
|
|
18695
18768
|
});
|
|
@@ -18703,7 +18776,7 @@ var shapeArc = {
|
|
|
18703
18776
|
state.event = event;
|
|
18704
18777
|
var updated = $$.updateAngle(d);
|
|
18705
18778
|
var arcData = updated ? $$.convertToArcData(updated) : null;
|
|
18706
|
-
var id = (arcData === null || arcData ===
|
|
18779
|
+
var id = (arcData === null || arcData === void 0 ? void 0 : arcData.id) || undefined;
|
|
18707
18780
|
selectArc(this, arcData, id);
|
|
18708
18781
|
$$.setOverOut(true, arcData);
|
|
18709
18782
|
})
|
|
@@ -18728,7 +18801,7 @@ var shapeArc = {
|
|
|
18728
18801
|
if (isTouch && $$.hasArcType() && !$$.radars) {
|
|
18729
18802
|
var getEventArc_1 = function (event) {
|
|
18730
18803
|
var _a, _b;
|
|
18731
|
-
var _c = (_b = (_a = event.changedTouches) === null || _a ===
|
|
18804
|
+
var _c = (_b = (_a = event.changedTouches) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : { clientX: 0, clientY: 0 }, clientX = _c.clientX, clientY = _c.clientY;
|
|
18732
18805
|
var eventArc = select(doc.elementFromPoint(clientX, clientY));
|
|
18733
18806
|
return eventArc;
|
|
18734
18807
|
};
|
|
@@ -18740,9 +18813,9 @@ var shapeArc = {
|
|
|
18740
18813
|
state.event = event;
|
|
18741
18814
|
var eventArc = getEventArc_1(event);
|
|
18742
18815
|
var datum = eventArc.datum();
|
|
18743
|
-
var updated = ((datum === null || datum ===
|
|
18816
|
+
var updated = ((datum === null || datum === void 0 ? void 0 : datum.data) && datum.data.id) ? $$.updateAngle(datum) : null;
|
|
18744
18817
|
var arcData = updated ? $$.convertToArcData(updated) : null;
|
|
18745
|
-
var id = (arcData === null || arcData ===
|
|
18818
|
+
var id = (arcData === null || arcData === void 0 ? void 0 : arcData.id) || undefined;
|
|
18746
18819
|
$$.callOverOutForTouch(arcData);
|
|
18747
18820
|
isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
|
18748
18821
|
});
|
|
@@ -18775,7 +18848,7 @@ var shapeArc = {
|
|
|
18775
18848
|
if (hasGauge) {
|
|
18776
18849
|
var isFullCircle = config.gauge_fullCircle;
|
|
18777
18850
|
isFullCircle &&
|
|
18778
|
-
(text === null || text ===
|
|
18851
|
+
(text === null || text === void 0 ? void 0 : text.attr("dy", "".concat(hasMultiArcGauge ? 0 : Math.round(state.radius / 14))));
|
|
18779
18852
|
if (config.gauge_label_show) {
|
|
18780
18853
|
arcs.select(".".concat($GAUGE.chartArcsGaugeUnit))
|
|
18781
18854
|
.attr("dy", "".concat(isFullCircle ? 1.5 : 0.75, "em"))
|
|
@@ -18804,7 +18877,7 @@ var shapeArc = {
|
|
|
18804
18877
|
var $$ = this;
|
|
18805
18878
|
var arcs = $$.$el.arcs;
|
|
18806
18879
|
var filterFn = isNumber(value) ? function (d) { return d.index === value; } : function (d) { return d.data.id === value; };
|
|
18807
|
-
return arcs === null || arcs ===
|
|
18880
|
+
return arcs === null || arcs === void 0 ? void 0 : arcs.selectAll(".".concat($COMMON.target, " path")).filter(filterFn);
|
|
18808
18881
|
}
|
|
18809
18882
|
};
|
|
18810
18883
|
|
|
@@ -18837,7 +18910,7 @@ var shapeArea = {
|
|
|
18837
18910
|
* @private
|
|
18838
18911
|
*/
|
|
18839
18912
|
updateArea: function (withTransition, isSub) {
|
|
18840
|
-
if (isSub ===
|
|
18913
|
+
if (isSub === void 0) { isSub = false; }
|
|
18841
18914
|
var $$ = this;
|
|
18842
18915
|
var config = $$.config, state = $$.state, $el = $$.$el, $T = $$.$T;
|
|
18843
18916
|
var $root = isSub ? $el.subchart : $el;
|
|
@@ -18868,7 +18941,7 @@ var shapeArea = {
|
|
|
18868
18941
|
* @returns {Array}
|
|
18869
18942
|
*/
|
|
18870
18943
|
redrawArea: function (drawFn, withTransition, isSub) {
|
|
18871
|
-
if (isSub ===
|
|
18944
|
+
if (isSub === void 0) { isSub = false; }
|
|
18872
18945
|
var $$ = this;
|
|
18873
18946
|
var area = (isSub ? this.$el.subchart : this.$el).area;
|
|
18874
18947
|
var orgAreaOpacity = $$.state.orgAreaOpacity;
|
|
@@ -18994,7 +19067,7 @@ var shapeBar = {
|
|
|
18994
19067
|
// Bars for each data
|
|
18995
19068
|
mainBarEnter.append("g")
|
|
18996
19069
|
.attr("class", classBars)
|
|
18997
|
-
.style("cursor", function (d) { var _a; return (((_a = isSelectable === null || isSelectable ===
|
|
19070
|
+
.style("cursor", function (d) { var _a; return (((_a = isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind) === null || _a === void 0 ? void 0 : _a.call(isSelectable, $$.api)(d)) ? "pointer" : null); })
|
|
18998
19071
|
.call($$.setCssRule(true, " .".concat($BAR.bar), ["fill"], $$.color));
|
|
18999
19072
|
},
|
|
19000
19073
|
/**
|
|
@@ -19004,7 +19077,7 @@ var shapeBar = {
|
|
|
19004
19077
|
* @private
|
|
19005
19078
|
*/
|
|
19006
19079
|
updateBar: function (withTransition, isSub) {
|
|
19007
|
-
if (isSub ===
|
|
19080
|
+
if (isSub === void 0) { isSub = false; }
|
|
19008
19081
|
var $$ = this;
|
|
19009
19082
|
var config = $$.config, $el = $$.$el, $T = $$.$T;
|
|
19010
19083
|
var $root = isSub ? $el.subchart : $el;
|
|
@@ -19045,7 +19118,7 @@ var shapeBar = {
|
|
|
19045
19118
|
* @private
|
|
19046
19119
|
*/
|
|
19047
19120
|
redrawBar: function (drawFn, withTransition, isSub) {
|
|
19048
|
-
if (isSub ===
|
|
19121
|
+
if (isSub === void 0) { isSub = false; }
|
|
19049
19122
|
var $$ = this;
|
|
19050
19123
|
var bar = (isSub ? $$.$el.subchart : $$.$el).bar;
|
|
19051
19124
|
return [
|
|
@@ -19323,7 +19396,7 @@ var shapeCandlestick = {
|
|
|
19323
19396
|
* @private
|
|
19324
19397
|
*/
|
|
19325
19398
|
updateCandlestick: function (withTransition, isSub) {
|
|
19326
|
-
if (isSub ===
|
|
19399
|
+
if (isSub === void 0) { isSub = false; }
|
|
19327
19400
|
var $$ = this;
|
|
19328
19401
|
var $el = $$.$el, $T = $$.$T;
|
|
19329
19402
|
var $root = isSub ? $el.subchart : $el;
|
|
@@ -19360,7 +19433,7 @@ var shapeCandlestick = {
|
|
|
19360
19433
|
return function (d, i, g) {
|
|
19361
19434
|
var points = getPoints(d, i);
|
|
19362
19435
|
var value = $$.getCandlestickData(d);
|
|
19363
|
-
var isUp = value === null || value ===
|
|
19436
|
+
var isUp = value === null || value === void 0 ? void 0 : value._isUp;
|
|
19364
19437
|
// switch points if axis is rotated, not applicable for sub chart
|
|
19365
19438
|
var indexX = +isRotated;
|
|
19366
19439
|
var indexY = +!indexX;
|
|
@@ -19403,7 +19476,7 @@ var shapeCandlestick = {
|
|
|
19403
19476
|
* @returns {Function}
|
|
19404
19477
|
*/
|
|
19405
19478
|
generateGetCandlestickPoints: function (indices, isSub) {
|
|
19406
|
-
if (isSub ===
|
|
19479
|
+
if (isSub === void 0) { isSub = false; }
|
|
19407
19480
|
var $$ = this;
|
|
19408
19481
|
var axis = isSub ? $$.axis.subX : $$.axis.x;
|
|
19409
19482
|
var targetsNum = $$.getIndicesMax(indices) + 1;
|
|
@@ -19454,7 +19527,7 @@ var shapeCandlestick = {
|
|
|
19454
19527
|
* @returns {Array}
|
|
19455
19528
|
*/
|
|
19456
19529
|
redrawCandlestick: function (drawFn, withTransition, isSub) {
|
|
19457
|
-
if (isSub ===
|
|
19530
|
+
if (isSub === void 0) { isSub = false; }
|
|
19458
19531
|
var $$ = this;
|
|
19459
19532
|
var $el = $$.$el, $T = $$.$T;
|
|
19460
19533
|
var candlestick = (isSub ? $el.subchart : $el).candlestick;
|
|
@@ -19479,7 +19552,7 @@ var shapeCandlestick = {
|
|
|
19479
19552
|
var value = _a.value;
|
|
19480
19553
|
var d;
|
|
19481
19554
|
if (isArray(value)) {
|
|
19482
|
-
var open_1 = value[0], high = value[1], low = value[2], close_1 = value[3], _b = value[4], volume = _b ===
|
|
19555
|
+
var open_1 = value[0], high = value[1], low = value[2], close_1 = value[3], _b = value[4], volume = _b === void 0 ? false : _b;
|
|
19483
19556
|
d = { open: open_1, high: high, low: low, close: close_1 };
|
|
19484
19557
|
if (volume !== false) {
|
|
19485
19558
|
d.volume = volume;
|
|
@@ -19502,7 +19575,7 @@ var shapeCandlestick = {
|
|
|
19502
19575
|
* @private
|
|
19503
19576
|
*/
|
|
19504
19577
|
function getSize(checkNeck) {
|
|
19505
|
-
if (checkNeck ===
|
|
19578
|
+
if (checkNeck === void 0) { checkNeck = false; }
|
|
19506
19579
|
var $$ = this;
|
|
19507
19580
|
var config = $$.config, _a = $$.state.current, width = _a.width, height = _a.height;
|
|
19508
19581
|
var padding = $$.getCurrentPadding();
|
|
@@ -19583,7 +19656,7 @@ function getCoord(d) {
|
|
|
19583
19656
|
* @private
|
|
19584
19657
|
*/
|
|
19585
19658
|
function getClipPath(forBackground) {
|
|
19586
|
-
if (forBackground ===
|
|
19659
|
+
if (forBackground === void 0) { forBackground = false; }
|
|
19587
19660
|
var $$ = this;
|
|
19588
19661
|
var _a = getSize.call($$, true), width = _a.width, height = _a.height, top = _a.top, left = _a.left;
|
|
19589
19662
|
var neck = getNecklSize.call($$, { width: width, height: height });
|
|
@@ -19666,7 +19739,7 @@ var shapeFunnel = {
|
|
|
19666
19739
|
var funnel = $$.$el.funnel, config = $$.config, state = $$.state;
|
|
19667
19740
|
var getTarget = function (event) {
|
|
19668
19741
|
var _a;
|
|
19669
|
-
var target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) === null || _a ===
|
|
19742
|
+
var target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) === null || _a === void 0 ? void 0 : _a.node();
|
|
19670
19743
|
var data;
|
|
19671
19744
|
if (/^path$/i.test(target.tagName)) {
|
|
19672
19745
|
state.event = event;
|
|
@@ -19750,12 +19823,12 @@ var shapeFunnel = {
|
|
|
19750
19823
|
var _a = getSize.call($$), top = _a.top, left = _a.left, right = _a.right;
|
|
19751
19824
|
var center = (left - right) / 2;
|
|
19752
19825
|
var points = {};
|
|
19753
|
-
var accumulatedHeight = top !== null && top !==
|
|
19826
|
+
var accumulatedHeight = top !== null && top !== void 0 ? top : 0;
|
|
19754
19827
|
targets.each(function (d, i) {
|
|
19755
19828
|
var _a;
|
|
19756
19829
|
points[d.id] = [
|
|
19757
19830
|
[center, accumulatedHeight],
|
|
19758
|
-
[center, accumulatedHeight += ((_a = targets === null || targets ===
|
|
19831
|
+
[center, accumulatedHeight += ((_a = targets === null || targets === void 0 ? void 0 : targets[i]) !== null && _a !== void 0 ? _a : d).ratio]
|
|
19759
19832
|
];
|
|
19760
19833
|
});
|
|
19761
19834
|
return function (d) { return points[d.id]; };
|
|
@@ -19788,8 +19861,8 @@ var shapeGauge = {
|
|
|
19788
19861
|
var $$ = this;
|
|
19789
19862
|
var config = $$.config, arcs = $$.$el.arcs;
|
|
19790
19863
|
var appendText = function (className, value) {
|
|
19791
|
-
if (className ===
|
|
19792
|
-
if (value ===
|
|
19864
|
+
if (className === void 0) { className = null; }
|
|
19865
|
+
if (value === void 0) { value = ""; }
|
|
19793
19866
|
arcs.append("text")
|
|
19794
19867
|
.attr("class", className)
|
|
19795
19868
|
.style("text-anchor", "middle")
|
|
@@ -19895,7 +19968,7 @@ var shapeGauge = {
|
|
|
19895
19968
|
* @private
|
|
19896
19969
|
*/
|
|
19897
19970
|
function getStrokeDashArray(start, end, pattern, isLastX) {
|
|
19898
|
-
if (isLastX ===
|
|
19971
|
+
if (isLastX === void 0) { isLastX = false; }
|
|
19899
19972
|
var dash = start ? [start, 0] : pattern;
|
|
19900
19973
|
var _loop_1 = function (i) {
|
|
19901
19974
|
pattern.forEach(function (v) {
|
|
@@ -19933,7 +20006,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19933
20006
|
// Check start/end of regions
|
|
19934
20007
|
if (isDefined(_regions)) {
|
|
19935
20008
|
var getValue = function (v, def) { return (isUndefined(v) ? def : (isTimeSeries ? parseDate.call($$, v) : v)); };
|
|
19936
|
-
for (var i = 0, reg =
|
|
20009
|
+
for (var i = 0, reg = void 0; (reg = _regions[i]); i++) {
|
|
19937
20010
|
var start = getValue(reg.start, d[0].x);
|
|
19938
20011
|
var end = getValue(reg.end, d[d.length - 1].x);
|
|
19939
20012
|
var style = reg.style || { dasharray: dasharray };
|
|
@@ -19984,7 +20057,7 @@ var shapeLine = {
|
|
|
19984
20057
|
* @private
|
|
19985
20058
|
*/
|
|
19986
20059
|
updateLine: function (withTransition, isSub) {
|
|
19987
|
-
if (isSub ===
|
|
20060
|
+
if (isSub === void 0) { isSub = false; }
|
|
19988
20061
|
var $$ = this;
|
|
19989
20062
|
var extraLineClasses = $$.format.extraLineClasses, $el = $$.$el, $T = $$.$T;
|
|
19990
20063
|
var $root = isSub ? $el.subchart : $el;
|
|
@@ -20012,7 +20085,7 @@ var shapeLine = {
|
|
|
20012
20085
|
* @private
|
|
20013
20086
|
*/
|
|
20014
20087
|
redrawLine: function (drawFn, withTransition, isSub) {
|
|
20015
|
-
if (isSub ===
|
|
20088
|
+
if (isSub === void 0) { isSub = false; }
|
|
20016
20089
|
var $$ = this;
|
|
20017
20090
|
var $el = $$.$el, $T = $$.$T;
|
|
20018
20091
|
var line = (isSub ? $el.subchart : $el).line;
|
|
@@ -20175,7 +20248,7 @@ var shapeLine = {
|
|
|
20175
20248
|
lastLength: 0
|
|
20176
20249
|
};
|
|
20177
20250
|
var isLastX = false;
|
|
20178
|
-
for (var i = 0, data =
|
|
20251
|
+
for (var i = 0, data = void 0; (data = d[i]); i++) {
|
|
20179
20252
|
var prevData = d[i - 1];
|
|
20180
20253
|
var hasPrevData = prevData && isValue(prevData.value);
|
|
20181
20254
|
var style = $$.isWithinRegions(data.x, regions);
|
|
@@ -20188,7 +20261,7 @@ var shapeLine = {
|
|
|
20188
20261
|
path += "".concat(i && hasPrevData ? "L" : "M").concat(xValue(data), ",").concat(yValue(data));
|
|
20189
20262
|
}
|
|
20190
20263
|
else if (hasPrevData) {
|
|
20191
|
-
style = ((style === null || style ===
|
|
20264
|
+
style = ((style === null || style === void 0 ? void 0 : style.dasharray) || dasharray).split(" ").map(Number);
|
|
20192
20265
|
// Draw with region // TODO: Fix for horizotal charts
|
|
20193
20266
|
xp = getScale(axisType.x, prevData.x, data.x);
|
|
20194
20267
|
yp = getScale(axisType.y, prevData.value, data.value);
|
|
@@ -20243,7 +20316,7 @@ var shapeLine = {
|
|
|
20243
20316
|
return path;
|
|
20244
20317
|
},
|
|
20245
20318
|
isWithinRegions: function (withinX, withinRegions) {
|
|
20246
|
-
for (var i = 0, reg =
|
|
20319
|
+
for (var i = 0, reg = void 0; (reg = withinRegions[i]); i++) {
|
|
20247
20320
|
if (reg.start < withinX && withinX <= reg.end) {
|
|
20248
20321
|
return reg.style;
|
|
20249
20322
|
}
|
|
@@ -20282,7 +20355,7 @@ var shapePoint = {
|
|
|
20282
20355
|
var config = this.config;
|
|
20283
20356
|
var opacity = config.point_opacity;
|
|
20284
20357
|
if (isUndefined(opacity)) {
|
|
20285
|
-
opacity = config.point_show && !((_a = this.isPointFocusOnly) === null || _a ===
|
|
20358
|
+
opacity = config.point_show && !((_a = this.isPointFocusOnly) === null || _a === void 0 ? void 0 : _a.call(this)) ? null : "0";
|
|
20286
20359
|
opacity = isValue(this.getBaseValue(d)) ?
|
|
20287
20360
|
(this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity) :
|
|
20288
20361
|
"0";
|
|
@@ -20348,7 +20421,7 @@ var shapePoint = {
|
|
|
20348
20421
|
});
|
|
20349
20422
|
},
|
|
20350
20423
|
updateCircle: function (isSub) {
|
|
20351
|
-
if (isSub ===
|
|
20424
|
+
if (isSub === void 0) { isSub = false; }
|
|
20352
20425
|
var $$ = this;
|
|
20353
20426
|
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
20354
20427
|
var focusOnly = $$.isPointFocusOnly();
|
|
@@ -20382,7 +20455,7 @@ var shapePoint = {
|
|
|
20382
20455
|
return $$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null);
|
|
20383
20456
|
},
|
|
20384
20457
|
redrawCircle: function (cx, cy, withTransition, flow, isSub) {
|
|
20385
|
-
if (isSub ===
|
|
20458
|
+
if (isSub === void 0) { isSub = false; }
|
|
20386
20459
|
var $$ = this;
|
|
20387
20460
|
var rendered = $$.state.rendered, $el = $$.$el, $T = $$.$T;
|
|
20388
20461
|
var $root = isSub ? $el.subchart : $el;
|
|
@@ -20426,7 +20499,7 @@ var shapePoint = {
|
|
|
20426
20499
|
circle = circle
|
|
20427
20500
|
.filter(function (t) {
|
|
20428
20501
|
var _a;
|
|
20429
|
-
var data = (_a = d.filter) === null || _a ===
|
|
20502
|
+
var data = (_a = d.filter) === null || _a === void 0 ? void 0 : _a.call(d, function (v) { return v.id === t.id; });
|
|
20430
20503
|
return data.length ? select(this).datum(data[0]) : false;
|
|
20431
20504
|
});
|
|
20432
20505
|
}
|
|
@@ -20461,7 +20534,7 @@ var shapePoint = {
|
|
|
20461
20534
|
return this.xx(d);
|
|
20462
20535
|
},
|
|
20463
20536
|
updateCircleY: function (isSub) {
|
|
20464
|
-
if (isSub ===
|
|
20537
|
+
if (isSub === void 0) { isSub = false; }
|
|
20465
20538
|
var $$ = this;
|
|
20466
20539
|
var getPoints = $$.generateGetLinePoints($$.getShapeIndices($$.isLineType), isSub);
|
|
20467
20540
|
return function (d, i) {
|
|
@@ -20553,7 +20626,7 @@ var shapePoint = {
|
|
|
20553
20626
|
var mouse = getPointer(state.event, node);
|
|
20554
20627
|
var element = select(node);
|
|
20555
20628
|
var prefix = this.isCirclePoint(node) ? "c" : "";
|
|
20556
|
-
var pointSensitivity = this.getPointSensitivity(element === null || element ===
|
|
20629
|
+
var pointSensitivity = this.getPointSensitivity(element === null || element === void 0 ? void 0 : element.datum());
|
|
20557
20630
|
var cx = +element.attr("".concat(prefix, "x"));
|
|
20558
20631
|
var cy = +element.attr("".concat(prefix, "y"));
|
|
20559
20632
|
// if node don't have cx/y or x/y attribute value
|
|
@@ -20743,7 +20816,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20743
20816
|
clone.style.fill = "inherit";
|
|
20744
20817
|
clone.style.stroke = "inherit";
|
|
20745
20818
|
copyAttr(node, clone);
|
|
20746
|
-
if ((_a = node.childNodes) === null || _a ===
|
|
20819
|
+
if ((_a = node.childNodes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
20747
20820
|
var parent_1 = select(clone);
|
|
20748
20821
|
if ("innerHTML" in clone) {
|
|
20749
20822
|
parent_1.html(node.innerHTML);
|
|
@@ -20774,7 +20847,7 @@ var shapePointCommon = {
|
|
|
20774
20847
|
hasLegendDefsPoint: function () {
|
|
20775
20848
|
var _a;
|
|
20776
20849
|
var config = this.config;
|
|
20777
|
-
return config.legend_show && ((_a = config.point_pattern) === null || _a ===
|
|
20850
|
+
return config.legend_show && ((_a = config.point_pattern) === null || _a === void 0 ? void 0 : _a.length) && config.legend_usePoint;
|
|
20778
20851
|
},
|
|
20779
20852
|
getDefsPointId: function (id) {
|
|
20780
20853
|
var datetimeId = this.state.datetimeId;
|
|
@@ -20797,7 +20870,7 @@ var shapePointCommon = {
|
|
|
20797
20870
|
}
|
|
20798
20871
|
return function (d) {
|
|
20799
20872
|
var _a, _b, _c, _d;
|
|
20800
|
-
var id = $$.getTargetSelectorSuffix(d.id || ((_a = d.data) === null || _a ===
|
|
20873
|
+
var id = $$.getTargetSelectorSuffix(d.id || ((_a = d.data) === null || _a === void 0 ? void 0 : _a.id) || d);
|
|
20801
20874
|
var element = select(this);
|
|
20802
20875
|
ids.indexOf(id) < 0 && ids.push(id);
|
|
20803
20876
|
var point = pattern[ids.indexOf(id) % pattern.length];
|
|
@@ -20811,13 +20884,13 @@ var shapePointCommon = {
|
|
|
20811
20884
|
insertPointInfoDefs.bind($$)(point, pointId);
|
|
20812
20885
|
}
|
|
20813
20886
|
if (method === "create") {
|
|
20814
|
-
return (_b = $$.custom) === null || _b ===
|
|
20887
|
+
return (_b = $$.custom) === null || _b === void 0 ? void 0 : _b.create.bind(context).apply(void 0, __spreadArray([element, pointId], args, false));
|
|
20815
20888
|
}
|
|
20816
20889
|
else if (method === "update") {
|
|
20817
|
-
return (_c = $$.custom) === null || _c ===
|
|
20890
|
+
return (_c = $$.custom) === null || _c === void 0 ? void 0 : _c.update.bind(context).apply(void 0, __spreadArray([element], args, false));
|
|
20818
20891
|
}
|
|
20819
20892
|
}
|
|
20820
|
-
return (_d = point[method]) === null || _d ===
|
|
20893
|
+
return (_d = point[method]) === null || _d === void 0 ? void 0 : _d.bind(context).apply(void 0, __spreadArray([element], args, false));
|
|
20821
20894
|
};
|
|
20822
20895
|
};
|
|
20823
20896
|
}
|
|
@@ -20870,7 +20943,7 @@ var shapePolar = {
|
|
|
20870
20943
|
getPolarOuterRadius: function (d, outerRadius) {
|
|
20871
20944
|
var _a;
|
|
20872
20945
|
var dataMax = getDataMax(this);
|
|
20873
|
-
return (((_a = d === null || d ===
|
|
20946
|
+
return (((_a = d === null || d === void 0 ? void 0 : d.data.values[0].value) !== null && _a !== void 0 ? _a : 0) / dataMax) * outerRadius;
|
|
20874
20947
|
},
|
|
20875
20948
|
/**
|
|
20876
20949
|
* Update polar based on given data array
|
|
@@ -21134,7 +21207,7 @@ var shapeRadar = {
|
|
|
21134
21207
|
}
|
|
21135
21208
|
// axis text
|
|
21136
21209
|
if (config.radar_axis_text_show) {
|
|
21137
|
-
var _b = config.radar_axis_text_position, _c = _b.x, x_1 = _c ===
|
|
21210
|
+
var _b = config.radar_axis_text_position, _c = _b.x, x_1 = _c === void 0 ? 0 : _c, _d = _b.y, y_1 = _d === void 0 ? 0 : _d;
|
|
21138
21211
|
var textWidth = $$.cache.get(cacheKeyTextWidth) || 0;
|
|
21139
21212
|
axis.select("text")
|
|
21140
21213
|
.style("text-anchor", "middle")
|
|
@@ -21337,13 +21410,13 @@ var shapeTreemap = {
|
|
|
21337
21410
|
var $el = $$.$el, config = $$.config, state = $$.state;
|
|
21338
21411
|
var getTarget = function (event) {
|
|
21339
21412
|
var _a;
|
|
21340
|
-
var target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) === null || _a ===
|
|
21413
|
+
var target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) === null || _a === void 0 ? void 0 : _a.node();
|
|
21341
21414
|
var data;
|
|
21342
21415
|
if (/^rect$/i.test(target.tagName)) {
|
|
21343
21416
|
state.event = event;
|
|
21344
21417
|
data = select(target).datum();
|
|
21345
21418
|
}
|
|
21346
|
-
return data === null || data ===
|
|
21419
|
+
return data === null || data === void 0 ? void 0 : data.data;
|
|
21347
21420
|
};
|
|
21348
21421
|
if (config.interaction_enabled) {
|
|
21349
21422
|
var isTouch = state.inputType === "touch";
|
|
@@ -21380,7 +21453,7 @@ var shapeTreemap = {
|
|
|
21380
21453
|
sliceDice: treemapSliceDice,
|
|
21381
21454
|
squarify: treemapSquarify,
|
|
21382
21455
|
resquarify: treemapResquarify
|
|
21383
|
-
}[(_a = config.treemap_tile) !== null && _a !==
|
|
21456
|
+
}[(_a = config.treemap_tile) !== null && _a !== void 0 ? _a : "binary"]) !== null && _b !== void 0 ? _b : treemapBinary;
|
|
21384
21457
|
return function (node, x0, y0, x1, y1) {
|
|
21385
21458
|
tile(node, 0, 0, width, height);
|
|
21386
21459
|
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
|
@@ -21413,7 +21486,7 @@ var shapeTreemap = {
|
|
|
21413
21486
|
updateTargetsForTreemap: function (targets) {
|
|
21414
21487
|
var $$ = this;
|
|
21415
21488
|
var treemap = $$.$el.treemap;
|
|
21416
|
-
var treemapData = getHierachyData.call($$, $$.getTreemapData(targets !== null && targets !==
|
|
21489
|
+
var treemapData = getHierachyData.call($$, $$.getTreemapData(targets !== null && targets !== void 0 ? targets : $$.data.targets));
|
|
21417
21490
|
// using $el.treemap reference can alter data, so select treemap <g> again
|
|
21418
21491
|
treemap.data(treemapData);
|
|
21419
21492
|
},
|
|
@@ -22931,7 +23004,7 @@ var treemap = function () { return (extendAxis([shapeTreemap], [optTreemap]), (t
|
|
|
22931
23004
|
* @private
|
|
22932
23005
|
*/
|
|
22933
23006
|
function setSelection(isSelection, ids, indices, resetOther) {
|
|
22934
|
-
if (isSelection ===
|
|
23007
|
+
if (isSelection === void 0) { isSelection = false; }
|
|
22935
23008
|
var $$ = this;
|
|
22936
23009
|
var config = $$.config, main = $$.$el.main;
|
|
22937
23010
|
var selectionGrouped = config.data_selection_grouped;
|
|
@@ -23082,7 +23155,7 @@ var subchart$1 = function (domainValue) {
|
|
|
23082
23155
|
}
|
|
23083
23156
|
}
|
|
23084
23157
|
else {
|
|
23085
|
-
domain = (_a = state.domain) !== null && _a !==
|
|
23158
|
+
domain = (_a = state.domain) !== null && _a !== void 0 ? _a : x.orgDomain();
|
|
23086
23159
|
}
|
|
23087
23160
|
}
|
|
23088
23161
|
return domain;
|
|
@@ -23126,10 +23199,10 @@ extend(subchart$1, {
|
|
|
23126
23199
|
if ($$.data.targets.length !== $target.size()) {
|
|
23127
23200
|
$$.updateSizes();
|
|
23128
23201
|
$$.updateTargetsForSubchart($$.data.targets);
|
|
23129
|
-
$target = (_a = subchart.main) === null || _a ===
|
|
23202
|
+
$target = (_a = subchart.main) === null || _a === void 0 ? void 0 : _a.selectAll(".".concat($COMMON.target));
|
|
23130
23203
|
}
|
|
23131
|
-
$target === null || $target ===
|
|
23132
|
-
(_b = subchart.main) === null || _b ===
|
|
23204
|
+
$target === null || $target === void 0 ? void 0 : $target.style("opacity", null);
|
|
23205
|
+
(_b = subchart.main) === null || _b === void 0 ? void 0 : _b.style("display", null);
|
|
23133
23206
|
this.resize();
|
|
23134
23207
|
}
|
|
23135
23208
|
},
|
|
@@ -23145,7 +23218,7 @@ extend(subchart$1, {
|
|
|
23145
23218
|
hide: function () {
|
|
23146
23219
|
var $$ = this.internal;
|
|
23147
23220
|
var main = $$.$el.subchart.main, config = $$.config;
|
|
23148
|
-
if (config.subchart_show && (main === null || main ===
|
|
23221
|
+
if (config.subchart_show && (main === null || main === void 0 ? void 0 : main.style("display")) !== "none") {
|
|
23149
23222
|
config.subchart_show = false;
|
|
23150
23223
|
main.style("display", "none");
|
|
23151
23224
|
this.resize();
|
|
@@ -23252,7 +23325,7 @@ var zoom$1 = function (domainValue) {
|
|
|
23252
23325
|
domain = $$.zoom.getDomain();
|
|
23253
23326
|
}
|
|
23254
23327
|
}
|
|
23255
|
-
return (_a = state.domain) !== null && _a !==
|
|
23328
|
+
return (_a = state.domain) !== null && _a !== void 0 ? _a : domain;
|
|
23256
23329
|
};
|
|
23257
23330
|
extend(zoom$1, {
|
|
23258
23331
|
/**
|
|
@@ -23376,7 +23449,7 @@ var apiZoom = {
|
|
|
23376
23449
|
$$.brush.getSelection().call($$.brush.move, null) :
|
|
23377
23450
|
$$.zoom.updateTransformScale(zoomIdentity);
|
|
23378
23451
|
$$.updateZoom(true);
|
|
23379
|
-
zoomResetBtn === null || zoomResetBtn ===
|
|
23452
|
+
zoomResetBtn === null || zoomResetBtn === void 0 ? void 0 : zoomResetBtn.style("display", "none");
|
|
23380
23453
|
// reset transform
|
|
23381
23454
|
if (zoomTransform(eventRect.node()) !== zoomIdentity) {
|
|
23382
23455
|
$$.zoom.transform(eventRect, zoomIdentity);
|
|
@@ -23418,7 +23491,7 @@ var subchart = {
|
|
|
23418
23491
|
// when brush selection updates happens on one edge, update only chainging edge and
|
|
23419
23492
|
// is only for adjustment of given domain range to be used to return current domain range.
|
|
23420
23493
|
type === "brush" && sourceEvent && state.domain &&
|
|
23421
|
-
(lastSelection === null || lastSelection ===
|
|
23494
|
+
(lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.forEach(function (v, i) {
|
|
23422
23495
|
if (v !== selection[i]) {
|
|
23423
23496
|
state.domain[i] = scale.x.orgDomain()[i];
|
|
23424
23497
|
}
|
|
@@ -23429,7 +23502,7 @@ var subchart = {
|
|
|
23429
23502
|
lastDomain = scale.x.orgDomain();
|
|
23430
23503
|
}
|
|
23431
23504
|
// handle brush's handle position & visibility
|
|
23432
|
-
if (target === null || target ===
|
|
23505
|
+
if (target === null || target === void 0 ? void 0 : target.handle) {
|
|
23433
23506
|
if (selection === null) {
|
|
23434
23507
|
$$.brush.handle.attr("display", "none");
|
|
23435
23508
|
}
|
|
@@ -23455,7 +23528,7 @@ var subchart = {
|
|
|
23455
23528
|
var _a;
|
|
23456
23529
|
var extent = this.extent()();
|
|
23457
23530
|
if (extent[1].filter(function (v) { return isNaN(v); }).length === 0) {
|
|
23458
|
-
(_a = subchart.main) === null || _a ===
|
|
23531
|
+
(_a = subchart.main) === null || _a === void 0 ? void 0 : _a.select(".".concat(CLASS.brush)).call(this);
|
|
23459
23532
|
}
|
|
23460
23533
|
return this;
|
|
23461
23534
|
};
|
|
@@ -23627,7 +23700,7 @@ var subchart = {
|
|
|
23627
23700
|
// subchart
|
|
23628
23701
|
if (config.subchart_show) {
|
|
23629
23702
|
// reflect main chart to extent on subchart if zoomed
|
|
23630
|
-
if (((_a = state.event) === null || _a ===
|
|
23703
|
+
if (((_a = state.event) === null || _a === void 0 ? void 0 : _a.type) === "zoom") {
|
|
23631
23704
|
$$.brush.update();
|
|
23632
23705
|
}
|
|
23633
23706
|
// update subchart elements if needed
|
|
@@ -23662,7 +23735,7 @@ var subchart = {
|
|
|
23662
23735
|
*/
|
|
23663
23736
|
redrawForBrush: function (callCallbck) {
|
|
23664
23737
|
var _a;
|
|
23665
|
-
if (callCallbck ===
|
|
23738
|
+
if (callCallbck === void 0) { callCallbck = true; }
|
|
23666
23739
|
var $$ = this;
|
|
23667
23740
|
var _b = $$.config, onBrush = _b.subchart_onbrush, withY = _b.zoom_rescale, scale = $$.scale, state = $$.state;
|
|
23668
23741
|
$$.redraw({
|
|
@@ -23673,7 +23746,7 @@ var subchart = {
|
|
|
23673
23746
|
withDimension: false
|
|
23674
23747
|
});
|
|
23675
23748
|
callCallbck && state.rendered &&
|
|
23676
|
-
onBrush.bind($$.api)((_a = state.domain) !== null && _a !==
|
|
23749
|
+
onBrush.bind($$.api)((_a = state.domain) !== null && _a !== void 0 ? _a : scale.x.orgDomain());
|
|
23677
23750
|
},
|
|
23678
23751
|
/**
|
|
23679
23752
|
* Transform context
|
|
@@ -23684,7 +23757,7 @@ var subchart = {
|
|
|
23684
23757
|
transformContext: function (withTransition, transitions) {
|
|
23685
23758
|
var $$ = this;
|
|
23686
23759
|
var subchart = $$.$el.subchart, $T = $$.$T;
|
|
23687
|
-
var subXAxis = (transitions === null || transitions ===
|
|
23760
|
+
var subXAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisSubX) ?
|
|
23688
23761
|
transitions.axisSubX :
|
|
23689
23762
|
$T(subchart.main.select(".".concat(CLASS.axisX)), withTransition);
|
|
23690
23763
|
subchart.main.attr("transform", $$.getTranslate("context"));
|
|
@@ -23714,7 +23787,7 @@ var zoom = {
|
|
|
23714
23787
|
* @private
|
|
23715
23788
|
*/
|
|
23716
23789
|
bindZoomEvent: function (bind) {
|
|
23717
|
-
if (bind ===
|
|
23790
|
+
if (bind === void 0) { bind = true; }
|
|
23718
23791
|
var $$ = this;
|
|
23719
23792
|
var config = $$.config;
|
|
23720
23793
|
var zoomEnabled = config.zoom_enabled;
|
|
@@ -23764,7 +23837,7 @@ var zoom = {
|
|
|
23764
23837
|
var _a;
|
|
23765
23838
|
var isRotated = config.axis_rotated;
|
|
23766
23839
|
// in case of resize, update range of orgXScale
|
|
23767
|
-
(_a = org.xScale) === null || _a ===
|
|
23840
|
+
(_a = org.xScale) === null || _a === void 0 ? void 0 : _a.range(scale.x.range());
|
|
23768
23841
|
// rescale from the original scale
|
|
23769
23842
|
var newScale = transform[isRotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x);
|
|
23770
23843
|
// prevent drag zoom to be out of range
|
|
@@ -23837,19 +23910,19 @@ var zoom = {
|
|
|
23837
23910
|
var $$ = this;
|
|
23838
23911
|
var config = $$.config, scale = $$.scale, state = $$.state, org = $$.org;
|
|
23839
23912
|
var sourceEvent = event.sourceEvent;
|
|
23840
|
-
var isUnZoom = (event === null || event ===
|
|
23913
|
+
var isUnZoom = (event === null || event === void 0 ? void 0 : event.transform) === zoomIdentity;
|
|
23841
23914
|
if (!config.zoom_enabled ||
|
|
23842
23915
|
$$.filterTargetsToShow($$.data.targets).length === 0 ||
|
|
23843
|
-
(!scale.zoom && (sourceEvent === null || sourceEvent ===
|
|
23844
|
-
(sourceEvent === null || sourceEvent ===
|
|
23916
|
+
(!scale.zoom && (sourceEvent === null || sourceEvent === void 0 ? void 0 : sourceEvent.type.indexOf("touch")) > -1 &&
|
|
23917
|
+
(sourceEvent === null || sourceEvent === void 0 ? void 0 : sourceEvent.touches.length) === 1)) {
|
|
23845
23918
|
return;
|
|
23846
23919
|
}
|
|
23847
23920
|
if (event.sourceEvent) {
|
|
23848
23921
|
state.zooming = true;
|
|
23849
23922
|
state.domain = undefined;
|
|
23850
23923
|
}
|
|
23851
|
-
var isMousemove = (sourceEvent === null || sourceEvent ===
|
|
23852
|
-
var isZoomOut = (sourceEvent === null || sourceEvent ===
|
|
23924
|
+
var isMousemove = (sourceEvent === null || sourceEvent === void 0 ? void 0 : sourceEvent.type) === "mousemove";
|
|
23925
|
+
var isZoomOut = (sourceEvent === null || sourceEvent === void 0 ? void 0 : sourceEvent.wheelDelta) < 0;
|
|
23853
23926
|
var transform = event.transform;
|
|
23854
23927
|
if (!isMousemove && isZoomOut && scale.x.domain().every(function (v, i) { return v !== org.xDomain[i]; })) {
|
|
23855
23928
|
scale.x.domain(org.xDomain);
|
|
@@ -23869,7 +23942,7 @@ var zoom = {
|
|
|
23869
23942
|
});
|
|
23870
23943
|
$$.state.cancelClick = isMousemove;
|
|
23871
23944
|
// do not call event cb when is .unzoom() is called
|
|
23872
|
-
!isUnZoom && callFn(config.zoom_onzoom, $$.api, (_a = $$.state.domain) !== null && _a !==
|
|
23945
|
+
!isUnZoom && callFn(config.zoom_onzoom, $$.api, (_a = $$.state.domain) !== null && _a !== void 0 ? _a : $$.zoom.getDomain());
|
|
23873
23946
|
},
|
|
23874
23947
|
/**
|
|
23875
23948
|
* 'end' event listener
|
|
@@ -23881,11 +23954,11 @@ var zoom = {
|
|
|
23881
23954
|
var $$ = this;
|
|
23882
23955
|
var config = $$.config, state = $$.state;
|
|
23883
23956
|
var startEvent = $$.zoom.startEvent;
|
|
23884
|
-
var e = event === null || event ===
|
|
23885
|
-
var isUnZoom = (event === null || event ===
|
|
23886
|
-
if ((startEvent === null || startEvent ===
|
|
23957
|
+
var e = event === null || event === void 0 ? void 0 : event.sourceEvent;
|
|
23958
|
+
var isUnZoom = (event === null || event === void 0 ? void 0 : event.transform) === zoomIdentity;
|
|
23959
|
+
if ((startEvent === null || startEvent === void 0 ? void 0 : startEvent.type.indexOf("touch")) > -1) {
|
|
23887
23960
|
startEvent = startEvent.changedTouches[0];
|
|
23888
|
-
e = (_a = e === null || e ===
|
|
23961
|
+
e = (_a = e === null || e === void 0 ? void 0 : e.changedTouches) === null || _a === void 0 ? void 0 : _a[0];
|
|
23889
23962
|
}
|
|
23890
23963
|
// if click, do nothing. otherwise, click interaction will be canceled.
|
|
23891
23964
|
if (config.zoom_type === "drag" && (e && startEvent.clientX === e.clientX && startEvent.clientY === e.clientY)) {
|
|
@@ -23895,7 +23968,7 @@ var zoom = {
|
|
|
23895
23968
|
$$.redrawEventRect();
|
|
23896
23969
|
$$.updateZoom();
|
|
23897
23970
|
// do not call event cb when is .unzoom() is called
|
|
23898
|
-
!isUnZoom && (e || state.dragging) && callFn(config.zoom_onzoomend, $$.api, (_b = $$.state.domain) !== null && _b !==
|
|
23971
|
+
!isUnZoom && (e || state.dragging) && callFn(config.zoom_onzoomend, $$.api, (_b = $$.state.domain) !== null && _b !== void 0 ? _b : $$.zoom.getDomain());
|
|
23899
23972
|
},
|
|
23900
23973
|
/**
|
|
23901
23974
|
* Update zoom
|
|
@@ -23953,10 +24026,10 @@ var zoom = {
|
|
|
23953
24026
|
// https://bugs.webkit.org/show_bug.cgi?id=226683#c3
|
|
23954
24027
|
// https://stackoverflow.com/questions/67836886/wheel-event-is-not-fired-on-a-svg-group-element-in-safari
|
|
23955
24028
|
if (win.GestureEvent &&
|
|
23956
|
-
/^((?!chrome|android|mobile).)*safari/i.test((_a = win.navigator) === null || _a ===
|
|
24029
|
+
/^((?!chrome|android|mobile).)*safari/i.test((_a = win.navigator) === null || _a === void 0 ? void 0 : _a.userAgent)) {
|
|
23957
24030
|
svg.on("wheel", function () { });
|
|
23958
24031
|
}
|
|
23959
|
-
eventRect === null || eventRect ===
|
|
24032
|
+
eventRect === null || eventRect === void 0 ? void 0 : eventRect.call(behaviour).on("dblclick.zoom", null);
|
|
23960
24033
|
},
|
|
23961
24034
|
/**
|
|
23962
24035
|
* Initialize the drag behaviour used for zooming.
|
|
@@ -24063,7 +24136,7 @@ var zoom = {
|
|
|
24063
24136
|
getZoomTransform: function () {
|
|
24064
24137
|
var $$ = this;
|
|
24065
24138
|
var eventRect = $$.$el.eventRect;
|
|
24066
|
-
return (eventRect === null || eventRect ===
|
|
24139
|
+
return (eventRect === null || eventRect === void 0 ? void 0 : eventRect.node()) ? zoomTransform(eventRect.node()) : { k: 1 };
|
|
24067
24140
|
}
|
|
24068
24141
|
};
|
|
24069
24142
|
|
|
@@ -24107,7 +24180,7 @@ var drag = {
|
|
|
24107
24180
|
// TODO: binary search when multiple xs
|
|
24108
24181
|
main.selectAll(".".concat($SHAPE.shapes))
|
|
24109
24182
|
.selectAll(".".concat($SHAPE.shape))
|
|
24110
|
-
.filter(function (d) { return isSelectable === null || isSelectable ===
|
|
24183
|
+
.filter(function (d) { return isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d); })
|
|
24111
24184
|
.each(function (d, i) {
|
|
24112
24185
|
var shape = select(this);
|
|
24113
24186
|
var isSelected = shape.classed($SELECT.SELECTED);
|
|
@@ -24215,7 +24288,7 @@ var selection = __assign(__assign({}, drag), {
|
|
|
24215
24288
|
unselectPoint: function (target, d, i) {
|
|
24216
24289
|
var $$ = this;
|
|
24217
24290
|
var config = $$.config, main = $$.$el.main, $T = $$.$T;
|
|
24218
|
-
callFn(config.data_onunselected, $$.api, d, target === null || target ===
|
|
24291
|
+
callFn(config.data_onunselected, $$.api, d, target === null || target === void 0 ? void 0 : target.node());
|
|
24219
24292
|
// remove selected-circle from low layer g
|
|
24220
24293
|
$T(main.select(".".concat($SELECT.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
24221
24294
|
.selectAll(".".concat($SELECT.selectedCircle, "-").concat(i)))
|
|
@@ -24303,7 +24376,7 @@ var selection = __assign(__assign({}, drag), {
|
|
|
24303
24376
|
var toggle_1 = $$.getToggle(that, d).bind($$);
|
|
24304
24377
|
var toggledShape_1;
|
|
24305
24378
|
if (!config.data_selection_multiple) {
|
|
24306
|
-
var focusOnly = (_a = $$.isPointFocusOnly) === null || _a ===
|
|
24379
|
+
var focusOnly = (_a = $$.isPointFocusOnly) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
24307
24380
|
var selector = ".".concat(focusOnly ? $SELECT.selectedCircles : $SHAPE.shapes);
|
|
24308
24381
|
if (config.data_selection_grouped) {
|
|
24309
24382
|
selector += $$.getTargetSelectorSuffix(d.id);
|
|
@@ -24647,7 +24720,7 @@ var zoomModule = function () {
|
|
|
24647
24720
|
var defaults = {};
|
|
24648
24721
|
/**
|
|
24649
24722
|
* @namespace bb
|
|
24650
|
-
* @version 3.
|
|
24723
|
+
* @version 3.15.0-next.2
|
|
24651
24724
|
*/
|
|
24652
24725
|
var bb = {
|
|
24653
24726
|
/**
|
|
@@ -24657,7 +24730,7 @@ var bb = {
|
|
|
24657
24730
|
* bb.version; // "1.0.0"
|
|
24658
24731
|
* @memberof bb
|
|
24659
24732
|
*/
|
|
24660
|
-
version: "3.
|
|
24733
|
+
version: "3.15.0-next.2",
|
|
24661
24734
|
/**
|
|
24662
24735
|
* Generate chart
|
|
24663
24736
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|