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

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 (142) hide show
  1. package/BarChart/BarChart.d.ts +19 -2
  2. package/BarChart/BarChart.js +84 -22
  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 +48 -19
  7. package/BarChart/extremums.js +19 -3
  8. package/BarChart/formatter.js +3 -1
  9. package/CHANGELOG.md +213 -28
  10. package/ChartsAxis/ChartsAxis.d.ts +11 -1
  11. package/ChartsAxis/ChartsAxis.js +51 -6
  12. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +3 -2
  13. package/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  14. package/ChartsLegend/ChartsLegend.d.ts +25 -2
  15. package/ChartsLegend/ChartsLegend.js +49 -17
  16. package/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  17. package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
  18. package/ChartsXAxis/ChartsXAxis.js +44 -9
  19. package/ChartsYAxis/ChartsYAxis.js +44 -9
  20. package/LineChart/AreaElement.d.ts +22 -0
  21. package/LineChart/AreaElement.js +31 -11
  22. package/LineChart/AreaPlot.d.ts +14 -1
  23. package/LineChart/AreaPlot.js +29 -3
  24. package/LineChart/LineChart.d.ts +20 -2
  25. package/LineChart/LineChart.js +63 -11
  26. package/LineChart/LineElement.d.ts +22 -0
  27. package/LineChart/LineElement.js +31 -10
  28. package/LineChart/LinePlot.d.ts +14 -1
  29. package/LineChart/LinePlot.js +35 -4
  30. package/LineChart/MarkPlot.d.ts +24 -1
  31. package/LineChart/MarkPlot.js +29 -4
  32. package/PieChart/PieArcLabel.js +0 -1
  33. package/PieChart/PieChart.d.ts +14 -2
  34. package/PieChart/PieChart.js +52 -10
  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 +56 -10
  39. package/ScatterChart/ScatterPlot.d.ts +24 -1
  40. package/ScatterChart/ScatterPlot.js +28 -4
  41. package/SparkLineChart/SparkLineChart.d.ts +18 -0
  42. package/SparkLineChart/SparkLineChart.js +29 -6
  43. package/colorPalettes/colorPalettes.js +2 -2
  44. package/context/CartesianContextProvider.js +18 -12
  45. package/esm/BarChart/BarChart.js +88 -26
  46. package/esm/BarChart/BarElement.js +21 -11
  47. package/esm/BarChart/BarPlot.js +49 -20
  48. package/esm/BarChart/extremums.js +18 -2
  49. package/esm/BarChart/formatter.js +3 -1
  50. package/esm/ChartsAxis/ChartsAxis.js +51 -6
  51. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  52. package/esm/ChartsLegend/ChartsLegend.js +47 -14
  53. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  54. package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
  55. package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
  56. package/esm/LineChart/AreaElement.js +31 -11
  57. package/esm/LineChart/AreaPlot.js +31 -4
  58. package/esm/LineChart/LineChart.js +63 -11
  59. package/esm/LineChart/LineElement.js +31 -11
  60. package/esm/LineChart/LinePlot.js +43 -8
  61. package/esm/LineChart/MarkPlot.js +32 -5
  62. package/esm/PieChart/PieArcLabel.js +0 -1
  63. package/esm/PieChart/PieChart.js +52 -10
  64. package/esm/PieChart/PiePlot.js +31 -6
  65. package/esm/ScatterChart/ScatterChart.js +56 -10
  66. package/esm/ScatterChart/ScatterPlot.js +29 -4
  67. package/esm/SparkLineChart/SparkLineChart.js +29 -6
  68. package/esm/colorPalettes/colorPalettes.js +2 -2
  69. package/esm/context/CartesianContextProvider.js +18 -12
  70. package/esm/hooks/useAxisEvents.js +21 -38
  71. package/esm/hooks/useTicks.js +11 -8
  72. package/esm/internals/components/AxisSharedComponents.js +10 -10
  73. package/hooks/useAxisEvents.js +21 -38
  74. package/hooks/useTicks.d.ts +20 -5
  75. package/hooks/useTicks.js +11 -8
  76. package/index.js +1 -1
  77. package/internals/components/AxisSharedComponents.d.ts +4 -4
  78. package/internals/components/AxisSharedComponents.js +15 -15
  79. package/internals/defaultizeColor.d.ts +1 -0
  80. package/legacy/BarChart/BarChart.js +93 -29
  81. package/legacy/BarChart/BarElement.js +20 -10
  82. package/legacy/BarChart/BarPlot.js +49 -20
  83. package/legacy/BarChart/extremums.js +22 -2
  84. package/legacy/BarChart/formatter.js +3 -1
  85. package/legacy/ChartsAxis/ChartsAxis.js +51 -6
  86. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  87. package/legacy/ChartsLegend/ChartsLegend.js +46 -15
  88. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  89. package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
  90. package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
  91. package/legacy/LineChart/AreaElement.js +30 -10
  92. package/legacy/LineChart/AreaPlot.js +29 -4
  93. package/legacy/LineChart/LineChart.js +63 -11
  94. package/legacy/LineChart/LineElement.js +30 -10
  95. package/legacy/LineChart/LinePlot.js +36 -5
  96. package/legacy/LineChart/MarkPlot.js +30 -5
  97. package/legacy/PieChart/PieArcLabel.js +0 -1
  98. package/legacy/PieChart/PieChart.js +52 -10
  99. package/legacy/PieChart/PiePlot.js +29 -6
  100. package/legacy/ScatterChart/ScatterChart.js +56 -10
  101. package/legacy/ScatterChart/ScatterPlot.js +27 -4
  102. package/legacy/SparkLineChart/SparkLineChart.js +29 -6
  103. package/legacy/colorPalettes/colorPalettes.js +2 -2
  104. package/legacy/context/CartesianContextProvider.js +18 -12
  105. package/legacy/hooks/useAxisEvents.js +21 -37
  106. package/legacy/hooks/useTicks.js +11 -11
  107. package/legacy/index.js +1 -1
  108. package/legacy/internals/components/AxisSharedComponents.js +10 -10
  109. package/models/axis.d.ts +24 -1
  110. package/models/seriesType/bar.d.ts +6 -1
  111. package/modern/BarChart/BarChart.js +85 -23
  112. package/modern/BarChart/BarElement.js +20 -11
  113. package/modern/BarChart/BarPlot.js +48 -19
  114. package/modern/BarChart/extremums.js +18 -2
  115. package/modern/BarChart/formatter.js +3 -1
  116. package/modern/ChartsAxis/ChartsAxis.js +51 -6
  117. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  118. package/modern/ChartsLegend/ChartsLegend.js +46 -14
  119. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  120. package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
  121. package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
  122. package/modern/LineChart/AreaElement.js +30 -11
  123. package/modern/LineChart/AreaPlot.js +31 -4
  124. package/modern/LineChart/LineChart.js +63 -11
  125. package/modern/LineChart/LineElement.js +30 -11
  126. package/modern/LineChart/LinePlot.js +37 -5
  127. package/modern/LineChart/MarkPlot.js +31 -5
  128. package/modern/PieChart/PieArcLabel.js +0 -1
  129. package/modern/PieChart/PieChart.js +52 -10
  130. package/modern/PieChart/PiePlot.js +30 -6
  131. package/modern/ScatterChart/ScatterChart.js +56 -10
  132. package/modern/ScatterChart/ScatterPlot.js +28 -4
  133. package/modern/SparkLineChart/SparkLineChart.js +29 -6
  134. package/modern/colorPalettes/colorPalettes.js +2 -2
  135. package/modern/context/CartesianContextProvider.js +18 -12
  136. package/modern/hooks/useAxisEvents.js +21 -38
  137. package/modern/hooks/useTicks.js +11 -8
  138. package/modern/index.js +1 -1
  139. package/modern/internals/components/AxisSharedComponents.js +10 -10
  140. package/package.json +5 -5
  141. package/themeAugmentation/components.d.ts +0 -10
  142. 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";
