@mui/x-charts 6.0.0-alpha.6 → 6.0.0-alpha.7

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 (119) hide show
  1. package/BarChart/BarChart.d.ts +18 -2
  2. package/BarChart/BarChart.js +60 -11
  3. package/BarChart/BarElement.d.ts +22 -0
  4. package/BarChart/BarElement.js +21 -10
  5. package/BarChart/BarPlot.d.ts +14 -1
  6. package/BarChart/BarPlot.js +23 -4
  7. package/CHANGELOG.md +62 -0
  8. package/ChartsAxis/ChartsAxis.d.ts +11 -1
  9. package/ChartsAxis/ChartsAxis.js +51 -6
  10. package/ChartsLegend/ChartsLegend.d.ts +25 -2
  11. package/ChartsLegend/ChartsLegend.js +49 -17
  12. package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
  13. package/ChartsXAxis/ChartsXAxis.js +44 -9
  14. package/ChartsYAxis/ChartsYAxis.js +44 -9
  15. package/LineChart/AreaElement.d.ts +22 -0
  16. package/LineChart/AreaElement.js +31 -11
  17. package/LineChart/AreaPlot.d.ts +14 -1
  18. package/LineChart/AreaPlot.js +29 -3
  19. package/LineChart/LineChart.d.ts +20 -2
  20. package/LineChart/LineChart.js +62 -10
  21. package/LineChart/LineElement.d.ts +22 -0
  22. package/LineChart/LineElement.js +31 -10
  23. package/LineChart/LinePlot.d.ts +14 -1
  24. package/LineChart/LinePlot.js +35 -4
  25. package/LineChart/MarkPlot.d.ts +24 -1
  26. package/LineChart/MarkPlot.js +25 -3
  27. package/PieChart/PieArcLabel.js +0 -1
  28. package/PieChart/PieChart.d.ts +14 -2
  29. package/PieChart/PieChart.js +51 -9
  30. package/PieChart/PiePlot.d.ts +27 -1
  31. package/PieChart/PiePlot.js +29 -6
  32. package/ScatterChart/ScatterChart.d.ts +18 -2
  33. package/ScatterChart/ScatterChart.js +55 -9
  34. package/ScatterChart/ScatterPlot.d.ts +24 -1
  35. package/ScatterChart/ScatterPlot.js +28 -4
  36. package/SparkLineChart/SparkLineChart.d.ts +18 -0
  37. package/SparkLineChart/SparkLineChart.js +28 -5
  38. package/colorPalettes/colorPalettes.js +2 -2
  39. package/context/CartesianContextProvider.js +14 -8
  40. package/esm/BarChart/BarChart.js +60 -11
  41. package/esm/BarChart/BarElement.js +21 -11
  42. package/esm/BarChart/BarPlot.js +23 -4
  43. package/esm/ChartsAxis/ChartsAxis.js +51 -6
  44. package/esm/ChartsLegend/ChartsLegend.js +47 -14
  45. package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
  46. package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
  47. package/esm/LineChart/AreaElement.js +31 -11
  48. package/esm/LineChart/AreaPlot.js +31 -4
  49. package/esm/LineChart/LineChart.js +62 -10
  50. package/esm/LineChart/LineElement.js +31 -11
  51. package/esm/LineChart/LinePlot.js +43 -8
  52. package/esm/LineChart/MarkPlot.js +28 -4
  53. package/esm/PieChart/PieArcLabel.js +0 -1
  54. package/esm/PieChart/PieChart.js +51 -9
  55. package/esm/PieChart/PiePlot.js +31 -6
  56. package/esm/ScatterChart/ScatterChart.js +55 -9
  57. package/esm/ScatterChart/ScatterPlot.js +29 -4
  58. package/esm/SparkLineChart/SparkLineChart.js +28 -5
  59. package/esm/colorPalettes/colorPalettes.js +2 -2
  60. package/esm/context/CartesianContextProvider.js +14 -8
  61. package/esm/hooks/useTicks.js +9 -6
  62. package/esm/internals/components/AxisSharedComponents.js +10 -10
  63. package/hooks/useTicks.d.ts +20 -5
  64. package/hooks/useTicks.js +9 -6
  65. package/index.js +1 -1
  66. package/internals/components/AxisSharedComponents.d.ts +4 -4
  67. package/internals/components/AxisSharedComponents.js +15 -15
  68. package/legacy/BarChart/BarChart.js +60 -11
  69. package/legacy/BarChart/BarElement.js +20 -10
  70. package/legacy/BarChart/BarPlot.js +23 -4
  71. package/legacy/ChartsAxis/ChartsAxis.js +51 -6
  72. package/legacy/ChartsLegend/ChartsLegend.js +46 -15
  73. package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
  74. package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
  75. package/legacy/LineChart/AreaElement.js +30 -10
  76. package/legacy/LineChart/AreaPlot.js +29 -4
  77. package/legacy/LineChart/LineChart.js +62 -10
  78. package/legacy/LineChart/LineElement.js +30 -10
  79. package/legacy/LineChart/LinePlot.js +36 -5
  80. package/legacy/LineChart/MarkPlot.js +26 -4
  81. package/legacy/PieChart/PieArcLabel.js +0 -1
  82. package/legacy/PieChart/PieChart.js +51 -9
  83. package/legacy/PieChart/PiePlot.js +29 -6
  84. package/legacy/ScatterChart/ScatterChart.js +55 -9
  85. package/legacy/ScatterChart/ScatterPlot.js +27 -4
  86. package/legacy/SparkLineChart/SparkLineChart.js +28 -5
  87. package/legacy/colorPalettes/colorPalettes.js +2 -2
  88. package/legacy/context/CartesianContextProvider.js +14 -8
  89. package/legacy/hooks/useTicks.js +9 -9
  90. package/legacy/index.js +1 -1
  91. package/legacy/internals/components/AxisSharedComponents.js +10 -10
  92. package/models/axis.d.ts +24 -1
  93. package/modern/BarChart/BarChart.js +60 -11
  94. package/modern/BarChart/BarElement.js +20 -11
  95. package/modern/BarChart/BarPlot.js +23 -4
  96. package/modern/ChartsAxis/ChartsAxis.js +51 -6
  97. package/modern/ChartsLegend/ChartsLegend.js +46 -14
  98. package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
  99. package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
  100. package/modern/LineChart/AreaElement.js +30 -11
  101. package/modern/LineChart/AreaPlot.js +31 -4
  102. package/modern/LineChart/LineChart.js +62 -10
  103. package/modern/LineChart/LineElement.js +30 -11
  104. package/modern/LineChart/LinePlot.js +37 -5
  105. package/modern/LineChart/MarkPlot.js +27 -4
  106. package/modern/PieChart/PieArcLabel.js +0 -1
  107. package/modern/PieChart/PieChart.js +51 -9
  108. package/modern/PieChart/PiePlot.js +30 -6
  109. package/modern/ScatterChart/ScatterChart.js +55 -9
  110. package/modern/ScatterChart/ScatterPlot.js +28 -4
  111. package/modern/SparkLineChart/SparkLineChart.js +28 -5
  112. package/modern/colorPalettes/colorPalettes.js +2 -2
  113. package/modern/context/CartesianContextProvider.js +14 -8
  114. package/modern/hooks/useTicks.js +9 -6
  115. package/modern/index.js +1 -1
  116. package/modern/internals/components/AxisSharedComponents.js +10 -10
  117. package/package.json +2 -2
  118. package/themeAugmentation/components.d.ts +0 -10
  119. package/themeAugmentation/overrides.d.ts +0 -2
