@aura-react-comp/charts 0.3.1 → 0.4.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.
Files changed (68) hide show
  1. package/esm/charts/area-chart/index.js +27 -23
  2. package/esm/charts/bar-chart/index.js +17 -21
  3. package/esm/charts/candlestick-chart/index.js +242 -180
  4. package/esm/charts/combo-chart/index.js +8 -20
  5. package/esm/charts/funnel-chart/index.js +133 -108
  6. package/esm/charts/gauge-chart/index.js +102 -105
  7. package/esm/charts/graph-chart/index.js +154 -114
  8. package/esm/charts/heatmap-chart/index.js +179 -135
  9. package/esm/charts/line-chart/index.js +28 -24
  10. package/esm/charts/pie-chart/index.d.ts.map +1 -1
  11. package/esm/charts/pie-chart/index.js +198 -139
  12. package/esm/charts/radar-chart/index.d.ts.map +1 -1
  13. package/esm/charts/radar-chart/index.js +154 -128
  14. package/esm/charts/ring-progress/index.js +81 -82
  15. package/esm/charts/sankey-chart/index.js +171 -141
  16. package/esm/charts/scatter-chart/index.d.ts.map +1 -1
  17. package/esm/charts/scatter-chart/index.js +225 -159
  18. package/esm/charts/sparkline/index.js +81 -66
  19. package/esm/charts/tree-chart/index.js +128 -102
  20. package/esm/charts/treemap-chart/index.js +162 -141
  21. package/esm/charts/waterfall-chart/index.js +165 -121
  22. package/esm/components/Legend.d.ts +3 -2
  23. package/esm/components/Legend.d.ts.map +1 -1
  24. package/esm/components/Legend.js +79 -48
  25. package/esm/components/Tooltip.js +62 -71
  26. package/esm/components/chart/index.d.ts +4 -1
  27. package/esm/components/chart/index.d.ts.map +1 -1
  28. package/esm/components/chart/index.js +80 -102
  29. package/esm/components/chart.less +13 -0
  30. package/esm/core/animation.js +31 -43
  31. package/esm/core/export.d.ts +34 -0
  32. package/esm/core/export.d.ts.map +1 -0
  33. package/esm/core/export.js +390 -0
  34. package/esm/core/force.js +22 -45
  35. package/esm/core/format.js +48 -52
  36. package/esm/core/hierarchy.js +60 -92
  37. package/esm/core/layout.js +32 -50
  38. package/esm/core/sampling.js +30 -53
  39. package/esm/core/sankey.js +35 -55
  40. package/esm/core/scale.js +72 -86
  41. package/esm/core/shape.js +101 -133
  42. package/esm/core/sync.d.ts +41 -0
  43. package/esm/core/sync.d.ts.map +1 -0
  44. package/esm/core/sync.js +120 -0
  45. package/esm/hooks/useChartExport.d.ts +19 -0
  46. package/esm/hooks/useChartExport.d.ts.map +1 -0
  47. package/esm/hooks/useChartExport.js +35 -0
  48. package/esm/hooks/useChartTheme.js +17 -19
  49. package/esm/hooks/useChartTransition.js +58 -73
  50. package/esm/hooks/useElementSize.js +19 -28
  51. package/esm/hooks/usePlotPointer.d.ts +23 -0
  52. package/esm/hooks/usePlotPointer.d.ts.map +1 -0
  53. package/esm/hooks/usePlotPointer.js +94 -0
  54. package/esm/index.d.ts +6 -0
  55. package/esm/index.d.ts.map +1 -1
  56. package/esm/index.js +136 -47
  57. package/esm/internal/CartesianChart.d.ts.map +1 -1
  58. package/esm/internal/CartesianChart.js +666 -485
  59. package/esm/internal/model.js +44 -60
  60. package/esm/scene/canvas.js +100 -107
  61. package/esm/scene/svg.js +106 -99
  62. package/esm/scene/types.js +8 -15
  63. package/esm/style.css +10 -0
  64. package/esm/theme/index.js +143 -171
  65. package/esm/types.d.ts +4 -0
  66. package/esm/types.d.ts.map +1 -1
  67. package/esm/types.js +0 -1
  68. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  'use client';