@@ -34,6 +34,7 @@ var defaultProps = {
34
34
  tickSize: 6
35
35
  };
36
36
  function ChartsYAxis(inProps) {
37
+ var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
37
38
  var props = useThemeProps({
38
39
  props: _extends({}, defaultProps, inProps),
39
40
  name: 'MuiChartsYAxis'
@@ -51,7 +52,9 @@ function ChartsYAxis(inProps) {
51
52
  label = defaultizedProps.label,
52
53
  labelFontSize = defaultizedProps.labelFontSize,
53
54
  tickSizeProp = defaultizedProps.tickSize,
54
- valueFormatter = defaultizedProps.valueFormatter;
55
+ valueFormatter = defaultizedProps.valueFormatter,
56
+ slots = defaultizedProps.slots,
57
+ slotProps = defaultizedProps.slotProps;
55
58
  var theme = useTheme();
56
59
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
57
60
  theme: theme
@@ -72,14 +75,18 @@ function ChartsYAxis(inProps) {
72
75
  x: positionSigne * (tickFontSize + tickSize + 10),
73
76
  y: top + height / 2
74
77
  };
78
+ var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
79
+ var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
80
+ var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
81
+ var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
75
82
  return /*#__PURE__*/_jsxs(AxisRoot, {
76
83
  transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
77
84
  className: classes.root,
78
- children: [!disableLine && /*#__PURE__*/_jsx(Line, {
85
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
79
86
  y1: yScale.range()[0],
80
87
  y2: yScale.range()[1],
81
88
  className: classes.line
82
- }), yTicks.map(function (_ref, index) {
89
+ }, slotProps == null ? void 0 : slotProps.axisLine)), yTicks.map(function (_ref, index) {
83
90
  var formattedValue = _ref.formattedValue,
84
91
  offset = _ref.offset,
85
92
  labelOffset = _ref.labelOffset;
@@ -88,19 +95,20 @@ function ChartsYAxis(inProps) {
88
95
  return /*#__PURE__*/_jsxs("g", {
89
96
  transform: "translate(0, ".concat(offset, ")"),
90
97
  className: classes.tickContainer,
91
- children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
98
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
92
99
  x2: positionSigne * tickSize,
93
100
  className: classes.tick
94
- }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
101
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
95
102
  x: xTickLabel,
96
103
  y: yTickLabel,
97
104
  "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
98
105
  sx: {
99
106
  fontSize: tickFontSize
100
107
  },
101
- className: classes.tickLabel,
108
+ className: classes.tickLabel
109
+ }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
102
110
  children: formattedValue.toLocaleString()
103
- })]
111
+ }))]
104
112
  }, index);
