@mui/x-charts 9.0.1 → 9.0.3

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 (206) hide show
  1. package/BarChart/BarChart.js +29 -10
  2. package/BarChart/BarChart.mjs +29 -10
  3. package/BarChart/BarElement.js +1 -5
  4. package/BarChart/BarElement.mjs +1 -5
  5. package/BarChart/BarPlot.js +2 -1
  6. package/BarChart/BarPlot.mjs +2 -1
  7. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +8 -7
  8. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +8 -7
  9. package/BarChart/seriesConfig/bar/seriesProcessor.js +37 -13
  10. package/BarChart/seriesConfig/bar/seriesProcessor.mjs +37 -13
  11. package/CHANGELOG.md +257 -0
  12. package/ChartsContainer/ChartsContainer.js +59 -30
  13. package/ChartsContainer/ChartsContainer.mjs +59 -30
  14. package/ChartsDataProvider/useChartsDataProviderProps.js +1 -6
  15. package/ChartsDataProvider/useChartsDataProviderProps.mjs +1 -6
  16. package/ChartsGrid/styledComponents.js +2 -2
  17. package/ChartsGrid/styledComponents.mjs +2 -2
  18. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +38 -0
  19. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +38 -0
  20. package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +115 -0
  21. package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +109 -0
  22. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.mts +9 -0
  23. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.ts +9 -0
  24. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.js +13 -0
  25. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.mjs +7 -0
  26. package/ChartsRadialDataProvider/index.d.mts +2 -0
  27. package/ChartsRadialDataProvider/index.d.ts +2 -0
  28. package/ChartsRadialDataProvider/index.js +27 -0
  29. package/ChartsRadialDataProvider/index.mjs +2 -0
  30. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.mts +13 -0
  31. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.ts +13 -0
  32. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.js +46 -0
  33. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs +39 -0
  34. package/ChartsRadialGrid/ChartsRadialGrid.d.mts +33 -0
  35. package/ChartsRadialGrid/ChartsRadialGrid.d.ts +33 -0
  36. package/ChartsRadialGrid/ChartsRadialGrid.js +101 -0
  37. package/ChartsRadialGrid/ChartsRadialGrid.mjs +96 -0
  38. package/ChartsRadialGrid/ChartsRadiusGrid.d.mts +14 -0
  39. package/ChartsRadialGrid/ChartsRadiusGrid.d.ts +14 -0
  40. package/ChartsRadialGrid/ChartsRadiusGrid.js +72 -0
  41. package/ChartsRadialGrid/ChartsRadiusGrid.mjs +65 -0
  42. package/ChartsRadialGrid/ChartsRotationGrid.d.mts +13 -0
  43. package/ChartsRadialGrid/ChartsRotationGrid.d.ts +13 -0
  44. package/ChartsRadialGrid/ChartsRotationGrid.js +65 -0
  45. package/ChartsRadialGrid/ChartsRotationGrid.mjs +58 -0
  46. package/ChartsRadialGrid/chartsRadialGridClasses.d.mts +13 -0
  47. package/ChartsRadialGrid/chartsRadialGridClasses.d.ts +13 -0
  48. package/ChartsRadialGrid/chartsRadialGridClasses.js +14 -0
  49. package/ChartsRadialGrid/chartsRadialGridClasses.mjs +6 -0
  50. package/ChartsRadialGrid/index.d.mts +3 -0
  51. package/ChartsRadialGrid/index.d.ts +3 -0
  52. package/ChartsRadialGrid/index.js +19 -0
  53. package/ChartsRadialGrid/index.mjs +2 -0
  54. package/ChartsRadialGrid/styledComponents.d.mts +4 -0
  55. package/ChartsRadialGrid/styledComponents.d.ts +4 -0
  56. package/ChartsRadialGrid/styledComponents.js +50 -0
  57. package/ChartsRadialGrid/styledComponents.mjs +44 -0
  58. package/ChartsRadiusAxis/ChartsRadiusAxis.d.mts +48 -0
  59. package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +48 -0
  60. package/ChartsRadiusAxis/ChartsRadiusAxis.js +147 -0
  61. package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +141 -0
  62. package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.mts +6 -0
  63. package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.ts +6 -0
  64. package/ChartsRadiusAxis/chartsRadiusAxisClasses.js +30 -0
  65. package/ChartsRadiusAxis/chartsRadiusAxisClasses.mjs +17 -0
  66. package/ChartsRadiusAxis/createGetLabelTextAnchors.d.mts +10 -0
  67. package/ChartsRadiusAxis/createGetLabelTextAnchors.d.ts +10 -0
  68. package/ChartsRadiusAxis/createGetLabelTextAnchors.js +46 -0
  69. package/ChartsRadiusAxis/createGetLabelTextAnchors.mjs +39 -0
  70. package/ChartsRadiusAxis/getLabelTransform.d.mts +11 -0
  71. package/ChartsRadiusAxis/getLabelTransform.d.ts +11 -0
  72. package/ChartsRadiusAxis/getLabelTransform.js +37 -0
  73. package/ChartsRadiusAxis/getLabelTransform.mjs +31 -0
  74. package/ChartsRadiusAxis/index.d.mts +3 -0
  75. package/ChartsRadiusAxis/index.d.ts +3 -0
  76. package/ChartsRadiusAxis/index.js +19 -0
  77. package/ChartsRadiusAxis/index.mjs +2 -0
  78. package/ChartsRadiusAxis/sharedRadialAxisClasses.d.mts +21 -0
  79. package/ChartsRadiusAxis/sharedRadialAxisClasses.d.ts +21 -0
  80. package/ChartsRadiusAxis/sharedRadialAxisClasses.js +14 -0
  81. package/ChartsRadiusAxis/sharedRadialAxisClasses.mjs +6 -0
  82. package/ChartsRotationAxis/ChartsRotationAxis.d.mts +48 -0
  83. package/ChartsRotationAxis/ChartsRotationAxis.d.ts +48 -0
  84. package/ChartsRotationAxis/ChartsRotationAxis.js +141 -0
  85. package/ChartsRotationAxis/ChartsRotationAxis.mjs +135 -0
  86. package/ChartsRotationAxis/chartsRotationAxisClasses.d.mts +5 -0
  87. package/ChartsRotationAxis/chartsRotationAxisClasses.d.ts +5 -0
  88. package/ChartsRotationAxis/chartsRotationAxisClasses.js +29 -0
  89. package/ChartsRotationAxis/chartsRotationAxisClasses.mjs +16 -0
  90. package/ChartsRotationAxis/getLabelTransform.d.mts +11 -0
  91. package/ChartsRotationAxis/getLabelTransform.d.ts +11 -0
  92. package/ChartsRotationAxis/getLabelTransform.js +37 -0
  93. package/ChartsRotationAxis/getLabelTransform.mjs +31 -0
  94. package/ChartsRotationAxis/index.d.mts +2 -0
  95. package/ChartsRotationAxis/index.d.ts +2 -0
  96. package/ChartsRotationAxis/index.js +19 -0
  97. package/ChartsRotationAxis/index.mjs +2 -0
  98. package/ChartsTooltip/useAxesTooltip.js +7 -4
  99. package/ChartsTooltip/useAxesTooltip.mjs +8 -5
  100. package/ChartsTooltip/useItemTooltip.d.mts +1 -1
  101. package/ChartsTooltip/useItemTooltip.d.ts +1 -1
  102. package/ChartsTooltip/useItemTooltip.js +17 -2
  103. package/ChartsTooltip/useItemTooltip.mjs +18 -3
  104. package/ChartsXAxis/useAxisTicksProps.d.mts +652 -490
  105. package/ChartsXAxis/useAxisTicksProps.d.ts +652 -490
  106. package/ChartsYAxis/useAxisTicksProps.d.mts +652 -490
  107. package/ChartsYAxis/useAxisTicksProps.d.ts +652 -490
  108. package/LineChart/LineChart.js +27 -9
  109. package/LineChart/LineChart.mjs +27 -9
  110. package/LineChart/seriesConfig/curveEvaluation.js +24 -19
  111. package/LineChart/seriesConfig/curveEvaluation.mjs +24 -19
  112. package/LineChart/seriesConfig/getItemAtPosition.js +14 -3
  113. package/LineChart/seriesConfig/getItemAtPosition.mjs +14 -3
  114. package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +4 -6
  115. package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +4 -6
  116. package/LineChart/seriesConfig/seriesProcessor.d.mts +4 -2
  117. package/LineChart/seriesConfig/seriesProcessor.d.ts +4 -2
  118. package/LineChart/seriesConfig/seriesProcessor.js +39 -15
  119. package/LineChart/seriesConfig/seriesProcessor.mjs +39 -15
  120. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.mts +2 -2
  121. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  122. package/ScatterChart/Scatter.d.mts +11 -0
  123. package/ScatterChart/Scatter.d.ts +11 -0
  124. package/ScatterChart/Scatter.js +11 -0
  125. package/ScatterChart/Scatter.mjs +14 -0
  126. package/ScatterChart/ScatterChart.js +29 -10
  127. package/ScatterChart/ScatterChart.mjs +29 -10
  128. package/ScatterChart/seriesConfig/seriesProcessor.js +9 -4
  129. package/ScatterChart/seriesConfig/seriesProcessor.mjs +9 -4
  130. package/SparkLineChart/SparkLineChart.js +27 -9
  131. package/SparkLineChart/SparkLineChart.mjs +27 -9
  132. package/hooks/useAxis.d.mts +2 -2
  133. package/hooks/useAxis.d.ts +2 -2
  134. package/hooks/useTicks.d.mts +1 -1
  135. package/hooks/useTicks.d.ts +1 -1
  136. package/hooks/useTicks.js +21 -3
  137. package/hooks/useTicks.mjs +21 -3
  138. package/index.d.mts +4 -0
  139. package/index.d.ts +4 -0
  140. package/index.js +46 -2
  141. package/index.mjs +5 -1
  142. package/internals/cubiqSolver.d.mts +5 -0
  143. package/internals/cubiqSolver.d.ts +5 -0
  144. package/internals/cubiqSolver.js +62 -0
  145. package/internals/cubiqSolver.mjs +56 -0
  146. package/internals/index.d.mts +5 -1
  147. package/internals/index.d.ts +5 -1
  148. package/internals/index.js +47 -2
  149. package/internals/index.mjs +5 -1
  150. package/internals/isPolar.d.mts +3 -2
  151. package/internals/isPolar.d.ts +3 -2
  152. package/internals/isPolar.js +4 -0
  153. package/internals/isPolar.mjs +3 -0
  154. package/internals/material/index.js +6 -1
  155. package/internals/material/index.mjs +6 -1
  156. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.mts +8 -9
  157. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.ts +8 -9
  158. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +8 -12
  159. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +8 -12
  160. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +1 -0
  161. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +1 -0
  162. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +3 -2
  163. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +3 -2
  164. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +29 -16
  165. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +30 -17
  166. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.js +3 -3
  167. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.mjs +3 -3
  168. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +2 -2
  169. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
  170. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +3 -3
  171. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +3 -3
  172. package/models/axis.d.mts +13 -2
  173. package/models/axis.d.ts +13 -2
  174. package/models/seriesType/bar.d.mts +21 -7
  175. package/models/seriesType/bar.d.ts +21 -7
  176. package/models/seriesType/common.d.mts +10 -0
  177. package/models/seriesType/common.d.ts +10 -0
  178. package/models/seriesType/composition.d.mts +3 -1
  179. package/models/seriesType/composition.d.ts +3 -1
  180. package/models/seriesType/composition.js +6 -2
  181. package/models/seriesType/composition.mjs +5 -1
  182. package/models/seriesType/index.d.mts +3 -3
  183. package/models/seriesType/index.d.ts +3 -3
  184. package/models/seriesType/index.js +0 -22
  185. package/models/seriesType/index.mjs +0 -2
  186. package/models/seriesType/line.d.mts +22 -8
  187. package/models/seriesType/line.d.ts +22 -8
  188. package/models/seriesType/scatter.d.mts +9 -0
  189. package/models/seriesType/scatter.d.ts +9 -0
  190. package/models/slots/chartsBaseSlotProps.d.mts +17 -0
  191. package/models/slots/chartsBaseSlotProps.d.ts +17 -0
  192. package/models/slots/chartsBaseSlots.d.mts +7 -1
  193. package/models/slots/chartsBaseSlots.d.ts +7 -1
  194. package/models/z-axis.d.mts +9 -0
  195. package/models/z-axis.d.ts +9 -0
  196. package/package.json +182 -126
  197. package/themeAugmentation/components.d.mts +4 -0
  198. package/themeAugmentation/components.d.ts +4 -0
  199. package/themeAugmentation/overrides.d.mts +2 -0
  200. package/themeAugmentation/overrides.d.ts +2 -0
  201. package/themeAugmentation/props.d.mts +2 -0
  202. package/themeAugmentation/props.d.ts +2 -0
  203. package/utils/epsilon.d.mts +1 -0
  204. package/utils/epsilon.d.ts +1 -0
  205. package/utils/epsilon.js +7 -0
  206. package/utils/epsilon.mjs +1 -0