2
- import React, { useCallback, useMemo, useState } from 'react';
3
- import { classNames, prefixCls } from '@aura-react-comp/shared';
2
+ // src/charts/scatter-chart/index.tsx
3
+ import { useCallback, useMemo, useState } from "react";
4
+ import { classNames, prefixCls } from "@aura-react-comp/shared";
4
5
  import { SvgScene } from "../../scene/svg";
5
6
  import { createLinearScale, extentOf, linearTicks } from "../../core/scale";
6
7
  import { computeLayout, suggestTickCount } from "../../core/layout";
@@ -10,67 +11,66 @@ import { colorAt } from "../../theme";
10
11
  import { useChartTheme } from "../../hooks/useChartTheme";
11
12
  import { useElementSize } from "../../hooks/useElementSize";
12
13
  import { useChartTransition } from "../../hooks/useChartTransition";
14
+ import { usePlotPointer } from "../../hooks/usePlotPointer";
13
15
  import { resolveAnimation, staggerProgress } from "../../core/animation";
14
16
  import { Legend } from "../../components/Legend";
15
17
  import { Tooltip } from "../../components/Tooltip";
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
- /**
19
- * 散点图。
20
- *
21
- * 与折线/柱状不同,散点的 x 是**连续的数值轴**而非分类轴:
22
- * 分类轴会把 [1, 2, 100] 摆成等间距,严重扭曲相关性判断。
23
- * 因此这里不复用 CartesianChart 的 band 坐标,改为线性 x 轴。
24
- */
25
- export function ScatterChart({
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ function ScatterChart({
26
20
  data = [],
27
- xKey = 'x',
21
+ xKey = "x",
28
22
  series = [],
29
- width = '100%',
23
+ width = "100%",
30
24
  height = 320,
31
25
  theme: themeInput,
32
26
  palette,
33
27
  legend = true,
34
28
  tooltip = true,
35
- symbol = 'circle',
29
+ symbol = "circle",
36
30
  symbolSize = 8,
37
31
  animation = true,
38
32
  className,
39
33
  style,
40
34
  ariaLabel,
41
- emptyText = '暂无数据'
35
+ emptyText = "暂无数据"
42
36
  }) {
43
37
  const theme = useChartTheme(themeInput, palette);
44
- const {
45
- ref,
46
- size
47
- } = useElementSize();
38
+ const { ref, size } = useElementSize();
48
39
  const [hiddenKeys, setHiddenKeys] = useState([]);
49
40
  const [activeKey, setActiveKey] = useState(null);
50
- const xValues = useMemo(() => data.map(row => {
51
- const raw = row[xKey];
52
- const num = typeof raw === 'number' ? raw : Number(raw);
53
- return Number.isFinite(num) ? num : null;
54
- }), [data, xKey]);
55
- const seriesList = useMemo(() => series.map((config, index) => ({
56
- config,
57
- key: config.key,
58
- name: config.name ?? config.key,
59
- color: config.color ?? colorAt(theme, index),
60
- values: data.map((row, rowIndex) => {
61
- const raw = config.data ? config.data[rowIndex] : row[config.key];
62
- const num = typeof raw === 'number' ? raw : Number(raw);
41
+ const xValues = useMemo(
42
+ () => data.map((row) => {
43
+ const raw = row[xKey];
44
+ const num = typeof raw === "number" ? raw : Number(raw);
63
45
  return Number.isFinite(num) ? num : null;
64
46
  }),
65
- visible: !config.hidden && !hiddenKeys.includes(config.key)
66
- })), [series, data, theme, hiddenKeys]);
67
- const animKey = typeof animation === 'object' ? JSON.stringify(animation) : String(animation);
68
- const animConfig = useMemo(() => resolveAnimation(animation),
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
- [animKey]);
71
-
72
- // 每个系列一行数值,更新时在旧值之间插值
73
- const valueMatrix = useMemo(() => seriesList.map(item => item.values), [seriesList]);
47
+ [data, xKey]
48
+ );
49
+ const seriesList = useMemo(
50
+ () => series.map((config, index) => ({
51
+ config,
52
+ key: config.key,
53
+ name: config.name ?? config.key,
54
+ color: config.color ?? colorAt(theme, index),
55
+ values: data.map((row, rowIndex) => {
56
+ const raw = config.data ? config.data[rowIndex] : row[config.key];
57
+ const num = typeof raw === "number" ? raw : Number(raw);
58
+ return Number.isFinite(num) ? num : null;
59
+ }),
60
+ visible: !config.hidden && !hiddenKeys.includes(config.key)
61
+ })),
62
+ [series, data, theme, hiddenKeys]
63
+ );
64
+ const animKey = typeof animation === "object" ? JSON.stringify(animation) : String(animation);
65
+ const animConfig = useMemo(
66
+ () => resolveAnimation(animation),
67
+ // eslint-disable-next-line react-hooks/exhaustive-deps
68
+ [animKey]
69
+ );
70
+ const valueMatrix = useMemo(
71
+ () => seriesList.map((item) => item.values),
72
+ [seriesList]
73
+ );
74
74
  const transition = useChartTransition(valueMatrix, animConfig);
75
75
  const progress = transition.progress;
76
76
  const points = useMemo(() => {
@@ -78,11 +78,13 @@ export function ScatterChart({
78
78
  let seriesIndex = -1;
79
79
  for (const item of seriesList) {
80
80
  seriesIndex += 1;
81
- if (!item.visible) continue;
81
+ if (!item.visible)
82
+ continue;
82
83
  const row = transition.values[seriesIndex] ?? item.values;
83
84
  row.forEach((value, index) => {
84
85
  const x = xValues[index];
85
- if (value === null || x === null || x === undefined) return;
86
+ if (value === null || x === null || x === void 0)
87
+ return;
86
88
  list.push({
87
89
  seriesKey: item.key,
88
90
  seriesName: item.name,
@@ -97,48 +99,69 @@ export function ScatterChart({
97
99
  }, [seriesList, xValues, transition.values]);
98
100
  const xDomain = useMemo(() => {
99
101
  const [min, max] = extentOf(xValues);
100
- if (min === max) return [min - 1, max + 1];
101
- // 两端留 4% 余量,避免点被裁在轴线上
102
+ if (min === max)
103
+ return [min - 1, max + 1];
102
104
  const pad = (max - min) * 0.04;
103
105
  return [min - pad, max + pad];
104
106
  }, [xValues]);
105
107
  const yDomain = useMemo(() => {
106
- const [min, max] = extentOf(points.map(point => point.y));
107
- if (min === max) return [min - 1, max + 1];
108
+ const [min, max] = extentOf(points.map((point) => point.y));
109
+ if (min === max)
110
+ return [min - 1, max + 1];
108
111
  const pad = (max - min) * 0.08;
109
112
  return [min - pad, max + pad];
110
113
  }, [points]);
111
114
  const estimatedPlotHeight = Math.max(60, height - 48);
112
115
  const tickCount = suggestTickCount(estimatedPlotHeight);
113
- const yTicks = useMemo(() => linearTicks(yDomain[0], yDomain[1], tickCount), [yDomain, tickCount]);
114
- const xTicks = useMemo(() => linearTicks(xDomain[0], xDomain[1], Math.round(tickCount * 1.3)), [xDomain, tickCount]);
115
- const yLabels = useMemo(() => yTicks.map(tick => formatNumber(tick)), [yTicks]);
116
- const xLabels = useMemo(() => xTicks.map(tick => formatNumber(tick)), [xTicks]);
117
- const layout = useMemo(() => computeLayout({
118
- width: Math.max(size.width, 0),
119
- height: Math.max(size.height, 0),
120
- yLabels,
121
- xLabels,
122
- theme
123
- }), [size.width, size.height, yLabels, xLabels, theme]);
124
- const {
125
- plot
126
- } = layout;
127
- const xScale = useMemo(() => createLinearScale({
128
- domain: xDomain,
129
- range: [plot.x, plot.x + plot.width]
130
- }), [xDomain, plot.x, plot.width]);
131
- const yScale = useMemo(() => createLinearScale({
132
- domain: yDomain,
133
- range: [plot.y + plot.height, plot.y]
134
- }), [yDomain, plot.y, plot.height]);
116
+ const yTicks = useMemo(
117
+ () => linearTicks(yDomain[0], yDomain[1], tickCount),
118
+ [yDomain, tickCount]
119
+ );
120
+ const xTicks = useMemo(
121
+ () => linearTicks(xDomain[0], xDomain[1], Math.round(tickCount * 1.3)),
122
+ [xDomain, tickCount]
123
+ );
124
+ const yLabels = useMemo(
125
+ () => yTicks.map((tick) => formatNumber(tick)),
126
+ [yTicks]
127
+ );
128
+ const xLabels = useMemo(
129
+ () => xTicks.map((tick) => formatNumber(tick)),
130
+ [xTicks]
131
+ );
132
+ const layout = useMemo(
133
+ () => computeLayout({
134
+ width: Math.max(size.width, 0),
135
+ height: Math.max(size.height, 0),
136
+ yLabels,
137
+ xLabels,
138
+ theme
139
+ }),
140
+ [size.width, size.height, yLabels, xLabels, theme]
141
+ );
142
+ const { plot } = layout;
143
+ const xScale = useMemo(
144
+ () => createLinearScale({
145
+ domain: xDomain,
146
+ range: [plot.x, plot.x + plot.width]
147
+ }),
148
+ [xDomain, plot.x, plot.width]
149
+ );
150
+ const yScale = useMemo(
151
+ () => createLinearScale({
152
+ domain: yDomain,
153
+ range: [plot.y + plot.height, plot.y]
154
+ }),
155
+ [yDomain, plot.y, plot.height]
156
+ );
135
157
  const animBaseY = plot.y + plot.height;
136
158
  const scene = useMemo(() => {
137
- if (plot.width <= 0 || plot.height <= 0) return [];
159
+ if (plot.width <= 0 || plot.height <= 0)
160
+ return [];
138
161
  const nodes = [];
139
162
  for (const tick of yTicks) {
140
163
  nodes.push({
141
- kind: 'line',
164
+ kind: "line",
142
165
  key: `gy-${tick}`,
143
166
  x1: plot.x,
144
167
  y1: yScale.scale(tick),
@@ -146,41 +169,42 @@ export function ScatterChart({
146
169
  y2: yScale.scale(tick),
147
170
  stroke: theme.grid.line,
148
171
  strokeWidth: theme.grid.lineWidth,
149
- strokeDasharray: theme.grid.dash.join(' ') || undefined
172
+ strokeDasharray: theme.grid.dash.join(" ") || void 0
150
173
  });
151
174
  }
152
175
  yTicks.forEach((tick, index) => {
153
176
  nodes.push({
154
- kind: 'text',
177
+ kind: "text",
155
178
  key: `yl-${index}`,
156
179
  x: plot.x - theme.axis.tickSize - 4,
157
180
  y: yScale.scale(tick),
158
181
  text: yLabels[index],
159
182
  fill: theme.axis.label,
160
183
  fontSize: theme.font.size,
161
- anchor: 'end',
162
- baseline: 'middle',
184
+ anchor: "end",
185
+ baseline: "middle",
163
186
  fontFamily: theme.font.family
164
187
  });
165
188
  });
166
189
  xTicks.forEach((tick, index) => {
167
190
  const x = xScale.scale(tick);
168
- if (x < plot.x - 1 || x > plot.x + plot.width + 1) return;
191
+ if (x < plot.x - 1 || x > plot.x + plot.width + 1)
192
+ return;
169
193
  nodes.push({
170
- kind: 'text',
194
+ kind: "text",
171
195
  key: `xl-${index}`,
172
196
  x,
173
197
  y: plot.y + plot.height + theme.axis.tickSize + theme.font.size,
174
198
  text: xLabels[index],
175
199
  fill: theme.axis.label,
176
200
  fontSize: theme.font.size,
177
- anchor: 'middle',
201
+ anchor: "middle",
178
202
  fontFamily: theme.font.family
179
203
  });
180
204
  });
181
205
  nodes.push({
182
- kind: 'line',
183
- key: 'x-axis',
206
+ kind: "line",
207
+ key: "x-axis",
184
208
  x1: plot.x,
185
209
  y1: plot.y + plot.height,
186
210
  x2: plot.x + plot.width,
@@ -189,8 +213,8 @@ export function ScatterChart({
189
213
  strokeWidth: theme.axis.lineWidth
190
214
  });
191
215
  nodes.push({
192
- kind: 'line',
193
- key: 'y-axis',
216
+ kind: "line",
217
+ key: "y-axis",
194
218
  x1: plot.x,
195
219
  y1: plot.y,
196
220
  x2: plot.x,
@@ -201,105 +225,147 @@ export function ScatterChart({
201
225
  points.forEach((point, pointIndex) => {
202
226
  const cx = xScale.scale(point.x);
203
227
  const targetY = yScale.scale(point.y);
204
- // 逐点错峰 + 透明度淡入,避免整片点同时「砸」在基线上
205
- const local = staggerProgress(progress, pointIndex, points.length, animConfig.stagger);
228
+ const local = staggerProgress(
229
+ progress,
230
+ pointIndex,
231
+ points.length,
232
+ animConfig.stagger
233
+ );
206
234
  const cy = animBaseY + (targetY - animBaseY) * local;
207
235
  const isActive = activeKey === `${point.seriesKey}-${point.xIndex}`;
208
236
  const radius = isActive ? symbolSize * 0.75 : symbolSize * 0.55;
209
237
  nodes.push({
210
- kind: 'path',
238
+ kind: "path",
211
239
  key: `pt-${point.seriesKey}-${point.xIndex}`,
212
240
  d: symbolPath(symbol, cx, cy, radius * 2),
213
241
  fill: point.color,
214
242
  opacity: (activeKey === null || isActive ? 0.85 : 0.35) * local,
215
- pointerEvents: 'none'
243
+ pointerEvents: "none"
216
244
  });
217
245
  });
218
246
  return nodes;
219
- }, [plot, yTicks, xTicks, yLabels, xLabels, yScale, xScale, points, theme, progress, animBaseY, activeKey, symbol, symbolSize, animConfig.stagger]);
220
-
221
- /** 指针 → 最近的点(限定 28px 内,避免远处空白也触发) */
222
- const findNearest = useCallback((clientX, clientY) => {
223
- const element = ref.current;
224
- if (!element || !points.length) return null;
225
- const rect = element.getBoundingClientRect();
226
- const localX = clientX - rect.left;
227
- const localY = clientY - rect.top;
228
- let best = null;
229
- let minDistance = 28;
230
- for (const point of points) {
231
- const px = xScale.scale(point.x);
232
- const py = yScale.scale(point.y);
233
- const distance = Math.hypot(px - localX, py - localY);
234
- if (distance < minDistance) {
235
- minDistance = distance;
236
- best = point;
247
+ }, [
248
+ plot,
249
+ yTicks,
250
+ xTicks,
251
+ yLabels,
252
+ xLabels,
253
+ yScale,
254
+ xScale,
255
+ points,
256
+ theme,
257
+ progress,
258
+ animBaseY,
259
+ activeKey,
260
+ symbol,
261
+ symbolSize,
262
+ animConfig.stagger
263
+ ]);
264
+ const findNearest = useCallback(
265
+ (clientX, clientY) => {
266
+ const element = ref.current;
267
+ if (!element || !points.length)
268
+ return null;
269
+ const rect = element.getBoundingClientRect();
270
+ const localX = clientX - rect.left;
271
+ const localY = clientY - rect.top;
272
+ let best = null;
273
+ let minDistance = 28;
274
+ for (const point of points) {
275
+ const px = xScale.scale(point.x);
276
+ const py = yScale.scale(point.y);
277
+ const distance = Math.hypot(px - localX, py - localY);
278
+ if (distance < minDistance) {
279
+ minDistance = distance;
280
+ best = point;
281
+ }
237
282
  }
238
- }
239
- return best;
240
- }, [ref, points, xScale, yScale]);
283
+ return best;
284
+ },
285
+ [ref, points, xScale, yScale]
286
+ );
241
287
  const activePoint = useMemo(() => {
242
- if (!activeKey) return null;
243
- return points.find(point => `${point.seriesKey}-${point.xIndex}` === activeKey) ?? null;
288
+ if (!activeKey)
289
+ return null;
290
+ return points.find(
291
+ (point) => `${point.seriesKey}-${point.xIndex}` === activeKey
292
+ ) ?? null;
244
293
  }, [activeKey, points]);
245
294
  const tooltipPayload = activePoint ? {
246
295
  label: `${xKey}: ${formatNumber(activePoint.x)}`,
247
296
  row: data[activePoint.xIndex] ?? null,
248
- series: [{
249
- key: activePoint.seriesKey,
250
- name: activePoint.seriesName,
251
- color: activePoint.color,
252
- value: activePoint.y,
253
- formatted: formatNumber(activePoint.y)
254
- }]
297
+ series: [
298
+ {
299
+ key: activePoint.seriesKey,
300
+ name: activePoint.seriesName,
301
+ color: activePoint.color,
302
+ value: activePoint.y,
303
+ formatted: formatNumber(activePoint.y)
304
+ }
305
+ ]
255
306
  } : null;
256
- const legendItems = seriesList.map(item => ({
307
+ const legendItems = seriesList.map((item) => ({
257
308
  key: item.key,
258
309
  name: item.name,
259
310
  color: item.color,
260
311
  visible: item.visible
261
312
  }));
262
- const toggle = useCallback(key => {
263
- setHiddenKeys(prev => prev.includes(key) ? prev.filter(item => item !== key) : [...prev, key]);
313
+ const toggle = useCallback((key) => {
314
+ setHiddenKeys(
315
+ (prev) => prev.includes(key) ? prev.filter((item) => item !== key) : [...prev, key]
316
+ );
264
317
  }, []);
265
- const autoAriaLabel = ariaLabel ?? `散点图:${seriesList.map(item => item.name).join('、')}`;
266
- return /*#__PURE__*/_jsxs("div", {
267
- className: classNames(prefixCls('chart'), className),
268
- style: {
269
- width,
270
- height,
271
- ...style
318
+ const pointerHandlers = usePlotPointer({
319
+ disabled: tooltip === false || points.length === 0,
320
+ onMove: (clientX, clientY) => {
321
+ const nearest = findNearest(clientX, clientY);
322
+ setActiveKey(nearest ? `${nearest.seriesKey}-${nearest.xIndex}` : null);
272
323
  },
273
- "data-aura-chart": "scatter",
274
- children: [/*#__PURE__*/_jsx(Legend, {
275
- items: legendItems,
276
- theme: theme,
277
- config: legend,
278
- onToggle: toggle
279
- }), /*#__PURE__*/_jsxs("div", {
280
- ref: ref,
281
- className: prefixCls('chart__plot'),
282
- onPointerMove: event => {
283
- const nearest = findNearest(event.clientX, event.clientY);
284
- setActiveKey(nearest ? `${nearest.seriesKey}-${nearest.xIndex}` : null);
285
- },
286
- onPointerLeave: () => setActiveKey(null),
287
- children: [points.length === 0 ? /*#__PURE__*/_jsx("div", {
288
- className: prefixCls('chart__empty'),
289
- children: emptyText
290
- }) : /*#__PURE__*/_jsx(SvgScene, {
291
- nodes: scene,
292
- width: size.width,
293
- height: size.height,
294
- ariaLabel: autoAriaLabel
295
- }), /*#__PURE__*/_jsx(Tooltip, {
296
- payload: tooltipPayload,
297
- x: activePoint ? xScale.scale(activePoint.x) : 0,
298
- y: activePoint ? yScale.scale(activePoint.y) : 0,
299
- containerWidth: size.width,
300
- theme: theme,
301
- config: tooltip
302
- })]
303
- })]
324
+ onLeave: () => setActiveKey(null)
304
325
  });
305
- }
326
+ const autoAriaLabel = ariaLabel ?? `散点图:${seriesList.map((item) => item.name).join("、")}`;
327
+ return /* @__PURE__ */ jsxs(
328
+ "div",
329
+ {
330
+ className: classNames(prefixCls("chart"), className),
331
+ style: { width, height, ...style },
332
+ "data-aura-chart": "scatter",
333
+ children: [
334
+ /* @__PURE__ */ jsx(
335
+ Legend,
336
+ {
337
+ items: legendItems,
338
+ theme,
339
+ config: legend,
340
+ onToggle: toggle
341
+ }
342
+ ),
343
+ /* @__PURE__ */ jsxs("div", { ref, className: prefixCls("chart__plot"), ...pointerHandlers, children: [
344
+ points.length === 0 ? /* @__PURE__ */ jsx("div", { className: prefixCls("chart__empty"), children: emptyText }) : /* @__PURE__ */ jsx(
345
+ SvgScene,
346
+ {
347
+ nodes: scene,
348
+ width: size.width,
349
+ height: size.height,
350
+ ariaLabel: autoAriaLabel
351
+ }
352
+ ),
353
+ /* @__PURE__ */ jsx(
354
+ Tooltip,
355
+ {
356
+ payload: tooltipPayload,
357
+ x: activePoint ? xScale.scale(activePoint.x) : 0,
358
+ y: activePoint ? yScale.scale(activePoint.y) : 0,
359
+ containerWidth: size.width,
360
+ theme,
361
+ config: tooltip
362
+ }
363
+ )
364
+ ] })
365
+ ]
366
+ }
367
+ );
368
+ }
369
+ export {
370
+ ScatterChart
371
+ };