105
113
  }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
106
114
  sx: {
@@ -108,7 +116,8 @@ function ChartsYAxis(inProps) {
108
116
  transform: "rotate(".concat(positionSigne * 90, "deg)"),
109
117
  transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
110
118
  },
111
- className: classes.label,
119
+ className: classes.label
120
+ }, slotProps == null ? void 0 : slotProps.axisLabel, {
112
121
  children: label
113
122
  }))]
114
123
  });
@@ -154,6 +163,16 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
154
163
  * Position of the axis.
155
164
  */
156
165
  position: PropTypes.oneOf(['left', 'right']),
166
+ /**
167
+ * The props used for each component slot.
168
+ * @default {}
169
+ */
170
+ slotProps: PropTypes.object,
171
+ /**
172
+ * Overridable component slots.
173
+ * @default {}
174
+ */
175
+ slots: PropTypes.object,
157
176
  /**
158
177
  * The stroke color of the axis line.
159
178
  * @default 'currentColor'
@@ -164,6 +183,23 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
164
183
  * @default 12
165
184
  */
166
185
  tickFontSize: PropTypes.number,
186
+ /**
187
+ * Maximal step between two ticks.
188
+ * When using time data, the value is assumed to be in ms.
189
+ * Not supported by categorical axis (band, points).
190
+ */
191
+ tickMaxStep: PropTypes.number,
192
+ /**
193
+ * Maximal step between two ticks.
194
+ * When using time data, the value is assumed to be in ms.
195
+ * Not supported by categorical axis (band, points).
196
+ */
197
+ tickMinStep: PropTypes.number,
198
+ /**
199
+ * The number of ticks. This number is not guaranted.
200
+ * Not supported by categorical axis (band, points).
201
+ */
202
+ tickNumber: PropTypes.number,
167
203
  /**
168
204
  * The size of the ticks.
169
205
  * @default 6
@@ -1,9 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "classes", "color", "highlightScope"];
3
+ var _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';
@@ -25,7 +26,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
25
26
  };
26
27
  return composeClasses(slots, getAreaElementUtilityClass, classes);
27
28
  };
28
- var AreaElementPath = styled('path', {
29
+ export var AreaElementPath = styled('path', {
29
30
  name: 'MuiAreaElement',
30
31
  slot: 'Root',
31
32
  overridesResolver: function overridesResolver(_, styles) {
@@ -56,10 +57,13 @@ AreaElementPath.propTypes = {
56
57
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
57
58
  };
58
59
  function AreaElement(props) {
60
+ var _slots$area;
59
61
  var id = props.id,
60
62
  innerClasses = props.classes,
61
63
  color = props.color,
62
64
  highlightScope = props.highlightScope,
65
+ slots = props.slots,
66
+ slotProps = props.slotProps,
63
67
  other = _objectWithoutProperties(props, _excluded);
64
68
  var getInteractionItemProps = useInteractionItemProps(highlightScope);
65
69
  var _React$useContext = React.useContext(InteractionContext),
@@ -80,13 +84,19 @@ function AreaElement(props) {
80
84
  isHighlighted: isHighlighted
81
85
  };
82
86
  var classes = useUtilityClasses(ownerState);
83
- return /*#__PURE__*/_jsx(AreaElementPath, _extends({}, other, {
84
- ownerState: ownerState,
85
- className: classes.root
86
- }, getInteractionItemProps({
87
- type: 'line',
88
- seriesId: id
89
- })));
87
+ var Area = (_slots$area = slots == null ? void 0 : slots.area) != null ? _slots$area : AreaElementPath;
88
+ var areaProps = useSlotProps({
89
+ elementType: Area,
90
+ externalSlotProps: slotProps == null ? void 0 : slotProps.area,
91
+ additionalProps: _extends({}, other, getInteractionItemProps({
92
+ type: 'line',
93
+ seriesId: id
94
+ }), {
95
+ className: classes.root
96
+ }),
97
+ ownerState: ownerState
98
+ });
99
+ return /*#__PURE__*/_jsx(Area, _extends({}, areaProps));
90
100
  }