@@ -1,10 +1,11 @@
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"];
3
+ const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { color as d3Color } from 'd3-color';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
+ import { useSlotProps } from '@mui/base/utils';
8
9
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
10
  import { styled } from '@mui/material/styles';
10
11
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
@@ -27,7 +28,7 @@ const useUtilityClasses = ownerState => {
27
28
  };
28
29
  return composeClasses(slots, getLineElementUtilityClass, classes);
29
30
  };
30
- const LineElementPath = styled('path', {
31
+ export const LineElementPath = styled('path', {
31
32
  name: 'MuiLineElement',
32
33
  slot: 'Root',
33
34
  overridesResolver: (_, styles) => styles.root
@@ -61,7 +62,9 @@ function LineElement(props) {
61
62
  id,
62
63
  classes: innerClasses,
63
64
  color,
64
- highlightScope
65
+ highlightScope,
66
+ slots,
67
+ slotProps
65
68
  } = props,
66
69
  other = _objectWithoutPropertiesLoose(props, _excluded);
67
70
  const getInteractionItemProps = useInteractionItemProps(highlightScope);
@@ -84,13 +87,19 @@ function LineElement(props) {
84
87
  isHighlighted
85
88
  };
86
89
  const classes = useUtilityClasses(ownerState);
87
- return /*#__PURE__*/_jsx(LineElementPath, _extends({}, other, {
88
- ownerState: ownerState,
89
- className: classes.root
90
- }, getInteractionItemProps({
91
- type: 'line',
92
- seriesId: id
93
- })));
90
+ const Line = slots?.line ?? LineElementPath;
91
+ const lineProps = useSlotProps({
92
+ elementType: Line,
93
+ externalSlotProps: slotProps?.line,
94
+ additionalProps: _extends({}, other, getInteractionItemProps({
95
+ type: 'line',
96
+ seriesId: id
97
+ }), {
98
+ className: classes.root
99
+ }),
100
+ ownerState
101
+ });
102
+ return /*#__PURE__*/_jsx(Line, _extends({}, lineProps));
94
103
  }
95
104
  process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
96
105
  // ----------------------------- Warning --------------------------------
@@ -101,6 +110,16 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
101
110
  highlightScope: PropTypes.shape({
102
111
  faded: PropTypes.oneOf(['global', 'none', 'series']),
103
112
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
104
- })
113
+ }),
114
+ /**
115
+ * The props used for each component slot.
116
+ * @default {}
117
+ */
118
+ slotProps: PropTypes.object,
119
+ /**
120
+ * Overridable component slots.
121
+ * @default {}
122
+ */
123
+ slots: PropTypes.object
105
124
  } : void 0;