@@ -291,7 +291,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
291
291
  onHighlightedAxisChange: _propTypes.default.func,
292
292
  /**
293
293
  * Callback fired when a bar item is clicked.
294
- * @param {MouseEvent} event The event source of the callback.
294
+ * @param {MouseEvent | React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
295
+ * It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
295
296
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
296
297
  */
297
298
  onItemClick: _propTypes.default.func,
@@ -439,7 +440,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
439
440
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
440
441
  tickSize: _propTypes.default.number,
441
442
  tickSpacing: _propTypes.default.number,
442
- valueFormatter: _propTypes.default.func
443
+ valueFormatter: _propTypes.default.func,
444
+ valueGetter: _propTypes.default.func
443
445
  }), _propTypes.default.shape({
444
446
  axis: _propTypes.default.oneOf(['x']),
445
447
  classes: _propTypes.default.object,
@@ -498,7 +500,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
498
500
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
499
501
  tickSize: _propTypes.default.number,
500
502
  tickSpacing: _propTypes.default.number,
501
- valueFormatter: _propTypes.default.func
503
+ valueFormatter: _propTypes.default.func,
504
+ valueGetter: _propTypes.default.func
502
505
  }), _propTypes.default.shape({
503
506
  axis: _propTypes.default.oneOf(['x']),
504
507
  classes: _propTypes.default.object,
@@ -544,7 +547,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
544
547
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
545
548
  tickSize: _propTypes.default.number,
546
549
  tickSpacing: _propTypes.default.number,
547
- valueFormatter: _propTypes.default.func
550
+ valueFormatter: _propTypes.default.func,
551
+ valueGetter: _propTypes.default.func
548
552
  }), _propTypes.default.shape({
549
553
  axis: _propTypes.default.oneOf(['x']),
550
554
  classes: _propTypes.default.object,
@@ -591,7 +595,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
591
595
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
592
596
  tickSize: _propTypes.default.number,
593
597
  tickSpacing: _propTypes.default.number,
594
- valueFormatter: _propTypes.default.func
598
+ valueFormatter: _propTypes.default.func,
599
+ valueGetter: _propTypes.default.func
595
600
  }), _propTypes.default.shape({
596
601
  axis: _propTypes.default.oneOf(['x']),
597
602
  classes: _propTypes.default.object,
@@ -637,7 +642,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
637
642
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
638
643
  tickSize: _propTypes.default.number,
639
644
  tickSpacing: _propTypes.default.number,
640
- valueFormatter: _propTypes.default.func
645
+ valueFormatter: _propTypes.default.func,
646
+ valueGetter: _propTypes.default.func
641
647
  }), _propTypes.default.shape({
642
648
  axis: _propTypes.default.oneOf(['x']),
643
649
  classes: _propTypes.default.object,
@@ -683,7 +689,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
683
689
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
684
690
  tickSize: _propTypes.default.number,
685
691
  tickSpacing: _propTypes.default.number,
686
- valueFormatter: _propTypes.default.func
692
+ valueFormatter: _propTypes.default.func,
693
+ valueGetter: _propTypes.default.func
687
694
  }), _propTypes.default.shape({
688
695
  axis: _propTypes.default.oneOf(['x']),
689
696
  classes: _propTypes.default.object,
@@ -733,7 +740,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
733
740
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
734
741
  tickSize: _propTypes.default.number,
735
742
  tickSpacing: _propTypes.default.number,
736
- valueFormatter: _propTypes.default.func
743
+ valueFormatter: _propTypes.default.func,
744
+ valueGetter: _propTypes.default.func
737
745
  }), _propTypes.default.shape({
738
746
  axis: _propTypes.default.oneOf(['x']),
739
747
  classes: _propTypes.default.object,
@@ -783,7 +791,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
783
791
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
784
792
  tickSize: _propTypes.default.number,
785
793
  tickSpacing: _propTypes.default.number,
786
- valueFormatter: _propTypes.default.func
794
+ valueFormatter: _propTypes.default.func,
795
+ valueGetter: _propTypes.default.func
787
796
  }), _propTypes.default.shape({
788
797
  axis: _propTypes.default.oneOf(['x']),
789
798
  classes: _propTypes.default.object,
@@ -829,7 +838,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
829
838
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
830
839
  tickSize: _propTypes.default.number,
831
840
  tickSpacing: _propTypes.default.number,
832
- valueFormatter: _propTypes.default.func
841
+ valueFormatter: _propTypes.default.func,
842
+ valueGetter: _propTypes.default.func
833
843
  })]).isRequired),