91
101
  process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
92
102
  // ----------------------------- Warning --------------------------------
@@ -97,6 +107,16 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
97
107
  highlightScope: PropTypes.shape({
98
108
  faded: PropTypes.oneOf(['global', 'none', 'series']),
99
109
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
100
- })
110
+ }),
111
+ /**
112
+ * The props used for each component slot.
113
+ * @default {}
114
+ */
115
+ slotProps: PropTypes.object,
116
+ /**
117
+ * Overridable component slots.
118
+ * @default {}
119
+ */
120
+ slots: PropTypes.object
101
121
  } : void 0;
102
122
  export { AreaElement };
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _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,10 @@ 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
+ var slots = props.slots,
15
+ slotProps = props.slotProps,
16
+ other = _objectWithoutProperties(props, _excluded);
11
17
  var seriesData = React.useContext(SeriesContext).line;
12
18
  var axisData = React.useContext(CartesianContext);
13
19
  if (seriesData === undefined) {
@@ -21,7 +27,7 @@ export function AreaPlot(props) {
21
27
  yAxisIds = axisData.yAxisIds;
22
28
  var defaultXAxisId = xAxisIds[0];
23
29
  var defaultYAxisId = yAxisIds[0];
24
- return /*#__PURE__*/_jsx("g", _extends({}, props, {
30
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
25
31
  children: stackingGroups.flatMap(function (_ref) {
26
32
  var groupIds = _ref.ids;
27
33
  return groupIds.flatMap(function (seriesId) {
@@ -55,9 +61,28 @@ export function AreaPlot(props) {
55
61
  id: seriesId,
56
62
  d: areaPath.curve(curve)(d3Data) || undefined,
57
63
  color: series[seriesId].color,
58
- highlightScope: series[seriesId].highlightScope
64
+ highlightScope: series[seriesId].highlightScope,
65
+ slots: slots,
66
+ slotProps: slotProps
59
67
  }, seriesId);
60
68
  });
61
69
  })
62
70
  }));
63
- }
71
+ }
72
+ process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
73
+ // ----------------------------- Warning --------------------------------
74
+ // | These PropTypes are generated from the TypeScript type definitions |
75
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
76
+ // ----------------------------------------------------------------------
77
+ /**
78
+ * The props used for each component slot.
79
+ * @default {}
80
+ */
81
+ slotProps: PropTypes.object,
82
+ /**
83
+ * Overridable component slots.
84
+ * @default {}
85
+ */
86
+ slots: PropTypes.object
87
+ } : void 0;
88
+ export { AreaPlot };
@@ -35,7 +35,9 @@ var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
35
35
  leftAxis = props.leftAxis,
