@mui/x-charts 6.0.0-alpha.5 → 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 (163) hide show
  1. package/BarChart/BarChart.d.ts +18 -2
  2. package/BarChart/BarChart.js +74 -17
  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/BarChart/formatter.js +23 -12
  8. package/CHANGELOG.md +154 -0
  9. package/ChartContainer/index.js +3 -0
  10. package/ChartsAxis/ChartsAxis.d.ts +11 -1
  11. package/ChartsAxis/ChartsAxis.js +51 -6
  12. package/ChartsLegend/ChartsLegend.d.ts +25 -2
  13. package/ChartsLegend/ChartsLegend.js +49 -17
  14. package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  15. package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
  16. package/ChartsXAxis/ChartsXAxis.js +44 -9
  17. package/ChartsYAxis/ChartsYAxis.js +44 -9
  18. package/LineChart/AreaElement.d.ts +22 -0
  19. package/LineChart/AreaElement.js +31 -11
  20. package/LineChart/AreaPlot.d.ts +14 -1
  21. package/LineChart/AreaPlot.js +32 -5
  22. package/LineChart/LineChart.d.ts +20 -2
  23. package/LineChart/LineChart.js +76 -16
  24. package/LineChart/LineElement.d.ts +22 -0
  25. package/LineChart/LineElement.js +31 -10
  26. package/LineChart/LinePlot.d.ts +14 -1
  27. package/LineChart/LinePlot.js +38 -6
  28. package/LineChart/MarkElement.js +1 -1
  29. package/LineChart/MarkPlot.d.ts +24 -1
  30. package/LineChart/MarkPlot.js +30 -6
  31. package/LineChart/formatter.js +23 -12
  32. package/PieChart/PieArcLabel.js +0 -1
  33. package/PieChart/PieChart.d.ts +14 -2
  34. package/PieChart/PieChart.js +60 -13
  35. package/PieChart/PiePlot.d.ts +27 -1
  36. package/PieChart/PiePlot.js +29 -6
  37. package/ScatterChart/ScatterChart.d.ts +18 -2
  38. package/ScatterChart/ScatterChart.js +64 -13
  39. package/ScatterChart/ScatterPlot.d.ts +24 -1
  40. package/ScatterChart/ScatterPlot.js +28 -4
  41. package/SparkLineChart/SparkLineChart.d.ts +73 -0
  42. package/SparkLineChart/SparkLineChart.js +218 -0
  43. package/SparkLineChart/index.d.ts +1 -0
  44. package/SparkLineChart/index.js +12 -0
  45. package/SparkLineChart/package.json +6 -0
  46. package/colorPalettes/colorPalettes.js +2 -2
  47. package/context/CartesianContextProvider.d.ts +3 -1
  48. package/context/CartesianContextProvider.js +50 -14
  49. package/context/SeriesContextProvider.d.ts +3 -2
  50. package/context/SeriesContextProvider.js +5 -3
  51. package/esm/BarChart/BarChart.js +77 -17
  52. package/esm/BarChart/BarElement.js +21 -11
  53. package/esm/BarChart/BarPlot.js +23 -4
  54. package/esm/BarChart/formatter.js +23 -12
  55. package/esm/ChartContainer/index.js +3 -0
  56. package/esm/ChartsAxis/ChartsAxis.js +51 -6
  57. package/esm/ChartsLegend/ChartsLegend.js +47 -14
  58. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  59. package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
  60. package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
  61. package/esm/LineChart/AreaElement.js +31 -11
  62. package/esm/LineChart/AreaPlot.js +33 -5
  63. package/esm/LineChart/LineChart.js +79 -16
  64. package/esm/LineChart/LineElement.js +31 -11
  65. package/esm/LineChart/LinePlot.js +45 -9
  66. package/esm/LineChart/MarkElement.js +1 -1
  67. package/esm/LineChart/MarkPlot.js +31 -6
  68. package/esm/LineChart/formatter.js +23 -13
  69. package/esm/PieChart/PieArcLabel.js +0 -1
  70. package/esm/PieChart/PieChart.js +60 -13
  71. package/esm/PieChart/PiePlot.js +31 -6
  72. package/esm/ScatterChart/ScatterChart.js +64 -13
  73. package/esm/ScatterChart/ScatterPlot.js +29 -4
  74. package/esm/SparkLineChart/SparkLineChart.js +210 -0
  75. package/esm/SparkLineChart/index.js +1 -0
  76. package/esm/colorPalettes/colorPalettes.js +2 -2
  77. package/esm/context/CartesianContextProvider.js +50 -14
  78. package/esm/context/SeriesContextProvider.js +5 -3
  79. package/esm/hooks/useTicks.js +9 -6
  80. package/esm/index.js +1 -0
  81. package/esm/internals/components/AxisSharedComponents.js +10 -10
  82. package/esm/models/index.js +3 -1
  83. package/hooks/useTicks.d.ts +20 -5
  84. package/hooks/useTicks.js +9 -6
  85. package/index.d.ts +1 -0
  86. package/index.js +12 -1
  87. package/internals/components/AxisSharedComponents.d.ts +4 -4
  88. package/internals/components/AxisSharedComponents.js +15 -15
  89. package/internals/defaultizeColor.d.ts +4 -2
  90. package/legacy/BarChart/BarChart.js +75 -17
  91. package/legacy/BarChart/BarElement.js +20 -10
  92. package/legacy/BarChart/BarPlot.js +23 -4
  93. package/legacy/BarChart/formatter.js +23 -10
  94. package/legacy/ChartContainer/index.js +3 -0
  95. package/legacy/ChartsAxis/ChartsAxis.js +51 -6
  96. package/legacy/ChartsLegend/ChartsLegend.js +46 -15
  97. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  98. package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
  99. package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
  100. package/legacy/LineChart/AreaElement.js +30 -10
  101. package/legacy/LineChart/AreaPlot.js +31 -5
  102. package/legacy/LineChart/LineChart.js +77 -16
  103. package/legacy/LineChart/LineElement.js +30 -10
  104. package/legacy/LineChart/LinePlot.js +38 -6
  105. package/legacy/LineChart/MarkElement.js +1 -1
  106. package/legacy/LineChart/MarkPlot.js +29 -6
  107. package/legacy/LineChart/formatter.js +23 -11
  108. package/legacy/PieChart/PieArcLabel.js +0 -1
  109. package/legacy/PieChart/PieChart.js +60 -13
  110. package/legacy/PieChart/PiePlot.js +29 -6
  111. package/legacy/ScatterChart/ScatterChart.js +64 -13
  112. package/legacy/ScatterChart/ScatterPlot.js +27 -4
  113. package/legacy/SparkLineChart/SparkLineChart.js +214 -0
  114. package/legacy/SparkLineChart/index.js +1 -0
  115. package/legacy/colorPalettes/colorPalettes.js +2 -2
  116. package/legacy/context/CartesianContextProvider.js +59 -15
  117. package/legacy/context/SeriesContextProvider.js +6 -4
  118. package/legacy/hooks/useTicks.js +9 -9
  119. package/legacy/index.js +2 -1
  120. package/legacy/internals/components/AxisSharedComponents.js +10 -10
  121. package/legacy/models/index.js +3 -1
  122. package/models/axis.d.ts +34 -3
  123. package/models/index.d.ts +2 -0
  124. package/models/index.js +11 -0
  125. package/models/seriesType/bar.d.ts +8 -1
  126. package/models/seriesType/common.d.ts +2 -2
  127. package/models/seriesType/config.d.ts +4 -1
  128. package/models/seriesType/line.d.ts +8 -1
  129. package/modern/BarChart/BarChart.js +74 -17
  130. package/modern/BarChart/BarElement.js +20 -11
  131. package/modern/BarChart/BarPlot.js +23 -4
  132. package/modern/BarChart/formatter.js +23 -12
  133. package/modern/ChartContainer/index.js +3 -0
  134. package/modern/ChartsAxis/ChartsAxis.js +51 -6
  135. package/modern/ChartsLegend/ChartsLegend.js +46 -14
  136. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  137. package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
  138. package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
  139. package/modern/LineChart/AreaElement.js +30 -11
  140. package/modern/LineChart/AreaPlot.js +33 -5
  141. package/modern/LineChart/LineChart.js +76 -16
  142. package/modern/LineChart/LineElement.js +30 -11
  143. package/modern/LineChart/LinePlot.js +39 -6
  144. package/modern/LineChart/MarkElement.js +1 -1
  145. package/modern/LineChart/MarkPlot.js +30 -6
  146. package/modern/LineChart/formatter.js +23 -13
  147. package/modern/PieChart/PieArcLabel.js +0 -1
  148. package/modern/PieChart/PieChart.js +60 -13
  149. package/modern/PieChart/PiePlot.js +30 -6
  150. package/modern/ScatterChart/ScatterChart.js +64 -13
  151. package/modern/ScatterChart/ScatterPlot.js +28 -4
  152. package/modern/SparkLineChart/SparkLineChart.js +210 -0
  153. package/modern/SparkLineChart/index.js +1 -0
  154. package/modern/colorPalettes/colorPalettes.js +2 -2
  155. package/modern/context/CartesianContextProvider.js +50 -14
  156. package/modern/context/SeriesContextProvider.js +5 -3
  157. package/modern/hooks/useTicks.js +9 -6
  158. package/modern/index.js +2 -1
  159. package/modern/internals/components/AxisSharedComponents.js +10 -10
  160. package/modern/models/index.js +3 -1
  161. package/package.json +4 -2
  162. package/themeAugmentation/components.d.ts +0 -10
  163. package/themeAugmentation/overrides.d.ts +0 -2
