@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
@@ -8,7 +8,7 @@ import { useThemeProps, useTheme } from '@mui/material/styles';
8
8
  import { CartesianContext } from '../context/CartesianContextProvider';
9
9
  import { DrawingContext } from '../context/DrawingProvider';
10
10
  import useTicks from '../hooks/useTicks';
11
- import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
11
+ import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
12
12
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -36,6 +36,7 @@ const defaultProps = {
36
36
  tickSize: 6
37
37
  };
38
38
  function ChartsYAxis(inProps) {
39
+ var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
39
40
  const props = useThemeProps({
40
41
  props: _extends({}, defaultProps, inProps),
41
42
  name: 'MuiChartsYAxis'
@@ -60,7 +61,9 @@ function ChartsYAxis(inProps) {
60
61
  label,
61
62
  labelFontSize,
62
63
  tickSize: tickSizeProp,
63
- valueFormatter
64
+ valueFormatter,
65
+ slots,
66
+ slotProps
64
67
  } = defaultizedProps;
65
68
  const theme = useTheme();
66
69
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -83,14 +86,18 @@ function ChartsYAxis(inProps) {
83
86
  x: positionSigne * (tickFontSize + tickSize + 10),
84
87
  y: top + height / 2
85
88
  };
89
+ const Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
90
+ const Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
91
+ const TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
92
+ const Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
86
93
  return /*#__PURE__*/_jsxs(AxisRoot, {
87
94
  transform: `translate(${position === 'right' ? left + width : left}, 0)`,
88
95
  className: classes.root,
89
- children: [!disableLine && /*#__PURE__*/_jsx(Line, {
96
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
90
97
  y1: yScale.range()[0],
91
98
  y2: yScale.range()[1],
92
99
  className: classes.line
93
- }), yTicks.map(({
100
+ }, slotProps == null ? void 0 : slotProps.axisLine)), yTicks.map(({
94
101
  formattedValue,
95
102
  offset,
96
103
  labelOffset
@@ -100,19 +107,20 @@ function ChartsYAxis(inProps) {
100
107
  return /*#__PURE__*/_jsxs("g", {
101
108
  transform: `translate(0, ${offset})`,
102
109
  className: classes.tickContainer,
103
- children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
110
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
104
111
  x2: positionSigne * tickSize,
105
112
  className: classes.tick
106
- }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
113
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
107
114
  x: xTickLabel,
108
115
  y: yTickLabel,
109
116
  "transform-origin": `${xTickLabel}px ${yTickLabel}px`,
110
117
  sx: {
111
118
  fontSize: tickFontSize
112
119
  },
113
- className: classes.tickLabel,
120
+ className: classes.tickLabel
121
+ }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
114
122
  children: formattedValue.toLocaleString()
115
- })]
123
+ }))]
116
124
  }, index);
117
125
  }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
118
126
  sx: {
@@ -120,7 +128,8 @@ function ChartsYAxis(inProps) {
120
128
  transform: `rotate(${positionSigne * 90}deg)`,
121
129
  transformOrigin: `${labelRefPoint.x}px ${labelRefPoint.y}px`
122
130
  },
123
- className: classes.label,
131
+ className: classes.label
132
+ }, slotProps == null ? void 0 : slotProps.axisLabel, {
124
133
  children: label
125
134
  }))]
126
135
  });
@@ -166,6 +175,16 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
166
175
  * Position of the axis.
167
176
  */
168
177
  position: PropTypes.oneOf(['left', 'right']),
178
+ /**
179
+ * The props used for each component slot.
180
+ * @default {}
181
+ */
182
+ slotProps: PropTypes.object,
183
+ /**
184
+ * Overridable component slots.
185
+ * @default {}
186
+ */
187
+ slots: PropTypes.object,
169
188
  /**
170
189
  * The stroke color of the axis line.
171
190
  * @default 'currentColor'
@@ -176,6 +195,23 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
176
195
  * @default 12
177
196
  */
178
197
  tickFontSize: PropTypes.number,