106
125
  export { LineElement };
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["slots", "slotProps"];
2
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
3
6
  import { line as d3Line } from 'd3-shape';
4
7
  import { SeriesContext } from '../context/SeriesContextProvider';
5
8
  import { CartesianContext } from '../context/CartesianContextProvider';
@@ -7,7 +10,12 @@ import { LineElement } from './LineElement';
7
10
  import { getValueToPositionMapper } from '../hooks/useScale';
8
11
  import getCurveFactory from '../internals/getCurve';
9
12
  import { jsx as _jsx } from "react/jsx-runtime";
10
- export function LinePlot(props) {
13
+ function LinePlot(props) {
14
+ const {
15
+ slots,
16
+ slotProps
17
+ } = props,
18
+ other = _objectWithoutPropertiesLoose(props, _excluded);
11
19
  const seriesData = React.useContext(SeriesContext).line;
12
20
  const axisData = React.useContext(CartesianContext);
13
21
  if (seriesData === undefined) {
@@ -25,7 +33,7 @@ export function LinePlot(props) {
25
33
  } = axisData;
26
34
  const defaultXAxisId = xAxisIds[0];
27
35
  const defaultYAxisId = yAxisIds[0];
28
- return /*#__PURE__*/_jsx("g", _extends({}, props, {
36
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
29
37
  children: stackingGroups.flatMap(({
30
38
  ids: groupIds
31
39
  }) => {
@@ -42,18 +50,42 @@ export function LinePlot(props) {
42
50
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
43
51
  }
44
52
  const linePath = d3Line().x(d => xScale(d.x)).y(d => yScale(d.y[1]));
53
+ if (process.env.NODE_ENV !== 'production') {
54
+ if (xData.length !== stackedData.length) {
55
+ throw new Error(`MUI: data length of the x axis (${xData.length} items) does not match length of series (${stackedData.length} items)`);
56
+ }
57
+ }
45
58
  const curve = getCurveFactory(series[seriesId].curve);
46
59
  const d3Data = xData?.map((x, index) => ({
47
60
  x,
48
- y: stackedData[index]
61
+ y: stackedData[index] ?? [0, 0]
49
62
  }));
50
63
  return /*#__PURE__*/_jsx(LineElement, {
51
64
  id: seriesId,
52
65
  d: linePath.curve(curve)(d3Data) || undefined,
53
66
  color: series[seriesId].color,
54
- highlightScope: series[seriesId].highlightScope
67
+ highlightScope: series[seriesId].highlightScope,
68
+ slots: slots,
69
+ slotProps: slotProps
55
70
  }, seriesId);
56
71
  });
57
72
  })
58
73
  }));
59
- }
74
+ }
75
+ process.env.NODE_ENV !== "production" ? LinePlot.propTypes = {
76
+ // ----------------------------- Warning --------------------------------
77
+ // | These PropTypes are generated from the TypeScript type definitions |
78
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
79
+ // ----------------------------------------------------------------------
80
+ /**
81
+ * The props used for each component slot.
82
+ * @default {}
83
+ */
84
+ slotProps: PropTypes.object,
85
+ /**
86
+ * Overridable component slots.
87
+ * @default {}
88
+ */
89
+ slots: PropTypes.object
90
+ } : void 0;
91
+ export { LinePlot };
@@ -1,13 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import { SeriesContext } from '../context/SeriesContextProvider';
4
5
  import { CartesianContext } from '../context/CartesianContextProvider';