@@ -1,4 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["slots", "slotProps"];
1
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
2
6
  import { line as d3Line } from 'd3-shape';
3
7
  import { SeriesContext } from '../context/SeriesContextProvider';
4
8
  import { CartesianContext } from '../context/CartesianContextProvider';
@@ -6,7 +10,12 @@ import { LineElement } from './LineElement';
6
10
  import { getValueToPositionMapper } from '../hooks/useScale';
7
11
  import getCurveFactory from '../internals/getCurve';
8
12
  import { jsx as _jsx } from "react/jsx-runtime";
9
- export function LinePlot() {
13
+ function LinePlot(props) {
14
+ const {
15
+ slots,
16
+ slotProps
17
+ } = props,
18
+ other = _objectWithoutPropertiesLoose(props, _excluded);
10
19
  const seriesData = React.useContext(SeriesContext).line;
11
20
  const axisData = React.useContext(CartesianContext);
12
21
  if (seriesData === undefined) {
@@ -24,7 +33,7 @@ export function LinePlot() {
24
33
  } = axisData;
25
34
  const defaultXAxisId = xAxisIds[0];
26
35
  const defaultYAxisId = yAxisIds[0];
27
- return /*#__PURE__*/_jsx("g", {
36
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
28
37
  children: stackingGroups.flatMap(({
29
38
  ids: groupIds
30
39
  }) => {
@@ -41,18 +50,42 @@ export function LinePlot() {
41
50
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
42
51
  }
43
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
+ }
44
58
  const curve = getCurveFactory(series[seriesId].curve);
45
59
  const d3Data = xData?.map((x, index) => ({
46
60
  x,
47
- y: stackedData[index]
61
+ y: stackedData[index] ?? [0, 0]
48
62
  }));
49
63
  return /*#__PURE__*/_jsx(LineElement, {
50
64
  id: seriesId,
51
65
  d: linePath.curve(curve)(d3Data) || undefined,
52
66
  color: series[seriesId].color,
53
- highlightScope: series[seriesId].highlightScope
67
+ highlightScope: series[seriesId].highlightScope,
68
+ slots: slots,
69
+ slotProps: slotProps
54
70
  }, seriesId);
55
71
  });
56
72
  })
57
- });
58
- }
73
+ }));
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 };
@@ -38,7 +38,7 @@ const MarkElementPath = styled('path', {
38
38
  }) => ({
39
39
  transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
40
40
  transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
41
- fill: (theme.vars || theme).palette.background.paper,
41
+ fill: theme.palette.background.paper,
42
42
  stroke: ownerState.color,
43
43
  strokeWidth: 2,
44
44
  '&.MuiMarkElement-highlighted': {
@@ -1,12 +1,19 @@
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 { SeriesContext } from '../context/SeriesContextProvider';
3
5
  import { CartesianContext } from '../context/CartesianContextProvider';
4
6
  import { MarkElement } from './MarkElement';
5
7
  import { getValueToPositionMapper } from '../hooks/useScale';
6
8
  import { jsx as _jsx } from "react/jsx-runtime";
7
- export function MarkPlot() {
9
+ function MarkPlot(props) {
10
+ const {
11
+ slots,
12
+ slotProps
13
+ } = props;
8
14
  const seriesData = React.useContext(SeriesContext).line;
9
15
  const axisData = React.useContext(CartesianContext);
16
+ const Mark = slots?.mark ?? MarkElement;
10
17
  if (seriesData === undefined) {
11
18
  return null;
12
19
  }
@@ -22,7 +29,7 @@ export function MarkPlot() {
22
29
  } = axisData;
23
30
  const defaultXAxisId = xAxisIds[0];
24
31
  const defaultYAxisId = yAxisIds[0];
25
- return /*#__PURE__*/_jsx("g", {
32
+ return /*#__PURE__*/_jsx("g", _extends({}, props, {
26
33
  children: stackingGroups.flatMap(({
27
34
  ids: groupIds
28
35
  }) => {
@@ -63,7 +70,7 @@ export function MarkPlot() {
63
70
  x,
64
71
  y,
65
72
  index
66
- }) => /*#__PURE__*/_jsx(MarkElement, {
73
+ }) => /*#__PURE__*/_jsx(Mark, _extends({
67
74
  id: seriesId,
68
75
  dataIndex: index,
69
76
  shape: "circle",
@@ -71,8 +78,25 @@ export function MarkPlot() {
71
78
  x: x,
72
79
  y: y,
73
80
  highlightScope: series[seriesId].highlightScope
74
- }, `${seriesId}-${index}`));
81
+ }, slotProps?.mark), `${seriesId}-${index}`));
75
82
  });
76
83
  })
77
- });
78
- }
84
+ }));
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 };
@@ -2,9 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { stack as d3Stack } from 'd3-shape';
3
3
  import { getStackingGroups } from '../internals/stackSeries';