198
+ /**
199
+ * Maximal step between two ticks.
200
+ * When using time data, the value is assumed to be in ms.
201
+ * Not supported by categorical axis (band, points).
202
+ */
203
+ tickMaxStep: PropTypes.number,
204
+ /**
205
+ * Maximal step between two ticks.
206
+ * When using time data, the value is assumed to be in ms.
207
+ * Not supported by categorical axis (band, points).
208
+ */
209
+ tickMinStep: PropTypes.number,
210
+ /**
211
+ * The number of ticks. This number is not guaranted.
212
+ * Not supported by categorical axis (band, points).
213
+ */
214
+ tickNumber: PropTypes.number,
179
215
  /**
180
216
  * The size of the ticks.
181
217
  * @default 6
@@ -1,9 +1,10 @@
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 composeClasses from '@mui/utils/composeClasses';
7
+ import { useSlotProps } from '@mui/base/utils';
7
8
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
9
  import { styled } from '@mui/material/styles';
9
10
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
@@ -27,7 +28,7 @@ const useUtilityClasses = ownerState => {
27
28
  };
28
29
  return composeClasses(slots, getAreaElementUtilityClass, classes);
29
30
  };
30
- const AreaElementPath = styled('path', {
31
+ export const AreaElementPath = styled('path', {
31
32
  name: 'MuiAreaElement',
32
33
  slot: 'Root',
33
34
  overridesResolver: (_, styles) => styles.root
@@ -55,11 +56,14 @@ AreaElementPath.propTypes = {
55
56
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
56
57
  };
57
58
  function AreaElement(props) {
59
+ var _slots$area;
58
60
  const {
59
61
  id,
60
62
  classes: innerClasses,
61
63
  color,
62
- highlightScope
64
+ highlightScope,
65
+ slots,
66
+ slotProps
63
67
  } = props,
64
68
  other = _objectWithoutPropertiesLoose(props, _excluded);
65
69
  const getInteractionItemProps = useInteractionItemProps(highlightScope);
@@ -82,13 +86,19 @@ function AreaElement(props) {
82
86
  isHighlighted
83
87
  };
84
88
  const classes = useUtilityClasses(ownerState);
85
- return /*#__PURE__*/_jsx(AreaElementPath, _extends({}, other, {
86
- ownerState: ownerState,
87
- className: classes.root
88
- }, getInteractionItemProps({
89
- type: 'line',
90
- seriesId: id
91
- })));
89
+ const Area = (_slots$area = slots == null ? void 0 : slots.area) != null ? _slots$area : AreaElementPath;
90
+ const areaProps = useSlotProps({
91
+ elementType: Area,
92
+ externalSlotProps: slotProps == null ? void 0 : slotProps.area,
93
+ additionalProps: _extends({}, other, getInteractionItemProps({
94
+ type: 'line',
95
+ seriesId: id
96
+ }), {
97
+ className: classes.root
98
+ }),
99
+ ownerState
100
+ });
101
+ return /*#__PURE__*/_jsx(Area, _extends({}, areaProps));
92
102
  }
93
103
  process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
94
104
  // ----------------------------- Warning --------------------------------
@@ -99,6 +109,16 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
99
109
  highlightScope: PropTypes.shape({
100
110
  faded: PropTypes.oneOf(['global', 'none', 'series']),
101
111
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
102
- })
112
+ }),
113
+ /**
114
+ * The props used for each component slot.
115
+ * @default {}
116
+ */
117
+ slotProps: PropTypes.object,
118
+ /**
119
+ * Overridable component slots.
120
+ * @default {}
121
+ */
122
+ slots: PropTypes.object
103
123
  } : void 0;
104
124
  export { AreaElement };
@@ -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 { area as d3Area } from 'd3-shape';
4
7
  import { SeriesContext } from '../context/SeriesContextProvider';
5
8
  import { CartesianContext } from '../context/CartesianContextProvider';
@@ -7,7 +10,12 @@ import { AreaElement } from './AreaElement';
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 AreaPlot(props) {
13
+ function AreaPlot(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 AreaPlot(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
  }) => {
@@ -51,9 +59,28 @@ export function AreaPlot(props) {
51
59
  id: seriesId,
52
60
  d: areaPath.curve(curve)(d3Data) || undefined,
53
61
  color: series[seriesId].color,
54
- highlightScope: series[seriesId].highlightScope
62
+ highlightScope: series[seriesId].highlightScope,
63
+ slots: slots,
64
+ slotProps: slotProps
55
65
  }, seriesId);
56
66
  });