5
6
  import { MarkElement } from './MarkElement';
6
7
  import { getValueToPositionMapper } from '../hooks/useScale';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
- export function MarkPlot(props) {
9
+ function MarkPlot(props) {
10
+ const {
11
+ slots,
12
+ slotProps
13
+ } = props;
9
14
  const seriesData = React.useContext(SeriesContext).line;
10
15
  const axisData = React.useContext(CartesianContext);
16
+ const Mark = slots?.mark ?? MarkElement;
11
17
  if (seriesData === undefined) {
12
18
  return null;
13
19
  }
@@ -64,7 +70,7 @@ export function MarkPlot(props) {
64
70
  x,
65
71
  y,
66
72
  index
67
- }) => /*#__PURE__*/_jsx(MarkElement, {
73
+ }) => /*#__PURE__*/_jsx(Mark, _extends({
68
74
  id: seriesId,
69
75
  dataIndex: index,
70
76
  shape: "circle",
@@ -72,8 +78,25 @@ export function MarkPlot(props) {
72
78
  x: x,
73
79
  y: y,
74
80
  highlightScope: series[seriesId].highlightScope
75
- }, `${seriesId}-${index}`));
81
+ }, slotProps?.mark), `${seriesId}-${index}`));
76
82
  });
77
83
  })
78
84
  }));
79
- }
85
+ }
86
+ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
87
+ // ----------------------------- Warning --------------------------------
88
+ // | These PropTypes are generated from the TypeScript type definitions |
89
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
90
+ // ----------------------------------------------------------------------
91
+ /**
92
+ * The props used for each component slot.
93
+ * @default {}
94
+ */
95
+ slotProps: PropTypes.object,
96
+ /**
97
+ * Overridable component slots.
98
+ * @default {}
99
+ */
100
+ slots: PropTypes.object
101
+ } : void 0;
102
+ export { MarkPlot };
@@ -35,7 +35,6 @@ const PieArcLabelRoot = styled('text', {
35
35
  theme
36
36
  }) => ({
37
37
  fill: theme.palette.text.primary,
38
- alignmentBaseline: 'baseline',
39
38
  textAnchor: 'middle'
40
39
  }));
41
40
  export default function PieArcLabel(props) {
@@ -44,7 +44,9 @@ function PieChart(props) {
44
44
  leftAxis = null,
45
45
  rightAxis = null,
46
46
  bottomAxis = null,
47
- children
47
+ children,
48
+ slots,
49
+ slotProps
48
50
  } = props;
49
51
  const margin = _extends({}, defaultMargin, marginProps);
50
52
  return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
@@ -67,8 +69,16 @@ function PieChart(props) {
67
69
  topAxis: topAxis,
68
70
  leftAxis: leftAxis,
69
71
  rightAxis: rightAxis,
70
- bottomAxis: bottomAxis
71
- }), /*#__PURE__*/_jsx(PiePlot, {}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), children]
72
+ bottomAxis: bottomAxis,
73
+ slots: slots,
74
+ slotProps: slotProps
75
+ }), /*#__PURE__*/_jsx(PiePlot, {
76
+ slots: slots,
77
+ slotProps: slotProps
78
+ }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
79
+ slots: slots,
80
+ slotProps: slotProps
81
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), children]
72
82
  });
