@mui/x-charts 8.9.0 → 8.10.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 (128) hide show
  1. package/BarChart/BarChart.js +110 -1
  2. package/BarChart/BarClipPath.d.ts +17 -12
  3. package/BarChart/BarClipPath.js +70 -57
  4. package/BarChart/BarPlot.js +4 -0
  5. package/BarChart/seriesConfig/extremums.js +2 -3
  6. package/BarChart/useBarChartProps.d.ts +1 -1
  7. package/CHANGELOG.md +245 -6
  8. package/ChartContainer/ChartContainer.js +165 -0
  9. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -3
  10. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -3
  11. package/ChartsTooltip/ChartsTooltip.d.ts +2 -1
  12. package/ChartsTooltip/ChartsTooltip.js +3 -3
  13. package/ChartsTooltip/ChartsTooltipContainer.d.ts +5 -5
  14. package/ChartsTooltip/ChartsTooltipContainer.js +3 -3
  15. package/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.d.ts +13 -4
  16. package/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.js +33 -7
  17. package/ChartsXAxis/ChartsGroupedXAxis.d.ts +7 -0
  18. package/ChartsXAxis/ChartsGroupedXAxis.js +142 -0
  19. package/ChartsXAxis/ChartsSingleXAxis.d.ts +7 -0
  20. package/ChartsXAxis/ChartsSingleXAxis.js +144 -0
  21. package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
  22. package/ChartsXAxis/ChartsXAxis.js +8 -210
  23. package/ChartsXAxis/getVisibleLabels.d.ts +2 -2
  24. package/ChartsXAxis/useAxisProps.d.ts +4526 -0
  25. package/ChartsXAxis/useAxisProps.js +105 -0
  26. package/ChartsXAxis/utilities.d.ts +11 -0
  27. package/ChartsXAxis/utilities.js +43 -0
  28. package/LineChart/LineChart.js +110 -1
  29. package/LineChart/seriesConfig/extremums.js +2 -3
  30. package/LineChart/useLineChartProps.d.ts +1 -1
  31. package/PieChart/PieChart.js +1 -1
  32. package/RadarChart/RadarChart.d.ts +1 -1
  33. package/RadarChart/RadarChart.js +1 -1
  34. package/RadarChart/index.d.ts +9 -2
  35. package/RadarChart/index.js +13 -14
  36. package/RadarChart/useRadarChartProps.d.ts +1 -1
  37. package/ScatterChart/ScatterChart.d.ts +8 -1
  38. package/ScatterChart/ScatterChart.js +110 -1
  39. package/ScatterChart/seriesConfig/extremums.js +50 -23
  40. package/ScatterChart/useScatterChartProps.d.ts +1 -1
  41. package/SparkLineChart/SparkLineChart.js +109 -0
  42. package/esm/BarChart/BarChart.js +110 -1
  43. package/esm/BarChart/BarClipPath.d.ts +17 -12
  44. package/esm/BarChart/BarClipPath.js +69 -55
  45. package/esm/BarChart/BarPlot.js +4 -0
  46. package/esm/BarChart/seriesConfig/extremums.js +2 -3
  47. package/esm/BarChart/useBarChartProps.d.ts +1 -1
  48. package/esm/ChartContainer/ChartContainer.js +165 -0
  49. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -3
  50. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -3
  51. package/esm/ChartsTooltip/ChartsTooltip.d.ts +2 -1
  52. package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
  53. package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +5 -5
  54. package/esm/ChartsTooltip/ChartsTooltipContainer.js +3 -3
  55. package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.d.ts +13 -4
  56. package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.js +31 -6
  57. package/esm/ChartsXAxis/ChartsGroupedXAxis.d.ts +7 -0
  58. package/esm/ChartsXAxis/ChartsGroupedXAxis.js +136 -0
  59. package/esm/ChartsXAxis/ChartsSingleXAxis.d.ts +7 -0
  60. package/esm/ChartsXAxis/ChartsSingleXAxis.js +140 -0
  61. package/esm/ChartsXAxis/ChartsXAxis.d.ts +1 -1
  62. package/esm/ChartsXAxis/ChartsXAxis.js +7 -207
  63. package/esm/ChartsXAxis/getVisibleLabels.d.ts +2 -2
  64. package/esm/ChartsXAxis/useAxisProps.d.ts +4526 -0
  65. package/esm/ChartsXAxis/useAxisProps.js +98 -0
  66. package/esm/ChartsXAxis/utilities.d.ts +11 -0
  67. package/esm/ChartsXAxis/utilities.js +35 -0
  68. package/esm/LineChart/LineChart.js +110 -1
  69. package/esm/LineChart/seriesConfig/extremums.js +2 -3
  70. package/esm/LineChart/useLineChartProps.d.ts +1 -1
  71. package/esm/PieChart/PieChart.js +1 -1
  72. package/esm/RadarChart/RadarChart.d.ts +1 -1
  73. package/esm/RadarChart/RadarChart.js +1 -1
  74. package/esm/RadarChart/index.d.ts +9 -2
  75. package/esm/RadarChart/index.js +12 -2
  76. package/esm/RadarChart/useRadarChartProps.d.ts +1 -1
  77. package/esm/ScatterChart/ScatterChart.d.ts +8 -1
  78. package/esm/ScatterChart/ScatterChart.js +110 -1
  79. package/esm/ScatterChart/seriesConfig/extremums.js +50 -23
  80. package/esm/ScatterChart/useScatterChartProps.d.ts +1 -1
  81. package/esm/SparkLineChart/SparkLineChart.js +109 -0
  82. package/esm/hooks/useTicksGrouped.d.ts +28 -0
  83. package/esm/hooks/useTicksGrouped.js +98 -0
  84. package/esm/index.d.ts +2 -1
  85. package/esm/index.js +6 -2
  86. package/esm/internals/findMinMax.d.ts +1 -0
  87. package/esm/internals/findMinMax.js +13 -0
  88. package/esm/internals/getScale.d.ts +1 -1
  89. package/esm/internals/getScale.js +3 -0
  90. package/esm/internals/index.d.ts +1 -1
  91. package/esm/internals/index.js +1 -1
  92. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -1
  93. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -1
  94. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +32 -23
  95. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +1 -1
  96. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +17 -12
  97. package/esm/internals/symlogScale.d.ts +2 -0
  98. package/esm/internals/symlogScale.js +94 -0
  99. package/esm/models/axis.d.ts +81 -4
  100. package/esm/models/axis.js +3 -0
  101. package/hooks/useTicksGrouped.d.ts +28 -0
  102. package/hooks/useTicksGrouped.js +104 -0
  103. package/index.d.ts +2 -1
  104. package/index.js +13 -1
  105. package/internals/findMinMax.d.ts +1 -0
  106. package/internals/findMinMax.js +19 -0
  107. package/internals/getScale.d.ts +1 -1
  108. package/internals/getScale.js +3 -0
  109. package/internals/index.d.ts +1 -1
  110. package/internals/index.js +12 -12
  111. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -0
  112. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -1
  113. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +34 -23
  114. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +1 -1
  115. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +17 -12
  116. package/internals/symlogScale.d.ts +2 -0
  117. package/internals/symlogScale.js +100 -0
  118. package/models/axis.d.ts +81 -4
  119. package/models/axis.js +4 -0
  120. package/package.json +5 -7
  121. package/BarChart/getRadius.d.ts +0 -20
  122. package/BarChart/getRadius.js +0 -37
  123. package/esm/BarChart/getRadius.d.ts +0 -20
  124. package/esm/BarChart/getRadius.js +0 -30
  125. /package/{esm/internals/components/ChartsWrapper → ChartsWrapper}/index.d.ts +0 -0
  126. /package/{internals/components/ChartsWrapper → ChartsWrapper}/index.js +0 -0
  127. /package/{internals/components → esm}/ChartsWrapper/index.d.ts +0 -0
  128. /package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/index.js +0 -0
