@mui/x-charts 7.2.0 → 7.3.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 (188) hide show
  1. package/BarChart/BarChart.js +32 -2
  2. package/BarChart/BarPlot.js +12 -5
  3. package/BarChart/getColor.d.ts +3 -0
  4. package/BarChart/getColor.js +33 -0
  5. package/CHANGELOG.md +125 -0
  6. package/ChartContainer/ChartContainer.js +35 -4
  7. package/ChartsAxis/ChartsAxis.js +4 -4
  8. package/ChartsClipPath/ChartsClipPath.js +2 -2
  9. package/ChartsLegend/ChartsLegend.js +2 -2
  10. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +4 -1
  11. package/ChartsTooltip/ChartsAxisTooltipContent.js +7 -2
  12. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +6 -0
  13. package/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  14. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +6 -3
  15. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +13 -4
  16. package/ChartsTooltip/utils.d.ts +5 -1
  17. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +6 -6
  18. package/ChartsXAxis/ChartsXAxis.js +2 -2
  19. package/ChartsYAxis/ChartsYAxis.js +2 -2
  20. package/Gauge/GaugeProvider.js +5 -5
  21. package/LineChart/AnimatedArea.js +6 -5
  22. package/LineChart/AnimatedLine.js +7 -5
  23. package/LineChart/AreaElement.d.ts +1 -0
  24. package/LineChart/AreaElement.js +4 -1
  25. package/LineChart/AreaPlot.js +7 -1
  26. package/LineChart/LineChart.js +32 -2
  27. package/LineChart/LineElement.d.ts +1 -0
  28. package/LineChart/LineElement.js +4 -1
  29. package/LineChart/LineHighlightPlot.js +4 -1
  30. package/LineChart/LinePlot.js +7 -1
  31. package/LineChart/MarkPlot.js +5 -5
  32. package/LineChart/getColor.d.ts +3 -0
  33. package/LineChart/getColor.js +31 -0
  34. package/PieChart/PieChart.js +32 -2
  35. package/PieChart/PiePlot.js +26 -6
  36. package/PieChart/formatter.js +4 -2
  37. package/PieChart/getColor.d.ts +2 -0
  38. package/PieChart/getColor.js +11 -0
  39. package/PieChart/getPieCoordinates.d.ts +7 -0
  40. package/PieChart/getPieCoordinates.js +25 -0
  41. package/PieChart/index.d.ts +1 -0
  42. package/PieChart/index.js +11 -0
  43. package/ResponsiveChartContainer/ResponsiveChartContainer.js +32 -2
  44. package/ScatterChart/Scatter.d.ts +1 -0
  45. package/ScatterChart/Scatter.js +6 -3
  46. package/ScatterChart/ScatterChart.js +32 -2
  47. package/ScatterChart/ScatterPlot.js +3 -0
  48. package/ScatterChart/getColor.d.ts +3 -0
  49. package/ScatterChart/getColor.js +31 -0
  50. package/SparkLineChart/SparkLineChart.js +15 -0
  51. package/context/CartesianContextProvider.d.ts +2 -2
  52. package/context/CartesianContextProvider.js +23 -8
  53. package/esm/BarChart/BarChart.js +32 -2
  54. package/esm/BarChart/BarPlot.js +13 -5
  55. package/esm/BarChart/getColor.js +27 -0
  56. package/esm/ChartContainer/ChartContainer.js +36 -4
  57. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  58. package/esm/ChartsClipPath/ChartsClipPath.js +2 -2
  59. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  60. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +7 -2
  61. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  62. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +6 -3
  63. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +13 -4
  64. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +6 -6
  65. package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
  66. package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
  67. package/esm/Gauge/GaugeProvider.js +5 -5
  68. package/esm/LineChart/AnimatedArea.js +6 -5
  69. package/esm/LineChart/AnimatedLine.js +7 -5
  70. package/esm/LineChart/AreaElement.js +4 -1
  71. package/esm/LineChart/AreaPlot.js +7 -1
  72. package/esm/LineChart/LineChart.js +32 -2
  73. package/esm/LineChart/LineElement.js +4 -1
  74. package/esm/LineChart/LineHighlightPlot.js +4 -1
  75. package/esm/LineChart/LinePlot.js +7 -1
  76. package/esm/LineChart/MarkPlot.js +5 -5
  77. package/esm/LineChart/getColor.js +25 -0
  78. package/esm/PieChart/PieChart.js +32 -2
  79. package/esm/PieChart/PiePlot.js +26 -6
  80. package/esm/PieChart/formatter.js +4 -2
  81. package/esm/PieChart/getColor.js +5 -0
  82. package/esm/PieChart/getPieCoordinates.js +19 -0
  83. package/esm/PieChart/index.js +2 -1
  84. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +32 -2
  85. package/esm/ScatterChart/Scatter.js +6 -3
  86. package/esm/ScatterChart/ScatterChart.js +32 -2
  87. package/esm/ScatterChart/ScatterPlot.js +3 -0
  88. package/esm/ScatterChart/getColor.js +25 -0
  89. package/esm/SparkLineChart/SparkLineChart.js +15 -0
  90. package/esm/context/CartesianContextProvider.js +23 -8
  91. package/esm/hooks/index.js +4 -1
  92. package/esm/hooks/useAxisEvents.js +7 -6
  93. package/esm/hooks/useChartId.js +8 -0
  94. package/esm/hooks/useSeries.js +64 -0
  95. package/esm/hooks/useSvgRef.js +9 -0
  96. package/esm/internals/colorGetter.js +22 -0
  97. package/esm/internals/colorScale.js +16 -0
  98. package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +96 -0
  99. package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +55 -0
  100. package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +41 -0
  101. package/esm/internals/components/ChartsAxesGradients/index.js +1 -0
  102. package/esm/models/colorMapping.js +1 -0
  103. package/esm/models/seriesType/index.js +6 -1
  104. package/hooks/index.d.ts +3 -0
  105. package/hooks/index.js +65 -1
  106. package/hooks/useAxisEvents.js +7 -6
  107. package/hooks/useChartId.d.ts +1 -0
  108. package/hooks/useChartId.js +16 -0
  109. package/hooks/useSeries.d.ts +45 -0
  110. package/hooks/useSeries.js +75 -0
  111. package/hooks/useSvgRef.d.ts +2 -0
  112. package/hooks/useSvgRef.js +17 -0
  113. package/index.js +1 -1
  114. package/internals/colorGetter.d.ts +5 -0
  115. package/internals/colorGetter.js +29 -0
  116. package/internals/colorScale.d.ts +5 -0
  117. package/internals/colorScale.js +24 -0
  118. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +3 -0
  119. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +105 -0
  120. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +13 -0
  121. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +63 -0
  122. package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +12 -0
  123. package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +48 -0
  124. package/internals/components/ChartsAxesGradients/index.d.ts +1 -0
  125. package/internals/components/ChartsAxesGradients/index.js +16 -0
  126. package/internals/defaultizeColor.d.ts +4 -4
  127. package/internals/defaultizeValueFormatter.d.ts +5 -5
  128. package/internals/getScale.d.ts +2 -2
  129. package/models/axis.d.ts +44 -4
  130. package/models/colorMapping.d.ts +45 -0
  131. package/models/colorMapping.js +5 -0
  132. package/models/index.d.ts +1 -1
  133. package/models/seriesType/common.d.ts +10 -2
  134. package/models/seriesType/index.d.ts +2 -0
  135. package/models/seriesType/index.js +17 -1
  136. package/modern/BarChart/BarChart.js +32 -2
  137. package/modern/BarChart/BarPlot.js +13 -5
  138. package/modern/BarChart/getColor.js +27 -0
  139. package/modern/ChartContainer/ChartContainer.js +36 -4
  140. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  141. package/modern/ChartsClipPath/ChartsClipPath.js +2 -2
  142. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  143. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +7 -2
  144. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  145. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +6 -3
  146. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +13 -4
  147. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +6 -6
  148. package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
  149. package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
  150. package/modern/Gauge/GaugeProvider.js +5 -5
  151. package/modern/LineChart/AnimatedArea.js +6 -5
  152. package/modern/LineChart/AnimatedLine.js +7 -5
  153. package/modern/LineChart/AreaElement.js +4 -1
  154. package/modern/LineChart/AreaPlot.js +7 -1
  155. package/modern/LineChart/LineChart.js +32 -2
  156. package/modern/LineChart/LineElement.js +4 -1
  157. package/modern/LineChart/LineHighlightPlot.js +4 -1
  158. package/modern/LineChart/LinePlot.js +7 -1
  159. package/modern/LineChart/MarkPlot.js +5 -5
  160. package/modern/LineChart/getColor.js +25 -0
  161. package/modern/PieChart/PieChart.js +32 -2
  162. package/modern/PieChart/PiePlot.js +26 -6
  163. package/modern/PieChart/formatter.js +4 -2
  164. package/modern/PieChart/getColor.js +5 -0
  165. package/modern/PieChart/getPieCoordinates.js +19 -0
  166. package/modern/PieChart/index.js +2 -1
  167. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +32 -2
  168. package/modern/ScatterChart/Scatter.js +6 -3
  169. package/modern/ScatterChart/ScatterChart.js +32 -2
  170. package/modern/ScatterChart/ScatterPlot.js +3 -0
  171. package/modern/ScatterChart/getColor.js +25 -0
  172. package/modern/SparkLineChart/SparkLineChart.js +15 -0
  173. package/modern/context/CartesianContextProvider.js +23 -8
  174. package/modern/hooks/index.js +4 -1
  175. package/modern/hooks/useAxisEvents.js +7 -6
  176. package/modern/hooks/useChartId.js +8 -0
  177. package/modern/hooks/useSeries.js +64 -0
  178. package/modern/hooks/useSvgRef.js +9 -0
  179. package/modern/index.js +1 -1
  180. package/modern/internals/colorGetter.js +22 -0
  181. package/modern/internals/colorScale.js +16 -0
  182. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +96 -0
  183. package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +55 -0
  184. package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +41 -0
  185. package/modern/internals/components/ChartsAxesGradients/index.js +1 -0
  186. package/modern/models/colorMapping.js +1 -0
  187. package/modern/models/seriesType/index.js +6 -1
  188. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps", "onClick"];