4
4
  import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
5
-
6
5
  // For now it's a copy past of bar charts formatter, but maybe will diverge later
7
- const formatter = params => {
6
+ const formatter = (params, dataset) => {
8
7
  const {
9
8
  seriesOrder,
10
9
  series
@@ -12,17 +11,22 @@ const formatter = params => {
12
11
  const stackingGroups = getStackingGroups(params);
13
12
 
14
13
  // Create a data set with format adapted to d3
15
- const d3Dataset = [];
14
+ const d3Dataset = dataset ?? [];
16
15
  seriesOrder.forEach(id => {
17
- series[id].data.forEach((value, index) => {
18
- if (d3Dataset.length <= index) {
19
- d3Dataset.push({
20
- [id]: value
21
- });
22
- } else {
23
- d3Dataset[index][id] = value;
24
- }
25
- });
16
+ const data = series[id].data;
17
+ if (data !== undefined) {
18
+ data.forEach((value, index) => {
19
+ if (d3Dataset.length <= index) {
20
+ d3Dataset.push({
21
+ [id]: value
22
+ });
23
+ } else {
24
+ d3Dataset[index][id] = value;
25
+ }
26
+ });
27
+ } else if (dataset === undefined) {
28
+ throw new Error([`MUI: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
29
+ }
26
30
  });
27
31
  const completedSeries = {};
28
32
  stackingGroups.forEach(stackingGroup => {
@@ -32,9 +36,15 @@ const formatter = params => {
32
36
  stackingOrder,
33
37
  stackingOffset
34
38
  } = stackingGroup;
35
- const stackedSeries = d3Stack().keys(ids).order(stackingOrder).offset(stackingOffset)(d3Dataset);
39
+ const stackedSeries = d3Stack().keys(ids.map(id => {
40
+ // Use dataKey if needed and available
41
+ const dataKey = series[id].dataKey;
42
+ return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
43
+ })).order(stackingOrder).offset(stackingOffset)(d3Dataset);
36
44
  ids.forEach((id, index) => {
45
+ const dataKey = series[id].dataKey;
37
46
  completedSeries[id] = _extends({}, series[id], {
47
+ data: dataKey ? dataset.map(d => d[dataKey]) : series[id].data,
38
48
  stackedData: stackedSeries[index].map(([a, b]) => [a, b])
39
49
  });
40
50
  });
@@ -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,
@@ -104,6 +119,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
104
119
  * Color palette used to colorize multiple series.
105
120
  */
106
121
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
122
+ dataset: PropTypes.arrayOf(PropTypes.object),
107
123
  desc: PropTypes.string,
108
124
  disableAxisListener: PropTypes.bool,
109
125
  height: PropTypes.number,
@@ -121,8 +137,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
121
137
  label: PropTypes.string,
122
138
  labelFontSize: PropTypes.number,
123
139
  position: PropTypes.oneOf(['left', 'right']),
140
+ slotProps: PropTypes.object,
141
+ slots: PropTypes.object,
124
142
  stroke: PropTypes.string,
125
143
  tickFontSize: PropTypes.number,
144
+ tickMaxStep: PropTypes.number,
145
+ tickMinStep: PropTypes.number,
146
+ tickNumber: PropTypes.number,
126
147
  tickSize: PropTypes.number
127
148
  }), PropTypes.string]),
128
149
  legend: PropTypes.shape({
@@ -139,6 +160,8 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
139
160
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
140
161
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
141
162
  }),
163
+ slotProps: PropTypes.object,
164
+ slots: PropTypes.object,
142
165
  spacing: PropTypes.number
143
166
  }),
144
167
  margin: PropTypes.shape({
@@ -161,8 +184,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
161
184
  label: PropTypes.string,
162
185
  labelFontSize: PropTypes.number,
163
186
  position: PropTypes.oneOf(['left', 'right']),
187
+ slotProps: PropTypes.object,
188
+ slots: PropTypes.object,
164
189
  stroke: PropTypes.string,
165
190
  tickFontSize: PropTypes.number,
191
+ tickMaxStep: PropTypes.number,
192
+ tickMinStep: PropTypes.number,
193
+ tickNumber: PropTypes.number,
166
194
  tickSize: PropTypes.number
167
195
  }), PropTypes.string]),
168
196
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -204,6 +232,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
204
232
  type: PropTypes.oneOf(['pie']),
205
233
  valueFormatter: PropTypes.func
206
234
  })).isRequired,
235
+ /**
236
+ * The props used for each component slot.
237
+ * @default {}
238
+ */
239
+ slotProps: PropTypes.object,
240
+ slots: PropTypes.object,
207
241
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
208
242
  title: PropTypes.string,
209
243
  tooltip: PropTypes.shape({
@@ -226,8 +260,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
226
260
  label: PropTypes.string,
227
261
  labelFontSize: PropTypes.number,
228
262
  position: PropTypes.oneOf(['bottom', 'top']),
263
+ slotProps: PropTypes.object,
264
+ slots: PropTypes.object,
229
265
  stroke: PropTypes.string,
230
266
  tickFontSize: PropTypes.number,
267
+ tickMaxStep: PropTypes.number,
268
+ tickMinStep: PropTypes.number,
269
+ tickNumber: PropTypes.number,
231
270
  tickSize: PropTypes.number
232
271
  }), PropTypes.string]),
233
272
  viewBox: PropTypes.shape({
@@ -241,44 +280,52 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
241
280
  axisId: PropTypes.string,
242
281
  classes: PropTypes.object,
243
282
  data: PropTypes.array,
283
+ dataKey: PropTypes.string,
244
284
  disableLine: PropTypes.bool,
245
285
  disableTicks: PropTypes.bool,
246
286
  fill: PropTypes.string,
287
+ hideTooltip: PropTypes.bool,
247
288
  id: PropTypes.string,
248
289
  label: PropTypes.string,
249
290
  labelFontSize: PropTypes.number,
250
- max: PropTypes.number,
251
- maxTicks: PropTypes.number,
252
- min: PropTypes.number,
253
- minTicks: PropTypes.number,
291
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
292
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
254
293
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
255
294
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
295
+ slotProps: PropTypes.object,
296
+ slots: PropTypes.object,
256
297
  stroke: PropTypes.string,
257
298
  tickFontSize: PropTypes.number,
299
+ tickMaxStep: PropTypes.number,
300
+ tickMinStep: PropTypes.number,
301
+ tickNumber: PropTypes.number,
258
302
  tickSize: PropTypes.number,
259
- tickSpacing: PropTypes.number,
260
303
  valueFormatter: PropTypes.func
261
304
  })),
262
305
  yAxis: PropTypes.arrayOf(PropTypes.shape({
263
306
  axisId: PropTypes.string,
264
307
  classes: PropTypes.object,
265
308
  data: PropTypes.array,
309
+ dataKey: PropTypes.string,
266
310
  disableLine: PropTypes.bool,
267
311
  disableTicks: PropTypes.bool,
268
312
  fill: PropTypes.string,
313
+ hideTooltip: PropTypes.bool,
269
314
  id: PropTypes.string,
270
315
  label: PropTypes.string,
271
316
  labelFontSize: PropTypes.number,
272
- max: PropTypes.number,
273
- maxTicks: PropTypes.number,
274
- min: PropTypes.number,
275
- minTicks: PropTypes.number,
317
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
318
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
276
319
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
277
320
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
321
+ slotProps: PropTypes.object,
322
+ slots: PropTypes.object,
278
323
  stroke: PropTypes.string,
279
324
  tickFontSize: PropTypes.number,
325
+ tickMaxStep: PropTypes.number,
326
+ tickMinStep: PropTypes.number,
327
+ tickNumber: PropTypes.number,
280
328
  tickSize: PropTypes.number,
281
- tickSpacing: PropTypes.number,
282
329
  valueFormatter: PropTypes.func
283
330
  }))
284
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,
@@ -86,6 +101,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
86
101
  * Color palette used to colorize multiple series.
87
102
  */
88
103
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
104
+ dataset: PropTypes.arrayOf(PropTypes.object),
89
105
  desc: PropTypes.string,
90
106
  disableAxisListener: PropTypes.bool,
91
107
  height: PropTypes.number,
@@ -103,8 +119,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
103
119
  label: PropTypes.string,
104
120
  labelFontSize: PropTypes.number,
105
121
  position: PropTypes.oneOf(['left', 'right']),
122
+ slotProps: PropTypes.object,
123
+ slots: PropTypes.object,
106
124
  stroke: PropTypes.string,
107
125
  tickFontSize: PropTypes.number,
126
+ tickMaxStep: PropTypes.number,
127
+ tickMinStep: PropTypes.number,
128
+ tickNumber: PropTypes.number,
108
129
  tickSize: PropTypes.number
109
130
  }), PropTypes.string]),
110
131
  legend: PropTypes.shape({
@@ -121,6 +142,8 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
121
142
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
122
143
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
123
144
  }),
145
+ slotProps: PropTypes.object,
146
+ slots: PropTypes.object,
124
147
  spacing: PropTypes.number
125
148
  }),
126
149
  margin: PropTypes.shape({
@@ -143,8 +166,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
143
166
  label: PropTypes.string,
144
167
  labelFontSize: PropTypes.number,
145
168
  position: PropTypes.oneOf(['left', 'right']),
169
+ slotProps: PropTypes.object,
170
+ slots: PropTypes.object,
146
171
  stroke: PropTypes.string,
147
172
  tickFontSize: PropTypes.number,
173
+ tickMaxStep: PropTypes.number,
174
+ tickMinStep: PropTypes.number,
175
+ tickNumber: PropTypes.number,
148
176
  tickSize: PropTypes.number
149
177
  }), PropTypes.string]),
150
178
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -166,6 +194,16 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
166
194
  xAxisKey: PropTypes.string,
167
195
  yAxisKey: PropTypes.string
168
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,
169
207
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
170
208
  title: PropTypes.string,
171
209
  tooltip: PropTypes.shape({
@@ -188,8 +226,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
188
226
  label: PropTypes.string,
189
227
  labelFontSize: PropTypes.number,
190
228
  position: PropTypes.oneOf(['bottom', 'top']),
229
+ slotProps: PropTypes.object,
230
+ slots: PropTypes.object,
191
231
  stroke: PropTypes.string,
192
232
  tickFontSize: PropTypes.number,
233
+ tickMaxStep: PropTypes.number,
234
+ tickMinStep: PropTypes.number,
235
+ tickNumber: PropTypes.number,
193
236
  tickSize: PropTypes.number
194
237
  }), PropTypes.string]),
195
238
  viewBox: PropTypes.shape({
@@ -203,44 +246,52 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
203
246
  axisId: PropTypes.string,
204
247
  classes: PropTypes.object,
205
248
  data: PropTypes.array,
249
+ dataKey: PropTypes.string,
206
250
  disableLine: PropTypes.bool,
207
251
  disableTicks: PropTypes.bool,
208
252
  fill: PropTypes.string,
253
+ hideTooltip: PropTypes.bool,
209
254
  id: PropTypes.string,
210
255
  label: PropTypes.string,
211
256
  labelFontSize: PropTypes.number,
212
- max: PropTypes.number,
213
- maxTicks: PropTypes.number,
214
- min: PropTypes.number,
215
- minTicks: PropTypes.number,
257
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
258
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
216
259
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
217
260
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
261
+ slotProps: PropTypes.object,
262
+ slots: PropTypes.object,
218
263
  stroke: PropTypes.string,
219
264
  tickFontSize: PropTypes.number,
265
+ tickMaxStep: PropTypes.number,
266
+ tickMinStep: PropTypes.number,
267
+ tickNumber: PropTypes.number,
220
268
  tickSize: PropTypes.number,
221
- tickSpacing: PropTypes.number,
222
269
  valueFormatter: PropTypes.func
223
270
  })),
224
271
  yAxis: PropTypes.arrayOf(PropTypes.shape({
225
272
  axisId: PropTypes.string,
226
273
  classes: PropTypes.object,
227
274
  data: PropTypes.array,
275
+ dataKey: PropTypes.string,
228
276
  disableLine: PropTypes.bool,
229
277
  disableTicks: PropTypes.bool,
230
278
  fill: PropTypes.string,
279
+ hideTooltip: PropTypes.bool,
231
280
  id: PropTypes.string,
232
281
  label: PropTypes.string,
233
282
  labelFontSize: PropTypes.number,
234
- max: PropTypes.number,
235
- maxTicks: PropTypes.number,
236
- min: PropTypes.number,
237
- minTicks: PropTypes.number,
283
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
284
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
238
285
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
239
286
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
287
+ slotProps: PropTypes.object,
288
+ slots: PropTypes.object,
240
289
  stroke: PropTypes.string,
241
290
  tickFontSize: PropTypes.number,
291
+ tickMaxStep: PropTypes.number,
292
+ tickMinStep: PropTypes.number,
293
+ tickNumber: PropTypes.number,
242
294
  tickSize: PropTypes.number,
243
- tickSpacing: PropTypes.number,
244
295
  valueFormatter: PropTypes.func
245
296
  }))
246
297
  } : void 0;