@mui/x-charts 6.18.0 → 7.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/BarChart/BarChart.d.ts +15 -8
  2. package/BarChart/BarChart.js +41 -4
  3. package/BarChart/BarPlot.d.ts +2 -2
  4. package/CHANGELOG.md +212 -5
  5. package/ChartsAxis/ChartsAxis.d.ts +3 -3
  6. package/ChartsAxis/ChartsAxis.js +5 -5
  7. package/ChartsAxis/axisClasses.d.ts +2 -2
  8. package/ChartsLegend/ChartsLegend.d.ts +10 -6
  9. package/ChartsLegend/ChartsLegend.js +137 -2
  10. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  11. package/ChartsLegend/chartsLegendClasses.js +2 -2
  12. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
  13. package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
  14. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
  15. package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
  16. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
  17. package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
  18. package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
  19. package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
  20. package/ChartsReferenceLine/common.d.ts +41 -0
  21. package/ChartsReferenceLine/common.js +27 -0
  22. package/ChartsReferenceLine/index.d.ts +2 -0
  23. package/ChartsReferenceLine/index.js +27 -0
  24. package/ChartsReferenceLine/package.json +6 -0
  25. package/ChartsSurface.d.ts +11 -0
  26. package/ChartsTooltip/ChartsTooltip.d.ts +4 -4
  27. package/ChartsXAxis/ChartsXAxis.js +9 -5
  28. package/ChartsYAxis/ChartsYAxis.js +9 -5
  29. package/LineChart/AreaPlot.d.ts +2 -2
  30. package/LineChart/LineChart.d.ts +18 -11
  31. package/LineChart/LineChart.js +41 -4
  32. package/LineChart/LineHighlightPlot.d.ts +4 -4
  33. package/LineChart/LineHighlightPlot.js +1 -1
  34. package/LineChart/LinePlot.d.ts +2 -2
  35. package/LineChart/MarkPlot.d.ts +4 -4
  36. package/LineChart/MarkPlot.js +2 -1
  37. package/PieChart/PieArcLabelPlot.d.ts +4 -4
  38. package/PieChart/PieArcPlot.d.ts +4 -4
  39. package/PieChart/PieChart.d.ts +8 -8
  40. package/PieChart/PieChart.js +34 -4
  41. package/PieChart/PiePlot.d.ts +6 -6
  42. package/ResponsiveChartContainer/index.d.ts +13 -3
  43. package/ScatterChart/ScatterChart.d.ts +8 -8
  44. package/ScatterChart/ScatterChart.js +34 -4
  45. package/ScatterChart/ScatterPlot.d.ts +4 -4
  46. package/SparkLineChart/SparkLineChart.d.ts +10 -10
  47. package/SparkLineChart/SparkLineChart.js +22 -0
  48. package/context/CartesianContextProvider.d.ts +21 -1
  49. package/context/CartesianContextProvider.js +11 -0
  50. package/context/DrawingProvider.d.ts +18 -0
  51. package/context/DrawingProvider.js +6 -0
  52. package/context/HighlightProvider.d.ts +17 -0
  53. package/context/InteractionProvider.d.ts +6 -0
  54. package/context/SeriesContextProvider.d.ts +5 -0
  55. package/esm/BarChart/BarChart.js +41 -4
  56. package/esm/ChartsAxis/ChartsAxis.js +6 -5
  57. package/esm/ChartsLegend/ChartsLegend.js +140 -4
  58. package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
  59. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  60. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  61. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  62. package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  63. package/esm/ChartsReferenceLine/common.js +20 -0
  64. package/esm/ChartsReferenceLine/index.js +2 -0
  65. package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
  66. package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
  67. package/esm/LineChart/LineChart.js +41 -4
  68. package/esm/LineChart/LineHighlightPlot.js +1 -1
  69. package/esm/LineChart/MarkPlot.js +2 -1
  70. package/esm/PieChart/PieChart.js +34 -4
  71. package/esm/ScatterChart/ScatterChart.js +34 -4
  72. package/esm/SparkLineChart/SparkLineChart.js +22 -0
  73. package/esm/context/CartesianContextProvider.js +11 -0
  74. package/esm/context/DrawingProvider.js +6 -0
  75. package/esm/index.js +2 -0
  76. package/esm/internals/geometry.js +2 -2
  77. package/hooks/useScale.d.ts +2 -2
  78. package/index.d.ts +2 -0
  79. package/index.js +23 -1
  80. package/internals/components/ChartsText.d.ts +1 -1
  81. package/internals/geometry.d.ts +2 -2
  82. package/internals/geometry.js +2 -2
  83. package/internals/isBandScale.d.ts +3 -1
  84. package/internals/utils.d.ts +5 -0
  85. package/legacy/BarChart/BarChart.js +41 -4
  86. package/legacy/ChartsAxis/ChartsAxis.js +6 -5
  87. package/legacy/ChartsLegend/ChartsLegend.js +140 -4
  88. package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
  89. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  90. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  91. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  92. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  93. package/legacy/ChartsReferenceLine/common.js +20 -0
  94. package/legacy/ChartsReferenceLine/index.js +2 -0
  95. package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
  96. package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
  97. package/legacy/LineChart/LineChart.js +41 -4
  98. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  99. package/legacy/LineChart/MarkPlot.js +2 -1
  100. package/legacy/PieChart/PieChart.js +34 -4
  101. package/legacy/ScatterChart/ScatterChart.js +34 -4
  102. package/legacy/SparkLineChart/SparkLineChart.js +22 -0
  103. package/legacy/context/CartesianContextProvider.js +11 -0
  104. package/legacy/context/DrawingProvider.js +6 -0
  105. package/legacy/index.js +3 -1
  106. package/legacy/internals/geometry.js +2 -2
  107. package/models/axis.d.ts +37 -17
  108. package/models/layout.d.ts +6 -0
  109. package/models/seriesType/common.d.ts +16 -0
  110. package/modern/BarChart/BarChart.js +41 -4
  111. package/modern/ChartsAxis/ChartsAxis.js +5 -5
  112. package/modern/ChartsLegend/ChartsLegend.js +140 -4
  113. package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
  114. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  115. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
  116. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
  117. package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  118. package/modern/ChartsReferenceLine/common.js +20 -0
  119. package/modern/ChartsReferenceLine/index.js +2 -0
  120. package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
  121. package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
  122. package/modern/LineChart/LineChart.js +41 -4
  123. package/modern/LineChart/LineHighlightPlot.js +1 -1
  124. package/modern/LineChart/MarkPlot.js +2 -1
  125. package/modern/PieChart/PieChart.js +34 -4
  126. package/modern/ScatterChart/ScatterChart.js +34 -4
  127. package/modern/SparkLineChart/SparkLineChart.js +22 -0
  128. package/modern/context/CartesianContextProvider.js +11 -0
  129. package/modern/context/DrawingProvider.js +6 -0
  130. package/modern/index.js +3 -1
  131. package/modern/internals/geometry.js +2 -2
  132. package/package.json +1 -1