@@ -8,7 +8,7 @@ import { ChartsOverlayProps } from "../ChartsOverlay/index.js";
8
8
  import { ChartsAxisProps } from "../ChartsAxis/index.js";
9
9
  import { ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.js";
10
10
  import { ChartsLegendSlotExtension } from "../ChartsLegend/index.js";
11
- import type { ChartsWrapperProps } from "../internals/components/ChartsWrapper/index.js";
11
+ import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
12
12
  import { BarChartPluginsSignatures } from "./BarChart.plugins.js";
13
13
  /**
14
14
  * A helper function that extracts BarChartProps from the input props
@@ -234,6 +234,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
234
234
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
235
235
  endAngle: PropTypes.number,
236
236
  fill: PropTypes.string,
237
+ groups: PropTypes.arrayOf(PropTypes.shape({
238
+ getValue: PropTypes.func.isRequired,
239
+ tickSize: PropTypes.number
240
+ })),
237
241
  height: PropTypes.number,
238
242
  hideTooltip: PropTypes.bool,
239
243
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
@@ -286,6 +290,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
286
290
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
287
291
  endAngle: PropTypes.number,
288
292
  fill: PropTypes.string,
293
+ groups: PropTypes.arrayOf(PropTypes.shape({
294
+ getValue: PropTypes.func.isRequired,
295
+ tickSize: PropTypes.number
296
+ })),
289
297
  height: PropTypes.number,
290
298
  hideTooltip: PropTypes.bool,
291
299
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
@@ -361,6 +369,54 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
361
369
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
362
370
  tickSize: PropTypes.number,
363
371
  valueFormatter: PropTypes.func
372
+ }), PropTypes.shape({
373
+ classes: PropTypes.object,
374
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
375
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
376
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
377
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
378
+ type: PropTypes.oneOf(['continuous']).isRequired
379
+ }), PropTypes.shape({
380
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
381
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
382
+ type: PropTypes.oneOf(['piecewise']).isRequired
383
+ })]),
384
+ constant: PropTypes.number,
385
+ data: PropTypes.array,
386
+ dataKey: PropTypes.string,
387
+ disableLine: PropTypes.bool,
388
+ disableTicks: PropTypes.bool,
389
+ domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
390
+ endAngle: PropTypes.number,
391
+ fill: PropTypes.string,
392
+ height: PropTypes.number,
393
+ hideTooltip: PropTypes.bool,
394
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
395
+ ignoreTooltip: PropTypes.bool,
396
+ label: PropTypes.string,
397
+ labelGap: PropTypes.number,
398
+ labelStyle: PropTypes.object,
399
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
400
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
401
+ offset: PropTypes.number,
402
+ position: PropTypes.oneOf(['bottom', 'none', 'top']),
403
+ reverse: PropTypes.bool,
404
+ scaleType: PropTypes.oneOf(['symlog']),
405
+ slotProps: PropTypes.object,
406
+ slots: PropTypes.object,
407
+ startAngle: PropTypes.number,
408
+ stroke: PropTypes.string,
409
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
410
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
411
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
412
+ tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
413
+ tickLabelStyle: PropTypes.object,
414
+ tickMaxStep: PropTypes.number,
415
+ tickMinStep: PropTypes.number,
416
+ tickNumber: PropTypes.number,
417
+ tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
418
+ tickSize: PropTypes.number,
419
+ valueFormatter: PropTypes.func
364
420
  }), PropTypes.shape({
365
421
  classes: PropTypes.object,
366
422
  colorMap: PropTypes.oneOfType([PropTypes.shape({
@@ -659,6 +715,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
659
715
  disableTicks: PropTypes.bool,
660
716
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
661
717
  fill: PropTypes.string,
718
+ groups: PropTypes.arrayOf(PropTypes.shape({
719
+ getValue: PropTypes.func.isRequired,
720
+ tickSize: PropTypes.number
721
+ })),
662
722
  height: PropTypes.number,
663
723
  hideTooltip: PropTypes.bool,
664
724
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -710,6 +770,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
710
770
  disableTicks: PropTypes.bool,
711
771
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
712
772
  fill: PropTypes.string,
773
+ groups: PropTypes.arrayOf(PropTypes.shape({
774
+ getValue: PropTypes.func.isRequired,
775
+ tickSize: PropTypes.number
776
+ })),
713
777
  height: PropTypes.number,
714
778
  hideTooltip: PropTypes.bool,
715
779
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -783,6 +847,53 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
783
847
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
784
848
  tickSize: PropTypes.number,
785
849
  valueFormatter: PropTypes.func
850
+ }), PropTypes.shape({
851
+ axis: PropTypes.oneOf(['x']),
852
+ classes: PropTypes.object,
853
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
854
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
855
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
856
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
857
+ type: PropTypes.oneOf(['continuous']).isRequired
858
+ }), PropTypes.shape({
859
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
860
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
861
+ type: PropTypes.oneOf(['piecewise']).isRequired
862
+ })]),
863
+ constant: PropTypes.number,
864
+ data: PropTypes.array,
865
+ dataKey: PropTypes.string,
866
+ disableLine: PropTypes.bool,
867
+ disableTicks: PropTypes.bool,
868
+ domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
869
+ fill: PropTypes.string,
870
+ height: PropTypes.number,
871
+ hideTooltip: PropTypes.bool,
872
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
873
+ ignoreTooltip: PropTypes.bool,
874
+ label: PropTypes.string,
875
+ labelStyle: PropTypes.object,
876
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
877
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
878
+ offset: PropTypes.number,
879
+ position: PropTypes.oneOf(['bottom', 'none', 'top']),
880
+ reverse: PropTypes.bool,
881
+ scaleType: PropTypes.oneOf(['symlog']),
882
+ slotProps: PropTypes.object,
883
+ slots: PropTypes.object,
884
+ stroke: PropTypes.string,
885
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
886
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
887
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
888
+ tickLabelMinGap: PropTypes.number,
889
+ tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
890
+ tickLabelStyle: PropTypes.object,
891
+ tickMaxStep: PropTypes.number,
892
+ tickMinStep: PropTypes.number,
893
+ tickNumber: PropTypes.number,
894
+ tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
895
+ tickSize: PropTypes.number,
896
+ valueFormatter: PropTypes.func
786
897
  }), PropTypes.shape({
787
898
  axis: PropTypes.oneOf(['x']),
788
899
  classes: PropTypes.object,
@@ -1045,6 +1156,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
1045
1156
  disableTicks: PropTypes.bool,
1046
1157
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
1047
1158
  fill: PropTypes.string,
1159
+ groups: PropTypes.arrayOf(PropTypes.shape({
1160
+ getValue: PropTypes.func.isRequired,
1161
+ tickSize: PropTypes.number
1162
+ })),
1048
1163
  hideTooltip: PropTypes.bool,
1049
1164
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
1050
1165
  ignoreTooltip: PropTypes.bool,
@@ -1095,6 +1210,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
1095
1210
  disableTicks: PropTypes.bool,
1096
1211
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
1097
1212
  fill: PropTypes.string,
1213
+ groups: PropTypes.arrayOf(PropTypes.shape({
1214
+ getValue: PropTypes.func.isRequired,
1215
+ tickSize: PropTypes.number
1216
+ })),
1098
1217
  hideTooltip: PropTypes.bool,
1099
1218
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
1100
1219
  ignoreTooltip: PropTypes.bool,
@@ -1166,6 +1285,52 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
1166
1285
  tickSize: PropTypes.number,
1167
1286
  valueFormatter: PropTypes.func,
1168
1287
  width: PropTypes.number
1288
+ }), PropTypes.shape({
1289
+ axis: PropTypes.oneOf(['y']),
1290
+ classes: PropTypes.object,
1291
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
1292
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
1293
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
1294
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
1295
+ type: PropTypes.oneOf(['continuous']).isRequired
1296
+ }), PropTypes.shape({
1297
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
1298
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
1299
+ type: PropTypes.oneOf(['piecewise']).isRequired
1300
+ })]),
1301
+ constant: PropTypes.number,
1302
+ data: PropTypes.array,
1303
+ dataKey: PropTypes.string,
1304
+ disableLine: PropTypes.bool,
1305
+ disableTicks: PropTypes.bool,
1306
+ domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
1307
+ fill: PropTypes.string,
1308
+ hideTooltip: PropTypes.bool,
1309
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
1310
+ ignoreTooltip: PropTypes.bool,
1311
+ label: PropTypes.string,
1312
+ labelStyle: PropTypes.object,
1313
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
1314
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
1315
+ offset: PropTypes.number,
1316
+ position: PropTypes.oneOf(['left', 'none', 'right']),
1317
+ reverse: PropTypes.bool,
1318
+ scaleType: PropTypes.oneOf(['symlog']),
1319
+ slotProps: PropTypes.object,
1320
+ slots: PropTypes.object,
1321
+ stroke: PropTypes.string,
1322
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
1323
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
1324
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
1325
+ tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
1326
+ tickLabelStyle: PropTypes.object,
1327
+ tickMaxStep: PropTypes.number,
1328
+ tickMinStep: PropTypes.number,
1329
+ tickNumber: PropTypes.number,
1330
+ tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
1331
+ tickSize: PropTypes.number,
1332
+ valueFormatter: PropTypes.func,
1333
+ width: PropTypes.number
1169
1334
  }), PropTypes.shape({
1170
1335
  axis: PropTypes.oneOf(['y']),
1171
1336
  classes: PropTypes.object,
@@ -43,9 +43,7 @@ export default function ChartsXHighlight(props) {
43
43
  }
44
44
  }
45
45
  return /*#__PURE__*/_jsxs(React.Fragment, {
46
- children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
47
- // @ts-expect-error, xScale value is checked in the statement above
48
- , {
46
+ children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
49
47
  d: `M ${xScale(value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
50
48
  className: classes.root,
51
49
  ownerState: {
@@ -44,9 +44,7 @@ export default function ChartsYHighlight(props) {
44
44
  }
45
45
  return /*#__PURE__*/_jsxs(React.Fragment, {
46
46
  children: [isBandScaleY && yScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
47
- d: `M ${left} ${
48
- // @ts-expect-error, yScale value is checked in the statement above
49
- yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
47
+ d: `M ${left} ${yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
50
48
  className: classes.root,
51
49
  ownerState: {
52
50
  axisHighlight: 'band'
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ChartsTooltipContainerProps } from "./ChartsTooltipContainer.js";
3
- export interface ChartsTooltipProps extends Omit<ChartsTooltipContainerProps, 'children'> {}
3
+ import { TriggerOptions } from "./utils.js";
4
+ export interface ChartsTooltipProps<T extends TriggerOptions = TriggerOptions> extends Omit<ChartsTooltipContainerProps<T>, 'children'> {}
4
5
  /**
5
6
  * Demos:
6
7
  *
@@ -189,9 +189,9 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
189
189
  transition: PropTypes.bool,
190
190
  /**
191
191
  * Select the kind of tooltip to display
192
- * - 'item': Shows data about the item below the mouse.
193
- * - 'axis': Shows values associated with the hovered x value
194
- * - 'none': Does not display tooltip
192
+ * - 'item': Shows data about the item below the mouse;
193
+ * - 'axis': Shows values associated with the hovered x value;
194
+ * - 'none': Does not display tooltip.
195
195
  * @default 'axis'
196
196
  */
197
197
  trigger: PropTypes.oneOf(['axis', 'item', 'none'])
@@ -2,15 +2,15 @@ import * as React from 'react';
2
2
  import { PopperProps } from '@mui/material/Popper';
3
3
  import { TriggerOptions } from "./utils.js";
4
4
  import { ChartsTooltipClasses } from "./chartsTooltipClasses.js";
5
- export interface ChartsTooltipContainerProps extends Partial<PopperProps> {
5
+ export interface ChartsTooltipContainerProps<T extends TriggerOptions = TriggerOptions> extends Partial<PopperProps> {
6
6
  /**
7
7
  * Select the kind of tooltip to display
8
- * - 'item': Shows data about the item below the mouse.
9
- * - 'axis': Shows values associated with the hovered x value
10
- * - 'none': Does not display tooltip
8
+ * - 'item': Shows data about the item below the mouse;
9
+ * - 'axis': Shows values associated with the hovered x value;
10
+ * - 'none': Does not display tooltip.
11
11
  * @default 'axis'
12
12
  */
13
- trigger?: TriggerOptions;
13
+ trigger?: T;
14
14
  /**
15
15
  * Override or extend the styles applied to the component.
16
16
  */
@@ -295,9 +295,9 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
295
295
  transition: PropTypes.bool,
296
296
  /**
297
297
  * Select the kind of tooltip to display
298
- * - 'item': Shows data about the item below the mouse.
299
- * - 'axis': Shows values associated with the hovered x value
300
- * - 'none': Does not display tooltip
298
+ * - 'item': Shows data about the item below the mouse;
299
+ * - 'axis': Shows values associated with the hovered x value;
300
+ * - 'none': Does not display tooltip.
301
301
  * @default 'axis'
302
302
  */
303
303
  trigger: PropTypes.oneOf(['axis', 'item', 'none'])
@@ -1,9 +1,17 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps, Theme } from '@mui/material/styles';
3
- import { Direction } from "../../../ChartsLegend/index.js";
4
- import { Position } from "../../../models/index.js";
3
+ import { Direction } from "../ChartsLegend/index.js";
4
+ import { Position } from "../models/index.js";
5
5
  export interface ChartsWrapperProps {
6
+ /**
7
+ * The position of the legend.
8
+ * @default { horizontal: 'center', vertical: 'bottom' }
9
+ */
6
10
  legendPosition?: Position;
11
+ /**
12
+ * The direction of the legend.
13
+ * @default 'horizontal'
14
+ */
7
15
  legendDirection?: Direction;
8
16
  /**
9
17
  * If `true`, the chart wrapper set `height: 100%`.
@@ -14,10 +22,11 @@ export interface ChartsWrapperProps {
14
22
  sx?: SxProps<Theme>;
15
23
  }
16
24
  /**
17
- * @ignore - internal component.
18
- *
19
25
  * Wrapper for the charts components.
20
26
  * Its main purpose is to position the HTML legend in the correct place.
21
27
  */
22
28
  declare function ChartsWrapper(props: ChartsWrapperProps): React.JSX.Element;
29
+ declare namespace ChartsWrapper {
30
+ var propTypes: any;
31
+ }
23
32
  export { ChartsWrapper };
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { shouldForwardProp } from '@mui/system/createStyled';
4
- import { useChartRootRef } from "../../../hooks/useChartRootRef.js";
5
- import { useStore } from "../../store/useStore.js";
6
- import { useSelector } from "../../store/useSelector.js";
7
- import { selectorChartPropsSize } from "../../plugins/corePlugins/useChartDimensions/index.js";
5
+ import { useChartRootRef } from "../hooks/useChartRootRef.js";
6
+ import { useStore } from "../internals/store/useStore.js";
7
+ import { useSelector } from "../internals/store/useSelector.js";
8
+ import { selectorChartPropsSize } from "../internals/plugins/corePlugins/useChartDimensions/index.js";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  const getDirection = (direction, position) => {
10
11
  if (direction === 'vertical') {
@@ -60,8 +61,6 @@ const Root = styled('div', {
60
61
  }));
61
62
 
62
63
  /**
63
- * @ignore - internal component.
64
- *
65
64
  * Wrapper for the charts components.
66
65
  * Its main purpose is to position the HTML legend in the correct place.
67
66
  */
@@ -84,4 +83,30 @@ function ChartsWrapper(props) {
84
83
  children: children
85
84
  });
86
85
  }
86
+ process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
87
+ // ----------------------------- Warning --------------------------------
88
+ // | These PropTypes are generated from the TypeScript type definitions |
89
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
90
+ // ----------------------------------------------------------------------
91
+ children: PropTypes.node,
92
+ /**
93
+ * If `true`, the chart wrapper set `height: 100%`.
94
+ * @default `false` if the `height` prop is set. And `true` otherwise.
95
+ */
96
+ extendVertically: PropTypes.bool,
97
+ /**
98
+ * The direction of the legend.
99
+ * @default 'horizontal'
100
+ */
101
+ legendDirection: PropTypes.oneOf(['horizontal', 'vertical']),
102
+ /**
103
+ * The position of the legend.
104
+ * @default { horizontal: 'center', vertical: 'bottom' }
105
+ */
106
+ legendPosition: PropTypes.shape({
107
+ horizontal: PropTypes.oneOf(['center', 'end', 'start']),
108
+ vertical: PropTypes.oneOf(['bottom', 'middle', 'top'])
109
+ }),
110
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
111
+ } : void 0;
87
112
  export { ChartsWrapper };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { ChartsXAxisProps } from "../models/axis.js";
3
+ /**
4
+ * @ignore - internal component.
5
+ */
6
+ declare function ChartsGroupedXAxis(inProps: ChartsXAxisProps): React.JSX.Element | null;
7
+ export { ChartsGroupedXAxis };
@@ -0,0 +1,136 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { useDrawingArea } from "../hooks/useDrawingArea.js";
6
+ import { isBandScale } from "../internals/isBandScale.js";
7
+ import { useChartContext } from "../context/ChartProvider/useChartContext.js";
8
+ import { TICK_LABEL_GAP, XAxisRoot } from "./utilities.js";
9
+ import { useTicksGrouped } from "../hooks/useTicksGrouped.js";
10
+ import { useAxisProps } from "./useAxisProps.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const DEFAULT_GROUPING_CONFIG = {
13
+ tickSize: 6
14
+ };
15
+ const getGroupingConfig = (groups, groupIndex, tickSize) => {
16
+ const config = groups[groupIndex] ?? {};
17
+ const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
18
+ const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
19
+ return _extends({}, DEFAULT_GROUPING_CONFIG, config, {
20
+ tickSize: config.tickSize ?? calculatedTickSize
21
+ });
22
+ };
23
+
24
+ /**
25
+ * @ignore - internal component.
26
+ */
27
+ function ChartsGroupedXAxis(inProps) {
28
+ const {
29
+ xScale,
30
+ defaultizedProps,
31
+ tickNumber,
32
+ positionSign,
33
+ skipAxisRendering,
34
+ classes,
35
+ Line,
36
+ Tick,
37
+ TickLabel,
38
+ Label,
39
+ axisTickLabelProps,
40
+ axisLabelProps
41
+ } = useAxisProps(inProps);
42
+ if (!isBandScale(xScale)) {
43
+ throw new Error('MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.');
44
+ }
45
+ const {
46
+ position,
47
+ disableLine,
48
+ disableTicks,
49
+ label,
50
+ tickSize,
51
+ valueFormatter,
52
+ slotProps,
53
+ tickInterval,
54
+ tickPlacement,
55
+ tickLabelPlacement,
56
+ sx,
57
+ offset,
58
+ height: axisHeight
59
+ } = defaultizedProps;
60
+ const groups = defaultizedProps.groups;
61
+ const drawingArea = useDrawingArea();
62
+ const {
63
+ left,
64
+ top,
65
+ width,
66
+ height
67
+ } = drawingArea;
68
+ const {
69
+ instance
70
+ } = useChartContext();
71
+ const labelRefPoint = {
72
+ x: left + width / 2,
73
+ y: positionSign * axisHeight
74
+ };
75
+ const xTicks = useTicksGrouped({
76
+ scale: xScale,
77
+ tickNumber,
78
+ valueFormatter,
79
+ tickInterval,
80
+ tickPlacement,
81
+ tickLabelPlacement,
82
+ direction: 'x',
83
+ groups
84
+ });
85
+
86
+ // Skip axis rendering if no data is available
87
+ // - The domain is an empty array for band/point scales.
88
+ // - The domains contains Infinity for continuous scales.
89
+ // - The position is set to 'none'.
90
+ if (skipAxisRendering) {
91
+ return null;
92
+ }
93
+ return /*#__PURE__*/_jsxs(XAxisRoot, {
94
+ transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
95
+ className: classes.root,
96
+ sx: sx,
97
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
98
+ x1: left,
99
+ x2: left + width,
100
+ className: classes.line
101
+ }, slotProps?.axisLine)), xTicks.map((item, index) => {
102
+ const {
103
+ offset: tickOffset,
104
+ labelOffset
105
+ } = item;
106
+ const xTickLabel = labelOffset ?? 0;
107
+ const showTick = instance.isXInside(tickOffset);
108
+ const tickLabel = item.formattedValue;
109
+ const ignoreTick = item.ignoreTick ?? false;
110
+ const groupIndex = item.groupIndex ?? 0;
111
+ const groupConfig = getGroupingConfig(groups, groupIndex, tickSize);
112
+ const tickYSize = positionSign * groupConfig.tickSize;
113
+ const labelPositionY = positionSign * (groupConfig.tickSize + TICK_LABEL_GAP);
114
+ return /*#__PURE__*/_jsxs("g", {
115
+ transform: `translate(${tickOffset}, 0)`,
116
+ className: classes.tickContainer,
117
+ "data-group-index": groupIndex,
118
+ children: [!disableTicks && !ignoreTick && showTick && /*#__PURE__*/_jsx(Tick, _extends({
119
+ y2: tickYSize,
120
+ className: classes.tick
121
+ }, slotProps?.axisTick)), tickLabel !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
122
+ x: xTickLabel,
123
+ y: labelPositionY
124
+ }, axisTickLabelProps, {
125
+ text: tickLabel
126
+ }))]
127
+ }, index);
128
+ }), label && /*#__PURE__*/_jsx("g", {
129
+ className: classes.label,
130
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
131
+ text: label
132
+ }))
133
+ })]
134
+ });
135
+ }
136
+ export { ChartsGroupedXAxis };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { ChartsXAxisProps } from "../models/axis.js";
3
+ /**
4
+ * @ignore - internal component.
5
+ */
6
+ declare function ChartsSingleXAxis(inProps: ChartsXAxisProps): React.JSX.Element | null;
7
+ export { ChartsSingleXAxis };