@mui/x-charts 9.0.0 → 9.0.2

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 (124) hide show
  1. package/BarChart/BarChart.js +27 -9
  2. package/BarChart/BarChart.mjs +27 -9
  3. package/BarChart/BarElement.js +1 -5
  4. package/BarChart/BarElement.mjs +1 -5
  5. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +1 -0
  6. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -0
  7. package/BarChart/seriesConfig/bar/seriesProcessor.js +37 -13
  8. package/BarChart/seriesConfig/bar/seriesProcessor.mjs +37 -13
  9. package/CHANGELOG.md +215 -6891
  10. package/ChartsContainer/ChartsContainer.js +59 -30
  11. package/ChartsContainer/ChartsContainer.mjs +59 -30
  12. package/ChartsDataProvider/useChartsDataProviderProps.js +1 -6
  13. package/ChartsDataProvider/useChartsDataProviderProps.mjs +1 -6
  14. package/ChartsGrid/styledComponents.js +2 -2
  15. package/ChartsGrid/styledComponents.mjs +2 -2
  16. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +38 -0
  17. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +38 -0
  18. package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +115 -0
  19. package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +109 -0
  20. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.mts +9 -0
  21. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.ts +9 -0
  22. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.js +13 -0
  23. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.mjs +7 -0
  24. package/ChartsRadialDataProvider/index.d.mts +2 -0
  25. package/ChartsRadialDataProvider/index.d.ts +2 -0
  26. package/ChartsRadialDataProvider/index.js +27 -0
  27. package/ChartsRadialDataProvider/index.mjs +2 -0
  28. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.mts +13 -0
  29. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.ts +13 -0
  30. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.js +46 -0
  31. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs +39 -0
  32. package/ChartsRadialGrid/ChartsRadialGrid.d.mts +33 -0
  33. package/ChartsRadialGrid/ChartsRadialGrid.d.ts +33 -0
  34. package/ChartsRadialGrid/ChartsRadialGrid.js +99 -0
  35. package/ChartsRadialGrid/ChartsRadialGrid.mjs +94 -0
  36. package/ChartsRadialGrid/ChartsRadiusGrid.d.mts +13 -0
  37. package/ChartsRadialGrid/ChartsRadiusGrid.d.ts +13 -0
  38. package/ChartsRadialGrid/ChartsRadiusGrid.js +73 -0
  39. package/ChartsRadialGrid/ChartsRadiusGrid.mjs +66 -0
  40. package/ChartsRadialGrid/ChartsRotationGrid.d.mts +13 -0
  41. package/ChartsRadialGrid/ChartsRotationGrid.d.ts +13 -0
  42. package/ChartsRadialGrid/ChartsRotationGrid.js +65 -0
  43. package/ChartsRadialGrid/ChartsRotationGrid.mjs +58 -0
  44. package/ChartsRadialGrid/chartsRadialGridClasses.d.mts +13 -0
  45. package/ChartsRadialGrid/chartsRadialGridClasses.d.ts +13 -0
  46. package/ChartsRadialGrid/chartsRadialGridClasses.js +14 -0
  47. package/ChartsRadialGrid/chartsRadialGridClasses.mjs +6 -0
  48. package/ChartsRadialGrid/index.d.mts +3 -0
  49. package/ChartsRadialGrid/index.d.ts +3 -0
  50. package/ChartsRadialGrid/index.js +19 -0
  51. package/ChartsRadialGrid/index.mjs +2 -0
  52. package/ChartsRadialGrid/styledComponents.d.mts +4 -0
  53. package/ChartsRadialGrid/styledComponents.d.ts +4 -0
  54. package/ChartsRadialGrid/styledComponents.js +50 -0
  55. package/ChartsRadialGrid/styledComponents.mjs +44 -0
  56. package/ChartsXAxis/useAxisTicksProps.d.mts +407 -326
  57. package/ChartsXAxis/useAxisTicksProps.d.ts +407 -326
  58. package/ChartsYAxis/useAxisTicksProps.d.mts +407 -326
  59. package/ChartsYAxis/useAxisTicksProps.d.ts +407 -326
  60. package/LineChart/LineChart.d.mts +1 -2
  61. package/LineChart/LineChart.d.ts +1 -2
  62. package/LineChart/LineChart.js +27 -9
  63. package/LineChart/LineChart.mjs +27 -9
  64. package/LineChart/seriesConfig/seriesProcessor.js +37 -13
  65. package/LineChart/seriesConfig/seriesProcessor.mjs +37 -13
  66. package/RadarChart/RadarAxis/useRadarAxis.d.mts +1 -1
  67. package/RadarChart/RadarAxis/useRadarAxis.d.ts +1 -1
  68. package/RadarChart/RadarAxis/useRadarAxis.js +2 -2
  69. package/RadarChart/RadarAxis/useRadarAxis.mjs +2 -2
  70. package/ScatterChart/Scatter.d.mts +11 -0
  71. package/ScatterChart/Scatter.d.ts +11 -0
  72. package/ScatterChart/Scatter.js +11 -0
  73. package/ScatterChart/Scatter.mjs +14 -0
  74. package/ScatterChart/ScatterChart.js +29 -10
  75. package/ScatterChart/ScatterChart.mjs +29 -10
  76. package/ScatterChart/seriesConfig/seriesProcessor.js +9 -4
  77. package/ScatterChart/seriesConfig/seriesProcessor.mjs +9 -4
  78. package/SparkLineChart/SparkLineChart.js +27 -9
  79. package/SparkLineChart/SparkLineChart.mjs +27 -9
  80. package/hooks/useTicks.d.mts +1 -1
  81. package/hooks/useTicks.d.ts +1 -1
  82. package/hooks/useTicks.js +21 -3
  83. package/hooks/useTicks.mjs +21 -3
  84. package/index.d.mts +2 -0
  85. package/index.d.ts +2 -0
  86. package/index.js +25 -1
  87. package/index.mjs +3 -1
  88. package/internals/material/index.js +6 -1
  89. package/internals/material/index.mjs +6 -1
  90. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +8 -12
  91. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +8 -12
  92. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +1 -0
  93. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +1 -0
  94. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +7 -4
  95. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +8 -5
  96. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.js +3 -3
  97. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.mjs +3 -3
  98. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +3 -3
  99. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +3 -3
  100. package/models/axis.d.mts +11 -2
  101. package/models/axis.d.ts +11 -2
  102. package/models/seriesType/bar.d.mts +9 -0
  103. package/models/seriesType/bar.d.ts +9 -0
  104. package/models/seriesType/line.d.mts +9 -0
  105. package/models/seriesType/line.d.ts +9 -0
  106. package/models/seriesType/scatter.d.mts +9 -0
  107. package/models/seriesType/scatter.d.ts +9 -0
  108. package/models/slots/chartsBaseSlotProps.d.mts +17 -0
  109. package/models/slots/chartsBaseSlotProps.d.ts +17 -0
  110. package/models/slots/chartsBaseSlots.d.mts +7 -1
  111. package/models/slots/chartsBaseSlots.d.ts +7 -1
  112. package/models/z-axis.d.mts +9 -0
  113. package/models/z-axis.d.ts +9 -0
  114. package/package.json +31 -3
  115. package/themeAugmentation/components.d.mts +4 -0
  116. package/themeAugmentation/components.d.ts +4 -0
  117. package/themeAugmentation/overrides.d.mts +2 -0
  118. package/themeAugmentation/overrides.d.ts +2 -0
  119. package/themeAugmentation/props.d.mts +2 -0
  120. package/themeAugmentation/props.d.ts +2 -0
  121. package/utils/epsilon.d.mts +1 -0
  122. package/utils/epsilon.d.ts +1 -0
  123. package/utils/epsilon.js +7 -0
  124. package/utils/epsilon.mjs +1 -0