834
844
  /**
835
845
  * The configuration of the y-axes.
@@ -895,6 +905,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
895
905
  tickSize: _propTypes.default.number,
896
906
  tickSpacing: _propTypes.default.number,
897
907
  valueFormatter: _propTypes.default.func,
908
+ valueGetter: _propTypes.default.func,
898
909
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
899
910
  }), _propTypes.default.shape({
900
911
  axis: _propTypes.default.oneOf(['y']),
@@ -953,6 +964,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
953
964
  tickSize: _propTypes.default.number,
954
965
  tickSpacing: _propTypes.default.number,
955
966
  valueFormatter: _propTypes.default.func,
967
+ valueGetter: _propTypes.default.func,
956
968
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
957
969
  }), _propTypes.default.shape({
958
970
  axis: _propTypes.default.oneOf(['y']),
@@ -998,6 +1010,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
998
1010
  tickSize: _propTypes.default.number,
999
1011
  tickSpacing: _propTypes.default.number,
1000
1012
  valueFormatter: _propTypes.default.func,
1013
+ valueGetter: _propTypes.default.func,
1001
1014
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1002
1015
  }), _propTypes.default.shape({
1003
1016
  axis: _propTypes.default.oneOf(['y']),
@@ -1044,6 +1057,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1044
1057
  tickSize: _propTypes.default.number,
1045
1058
  tickSpacing: _propTypes.default.number,
1046
1059
  valueFormatter: _propTypes.default.func,
1060
+ valueGetter: _propTypes.default.func,
1047
1061
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1048
1062
  }), _propTypes.default.shape({
1049
1063
  axis: _propTypes.default.oneOf(['y']),
@@ -1089,6 +1103,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1089
1103
  tickSize: _propTypes.default.number,
1090
1104
  tickSpacing: _propTypes.default.number,
1091
1105
  valueFormatter: _propTypes.default.func,
1106
+ valueGetter: _propTypes.default.func,
1092
1107
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1093
1108
  }), _propTypes.default.shape({
1094
1109
  axis: _propTypes.default.oneOf(['y']),
@@ -1134,6 +1149,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1134
1149
  tickSize: _propTypes.default.number,
1135
1150
  tickSpacing: _propTypes.default.number,
1136
1151
  valueFormatter: _propTypes.default.func,
1152
+ valueGetter: _propTypes.default.func,
1137
1153
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1138
1154
  }), _propTypes.default.shape({
1139
1155
  axis: _propTypes.default.oneOf(['y']),
@@ -1183,6 +1199,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1183
1199
  tickSize: _propTypes.default.number,
1184
1200
  tickSpacing: _propTypes.default.number,
1185
1201
  valueFormatter: _propTypes.default.func,
1202
+ valueGetter: _propTypes.default.func,
1186
1203
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1187
1204
  }), _propTypes.default.shape({
1188
1205
  axis: _propTypes.default.oneOf(['y']),
@@ -1232,6 +1249,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1232
1249
  tickSize: _propTypes.default.number,
1233
1250
  tickSpacing: _propTypes.default.number,
1234
1251
  valueFormatter: _propTypes.default.func,
1252
+ valueGetter: _propTypes.default.func,
1235
1253
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1236
1254
  }), _propTypes.default.shape({
1237
1255
  axis: _propTypes.default.oneOf(['y']),
@@ -1277,6 +1295,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1277
1295
  tickSize: _propTypes.default.number,
1278
1296
  tickSpacing: _propTypes.default.number,
1279
1297
  valueFormatter: _propTypes.default.func,
1298
+ valueGetter: _propTypes.default.func,
1280
1299
  width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
1281
1300
  })]).isRequired)
1282
1301
  } : void 0;
@@ -284,7 +284,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
284
284
  onHighlightedAxisChange: PropTypes.func,
285
285
  /**
286
286
  * Callback fired when a bar item is clicked.
287
- * @param {MouseEvent} event The event source of the callback.
287
+ * @param {MouseEvent | React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
288
+ * It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
288
289
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
289
290
  */