36
36
  rightAxis = props.rightAxis,
37
37
  bottomAxis = props.bottomAxis,
38
- children = props.children;
38
+ children = props.children,
39
+ slots = props.slots,
40
+ slotProps = props.slotProps;
39
41
  var id = useId();
40
42
  var clipPathId = "".concat(id, "-clip-path");
41
43
  return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
@@ -67,13 +69,27 @@ var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
67
69
  disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
68
70
  children: [/*#__PURE__*/_jsxs("g", {
69
71
  clipPath: "url(#".concat(clipPathId, ")"),
70
- children: [/*#__PURE__*/_jsx(AreaPlot, {}), /*#__PURE__*/_jsx(LinePlot, {})]
72
+ children: [/*#__PURE__*/_jsx(AreaPlot, {
73
+ slots: slots,
74
+ slotProps: slotProps
75
+ }), /*#__PURE__*/_jsx(LinePlot, {
76
+ slots: slots,
77
+ slotProps: slotProps
78
+ })]
71
79
  }), /*#__PURE__*/_jsx(ChartsAxis, {
72
80
  topAxis: topAxis,
73
81
  leftAxis: leftAxis,
74
82
  rightAxis: rightAxis,
75
- bottomAxis: bottomAxis
76
- }), /*#__PURE__*/_jsx(MarkPlot, {}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
83
+ bottomAxis: bottomAxis,
84
+ slots: slots,
85
+ slotProps: slotProps
86
+ }), /*#__PURE__*/_jsx(MarkPlot, {
87
+ slots: slots,
88
+ slotProps: slotProps
89
+ }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
90
+ slots: slots,
91
+ slotProps: slotProps
92
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
77
93
  id: clipPathId
78
94
  }), children]
79
95
  });
@@ -85,7 +101,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
85
101
  // ----------------------------------------------------------------------
86
102
  axisHighlight: PropTypes.shape({
87
103
  x: PropTypes.oneOf(['band', 'line', 'none']),
88
- y: PropTypes.oneOf(['line', 'none'])
104
+ y: PropTypes.oneOf(['band', 'line', 'none'])
89
105
  }),
