@neo4j-ndl/react-charts 2.1.21 → 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,71 +1,76 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
*
|
|
3
|
-
* Copyright (c) "Neo4j"
|
|
4
|
-
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
-
*
|
|
6
|
-
* This file is part of Neo4j.
|
|
7
|
-
*
|
|
8
|
-
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU General Public License as published by
|
|
10
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
* (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU General Public License
|
|
19
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
1
|
"use strict";
|
|
23
|
-
Object.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
// src/charts/ChartContainer.tsx
|
|
10
|
+
/*!
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) "Neo4j"
|
|
13
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
14
|
+
*
|
|
15
|
+
* This file is part of Neo4j.
|
|
16
|
+
*
|
|
17
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
18
|
+
* it under the terms of the GNU General Public License as published by
|
|
19
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
20
|
+
* (at your option) any later version.
|
|
21
|
+
*
|
|
22
|
+
* This program is distributed in the hope that it will be useful,
|
|
23
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25
|
+
* GNU General Public License for more details.
|
|
26
|
+
*
|
|
27
|
+
* You should have received a copy of the GNU General Public License
|
|
28
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
29
|
+
*/
|
|
30
|
+
const EXPANDED_LEGEND_MAX_HEIGHT_RATIO = .3;
|
|
28
31
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
* Tracks the outer chart container height.
|
|
33
|
+
*
|
|
34
|
+
* The measured height is used to expose CSS sizing data to descendants, most
|
|
35
|
+
* notably the expanded legend max height. A ResizeObserver keeps the value in
|
|
36
|
+
* sync with parent layout changes.
|
|
37
|
+
*/
|
|
35
38
|
const useChartContainerHeight = (chartRef) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, [chartRef, updateChartContainerHeight]);
|
|
53
|
-
return chartContainerHeight;
|
|
39
|
+
const [chartContainerHeight, setChartContainerHeight] = (0, react.useState)();
|
|
40
|
+
const updateChartContainerHeight = (0, react.useCallback)(() => {
|
|
41
|
+
var _chartRef$current;
|
|
42
|
+
setChartContainerHeight((_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 ? void 0 : _chartRef$current.clientHeight);
|
|
43
|
+
}, [chartRef]);
|
|
44
|
+
(0, react.useEffect)(() => {
|
|
45
|
+
updateChartContainerHeight();
|
|
46
|
+
const chartContainer = chartRef.current;
|
|
47
|
+
if (!chartContainer) return;
|
|
48
|
+
const resizeObserver = new ResizeObserver(updateChartContainerHeight);
|
|
49
|
+
resizeObserver.observe(chartContainer);
|
|
50
|
+
return () => {
|
|
51
|
+
resizeObserver.disconnect();
|
|
52
|
+
};
|
|
53
|
+
}, [chartRef, updateChartContainerHeight]);
|
|
54
|
+
return chartContainerHeight;
|
|
54
55
|
};
|
|
55
56
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
* Provides the chart grid shell and CSS variables shared by the ECharts canvas
|
|
58
|
+
* and legend rows.
|
|
59
|
+
*
|
|
60
|
+
* The container owns the measurement ref for the full chart area so the legend
|
|
61
|
+
* can cap expanded height relative to the available chart height.
|
|
62
|
+
*/
|
|
62
63
|
const ChartContainer = ({ children, style }) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
const chartRef = (0, react.useRef)(null);
|
|
65
|
+
const chartContainerHeight = useChartContainerHeight(chartRef);
|
|
66
|
+
const chartContainerStyle = (0, react.useMemo)(() => require_objectSpread2.default(require_objectSpread2.default({}, style), {}, { "--ndl-chart-legend-expanded-max-height": chartContainerHeight === void 0 ? void 0 : `${Math.floor(chartContainerHeight * EXPANDED_LEGEND_MAX_HEIGHT_RATIO)}px` }), [chartContainerHeight, style]);
|
|
67
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
68
|
+
ref: chartRef,
|
|
69
|
+
className: "ndl-chart",
|
|
70
|
+
style: chartContainerStyle,
|
|
71
|
+
children
|
|
72
|
+
});
|
|
69
73
|
};
|
|
70
74
|
exports.ChartContainer = ChartContainer;
|
|
75
|
+
|
|
71
76
|
//# sourceMappingURL=ChartContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartContainer.js","
|
|
1
|
+
{"version":3,"file":"ChartContainer.js","names":["useState","useCallback","useRef","useMemo"],"sources":["../../../src/charts/ChartContainer.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type React from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nconst EXPANDED_LEGEND_MAX_HEIGHT_RATIO = 0.3;\n\n/**\n * Tracks the outer chart container height.\n *\n * The measured height is used to expose CSS sizing data to descendants, most\n * notably the expanded legend max height. A ResizeObserver keeps the value in\n * sync with parent layout changes.\n */\nconst useChartContainerHeight = (\n chartRef: React.RefObject<HTMLDivElement | null>,\n) => {\n const [chartContainerHeight, setChartContainerHeight] = useState<number>();\n\n const updateChartContainerHeight = useCallback(() => {\n setChartContainerHeight(chartRef.current?.clientHeight);\n }, [chartRef]);\n\n useEffect(() => {\n updateChartContainerHeight();\n\n const chartContainer = chartRef.current;\n if (!chartContainer) {\n return;\n }\n\n const resizeObserver = new ResizeObserver(updateChartContainerHeight);\n resizeObserver.observe(chartContainer);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [chartRef, updateChartContainerHeight]);\n\n return chartContainerHeight;\n};\n\ntype ChartContainerProps = {\n children: React.ReactNode;\n style?: React.CSSProperties;\n};\n\n/**\n * Provides the chart grid shell and CSS variables shared by the ECharts canvas\n * and legend rows.\n *\n * The container owns the measurement ref for the full chart area so the legend\n * can cap expanded height relative to the available chart height.\n */\nexport const ChartContainer = ({ children, style }: ChartContainerProps) => {\n const chartRef = useRef<HTMLDivElement>(null);\n const chartContainerHeight = useChartContainerHeight(chartRef);\n const chartContainerStyle = useMemo(\n () =>\n ({\n ...style,\n '--ndl-chart-legend-expanded-max-height':\n chartContainerHeight === undefined\n ? undefined\n : `${Math.floor(\n chartContainerHeight * EXPANDED_LEGEND_MAX_HEIGHT_RATIO,\n )}px`,\n }) as React.CSSProperties,\n [chartContainerHeight, style],\n );\n\n return (\n <div ref={chartRef} className=\"ndl-chart\" style={chartContainerStyle}>\n {children}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,mCAAmC;;;;;;;;AASzC,MAAM,2BACJ,aACG;CACH,MAAM,CAAC,sBAAsB,4BAAA,GAA2BA,MAAAA,SAAAA,CAAiB;CAEzE,MAAM,8BAAA,GAA6BC,MAAAA,YAAAA,OAAkB;;EACnD,yBAAA,oBAAwB,SAAS,aAAA,QAAA,sBAAA,KAAA,IAAA,KAAA,IAAA,kBAAS,YAAY;CACxD,GAAG,CAAC,QAAQ,CAAC;CAEb,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,2BAA2B;EAE3B,MAAM,iBAAiB,SAAS;EAChC,IAAI,CAAC,gBACH;EAGF,MAAM,iBAAiB,IAAI,eAAe,0BAA0B;EACpE,eAAe,QAAQ,cAAc;EAErC,aAAa;GACX,eAAe,WAAW;EAC5B;CACF,GAAG,CAAC,UAAU,0BAA0B,CAAC;CAEzC,OAAO;AACT;;;;;;;;AAcA,MAAa,kBAAkB,EAAE,UAAU,YAAiC;CAC1E,MAAM,YAAA,GAAWC,MAAAA,OAAAA,CAAuB,IAAI;CAC5C,MAAM,uBAAuB,wBAAwB,QAAQ;CAC7D,MAAM,uBAAA,GAAsBC,MAAAA,QAAAA,OAAAA,sBAAAA,QAAAA,sBAAAA,QAAAA,CAAAA,GAGnB,KAAA,GAAA,CAAA,GAAA,EACH,0CACE,yBAAyB,KAAA,IACrB,KAAA,IACA,GAAG,KAAK,MACN,uBAAuB,gCACzB,EAAE,IAAA,CACV,GACF,CAAC,sBAAsB,KAAK,CAC9B;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,KAAK;EAAU,WAAU;EAAY,OAAO;EAC9C;CACE,CAAA;AAET"}
|
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _neo4j_ndl_react = require("@neo4j-ndl/react");
|
|
8
|
+
let _neo4j_ndl_react_icons = require("@neo4j-ndl/react/icons");
|
|
9
|
+
// src/charts/ChartEmpty.tsx
|
|
5
10
|
/*!
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
-
const icons_1 = require("@neo4j-ndl/react/icons");
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) "Neo4j"
|
|
13
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
14
|
+
*
|
|
15
|
+
* This file is part of Neo4j.
|
|
16
|
+
*
|
|
17
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
18
|
+
* it under the terms of the GNU General Public License as published by
|
|
19
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
20
|
+
* (at your option) any later version.
|
|
21
|
+
*
|
|
22
|
+
* This program is distributed in the hope that it will be useful,
|
|
23
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
25
|
+
* GNU General Public License for more details.
|
|
26
|
+
*
|
|
27
|
+
* You should have received a copy of the GNU General Public License
|
|
28
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
29
|
+
*/
|
|
27
30
|
const chartEmptyIcons = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
bar: _neo4j_ndl_react_icons.PresentationChartBarIconOutline,
|
|
32
|
+
line: _neo4j_ndl_react_icons.PresentationChartLineIconOutline,
|
|
33
|
+
pie: _neo4j_ndl_react_icons.ChartPieIconOutline
|
|
31
34
|
};
|
|
32
|
-
function ChartEmpty({ action, message =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
function ChartEmpty({ action, message = "No data available", type = "line" }) {
|
|
36
|
+
const Icon = chartEmptyIcons[type];
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
38
|
+
className: "ndl-chart-empty-state",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "ndl-chart-empty-state-icon" }),
|
|
41
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
42
|
+
variant: "body-medium",
|
|
43
|
+
children: message
|
|
44
|
+
}),
|
|
45
|
+
action
|
|
46
|
+
]
|
|
47
|
+
});
|
|
35
48
|
}
|
|
49
|
+
exports.ChartEmpty = ChartEmpty;
|
|
50
|
+
|
|
36
51
|
//# sourceMappingURL=ChartEmpty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartEmpty.js","
|
|
1
|
+
{"version":3,"file":"ChartEmpty.js","names":["PresentationChartBarIconOutline","PresentationChartLineIconOutline","ChartPieIconOutline","Typography"],"sources":["../../../src/charts/ChartEmpty.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Typography } from '@neo4j-ndl/react';\nimport {\n ChartPieIconOutline,\n PresentationChartBarIconOutline,\n PresentationChartLineIconOutline,\n} from '@neo4j-ndl/react/icons';\n\nimport { type ChartEmptyProps } from './utils/chart-types';\n\nconst chartEmptyIcons = {\n bar: PresentationChartBarIconOutline,\n line: PresentationChartLineIconOutline,\n pie: ChartPieIconOutline,\n} satisfies Record<\n NonNullable<ChartEmptyProps['type']>,\n React.ComponentType<{ className?: string }>\n>;\n\nexport function ChartEmpty({\n action,\n message = 'No data available',\n type = 'line',\n}: ChartEmptyProps): React.JSX.Element {\n const Icon = chartEmptyIcons[type];\n\n return (\n <div className=\"ndl-chart-empty-state\">\n <Icon className=\"ndl-chart-empty-state-icon\" />\n <Typography variant=\"body-medium\">{message}</Typography>\n {action}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,kBAAkB;CACtB,KAAKA,uBAAAA;CACL,MAAMC,uBAAAA;CACN,KAAKC,uBAAAA;AACP;AAKA,SAAgB,WAAW,EACzB,QACA,UAAU,qBACV,OAAO,UAC8B;CACrC,MAAM,OAAO,gBAAgB;CAE7B,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,WAAU,6BAA8B,CAAA;GAC9C,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,YAAD;IAAY,SAAQ;IAAe,UAAA;GAAoB,CAAA;GACtD;EACE;;AAET"}
|
|
@@ -1,93 +1,118 @@
|
|
|
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_hooks_use_chart_instance = require("./hooks/use-chart-instance.js");
|
|
7
|
+
const require_charts_hooks_use_chart_option = require("./hooks/use-chart-option.js");
|
|
8
|
+
const require_charts_hooks_use_chart_refs = require("./hooks/use-chart-refs.js");
|
|
9
|
+
const require_charts_hooks_use_chart_zoom = require("./hooks/use-chart-zoom.js");
|
|
10
|
+
const require_charts_utils_build_chart_option = require("./utils/build-chart-option.js");
|
|
11
|
+
const require_charts_utils_defaults = require("./utils/defaults.js");
|
|
12
|
+
const require_charts_utils_threshold = require("./utils/threshold.js");
|
|
13
|
+
const require_charts_utils_user_option_utils = require("./utils/user-option-utils.js");
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
+
let _neo4j_ndl_react = require("@neo4j-ndl/react");
|
|
17
|
+
// src/charts/ChartRender.tsx
|
|
5
18
|
/*!
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
-
const react_2 = require("react");
|
|
27
|
-
const use_chart_instance_1 = require("./hooks/use-chart-instance");
|
|
28
|
-
const use_chart_option_1 = require("./hooks/use-chart-option");
|
|
29
|
-
const use_chart_refs_1 = require("./hooks/use-chart-refs");
|
|
30
|
-
const use_chart_zoom_1 = require("./hooks/use-chart-zoom");
|
|
31
|
-
const build_chart_option_1 = require("./utils/build-chart-option");
|
|
32
|
-
const defaults_1 = require("./utils/defaults");
|
|
33
|
-
const threshold_1 = require("./utils/threshold");
|
|
34
|
-
const user_option_utils_1 = require("./utils/user-option-utils");
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) "Neo4j"
|
|
21
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
22
|
+
*
|
|
23
|
+
* This file is part of Neo4j.
|
|
24
|
+
*
|
|
25
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
26
|
+
* it under the terms of the GNU General Public License as published by
|
|
27
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
28
|
+
* (at your option) any later version.
|
|
29
|
+
*
|
|
30
|
+
* This program is distributed in the hope that it will be useful,
|
|
31
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
32
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
33
|
+
* GNU General Public License for more details.
|
|
34
|
+
*
|
|
35
|
+
* You should have received a copy of the GNU General Public License
|
|
36
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
37
|
+
*/
|
|
35
38
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const ChartRender = ({ callbacks, dataset, isChartZoomDisabled = false, isLoading, onChartOptionChange, onFirstResizeChange, option: userOption, palette, series: propsSeries, settings =
|
|
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
|
-
|
|
39
|
+
* Owns the ECharts instance element and coordinates chart-specific hooks.
|
|
40
|
+
*
|
|
41
|
+
* The component normalizes user props into Needle-themed ECharts options,
|
|
42
|
+
* initializes/resizes the chart instance, applies loading and zoom behavior, and
|
|
43
|
+
* reports derived chart state back to `Chart` for legend rendering.
|
|
44
|
+
*/
|
|
45
|
+
const ChartRender = ({ callbacks, dataset, isChartZoomDisabled = false, isLoading, onChartOptionChange, onFirstResizeChange, option: userOption, palette, series: propsSeries, settings = require_charts_utils_defaults.defaultChartSettings, xAxis: propXAxis, yAxis: propYAxis }) => {
|
|
46
|
+
const { chartEchartRef } = require_charts_hooks_use_chart_refs.useChartRefsContext();
|
|
47
|
+
const dataZoomOptions = userOption === null || userOption === void 0 ? void 0 : userOption.dataZoom;
|
|
48
|
+
const toolboxOptions = userOption === null || userOption === void 0 ? void 0 : userOption.toolbox;
|
|
49
|
+
const { theme } = (0, _neo4j_ndl_react.useNeedleTheme)();
|
|
50
|
+
const thresholdLines = (0, react.useMemo)(() => require_charts_utils_threshold.normalizeThresholdLines(propsSeries), [propsSeries]);
|
|
51
|
+
const dataZoom = (0, react.useMemo)(() => require_charts_utils_user_option_utils.mergeDataZoom(dataZoomOptions, {
|
|
52
|
+
xAxis: propXAxis,
|
|
53
|
+
yAxis: propYAxis
|
|
54
|
+
}), [
|
|
55
|
+
dataZoomOptions,
|
|
56
|
+
propXAxis,
|
|
57
|
+
propYAxis
|
|
58
|
+
]);
|
|
59
|
+
const series = (0, react.useMemo)(() => require_charts_utils_user_option_utils.mergeSeries(propsSeries, theme, userOption, palette), [
|
|
60
|
+
palette,
|
|
61
|
+
propsSeries,
|
|
62
|
+
theme,
|
|
63
|
+
userOption
|
|
64
|
+
]);
|
|
65
|
+
const xAxis = (0, react.useMemo)(() => require_charts_utils_user_option_utils.mergeXAxis(propXAxis, theme), [propXAxis, theme]);
|
|
66
|
+
const yAxis = (0, react.useMemo)(() => require_charts_utils_user_option_utils.mergeYAxis(propYAxis, theme), [propYAxis, theme]);
|
|
67
|
+
const hasCategoryXAxis$1 = require_charts_utils_build_chart_option.hasCategoryXAxis(xAxis);
|
|
68
|
+
const hasMarkArea = require_charts_utils_build_chart_option.hasMarkAreaInSeries(series);
|
|
69
|
+
/**
|
|
70
|
+
* Hook responsibilities:
|
|
71
|
+
* - `useChartLifecycle` creates/disposes the ECharts instance and updates theme data.
|
|
72
|
+
* - `useChartResize` keeps the canvas sized to its container before first render.
|
|
73
|
+
* - `useChartOption` builds and applies the merged ECharts option.
|
|
74
|
+
* - `useChartZoom` attaches consumer zoom callbacks.
|
|
75
|
+
* - `useChartLoading` synchronizes the loading overlay with chart readiness.
|
|
76
|
+
*/
|
|
77
|
+
require_charts_hooks_use_chart_instance.useChartLifecycle({
|
|
78
|
+
palette,
|
|
79
|
+
theme
|
|
80
|
+
});
|
|
81
|
+
const { isWaitingForFirstResize } = require_charts_hooks_use_chart_instance.useChartResize();
|
|
82
|
+
const chartOption = require_charts_hooks_use_chart_option.useChartOption({
|
|
83
|
+
dataZoom,
|
|
84
|
+
dataset,
|
|
85
|
+
hasCategoryXAxis: hasCategoryXAxis$1,
|
|
86
|
+
hasMarkArea,
|
|
87
|
+
propsSeries,
|
|
88
|
+
series,
|
|
89
|
+
settings,
|
|
90
|
+
thresholdLines,
|
|
91
|
+
toolboxOptions,
|
|
92
|
+
userOption,
|
|
93
|
+
xAxis,
|
|
94
|
+
yAxis
|
|
95
|
+
});
|
|
96
|
+
require_charts_hooks_use_chart_zoom.useChartZoom({
|
|
97
|
+
callbacks,
|
|
98
|
+
isChartZoomDisabled
|
|
99
|
+
});
|
|
100
|
+
require_charts_hooks_use_chart_instance.useChartLoading({
|
|
101
|
+
isLoading,
|
|
102
|
+
isWaitingForFirstResize,
|
|
103
|
+
theme
|
|
104
|
+
});
|
|
105
|
+
(0, react.useEffect)(() => {
|
|
106
|
+
onFirstResizeChange(isWaitingForFirstResize);
|
|
107
|
+
}, [isWaitingForFirstResize, onFirstResizeChange]);
|
|
108
|
+
(0, react.useEffect)(() => {
|
|
109
|
+
onChartOptionChange(chartOption);
|
|
110
|
+
}, [chartOption, onChartOptionChange]);
|
|
111
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
112
|
+
ref: chartEchartRef,
|
|
113
|
+
className: "ndl-chart-echart"
|
|
114
|
+
});
|
|
91
115
|
};
|
|
92
116
|
exports.ChartRender = ChartRender;
|
|
117
|
+
|
|
93
118
|
//# sourceMappingURL=ChartRender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartRender.js","
|
|
1
|
+
{"version":3,"file":"ChartRender.js","names":["defaultChartSettings","useChartRefsContext","useNeedleTheme","useMemo","normalizeThresholdLines","mergeDataZoom","mergeSeries","mergeXAxis","mergeYAxis","hasCategoryXAxis","getHasCategoryXAxis","hasMarkAreaInSeries","useChartResize","useChartOption"],"sources":["../../../src/charts/ChartRender.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { useNeedleTheme } from '@neo4j-ndl/react';\nimport type { EChartsOption } from 'echarts';\nimport { useEffect, useMemo } from 'react';\n\nimport {\n useChartLifecycle,\n useChartLoading,\n useChartResize,\n} from './hooks/use-chart-instance';\nimport { useChartOption } from './hooks/use-chart-option';\nimport { useChartRefsContext } from './hooks/use-chart-refs';\nimport { useChartZoom } from './hooks/use-chart-zoom';\nimport {\n hasCategoryXAxis as getHasCategoryXAxis,\n hasMarkAreaInSeries,\n} from './utils/build-chart-option';\nimport type { ChartProps } from './utils/chart-types';\nimport { defaultChartSettings } from './utils/defaults';\nimport { normalizeThresholdLines } from './utils/threshold';\nimport {\n mergeDataZoom,\n mergeSeries,\n mergeXAxis,\n mergeYAxis,\n} from './utils/user-option-utils';\n\ntype ChartRenderProps = Omit<ChartProps, 'legend' | 'style'> & {\n onChartOptionChange: (chartOption: EChartsOption | undefined) => void;\n onFirstResizeChange: (isWaitingForFirstResize: boolean) => void;\n};\n\n/**\n * Owns the ECharts instance element and coordinates chart-specific hooks.\n *\n * The component normalizes user props into Needle-themed ECharts options,\n * initializes/resizes the chart instance, applies loading and zoom behavior, and\n * reports derived chart state back to `Chart` for legend rendering.\n */\nexport const ChartRender = ({\n callbacks,\n dataset,\n isChartZoomDisabled = false,\n isLoading,\n onChartOptionChange,\n onFirstResizeChange,\n option: userOption,\n palette,\n series: propsSeries,\n settings = defaultChartSettings,\n xAxis: propXAxis,\n yAxis: propYAxis,\n}: ChartRenderProps) => {\n const { chartEchartRef } = useChartRefsContext();\n const dataZoomOptions = (userOption as EChartsOption)?.dataZoom;\n const toolboxOptions = (userOption as EChartsOption)?.toolbox;\n const { theme } = useNeedleTheme();\n\n const thresholdLines = useMemo(\n () => normalizeThresholdLines(propsSeries),\n [propsSeries],\n );\n const dataZoom = useMemo(\n () =>\n mergeDataZoom(dataZoomOptions, { xAxis: propXAxis, yAxis: propYAxis }),\n [dataZoomOptions, propXAxis, propYAxis],\n );\n const series = useMemo(\n () => mergeSeries(propsSeries, theme, userOption, palette),\n [palette, propsSeries, theme, userOption],\n );\n const xAxis = useMemo(() => mergeXAxis(propXAxis, theme), [propXAxis, theme]);\n const yAxis = useMemo(() => mergeYAxis(propYAxis, theme), [propYAxis, theme]);\n const hasCategoryXAxis = getHasCategoryXAxis(xAxis);\n const hasMarkArea = hasMarkAreaInSeries(series);\n\n /**\n * Hook responsibilities:\n * - `useChartLifecycle` creates/disposes the ECharts instance and updates theme data.\n * - `useChartResize` keeps the canvas sized to its container before first render.\n * - `useChartOption` builds and applies the merged ECharts option.\n * - `useChartZoom` attaches consumer zoom callbacks.\n * - `useChartLoading` synchronizes the loading overlay with chart readiness.\n */\n useChartLifecycle({ palette, theme });\n const { isWaitingForFirstResize } = useChartResize();\n const chartOption = useChartOption({\n dataZoom,\n dataset,\n hasCategoryXAxis,\n hasMarkArea,\n propsSeries,\n series,\n settings,\n thresholdLines,\n toolboxOptions,\n userOption,\n xAxis,\n yAxis,\n });\n useChartZoom({ callbacks, isChartZoomDisabled });\n useChartLoading({\n isLoading,\n isWaitingForFirstResize,\n theme,\n });\n\n useEffect(() => {\n onFirstResizeChange(isWaitingForFirstResize);\n }, [isWaitingForFirstResize, onFirstResizeChange]);\n\n useEffect(() => {\n onChartOptionChange(chartOption);\n }, [chartOption, onChartOptionChange]);\n\n return <div ref={chartEchartRef} className=\"ndl-chart-echart\" />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,eAAe,EAC1B,WACA,SACA,sBAAsB,OACtB,WACA,qBACA,qBACA,QAAQ,YACR,SACA,QAAQ,aACR,WAAWA,8BAAAA,sBACX,OAAO,WACP,OAAO,gBACe;CACtB,MAAM,EAAE,mBAAmBC,oCAAAA,oBAAoB;CAC/C,MAAM,kBAAA,eAAA,QAAA,eAAA,KAAA,IAAA,KAAA,IAAmB,WAA8B;CACvD,MAAM,iBAAA,eAAA,QAAA,eAAA,KAAA,IAAA,KAAA,IAAkB,WAA8B;CACtD,MAAM,EAAE,WAAA,GAAUC,iBAAAA,eAAAA,CAAe;CAEjC,MAAM,kBAAA,GAAiBC,MAAAA,QAAAA,OACfC,+BAAAA,wBAAwB,WAAW,GACzC,CAAC,WAAW,CACd;CACA,MAAM,YAAA,GAAWD,MAAAA,QAAAA,OAEbE,uCAAAA,cAAc,iBAAiB;EAAE,OAAO;EAAW,OAAO;CAAU,CAAC,GACvE;EAAC;EAAiB;EAAW;CAAS,CACxC;CACA,MAAM,UAAA,GAASF,MAAAA,QAAAA,OACPG,uCAAAA,YAAY,aAAa,OAAO,YAAY,OAAO,GACzD;EAAC;EAAS;EAAa;EAAO;CAAU,CAC1C;CACA,MAAM,SAAA,GAAQH,MAAAA,QAAAA,OAAcI,uCAAAA,WAAW,WAAW,KAAK,GAAG,CAAC,WAAW,KAAK,CAAC;CAC5E,MAAM,SAAA,GAAQJ,MAAAA,QAAAA,OAAcK,uCAAAA,WAAW,WAAW,KAAK,GAAG,CAAC,WAAW,KAAK,CAAC;CAC5E,MAAMC,qBAAmBC,wCAAAA,iBAAoB,KAAK;CAClD,MAAM,cAAcC,wCAAAA,oBAAoB,MAAM;;;;;;;;;CAU9C,wCAAA,kBAAkB;EAAE;EAAS;CAAM,CAAC;CACpC,MAAM,EAAE,4BAA4BC,wCAAAA,eAAe;CACnD,MAAM,cAAcC,sCAAAA,eAAe;EACjC;EACA;EACA,kBAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,oCAAA,aAAa;EAAE;EAAW;CAAoB,CAAC;CAC/C,wCAAA,gBAAgB;EACd;EACA;EACA;CACF,CAAC;CAED,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,oBAAoB,uBAAuB;CAC7C,GAAG,CAAC,yBAAyB,mBAAmB,CAAC;CAEjD,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,oBAAoB,WAAW;CACjC,GAAG,CAAC,aAAa,mBAAmB,CAAC;CAErC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,KAAK;EAAgB,WAAU;CAAoB,CAAA;AACjE"}
|