290
291
  onItemClick: PropTypes.func,
@@ -432,7 +433,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
432
433
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
433
434
  tickSize: PropTypes.number,
434
435
  tickSpacing: PropTypes.number,
435
- valueFormatter: PropTypes.func
436
+ valueFormatter: PropTypes.func,
437
+ valueGetter: PropTypes.func
436
438
  }), PropTypes.shape({
437
439
  axis: PropTypes.oneOf(['x']),
438
440
  classes: PropTypes.object,
@@ -491,7 +493,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
491
493
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
492
494
  tickSize: PropTypes.number,
493
495
  tickSpacing: PropTypes.number,
494
- valueFormatter: PropTypes.func
496
+ valueFormatter: PropTypes.func,
497
+ valueGetter: PropTypes.func
495
498
  }), PropTypes.shape({
496
499
  axis: PropTypes.oneOf(['x']),
497
500
  classes: PropTypes.object,
@@ -537,7 +540,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
537
540
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
538
541
  tickSize: PropTypes.number,
539
542
  tickSpacing: PropTypes.number,
540
- valueFormatter: PropTypes.func
543
+ valueFormatter: PropTypes.func,
544
+ valueGetter: PropTypes.func
541
545
  }), PropTypes.shape({
542
546
  axis: PropTypes.oneOf(['x']),
543
547
  classes: PropTypes.object,
@@ -584,7 +588,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
584
588
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
585
589
  tickSize: PropTypes.number,
586
590
  tickSpacing: PropTypes.number,
587
- valueFormatter: PropTypes.func
591
+ valueFormatter: PropTypes.func,
592
+ valueGetter: PropTypes.func
588
593
  }), PropTypes.shape({
589
594
  axis: PropTypes.oneOf(['x']),
590
595
  classes: PropTypes.object,
@@ -630,7 +635,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
630
635
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
631
636
  tickSize: PropTypes.number,
632
637
  tickSpacing: PropTypes.number,
633
- valueFormatter: PropTypes.func
638
+ valueFormatter: PropTypes.func,
639
+ valueGetter: PropTypes.func
634
640
  }), PropTypes.shape({
635
641
  axis: PropTypes.oneOf(['x']),
636
642
  classes: PropTypes.object,
@@ -676,7 +682,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
676
682
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
677
683
  tickSize: PropTypes.number,
678
684
  tickSpacing: PropTypes.number,
679
- valueFormatter: PropTypes.func
685
+ valueFormatter: PropTypes.func,
686
+ valueGetter: PropTypes.func
680
687
  }), PropTypes.shape({
681
688
  axis: PropTypes.oneOf(['x']),
682
689
  classes: PropTypes.object,
@@ -726,7 +733,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
726
733
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
727
734
  tickSize: PropTypes.number,
728
735
  tickSpacing: PropTypes.number,
729
- valueFormatter: PropTypes.func
736
+ valueFormatter: PropTypes.func,
737
+ valueGetter: PropTypes.func
730
738
  }), PropTypes.shape({
731
739
  axis: PropTypes.oneOf(['x']),
732
740
  classes: PropTypes.object,
@@ -776,7 +784,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
776
784
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
777
785
  tickSize: PropTypes.number,
778
786
  tickSpacing: PropTypes.number,
779
- valueFormatter: PropTypes.func
787
+ valueFormatter: PropTypes.func,
788
+ valueGetter: PropTypes.func
780
789
  }), PropTypes.shape({
781
790
  axis: PropTypes.oneOf(['x']),
782
791
  classes: PropTypes.object,
@@ -822,7 +831,8 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
822
831
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
823
832
  tickSize: PropTypes.number,
824
833
  tickSpacing: PropTypes.number,
825
- valueFormatter: PropTypes.func
834
+ valueFormatter: PropTypes.func,
835
+ valueGetter: PropTypes.func
826
836
  })]).isRequired),