90
106
  /**
91
107
  * Indicate which axis to display the bottom of the charts.
@@ -101,8 +117,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
101
117
  label: PropTypes.string,
102
118
  labelFontSize: PropTypes.number,
103
119
  position: PropTypes.oneOf(['bottom', 'top']),
120
+ slotProps: PropTypes.object,
121
+ slots: PropTypes.object,
104
122
  stroke: PropTypes.string,
105
123
  tickFontSize: PropTypes.number,
124
+ tickMaxStep: PropTypes.number,
125
+ tickMinStep: PropTypes.number,
126
+ tickNumber: PropTypes.number,
106
127
  tickSize: PropTypes.number
107
128
  }), PropTypes.string]),
108
129
  children: PropTypes.node,
@@ -129,8 +150,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
129
150
  label: PropTypes.string,
130
151
  labelFontSize: PropTypes.number,
131
152
  position: PropTypes.oneOf(['left', 'right']),
153
+ slotProps: PropTypes.object,
154
+ slots: PropTypes.object,
132
155
  stroke: PropTypes.string,
133
156
  tickFontSize: PropTypes.number,
157
+ tickMaxStep: PropTypes.number,
158
+ tickMinStep: PropTypes.number,
159
+ tickNumber: PropTypes.number,
134
160
  tickSize: PropTypes.number
135
161
  }), PropTypes.string]),
136
162
  legend: PropTypes.shape({
@@ -147,6 +173,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
147
173
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
148
174
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
149
175
  }),
176
+ slotProps: PropTypes.object,
177
+ slots: PropTypes.object,
150
178
  spacing: PropTypes.number
151
179
  }),
152
180
  margin: PropTypes.shape({
@@ -169,8 +197,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
169
197
  label: PropTypes.string,
170
198
  labelFontSize: PropTypes.number,
171
199
  position: PropTypes.oneOf(['left', 'right']),
200
+ slotProps: PropTypes.object,
201
+ slots: PropTypes.object,
172
202
  stroke: PropTypes.string,
173
203
  tickFontSize: PropTypes.number,
204
+ tickMaxStep: PropTypes.number,
205
+ tickMinStep: PropTypes.number,
206
+ tickNumber: PropTypes.number,
174
207
  tickSize: PropTypes.number
175
208
  }), PropTypes.string]),
176
209
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -193,6 +226,16 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
193
226
  xAxisKey: PropTypes.string,
194
227
  yAxisKey: PropTypes.string
195
228
  })).isRequired,
229
+ /**
230
+ * The props used for each component slot.
231
+ * @default {}
232
+ */
233
+ slotProps: PropTypes.object,
234
+ /**
235
+ * Overridable component slots.
236
+ * @default {}
237
+ */
238
+ slots: PropTypes.object,
196
239
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
197
240
  title: PropTypes.string,
198
241
  tooltip: PropTypes.shape({
@@ -215,8 +258,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
215
258
  label: PropTypes.string,
216
259
  labelFontSize: PropTypes.number,
217
260
  position: PropTypes.oneOf(['bottom', 'top']),
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
269
  }), PropTypes.string]),
222
270
  viewBox: PropTypes.shape({
@@ -239,15 +287,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
239
287
  label: PropTypes.string,
240
288
  labelFontSize: PropTypes.number,
241
289
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
242
- maxTicks: PropTypes.number,
243
290
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
244
- minTicks: PropTypes.number,
245
291
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
246
292
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
293
+ slotProps: PropTypes.object,
294
+ slots: PropTypes.object,
247
295
  stroke: PropTypes.string,
248
296
  tickFontSize: PropTypes.number,
297
+ tickMaxStep: PropTypes.number,
298
+ tickMinStep: PropTypes.number,
299
+ tickNumber: PropTypes.number,
249
300
  tickSize: PropTypes.number,
250
- tickSpacing: PropTypes.number,
251
301
  valueFormatter: PropTypes.func
252
302
  })),
253
303
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -263,15 +313,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
263
313
  label: PropTypes.string,
264
314
  labelFontSize: PropTypes.number,
265
315
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
266
- maxTicks: PropTypes.number,
267
316
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
268
- minTicks: PropTypes.number,
269
317
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
270
318
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
319
+ slotProps: PropTypes.object,
320
+ slots: PropTypes.object,
271
321
  stroke: PropTypes.string,
272
322
  tickFontSize: PropTypes.number,
323
+ tickMaxStep: PropTypes.number,
324
+ tickMinStep: PropTypes.number,
325
+ tickNumber: PropTypes.number,
273
326
  tickSize: PropTypes.number,
274
- tickSpacing: PropTypes.number,
275
327
  valueFormatter: PropTypes.func
276
328
  }))
277
329
  } : void 0;
@@ -1,10 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "classes", "color", "highlightScope"];
3
+ var _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';
@@ -25,7 +26,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
25
26
  };
26
27
  return composeClasses(slots, getLineElementUtilityClass, classes);
27
28
  };