73
83
  }
74
84
  process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
@@ -94,8 +104,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
94
104
  label: PropTypes.string,
95
105
  labelFontSize: PropTypes.number,
96
106
  position: PropTypes.oneOf(['bottom', 'top']),
107
+ slotProps: PropTypes.object,
108
+ slots: PropTypes.object,
97
109
  stroke: PropTypes.string,
98
110
  tickFontSize: PropTypes.number,
111
+ tickMaxStep: PropTypes.number,
112
+ tickMinStep: PropTypes.number,
113
+ tickNumber: PropTypes.number,
99
114
  tickSize: PropTypes.number
100
115
  }), PropTypes.string]),
101
116
  children: PropTypes.node,
@@ -122,8 +137,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
122
137
  label: PropTypes.string,
123
138
  labelFontSize: PropTypes.number,
124
139
  position: PropTypes.oneOf(['left', 'right']),
140
+ slotProps: PropTypes.object,
141
+ slots: PropTypes.object,
125
142
  stroke: PropTypes.string,
126
143
  tickFontSize: PropTypes.number,
144
+ tickMaxStep: PropTypes.number,
145
+ tickMinStep: PropTypes.number,
146
+ tickNumber: PropTypes.number,
127
147
  tickSize: PropTypes.number
128
148
  }), PropTypes.string]),
129
149
  legend: PropTypes.shape({
@@ -140,6 +160,8 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
140
160
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
141
161
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
142
162
  }),
163
+ slotProps: PropTypes.object,
164
+ slots: PropTypes.object,
143
165
  spacing: PropTypes.number
144
166
  }),
145
167
  margin: PropTypes.shape({
@@ -162,8 +184,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
162
184
  label: PropTypes.string,
163
185
  labelFontSize: PropTypes.number,
164
186
  position: PropTypes.oneOf(['left', 'right']),
187
+ slotProps: PropTypes.object,
188
+ slots: PropTypes.object,
165
189
  stroke: PropTypes.string,
166
190
  tickFontSize: PropTypes.number,
191
+ tickMaxStep: PropTypes.number,
192
+ tickMinStep: PropTypes.number,
193
+ tickNumber: PropTypes.number,
167
194
  tickSize: PropTypes.number
168
195
  }), PropTypes.string]),
169
196
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -205,6 +232,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
205
232
  type: PropTypes.oneOf(['pie']),
206
233
  valueFormatter: PropTypes.func
207
234
  })).isRequired,
235
+ /**
236
+ * The props used for each component slot.
237
+ * @default {}
238
+ */
239
+ slotProps: PropTypes.object,
240
+ slots: PropTypes.object,
208
241
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
209
242
  title: PropTypes.string,
210
243
  tooltip: PropTypes.shape({
@@ -227,8 +260,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
227
260
  label: PropTypes.string,
228
261
  labelFontSize: PropTypes.number,
229
262
  position: PropTypes.oneOf(['bottom', 'top']),
263
+ slotProps: PropTypes.object,
264
+ slots: PropTypes.object,
230
265
  stroke: PropTypes.string,
231
266
  tickFontSize: PropTypes.number,
267
+ tickMaxStep: PropTypes.number,
268
+ tickMinStep: PropTypes.number,
269
+ tickNumber: PropTypes.number,
232
270
  tickSize: PropTypes.number
233
271
  }), PropTypes.string]),
234
272
  viewBox: PropTypes.shape({
@@ -251,15 +289,17 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
251
289
  label: PropTypes.string,
252
290
  labelFontSize: PropTypes.number,
253
291
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
254
- maxTicks: PropTypes.number,
255
292
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
256
- minTicks: PropTypes.number,
257
293
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
258
294
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
295
+ slotProps: PropTypes.object,
296
+ slots: PropTypes.object,
259
297
  stroke: PropTypes.string,
260
298
  tickFontSize: PropTypes.number,
299
+ tickMaxStep: PropTypes.number,
300
+ tickMinStep: PropTypes.number,
301
+ tickNumber: PropTypes.number,
261
302
  tickSize: PropTypes.number,
262
- tickSpacing: PropTypes.number,
263
303
  valueFormatter: PropTypes.func
264
304
  })),