@@ -52,17 +52,20 @@ function ChartsYAxis(inProps) {
52
52
  props: _extends({}, defaultProps, inProps),
53
53
  name: 'MuiChartsYAxis'
54
54
  });
55
+ const {
56
+ yAxisIds
57
+ } = React.useContext(CartesianContext);
55
58
  const _React$useContext = React.useContext(CartesianContext),
56
- _props$axisId = props.axisId,
59
+ _ref = props.axisId ?? yAxisIds[0],
57
60
  {
58
61
  yAxis: {
59
- [_props$axisId]: {
62
+ [_ref]: {
60
63
  scale: yScale,
61
64
  tickNumber
62
65
  }
63
66
  }
64
67
  } = _React$useContext,
65
- settings = _objectWithoutPropertiesLoose(_React$useContext.yAxis[_props$axisId], _excluded);
68
+ settings = _objectWithoutPropertiesLoose(_React$useContext.yAxis[_ref], _excluded);
66
69
  const defaultizedProps = _extends({}, defaultProps, settings, props);
67
70
  const {
68
71
  position,
@@ -167,9 +170,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
167
170
  // | To update them edit the TypeScript types and run "yarn proptypes" |
168
171
  // ----------------------------------------------------------------------
169
172
  /**
170
- * Id of the axis to render.
173
+ * The id of the axis to render.
174
+ * If undefined, it will be the first defined axis.
171
175
  */
172
- axisId: PropTypes.string.isRequired,
176
+ axisId: PropTypes.string,
173
177
  /**
174
178
  * Override or extend the styles applied to the component.
175
179
  */
@@ -111,6 +111,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
111
111
  // | These PropTypes are generated from the TypeScript type definitions |
112
112
  // | To update them edit the TypeScript types and run "yarn proptypes" |
113
113
  // ----------------------------------------------------------------------
114
+ /**
115
+ * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
116
+ * The two properties accept the following values:
117
+ * - 'none': display nothing.
118
+ * - 'line': display a line at the current mouse position.
119
+ * - 'band': display a band at the current mouse position. Only available with band scale.
120
+ */
114
121
  axisHighlight: PropTypes.shape({
115
122
  x: PropTypes.oneOf(['band', 'line', 'none']),
116
123
  y: PropTypes.oneOf(['band', 'line', 'none'])
@@ -121,7 +128,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
121
128
  * @default xAxisIds[0] The id of the first provided axis
122
129
  */
123
130
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
124
- axisId: PropTypes.string.isRequired,
131
+ axisId: PropTypes.string,
125
132
  classes: PropTypes.object,
126
133
  disableLine: PropTypes.bool,
127
134
  disableTicks: PropTypes.bool,
@@ -148,13 +155,25 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
148
155
  * Color palette used to colorize multiple series.
149
156
  */
150
157
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
158
+ /**
159
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
160
+ */
151
161
  dataset: PropTypes.arrayOf(PropTypes.object),
152
162
  desc: PropTypes.string,
163
+ /**
164
+ * If `true`, the charts will not listen to the mouse move event.
165
+ * It might break interactive features, but will improve performance.
166
+ * @default false
167
+ */
153
168
  disableAxisListener: PropTypes.bool,
154
169
  /**
155
170
  * If `true`, render the line highlight item.
156
171
  */
157
172
  disableLineItemHighlight: PropTypes.bool,
173
+ /**
174
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
175
+ * @default undefined
176
+ */
158
177
  height: PropTypes.number,
159
178
  /**
160
179
  * Indicate which axis to display the left of the charts.
@@ -162,7 +181,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
162
181
  * @default yAxisIds[0] The id of the first provided axis
163
182
  */
164
183
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
165
- axisId: PropTypes.string.isRequired,
184
+ axisId: PropTypes.string,
166
185
  classes: PropTypes.object,
167
186
  disableLine: PropTypes.bool,
168
187
  disableTicks: PropTypes.bool,
@@ -197,6 +216,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
197
216
  slotProps: PropTypes.object,
198
217
  slots: PropTypes.object
199
218
  }),
219
+ /**
220
+ * The margin between the SVG and the drawing area.
221
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
222
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
223
+ * @default object Depends on the charts type.
224
+ */
200
225
  margin: PropTypes.shape({
201
226
  bottom: PropTypes.number,
202
227
  left: PropTypes.number,
@@ -209,7 +234,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
209
234
  * @default null
210
235
  */
211
236
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
212
- axisId: PropTypes.string.isRequired,
237
+ axisId: PropTypes.string,
213
238
  classes: PropTypes.object,
214
239
  disableLine: PropTypes.bool,
215
240
  disableTicks: PropTypes.bool,
@@ -279,7 +304,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
279
304
  * @default null
280
305
  */
281
306
  topAxis: PropTypes.oneOfType([PropTypes.shape({
282
- axisId: PropTypes.string.isRequired,
307
+ axisId: PropTypes.string,
283
308
  classes: PropTypes.object,
284
309
  disableLine: PropTypes.bool,
285
310
  disableTicks: PropTypes.bool,
@@ -306,7 +331,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
306
331
  x: PropTypes.number,
307
332
  y: PropTypes.number
308
333
  }),
334
+ /**
335
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
336
+ * @default undefined
337
+ */
309
338
  width: PropTypes.number,
339
+ /**
340
+ * The configuration of the x-axes.
341
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
342
+ */
310
343
  xAxis: PropTypes.arrayOf(PropTypes.shape({
311
344
  axisId: PropTypes.string,
312
345
  classes: PropTypes.object,
@@ -337,6 +370,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
337
370
  tickSize: PropTypes.number,
338
371
  valueFormatter: PropTypes.func
339
372
  })),
373
+ /**
374
+ * The configuration of the y-axes.
375
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
376
+ */
340
377
  yAxis: PropTypes.arrayOf(PropTypes.shape({
341
378
  axisId: PropTypes.string,
342
379
  classes: PropTypes.object,
@@ -72,7 +72,7 @@ function LineHighlightPlot(props) {
72
72
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
73
73
  }
74
74
  const x = xScale(xData[highlightedIndex]);
75
- const y = yScale(stackedData[highlightedIndex][1]);
75
+ const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
76
76
  return /*#__PURE__*/_jsx(Element, _extends({
77
77
  id: seriesId,
78
78
  color: series[seriesId].color,
@@ -125,7 +125,8 @@ function MarkPlot(props) {
125
125
  shape: "circle",
126
126
  color: series[seriesId].color,
127
127
  x: x,
128
- y: y,
128
+ y: y // Don't knwo why TS don't get from the filter that y can't be null
129
+ ,
129
130
  highlightScope: series[seriesId].highlightScope
130
131
  }, slotProps?.mark), `${seriesId}-${index}`);
131
132
  });
@@ -111,7 +111,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
111
111
  * @default xAxisIds[0] The id of the first provided axis
112
112
  */
113
113
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
114
- axisId: PropTypes.string.isRequired,
114
+ axisId: PropTypes.string,
115
115
  classes: PropTypes.object,
116
116
  disableLine: PropTypes.bool,
117
117
  disableTicks: PropTypes.bool,
@@ -138,9 +138,21 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
138
138
  * Color palette used to colorize multiple series.
139
139
  */
140
140
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
141
+ /**
142
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
143
+ */
141
144
  dataset: PropTypes.arrayOf(PropTypes.object),
142
145
  desc: PropTypes.string,
146
+ /**
147
+ * If `true`, the charts will not listen to the mouse move event.
148
+ * It might break interactive features, but will improve performance.
149
+ * @default false
150
+ */
143
151
  disableAxisListener: PropTypes.bool,
152
+ /**
153
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
154
+ * @default undefined
155
+ */
144
156
  height: PropTypes.number,
145
157
  /**
146
158
  * Indicate which axis to display the left of the charts.
@@ -148,7 +160,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
148
160
  * @default yAxisIds[0] The id of the first provided axis
149
161
  */
150
162
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
151
- axisId: PropTypes.string.isRequired,
163
+ axisId: PropTypes.string,
152
164
  classes: PropTypes.object,
153
165
  disableLine: PropTypes.bool,
154
166
  disableTicks: PropTypes.bool,
@@ -183,6 +195,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
183
195
  slotProps: PropTypes.object,
184
196
  slots: PropTypes.object
185
197
  }),
198
+ /**
199
+ * The margin between the SVG and the drawing area.
200
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
201
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
202
+ * @default object Depends on the charts type.
203
+ */
186
204
  margin: PropTypes.shape({
187
205
  bottom: PropTypes.number,
188
206
  left: PropTypes.number,
@@ -196,7 +214,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
196
214
  * @default null
197
215
  */
198
216
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
199
- axisId: PropTypes.string.isRequired,
217
+ axisId: PropTypes.string,
200
218
  classes: PropTypes.object,
201
219
  disableLine: PropTypes.bool,
202
220
  disableTicks: PropTypes.bool,
@@ -287,7 +305,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
287
305
  * @default null
288
306
  */
289
307
  topAxis: PropTypes.oneOfType([PropTypes.shape({
290
- axisId: PropTypes.string.isRequired,
308
+ axisId: PropTypes.string,
291
309
  classes: PropTypes.object,
292
310
  disableLine: PropTypes.bool,
293
311
  disableTicks: PropTypes.bool,
@@ -314,7 +332,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
314
332
  x: PropTypes.number,
315
333
  y: PropTypes.number
316
334
  }),
335
+ /**
336
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
337
+ * @default undefined
338
+ */
317
339
  width: PropTypes.number,
340
+ /**
341
+ * The configuration of the x-axes.
342
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
343
+ */
318
344
  xAxis: PropTypes.arrayOf(PropTypes.shape({
319
345
  axisId: PropTypes.string,
320
346
  classes: PropTypes.object,
@@ -345,6 +371,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
345
371
  tickSize: PropTypes.number,
346
372
  valueFormatter: PropTypes.func
347
373
  })),
374
+ /**
375
+ * The configuration of the y-axes.
376
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
377
+ */
348
378
  yAxis: PropTypes.arrayOf(PropTypes.shape({
349
379
  axisId: PropTypes.string,
350
380
  classes: PropTypes.object,
@@ -88,7 +88,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
88
88
  * @default xAxisIds[0] The id of the first provided axis
89
89
  */
90
90
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
91
- axisId: PropTypes.string.isRequired,
91
+ axisId: PropTypes.string,
92
92
  classes: PropTypes.object,
93
93
  disableLine: PropTypes.bool,
94
94
  disableTicks: PropTypes.bool,
@@ -115,9 +115,21 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
115
115
  * Color palette used to colorize multiple series.
116
116
  */
117
117
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
118
+ /**
119
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
120
+ */
118
121
  dataset: PropTypes.arrayOf(PropTypes.object),
119
122
  desc: PropTypes.string,
123
+ /**
124
+ * If `true`, the charts will not listen to the mouse move event.
125
+ * It might break interactive features, but will improve performance.
126
+ * @default false
127
+ */
120
128
  disableAxisListener: PropTypes.bool,
129
+ /**
130
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
131
+ * @default undefined
132
+ */
121
133
  height: PropTypes.number,
122
134
  /**
123
135
  * Indicate which axis to display the left of the charts.
@@ -125,7 +137,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
125
137
  * @default yAxisIds[0] The id of the first provided axis
126
138
  */
127
139
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
128
- axisId: PropTypes.string.isRequired,
140
+ axisId: PropTypes.string,
129
141
  classes: PropTypes.object,
130
142
  disableLine: PropTypes.bool,
131
143
  disableTicks: PropTypes.bool,
@@ -160,6 +172,12 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
160
172
  slotProps: PropTypes.object,
161
173
  slots: PropTypes.object
162
174
  }),
175
+ /**
176
+ * The margin between the SVG and the drawing area.
177
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
178
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
179
+ * @default object Depends on the charts type.
180
+ */
163
181
  margin: PropTypes.shape({
164
182
  bottom: PropTypes.number,
165
183
  left: PropTypes.number,
@@ -172,7 +190,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
172
190
  * @default null
173
191
  */
174
192
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
175
- axisId: PropTypes.string.isRequired,
193
+ axisId: PropTypes.string,
176
194
  classes: PropTypes.object,
177
195
  disableLine: PropTypes.bool,
178
196
  disableTicks: PropTypes.bool,
@@ -238,7 +256,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
238
256
  * @default null
239
257
  */
240
258
  topAxis: PropTypes.oneOfType([PropTypes.shape({
241
- axisId: PropTypes.string.isRequired,
259
+ axisId: PropTypes.string,
242
260
  classes: PropTypes.object,
243
261
  disableLine: PropTypes.bool,
244
262
  disableTicks: PropTypes.bool,
@@ -265,7 +283,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
265
283
  x: PropTypes.number,
266
284
  y: PropTypes.number
267
285
  }),
286
+ /**
287
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
288
+ * @default undefined
289
+ */
268
290
  width: PropTypes.number,
291
+ /**
292
+ * The configuration of the x-axes.
293
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
294
+ */
269
295
  xAxis: PropTypes.arrayOf(PropTypes.shape({
270
296
  axisId: PropTypes.string,
271
297
  classes: PropTypes.object,
@@ -296,6 +322,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
296
322
  tickSize: PropTypes.number,
297
323
  valueFormatter: PropTypes.func
298
324
  })),
325
+ /**
326
+ * The configuration of the y-axes.
327
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
328
+ */
299
329
  yAxis: PropTypes.arrayOf(PropTypes.shape({
300
330
  axisId: PropTypes.string,
301
331
  classes: PropTypes.object,
@@ -129,10 +129,28 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
129
129
  * Data to plot.
130
130
  */
131
131
  data: PropTypes.arrayOf(PropTypes.number).isRequired,
132
+ /**
133
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
134
+ */
132
135
  dataset: PropTypes.arrayOf(PropTypes.object),
133
136
  desc: PropTypes.string,
137
+ /**
138
+ * If `true`, the charts will not listen to the mouse move event.
139
+ * It might break interactive features, but will improve performance.
140
+ * @default false
141
+ */
134
142
  disableAxisListener: PropTypes.bool,
143
+ /**
144
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
145
+ * @default undefined
146
+ */
135
147
  height: PropTypes.number,
148
+ /**
149
+ * The margin between the SVG and the drawing area.
150
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
151
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
152
+ * @default object Depends on the charts type.
153
+ */
136
154
  margin: PropTypes.shape({
137
155
  bottom: PropTypes.number,
138
156
  left: PropTypes.number,
@@ -188,6 +206,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
188
206
  x: PropTypes.number,
189
207
  y: PropTypes.number
190
208
  }),
209
+ /**
210
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
211
+ * @default undefined
212
+ */
191
213
  width: PropTypes.number,
192
214
  /**
193
215
  * The xAxis configuration.
@@ -215,7 +215,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
215
215
  // | To update them edit the TypeScript types and run "yarn proptypes" |
216
216
  // ----------------------------------------------------------------------
217
217
  children: PropTypes.node,
218
+ /**
219
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
220
+ */
218
221
  dataset: PropTypes.arrayOf(PropTypes.object),
222
+ /**
223
+ * The configuration of the x-axes.
224
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
225
+ */
219
226
  xAxis: PropTypes.arrayOf(PropTypes.shape({
220
227
  axisId: PropTypes.string,
221
228
  classes: PropTypes.object,
@@ -246,6 +253,10 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
246
253
  tickSize: PropTypes.number,
247
254
  valueFormatter: PropTypes.func
248
255
  })),
256
+ /**
257
+ * The configuration of the y-axes.
258
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
259
+ */
249
260
  yAxis: PropTypes.arrayOf(PropTypes.shape({
250
261
  axisId: PropTypes.string,
251
262
  classes: PropTypes.object,
@@ -46,6 +46,12 @@ process.env.NODE_ENV !== "production" ? DrawingProvider.propTypes = {
46
46
  // ----------------------------------------------------------------------
47
47
  children: PropTypes.node,
48
48
  height: PropTypes.number.isRequired,
49
+ /**
50
+ * The margin between the SVG and the drawing area.
51
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
52
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
53
+ * @default object Depends on the charts type.
54
+ */
49
55
  margin: PropTypes.shape({
50
56
  bottom: PropTypes.number,
51
57
  left: PropTypes.number,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v6.18.0
2
+ * @mui/x-charts v7.0.0-alpha.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,10 +11,12 @@ export * from './hooks';
11
11
  export * from './colorPalettes';
12
12
  export * from './models';
13
13
  export * from './ChartsClipPath';
14
+ export * from './ChartsReferenceLine';
14
15
  export * from './ChartsAxis';
15
16
  export * from './ChartsXAxis';
16
17
  export * from './ChartsYAxis';
17
18
  export * from './ChartsTooltip';
19
+ export * from './ChartsLegend';
18
20
  export * from './ChartsAxisHighlight';
19
21
  export * from './BarChart';
20
22
  export * from './LineChart';
@@ -6,8 +6,8 @@ let warnedOnce = false;
6
6
  * Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
7
7
  * This assumes that all rectangles have the same height and angle between -90 and 90.
8
8
  * Otherwise it would be problematic because you need the height/width of the next rectangle to do the correct computation.
9
- * @param width the side along the x axis.
10
- * @param height the side along the y axis.
9
+ * @param width the side along the x-axis.
10
+ * @param height the side along the y-axis.
11
11
  * @param angle the rotation in degrees.
12
12
  */
13
13
  export function getMinXTranslation(width, height, angle = 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "6.18.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "The community edition of the charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",