3
+ const _excluded = ["id", "classes", "color", "gradientId", "highlightScope", "slots", "slotProps", "onClick"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import composeClasses from '@mui/utils/composeClasses';
@@ -42,6 +42,7 @@ function LineElement(props) {
42
42
  id,
43
43
  classes: innerClasses,
44
44
  color,
45
+ gradientId,
45
46
  highlightScope,
46
47
  slots,
47
48
  slotProps,
@@ -64,6 +65,7 @@ function LineElement(props) {
64
65
  id,
65
66
  classes: innerClasses,
66
67
  color,
68
+ gradientId,
67
69
  isFaded,
68
70
  isHighlighted
69
71
  };
@@ -92,6 +94,7 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
92
94
  classes: PropTypes.object,
93
95
  color: PropTypes.string.isRequired,
94
96
  d: PropTypes.string.isRequired,
97
+ gradientId: PropTypes.string,
95
98
  highlightScope: PropTypes.shape({
96
99
  faded: PropTypes.oneOf(['global', 'none', 'series']),
97
100
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
@@ -9,6 +9,7 @@ import { LineHighlightElement } from './LineHighlightElement';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
10
10
  import { InteractionContext } from '../context/InteractionProvider';
11
11
  import { DEFAULT_X_AXIS_KEY } from '../constants';
12
+ import getColor from './getColor';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  /**
14
15
  * Demos:
@@ -74,9 +75,11 @@ function LineHighlightPlot(props) {
74
75
  }
75
76
  const x = xScale(xData[highlightedIndex]);
76
77
  const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
78
+
79
+ const colorGetter = getColor(series[seriesId], xAxis[xAxisKey], yAxis[yAxisKey]);
77
80
  return /*#__PURE__*/_jsx(Element, _extends({
78
81
  id: seriesId,
79
- color: series[seriesId].color,
82
+ color: colorGetter(highlightedIndex),
80
83
  x: x,
81
84
  y: y
82
85
  }, slotProps?.lineHighlight), `${seriesId}`);
@@ -10,6 +10,7 @@ import { LineElement } from './LineElement';
10
10
  import { getValueToPositionMapper } from '../hooks/useScale';
11
11
  import getCurveFactory from '../internals/getCurve';
12
12
  import { DEFAULT_X_AXIS_KEY } from '../constants';
13
+ import { useChartGradient } from '../internals/components/ChartsAxesGradients';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  const useAggregatedData = () => {
15
16
  const seriesData = React.useContext(SeriesContext).line;
@@ -43,6 +44,7 @@ const useAggregatedData = () => {
43
44
  const xScale = getValueToPositionMapper(xAxis[xAxisKey].scale);
44
45
  const yScale = yAxis[yAxisKey].scale;
45
46
  const xData = xAxis[xAxisKey].data;
47
+ const gradientUsed = yAxis[yAxisKey].colorScale && [yAxisKey, 'y'] || xAxis[xAxisKey].colorScale && [xAxisKey, 'x'] || undefined;
46
48
  if (process.env.NODE_ENV !== 'production') {
47
49
  if (xData === undefined) {
48
50
  throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
@@ -59,6 +61,7 @@ const useAggregatedData = () => {
59
61
  const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
60
62
  const d = linePath.curve(getCurveFactory(series[seriesId].curve))(d3Data) || '';
61
63
  return _extends({}, series[seriesId], {
64
+ gradientUsed,
62
65
  d,
63
66
  seriesId
64
67
  });
@@ -84,18 +87,21 @@ function LinePlot(props) {
84
87
  onItemClick
85
88
  } = props,
86
89
  other = _objectWithoutPropertiesLoose(props, _excluded);
90
+ const getGradientId = useChartGradient();
87
91
  const completedData = useAggregatedData();
88
92
  return /*#__PURE__*/_jsx("g", _extends({}, other, {
89
93
  children: completedData.map(({
90
94
  d,
91
95
  seriesId,
92
96
  color,
93
- highlightScope
97
+ highlightScope,
98
+ gradientUsed
94
99
  }) => {
95
100
  return /*#__PURE__*/_jsx(LineElement, {
96
101
  id: seriesId,
97
102
  d: d,
98
103
  color: color,
104
+ gradientId: gradientUsed && getGradientId(...gradientUsed),
99
105
  highlightScope: highlightScope,
100
106
  skipAnimation: skipAnimation,
101
107
  slots: slots,
@@ -7,9 +7,10 @@ import { SeriesContext } from '../context/SeriesContextProvider';
7
7
  import { CartesianContext } from '../context/CartesianContextProvider';
8
8
  import { MarkElement } from './MarkElement';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
10
+ import { useChartId } from '../hooks/useChartId';
10
11
  import { DEFAULT_X_AXIS_KEY } from '../constants';
11
- import { DrawingContext } from '../context/DrawingProvider';
12
12
  import { cleanId } from '../internals/utils';
13
+ import getColor from './getColor';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  /**
15
16
  * Demos:
@@ -31,9 +32,7 @@ function MarkPlot(props) {
31
32
  other = _objectWithoutPropertiesLoose(props, _excluded);
32
33
  const seriesData = React.useContext(SeriesContext).line;
33
34
  const axisData = React.useContext(CartesianContext);
34
- const {
35
- chartId
36
- } = React.useContext(DrawingContext);
35
+ const chartId = useChartId();
37
36
  const Mark = slots?.mark ?? MarkElement;
38
37
  if (seriesData === undefined) {
39
38
  return null;
@@ -87,6 +86,7 @@ function MarkPlot(props) {
87
86
  }
88
87
  const clipId = cleanId(`${chartId}-${seriesId}-line-clip`); // We assume that if displaying line mark, the line will also be rendered
89
88
 
89
+ const colorGetter = getColor(series[seriesId], xAxis[xAxisKey], yAxis[yAxisKey]);
90
90
  return /*#__PURE__*/_jsx("g", {
91
91
  clipPath: `url(#${clipId})`,
92
92
  children: xData?.map((x, index) => {
@@ -135,7 +135,7 @@ function MarkPlot(props) {
135
135
  id: seriesId,
136
136
  dataIndex: index,
137
137
  shape: "circle",
138
- color: series[seriesId].color,
138
+ color: colorGetter(index),
139
139
  x: x,
140
140
  y: y // Don't know why TS doesn't get from the filter that y can't be null
141
141
  ,
@@ -0,0 +1,25 @@
1
+ export default function getColor(series, xAxis, yAxis) {
2
+ const yColorScale = yAxis.colorScale;
3
+ const xColorScale = xAxis.colorScale;
4
+ if (yColorScale) {
5
+ return dataIndex => {
6
+ const value = series.data[dataIndex];
7
+ const color = value === null ? series.color : yColorScale(value);
8
+ if (color === null) {
9
+ return series.color;
10
+ }
11
+ return color;
12
+ };
13
+ }
14
+ if (xColorScale) {
15
+ return dataIndex => {
16
+ const value = xAxis.data?.[dataIndex];
17
+ const color = value === null ? series.color : xColorScale(value);
18
+ if (color === null) {
19
+ return series.color;
20
+ }
21
+ return color;
22
+ };
23
+ }
24
+ return () => series.color;
25
+ }
@@ -335,11 +335,26 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
335
335
  width: PropTypes.number,
336
336
  /**
337
337
  * The configuration of the x-axes.
338
- * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
338
+ * If not provided, a default axis config is used.
339
339
  */
340
340
  xAxis: PropTypes.arrayOf(PropTypes.shape({
341
341
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
342
342
  classes: PropTypes.object,
343
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
344
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
345
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
346
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
347
+ type: PropTypes.oneOf(['continuous']).isRequired
348
+ }), PropTypes.shape({
349
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
350
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
351
+ type: PropTypes.oneOf(['piecewise']).isRequired
352
+ }), PropTypes.shape({
353
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
354
+ type: PropTypes.oneOf(['ordinal']).isRequired,
355
+ unknownColor: PropTypes.string,
356
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
357
+ })]),
343
358
  data: PropTypes.array,
344
359
  dataKey: PropTypes.string,
345
360
  disableLine: PropTypes.bool,
@@ -372,11 +387,26 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
372
387
  })),
373
388
  /**
374
389
  * The configuration of the y-axes.
375
- * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
390
+ * If not provided, a default axis config is used.
376
391
  */
377
392
  yAxis: PropTypes.arrayOf(PropTypes.shape({
378
393
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
379
394
  classes: PropTypes.object,
395
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
396
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
397
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
398
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
399
+ type: PropTypes.oneOf(['continuous']).isRequired
400
+ }), PropTypes.shape({
401
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
402
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
403
+ type: PropTypes.oneOf(['piecewise']).isRequired
404
+ }), PropTypes.shape({
405
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
406
+ type: PropTypes.oneOf(['ordinal']).isRequired,
407
+ unknownColor: PropTypes.string,
408
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
409
+ })]),
380
410
  data: PropTypes.array,
381
411
  dataKey: PropTypes.string,
382
412
  disableLine: PropTypes.bool,
@@ -5,6 +5,7 @@ import { DrawingContext } from '../context/DrawingProvider';
5
5
  import { PieArcPlot } from './PieArcPlot';
6
6
  import { PieArcLabelPlot } from './PieArcLabelPlot';
7
7
  import { getPercentageValue } from '../internals/utils';
8
+ import { getPieCoordinates } from './getPieCoordinates';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
11
  /**
@@ -34,7 +35,6 @@ function PiePlot(props) {
34
35
  if (seriesData === undefined) {
35
36
  return null;
36
37
  }
37
- const availableRadius = Math.min(width, height) / 2;
38
38
  const {
39
39
  series,
40
40
  seriesOrder
@@ -53,10 +53,19 @@ function PiePlot(props) {
53
53
  faded,
54
54
  highlightScope
55
55
  } = series[seriesId];
56
+ const {
57
+ cx,
58
+ cy,
59
+ availableRadius
60
+ } = getPieCoordinates({
61
+ cx: cxParam,
62
+ cy: cyParam
63
+ }, {
64
+ width,
65
+ height
66
+ });
56
67
  const outerRadius = getPercentageValue(outerRadiusParam ?? availableRadius, availableRadius);
57
68
  const innerRadius = getPercentageValue(innerRadiusParam ?? 0, availableRadius);
58
- const cx = getPercentageValue(cxParam ?? '50%', width);
59
- const cy = getPercentageValue(cyParam ?? '50%', height);
60
69
  return /*#__PURE__*/_jsx("g", {
61
70
  transform: `translate(${left + cx}, ${top + cy})`,
62
71
  children: /*#__PURE__*/_jsx(PieArcPlot, {
@@ -89,11 +98,20 @@ function PiePlot(props) {
89
98
  cy: cyParam,
90
99
  highlightScope
91
100
  } = series[seriesId];
101
+ const {
102
+ cx,
103
+ cy,
104
+ availableRadius
105
+ } = getPieCoordinates({
106
+ cx: cxParam,
107
+ cy: cyParam
108
+ }, {
109
+ width,
110
+ height
111
+ });
92
112
  const outerRadius = getPercentageValue(outerRadiusParam ?? availableRadius, availableRadius);
93
113
  const innerRadius = getPercentageValue(innerRadiusParam ?? 0, availableRadius);
94
114
  const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
95
- const cx = getPercentageValue(cxParam ?? '50%', width);
96
- const cy = getPercentageValue(cyParam ?? '50%', height);
97
115
  return /*#__PURE__*/_jsx("g", {
98
116
  transform: `translate(${left + cx}, ${top + cy})`,
99
117
  children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
@@ -107,7 +125,9 @@ function PiePlot(props) {
107
125
  skipAnimation: skipAnimation,
108
126
  arcLabel: arcLabel,
109
127
  arcLabelMinAngle: arcLabelMinAngle,
110
- highlightScope: highlightScope
128
+ highlightScope: highlightScope,
129
+ slots: slots,
130
+ slotProps: slotProps
111
131
  })
112
132
  }, seriesId);
113
133
  })]
@@ -28,8 +28,10 @@ const formatter = params => {
28
28
  }, series[seriesId], {
29
29
  data: series[seriesId].data.map((item, index) => _extends({}, item, {
30
30
  id: item.id ?? `auto-generated-pie-id-${seriesId}-${index}`
31
- }, arcs[index])).map(item => _extends({}, item, {
32
- formattedValue: series[seriesId].valueFormatter?.(item) ?? item.value.toLocaleString()
31
+ }, arcs[index])).map((item, index) => _extends({}, item, {
32
+ formattedValue: series[seriesId].valueFormatter?.(item, {
33
+ dataIndex: index
34
+ }) ?? item.value.toLocaleString()
33
35
  }))
34
36
  });
35
37
  });
@@ -0,0 +1,5 @@
1
+ export default function getColor(series) {
2
+ return dataIndex => {
3
+ return series.data[dataIndex].color;
4
+ };
5
+ }
@@ -0,0 +1,19 @@
1
+ import { getPercentageValue } from '../internals/utils';
2
+ export function getPieCoordinates(series, drawing) {
3
+ const {
4
+ height,
5
+ width
6
+ } = drawing;
7
+ const {
8
+ cx: cxParam,
9
+ cy: cyParam
10
+ } = series;
11
+ const availableRadius = Math.min(width, height) / 2;
12
+ const cx = getPercentageValue(cxParam ?? '50%', width);
13
+ const cy = getPercentageValue(cyParam ?? '50%', height);
14
+ return {
15
+ cx,
16
+ cy,
17
+ availableRadius
18
+ };
19
+ }
@@ -3,4 +3,5 @@ export * from './PiePlot';
3
3
  export * from './PieArcPlot';
4
4
  export * from './PieArcLabelPlot';
5
5
  export * from './PieArc';
6
- export * from './PieArcLabel';
6
+ export * from './PieArcLabel';
7
+ export * from './getPieCoordinates';
@@ -106,11 +106,26 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
106
106
  width: PropTypes.number,
107
107
  /**
108
108
  * The configuration of the x-axes.
109
- * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
109
+ * If not provided, a default axis config is used.
110
110
  */
111
111
  xAxis: PropTypes.arrayOf(PropTypes.shape({
112
112
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
113
113
  classes: PropTypes.object,
114
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
115
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
116
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
117
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
118
+ type: PropTypes.oneOf(['continuous']).isRequired
119
+ }), PropTypes.shape({
120
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
121
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
122
+ type: PropTypes.oneOf(['piecewise']).isRequired
123
+ }), PropTypes.shape({
124
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
125
+ type: PropTypes.oneOf(['ordinal']).isRequired,
126
+ unknownColor: PropTypes.string,
127
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
128
+ })]),
114
129
  data: PropTypes.array,
115
130
  dataKey: PropTypes.string,
116
131
  disableLine: PropTypes.bool,
@@ -143,11 +158,26 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
143
158
  })),
144
159
  /**
145
160
  * The configuration of the y-axes.
146
- * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
161
+ * If not provided, a default axis config is used.
147
162
  */
148
163
  yAxis: PropTypes.arrayOf(PropTypes.shape({
149
164
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
150
165
  classes: PropTypes.object,
166
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
167
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
168
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
169
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
170
+ type: PropTypes.oneOf(['continuous']).isRequired
171
+ }), PropTypes.shape({
172
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
173
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
174
+ type: PropTypes.oneOf(['piecewise']).isRequired
175
+ }), PropTypes.shape({
176
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
177
+ type: PropTypes.oneOf(['ordinal']).isRequired,
178
+ unknownColor: PropTypes.string,
179
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
180
+ })]),
151
181
  data: PropTypes.array,
152
182
  dataKey: PropTypes.string,
153
183
  disableLine: PropTypes.bool,
@@ -21,6 +21,7 @@ function Scatter(props) {
21
21
  xScale,
22
22
  yScale,
23
23
  color,
24
+ colorGetter,
24
25
  markerSize,
25
26
  onItemClick
26
27
  } = props;
@@ -63,19 +64,20 @@ function Scatter(props) {
63
64
  isFaded: !isHighlighted && getIsFaded(item, pointCtx, highlightScope),
64
65
  interactionProps: getInteractionItemProps(pointCtx),
65
66
  id: scatterPoint.id,
66
- dataIndex: i
67
+ dataIndex: i,
68
+ color: colorGetter ? colorGetter(i) : color
67
69
  });
68
70
  }
69
71
  }
70
72
  return temp;
71
- }, [xScale, yScale, series.data, series.id, item, highlightScope, getInteractionItemProps]);
73
+ }, [xScale, yScale, series.data, series.id, item, highlightScope, getInteractionItemProps, color, colorGetter]);
72
74
  return /*#__PURE__*/_jsx("g", {
73
75
  children: cleanData.map(dataPoint => /*#__PURE__*/_jsx("circle", _extends({
74
76
  cx: 0,
75
77
  cy: 0,
76
78
  r: (dataPoint.isHighlighted ? 1.2 : 1) * markerSize,
77
79
  transform: `translate(${dataPoint.x}, ${dataPoint.y})`,
78
- fill: color,
80
+ fill: dataPoint.color,
79
81
  opacity: dataPoint.isFaded && 0.3 || 1,
80
82
  onClick: onItemClick && (event => onItemClick(event, {
81
83
  type: 'scatter',
@@ -92,6 +94,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
92
94
  // | To update them edit the TypeScript types and run "yarn proptypes" |
93
95
  // ----------------------------------------------------------------------
94
96
  color: PropTypes.string.isRequired,
97
+ colorGetter: PropTypes.func,
95
98
  markerSize: PropTypes.number.isRequired,
96
99
  /**
97
100
  * Callback fired when clicking on a scatter item.
@@ -328,11 +328,26 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
328
328
  width: PropTypes.number,
329
329
  /**
330
330
  * The configuration of the x-axes.
331
- * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
331
+ * If not provided, a default axis config is used.
332
332
  */
333
333
  xAxis: PropTypes.arrayOf(PropTypes.shape({
334
334
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
335
335
  classes: PropTypes.object,
336
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
337
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
338
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
339
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
340
+ type: PropTypes.oneOf(['continuous']).isRequired
341
+ }), PropTypes.shape({
342
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
343
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
344
+ type: PropTypes.oneOf(['piecewise']).isRequired
345
+ }), PropTypes.shape({
346
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
347
+ type: PropTypes.oneOf(['ordinal']).isRequired,
348
+ unknownColor: PropTypes.string,
349
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
350
+ })]),
336
351
  data: PropTypes.array,
337
352
  dataKey: PropTypes.string,
338
353
  disableLine: PropTypes.bool,
@@ -365,11 +380,26 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
365
380
  })),
366
381
  /**
367
382
  * The configuration of the y-axes.
368
- * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
383
+ * If not provided, a default axis config is used.
369
384
  */
370
385
  yAxis: PropTypes.arrayOf(PropTypes.shape({
371
386
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
372
387
  classes: PropTypes.object,
388
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
389
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
390
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
391
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
392
+ type: PropTypes.oneOf(['continuous']).isRequired
393
+ }), PropTypes.shape({
394
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
395
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
396
+ type: PropTypes.oneOf(['piecewise']).isRequired
397
+ }), PropTypes.shape({
398
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
399
+ type: PropTypes.oneOf(['ordinal']).isRequired,
400
+ unknownColor: PropTypes.string,
401
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
402
+ })]),
373
403
  data: PropTypes.array,
374
404
  dataKey: PropTypes.string,
375
405
  disableLine: PropTypes.bool,
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { Scatter } from './Scatter';
5
5
  import { SeriesContext } from '../context/SeriesContextProvider';
6
6
  import { CartesianContext } from '../context/CartesianContextProvider';
7
+ import getColor from './getColor';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  /**
9
10
  * Demos:
@@ -48,12 +49,14 @@ function ScatterPlot(props) {
48
49
  markerSize,
49
50
  color
50
51
  } = series[seriesId];
52
+ const colorGetter = getColor(series[seriesId], xAxis[xAxisKey ?? defaultXAxisId], yAxis[yAxisKey ?? defaultYAxisId]);
51
53
  const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
52
54
  const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
53
55
  return /*#__PURE__*/_jsx(ScatterItems, _extends({
54
56
  xScale: xScale,
55
57
  yScale: yScale,
56
58
  color: color,
59
+ colorGetter: colorGetter,
57
60
  markerSize: markerSize ?? 4,
58
61
  series: series[seriesId],
59
62
  onItemClick: onItemClick
@@ -0,0 +1,25 @@
1
+ export default function getColor(series, xAxis, yAxis) {
2
+ const yColorScale = yAxis.colorScale;
3
+ const xColorScale = xAxis.colorScale;
4
+ if (yColorScale) {
5
+ return dataIndex => {
6
+ const value = series.data[dataIndex];
7
+ const color = value === null ? series.color : yColorScale(value.y);
8
+ if (color === null) {
9
+ return series.color;
10
+ }
11
+ return color;
12
+ };
13
+ }
14
+ if (xColorScale) {
15
+ return dataIndex => {
16
+ const value = series.data[dataIndex];
17
+ const color = value === null ? series.color : xColorScale(value.x);
18
+ if (color === null) {
19
+ return series.color;
20
+ }
21
+ return color;
22
+ };
23
+ }
24
+ return () => series.color;
25
+ }
@@ -226,6 +226,21 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
226
226
  xAxis: PropTypes.shape({
227
227
  axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
228
228
  classes: PropTypes.object,
229
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
230
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
231
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
232
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
233
+ type: PropTypes.oneOf(['continuous']).isRequired
234
+ }), PropTypes.shape({
235
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
236
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
237
+ type: PropTypes.oneOf(['piecewise']).isRequired
238
+ }), PropTypes.shape({
239
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
240
+ type: PropTypes.oneOf(['ordinal']).isRequired,
241
+ unknownColor: PropTypes.string,
242
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
243
+ })]),
229
244
  data: PropTypes.array,
230
245
  dataKey: PropTypes.string,
231
246
  disableLine: PropTypes.bool,
@@ -6,10 +6,11 @@ import { getExtremumX as getScatterExtremumX, getExtremumY as getScatterExtremum
6
6
  import { getExtremumX as getLineExtremumX, getExtremumY as getLineExtremumY } from '../LineChart/extremums';
7
7
  import { isBandScaleConfig, isPointScaleConfig } from '../models/axis';
8
8
  import { getScale } from '../internals/getScale';
9
- import { DrawingContext } from './DrawingProvider';
10
9
  import { SeriesContext } from './SeriesContextProvider';
11
10
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
12
11
  import { getTickNumber } from '../hooks/useTicks';
12
+ import { useDrawingArea } from '../hooks/useDrawingArea';
13
+ import { getColorScale, getOrdinalColorScale } from '../internals/colorScale';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
15
16
  const DEFAULT_BAR_GAP_RATIO = 0.1;
@@ -42,7 +43,7 @@ function CartesianContextProvider(props) {
42
43
  children
43
44
  } = props;
44
45
  const formattedSeries = React.useContext(SeriesContext);
45
- const drawingArea = React.useContext(DrawingContext);
46
+ const drawingArea = useDrawingArea();
46
47
  const xAxis = React.useMemo(() => inXAxis?.map(axisConfig => {
47
48
  const dataKey = axisConfig.dataKey;
48
49
  if (dataKey === undefined || axisConfig.data !== undefined) {
@@ -112,13 +113,19 @@ function CartesianContextProvider(props) {
112
113
  barGapRatio
113
114
  }, axis, {
114
115
  scale: scaleBand(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
115
- tickNumber: axis.data.length
116
+ tickNumber: axis.data.length,
117
+ colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? getOrdinalColorScale(_extends({
118
+ values: axis.data
119
+ }, axis.colorMap)) : getColorScale(axis.colorMap))
116
120
  });
117
121
  }
118
122
  if (isPointScaleConfig(axis)) {
119
123
  completedXAxis[axis.id] = _extends({}, axis, {
120
124
  scale: scalePoint(axis.data, range),
121
- tickNumber: axis.data.length
125
+ tickNumber: axis.data.length,
126
+ colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? getOrdinalColorScale(_extends({
127
+ values: axis.data
128
+ }, axis.colorMap)) : getColorScale(axis.colorMap))
122
129
  });
123
130
  }
124
131
  if (axis.scaleType === 'band' || axis.scaleType === 'point') {
@@ -137,7 +144,8 @@ function CartesianContextProvider(props) {
137
144
  completedXAxis[axis.id] = _extends({}, axis, {
138
145
  scaleType,
139
146
  scale: niceScale.domain(domain),
140
- tickNumber
147
+ tickNumber,
148
+ colorScale: axis.colorMap && getColorScale(axis.colorMap)
141
149
  });
142
150
  });
143
151
  const allYAxis = [...(yAxis?.map((axis, index) => _extends({
@@ -160,13 +168,19 @@ function CartesianContextProvider(props) {
160
168
  barGapRatio: 0
161
169
  }, axis, {
162
170
  scale: scaleBand(axis.data, [range[1], range[0]]).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
163
- tickNumber: axis.data.length
171
+ tickNumber: axis.data.length,
172
+ colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? getOrdinalColorScale(_extends({
173
+ values: axis.data
174
+ }, axis.colorMap)) : getColorScale(axis.colorMap))
164
175
  });
165
176
  }
166
177
  if (isPointScaleConfig(axis)) {
167
178
  completedYAxis[axis.id] = _extends({}, axis, {
168
179
  scale: scalePoint(axis.data, [range[1], range[0]]),
169
- tickNumber: axis.data.length
180
+ tickNumber: axis.data.length,
181
+ colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? getOrdinalColorScale(_extends({
182
+ values: axis.data
183
+ }, axis.colorMap)) : getColorScale(axis.colorMap))
170
184
  });
171
185
  }
172
186
  if (axis.scaleType === 'band' || axis.scaleType === 'point') {
@@ -185,7 +199,8 @@ function CartesianContextProvider(props) {
185
199
  completedYAxis[axis.id] = _extends({}, axis, {
186
200
  scaleType,
187
201
  scale: niceScale.domain(domain),
188
- tickNumber
202
+ tickNumber,
203
+ colorScale: axis.colorMap && getColorScale(axis.colorMap)
189
204
  });
190
205
  });
191
206
  return {
@@ -1,2 +1,5 @@
1
1
  export * from './useDrawingArea';
2
- export * from './useScale';
2
+ export * from './useChartId';
3
+ export * from './useScale';
4
+ export * from './useSvgRef';
5
+ export { useSeries as unstable_useSeries, usePieSeries as unstable_usePieSeries, useLineSeries as unstable_useLineSeries, useBarSeries as unstable_useBarSeries, useScatterSeries as unstable_useScatterSeries } from './useSeries';