265
305
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -275,15 +315,17 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
275
315
  label: PropTypes.string,
276
316
  labelFontSize: PropTypes.number,
277
317
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
278
- maxTicks: PropTypes.number,
279
318
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
280
- minTicks: PropTypes.number,
281
319
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
282
320
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
321
+ slotProps: PropTypes.object,
322
+ slots: PropTypes.object,
283
323
  stroke: PropTypes.string,
284
324
  tickFontSize: PropTypes.number,
325
+ tickMaxStep: PropTypes.number,
326
+ tickMinStep: PropTypes.number,
327
+ tickNumber: PropTypes.number,
285
328
  tickSize: PropTypes.number,
286
- tickSpacing: PropTypes.number,
287
329
  valueFormatter: PropTypes.func
288
330
  }))
289
331
  } : void 0;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import { SeriesContext } from '../context/SeriesContextProvider';
4
5
  import PieArc from './PieArc';
5
6
  import PieArcLabel from './PieArcLabel';
@@ -21,7 +22,11 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
21
22
  }
22
23
  return arcLabel(item);
23
24
  }
24
- export function PiePlot() {
25
+ function PiePlot(props) {
26
+ const {
27
+ slots,
28
+ slotProps
29
+ } = props;
25
30
  const seriesData = React.useContext(SeriesContext).pie;
26
31
  const {
27
32
  left,
@@ -41,6 +46,8 @@ export function PiePlot() {
41
46
  series,
42
47
  seriesOrder
43
48
  } = seriesData;
49
+ const Arc = slots?.pieArc ?? PieArc;
50
+ const ArcLabel = slots?.pieArcLabel ?? PieArcLabel;
44
51
  return /*#__PURE__*/_jsx("g", {
45
52
  children: seriesOrder.map(seriesId => {
46
53
  const {
@@ -59,7 +66,7 @@ export function PiePlot() {
59
66
  transform: `translate(${cx === undefined ? center.x : left + cx}, ${cy === undefined ? center.y : top + cy})`,
60
67
  children: /*#__PURE__*/_jsxs("g", {
61
68
  children: [data.map((item, index) => {
62
- return /*#__PURE__*/_createElement(PieArc, _extends({}, item, {
69
+ return /*#__PURE__*/_createElement(Arc, _extends({}, item, {
63
70
  key: item.id,
64
71
  innerRadius: innerRadius,
65
72
  outerRadius: outerRadius ?? availableRadius,
@@ -70,9 +77,9 @@ export function PiePlot() {
70
77
  highlightScope: series[seriesId].highlightScope,
71
78
  highlighted: highlighted,
72
79
  faded: faded
73
- }));
80
+ }, slotProps?.pieArc));
74
81
  }), data.map((item, index) => {
75
- return /*#__PURE__*/_createElement(PieArcLabel, _extends({}, item, {
82
+ return /*#__PURE__*/_createElement(ArcLabel, _extends({}, item, {
76
83
  key: item.id,
77
84
  innerRadius: innerRadius,
78
85
  outerRadius: outerRadius ?? availableRadius,
@@ -82,10 +89,27 @@ export function PiePlot() {
82
89
  dataIndex: index,
83
90
  highlightScope: series[seriesId].highlightScope,
84
91
  formattedArcLabel: getItemLabel(arcLabel, arcLabelMinAngle, item)
85
- }));
92
+ }, slotProps?.pieArcLabel));
86
93
  })]
87
94
  })
88
95
  }, seriesId);
89
96
  })
90
97
  });
91
- }
98
+ }
99
+ process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
100
+ // ----------------------------- Warning --------------------------------
101
+ // | These PropTypes are generated from the TypeScript type definitions |
102
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
103
+ // ----------------------------------------------------------------------
104
+ /**
105
+ * The props used for each component slot.
106
+ * @default {}
107
+ */
108
+ slotProps: PropTypes.object,
109
+ /**
110
+ * Overridable component slots.
111
+ * @default {}
112
+ */
113
+ slots: PropTypes.object
114
+ } : void 0;
115
+ export { PiePlot };
@@ -26,7 +26,9 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
26
26
  leftAxis,
27
27
  rightAxis,
28
28
  bottomAxis,
29
- children
29
+ children,
30
+ slots,
31
+ slotProps
30
32
  } = props;
31
33
  return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
32
34
  ref: ref,
@@ -44,8 +46,16 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
44
46
  topAxis: topAxis,
45
47
  leftAxis: leftAxis,
46
48
  rightAxis: rightAxis,
47
- bottomAxis: bottomAxis
48
- }), /*#__PURE__*/_jsx(ScatterPlot, {}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({
49
+ bottomAxis: bottomAxis,
50
+ slots: slots,
51
+ slotProps: slotProps
52
+ }), /*#__PURE__*/_jsx(ScatterPlot, {
53
+ slots: slots,
54
+ slotProps: slotProps
55
+ }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
56
+ slots: slots,
57
+ slotProps: slotProps
58
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({
49
59
  x: "none",
50
60
  y: "none"
51
61
  }, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({
@@ -76,8 +86,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
76
86
  label: PropTypes.string,
77
87
  labelFontSize: PropTypes.number,
78
88
  position: PropTypes.oneOf(['bottom', 'top']),
89
+ slotProps: PropTypes.object,
90
+ slots: PropTypes.object,
79
91
  stroke: PropTypes.string,
80
92
  tickFontSize: PropTypes.number,
93
+ tickMaxStep: PropTypes.number,
94
+ tickMinStep: PropTypes.number,
95
+ tickNumber: PropTypes.number,
81
96
  tickSize: PropTypes.number
82
97
  }), PropTypes.string]),
83
98
  children: PropTypes.node,
@@ -104,8 +119,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
104
119
  label: PropTypes.string,
105
120
  labelFontSize: PropTypes.number,
106
121
  position: PropTypes.oneOf(['left', 'right']),
122
+ slotProps: PropTypes.object,
123
+ slots: PropTypes.object,
107
124
  stroke: PropTypes.string,
108
125
  tickFontSize: PropTypes.number,
126
+ tickMaxStep: PropTypes.number,
127
+ tickMinStep: PropTypes.number,
128
+ tickNumber: PropTypes.number,
109
129
  tickSize: PropTypes.number
110
130
  }), PropTypes.string]),