28
- var LineElementPath = styled('path', {
29
+ export var LineElementPath = styled('path', {
29
30
  name: 'MuiLineElement',
30
31
  slot: 'Root',
31
32
  overridesResolver: function overridesResolver(_, styles) {
@@ -58,10 +59,13 @@ LineElementPath.propTypes = {
58
59
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
59
60
  };
60
61
  function LineElement(props) {
62
+ var _slots$line;
61
63
  var id = props.id,
62
64
  innerClasses = props.classes,
63
65
  color = props.color,
64
66
  highlightScope = props.highlightScope,
67
+ slots = props.slots,
68
+ slotProps = props.slotProps,
65
69
  other = _objectWithoutProperties(props, _excluded);
66
70
  var getInteractionItemProps = useInteractionItemProps(highlightScope);
67
71
  var _React$useContext = React.useContext(InteractionContext),
@@ -82,13 +86,19 @@ function LineElement(props) {
82
86
  isHighlighted: isHighlighted
83
87
  };
84
88
  var classes = useUtilityClasses(ownerState);
85
- return /*#__PURE__*/_jsx(LineElementPath, _extends({}, other, {
86
- ownerState: ownerState,
87
- className: classes.root
88
- }, getInteractionItemProps({
89
- type: 'line',
90
- seriesId: id
91
- })));
89
+ var Line = (_slots$line = slots == null ? void 0 : slots.line) != null ? _slots$line : LineElementPath;
90
+ var lineProps = useSlotProps({
91
+ elementType: Line,
92
+ externalSlotProps: slotProps == null ? void 0 : slotProps.line,
93
+ additionalProps: _extends({}, other, getInteractionItemProps({
94
+ type: 'line',
95
+ seriesId: id
96
+ }), {
97
+ className: classes.root
98
+ }),
99
+ ownerState: ownerState
100
+ });
101
+ return /*#__PURE__*/_jsx(Line, _extends({}, lineProps));
92
102
  }
93
103
  process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
94
104
  // ----------------------------- Warning --------------------------------
@@ -99,6 +109,16 @@ process.env.NODE_ENV !== "production" ? LineElement.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 { LineElement };
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _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,10 @@ 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
+ var slots = props.slots,
15
+ slotProps = props.slotProps,
16
+ other = _objectWithoutProperties(props, _excluded);
11
17
  var seriesData = React.useContext(SeriesContext).line;
12
18
  var axisData = React.useContext(CartesianContext);
13
19
  if (seriesData === undefined) {
@@ -21,7 +27,7 @@ export function LinePlot(props) {
21
27
  yAxisIds = axisData.yAxisIds;
22
28
  var defaultXAxisId = xAxisIds[0];
23
29
  var defaultYAxisId = yAxisIds[0];
24
- return /*#__PURE__*/_jsx("g", _extends({}, props, {
30
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
25
31
  children: stackingGroups.flatMap(function (_ref) {
26
32
  var groupIds = _ref.ids;
27
33
  return groupIds.flatMap(function (seriesId) {
@@ -42,20 +48,45 @@ export function LinePlot(props) {
42
48
  }).y(function (d) {
43
49
  return yScale(d.y[1]);
44
50
  });
51
+ if (process.env.NODE_ENV !== 'production') {
52
+ if (xData.length !== stackedData.length) {
53
+ throw new Error("MUI: data length of the x axis (".concat(xData.length, " items) does not match length of series (").concat(stackedData.length, " items)"));
54
+ }
55
+ }
45
56
  var curve = getCurveFactory(series[seriesId].curve);
46
57
  var d3Data = xData == null ? void 0 : xData.map(function (x, index) {
58
+ var _stackedData$index;
47
59
  return {
48
60
  x: x,
49
- y: stackedData[index]
61
+ y: (_stackedData$index = stackedData[index]) != null ? _stackedData$index : [0, 0]
50
62
  };
51
63
  });
52
64
  return /*#__PURE__*/_jsx(LineElement, {
53
65
  id: seriesId,
54
66
  d: linePath.curve(curve)(d3Data) || undefined,
55
67
  color: series[seriesId].color,
56
- highlightScope: series[seriesId].highlightScope
68
+ highlightScope: series[seriesId].highlightScope,
69
+ slots: slots,
70
+ slotProps: slotProps
57
71
  }, seriesId);
58
72
  });
59
73
  })
60
74
  }));
61
- }
75
+ }
76
+ process.env.NODE_ENV !== "production" ? LinePlot.propTypes = {
77
+ // ----------------------------- Warning --------------------------------
78
+ // | These PropTypes are generated from the TypeScript type definitions |
79
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
80
+ // ----------------------------------------------------------------------
81
+ /**
82
+ * The props used for each component slot.
83
+ * @default {}
84
+ */
85
+ slotProps: PropTypes.object,
86
+ /**
87
+ * Overridable component slots.
88
+ * @default {}
89
+ */
90
+ slots: PropTypes.object
91
+ } : void 0;
92
+ export { LinePlot };
@@ -1,14 +1,22 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["slots", "slotProps"];
3
5
  import * as React from 'react';
6
+ import PropTypes from 'prop-types';
4
7
  import { SeriesContext } from '../context/SeriesContextProvider';
5
8
  import { CartesianContext } from '../context/CartesianContextProvider';
6
9
  import { MarkElement } from './MarkElement';
7
10
  import { getValueToPositionMapper } from '../hooks/useScale';
8
11
  import { jsx as _jsx } from "react/jsx-runtime";
9
- export function MarkPlot(props) {
12
+ function MarkPlot(props) {
13
+ var _slots$mark;
14
+ var slots = props.slots,
15
+ slotProps = props.slotProps,
16
+ other = _objectWithoutProperties(props, _excluded);
10
17
  var seriesData = React.useContext(SeriesContext).line;
11
18
  var axisData = React.useContext(CartesianContext);
19
+ var Mark = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : MarkElement;
12
20
  if (seriesData === undefined) {
13
21
  return null;
14
22
  }
@@ -20,7 +28,7 @@ export function MarkPlot(props) {
20
28
  yAxisIds = axisData.yAxisIds;
21
29
  var defaultXAxisId = xAxisIds[0];
22
30
  var defaultYAxisId = yAxisIds[0];
23
- return /*#__PURE__*/_jsx("g", _extends({}, props, {
31
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
24
32
  children: stackingGroups.flatMap(function (_ref) {
25
33
  var groupIds = _ref.ids;
26
34
  return groupIds.flatMap(function (seriesId) {
@@ -60,7 +68,7 @@ export function MarkPlot(props) {
60
68
  var x = _ref3.x,
61
69
  y = _ref3.y,
62
70
  index = _ref3.index;
63
- return /*#__PURE__*/_jsx(MarkElement, {
71
+ return /*#__PURE__*/_jsx(Mark, _extends({
64
72
  id: seriesId,
65
73
  dataIndex: index,
66
74
  shape: "circle",
@@ -68,9 +76,26 @@ export function MarkPlot(props) {
68
76
  x: x,
69
77
  y: y,
70
78
  highlightScope: series[seriesId].highlightScope
71
- }, "".concat(seriesId, "-").concat(index));
79
+ }, slotProps == null ? void 0 : slotProps.mark), "".concat(seriesId, "-").concat(index));
72
80
  });
73
81
  });
74
82
  })
75
83
  }));
76
- }
84
+ }
85
+ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
86
+ // ----------------------------- Warning --------------------------------
87
+ // | These PropTypes are generated from the TypeScript type definitions |
88
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
89
+ // ----------------------------------------------------------------------
90
+ /**
91
+ * The props used for each component slot.
92
+ * @default {}
93
+ */
94
+ slotProps: PropTypes.object,
95
+ /**
96
+ * Overridable component slots.
97
+ * @default {}
98
+ */
99
+ slots: PropTypes.object
100
+ } : void 0;
101
+ export { MarkPlot };
@@ -35,7 +35,6 @@ var PieArcLabelRoot = styled('text', {
35
35
  var theme = _ref.theme;
36
36
  return {
37
37
  fill: theme.palette.text.primary,
38
- alignmentBaseline: 'baseline',
39
38
  textAnchor: 'middle'
40
39
  };
41
40
  });