57
67
  })
58
68
  }));
59
- }
69
+ }
70
+ process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
71
+ // ----------------------------- Warning --------------------------------
72
+ // | These PropTypes are generated from the TypeScript type definitions |
73
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
74
+ // ----------------------------------------------------------------------
75
+ /**
76
+ * The props used for each component slot.
77
+ * @default {}
78
+ */
79
+ slotProps: PropTypes.object,
80
+ /**
81
+ * Overridable component slots.
82
+ * @default {}
83
+ */
84
+ slots: PropTypes.object
85
+ } : void 0;
86
+ export { AreaPlot };
@@ -34,7 +34,9 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
34
34
  leftAxis,
35
35
  rightAxis,
36
36
  bottomAxis,
37
- children
37
+ children,
38
+ slots,
39
+ slotProps
38
40
  } = props;
39
41
  const id = useId();
40
42
  const clipPathId = `${id}-clip-path`;
@@ -63,13 +65,27 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
63
65
  disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
64
66
  children: [/*#__PURE__*/_jsxs("g", {
65
67
  clipPath: `url(#${clipPathId})`,
66
- children: [/*#__PURE__*/_jsx(AreaPlot, {}), /*#__PURE__*/_jsx(LinePlot, {})]
68
+ children: [/*#__PURE__*/_jsx(AreaPlot, {
69
+ slots: slots,
70
+ slotProps: slotProps
71
+ }), /*#__PURE__*/_jsx(LinePlot, {
72
+ slots: slots,
73
+ slotProps: slotProps
74
+ })]
67
75
  }), /*#__PURE__*/_jsx(ChartsAxis, {
68
76
  topAxis: topAxis,
69
77
  leftAxis: leftAxis,
70
78
  rightAxis: rightAxis,
71
- bottomAxis: bottomAxis
72
- }), /*#__PURE__*/_jsx(MarkPlot, {}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
79
+ bottomAxis: bottomAxis,
80
+ slots: slots,
81
+ slotProps: slotProps
82
+ }), /*#__PURE__*/_jsx(MarkPlot, {
83
+ slots: slots,
84
+ slotProps: slotProps
85
+ }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
86
+ slots: slots,
87
+ slotProps: slotProps
88
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
73
89
  id: clipPathId
74
90
  }), children]
75
91
  });
@@ -97,8 +113,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
97
113
  label: PropTypes.string,
98
114
  labelFontSize: PropTypes.number,
99
115
  position: PropTypes.oneOf(['bottom', 'top']),
116
+ slotProps: PropTypes.object,
117
+ slots: PropTypes.object,
100
118
  stroke: PropTypes.string,
101
119
  tickFontSize: PropTypes.number,
120
+ tickMaxStep: PropTypes.number,
121
+ tickMinStep: PropTypes.number,
122
+ tickNumber: PropTypes.number,
102
123
  tickSize: PropTypes.number
103
124
  }), PropTypes.string]),
104
125
  children: PropTypes.node,
@@ -125,8 +146,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
125
146
  label: PropTypes.string,
126
147
  labelFontSize: PropTypes.number,
127
148
  position: PropTypes.oneOf(['left', 'right']),
149
+ slotProps: PropTypes.object,
150
+ slots: PropTypes.object,
128
151
  stroke: PropTypes.string,
129
152
  tickFontSize: PropTypes.number,
153
+ tickMaxStep: PropTypes.number,
154
+ tickMinStep: PropTypes.number,
155
+ tickNumber: PropTypes.number,
130
156
  tickSize: PropTypes.number
131
157
  }), PropTypes.string]),
132
158
  legend: PropTypes.shape({
@@ -143,6 +169,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
143
169
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
144
170
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
145
171
  }),
172
+ slotProps: PropTypes.object,
173
+ slots: PropTypes.object,
146
174
  spacing: PropTypes.number
147
175
  }),
