@mui/x-charts 6.19.1 → 6.19.4

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 (172) hide show
  1. package/BarChart/BarChart.js +12 -9
  2. package/BarChart/BarElement.d.ts +43 -23
  3. package/BarChart/BarElement.js +1 -0
  4. package/BarChart/BarPlot.js +9 -10
  5. package/CHANGELOG.md +140 -0
  6. package/ChartsAxis/ChartsAxis.js +4 -4
  7. package/ChartsLegend/ChartsLegend.d.ts +5 -2
  8. package/ChartsLegend/ChartsLegend.js +36 -1
  9. package/ChartsReferenceLine/ChartsReferenceLine.js +8 -4
  10. package/ChartsReferenceLine/common.d.ts +2 -1
  11. package/ChartsSurface.d.ts +2 -2
  12. package/ChartsSurface.js +33 -1
  13. package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
  14. package/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
  15. package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
  16. package/ChartsTooltip/ChartsTooltipTable.js +2 -0
  17. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
  18. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
  19. package/ChartsXAxis/ChartsXAxis.js +13 -9
  20. package/ChartsYAxis/ChartsYAxis.js +1 -1
  21. package/LineChart/AreaElement.d.ts +7 -4
  22. package/LineChart/AreaElement.js +1 -0
  23. package/LineChart/LineChart.d.ts +1 -0
  24. package/LineChart/LineChart.js +13 -9
  25. package/LineChart/LineElement.d.ts +7 -4
  26. package/LineChart/LineElement.js +1 -0
  27. package/LineChart/LineHighlightElement.d.ts +3 -2
  28. package/LineChart/LineHighlightElement.js +2 -1
  29. package/LineChart/MarkElement.d.ts +3 -2
  30. package/LineChart/MarkElement.js +1 -0
  31. package/PieChart/PieArc.d.ts +3 -2
  32. package/PieChart/PieArc.js +1 -0
  33. package/PieChart/PieArcLabel.d.ts +3 -2
  34. package/PieChart/PieArcLabel.js +1 -0
  35. package/PieChart/PieArcLabelPlot.d.ts +5 -0
  36. package/PieChart/PieArcLabelPlot.js +3 -1
  37. package/PieChart/PieArcPlot.d.ts +5 -0
  38. package/PieChart/PieArcPlot.js +2 -1
  39. package/PieChart/PieChart.d.ts +14 -2
  40. package/PieChart/PieChart.js +14 -11
  41. package/ScatterChart/Scatter.js +1 -1
  42. package/ScatterChart/ScatterChart.js +12 -9
  43. package/SparkLineChart/SparkLineChart.d.ts +15 -1
  44. package/SparkLineChart/SparkLineChart.js +11 -3
  45. package/context/CartesianContextProvider.d.ts +1 -1
  46. package/context/CartesianContextProvider.js +15 -12
  47. package/context/DrawingProvider.d.ts +1 -1
  48. package/context/DrawingProvider.js +8 -7
  49. package/context/HighlightProvider.d.ts +2 -2
  50. package/context/HighlightProvider.js +4 -3
  51. package/context/InteractionProvider.d.ts +4 -4
  52. package/context/InteractionProvider.js +4 -3
  53. package/context/SeriesContextProvider.d.ts +3 -1
  54. package/context/SeriesContextProvider.js +7 -6
  55. package/esm/BarChart/BarChart.js +12 -9
  56. package/esm/BarChart/BarElement.js +1 -0
  57. package/esm/BarChart/BarPlot.js +8 -10
  58. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  59. package/esm/ChartsLegend/ChartsLegend.js +38 -2
  60. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +8 -4
  61. package/esm/ChartsSurface.js +35 -2
  62. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
  63. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
  64. package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
  65. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
  66. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
  67. package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
  68. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  69. package/esm/LineChart/AreaElement.js +1 -0
  70. package/esm/LineChart/LineChart.js +13 -9
  71. package/esm/LineChart/LineElement.js +1 -0
  72. package/esm/LineChart/LineHighlightElement.js +2 -1
  73. package/esm/LineChart/MarkElement.js +1 -0
  74. package/esm/PieChart/PieArc.js +1 -0
  75. package/esm/PieChart/PieArcLabel.js +1 -0
  76. package/esm/PieChart/PieArcLabelPlot.js +3 -1
  77. package/esm/PieChart/PieArcPlot.js +2 -1
  78. package/esm/PieChart/PieChart.js +14 -11
  79. package/esm/ScatterChart/Scatter.js +1 -1
  80. package/esm/ScatterChart/ScatterChart.js +12 -9
  81. package/esm/SparkLineChart/SparkLineChart.js +11 -3
  82. package/esm/context/CartesianContextProvider.js +15 -12
  83. package/esm/context/DrawingProvider.js +8 -7
  84. package/esm/context/HighlightProvider.js +6 -4
  85. package/esm/context/InteractionProvider.js +6 -4
  86. package/esm/context/SeriesContextProvider.js +9 -7
  87. package/esm/hooks/useDrawingArea.js +7 -3
  88. package/esm/index.js +2 -0
  89. package/hooks/useDrawingArea.d.ts +2 -0
  90. package/hooks/useDrawingArea.js +7 -3
  91. package/index.d.ts +2 -0
  92. package/index.js +23 -1
  93. package/internals/defaultizeColor.d.ts +15 -15
  94. package/internals/defaultizeValueFormatter.d.ts +4 -7
  95. package/internals/stackSeries.d.ts +4 -7
  96. package/legacy/BarChart/BarChart.js +12 -9
  97. package/legacy/BarChart/BarElement.js +1 -0
  98. package/legacy/BarChart/BarPlot.js +10 -10
  99. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  100. package/legacy/ChartsLegend/ChartsLegend.js +38 -2
  101. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +6 -4
  102. package/legacy/ChartsReferenceLine/common.js +3 -4
  103. package/legacy/ChartsSurface.js +35 -2
  104. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
  105. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
  106. package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
  107. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
  108. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
  109. package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
  110. package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
  111. package/legacy/LineChart/AreaElement.js +1 -0
  112. package/legacy/LineChart/LineChart.js +13 -9
  113. package/legacy/LineChart/LineElement.js +1 -0
  114. package/legacy/LineChart/LineHighlightElement.js +2 -1
  115. package/legacy/LineChart/MarkElement.js +1 -0
  116. package/legacy/PieChart/PieArc.js +1 -0
  117. package/legacy/PieChart/PieArcLabel.js +1 -0
  118. package/legacy/PieChart/PieArcLabelPlot.js +3 -1
  119. package/legacy/PieChart/PieArcPlot.js +2 -1
  120. package/legacy/PieChart/PieChart.js +14 -11
  121. package/legacy/ScatterChart/Scatter.js +1 -1
  122. package/legacy/ScatterChart/ScatterChart.js +12 -9
  123. package/legacy/SparkLineChart/SparkLineChart.js +11 -3
  124. package/legacy/context/CartesianContextProvider.js +23 -21
  125. package/legacy/context/DrawingProvider.js +6 -6
  126. package/legacy/context/HighlightProvider.js +4 -3
  127. package/legacy/context/InteractionProvider.js +4 -3
  128. package/legacy/context/SeriesContextProvider.js +8 -7
  129. package/legacy/hooks/useDrawingArea.js +7 -3
  130. package/legacy/index.js +3 -1
  131. package/legacy/internals/components/AxisSharedComponents.js +5 -6
  132. package/models/axis.d.ts +7 -2
  133. package/models/seriesType/common.d.ts +2 -1
  134. package/models/seriesType/config.d.ts +7 -12
  135. package/models/seriesType/line.d.ts +2 -2
  136. package/models/seriesType/pie.d.ts +8 -3
  137. package/models/seriesType/scatter.d.ts +5 -2
  138. package/modern/BarChart/BarChart.js +12 -9
  139. package/modern/BarChart/BarElement.js +1 -0
  140. package/modern/BarChart/BarPlot.js +8 -10
  141. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  142. package/modern/ChartsLegend/ChartsLegend.js +38 -2
  143. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +8 -4
  144. package/modern/ChartsSurface.js +35 -2
  145. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
  146. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
  147. package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
  148. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
  149. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
  150. package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
  151. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  152. package/modern/LineChart/AreaElement.js +1 -0
  153. package/modern/LineChart/LineChart.js +13 -9
  154. package/modern/LineChart/LineElement.js +1 -0
  155. package/modern/LineChart/LineHighlightElement.js +2 -1
  156. package/modern/LineChart/MarkElement.js +1 -0
  157. package/modern/PieChart/PieArc.js +1 -0
  158. package/modern/PieChart/PieArcLabel.js +1 -0
  159. package/modern/PieChart/PieArcLabelPlot.js +3 -1
  160. package/modern/PieChart/PieArcPlot.js +2 -1
  161. package/modern/PieChart/PieChart.js +14 -11
  162. package/modern/ScatterChart/Scatter.js +1 -1
  163. package/modern/ScatterChart/ScatterChart.js +12 -9
  164. package/modern/SparkLineChart/SparkLineChart.js +11 -3
  165. package/modern/context/CartesianContextProvider.js +15 -12
  166. package/modern/context/DrawingProvider.js +8 -7
  167. package/modern/context/HighlightProvider.js +6 -4
  168. package/modern/context/InteractionProvider.js +6 -4
  169. package/modern/context/SeriesContextProvider.js +9 -7
  170. package/modern/hooks/useDrawingArea.js +7 -3
  171. package/modern/index.js +3 -1
  172. package/package.json +1 -1
