@neo4j-ndl/react-charts 2.1.22 → 2.2.0
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/lib/LICENSES.txt +0 -295
- package/lib/NOTICE.txt +1383 -1392
- package/lib/{esm/charts/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.js} +13 -5
- package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js +46 -0
- package/lib/{esm/charts/tests/ChartWrapperWithTooltipFormatter.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js} +12 -13
- package/lib/{esm/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js} +13 -2
- package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.js +35 -0
- package/lib/{esm/charts/utils/chart-types.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.js} +10 -2
- package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.js +37 -0
- package/lib/cjs/_virtual/_rolldown/runtime.js +44 -0
- package/lib/cjs/charts/Chart.js +121 -111
- package/lib/cjs/charts/Chart.js.map +1 -1
- package/lib/cjs/charts/ChartContainer.js +67 -62
- package/lib/cjs/charts/ChartContainer.js.map +1 -1
- package/lib/cjs/charts/ChartEmpty.js +45 -30
- package/lib/cjs/charts/ChartEmpty.js.map +1 -1
- package/lib/cjs/charts/ChartRender.js +112 -87
- package/lib/cjs/charts/ChartRender.js.map +1 -1
- package/lib/cjs/charts/ChartTooltip.js +111 -65
- package/lib/cjs/charts/ChartTooltip.js.map +1 -1
- package/lib/cjs/charts/Legend.js +81 -69
- package/lib/cjs/charts/Legend.js.map +1 -1
- package/lib/cjs/charts/LegendItem.js +83 -62
- package/lib/cjs/charts/LegendItem.js.map +1 -1
- package/lib/cjs/charts/LegendLayout.js +330 -348
- package/lib/cjs/charts/LegendLayout.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-instance.js +115 -122
- package/lib/cjs/charts/hooks/use-chart-instance.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-option.js +79 -80
- package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-refs.js +47 -44
- package/lib/cjs/charts/hooks/use-chart-refs.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-zoom.js +102 -127
- package/lib/cjs/charts/hooks/use-chart-zoom.js.map +1 -1
- package/lib/cjs/charts/hooks/use-legend-interactions.js +127 -132
- package/lib/cjs/charts/hooks/use-legend-interactions.js.map +1 -1
- package/lib/cjs/charts/hooks/use-legend-series.js +143 -174
- package/lib/cjs/charts/hooks/use-legend-series.js.map +1 -1
- package/lib/cjs/charts/hooks/use-legend-visibility.js +66 -85
- package/lib/cjs/charts/hooks/use-legend-visibility.js.map +1 -1
- package/lib/cjs/charts/index.js +31 -40
- package/lib/cjs/charts/index.js.map +1 -1
- package/lib/cjs/charts/themes/ndl-echarts-theme.js +136 -168
- package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
- package/lib/cjs/charts/utils/aria-description.js +150 -214
- package/lib/cjs/charts/utils/aria-description.js.map +1 -1
- package/lib/cjs/charts/utils/build-chart-option.js +166 -174
- package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
- package/lib/cjs/charts/utils/chart-tooltip-formatter.js +156 -172
- package/lib/cjs/charts/utils/chart-tooltip-formatter.js.map +1 -1
- package/lib/cjs/charts/utils/chart-types.js +25 -20
- package/lib/cjs/charts/utils/chart-types.js.map +1 -1
- package/lib/cjs/charts/utils/defaults.js +69 -67
- package/lib/cjs/charts/utils/defaults.js.map +1 -1
- package/lib/cjs/charts/utils/format-utils.js +55 -66
- package/lib/cjs/charts/utils/format-utils.js.map +1 -1
- package/lib/cjs/charts/utils/legend-layout.js +54 -53
- package/lib/cjs/charts/utils/legend-layout.js.map +1 -1
- package/lib/cjs/charts/utils/legend-utils.js +82 -121
- package/lib/cjs/charts/utils/legend-utils.js.map +1 -1
- package/lib/cjs/charts/utils/scatter-tooltip-points.js +191 -266
- package/lib/cjs/charts/utils/scatter-tooltip-points.js.map +1 -1
- package/lib/cjs/charts/utils/threshold.js +89 -102
- package/lib/cjs/charts/utils/threshold.js.map +1 -1
- package/lib/cjs/charts/utils/user-option-utils.js +419 -347
- package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
- package/lib/cjs/index.js +31 -35
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.mjs +11 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.mjs +24 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.mjs +12 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.mjs +11 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.mjs +13 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.mjs +8 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.mjs +10 -0
- package/lib/esm/charts/Chart.mjs +123 -0
- package/lib/esm/charts/Chart.mjs.map +1 -0
- package/lib/esm/charts/ChartContainer.mjs +71 -0
- package/lib/esm/charts/ChartContainer.mjs.map +1 -0
- package/lib/esm/charts/ChartEmpty.mjs +46 -0
- package/lib/esm/charts/ChartEmpty.mjs.map +1 -0
- package/lib/esm/charts/ChartRender.mjs +113 -0
- package/lib/esm/charts/ChartRender.mjs.map +1 -0
- package/lib/esm/charts/ChartTooltip.mjs +109 -0
- package/lib/esm/charts/ChartTooltip.mjs.map +1 -0
- package/lib/esm/charts/Legend.mjs +82 -0
- package/lib/esm/charts/Legend.mjs.map +1 -0
- package/lib/esm/charts/LegendItem.mjs +82 -0
- package/lib/esm/charts/LegendItem.mjs.map +1 -0
- package/lib/esm/charts/LegendLayout.mjs +337 -0
- package/lib/esm/charts/LegendLayout.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-instance.mjs +119 -0
- package/lib/esm/charts/hooks/use-chart-instance.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-option.mjs +79 -0
- package/lib/esm/charts/hooks/use-chart-option.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-refs.mjs +49 -0
- package/lib/esm/charts/hooks/use-chart-refs.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-zoom.mjs +102 -0
- package/lib/esm/charts/hooks/use-chart-zoom.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-legend-interactions.mjs +138 -0
- package/lib/esm/charts/hooks/use-legend-interactions.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-legend-series.mjs +151 -0
- package/lib/esm/charts/hooks/use-legend-series.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-legend-visibility.mjs +67 -0
- package/lib/esm/charts/hooks/use-legend-visibility.mjs.map +1 -0
- package/lib/esm/charts/index.mjs +27 -0
- package/lib/esm/charts/index.mjs.map +1 -0
- package/lib/esm/charts/themes/ndl-echarts-theme.mjs +139 -0
- package/lib/esm/charts/themes/ndl-echarts-theme.mjs.map +1 -0
- package/lib/esm/charts/utils/aria-description.mjs +162 -0
- package/lib/esm/charts/utils/aria-description.mjs.map +1 -0
- package/lib/esm/charts/utils/build-chart-option.mjs +184 -0
- package/lib/esm/charts/utils/build-chart-option.mjs.map +1 -0
- package/lib/esm/charts/utils/chart-tooltip-formatter.mjs +159 -0
- package/lib/esm/charts/utils/chart-tooltip-formatter.mjs.map +1 -0
- package/lib/esm/charts/utils/chart-types.mjs +24 -0
- package/lib/esm/charts/utils/chart-types.mjs.map +1 -0
- package/lib/esm/charts/utils/defaults.mjs +73 -0
- package/lib/esm/charts/utils/defaults.mjs.map +1 -0
- package/lib/esm/charts/utils/format-utils.mjs +61 -0
- package/lib/esm/charts/utils/format-utils.mjs.map +1 -0
- package/lib/esm/charts/utils/legend-layout.mjs +57 -0
- package/lib/esm/charts/utils/legend-layout.mjs.map +1 -0
- package/lib/esm/charts/utils/legend-utils.mjs +90 -0
- package/lib/esm/charts/utils/legend-utils.mjs.map +1 -0
- package/lib/esm/charts/utils/scatter-tooltip-points.mjs +215 -0
- package/lib/esm/charts/utils/scatter-tooltip-points.mjs.map +1 -0
- package/lib/esm/charts/utils/threshold.mjs +92 -0
- package/lib/esm/charts/utils/threshold.mjs.map +1 -0
- package/lib/esm/charts/utils/user-option-utils.mjs +445 -0
- package/lib/esm/charts/utils/user-option-utils.mjs.map +1 -0
- package/lib/esm/index.mjs +27 -0
- package/lib/esm/index.mjs.map +1 -0
- package/package.json +12 -16
- package/skills/ndl-react-charts/SKILL.md +2 -2
- package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js +0 -38
- package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
- package/lib/cjs/charts/tests/ChartZoomHarness.js +0 -113
- package/lib/cjs/charts/tests/ChartZoomHarness.js.map +0 -1
- package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +0 -78
- package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
- package/lib/cjs/charts/tests/PieChartWithRerender.js +0 -46
- package/lib/cjs/charts/tests/PieChartWithRerender.js.map +0 -1
- package/lib/cjs/charts/tests/chart-test-utils.js +0 -527
- package/lib/cjs/charts/tests/chart-test-utils.js.map +0 -1
- package/lib/esm/charts/Chart.js +0 -114
- package/lib/esm/charts/Chart.js.map +0 -1
- package/lib/esm/charts/ChartContainer.js +0 -67
- package/lib/esm/charts/ChartContainer.js.map +0 -1
- package/lib/esm/charts/ChartEmpty.js +0 -33
- package/lib/esm/charts/ChartEmpty.js.map +0 -1
- package/lib/esm/charts/ChartRender.js +0 -89
- package/lib/esm/charts/ChartRender.js.map +0 -1
- package/lib/esm/charts/ChartTooltip.js +0 -64
- package/lib/esm/charts/ChartTooltip.js.map +0 -1
- package/lib/esm/charts/Legend.js +0 -71
- package/lib/esm/charts/Legend.js.map +0 -1
- package/lib/esm/charts/LegendItem.js +0 -61
- package/lib/esm/charts/LegendItem.js.map +0 -1
- package/lib/esm/charts/LegendLayout.js +0 -323
- package/lib/esm/charts/LegendLayout.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-instance.js +0 -128
- package/lib/esm/charts/hooks/use-chart-instance.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-option.js +0 -82
- package/lib/esm/charts/hooks/use-chart-option.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-refs.js +0 -48
- package/lib/esm/charts/hooks/use-chart-refs.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-zoom.js +0 -129
- package/lib/esm/charts/hooks/use-chart-zoom.js.map +0 -1
- package/lib/esm/charts/hooks/use-legend-interactions.js +0 -145
- package/lib/esm/charts/hooks/use-legend-interactions.js.map +0 -1
- package/lib/esm/charts/hooks/use-legend-series.js +0 -184
- package/lib/esm/charts/hooks/use-legend-series.js.map +0 -1
- package/lib/esm/charts/hooks/use-legend-visibility.js +0 -87
- package/lib/esm/charts/hooks/use-legend-visibility.js.map +0 -1
- package/lib/esm/charts/index.js.map +0 -1
- package/lib/esm/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
- package/lib/esm/charts/tests/ChartZoomHarness.js +0 -109
- package/lib/esm/charts/tests/ChartZoomHarness.js.map +0 -1
- package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +0 -74
- package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
- package/lib/esm/charts/tests/PieChartWithRerender.js +0 -43
- package/lib/esm/charts/tests/PieChartWithRerender.js.map +0 -1
- package/lib/esm/charts/tests/chart-test-utils.js +0 -500
- package/lib/esm/charts/tests/chart-test-utils.js.map +0 -1
- package/lib/esm/charts/themes/ndl-echarts-theme.js +0 -172
- package/lib/esm/charts/themes/ndl-echarts-theme.js.map +0 -1
- package/lib/esm/charts/utils/aria-description.js +0 -228
- package/lib/esm/charts/utils/aria-description.js.map +0 -1
- package/lib/esm/charts/utils/build-chart-option.js +0 -193
- package/lib/esm/charts/utils/build-chart-option.js.map +0 -1
- package/lib/esm/charts/utils/chart-tooltip-formatter.js +0 -177
- package/lib/esm/charts/utils/chart-tooltip-formatter.js.map +0 -1
- package/lib/esm/charts/utils/chart-types.js.map +0 -1
- package/lib/esm/charts/utils/defaults.js +0 -73
- package/lib/esm/charts/utils/defaults.js.map +0 -1
- package/lib/esm/charts/utils/format-utils.js +0 -74
- package/lib/esm/charts/utils/format-utils.js.map +0 -1
- package/lib/esm/charts/utils/legend-layout.js +0 -59
- package/lib/esm/charts/utils/legend-layout.js.map +0 -1
- package/lib/esm/charts/utils/legend-utils.js +0 -131
- package/lib/esm/charts/utils/legend-utils.js.map +0 -1
- package/lib/esm/charts/utils/scatter-tooltip-points.js +0 -291
- package/lib/esm/charts/utils/scatter-tooltip-points.js.map +0 -1
- package/lib/esm/charts/utils/threshold.js +0 -106
- package/lib/esm/charts/utils/threshold.js.map +0 -1
- package/lib/esm/charts/utils/user-option-utils.js +0 -374
- package/lib/esm/charts/utils/user-option-utils.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
|
@@ -1,384 +1,456 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
const require_charts_ChartTooltip = require("../ChartTooltip.js");
|
|
7
|
+
const require_charts_utils_chart_tooltip_formatter = require("./chart-tooltip-formatter.js");
|
|
8
|
+
const require_charts_utils_defaults = require("./defaults.js");
|
|
9
|
+
const require_charts_utils_format_utils = require("./format-utils.js");
|
|
10
|
+
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
let _neo4j_ndl_base = require("@neo4j-ndl/base");
|
|
13
|
+
let react_dom_server = require("react-dom/server");
|
|
14
|
+
// src/charts/utils/user-option-utils.tsx
|
|
5
15
|
/*!
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) "Neo4j"
|
|
18
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
19
|
+
*
|
|
20
|
+
* This file is part of Neo4j.
|
|
21
|
+
*
|
|
22
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
23
|
+
* it under the terms of the GNU General Public License as published by
|
|
24
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
25
|
+
* (at your option) any later version.
|
|
26
|
+
*
|
|
27
|
+
* This program is distributed in the hope that it will be useful,
|
|
28
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
29
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
30
|
+
* GNU General Public License for more details.
|
|
31
|
+
*
|
|
32
|
+
* You should have received a copy of the GNU General Public License
|
|
33
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
34
|
+
*/
|
|
35
|
+
const defaultColors = Object.values(_neo4j_ndl_base.tokens.categorical);
|
|
36
|
+
const mergeAxisTooltip = (tooltip) => require_objectSpread2.default({
|
|
37
|
+
formatter: (params) => {
|
|
38
|
+
var _params$isTruncated;
|
|
39
|
+
return ((_params$isTruncated = params.isTruncated) === null || _params$isTruncated === void 0 ? void 0 : _params$isTruncated.call(params)) === true ? (0, react_dom_server.renderToString)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40
|
+
className: "ndl-tooltip-content ndl-tooltip-content-simple",
|
|
41
|
+
children: params.name
|
|
42
|
+
})) : void 0;
|
|
43
|
+
},
|
|
44
|
+
show: true
|
|
45
|
+
}, tooltip);
|
|
46
|
+
const mergeSeries = (series, theme = "light", userOption, palette) => {
|
|
47
|
+
const colors = palette !== null && palette !== void 0 ? palette : defaultColors;
|
|
48
|
+
return series.map((option, index = 0) => {
|
|
49
|
+
var _option$color;
|
|
50
|
+
if (option === void 0) return {};
|
|
51
|
+
const color = Array.isArray(option.color) ? option.color[index] : (_option$color = option.color) !== null && _option$color !== void 0 ? _option$color : colors[index % colors.length];
|
|
52
|
+
if (option.type === "thresholdLine") {
|
|
53
|
+
const { notificationType } = option;
|
|
54
|
+
const thresholdLineName = `thresholdLine-${notificationType}`;
|
|
55
|
+
return require_objectSpread2.default(require_objectSpread2.default({
|
|
56
|
+
symbolSize: 9,
|
|
57
|
+
symbol: "none",
|
|
58
|
+
condition: require_charts_utils_defaults.defaultThresholdLineSeriesOption.condition
|
|
59
|
+
}, option), {}, {
|
|
60
|
+
lineStyle: require_objectSpread2.default({
|
|
61
|
+
type: "dashed",
|
|
62
|
+
width: 2
|
|
63
|
+
}, option.lineStyle),
|
|
64
|
+
name: thresholdLineName,
|
|
65
|
+
type: "line",
|
|
66
|
+
data: [[option.xAxis[0], option.yAxis], [option.xAxis[1], option.yAxis]]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (option.type === "line") {
|
|
70
|
+
var _option$emphasis;
|
|
71
|
+
const shadowParts = _neo4j_ndl_base.tokens.theme[theme].boxShadow.raised.split(/ (?=\d+px|rgba?\()/);
|
|
72
|
+
return require_objectSpread2.default(require_objectSpread2.default({
|
|
73
|
+
type: "line",
|
|
74
|
+
symbolSize: 9,
|
|
75
|
+
color,
|
|
76
|
+
symbol: "none"
|
|
77
|
+
}, option), {}, {
|
|
78
|
+
lineStyle: require_objectSpread2.default({
|
|
79
|
+
type: "solid",
|
|
80
|
+
width: 2
|
|
81
|
+
}, option.lineStyle),
|
|
82
|
+
emphasis: require_objectSpread2.default(require_objectSpread2.default({
|
|
83
|
+
disabled: true,
|
|
84
|
+
focus: "series"
|
|
85
|
+
}, option.emphasis), {}, {
|
|
86
|
+
itemStyle: require_objectSpread2.default({
|
|
87
|
+
borderColor: _neo4j_ndl_base.tokens.theme[theme].color.neutral.bg.weak,
|
|
88
|
+
shadowBlur: parseInt(shadowParts[2]),
|
|
89
|
+
shadowColor: shadowParts[4],
|
|
90
|
+
shadowOffsetX: parseInt(shadowParts[0]),
|
|
91
|
+
shadowOffsetY: parseInt(shadowParts[1])
|
|
92
|
+
}, (_option$emphasis = option.emphasis) === null || _option$emphasis === void 0 ? void 0 : _option$emphasis.itemStyle),
|
|
93
|
+
label: { show: false }
|
|
94
|
+
}, option.emphasis)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (option.type === "pie") {
|
|
98
|
+
var _option$blur, _option$blur2;
|
|
99
|
+
const valueFormatter = require_charts_utils_chart_tooltip_formatter.getTooltipValueFormatter(userOption);
|
|
100
|
+
return require_objectSpread2.default(require_objectSpread2.default({
|
|
101
|
+
animationDuration: 600,
|
|
102
|
+
animationType: "scale",
|
|
103
|
+
selectedMode: "single"
|
|
104
|
+
}, option), {}, {
|
|
105
|
+
blur: require_objectSpread2.default({
|
|
106
|
+
itemStyle: require_objectSpread2.default({ opacity: 1 }, (_option$blur = option.blur) === null || _option$blur === void 0 ? void 0 : _option$blur.itemStyle),
|
|
107
|
+
label: require_objectSpread2.default({ opacity: 1 }, (_option$blur2 = option.blur) === null || _option$blur2 === void 0 ? void 0 : _option$blur2.label)
|
|
108
|
+
}, option.blur),
|
|
109
|
+
emphasis: require_objectSpread2.default({
|
|
110
|
+
disabled: false,
|
|
111
|
+
focus: "self",
|
|
112
|
+
scale: true,
|
|
113
|
+
scaleSize: 5
|
|
114
|
+
}, option.emphasis),
|
|
115
|
+
itemStyle: require_objectSpread2.default({
|
|
116
|
+
borderColor: _neo4j_ndl_base.tokens.theme[theme].color.neutral.bg.weak,
|
|
117
|
+
borderWidth: 1
|
|
118
|
+
}, option.itemStyle),
|
|
119
|
+
label: require_objectSpread2.default({
|
|
120
|
+
backgroundColor: "transparent",
|
|
121
|
+
color: _neo4j_ndl_base.tokens.theme[theme].color.neutral.text.weak,
|
|
122
|
+
formatter: "{d}%"
|
|
123
|
+
}, option.label),
|
|
124
|
+
labelLine: require_objectSpread2.default({
|
|
125
|
+
length: 5,
|
|
126
|
+
show: true
|
|
127
|
+
}, option.labelLine),
|
|
128
|
+
tooltip: require_objectSpread2.default({
|
|
129
|
+
trigger: "item",
|
|
130
|
+
confine: true,
|
|
131
|
+
padding: 0,
|
|
132
|
+
borderRadius: 0,
|
|
133
|
+
borderWidth: 0,
|
|
134
|
+
extraCssText: require_charts_utils_defaults.tooltipExtraCssText,
|
|
135
|
+
formatter: function(params) {
|
|
136
|
+
var _firstParam$value$;
|
|
137
|
+
const firstParam = (Array.isArray(params) ? params : [params])[0];
|
|
138
|
+
const sliceName = (_firstParam$value$ = firstParam === null || firstParam === void 0 ? void 0 : firstParam.value[0]) !== null && _firstParam$value$ !== void 0 ? _firstParam$value$ : firstParam.seriesName;
|
|
139
|
+
const sliceLabel = sliceName instanceof Date ? require_charts_utils_format_utils.formatTimeAxisDate(sliceName) : sliceName;
|
|
140
|
+
return `${(0, react_dom_server.renderToString)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
141
|
+
className: "ndl-charts-chart-tooltip",
|
|
142
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_charts_ChartTooltip.ChartTooltip.Content, {
|
|
143
|
+
leadingElement: sliceLabel,
|
|
144
|
+
trailingElement: valueFormatter(Array.isArray(firstParam.value) ? firstParam.value[1] : firstParam.value),
|
|
145
|
+
indentSquareColor: firstParam.color
|
|
146
|
+
}, sliceLabel)
|
|
147
|
+
}))}`;
|
|
148
|
+
}
|
|
149
|
+
}, option.tooltip)
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (option.type === "scatter") {
|
|
153
|
+
var _option$emphasis2;
|
|
154
|
+
const interiorColor = _neo4j_ndl_base.tokens.theme[theme].color.neutral.bg.weak;
|
|
155
|
+
return require_objectSpread2.default(require_objectSpread2.default({
|
|
156
|
+
color,
|
|
157
|
+
symbol: "circle",
|
|
158
|
+
symbolSize: 10
|
|
159
|
+
}, option), {}, {
|
|
160
|
+
itemStyle: require_objectSpread2.default({
|
|
161
|
+
borderColor: color,
|
|
162
|
+
borderWidth: 2,
|
|
163
|
+
color: interiorColor
|
|
164
|
+
}, option.itemStyle),
|
|
165
|
+
emphasis: require_objectSpread2.default(require_objectSpread2.default({
|
|
166
|
+
disabled: false,
|
|
167
|
+
focus: "none"
|
|
168
|
+
}, option.emphasis), {}, { itemStyle: require_objectSpread2.default({
|
|
169
|
+
borderColor: color,
|
|
170
|
+
color
|
|
171
|
+
}, (_option$emphasis2 = option.emphasis) === null || _option$emphasis2 === void 0 ? void 0 : _option$emphasis2.itemStyle) })
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (option.type === "bar") {
|
|
175
|
+
var _option$blur3, _option$markLine, _option$markLine2, _option$markLine3;
|
|
176
|
+
const valueFormatter = require_charts_utils_chart_tooltip_formatter.getTooltipValueFormatter(userOption);
|
|
177
|
+
return require_objectSpread2.default(require_objectSpread2.default({ barMaxWidth: 16 }, option), {}, {
|
|
178
|
+
blur: require_objectSpread2.default({ itemStyle: require_objectSpread2.default({ opacity: .3 }, (_option$blur3 = option.blur) === null || _option$blur3 === void 0 ? void 0 : _option$blur3.itemStyle) }, option.blur),
|
|
179
|
+
emphasis: require_objectSpread2.default({
|
|
180
|
+
disabled: true,
|
|
181
|
+
focus: "series"
|
|
182
|
+
}, option.emphasis),
|
|
183
|
+
itemStyle: require_objectSpread2.default({
|
|
184
|
+
borderWidth: 20,
|
|
185
|
+
color
|
|
186
|
+
}, option.itemStyle),
|
|
187
|
+
markLine: {
|
|
188
|
+
emphasis: require_objectSpread2.default({
|
|
189
|
+
disabled: true,
|
|
190
|
+
lineStyle: require_objectSpread2.default({ width: 20 }, (_option$markLine = option.markLine) === null || _option$markLine === void 0 || (_option$markLine = _option$markLine.emphasis) === null || _option$markLine === void 0 ? void 0 : _option$markLine.lineStyle)
|
|
191
|
+
}, (_option$markLine2 = option.markLine) === null || _option$markLine2 === void 0 ? void 0 : _option$markLine2.emphasis),
|
|
192
|
+
lineStyle: require_objectSpread2.default({ width: 20 }, (_option$markLine3 = option.markLine) === null || _option$markLine3 === void 0 ? void 0 : _option$markLine3.lineStyle)
|
|
193
|
+
},
|
|
194
|
+
tooltip: require_objectSpread2.default({
|
|
195
|
+
trigger: "axis",
|
|
196
|
+
confine: true,
|
|
197
|
+
padding: 0,
|
|
198
|
+
borderRadius: 0,
|
|
199
|
+
borderWidth: 0,
|
|
200
|
+
extraCssText: require_charts_utils_defaults.tooltipExtraCssText,
|
|
201
|
+
formatter: function(params) {
|
|
202
|
+
var _firstParam$value$2;
|
|
203
|
+
const firstParam = (Array.isArray(params) ? params : [params])[0];
|
|
204
|
+
return `${(0, react_dom_server.renderToString)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
205
|
+
className: "ndl-charts-chart-tooltip",
|
|
206
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_charts_ChartTooltip.ChartTooltip.Title, { children: firstParam.name }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_charts_ChartTooltip.ChartTooltip.Content, {
|
|
207
|
+
leadingElement: firstParam.seriesName,
|
|
208
|
+
trailingElement: valueFormatter(Array.isArray(firstParam.value) ? firstParam.value[1] : firstParam.value),
|
|
209
|
+
indentSquareColor: firstParam.color
|
|
210
|
+
}, (_firstParam$value$2 = firstParam === null || firstParam === void 0 ? void 0 : firstParam.value[0]) !== null && _firstParam$value$2 !== void 0 ? _firstParam$value$2 : firstParam.seriesName)]
|
|
211
|
+
}))}`;
|
|
212
|
+
}
|
|
213
|
+
}, option.tooltip)
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return option;
|
|
217
|
+
});
|
|
115
218
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
219
|
+
const mergeXAxis = (xAxis, theme = "light") => {
|
|
220
|
+
var _xAxis$axisLine, _xAxis$axisTick;
|
|
221
|
+
if (xAxis === void 0) return [];
|
|
222
|
+
if (Array.isArray(xAxis)) return xAxis.map((axis) => mergeXAxis(axis, theme));
|
|
223
|
+
const baseXAxis = require_objectSpread2.default(require_objectSpread2.default({}, xAxis), {}, {
|
|
224
|
+
axisLabel: require_objectSpread2.default({
|
|
225
|
+
formatter: {
|
|
226
|
+
day: "{dd} {MMM}",
|
|
227
|
+
hour: "{HH}:{mm}",
|
|
228
|
+
millisecond: "{hh}:{mm}:{ss} {SSS}",
|
|
229
|
+
minute: "{HH}:{mm}",
|
|
230
|
+
month: "{MMM}",
|
|
231
|
+
none: "{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}",
|
|
232
|
+
second: "{HH}:{mm}:{ss}",
|
|
233
|
+
year: "{yearStyle|{yyyy}}\n{monthStyle|{MMM}}"
|
|
234
|
+
},
|
|
235
|
+
margin: 16,
|
|
236
|
+
overflow: "truncate"
|
|
237
|
+
}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLabel),
|
|
238
|
+
axisLine: require_objectSpread2.default({ lineStyle: require_objectSpread2.default({}, xAxis === null || xAxis === void 0 || (_xAxis$axisLine = xAxis.axisLine) === null || _xAxis$axisLine === void 0 ? void 0 : _xAxis$axisLine.lineStyle) }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisLine),
|
|
239
|
+
axisTick: require_objectSpread2.default(require_objectSpread2.default({}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick), {}, {
|
|
240
|
+
lineStyle: require_objectSpread2.default({}, xAxis === null || xAxis === void 0 || (_xAxis$axisTick = xAxis.axisTick) === null || _xAxis$axisTick === void 0 ? void 0 : _xAxis$axisTick.lineStyle),
|
|
241
|
+
show: true
|
|
242
|
+
}, xAxis === null || xAxis === void 0 ? void 0 : xAxis.axisTick),
|
|
243
|
+
splitLine: require_objectSpread2.default({ show: false }, xAxis === null || xAxis === void 0 ? void 0 : xAxis.splitLine),
|
|
244
|
+
tooltip: mergeAxisTooltip(xAxis.tooltip)
|
|
245
|
+
});
|
|
246
|
+
if (xAxis.type === "time") return require_objectSpread2.default(require_objectSpread2.default({}, baseXAxis), {}, { axisLabel: require_objectSpread2.default({ hideOverlap: true }, baseXAxis.axisLabel) });
|
|
247
|
+
if (xAxis.type === "value" || xAxis.type === "log") {
|
|
248
|
+
const xAxisFormatter = xAxis.axisLabel && "formatter" in xAxis.axisLabel ? xAxis.axisLabel.formatter : void 0;
|
|
249
|
+
return require_objectSpread2.default(require_objectSpread2.default({}, baseXAxis), {}, { axisLabel: require_objectSpread2.default(require_objectSpread2.default({}, baseXAxis.axisLabel), {}, { formatter: xAxisFormatter !== null && xAxisFormatter !== void 0 ? xAxisFormatter : require_charts_utils_format_utils.formatNumberEnUS }) });
|
|
250
|
+
}
|
|
251
|
+
if (xAxis.type === "category") return require_objectSpread2.default(require_objectSpread2.default({}, baseXAxis), {}, {
|
|
252
|
+
axisLabel: require_objectSpread2.default({ width: 80 }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisLabel),
|
|
253
|
+
axisTick: require_objectSpread2.default({ alignWithLabel: true }, baseXAxis === null || baseXAxis === void 0 ? void 0 : baseXAxis.axisTick)
|
|
254
|
+
});
|
|
255
|
+
return baseXAxis;
|
|
151
256
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
257
|
+
const mergeYAxis = (yAxis, theme = "light") => {
|
|
258
|
+
var _yAxis$axisLine, _yAxis$axisTick;
|
|
259
|
+
if (yAxis === void 0) return [];
|
|
260
|
+
if (Array.isArray(yAxis)) return yAxis.map((axis) => mergeYAxis(axis, theme));
|
|
261
|
+
const baseYAxis = require_objectSpread2.default(require_objectSpread2.default({}, yAxis), {}, {
|
|
262
|
+
axisLabel: require_objectSpread2.default({
|
|
263
|
+
margin: 8,
|
|
264
|
+
overflow: "truncate"
|
|
265
|
+
}, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLabel),
|
|
266
|
+
axisLine: require_objectSpread2.default(require_objectSpread2.default({}, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisLine), {}, {
|
|
267
|
+
lineStyle: require_objectSpread2.default({}, yAxis === null || yAxis === void 0 || (_yAxis$axisLine = yAxis.axisLine) === null || _yAxis$axisLine === void 0 ? void 0 : _yAxis$axisLine.lineStyle),
|
|
268
|
+
show: true
|
|
269
|
+
}),
|
|
270
|
+
axisTick: require_objectSpread2.default(require_objectSpread2.default({ show: false }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.axisTick), {}, { lineStyle: require_objectSpread2.default({ width: 1 }, yAxis === null || yAxis === void 0 || (_yAxis$axisTick = yAxis.axisTick) === null || _yAxis$axisTick === void 0 ? void 0 : _yAxis$axisTick.lineStyle) }),
|
|
271
|
+
splitLine: require_objectSpread2.default({ show: true }, yAxis === null || yAxis === void 0 ? void 0 : yAxis.splitLine),
|
|
272
|
+
tooltip: mergeAxisTooltip(yAxis.tooltip)
|
|
273
|
+
});
|
|
274
|
+
if (yAxis.type === "time") return require_objectSpread2.default(require_objectSpread2.default({}, baseYAxis), {}, {
|
|
275
|
+
axisLabel: require_objectSpread2.default({ hideOverlap: true }, baseYAxis.axisLabel),
|
|
276
|
+
splitLine: require_objectSpread2.default({ show: false }, baseYAxis === null || baseYAxis === void 0 ? void 0 : baseYAxis.splitLine)
|
|
277
|
+
});
|
|
278
|
+
if (yAxis.type === "value" || yAxis.type === "log") {
|
|
279
|
+
const yAxisFormatter = yAxis.axisLabel && "formatter" in yAxis.axisLabel ? yAxis.axisLabel.formatter : void 0;
|
|
280
|
+
return require_objectSpread2.default(require_objectSpread2.default({}, baseYAxis), {}, {
|
|
281
|
+
axisLabel: require_objectSpread2.default(require_objectSpread2.default({ hideOverlap: true }, baseYAxis.axisLabel), {}, { formatter: yAxisFormatter !== null && yAxisFormatter !== void 0 ? yAxisFormatter : require_charts_utils_format_utils.formatNumberEnUS }),
|
|
282
|
+
splitLine: require_objectSpread2.default({ show: false }, baseYAxis === null || baseYAxis === void 0 ? void 0 : baseYAxis.splitLine)
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (yAxis.type === "category") return require_objectSpread2.default(require_objectSpread2.default({}, baseYAxis), {}, { axisLabel: require_objectSpread2.default({ width: 100 }, baseYAxis === null || baseYAxis === void 0 ? void 0 : baseYAxis.axisLabel) });
|
|
286
|
+
return baseYAxis;
|
|
178
287
|
};
|
|
179
|
-
exports.mergeYAxis = mergeYAxis;
|
|
180
288
|
const normalizeAxisIndices = (axisIndex) => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return typeof index === 'number';
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
return [];
|
|
289
|
+
if (typeof axisIndex === "number") return [axisIndex];
|
|
290
|
+
if (Array.isArray(axisIndex)) return axisIndex.filter((index) => {
|
|
291
|
+
return typeof index === "number";
|
|
292
|
+
});
|
|
293
|
+
return [];
|
|
190
294
|
};
|
|
191
295
|
/**
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
296
|
+
* Resolves the axes a single dataZoom entry targets, mirroring ECharts' own
|
|
297
|
+
* resolution order: explicit `xAxisIndex`/`yAxisIndex` win (`false` meaning
|
|
298
|
+
* "not this axis"); when no index is given, `orient: 'vertical'` targets the
|
|
299
|
+
* first y-axis and horizontal/unset targets the first x-axis.
|
|
300
|
+
*/
|
|
197
301
|
const getSingleDataZoomTargets = (dataZoom) => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
302
|
+
if ((dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) !== "slider" && (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) !== "inside") return {
|
|
303
|
+
xAxisIndices: [],
|
|
304
|
+
yAxisIndices: []
|
|
305
|
+
};
|
|
306
|
+
if (dataZoom.xAxisIndex !== void 0 || dataZoom.yAxisIndex !== void 0) return {
|
|
307
|
+
xAxisIndices: normalizeAxisIndices(dataZoom.xAxisIndex),
|
|
308
|
+
yAxisIndices: normalizeAxisIndices(dataZoom.yAxisIndex)
|
|
309
|
+
};
|
|
310
|
+
return dataZoom.orient === "vertical" ? {
|
|
311
|
+
xAxisIndices: [],
|
|
312
|
+
yAxisIndices: [0]
|
|
313
|
+
} : {
|
|
314
|
+
xAxisIndices: [0],
|
|
315
|
+
yAxisIndices: []
|
|
316
|
+
};
|
|
211
317
|
};
|
|
212
318
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
319
|
+
* Union of the axis indices targeted by all slider/inside entries in a
|
|
320
|
+
* dataZoom config, using the same per-entry resolution as ECharts (explicit
|
|
321
|
+
* axis indices first, then orientation).
|
|
322
|
+
*/
|
|
217
323
|
const getDataZoomTargetAxes = (dataZoom) => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
targets.yAxisIndices.push(index);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return targets;
|
|
324
|
+
const entries = Array.isArray(dataZoom) ? dataZoom : [dataZoom];
|
|
325
|
+
const targets = {
|
|
326
|
+
xAxisIndices: [],
|
|
327
|
+
yAxisIndices: []
|
|
328
|
+
};
|
|
329
|
+
for (const entry of entries) {
|
|
330
|
+
const entryTargets = getSingleDataZoomTargets(entry);
|
|
331
|
+
for (const index of entryTargets.xAxisIndices) if (!targets.xAxisIndices.includes(index)) targets.xAxisIndices.push(index);
|
|
332
|
+
for (const index of entryTargets.yAxisIndices) if (!targets.yAxisIndices.includes(index)) targets.yAxisIndices.push(index);
|
|
333
|
+
}
|
|
334
|
+
return targets;
|
|
234
335
|
};
|
|
235
|
-
exports.getDataZoomTargetAxes = getDataZoomTargetAxes;
|
|
236
336
|
/**
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
337
|
+
* A slider is vertical when the consumer sets `orient: 'vertical'`, or when it
|
|
338
|
+
* only targets a y-axis, which makes ECharts infer the vertical orientation.
|
|
339
|
+
*/
|
|
240
340
|
const isVerticalSlider = (dataZoom) => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return dataZoom.orient === 'vertical';
|
|
246
|
-
}
|
|
247
|
-
const targets = getSingleDataZoomTargets(dataZoom);
|
|
248
|
-
return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;
|
|
341
|
+
if ((dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) !== "slider") return false;
|
|
342
|
+
if (dataZoom.orient !== void 0) return dataZoom.orient === "vertical";
|
|
343
|
+
const targets = getSingleDataZoomTargets(dataZoom);
|
|
344
|
+
return targets.yAxisIndices.length > 0 && targets.xAxisIndices.length === 0;
|
|
249
345
|
};
|
|
250
|
-
exports.isVerticalSlider = isVerticalSlider;
|
|
251
346
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const WINDOWED_FILTER_AXIS_TYPES = [
|
|
347
|
+
* Axis types where windowing (`filterMode: 'none'`) beats ECharts' default
|
|
348
|
+
* data filtering. Filtering a continuous axis removes whole data items outside
|
|
349
|
+
* the window, which makes bars and points vanish instead of clipping them.
|
|
350
|
+
* Category axes keep the `'filter'` default so paging through categories still
|
|
351
|
+
* rescales the opposite value axis to the visible data.
|
|
352
|
+
*/
|
|
353
|
+
const WINDOWED_FILTER_AXIS_TYPES = [
|
|
354
|
+
"log",
|
|
355
|
+
"time",
|
|
356
|
+
"value"
|
|
357
|
+
];
|
|
259
358
|
const getSingleAxisOption = (axis, axisIndex) => {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
const index = typeof axisIndex === 'number'
|
|
264
|
-
? axisIndex
|
|
265
|
-
: Array.isArray(axisIndex) && typeof axisIndex[0] === 'number'
|
|
266
|
-
? axisIndex[0]
|
|
267
|
-
: 0;
|
|
268
|
-
return axis[index];
|
|
359
|
+
if (!Array.isArray(axis)) return axis;
|
|
360
|
+
return axis[typeof axisIndex === "number" ? axisIndex : Array.isArray(axisIndex) && typeof axisIndex[0] === "number" ? axisIndex[0] : 0];
|
|
269
361
|
};
|
|
270
362
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
363
|
+
* Resolves the slider's target axis the way ECharts does (explicit axis index
|
|
364
|
+
* first, then orientation) and returns `'none'` when that axis is continuous.
|
|
365
|
+
* Returns `undefined` (keep ECharts' `'filter'` default) for category axes and
|
|
366
|
+
* for sliders that target both axes at once.
|
|
367
|
+
*/
|
|
276
368
|
const getSliderDefaultFilterMode = (dataZoom, axes) => {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const targetAxis = isYAxisTarget
|
|
284
|
-
? getSingleAxisOption(axes === null || axes === void 0 ? void 0 : axes.yAxis, dataZoom.yAxisIndex)
|
|
285
|
-
: getSingleAxisOption(axes === null || axes === void 0 ? void 0 : axes.xAxis, dataZoom.xAxisIndex);
|
|
286
|
-
return (targetAxis === null || targetAxis === void 0 ? void 0 : targetAxis.type) !== undefined &&
|
|
287
|
-
WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type)
|
|
288
|
-
? 'none'
|
|
289
|
-
: undefined;
|
|
369
|
+
const targets = getSingleDataZoomTargets(dataZoom);
|
|
370
|
+
const isXAxisTarget = targets.xAxisIndices.length > 0;
|
|
371
|
+
const isYAxisTarget = targets.yAxisIndices.length > 0;
|
|
372
|
+
if (isXAxisTarget === isYAxisTarget) return;
|
|
373
|
+
const targetAxis = isYAxisTarget ? getSingleAxisOption(axes === null || axes === void 0 ? void 0 : axes.yAxis, dataZoom.yAxisIndex) : getSingleAxisOption(axes === null || axes === void 0 ? void 0 : axes.xAxis, dataZoom.xAxisIndex);
|
|
374
|
+
return (targetAxis === null || targetAxis === void 0 ? void 0 : targetAxis.type) !== void 0 && WINDOWED_FILTER_AXIS_TYPES.includes(targetAxis.type) ? "none" : void 0;
|
|
290
375
|
};
|
|
291
376
|
const VERTICAL_SLIDER_RIGHT = 10;
|
|
292
377
|
const VERTICAL_SLIDER_WIDTH = 28;
|
|
293
378
|
const mergeDataZoom = (dataZoom, axes) => {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
return dataZoom;
|
|
379
|
+
if (Array.isArray(dataZoom)) return dataZoom.map((option) => mergeDataZoom(option, axes));
|
|
380
|
+
const isSlider = (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) === "slider";
|
|
381
|
+
const isInside = (dataZoom === null || dataZoom === void 0 ? void 0 : dataZoom.type) === "inside";
|
|
382
|
+
if (isSlider) {
|
|
383
|
+
const filterMode = getSliderDefaultFilterMode(dataZoom, axes);
|
|
384
|
+
const layoutDefaults = isVerticalSlider(dataZoom) ? {
|
|
385
|
+
right: VERTICAL_SLIDER_RIGHT,
|
|
386
|
+
textStyle: {
|
|
387
|
+
overflow: "truncate",
|
|
388
|
+
width: 48
|
|
389
|
+
},
|
|
390
|
+
width: VERTICAL_SLIDER_WIDTH
|
|
391
|
+
} : {
|
|
392
|
+
bottom: 10,
|
|
393
|
+
height: 28
|
|
394
|
+
};
|
|
395
|
+
return require_objectSpread2.default(require_objectSpread2.default(require_objectSpread2.default({}, filterMode !== void 0 && { filterMode }), layoutDefaults), {}, {
|
|
396
|
+
show: true,
|
|
397
|
+
type: "slider"
|
|
398
|
+
}, dataZoom);
|
|
399
|
+
} else if (isInside) {
|
|
400
|
+
const targets = getSingleDataZoomTargets(dataZoom);
|
|
401
|
+
const hasDefaultXAxisTarget = dataZoom.xAxisIndex === void 0 && targets.xAxisIndices.length > 0;
|
|
402
|
+
return require_objectSpread2.default(require_objectSpread2.default({ filterMode: "none" }, hasDefaultXAxisTarget && { xAxisIndex: [0] }), {}, { zoomOnMouseWheel: false }, dataZoom);
|
|
403
|
+
}
|
|
404
|
+
return dataZoom;
|
|
322
405
|
};
|
|
323
|
-
exports.mergeDataZoom = mergeDataZoom;
|
|
324
406
|
const isContinuousAxisOption = (axisOption) => {
|
|
325
|
-
|
|
326
|
-
WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type));
|
|
407
|
+
return (axisOption === null || axisOption === void 0 ? void 0 : axisOption.type) !== void 0 && WINDOWED_FILTER_AXIS_TYPES.includes(axisOption.type);
|
|
327
408
|
};
|
|
328
409
|
const areTargetAxesContinuous = (axis, axisIndices) => {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
});
|
|
410
|
+
if (axisIndices === "all") {
|
|
411
|
+
const axisOptions = Array.isArray(axis) ? axis : [axis];
|
|
412
|
+
return axisOptions.length > 0 && axisOptions.every((axisOption) => {
|
|
413
|
+
return isContinuousAxisOption(axisOption);
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return axisIndices.every((axisIndex) => {
|
|
417
|
+
return isContinuousAxisOption(getSingleAxisOption(axis, axisIndex));
|
|
418
|
+
});
|
|
339
419
|
};
|
|
340
420
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
421
|
+
* Returns `'none'` when every axis targeted by the drag-to-zoom brush is
|
|
422
|
+
* continuous (`value`/`time`/`log`), matching the slider rule: filtering a
|
|
423
|
+
* continuous axis removes whole data items outside the selection instead of
|
|
424
|
+
* clipping them. Category (or unknown) targets keep ECharts' `'filter'`
|
|
425
|
+
* default.
|
|
426
|
+
*/
|
|
347
427
|
const getBrushDefaultFilterMode = (context, xAxisTargets, yAxisTargets) => {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (yAxisTargets !== false) {
|
|
353
|
-
checks.push(areTargetAxesContinuous(context === null || context === void 0 ? void 0 : context.yAxis, yAxisTargets));
|
|
354
|
-
}
|
|
355
|
-
return checks.length > 0 && checks.every(Boolean) ? 'none' : undefined;
|
|
428
|
+
const checks = [];
|
|
429
|
+
if (xAxisTargets !== false) checks.push(areTargetAxesContinuous(context === null || context === void 0 ? void 0 : context.xAxis, xAxisTargets));
|
|
430
|
+
if (yAxisTargets !== false) checks.push(areTargetAxesContinuous(context === null || context === void 0 ? void 0 : context.yAxis, yAxisTargets));
|
|
431
|
+
return checks.length > 0 && checks.every(Boolean) ? "none" : void 0;
|
|
356
432
|
};
|
|
357
433
|
const mergeToolbox = (toolbox, context) => {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const filterMode = getBrushDefaultFilterMode(context, xAxisTargets, yAxisTargets);
|
|
372
|
-
return {
|
|
373
|
-
feature: {
|
|
374
|
-
dataZoom: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (filterMode !== undefined && { filterMode })), (xAxisTargets !== 'all' && { xAxisIndex: xAxisTargets })), { yAxisIndex: yAxisTargets }), (_a = toolbox === null || toolbox === void 0 ? void 0 : toolbox.feature) === null || _a === void 0 ? void 0 : _a.dataZoom), { icon: {
|
|
375
|
-
// This hack removes the icons.
|
|
376
|
-
// Due to: https://github.com/apache/echarts/issues/10274
|
|
377
|
-
back: '-',
|
|
378
|
-
zoom: '-',
|
|
379
|
-
}, show: true }),
|
|
380
|
-
},
|
|
381
|
-
};
|
|
434
|
+
var _toolbox$feature;
|
|
435
|
+
if (Array.isArray(toolbox)) return toolbox.map((option) => mergeToolbox(option, context));
|
|
436
|
+
const targets = getDataZoomTargetAxes(context === null || context === void 0 ? void 0 : context.dataZoom);
|
|
437
|
+
const xAxisTargets = targets.xAxisIndices.length > 0 || targets.yAxisIndices.length > 0 ? targets.xAxisIndices.length > 0 && targets.xAxisIndices : "all";
|
|
438
|
+
const yAxisTargets = targets.yAxisIndices.length > 0 && targets.yAxisIndices;
|
|
439
|
+
const filterMode = getBrushDefaultFilterMode(context, xAxisTargets, yAxisTargets);
|
|
440
|
+
return { feature: { dataZoom: require_objectSpread2.default(require_objectSpread2.default(require_objectSpread2.default(require_objectSpread2.default({}, filterMode !== void 0 && { filterMode }), xAxisTargets !== "all" && { xAxisIndex: xAxisTargets }), {}, { yAxisIndex: yAxisTargets }, toolbox === null || toolbox === void 0 || (_toolbox$feature = toolbox.feature) === null || _toolbox$feature === void 0 ? void 0 : _toolbox$feature.dataZoom), {}, {
|
|
441
|
+
icon: {
|
|
442
|
+
back: "-",
|
|
443
|
+
zoom: "-"
|
|
444
|
+
},
|
|
445
|
+
show: true
|
|
446
|
+
}) } };
|
|
382
447
|
};
|
|
448
|
+
exports.getDataZoomTargetAxes = getDataZoomTargetAxes;
|
|
449
|
+
exports.isVerticalSlider = isVerticalSlider;
|
|
450
|
+
exports.mergeDataZoom = mergeDataZoom;
|
|
451
|
+
exports.mergeSeries = mergeSeries;
|
|
383
452
|
exports.mergeToolbox = mergeToolbox;
|
|
453
|
+
exports.mergeXAxis = mergeXAxis;
|
|
454
|
+
exports.mergeYAxis = mergeYAxis;
|
|
455
|
+
|
|
384
456
|
//# sourceMappingURL=user-option-utils.js.map
|