827
837
  /**
828
838
  * The configuration of the y-axes.
@@ -888,6 +898,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
888
898
  tickSize: PropTypes.number,
889
899
  tickSpacing: PropTypes.number,
890
900
  valueFormatter: PropTypes.func,
901
+ valueGetter: PropTypes.func,
891
902
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
892
903
  }), PropTypes.shape({
893
904
  axis: PropTypes.oneOf(['y']),
@@ -946,6 +957,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
946
957
  tickSize: PropTypes.number,
947
958
  tickSpacing: PropTypes.number,
948
959
  valueFormatter: PropTypes.func,
960
+ valueGetter: PropTypes.func,
949
961
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
950
962
  }), PropTypes.shape({
951
963
  axis: PropTypes.oneOf(['y']),
@@ -991,6 +1003,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
991
1003
  tickSize: PropTypes.number,
992
1004
  tickSpacing: PropTypes.number,
993
1005
  valueFormatter: PropTypes.func,
1006
+ valueGetter: PropTypes.func,
994
1007
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
995
1008
  }), PropTypes.shape({
996
1009
  axis: PropTypes.oneOf(['y']),
@@ -1037,6 +1050,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1037
1050
  tickSize: PropTypes.number,
1038
1051
  tickSpacing: PropTypes.number,
1039
1052
  valueFormatter: PropTypes.func,
1053
+ valueGetter: PropTypes.func,
1040
1054
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1041
1055
  }), PropTypes.shape({
1042
1056
  axis: PropTypes.oneOf(['y']),
@@ -1082,6 +1096,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1082
1096
  tickSize: PropTypes.number,
1083
1097
  tickSpacing: PropTypes.number,
1084
1098
  valueFormatter: PropTypes.func,
1099
+ valueGetter: PropTypes.func,
1085
1100
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1086
1101
  }), PropTypes.shape({
1087
1102
  axis: PropTypes.oneOf(['y']),
@@ -1127,6 +1142,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1127
1142
  tickSize: PropTypes.number,
1128
1143
  tickSpacing: PropTypes.number,
1129
1144
  valueFormatter: PropTypes.func,
1145
+ valueGetter: PropTypes.func,
1130
1146
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1131
1147
  }), PropTypes.shape({
1132
1148
  axis: PropTypes.oneOf(['y']),
@@ -1176,6 +1192,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1176
1192
  tickSize: PropTypes.number,
1177
1193
  tickSpacing: PropTypes.number,
1178
1194
  valueFormatter: PropTypes.func,
1195
+ valueGetter: PropTypes.func,
1179
1196
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1180
1197
  }), PropTypes.shape({
1181
1198
  axis: PropTypes.oneOf(['y']),
@@ -1225,6 +1242,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1225
1242
  tickSize: PropTypes.number,
1226
1243
  tickSpacing: PropTypes.number,
1227
1244
  valueFormatter: PropTypes.func,
1245
+ valueGetter: PropTypes.func,
1228
1246
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1229
1247
  }), PropTypes.shape({
1230
1248
  axis: PropTypes.oneOf(['y']),
@@ -1270,6 +1288,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1270
1288
  tickSize: PropTypes.number,
1271
1289
  tickSpacing: PropTypes.number,
1272
1290
  valueFormatter: PropTypes.func,
1291
+ valueGetter: PropTypes.func,
1273
1292
  width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
1274
1293
  })]).isRequired)
1275
1294
  } : 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,
@@ -102,7 +102,8 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
102
102
  className: _propTypes.default.string,
103
103
  /**
104
104
  * Callback fired when a bar item is clicked.
105
- * @param {MouseEvent} event The event source of the callback.
105
+ * @param {MouseEvent | React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
106
+ * It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
106
107
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
107
108
  */