@@ -439,7 +439,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
439
439
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
440
440
  tickSize: _propTypes.default.number,
441
441
  tickSpacing: _propTypes.default.number,
442
- valueFormatter: _propTypes.default.func
442
+ valueFormatter: _propTypes.default.func,
443
+ valueGetter: _propTypes.default.func
443
444
  }), _propTypes.default.shape({
444
445
  axis: _propTypes.default.oneOf(['x']),
445
446
  classes: _propTypes.default.object,
@@ -498,7 +499,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
498
499
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
499
500
  tickSize: _propTypes.default.number,
500
501
  tickSpacing: _propTypes.default.number,
501
- valueFormatter: _propTypes.default.func
502
+ valueFormatter: _propTypes.default.func,
503
+ valueGetter: _propTypes.default.func
502
504
  }), _propTypes.default.shape({
503
505
  axis: _propTypes.default.oneOf(['x']),
504
506
  classes: _propTypes.default.object,
@@ -544,7 +546,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
544
546
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
545
547
  tickSize: _propTypes.default.number,
546
548
  tickSpacing: _propTypes.default.number,
547
- valueFormatter: _propTypes.default.func
549
+ valueFormatter: _propTypes.default.func,
550
+ valueGetter: _propTypes.default.func
548
551
  }), _propTypes.default.shape({
549
552
  axis: _propTypes.default.oneOf(['x']),
550
553
  classes: _propTypes.default.object,
@@ -591,7 +594,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
591
594
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
592
595
  tickSize: _propTypes.default.number,
593
596
  tickSpacing: _propTypes.default.number,
594
- valueFormatter: _propTypes.default.func
597
+ valueFormatter: _propTypes.default.func,
598
+ valueGetter: _propTypes.default.func
595
599
  }), _propTypes.default.shape({
596
600
  axis: _propTypes.default.oneOf(['x']),
597
601
  classes: _propTypes.default.object,
@@ -637,7 +641,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
637
641
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
638
642
  tickSize: _propTypes.default.number,
639
643
  tickSpacing: _propTypes.default.number,
640
- valueFormatter: _propTypes.default.func
644
+ valueFormatter: _propTypes.default.func,
645
+ valueGetter: _propTypes.default.func
641
646
  }), _propTypes.default.shape({
642
647
  axis: _propTypes.default.oneOf(['x']),
643
648
  classes: _propTypes.default.object,
@@ -683,7 +688,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
683
688
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
684
689
  tickSize: _propTypes.default.number,
685
690
  tickSpacing: _propTypes.default.number,
686
- valueFormatter: _propTypes.default.func
691
+ valueFormatter: _propTypes.default.func,
692
+ valueGetter: _propTypes.default.func
687
693
  }), _propTypes.default.shape({
688
694
  axis: _propTypes.default.oneOf(['x']),
689
695
  classes: _propTypes.default.object,
@@ -733,7 +739,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
733
739
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
734
740
  tickSize: _propTypes.default.number,
735
741
  tickSpacing: _propTypes.default.number,
736
- valueFormatter: _propTypes.default.func
742
+ valueFormatter: _propTypes.default.func,
743
+ valueGetter: _propTypes.default.func
737
744
  }), _propTypes.default.shape({
738
745
  axis: _propTypes.default.oneOf(['x']),
739
746
  classes: _propTypes.default.object,
@@ -783,7 +790,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
783
790
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
784
791
  tickSize: _propTypes.default.number,
785
792
  tickSpacing: _propTypes.default.number,
786
- valueFormatter: _propTypes.default.func
793
+ valueFormatter: _propTypes.default.func,
794
+ valueGetter: _propTypes.default.func
787
795
  }), _propTypes.default.shape({
788
796
  axis: _propTypes.default.oneOf(['x']),
789
797
  classes: _propTypes.default.object,
@@ -829,7 +837,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
829
837
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
830
838
  tickSize: _propTypes.default.number,
831
839
  tickSpacing: _propTypes.default.number,
832
- valueFormatter: _propTypes.default.func
840
+ valueFormatter: _propTypes.default.func,
841
+ valueGetter: _propTypes.default.func
833
842
  })]).isRequired),