@@ -108,10 +108,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
108
108
  /**
109
109
  * Indicate which axis to display the bottom of the charts.
110
110
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
111
- * @default xAxisIds[0] The id of the first provided axis
111
+ * @default null
112
112
  */
113
113
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
114
- axisId: PropTypes.string,
114
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
115
115
  classes: PropTypes.object,
116
116
  disableLine: PropTypes.bool,
117
117
  disableTicks: PropTypes.bool,
@@ -136,6 +136,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
136
136
  className: PropTypes.string,
137
137
  /**
138
138
  * Color palette used to colorize multiple series.
139
+ * @default blueberryTwilightPalette
139
140
  */
140
141
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
141
142
  /**
@@ -157,10 +158,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
157
158
  /**
158
159
  * Indicate which axis to display the left of the charts.
159
160
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
160
- * @default yAxisIds[0] The id of the first provided axis
161
+ * @default null
161
162
  */
162
163
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
163
- axisId: PropTypes.string,
164
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
164
165
  classes: PropTypes.object,
165
166
  disableLine: PropTypes.bool,
166
167
  disableTicks: PropTypes.bool,
@@ -214,7 +215,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
214
215
  * @default null
215
216
  */
216
217
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
217
- axisId: PropTypes.string,
218
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
218
219
  classes: PropTypes.object,