108
109
  onItemClick: _propTypes.default.func,
@@ -95,7 +95,8 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
95
95
  className: PropTypes.string,
96
96
  /**
97
97
  * Callback fired when a bar item is clicked.
98
- * @param {MouseEvent} event The event source of the callback.
98
+ * @param {MouseEvent | React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
99
+ * It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
99
100
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
100
101
  */
101
102
  onItemClick: PropTypes.func,
@@ -3,14 +3,8 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
3
3
  id: string;
4
4
  color: string;
5
5
  type: "bar";
6
- data?: ReadonlyArray<import("../../../index.mjs").BarValueType | null>;
7
- dataKey?: string;
8
- label?: string | ((location: "tooltip" | "legend") => string);
9
- layout?: "horizontal" | "vertical";
10
- stackOffset?: import("../../../index.mjs").StackOffsetType;
11
- minBarSize?: number;
12
- barLabel?: "value" | ((item: import("@mui/x-charts/BarChart").BarItem, context: import("@mui/x-charts/BarChart").BarLabelContext) => string | null | undefined);
13
6
  barLabelPlacement?: "center" | "outside";
7
+ stackOffset?: import("../../../index.mjs").StackOffsetType;
14
8
  valueFormatter?: import("../../../internals/index.mjs").SeriesValueFormatter<number | null> | undefined;