111
131
  legend: PropTypes.shape({
@@ -122,6 +142,8 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
122
142
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
123
143
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
124
144
  }),
145
+ slotProps: PropTypes.object,
146
+ slots: PropTypes.object,
125
147
  spacing: PropTypes.number
126
148
  }),
127
149
  margin: PropTypes.shape({
@@ -144,8 +166,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
144
166
  label: PropTypes.string,
145
167
  labelFontSize: PropTypes.number,
146
168
  position: PropTypes.oneOf(['left', 'right']),
169
+ slotProps: PropTypes.object,
170
+ slots: PropTypes.object,
147
171
  stroke: PropTypes.string,
148
172
  tickFontSize: PropTypes.number,
173
+ tickMaxStep: PropTypes.number,
174
+ tickMinStep: PropTypes.number,
175
+ tickNumber: PropTypes.number,
149
176
  tickSize: PropTypes.number
150
177
  }), PropTypes.string]),
151
178
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -167,6 +194,16 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
167
194
  xAxisKey: PropTypes.string,
168
195
  yAxisKey: PropTypes.string
169
196
  })).isRequired,
197
+ /**
198
+ * The props used for each component slot.
199
+ * @default {}
200
+ */
201
+ slotProps: PropTypes.object,
202
+ /**
203
+ * Overridable component slots.
204
+ * @default {}
205
+ */
206
+ slots: PropTypes.object,
170
207
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
171
208
  title: PropTypes.string,