834
843
  /**
835
844
  * The configuration of the y-axes.
@@ -895,6 +904,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
895
904
  tickSize: _propTypes.default.number,
896
905
  tickSpacing: _propTypes.default.number,
897
906
  valueFormatter: _propTypes.default.func,
907
+ valueGetter: _propTypes.default.func,
898
908
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
899
909
  }), _propTypes.default.shape({
900
910
  axis: _propTypes.default.oneOf(['y']),
@@ -953,6 +963,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
953
963
  tickSize: _propTypes.default.number,
954
964
  tickSpacing: _propTypes.default.number,
955
965
  valueFormatter: _propTypes.default.func,
966
+ valueGetter: _propTypes.default.func,
956
967
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
957
968
  }), _propTypes.default.shape({
958
969
  axis: _propTypes.default.oneOf(['y']),
@@ -998,6 +1009,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
998
1009
  tickSize: _propTypes.default.number,
999
1010
  tickSpacing: _propTypes.default.number,
1000
1011
  valueFormatter: _propTypes.default.func,
1012
+ valueGetter: _propTypes.default.func,
1001
1013
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1002
1014
  }), _propTypes.default.shape({
1003
1015
  axis: _propTypes.default.oneOf(['y']),
@@ -1044,6 +1056,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1044
1056
  tickSize: _propTypes.default.number,
1045
1057
  tickSpacing: _propTypes.default.number,
1046
1058
  valueFormatter: _propTypes.default.func,
1059
+ valueGetter: _propTypes.default.func,
1047
1060
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1048
1061
  }), _propTypes.default.shape({
1049
1062
  axis: _propTypes.default.oneOf(['y']),
@@ -1089,6 +1102,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1089
1102
  tickSize: _propTypes.default.number,
1090
1103
  tickSpacing: _propTypes.default.number,
1091
1104
  valueFormatter: _propTypes.default.func,
1105
+ valueGetter: _propTypes.default.func,
1092
1106
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1093
1107
  }), _propTypes.default.shape({
1094
1108
  axis: _propTypes.default.oneOf(['y']),
@@ -1134,6 +1148,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1134
1148
  tickSize: _propTypes.default.number,
1135
1149
  tickSpacing: _propTypes.default.number,
1136
1150
  valueFormatter: _propTypes.default.func,
1151
+ valueGetter: _propTypes.default.func,
1137
1152
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1138
1153
  }), _propTypes.default.shape({
1139
1154
  axis: _propTypes.default.oneOf(['y']),
@@ -1183,6 +1198,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1183
1198
  tickSize: _propTypes.default.number,
1184
1199
  tickSpacing: _propTypes.default.number,
1185
1200
  valueFormatter: _propTypes.default.func,
1201
+ valueGetter: _propTypes.default.func,
1186
1202
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1187
1203
  }), _propTypes.default.shape({
1188
1204
  axis: _propTypes.default.oneOf(['y']),
@@ -1232,6 +1248,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1232
1248
  tickSize: _propTypes.default.number,
1233
1249
  tickSpacing: _propTypes.default.number,
1234
1250
  valueFormatter: _propTypes.default.func,
1251
+ valueGetter: _propTypes.default.func,
1235
1252
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1236
1253
  }), _propTypes.default.shape({
1237
1254
  axis: _propTypes.default.oneOf(['y']),
@@ -1277,6 +1294,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1277
1294
  tickSize: _propTypes.default.number,
1278
1295
  tickSpacing: _propTypes.default.number,
1279
1296
  valueFormatter: _propTypes.default.func,
1297
+ valueGetter: _propTypes.default.func,
1280
1298
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1281
1299
  })]).isRequired)
1282
1300
  } : void 0;
@@ -432,7 +432,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
432
432
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
433
433
  tickSize: PropTypes.number,
434
434
  tickSpacing: PropTypes.number,
435
- valueFormatter: PropTypes.func
435
+ valueFormatter: PropTypes.func,
436
+ valueGetter: PropTypes.func
436
437
  }), PropTypes.shape({
437
438
  axis: PropTypes.oneOf(['x']),
438
439
  classes: PropTypes.object,
@@ -491,7 +492,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
491
492
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
492
493
  tickSize: PropTypes.number,
493
494
  tickSpacing: PropTypes.number,
494
- valueFormatter: PropTypes.func
495
+ valueFormatter: PropTypes.func,
496
+ valueGetter: PropTypes.func
495
497
  }), PropTypes.shape({
496
498
  axis: PropTypes.oneOf(['x']),
497
499
  classes: PropTypes.object,
@@ -537,7 +539,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
537
539
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
538
540
  tickSize: PropTypes.number,
539
541
  tickSpacing: PropTypes.number,
540
- valueFormatter: PropTypes.func
542
+ valueFormatter: PropTypes.func,
543
+ valueGetter: PropTypes.func
541
544
  }), PropTypes.shape({
542
545
  axis: PropTypes.oneOf(['x']),
543
546
  classes: PropTypes.object,
@@ -584,7 +587,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
584
587
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
585
588
  tickSize: PropTypes.number,
586
589
  tickSpacing: PropTypes.number,
587
- valueFormatter: PropTypes.func
590
+ valueFormatter: PropTypes.func,
591
+ valueGetter: PropTypes.func
588
592
  }), PropTypes.shape({
589
593
  axis: PropTypes.oneOf(['x']),
590
594
  classes: PropTypes.object,
@@ -630,7 +634,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
630
634
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
631
635
  tickSize: PropTypes.number,
632
636
  tickSpacing: PropTypes.number,
633
- valueFormatter: PropTypes.func
637
+ valueFormatter: PropTypes.func,
638
+ valueGetter: PropTypes.func
634
639
  }), PropTypes.shape({
635
640
  axis: PropTypes.oneOf(['x']),
636
641
  classes: PropTypes.object,
@@ -676,7 +681,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
676
681
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
677
682
  tickSize: PropTypes.number,
678
683
  tickSpacing: PropTypes.number,
679
- valueFormatter: PropTypes.func
684
+ valueFormatter: PropTypes.func,
685
+ valueGetter: PropTypes.func
680
686
  }), PropTypes.shape({
681
687
  axis: PropTypes.oneOf(['x']),
682
688
  classes: PropTypes.object,
@@ -726,7 +732,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
726
732
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
727
733
  tickSize: PropTypes.number,
728
734
  tickSpacing: PropTypes.number,
729
- valueFormatter: PropTypes.func
735
+ valueFormatter: PropTypes.func,
736
+ valueGetter: PropTypes.func
730
737
  }), PropTypes.shape({
731
738
  axis: PropTypes.oneOf(['x']),
732
739
  classes: PropTypes.object,
@@ -776,7 +783,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
776
783
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
777
784
  tickSize: PropTypes.number,
778
785
  tickSpacing: PropTypes.number,
779
- valueFormatter: PropTypes.func
786
+ valueFormatter: PropTypes.func,
787
+ valueGetter: PropTypes.func
780
788
  }), PropTypes.shape({
781
789
  axis: PropTypes.oneOf(['x']),
782
790
  classes: PropTypes.object,
@@ -822,7 +830,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
822
830
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
823
831
  tickSize: PropTypes.number,
824
832
  tickSpacing: PropTypes.number,
825
- valueFormatter: PropTypes.func
833
+ valueFormatter: PropTypes.func,
834
+ valueGetter: PropTypes.func
826
835
  })]).isRequired),
827
836
  /**
828
837
  * The configuration of the y-axes.
@@ -888,6 +897,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
888
897
  tickSize: PropTypes.number,
889
898
  tickSpacing: PropTypes.number,
890
899
  valueFormatter: PropTypes.func,
900
+ valueGetter: PropTypes.func,
891
901
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
892
902
  }), PropTypes.shape({
893
903
  axis: PropTypes.oneOf(['y']),
@@ -946,6 +956,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
946
956
  tickSize: PropTypes.number,
947
957
  tickSpacing: PropTypes.number,
948
958
  valueFormatter: PropTypes.func,
959
+ valueGetter: PropTypes.func,
949
960
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
950
961
  }), PropTypes.shape({
951
962
  axis: PropTypes.oneOf(['y']),
@@ -991,6 +1002,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
991
1002
  tickSize: PropTypes.number,
992
1003
  tickSpacing: PropTypes.number,
993
1004
  valueFormatter: PropTypes.func,
1005
+ valueGetter: PropTypes.func,
994
1006
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
995
1007
  }), PropTypes.shape({
996
1008
  axis: PropTypes.oneOf(['y']),
@@ -1037,6 +1049,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1037
1049
  tickSize: PropTypes.number,
1038
1050
  tickSpacing: PropTypes.number,
1039
1051
  valueFormatter: PropTypes.func,
1052
+ valueGetter: PropTypes.func,
1040
1053
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1041
1054
  }), PropTypes.shape({
1042
1055
  axis: PropTypes.oneOf(['y']),
@@ -1082,6 +1095,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1082
1095
  tickSize: PropTypes.number,
1083
1096
  tickSpacing: PropTypes.number,
1084
1097
  valueFormatter: PropTypes.func,
1098
+ valueGetter: PropTypes.func,
1085
1099
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1086
1100
  }), PropTypes.shape({
1087
1101
  axis: PropTypes.oneOf(['y']),
@@ -1127,6 +1141,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1127
1141
  tickSize: PropTypes.number,
1128
1142
  tickSpacing: PropTypes.number,
1129
1143
  valueFormatter: PropTypes.func,
1144
+ valueGetter: PropTypes.func,
1130
1145
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1131
1146
  }), PropTypes.shape({
1132
1147
  axis: PropTypes.oneOf(['y']),
@@ -1176,6 +1191,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1176
1191
  tickSize: PropTypes.number,
1177
1192
  tickSpacing: PropTypes.number,
1178
1193
  valueFormatter: PropTypes.func,
1194
+ valueGetter: PropTypes.func,
1179
1195
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1180
1196
  }), PropTypes.shape({
1181
1197
  axis: PropTypes.oneOf(['y']),
@@ -1225,6 +1241,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1225
1241
  tickSize: PropTypes.number,
1226
1242
  tickSpacing: PropTypes.number,
1227
1243
  valueFormatter: PropTypes.func,
1244
+ valueGetter: PropTypes.func,
1228
1245
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1229
1246
  }), PropTypes.shape({
1230
1247
  axis: PropTypes.oneOf(['y']),
@@ -1270,6 +1287,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1270
1287
  tickSize: PropTypes.number,
1271
1288
  tickSpacing: PropTypes.number,
1272
1289
  valueFormatter: PropTypes.func,
1290
+ valueGetter: PropTypes.func,
1273
1291
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1274
1292
  })]).isRequired)
1275
1293
  } : void 0;
@@ -47,11 +47,7 @@ function BarElement(props) {
47
47
  const highlightState = (0, _useItemHighlightState.useItemHighlightState)(itemIdentifier);
48
48
  const isHighlighted = highlightState === 'highlighted';
49
49
  const isFaded = highlightState === 'faded';
50
- const isFocused = (0, _useIsItemFocused.useIsItemFocused)(React.useMemo(() => ({
51
- type: 'bar',
52
- seriesId,
53
- dataIndex
54
- }), [seriesId, dataIndex]));
50
+ const isFocused = (0, _useIsItemFocused.useIsItemFocused)(itemIdentifier);
55
51
  const ownerState = {
56
52
  seriesId,
57
53
  dataIndex,
@@ -40,11 +40,7 @@ function BarElement(props) {
40
40
  const highlightState = useItemHighlightState(itemIdentifier);
41
41
  const isHighlighted = highlightState === 'highlighted';
42
42
  const isFaded = highlightState === 'faded';
43
- const isFocused = useIsItemFocused(React.useMemo(() => ({
44
- type: 'bar',
45
- seriesId,
46
- dataIndex
47
- }), [seriesId, dataIndex]));
43
+ const isFocused = useIsItemFocused(itemIdentifier);
48
44
  const ownerState = {
49
45
  seriesId,
50
46
  dataIndex,
@@ -5,6 +5,7 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
5
5
  type: "bar";
6
6
  data?: ReadonlyArray<import("../../../index.mjs").BarValueType | null>;
7
7
  dataKey?: string;
8
+ valueGetter?: (item: import("../../../internals/index.mjs").DatasetElementType<unknown>) => import("../../../index.mjs").BarValueType | null;
8
9
  label?: string | ((location: "tooltip" | "legend") => string);
9
10
  layout?: "horizontal" | "vertical";
10
11
  stackOffset?: import("../../../index.mjs").StackOffsetType;
@@ -5,6 +5,7 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
5
5
  type: "bar";
6
6
  data?: ReadonlyArray<import("../../../index.js").BarValueType | null>;
7
7
  dataKey?: string;
8
+ valueGetter?: (item: import("../../../internals/index.js").DatasetElementType<unknown>) => import("../../../index.js").BarValueType | null;
8
9
  label?: string | ((location: "tooltip" | "legend") => string);
9
10
  layout?: "horizontal" | "vertical";
10
11
  stackOffset?: import("../../../index.js").StackOffsetType;
@@ -32,22 +32,36 @@ const seriesProcessor = (params, dataset, isItemVisible) => {
32
32
  d3Dataset[index][id] = value;
33
33
  }
34
34
  });
35
+ } else if (series[id].valueGetter && dataset) {
36
+ // When valueGetter is used without dataKey, populate d3Dataset with the series id as key
37
+ dataset.forEach((entry, index) => {
38
+ const value = series[id].valueGetter(entry);
39
+ if (d3Dataset.length <= index) {
40
+ d3Dataset.push({
41
+ [id]: value
42
+ });
43
+ } else {
44
+ d3Dataset[index][id] = value;
45
+ }
46
+ });
35
47
  } else if (dataset === undefined) {
36
48
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Bar series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : (0, _formatErrorMessage2.default)(33, id));
37
49
  }
38
50
  if (process.env.NODE_ENV !== 'production') {
39
51
  if (!data && dataset) {
40
52
  const dataKey = series[id].dataKey;
41
- if (!dataKey) {
42
- throw new Error(`MUI X Charts: Bar series with id="${id}" has no data and no dataKey. ` + 'When using the dataset prop, each series must have a dataKey to identify which dataset column to use. ' + 'Add a dataKey property to the series configuration.');
53
+ if (!dataKey && !series[id].valueGetter) {
54
+ throw new Error(`MUI X Charts: Bar series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
43
55
  }
44
- dataset.forEach((entry, index) => {
45
- const value = entry[dataKey];
46
- if (value != null && typeof value !== 'number') {
47
- (0, _warning.warnOnce)(`MUI X Charts: your dataset key "${dataKey}" is used for plotting bars, but the dataset contains the non-null non-numerical element "${value}" at index ${index}.
56
+ if (dataKey) {
57
+ dataset.forEach((entry, index) => {
58
+ const value = entry[dataKey];
59
+ if (value != null && typeof value !== 'number') {
60
+ (0, _warning.warnOnce)(`MUI X Charts: your dataset key "${dataKey}" is used for plotting bars, but the dataset contains the non-null non-numerical element "${value}" at index ${index}.
48
61
  Bar plots only support numeric and null values.`);
49
- }
50
- });
62
+ }
63
+ });
64
+ }
51
65
  }
52
66
  }
53
67
  });
@@ -82,11 +96,21 @@ Bar plots only support numeric and null values.`);
82
96
  return d[key] ?? 0;
83
97
  }).order(fixedOrder).offset(stackingOffset)(d3Dataset);
84
98
  ids.forEach((id, index) => {
85
- const dataKey = series[id].dataKey;
86
- const data = dataKey ? dataset.map(d => {
87
- const value = d[dataKey];
88
- return typeof value === 'number' ? value : null;
89
- }) : series[id].data;
99
+ const {
100
+ dataKey,
101
+ valueGetter
102
+ } = series[id];
103
+ let data;
104
+ if (valueGetter) {
105
+ data = dataset.map(d => valueGetter(d));
106
+ } else if (dataKey) {
107
+ data = dataset.map(d => {
108
+ const value = d[dataKey];
109
+ return typeof value === 'number' ? value : null;
110
+ });
111
+ } else {
112
+ data = series[id].data;
113
+ }
90
114
  const hidden = !isItemVisible?.({
91
115
  type: 'bar',
92
116
  seriesId: id
@@ -25,22 +25,36 @@ const seriesProcessor = (params, dataset, isItemVisible) => {
25
25
  d3Dataset[index][id] = value;
26
26
  }
27
27
  });
28
+ } else if (series[id].valueGetter && dataset) {
29
+ // When valueGetter is used without dataKey, populate d3Dataset with the series id as key
30
+ dataset.forEach((entry, index) => {
31
+ const value = series[id].valueGetter(entry);
32
+ if (d3Dataset.length <= index) {
33
+ d3Dataset.push({
34
+ [id]: value
35
+ });
36
+ } else {
37
+ d3Dataset[index][id] = value;
38
+ }
39
+ });
28
40
  } else if (dataset === undefined) {
29
41
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Bar series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : _formatErrorMessage(33, id));
30
42
  }
31
43
  if (process.env.NODE_ENV !== 'production') {
32
44
  if (!data && dataset) {
33
45
  const dataKey = series[id].dataKey;
34
- if (!dataKey) {
35
- throw new Error(`MUI X Charts: Bar series with id="${id}" has no data and no dataKey. ` + 'When using the dataset prop, each series must have a dataKey to identify which dataset column to use. ' + 'Add a dataKey property to the series configuration.');
46
+ if (!dataKey && !series[id].valueGetter) {
47
+ throw new Error(`MUI X Charts: Bar series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
36
48
  }
37
- dataset.forEach((entry, index) => {
38
- const value = entry[dataKey];
39
- if (value != null && typeof value !== 'number') {
40
- warnOnce(`MUI X Charts: your dataset key "${dataKey}" is used for plotting bars, but the dataset contains the non-null non-numerical element "${value}" at index ${index}.
49
+ if (dataKey) {
50
+ dataset.forEach((entry, index) => {
51
+ const value = entry[dataKey];
52
+ if (value != null && typeof value !== 'number') {
53
+ warnOnce(`MUI X Charts: your dataset key "${dataKey}" is used for plotting bars, but the dataset contains the non-null non-numerical element "${value}" at index ${index}.
41
54
  Bar plots only support numeric and null values.`);
42
- }
43
- });
55
+ }
56
+ });
57
+ }
44
58
  }
45
59
  }
46
60
  });
@@ -75,11 +89,21 @@ Bar plots only support numeric and null values.`);
75
89
  return d[key] ?? 0;
76
90
  }).order(fixedOrder).offset(stackingOffset)(d3Dataset);
77
91
  ids.forEach((id, index) => {
78
- const dataKey = series[id].dataKey;
79
- const data = dataKey ? dataset.map(d => {
80
- const value = d[dataKey];
81
- return typeof value === 'number' ? value : null;
82
- }) : series[id].data;
92
+ const {
93
+ dataKey,
94
+ valueGetter
95
+ } = series[id];
96
+ let data;
97
+ if (valueGetter) {
98
+ data = dataset.map(d => valueGetter(d));
99
+ } else if (dataKey) {
100
+ data = dataset.map(d => {
101
+ const value = d[dataKey];
102
+ return typeof value === 'number' ? value : null;
103
+ });
104
+ } else {
105
+ data = series[id].data;
106
+ }
83
107
  const hidden = !isItemVisible?.({
84
108
  type: 'bar',
85
109
  seriesId: id