15
9
  highlightScope?: import("../../../internals/index.mjs").CommonHighlightScope | undefined;
16
10
  labelMarkType?: import("../../../internals/index.mjs").ChartsLabelMarkType;
@@ -19,4 +13,11 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
19
13
  yAxisId?: import("../../../internals/index.mjs").AxisId;
20
14
  stack?: string;
21
15
  stackOrder?: import("../../../index.mjs").StackOrderType;
16
+ data?: ReadonlyArray<import("../../../index.mjs").BarValueType | null>;
17
+ dataKey?: string;
18
+ valueGetter?: (item: import("../../../internals/index.mjs").DatasetElementType<unknown>) => import("../../../index.mjs").BarValueType | null;
19
+ label?: string | ((location: "tooltip" | "legend") => string);
20
+ layout?: "horizontal" | "vertical";
21
+ minBarSize?: number;
22
+ barLabel?: "value" | ((item: import("@mui/x-charts/BarChart").BarItem, context: import("@mui/x-charts/BarChart").BarLabelContext) => string | null | undefined);
22
23
  };
@@ -3,14 +3,8 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
3
3
  id: string;
4
4
  color: string;
5
5
  type: "bar";
6
- data?: ReadonlyArray<import("../../../index.js").BarValueType | null>;
7
- dataKey?: string;
8
- label?: string | ((location: "tooltip" | "legend") => string);
9
- layout?: "horizontal" | "vertical";
10
- stackOffset?: import("../../../index.js").StackOffsetType;
11
- minBarSize?: number;
12
- barLabel?: "value" | ((item: import("@mui/x-charts/BarChart").BarItem, context: import("@mui/x-charts/BarChart").BarLabelContext) => string | null | undefined);
13
6
  barLabelPlacement?: "center" | "outside";
7
+ stackOffset?: import("../../../index.js").StackOffsetType;
14
8
  valueFormatter?: import("../../../internals/index.js").SeriesValueFormatter<number | null> | undefined;
15
9
  highlightScope?: import("../../../internals/index.js").CommonHighlightScope | undefined;
16
10
  labelMarkType?: import("../../../internals/index.js").ChartsLabelMarkType;
@@ -19,4 +13,11 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
19
13
  yAxisId?: import("../../../internals/index.js").AxisId;
20
14
  stack?: string;
21
15
  stackOrder?: import("../../../index.js").StackOrderType;
16
+ data?: ReadonlyArray<import("../../../index.js").BarValueType | null>;
17
+ dataKey?: string;
18
+ valueGetter?: (item: import("../../../internals/index.js").DatasetElementType<unknown>) => import("../../../index.js").BarValueType | null;
19
+ label?: string | ((location: "tooltip" | "legend") => string);
20
+ layout?: "horizontal" | "vertical";
21
+ minBarSize?: number;
22
+ barLabel?: "value" | ((item: import("@mui/x-charts/BarChart").BarItem, context: import("@mui/x-charts/BarChart").BarLabelContext) => string | null | undefined);
22
23
  };
@@ -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