148
176
  margin: PropTypes.shape({
@@ -165,8 +193,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
165
193
  label: PropTypes.string,
166
194
  labelFontSize: PropTypes.number,
167
195
  position: PropTypes.oneOf(['left', 'right']),
196
+ slotProps: PropTypes.object,
197
+ slots: PropTypes.object,
168
198
  stroke: PropTypes.string,
169
199
  tickFontSize: PropTypes.number,
200
+ tickMaxStep: PropTypes.number,
201
+ tickMinStep: PropTypes.number,
202
+ tickNumber: PropTypes.number,
170
203
  tickSize: PropTypes.number
171
204
  }), PropTypes.string]),
172
205
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -189,6 +222,16 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
189
222
  xAxisKey: PropTypes.string,
190
223
  yAxisKey: PropTypes.string
191
224
  })).isRequired,
225
+ /**
226
+ * The props used for each component slot.
227
+ * @default {}
228
+ */
229
+ slotProps: PropTypes.object,
230
+ /**
231
+ * Overridable component slots.
232
+ * @default {}
233
+ */
234
+ slots: PropTypes.object,
192
235
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
193
236
  title: PropTypes.string,
194
237
  tooltip: PropTypes.shape({
@@ -211,8 +254,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
211
254
  label: PropTypes.string,
212
255
  labelFontSize: PropTypes.number,
213
256
  position: PropTypes.oneOf(['bottom', 'top']),
257
+ slotProps: PropTypes.object,
258
+ slots: PropTypes.object,
214
259
  stroke: PropTypes.string,
215
260
  tickFontSize: PropTypes.number,
261
+ tickMaxStep: PropTypes.number,
262
+ tickMinStep: PropTypes.number,
263
+ tickNumber: PropTypes.number,
216
264
  tickSize: PropTypes.number
217
265
  }), PropTypes.string]),
218
266
  viewBox: PropTypes.shape({
@@ -235,15 +283,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
235
283
  label: PropTypes.string,
236
284
  labelFontSize: PropTypes.number,
237
285
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
238
- maxTicks: PropTypes.number,
239
286
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
240
- minTicks: PropTypes.number,
241
287
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
242
288
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
289
+ slotProps: PropTypes.object,
290
+ slots: PropTypes.object,
243
291
  stroke: PropTypes.string,
244
292
  tickFontSize: PropTypes.number,
293
+ tickMaxStep: PropTypes.number,
294
+ tickMinStep: PropTypes.number,
295
+ tickNumber: PropTypes.number,
245
296
  tickSize: PropTypes.number,
246
- tickSpacing: PropTypes.number,
247
297
  valueFormatter: PropTypes.func
248
298
  })),
249
299
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -259,15 +309,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
259
309
  label: PropTypes.string,
260
310
  labelFontSize: PropTypes.number,
261
311
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
262
- maxTicks: PropTypes.number,
263
312
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
264
- minTicks: PropTypes.number,
265
313
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
266
314
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
315
+ slotProps: PropTypes.object,
316
+ slots: PropTypes.object,
267
317
  stroke: PropTypes.string,
268
318
  tickFontSize: PropTypes.number,
319
+ tickMaxStep: PropTypes.number,
320
+ tickMinStep: PropTypes.number,
321
+ tickNumber: PropTypes.number,
269
322
  tickSize: PropTypes.number,
270
- tickSpacing: PropTypes.number,
271
323
  valueFormatter: PropTypes.func
272
324
  }))
273
325
  } : void 0;
@@ -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
@@ -57,11 +58,14 @@ LineElementPath.propTypes = {
57
58
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
58
59
  };
59
60
  function LineElement(props) {
61
+ var _slots$line;
60
62
  const {
61
63
  id,
62
64
  classes: innerClasses,
63
65
  color,
64
- highlightScope
66
+ highlightScope,
67
+ slots,
68
+ slotProps
65
69
  } = props,
66
70
  other = _objectWithoutPropertiesLoose(props, _excluded);
67
71
  const getInteractionItemProps = useInteractionItemProps(highlightScope);
@@ -84,13 +88,19 @@ function LineElement(props) {
84
88
  isHighlighted
85
89
  };
86
90
  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
- })));
91
+ const Line = (_slots$line = slots == null ? void 0 : slots.line) != null ? _slots$line : LineElementPath;
92
+ const lineProps = useSlotProps({
93
+ elementType: Line,
94
+ externalSlotProps: slotProps == null ? void 0 : slotProps.line,
95
+ additionalProps: _extends({}, other, getInteractionItemProps({
96
+ type: 'line',
97
+ seriesId: id
98
+ }), {
99
+ className: classes.root
100
+ }),
101
+ ownerState
102
+ });
103
+ return /*#__PURE__*/_jsx(Line, _extends({}, lineProps));
94
104
  }