219
220
  disableLine: PropTypes.bool,
220
221
  disableTicks: PropTypes.bool,
@@ -272,7 +273,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
272
273
  faded: PropTypes.oneOf(['global', 'none', 'series']),
273
274
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
274
275
  }),
275
- id: PropTypes.string,
276
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
276
277
  innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
277
278
  outerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
278
279
  paddingAngle: PropTypes.number,
@@ -308,7 +309,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
308
309
  * @default null
309
310
  */
310
311
  topAxis: PropTypes.oneOfType([PropTypes.shape({
311
- axisId: PropTypes.string,
312
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
312
313
  classes: PropTypes.object,
313
314
  disableLine: PropTypes.bool,
314
315
  disableTicks: PropTypes.bool,
@@ -345,7 +346,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
345
346
  * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
346
347
  */
347
348
  xAxis: PropTypes.arrayOf(PropTypes.shape({
348
- axisId: PropTypes.string,
349
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
349
350
  classes: PropTypes.object,
350
351
  data: PropTypes.array,
351
352
  dataKey: PropTypes.string,
@@ -353,13 +354,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
353
354
  disableTicks: PropTypes.bool,
354
355
  fill: PropTypes.string,
355
356
  hideTooltip: PropTypes.bool,
356
- id: PropTypes.string,
357
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
357
358
  label: PropTypes.string,
358
359
  labelFontSize: PropTypes.number,
359
360
  labelStyle: PropTypes.object,
360
361
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
361
362
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
362
363
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
364
+ reverse: PropTypes.bool,
363
365
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
364
366
  slotProps: PropTypes.object,
365
367
  slots: PropTypes.object,
@@ -379,7 +381,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
379
381
  * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
380
382
  */
381
383
  yAxis: PropTypes.arrayOf(PropTypes.shape({
382
- axisId: PropTypes.string,
384
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
383
385
  classes: PropTypes.object,
384
386
  data: PropTypes.array,
385
387
  dataKey: PropTypes.string,
@@ -387,13 +389,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
387
389
  disableTicks: PropTypes.bool,
388
390
  fill: PropTypes.string,
389
391
  hideTooltip: PropTypes.bool,
390
- id: PropTypes.string,
392
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
391
393
  label: PropTypes.string,
392
394
  labelFontSize: PropTypes.number,
393
395
  labelStyle: PropTypes.object,
394
396
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
395
397
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
396
398
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
399
+ reverse: PropTypes.bool,
397
400
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
398
401
  slotProps: PropTypes.object,
399
402
  slots: PropTypes.object,
@@ -88,7 +88,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
88
88
  faded: PropTypes.oneOf(['global', 'none', 'series']),
89
89
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
90
90
  }),
91
- id: PropTypes.string.isRequired,
91
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
92
92
  label: PropTypes.string,
93
93
  markerSize: PropTypes.number,
94
94
  type: PropTypes.oneOf(['scatter']).isRequired,
@@ -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,
91
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
92
92
  classes: PropTypes.object,
93
93
  disableLine: PropTypes.bool,
94
94
  disableTicks: PropTypes.bool,
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
113
113
  className: PropTypes.string,
114
114
  /**
115
115
  * Color palette used to colorize multiple series.
116
+ * @default blueberryTwilightPalette
116
117
  */
117
118
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
118
119
  /**
@@ -137,7 +138,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
137
138
  * @default yAxisIds[0] The id of the first provided axis
138
139
  */
139
140
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
140
- axisId: PropTypes.string,
141
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
141
142
  classes: PropTypes.object,
142
143
  disableLine: PropTypes.bool,
143
144
  disableTicks: PropTypes.bool,
@@ -190,7 +191,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
190
191
  * @default null
191
192
  */
192
193
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
193
- axisId: PropTypes.string,
194
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
194
195
  classes: PropTypes.object,
195
196
  disableLine: PropTypes.bool,
196
197
  disableTicks: PropTypes.bool,
@@ -222,7 +223,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
222
223
  faded: PropTypes.oneOf(['global', 'none', 'series']),
223
224
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
224
225
  }),
225
- id: PropTypes.string,
226
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
226
227
  label: PropTypes.string,
227
228
  markerSize: PropTypes.number,
228
229
  type: PropTypes.oneOf(['scatter']),
@@ -256,7 +257,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
256
257
  * @default null
257
258
  */
258
259
  topAxis: PropTypes.oneOfType([PropTypes.shape({
259
- axisId: PropTypes.string,
260
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
260
261
  classes: PropTypes.object,
261
262
  disableLine: PropTypes.bool,
262
263
  disableTicks: PropTypes.bool,
@@ -293,7 +294,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
293
294
  * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
294
295
  */
295
296
  xAxis: PropTypes.arrayOf(PropTypes.shape({
296
- axisId: PropTypes.string,
297
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
297
298
  classes: PropTypes.object,
298
299
  data: PropTypes.array,
299
300
  dataKey: PropTypes.string,
@@ -301,13 +302,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
301
302
  disableTicks: PropTypes.bool,
302
303
  fill: PropTypes.string,
303
304
  hideTooltip: PropTypes.bool,
304
- id: PropTypes.string,
305
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
305
306
  label: PropTypes.string,
306
307
  labelFontSize: PropTypes.number,
307
308
  labelStyle: PropTypes.object,
308
309
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
309
310
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
310
311
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
312
+ reverse: PropTypes.bool,
311
313
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
312
314
  slotProps: PropTypes.object,
313
315
  slots: PropTypes.object,
@@ -327,7 +329,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
327
329
  * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
328
330
  */
329
331
  yAxis: PropTypes.arrayOf(PropTypes.shape({
330
- axisId: PropTypes.string,
332
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
331
333
  classes: PropTypes.object,
332
334
  data: PropTypes.array,
333
335
  dataKey: PropTypes.string,
@@ -335,13 +337,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
335
337
  disableTicks: PropTypes.bool,
336
338
  fill: PropTypes.string,
337
339
  hideTooltip: PropTypes.bool,
338
- id: PropTypes.string,
340
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
339
341
  label: PropTypes.string,
340
342
  labelFontSize: PropTypes.number,
341
343
  labelStyle: PropTypes.object,
342
344
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
343
345
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
344
346
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
347
+ reverse: PropTypes.bool,
345
348
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
346
349
  slotProps: PropTypes.object,
347
350
  slots: PropTypes.object,
@@ -119,6 +119,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
119
119
  className: PropTypes.string,
120
120
  /**
121
121
  * Color palette used to colorize multiple series.
122
+ * @default blueberryTwilightPalette
122
123
  */
123
124
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
124
125
  /**
@@ -149,7 +150,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
149
150
  * The margin between the SVG and the drawing area.
150
151
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
151
152
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
152
- * @default object Depends on the charts type.
153
+ * @default {
154
+ * top: 5,
155
+ * bottom: 5,
156
+ * left: 5,
157
+ * right: 5,
158
+ * }
153
159
  */
154
160
  margin: PropTypes.shape({
155
161
  bottom: PropTypes.number,
@@ -198,6 +204,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
198
204
  * Formatter used by the tooltip.
199
205
  * @param {number} value The value to format.
200
206
  * @returns {string} the formatted value.
207
+ * @default (v: number) => v.toString()
201
208
  */
202
209
  valueFormatter: PropTypes.func,
203
210
  viewBox: PropTypes.shape({
@@ -216,7 +223,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
216
223
  * Notice it is a single configuration object, not an array of configuration.
217
224
  */
218
225
  xAxis: PropTypes.shape({
219
- axisId: PropTypes.string,
226
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
220
227
  classes: PropTypes.object,
221
228
  data: PropTypes.array,
222
229
  dataKey: PropTypes.string,
@@ -224,13 +231,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
224
231
  disableTicks: PropTypes.bool,
225
232
  fill: PropTypes.string,
226
233
  hideTooltip: PropTypes.bool,
227
- id: PropTypes.string,
234
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
228
235
  label: PropTypes.string,
229
236
  labelFontSize: PropTypes.number,
230
237
  labelStyle: PropTypes.object,
231
238
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
232
239
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
233
240
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
241
+ reverse: PropTypes.bool,
234
242
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
235
243
  slotProps: PropTypes.object,
236
244
  slots: PropTypes.object,
@@ -38,12 +38,13 @@ export const CartesianContext = /*#__PURE__*/React.createContext({
38
38
  *
39
39
  * - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
40
40
  */
41
- function CartesianContextProvider({
42
- xAxis: inXAxis,
43
- yAxis: inYAxis,
44
- dataset,
45
- children
46
- }) {
41
+ function CartesianContextProvider(props) {
42
+ const {
43
+ xAxis: inXAxis,
44
+ yAxis: inYAxis,
45
+ dataset,
46
+ children
47
+ } = props;
47
48
  const formattedSeries = React.useContext(SeriesContext);
48
49
  const drawingArea = React.useContext(DrawingContext);
49
50
  const xAxis = React.useMemo(() => inXAxis == null ? void 0 : inXAxis.map(axisConfig => {
@@ -109,7 +110,7 @@ function CartesianContextProvider({
109
110
  var _axis$scaleType, _axis$min, _axis$max, _axis$min2, _axis$max2;
110
111
  const isDefaultAxis = axisIndex === 0;
111
112
  const [minData, maxData] = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis);
112
- const range = [drawingArea.left, drawingArea.left + drawingArea.width];
113
+ const range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
113
114
  if (isBandScaleConfig(axis)) {
114
115
  var _axis$categoryGapRati, _axis$barGapRatio;
115
116
  const categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
@@ -160,7 +161,7 @@ function CartesianContextProvider({
160
161
  var _axis$scaleType2, _axis$min3, _axis$max3, _axis$min4, _axis$max4;
161
162
  const isDefaultAxis = axisIndex === 0;
162
163
  const [minData, maxData] = getAxisExtremum(axis, yExtremumGetters, isDefaultAxis);
163
- const range = [drawingArea.top + drawingArea.height, drawingArea.top];
164
+ const range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
164
165
  if (isBandScaleConfig(axis)) {
165
166
  var _axis$categoryGapRati2;
166
167
  const categoryGapRatio = (_axis$categoryGapRati2 = axis.categoryGapRatio) != null ? _axis$categoryGapRati2 : DEFAULT_CATEGORY_GAP_RATIO;
@@ -230,7 +231,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
230
231
  * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
231
232
  */
232
233
  xAxis: PropTypes.arrayOf(PropTypes.shape({
233
- axisId: PropTypes.string,
234
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
234
235
  classes: PropTypes.object,
235
236
  data: PropTypes.array,
236
237
  dataKey: PropTypes.string,
@@ -238,13 +239,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
238
239
  disableTicks: PropTypes.bool,
239
240
  fill: PropTypes.string,
240
241
  hideTooltip: PropTypes.bool,
241
- id: PropTypes.string,
242
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
242
243
  label: PropTypes.string,
243
244
  labelFontSize: PropTypes.number,
244
245
  labelStyle: PropTypes.object,
245
246
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
246
247
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
247
248
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
249
+ reverse: PropTypes.bool,
248
250
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
249
251
  slotProps: PropTypes.object,
250
252
  slots: PropTypes.object,
@@ -264,7 +266,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
264
266
  * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
265
267
  */
266
268
  yAxis: PropTypes.arrayOf(PropTypes.shape({
267
- axisId: PropTypes.string,
269
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
268
270
  classes: PropTypes.object,
269
271
  data: PropTypes.array,
270
272
  dataKey: PropTypes.string,
@@ -272,13 +274,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
272
274
  disableTicks: PropTypes.bool,
273
275
  fill: PropTypes.string,
274
276
  hideTooltip: PropTypes.bool,
275
- id: PropTypes.string,
277
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
276
278
  label: PropTypes.string,
277
279
  labelFontSize: PropTypes.number,
278
280
  labelStyle: PropTypes.object,
279
281
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
280
282
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
281
283
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
284
+ reverse: PropTypes.bool,
282
285
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
283
286
  slotProps: PropTypes.object,
284
287
  slots: PropTypes.object,
@@ -23,13 +23,14 @@ export const SVGContext = /*#__PURE__*/React.createContext({
23
23
  *
24
24
  * - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
25
25
  */
26
- function DrawingProvider({
27
- width,
28
- height,
29
- margin,
30
- svgRef,
31
- children
32
- }) {
26
+ function DrawingProvider(props) {
27
+ const {
28
+ width,
29
+ height,
30
+ margin,
31
+ svgRef,
32
+ children
33
+ } = props;
33
34
  const drawingArea = useChartDimensions(width, height, margin);
34
35
  return /*#__PURE__*/_jsx(SVGContext.Provider, {
35
36
  value: svgRef,
@@ -29,9 +29,10 @@ const dataReducer = (prevState, action) => {
29
29
  return prevState;
30
30
  }
31
31
  };
32
- export function HighlightProvider({
33
- children
34
- }) {
32
+ function HighlightProvider(props) {
33
+ const {
34
+ children
35
+ } = props;
35
36
  const [data, dispatch] = React.useReducer(dataReducer, {
36
37
  item: null,
37
38
  scope: defaultScope
@@ -43,4 +44,5 @@ export function HighlightProvider({
43
44
  value: value,
44
45
  children: children
45
46
  });
46
- }
47
+ }
48
+ export { HighlightProvider };
@@ -31,9 +31,10 @@ const dataReducer = (prevState, action) => {
31
31
  return prevState;
32
32
  }
33
33
  };
34
- export function InteractionProvider({
35
- children
36
- }) {
34
+ function InteractionProvider(props) {
35
+ const {
36
+ children
37
+ } = props;
37
38
  const [data, dispatch] = React.useReducer(dataReducer, {
38
39
  item: null,
39
40
  axis: {
@@ -48,4 +49,5 @@ export function InteractionProvider({
48
49
  value: value,
49
50
  children: children
50
51
  });
51
- }
52
+ }
53
+ export { InteractionProvider };
@@ -57,16 +57,18 @@ const formatSeries = (series, colors, dataset) => {
57
57
  });
58
58
  return formattedSeries;
59
59
  };
60
- export function SeriesContextProvider({
61
- series,
62
- dataset,
63
- colors = blueberryTwilightPalette,
64
- children
65
- }) {
60
+ function SeriesContextProvider(props) {
61
+ const {
62
+ series,
63
+ dataset,
64
+ colors = blueberryTwilightPalette,
65
+ children
66
+ } = props;
66
67
  const theme = useTheme();
67
68
  const formattedSeries = React.useMemo(() => formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset), [series, colors, theme.palette.mode, dataset]);
68
69
  return /*#__PURE__*/_jsx(SeriesContext.Provider, {
69
70
  value: formattedSeries,
70
71
  children: children
71
72
  });
72
- }
73
+ }
74
+ export { SeriesContextProvider };
@@ -5,12 +5,16 @@ export function useDrawingArea() {
5
5
  left,
6
6
  top,
7
7
  width,
8
- height
8
+ height,
9
+ bottom,
10
+ right
9
11
  } = React.useContext(DrawingContext);
10
12
  return React.useMemo(() => ({
11
13
  left,
12
14
  top,
13
15
  width,
14
- height
15
- }), [height, left, top, width]);
16
+ height,
17
+ bottom,
18
+ right
19
+ }), [height, left, top, width, bottom, right]);
16
20
  }
package/esm/index.js CHANGED
@@ -17,4 +17,6 @@ export * from './PieChart';
17
17
  export * from './ScatterChart';
18
18
  export * from './SparkLineChart';
19
19
  export * from './ChartContainer';
20
+ export * from './ChartsSurface';
21
+ export * from './ChartsLegend';
20
22
  export * from './ResponsiveChartContainer';
@@ -3,4 +3,6 @@ export declare function useDrawingArea(): {
3
3
  top: number;
4
4
  width: number;
5
5
  height: number;
6
+ bottom: number;
7
+ right: number;
6
8
  };
@@ -13,12 +13,16 @@ function useDrawingArea() {
13
13
  left,
14
14
  top,
15
15
  width,
16
- height
16
+ height,
17
+ bottom,
18
+ right
17
19
  } = React.useContext(_DrawingProvider.DrawingContext);
18
20
  return React.useMemo(() => ({
19
21
  left,
20
22
  top,
21
23
  width,
22
- height
23
- }), [height, left, top, width]);
24
+ height,
25
+ bottom,
26
+ right
27
+ }), [height, left, top, width, bottom, right]);
24
28
  }
package/index.d.ts CHANGED
@@ -17,4 +17,6 @@ export * from './PieChart';
17
17
  export * from './ScatterChart';
18
18
  export * from './SparkLineChart';
19
19
  export * from './ChartContainer';
20
+ export * from './ChartsSurface';
21
+ export * from './ChartsLegend';
20
22
  export * from './ResponsiveChartContainer';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v6.19.1
2
+ * @mui/x-charts v6.19.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -219,6 +219,28 @@ Object.keys(_ChartContainer).forEach(function (key) {
219
219
  }
220
220
  });
221
221
  });
222
+ var _ChartsSurface = require("./ChartsSurface");
223
+ Object.keys(_ChartsSurface).forEach(function (key) {
224
+ if (key === "default" || key === "__esModule") return;
225
+ if (key in exports && exports[key] === _ChartsSurface[key]) return;
226
+ Object.defineProperty(exports, key, {
227
+ enumerable: true,
228
+ get: function () {
229
+ return _ChartsSurface[key];
230
+ }
231
+ });
232
+ });
233
+ var _ChartsLegend = require("./ChartsLegend");
234
+ Object.keys(_ChartsLegend).forEach(function (key) {
235
+ if (key === "default" || key === "__esModule") return;
236
+ if (key in exports && exports[key] === _ChartsLegend[key]) return;
237
+ Object.defineProperty(exports, key, {
238
+ enumerable: true,
239
+ get: function () {
240
+ return _ChartsLegend[key];
241
+ }
242
+ });
243
+ });
222
244
  var _ResponsiveChartContainer = require("./ResponsiveChartContainer");
223
245
  Object.keys(_ResponsiveChartContainer).forEach(function (key) {
224
246
  if (key === "default" || key === "__esModule") return;
@@ -4,7 +4,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
4
4
  color: string;
5
5
  label?: string | undefined;
6
6
  value: number;
7
- id?: string | number | undefined;
7
+ id?: import("../models/seriesType").PieItemId | undefined;
8
8
  }[];
9
9
  type: "pie";
10
10
  innerRadius?: string | number | undefined;
@@ -37,7 +37,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
37
37
  arcLabelRadius?: number | undefined;
38
38
  color?: string | undefined;
39
39
  } | undefined;
40
- id?: string | undefined;
40
+ id?: import("../models/seriesType/common").SeriesId | undefined;
41
41
  color?: string | undefined;
42
42
  valueFormatter?: ((value: import("../models/helpers").MakeOptional<import("../models/seriesType").PieValueType, "id">) => string) | undefined;
43
43
  highlightScope?: Partial<import("..").HighlightScope> | undefined;
@@ -48,7 +48,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
48
48
  label?: string | undefined;
49
49
  layout?: "horizontal" | "vertical" | undefined;
50
50
  stackOffset?: import("..").StackOffsetType | undefined;
51
- id?: string | undefined;
51
+ id?: import("../models/seriesType/common").SeriesId | undefined;
52
52
  color: string;
53
53
  valueFormatter?: ((value: number) => string) | undefined;
54
54
  highlightScope?: Partial<import("..").HighlightScope> | undefined;
@@ -56,6 +56,17 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
56
56
  yAxisKey?: string | undefined;
57
57
  stack?: string | undefined;
58
58
  stackOrder?: import("..").StackOrderType | undefined;
59
+ } | {
60
+ type: "scatter";
61
+ data: import("../models/seriesType").ScatterValueType[];
62
+ markerSize?: number | undefined;
63
+ label?: string | undefined;
64
+ id?: import("../models/seriesType/common").SeriesId | undefined;
65
+ color: string;
66
+ valueFormatter?: ((value: import("../models/seriesType").ScatterValueType) => string) | undefined;
67
+ highlightScope?: Partial<import("..").HighlightScope> | undefined;
68
+ xAxisKey?: string | undefined;
69
+ yAxisKey?: string | undefined;
59
70
  } | {
60
71
  type: "line";
61
72
  data?: (number | null)[] | undefined;
@@ -68,22 +79,11 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
68
79
  disableHighlight?: boolean | undefined;
69
80
  connectNulls?: boolean | undefined;
70
81
  stackOffset?: import("..").StackOffsetType | undefined;
71
- id?: string | undefined;
82
+ id?: import("../models/seriesType/common").SeriesId | undefined;
72
83
  color: string;
73
84
  valueFormatter?: ((value: number) => string) | undefined;
74
85
  highlightScope?: Partial<import("..").HighlightScope> | undefined;
75
86
  xAxisKey?: string | undefined;
76
87
  yAxisKey?: string | undefined;
77
88
  stackOrder?: import("..").StackOrderType | undefined;
78
- } | {
79
- type: "scatter";
80
- data: import("../models/seriesType").ScatterValueType[];
81
- markerSize?: number | undefined;
82
- label?: string | undefined;
83
- id?: string | undefined;
84
- color: string;
85
- valueFormatter?: ((value: import("../models/seriesType").ScatterValueType) => string) | undefined;
86
- highlightScope?: Partial<import("..").HighlightScope> | undefined;
87
- xAxisKey?: string | undefined;
88
- yAxisKey?: string | undefined;
89
89
  };
@@ -1,10 +1,7 @@
1
+ import { SeriesId } from '../models/seriesType/common';
1
2
  declare function defaultizeValueFormatter<ISeries extends {
2
3
  valueFormatter?: IFormatter;
3
- }, IFormatter extends (v: any) => string>(series: {
4
- [id: string]: ISeries;
5
- }, defaultValueFormatter: IFormatter): {
6
- [id: string]: ISeries & {
7
- valueFormatter: IFormatter;
8
- };
9
- };
4
+ }, IFormatter extends (v: any) => string>(series: Record<SeriesId, ISeries>, defaultValueFormatter: IFormatter): Record<SeriesId, ISeries & {
5
+ valueFormatter: IFormatter;
6
+ }>;
10
7
  export default defaultizeValueFormatter;