172
209
  tooltip: PropTypes.shape({
@@ -189,8 +226,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
189
226
  label: PropTypes.string,
190
227
  labelFontSize: PropTypes.number,
191
228
  position: PropTypes.oneOf(['bottom', 'top']),
229
+ slotProps: PropTypes.object,
230
+ slots: PropTypes.object,
192
231
  stroke: PropTypes.string,
193
232
  tickFontSize: PropTypes.number,
233
+ tickMaxStep: PropTypes.number,
234
+ tickMinStep: PropTypes.number,
235
+ tickNumber: PropTypes.number,
194
236
  tickSize: PropTypes.number
195
237
  }), PropTypes.string]),
196
238
  viewBox: PropTypes.shape({
@@ -213,15 +255,17 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
213
255
  label: PropTypes.string,
214
256
  labelFontSize: PropTypes.number,
215
257
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
216
- maxTicks: PropTypes.number,
217
258
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
218
- minTicks: PropTypes.number,
219
259
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
220
260
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
261
+ slotProps: PropTypes.object,
262
+ slots: PropTypes.object,
221
263
  stroke: PropTypes.string,
222
264
  tickFontSize: PropTypes.number,
265
+ tickMaxStep: PropTypes.number,
266
+ tickMinStep: PropTypes.number,
267
+ tickNumber: PropTypes.number,
223
268
  tickSize: PropTypes.number,
224
- tickSpacing: PropTypes.number,
225
269
  valueFormatter: PropTypes.func
226
270
  })),
227
271
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -237,15 +281,17 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
237
281
  label: PropTypes.string,
238
282
  labelFontSize: PropTypes.number,
239
283
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
240
- maxTicks: PropTypes.number,
241
284
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
242
- minTicks: PropTypes.number,
243
285
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
244
286
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
287
+ slotProps: PropTypes.object,
288
+ slots: PropTypes.object,
245
289
  stroke: PropTypes.string,
246
290
  tickFontSize: PropTypes.number,
291
+ tickMaxStep: PropTypes.number,
292
+ tickMinStep: PropTypes.number,
293
+ tickNumber: PropTypes.number,
247
294
  tickSize: PropTypes.number,
248
- tickSpacing: PropTypes.number,
249
295
  valueFormatter: PropTypes.func
250
296
  }))
251
297
  } : void 0;
@@ -1,9 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
2
4
  import { Scatter } from './Scatter';
3
5
  import { SeriesContext } from '../context/SeriesContextProvider';
4
6
  import { CartesianContext } from '../context/CartesianContextProvider';
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
- export function ScatterPlot() {
8
+ function ScatterPlot(props) {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = props;
7
13
  const seriesData = React.useContext(SeriesContext).scatter;
8
14
  const axisData = React.useContext(CartesianContext);
9
15
  if (seriesData === undefined) {
@@ -21,6 +27,7 @@ export function ScatterPlot() {
21
27
  } = axisData;
22
28
  const defaultXAxisId = xAxisIds[0];
23
29
  const defaultYAxisId = yAxisIds[0];
30
+ const ScatterItems = slots?.scatter ?? Scatter;
24
31
  return /*#__PURE__*/_jsx(React.Fragment, {
25
32
  children: seriesOrder.map(seriesId => {
26
33
  const {
@@ -32,13 +39,30 @@ export function ScatterPlot() {
32
39
  } = series[seriesId];
33
40
  const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
34
41
  const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
35
- return /*#__PURE__*/_jsx(Scatter, {
42
+ return /*#__PURE__*/_jsx(ScatterItems, _extends({
36
43
  xScale: xScale,
37
44
  yScale: yScale,
38
45
  color: color,
39
46
  markerSize: markerSize ?? 4,
40
47
  series: series[seriesId]
41
- }, id);
48
+ }, slotProps?.scatter), id);
42
49
  })
43
50
  });
44
- }
51
+ }
52
+ process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
53
+ // ----------------------------- Warning --------------------------------
54
+ // | These PropTypes are generated from the TypeScript type definitions |
55
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
56
+ // ----------------------------------------------------------------------
57
+ /**
58
+ * The props used for each component slot.
59
+ * @default {}
60
+ */
61
+ slotProps: PropTypes.object,
62
+ /**
63
+ * Overridable component slots.
64
+ * @default {}
65
+ */
66
+ slots: PropTypes.object
67
+ } : void 0;
68
+ export { ScatterPlot };