95
105
  process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
96
106
  // ----------------------------- Warning --------------------------------
@@ -101,6 +111,16 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
101
111
  highlightScope: PropTypes.shape({
102
112
  faded: PropTypes.oneOf(['global', 'none', 'series']),
103
113
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
104
- })
114
+ }),
115
+ /**
116
+ * The props used for each component slot.
117
+ * @default {}
118
+ */
119
+ slotProps: PropTypes.object,
120
+ /**
121
+ * Overridable component slots.
122
+ * @default {}
123
+ */
124
+ slots: PropTypes.object
105
125
  } : void 0;
106
126
  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,45 @@ 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
- const d3Data = xData == null ? void 0 : xData.map((x, index) => ({
47
- x,
48
- y: stackedData[index]
49
- }));
59
+ const d3Data = xData == null ? void 0 : xData.map((x, index) => {
60
+ var _stackedData$index;
61
+ return {
62
+ x,
63
+ y: (_stackedData$index = stackedData[index]) != null ? _stackedData$index : [0, 0]
64
+ };
65
+ });
50
66
  return /*#__PURE__*/_jsx(LineElement, {
51
67
  id: seriesId,
52
68
  d: linePath.curve(curve)(d3Data) || undefined,
53
69
  color: series[seriesId].color,
54
- highlightScope: series[seriesId].highlightScope
70
+ highlightScope: series[seriesId].highlightScope,
71
+ slots: slots,
72
+ slotProps: slotProps
55
73
  }, seriesId);
56
74
  });
57
75
  })
58
76
  }));
59
- }
77
+ }
78
+ process.env.NODE_ENV !== "production" ? LinePlot.propTypes = {
79
+ // ----------------------------- Warning --------------------------------
80
+ // | These PropTypes are generated from the TypeScript type definitions |
81
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
82
+ // ----------------------------------------------------------------------
83
+ /**
84
+ * The props used for each component slot.
85
+ * @default {}
86
+ */
87
+ slotProps: PropTypes.object,
88
+ /**
89
+ * Overridable component slots.
90
+ * @default {}
91
+ */
92
+ slots: PropTypes.object
93
+ } : void 0;
94
+ export { LinePlot };
@@ -1,13 +1,20 @@
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
+ var _slots$mark;
11
+ const {
12
+ slots,
13
+ slotProps
14
+ } = props;
9
15
  const seriesData = React.useContext(SeriesContext).line;
10
16
  const axisData = React.useContext(CartesianContext);
17
+ const Mark = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : MarkElement;
11
18
  if (seriesData === undefined) {
12
19
  return null;
13
20
  }
@@ -64,7 +71,7 @@ export function MarkPlot(props) {
64
71
  x,
65
72
  y,
66
73
  index
67
- }) => /*#__PURE__*/_jsx(MarkElement, {
74
+ }) => /*#__PURE__*/_jsx(Mark, _extends({
68
75
  id: seriesId,
69
76
  dataIndex: index,
70
77
  shape: "circle",
@@ -72,8 +79,25 @@ export function MarkPlot(props) {
72
79
  x: x,
73
80
  y: y,
74
81
  highlightScope: series[seriesId].highlightScope
75
- }, `${seriesId}-${index}`));
82
+ }, slotProps == null ? void 0 : slotProps.mark), `${seriesId}-${index}`));
76
83
  });
77
84
  })
78
85
  }));
79
- }
86
+ }
87
+ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
88
+ // ----------------------------- Warning --------------------------------
89
+ // | These PropTypes are generated from the TypeScript type definitions |
90
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
91
+ // ----------------------------------------------------------------------
92
+ /**
93
+ * The props used for each component slot.
94
+ * @default {}
95
+ */
96
+ slotProps: PropTypes.object,
97
+ /**
98
+ * Overridable component slots.
99
+ * @default {}
100
+ */
101
+ slots: PropTypes.object
102
+ } : void 0;
103
+ 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) {