@mui/x-charts 8.19.0 → 8.21.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 (168) hide show
  1. package/BarChart/BarChart.d.ts +1 -1
  2. package/BarChart/BarChart.js +18 -0
  3. package/BarChart/BarLabel/BarLabel.types.d.ts +4 -3
  4. package/BarChart/BarLabel/BarLabelItem.d.ts +5 -4
  5. package/BarChart/BarLabel/BarLabelPlot.d.ts +25 -6
  6. package/BarChart/BarLabel/BarLabelPlot.js +10 -9
  7. package/BarChart/BarLabel/getBarLabel.d.ts +5 -4
  8. package/BarChart/BarLabel/getBarLabel.js +3 -4
  9. package/BarChart/BarPlot.js +4 -3
  10. package/BarChart/checkBarChartScaleErrors.d.ts +7 -0
  11. package/BarChart/{checkScaleErrors.js → checkBarChartScaleErrors.js} +6 -7
  12. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +5 -3
  13. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.js +3 -4
  14. package/BarChart/seriesConfig/index.js +2 -2
  15. package/BarChart/types.d.ts +6 -3
  16. package/BarChart/useBarPlotData.js +17 -45
  17. package/CHANGELOG.md +174 -0
  18. package/ChartContainer/ChartContainer.js +28 -0
  19. package/ChartsGrid/ChartsHorizontalGrid.js +8 -2
  20. package/ChartsGrid/ChartsVerticalGrid.js +8 -2
  21. package/ChartsTooltip/ChartsTooltipContainer.js +2 -1
  22. package/ChartsXAxis/ChartsSingleXAxisTicks.js +2 -0
  23. package/ChartsXAxis/ChartsXAxisImpl.js +2 -0
  24. package/ChartsXAxis/useAxisTicksProps.d.ts +198 -117
  25. package/ChartsXAxis/useAxisTicksProps.js +2 -0
  26. package/ChartsYAxis/ChartsSingleYAxisTicks.js +2 -0
  27. package/ChartsYAxis/ChartsYAxisImpl.js +2 -0
  28. package/ChartsYAxis/useAxisTicksProps.d.ts +198 -117
  29. package/ChartsYAxis/useAxisTicksProps.js +2 -0
  30. package/LineChart/LineChart.js +18 -0
  31. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +2 -2
  32. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +2 -2
  33. package/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.d.ts +7 -0
  34. package/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.js +26 -0
  35. package/RadarChart/seriesConfig/index.js +2 -0
  36. package/RadarChart/seriesConfig/tooltipPosition.d.ts +3 -0
  37. package/RadarChart/seriesConfig/tooltipPosition.js +80 -0
  38. package/ScatterChart/ScatterChart.js +18 -0
  39. package/SparkLineChart/SparkLineChart.js +18 -0
  40. package/esm/BarChart/BarChart.d.ts +1 -1
  41. package/esm/BarChart/BarChart.js +18 -0
  42. package/esm/BarChart/BarLabel/BarLabel.types.d.ts +4 -3
  43. package/esm/BarChart/BarLabel/BarLabelItem.d.ts +5 -4
  44. package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +25 -6
  45. package/esm/BarChart/BarLabel/BarLabelPlot.js +9 -9
  46. package/esm/BarChart/BarLabel/getBarLabel.d.ts +5 -4
  47. package/esm/BarChart/BarLabel/getBarLabel.js +2 -2
  48. package/esm/BarChart/BarPlot.js +4 -3
  49. package/esm/BarChart/checkBarChartScaleErrors.d.ts +7 -0
  50. package/esm/BarChart/{checkScaleErrors.js → checkBarChartScaleErrors.js} +5 -6
  51. package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +5 -3
  52. package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.js +2 -3
  53. package/esm/BarChart/seriesConfig/index.js +1 -1
  54. package/esm/BarChart/types.d.ts +6 -3
  55. package/esm/BarChart/useBarPlotData.js +17 -45
  56. package/esm/ChartContainer/ChartContainer.js +28 -0
  57. package/esm/ChartsGrid/ChartsHorizontalGrid.js +8 -2
  58. package/esm/ChartsGrid/ChartsVerticalGrid.js +8 -2
  59. package/esm/ChartsTooltip/ChartsTooltipContainer.js +2 -1
  60. package/esm/ChartsXAxis/ChartsSingleXAxisTicks.js +2 -0
  61. package/esm/ChartsXAxis/ChartsXAxisImpl.js +2 -0
  62. package/esm/ChartsXAxis/useAxisTicksProps.d.ts +198 -117
  63. package/esm/ChartsXAxis/useAxisTicksProps.js +2 -0
  64. package/esm/ChartsYAxis/ChartsSingleYAxisTicks.js +2 -0
  65. package/esm/ChartsYAxis/ChartsYAxisImpl.js +2 -0
  66. package/esm/ChartsYAxis/useAxisTicksProps.d.ts +198 -117
  67. package/esm/ChartsYAxis/useAxisTicksProps.js +2 -0
  68. package/esm/LineChart/LineChart.js +18 -0
  69. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +1 -1
  70. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +1 -1
  71. package/esm/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.d.ts +7 -0
  72. package/esm/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.js +18 -0
  73. package/esm/RadarChart/seriesConfig/index.js +2 -0
  74. package/esm/RadarChart/seriesConfig/tooltipPosition.d.ts +3 -0
  75. package/esm/RadarChart/seriesConfig/tooltipPosition.js +74 -0
  76. package/esm/ScatterChart/ScatterChart.js +18 -0
  77. package/esm/SparkLineChart/SparkLineChart.js +18 -0
  78. package/esm/hooks/useInteractionItemProps.d.ts +0 -5
  79. package/esm/hooks/useInteractionItemProps.js +0 -11
  80. package/esm/hooks/useIsHydrated.js +1 -1
  81. package/esm/hooks/useTicks.d.ts +15 -2
  82. package/esm/hooks/useTicks.js +44 -6
  83. package/esm/index.js +1 -1
  84. package/esm/internals/domUtils.d.ts +6 -3
  85. package/esm/internals/getBandSize.d.ts +13 -0
  86. package/esm/internals/getBandSize.js +23 -0
  87. package/esm/internals/getWordsByLines.d.ts +2 -1
  88. package/esm/internals/index.d.ts +5 -0
  89. package/esm/internals/index.js +5 -0
  90. package/esm/internals/plugins/corePlugins/useChartSeries/index.d.ts +1 -1
  91. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +25 -10
  92. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.js +49 -12
  93. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +5 -7
  94. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +19 -4
  95. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +23 -4
  96. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +5 -3
  97. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +5 -5
  98. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +2 -2
  99. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -2
  100. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +1 -1
  101. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -4
  102. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +16 -12
  103. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +7 -7
  104. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +4 -0
  105. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +1 -1
  106. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +37 -22
  107. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +15 -10
  108. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -0
  109. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +10 -7
  110. package/esm/internals/plugins/models/seriesConfig/index.d.ts +1 -0
  111. package/esm/internals/plugins/models/seriesConfig/index.js +1 -0
  112. package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +5 -0
  113. package/esm/internals/plugins/models/seriesConfig/seriesLayout.types.d.ts +6 -0
  114. package/esm/internals/plugins/models/seriesConfig/seriesLayout.types.js +1 -0
  115. package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +6 -4
  116. package/esm/internals/seriesSelectorOfType.d.ts +3 -3
  117. package/esm/internals/seriesSelectorOfType.js +1 -1
  118. package/esm/models/axis.d.ts +5 -0
  119. package/esm/models/seriesType/bar.d.ts +3 -2
  120. package/esm/models/seriesType/config.d.ts +10 -0
  121. package/esm/models/seriesType/index.d.ts +1 -0
  122. package/hooks/useInteractionItemProps.d.ts +0 -5
  123. package/hooks/useInteractionItemProps.js +1 -13
  124. package/hooks/useIsHydrated.js +1 -1
  125. package/hooks/useTicks.d.ts +15 -2
  126. package/hooks/useTicks.js +45 -6
  127. package/index.js +1 -1
  128. package/internals/domUtils.d.ts +6 -3
  129. package/internals/getBandSize.d.ts +13 -0
  130. package/internals/getBandSize.js +29 -0
  131. package/internals/getWordsByLines.d.ts +2 -1
  132. package/internals/index.d.ts +5 -0
  133. package/internals/index.js +48 -0
  134. package/internals/plugins/corePlugins/useChartSeries/index.d.ts +1 -1
  135. package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +25 -10
  136. package/internals/plugins/corePlugins/useChartSeries/processSeries.js +53 -14
  137. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +4 -6
  138. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +19 -4
  139. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +23 -4
  140. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +5 -3
  141. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +4 -4
  142. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +2 -2
  143. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -2
  144. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +1 -1
  145. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -4
  146. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +16 -12
  147. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +7 -7
  148. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +4 -0
  149. package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +1 -1
  150. package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +35 -20
  151. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +15 -10
  152. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -0
  153. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +10 -6
  154. package/internals/plugins/models/seriesConfig/index.d.ts +1 -0
  155. package/internals/plugins/models/seriesConfig/index.js +11 -0
  156. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +5 -0
  157. package/internals/plugins/models/seriesConfig/seriesLayout.types.d.ts +6 -0
  158. package/internals/plugins/models/seriesConfig/seriesLayout.types.js +5 -0
  159. package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +6 -4
  160. package/internals/seriesSelectorOfType.d.ts +3 -3
  161. package/internals/seriesSelectorOfType.js +1 -1
  162. package/models/axis.d.ts +5 -0
  163. package/models/seriesType/bar.d.ts +3 -2
  164. package/models/seriesType/config.d.ts +10 -0
  165. package/models/seriesType/index.d.ts +1 -0
  166. package/package.json +4 -4
  167. package/BarChart/checkScaleErrors.d.ts +0 -10
  168. package/esm/BarChart/checkScaleErrors.d.ts +0 -10
@@ -21,7 +21,7 @@ export interface BarChartProps extends Omit<ChartContainerProps<'bar', BarChartP
21
21
  * The series to display in the bar chart.
22
22
  * An array of [[BarSeries]] objects.
23
23
  */
24
- series: Readonly<BarSeries[]>;
24
+ series: ReadonlyArray<BarSeries>;
25
25
  /**
26
26
  * Option to display a cartesian grid in the background.
27
27
  */
@@ -308,6 +308,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
308
308
  tickNumber: _propTypes.default.number,
309
309
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
310
310
  tickSize: _propTypes.default.number,
311
+ tickSpacing: _propTypes.default.number,
311
312
  valueFormatter: _propTypes.default.func
312
313
  }), _propTypes.default.shape({
313
314
  axis: _propTypes.default.oneOf(['x']),
@@ -360,6 +361,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
360
361
  tickNumber: _propTypes.default.number,
361
362
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
362
363
  tickSize: _propTypes.default.number,
364
+ tickSpacing: _propTypes.default.number,
363
365
  valueFormatter: _propTypes.default.func
364
366
  }), _propTypes.default.shape({
365
367
  axis: _propTypes.default.oneOf(['x']),
@@ -404,6 +406,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
404
406
  tickNumber: _propTypes.default.number,
405
407
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
406
408
  tickSize: _propTypes.default.number,
409
+ tickSpacing: _propTypes.default.number,
407
410
  valueFormatter: _propTypes.default.func
408
411
  }), _propTypes.default.shape({
409
412
  axis: _propTypes.default.oneOf(['x']),
@@ -449,6 +452,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
449
452
  tickNumber: _propTypes.default.number,
450
453
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
451
454
  tickSize: _propTypes.default.number,
455
+ tickSpacing: _propTypes.default.number,
452
456
  valueFormatter: _propTypes.default.func
453
457
  }), _propTypes.default.shape({
454
458
  axis: _propTypes.default.oneOf(['x']),
@@ -493,6 +497,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
493
497
  tickNumber: _propTypes.default.number,
494
498
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
495
499
  tickSize: _propTypes.default.number,
500
+ tickSpacing: _propTypes.default.number,
496
501
  valueFormatter: _propTypes.default.func
497
502
  }), _propTypes.default.shape({
498
503
  axis: _propTypes.default.oneOf(['x']),
@@ -537,6 +542,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
537
542
  tickNumber: _propTypes.default.number,
538
543
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
539
544
  tickSize: _propTypes.default.number,
545
+ tickSpacing: _propTypes.default.number,
540
546
  valueFormatter: _propTypes.default.func
541
547
  }), _propTypes.default.shape({
542
548
  axis: _propTypes.default.oneOf(['x']),
@@ -585,6 +591,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
585
591
  tickNumber: _propTypes.default.number,
586
592
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
587
593
  tickSize: _propTypes.default.number,
594
+ tickSpacing: _propTypes.default.number,
588
595
  valueFormatter: _propTypes.default.func
589
596
  }), _propTypes.default.shape({
590
597
  axis: _propTypes.default.oneOf(['x']),
@@ -633,6 +640,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
633
640
  tickNumber: _propTypes.default.number,
634
641
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
635
642
  tickSize: _propTypes.default.number,
643
+ tickSpacing: _propTypes.default.number,
636
644
  valueFormatter: _propTypes.default.func
637
645
  }), _propTypes.default.shape({
638
646
  axis: _propTypes.default.oneOf(['x']),
@@ -677,6 +685,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
677
685
  tickNumber: _propTypes.default.number,
678
686
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
679
687
  tickSize: _propTypes.default.number,
688
+ tickSpacing: _propTypes.default.number,
680
689
  valueFormatter: _propTypes.default.func
681
690
  })]).isRequired),
682
691
  /**
@@ -735,6 +744,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
735
744
  tickNumber: _propTypes.default.number,
736
745
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
737
746
  tickSize: _propTypes.default.number,
747
+ tickSpacing: _propTypes.default.number,
738
748
  valueFormatter: _propTypes.default.func,
739
749
  width: _propTypes.default.number
740
750
  }), _propTypes.default.shape({
@@ -786,6 +796,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
786
796
  tickNumber: _propTypes.default.number,
787
797
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
788
798
  tickSize: _propTypes.default.number,
799
+ tickSpacing: _propTypes.default.number,
789
800
  valueFormatter: _propTypes.default.func,
790
801
  width: _propTypes.default.number
791
802
  }), _propTypes.default.shape({
@@ -829,6 +840,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
829
840
  tickNumber: _propTypes.default.number,
830
841
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
831
842
  tickSize: _propTypes.default.number,
843
+ tickSpacing: _propTypes.default.number,
832
844
  valueFormatter: _propTypes.default.func,
833
845
  width: _propTypes.default.number
834
846
  }), _propTypes.default.shape({
@@ -873,6 +885,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
873
885
  tickNumber: _propTypes.default.number,
874
886
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
875
887
  tickSize: _propTypes.default.number,
888
+ tickSpacing: _propTypes.default.number,
876
889
  valueFormatter: _propTypes.default.func,
877
890
  width: _propTypes.default.number
878
891
  }), _propTypes.default.shape({
@@ -916,6 +929,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
916
929
  tickNumber: _propTypes.default.number,
917
930
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
918
931
  tickSize: _propTypes.default.number,
932
+ tickSpacing: _propTypes.default.number,
919
933
  valueFormatter: _propTypes.default.func,
920
934
  width: _propTypes.default.number
921
935
  }), _propTypes.default.shape({
@@ -959,6 +973,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
959
973
  tickNumber: _propTypes.default.number,
960
974
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
961
975
  tickSize: _propTypes.default.number,
976
+ tickSpacing: _propTypes.default.number,
962
977
  valueFormatter: _propTypes.default.func,
963
978
  width: _propTypes.default.number
964
979
  }), _propTypes.default.shape({
@@ -1006,6 +1021,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1006
1021
  tickNumber: _propTypes.default.number,
1007
1022
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
1008
1023
  tickSize: _propTypes.default.number,
1024
+ tickSpacing: _propTypes.default.number,
1009
1025
  valueFormatter: _propTypes.default.func,
1010
1026
  width: _propTypes.default.number
1011
1027
  }), _propTypes.default.shape({
@@ -1053,6 +1069,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1053
1069
  tickNumber: _propTypes.default.number,
1054
1070
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
1055
1071
  tickSize: _propTypes.default.number,
1072
+ tickSpacing: _propTypes.default.number,
1056
1073
  valueFormatter: _propTypes.default.func,
1057
1074
  width: _propTypes.default.number
1058
1075
  }), _propTypes.default.shape({
@@ -1096,6 +1113,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
1096
1113
  tickNumber: _propTypes.default.number,
1097
1114
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
1098
1115
  tickSize: _propTypes.default.number,
1116
+ tickSpacing: _propTypes.default.number,
1099
1117
  valueFormatter: _propTypes.default.func,
1100
1118
  width: _propTypes.default.number
1101
1119
  })]).isRequired)
@@ -1,5 +1,6 @@
1
1
  import { SeriesId } from "../../models/seriesType/common.js";
2
2
  import type { BarLabelClasses } from "./barLabelClasses.js";
3
+ import { BarValueType } from "../../models/index.js";
3
4
  export interface BarLabelOwnerState {
4
5
  seriesId: SeriesId;
5
6
  dataIndex: number;
@@ -10,7 +11,7 @@ export interface BarLabelOwnerState {
10
11
  layout: 'vertical' | 'horizontal';
11
12
  classes?: Partial<BarLabelClasses>;
12
13
  }
13
- export type BarItem = {
14
+ export type BarItem<V extends BarValueType | null = BarValueType | null> = {
14
15
  /**
15
16
  * The series id of the bar.
16
17
  */
@@ -22,7 +23,7 @@ export type BarItem = {
22
23
  /**
23
24
  * The value of the data point.
24
25
  */
25
- value: number | null;
26
+ value: V;
26
27
  };
27
28
  export type BarLabelContext = {
28
29
  bar: {
@@ -38,4 +39,4 @@ export type BarLabelContext = {
38
39
  width: number;
39
40
  };
40
41
  };
41
- export type BarLabelFunction = (item: BarItem, context: BarLabelContext) => string | null | undefined;
42
+ export type BarLabelFunction<V extends BarValueType | null = BarValueType | null> = (item: BarItem<V>, context: BarLabelContext) => string | null | undefined;
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
3
3
  import { BarLabelOwnerState, BarItem, BarLabelContext } from "./BarLabel.types.js";
4
4
  import { BarLabelProps } from "./BarLabel.js";
5
+ import { BarValueType } from "../../models/index.js";
5
6
  export interface BarLabelSlots {
6
7
  /**
7
8
  * The component that renders the bar label.
@@ -12,7 +13,7 @@ export interface BarLabelSlots {
12
13
  export interface BarLabelSlotProps {
13
14
  barLabel?: SlotComponentPropsFromProps<BarLabelProps, {}, BarLabelOwnerState>;
14
15
  }
15
- export type BarLabelItemProps = Omit<BarLabelOwnerState, 'isFaded' | 'isHighlighted'> & Pick<BarLabelProps, 'style'> & {
16
+ export type BarLabelItemProps<V extends BarValueType | null> = Omit<BarLabelOwnerState, 'isFaded' | 'isHighlighted'> & Pick<BarLabelProps, 'style'> & {
16
17
  /**
17
18
  * The props used for each component slot.
18
19
  * @default {}
@@ -54,7 +55,7 @@ export type BarLabelItemProps = Omit<BarLabelOwnerState, 'isFaded' | 'isHighligh
54
55
  /**
55
56
  * The value of the data point.
56
57
  */
57
- value: number | null;
58
+ value: V;
58
59
  /**
59
60
  * If true, no animations should be applied.
60
61
  */
@@ -66,7 +67,7 @@ export type BarLabelItemProps = Omit<BarLabelOwnerState, 'isFaded' | 'isHighligh
66
67
  * @param {BarLabelContext} context data about the bar.
67
68
  * @returns {string} The formatted label.
68
69
  */
69
- barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined);
70
+ barLabel?: 'value' | ((item: BarItem<V>, context: BarLabelContext) => string | null | undefined);
70
71
  /**
71
72
  * The placement of the bar label.
72
73
  * It controls whether the label is rendered in the center or outside the bar.
@@ -77,7 +78,7 @@ export type BarLabelItemProps = Omit<BarLabelOwnerState, 'isFaded' | 'isHighligh
77
78
  /**
78
79
  * @ignore - internal component.
79
80
  */
80
- declare function BarLabelItem(props: BarLabelItemProps): import("react/jsx-runtime").JSX.Element | null;
81
+ declare function BarLabelItem<V extends BarValueType | null = BarValueType | null>(props: BarLabelItemProps<V>): import("react/jsx-runtime").JSX.Element | null;
81
82
  declare namespace BarLabelItem {
82
83
  var propTypes: any;
83
84
  }
@@ -1,12 +1,31 @@
1
- import type { ProcessedBarSeriesData } from "../types.js";
1
+ import { AnimationData } from "../types.js";
2
2
  import { BarLabelItemProps } from "./BarLabelItem.js";
3
- type BarLabelPlotProps = {
4
- processedSeries: ProcessedBarSeriesData;
3
+ import type { SeriesId } from "../../models/seriesType/common.js";
4
+ import { BarSeriesType, BarValueType } from "../../models/seriesType/bar.js";
5
+ import { BarLabelFunction } from "./BarLabel.types.js";
6
+ interface BarLabelPlotProps<V extends BarValueType | null = BarValueType | null> {
7
+ processedSeries: ProcessedBarLabelSeriesData<V>;
8
+ className: string;
5
9
  skipAnimation?: boolean;
6
- barLabel?: BarLabelItemProps['barLabel'];
7
- };
10
+ barLabel?: BarLabelItemProps<V | null>['barLabel'];
11
+ }
12
+ export interface ProcessedBarLabelSeriesData<V extends BarValueType | null> {
13
+ seriesId: SeriesId;
14
+ data: ProcessedBarLabelData<V>[];
15
+ barLabel?: 'value' | BarLabelFunction<V>;
16
+ barLabelPlacement?: BarSeriesType['barLabelPlacement'];
17
+ layout?: 'vertical' | 'horizontal';
18
+ xOrigin: number;
19
+ yOrigin: number;
20
+ }
21
+ export interface ProcessedBarLabelData<V extends BarValueType | null> extends AnimationData {
22
+ seriesId: SeriesId;
23
+ dataIndex: number;
24
+ color: string;
25
+ value: V;
26
+ }
8
27
  /**
9
28
  * @ignore - internal component.
10
29
  */
11
- declare function BarLabelPlot(props: BarLabelPlotProps): import("react/jsx-runtime").JSX.Element | null;
30
+ declare function BarLabelPlot<V extends BarValueType | null = BarValueType | null>(props: BarLabelPlotProps<V>): import("react/jsx-runtime").JSX.Element | null;
12
31
  export { BarLabelPlot };
@@ -1,48 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.BarLabelPlot = BarLabelPlot;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
+ var React = _interopRequireWildcard(require("react"));
10
12
  var _BarLabelItem = require("./BarLabelItem");
11
- var _barClasses = require("../barClasses");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
- const _excluded = ["processedSeries", "skipAnimation"];
14
+ const _excluded = ["processedSeries", "className", "skipAnimation"];
14
15
  /**
15
16
  * @ignore - internal component.
16
17
  */
17
18
  function BarLabelPlot(props) {
18
19
  const {
19
20
  processedSeries,
21
+ className,
20
22
  skipAnimation
21
23
  } = props,
22
24
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
23
25
  const {
24
26
  seriesId,
25
- data
27
+ data,
28
+ layout,
29
+ xOrigin,
30
+ yOrigin
26
31
  } = processedSeries;
27
- const classes = (0, _barClasses.useUtilityClasses)();
28
32
  const barLabel = processedSeries.barLabel ?? props.barLabel;
29
33
  if (!barLabel) {
30
34
  return null;
31
35
  }
32
36
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
33
- className: classes.seriesLabels,
37
+ className: className,
34
38
  "data-series": seriesId,
35
39
  children: data.map(({
36
- xOrigin,
37
- yOrigin,
38
40
  x,
39
41
  y,
40
42
  dataIndex,
41
43
  color,
42
44
  value,
43
45
  width,
44
- height,
45
- layout
46
+ height
46
47
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelItem.BarLabelItem, (0, _extends2.default)({
47
48
  seriesId: seriesId,
48
49
  dataIndex: dataIndex,
@@ -1,10 +1,11 @@
1
1
  import { SeriesId } from "../../models/seriesType/common.js";
2
2
  import { BarLabelFunction } from "./BarLabel.types.js";
3
- export declare const getBarLabel: (options: {
4
- barLabel: "value" | BarLabelFunction;
5
- value: number | null;
3
+ import { BarValueType } from "../../models/seriesType/bar.js";
4
+ export declare function getBarLabel<V extends BarValueType | null = BarValueType | null>(options: {
5
+ barLabel: 'value' | BarLabelFunction<V>;
6
+ value: V;
6
7
  dataIndex: number;
7
8
  seriesId: SeriesId;
8
9
  height: number;
9
10
  width: number;
10
- }) => string | null | undefined;
11
+ }): string | null | undefined;
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getBarLabel = void 0;
7
- const getBarLabel = options => {
6
+ exports.getBarLabel = getBarLabel;
7
+ function getBarLabel(options) {
8
8
  const {
9
9
  barLabel,
10
10
  value,
@@ -27,5 +27,4 @@ const getBarLabel = options => {
27
27
  width
28
28
  }
29
29
  });
30
- };
31
- exports.getBarLabel = getBarLabel;
30
+ }
@@ -95,6 +95,9 @@ function BarPlot(props) {
95
95
  }, id);
96
96
  }), completedData.map(({
97
97
  seriesId,
98
+ layout,
99
+ xOrigin,
100
+ yOrigin,
98
101
  data
99
102
  }) => {
100
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
@@ -104,11 +107,8 @@ function BarPlot(props) {
104
107
  dataIndex,
105
108
  color,
106
109
  maskId,
107
- layout,
108
110
  x,
109
- xOrigin,
110
111
  y,
111
- yOrigin,
112
112
  width,
113
113
  height
114
114
  }) => {
@@ -143,6 +143,7 @@ function BarPlot(props) {
143
143
  })
144
144
  }, seriesId);
145
145
  }), completedData.map(processedSeries => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelPlot.BarLabelPlot, (0, _extends2.default)({
146
+ className: classes.seriesLabels,
146
147
  processedSeries: processedSeries,
147
148
  skipAnimation: skipAnimation,
148
149
  barLabel: barLabel
@@ -0,0 +1,7 @@
1
+ import { AxisId, ComputedXAxis, ComputedYAxis } from "../models/axis.js";
2
+ import { SeriesId } from "../models/seriesType/common.js";
3
+ export declare function checkBarChartScaleErrors(verticalLayout: boolean, seriesId: SeriesId, seriesDataLength: number, xAxisId: AxisId, xAxis: {
4
+ [axisId: AxisId]: Pick<ComputedXAxis, 'scaleType' | 'data'>;
5
+ }, yAxisId: AxisId, yAxis: {
6
+ [axisId: AxisId]: Pick<ComputedYAxis, 'scaleType' | 'data'>;
7
+ }): void;
@@ -3,17 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.checkScaleErrors = checkScaleErrors;
6
+ exports.checkBarChartScaleErrors = checkBarChartScaleErrors;
7
7
  var _warning = require("@mui/x-internals/warning");
8
8
  var _constants = require("../constants");
9
- var _axis = require("../models/axis");
10
9
  const getAxisMessage = (axisDirection, axisId) => {
11
10
  const axisName = `${axisDirection}-axis`;
12
11
  const axisIdName = `${axisDirection}Axis`;
13
12
  const axisDefaultKey = axisDirection === 'x' ? _constants.DEFAULT_X_AXIS_KEY : _constants.DEFAULT_Y_AXIS_KEY;
14
13
  return axisId === axisDefaultKey ? `The first \`${axisIdName}\`` : `The ${axisName} with id "${axisId}"`;
15
14
  };
16
- function checkScaleErrors(verticalLayout, seriesId, series, xAxisId, xAxis, yAxisId, yAxis) {
15
+ function checkBarChartScaleErrors(verticalLayout, seriesId, seriesDataLength, xAxisId, xAxis, yAxisId, yAxis) {
17
16
  const xAxisConfig = xAxis[xAxisId];
18
17
  const yAxisConfig = yAxis[yAxisId];
19
18
  const discreteAxisConfig = verticalLayout ? xAxisConfig : yAxisConfig;
@@ -22,18 +21,18 @@ function checkScaleErrors(verticalLayout, seriesId, series, xAxisId, xAxis, yAxi
22
21
  const continuousAxisId = verticalLayout ? yAxisId : xAxisId;
23
22
  const discreteAxisDirection = verticalLayout ? 'x' : 'y';
24
23
  const continuousAxisDirection = verticalLayout ? 'y' : 'x';
25
- if (!(0, _axis.isBandScaleConfig)(discreteAxisConfig)) {
24
+ if (discreteAxisConfig.scaleType !== 'band') {
26
25
  throw new Error(`MUI X Charts: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} should be of type "band" to display the bar series of id "${seriesId}".`);
27
26
  }
28
27
  if (discreteAxisConfig.data === undefined) {
29
28
  throw new Error(`MUI X Charts: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} should have data property.`);
30
29
  }
31
- if ((0, _axis.isBandScaleConfig)(continuousAxisConfig) || (0, _axis.isPointScaleConfig)(continuousAxisConfig)) {
30
+ if (continuousAxisConfig.scaleType === 'band' || continuousAxisConfig.scaleType === 'point') {
32
31
  throw new Error(`MUI X Charts: ${getAxisMessage(continuousAxisDirection, continuousAxisId)} should be a continuous type to display the bar series of id "${seriesId}".`);
33
32
  }
34
33
  if (process.env.NODE_ENV !== 'production') {
35
- if (discreteAxisConfig.data.length < series.stackedData.length) {
36
- (0, _warning.warnOnce)([`MUI X Charts: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} has less data (${discreteAxisConfig.data.length} values) than the bar series of id "${seriesId}" (${series.stackedData.length} values).`, 'The axis data should have at least the same length than the series using it.'], 'error');
34
+ if (discreteAxisConfig.data.length < seriesDataLength) {
35
+ (0, _warning.warnOnce)([`MUI X Charts: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} has less data (${discreteAxisConfig.data.length} values) than the bar series of id "${seriesId}" (${seriesDataLength} values).`, 'The axis data should have at least the same length than the series using it.'], 'error');
37
36
  }
38
37
  }
39
38
  }
@@ -1,3 +1,5 @@
1
- import type { GetSeriesWithDefaultValues } from "../../../internals/plugins/models/seriesConfig/index.js";
2
- declare const getSeriesWithDefaultValues: GetSeriesWithDefaultValues<'bar'>;
3
- export default getSeriesWithDefaultValues;
1
+ import { AllSeriesType } from "../../../models/seriesType/index.js";
2
+ export declare function getSeriesWithDefaultValues<T extends 'bar'>(seriesData: AllSeriesType<T>, seriesIndex: number, colors: readonly string[]): AllSeriesType<T> & {
3
+ id: import("../../../index.js").SeriesId;
4
+ color: string;
5
+ };
@@ -4,12 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.getSeriesWithDefaultValues = getSeriesWithDefaultValues;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
9
+ function getSeriesWithDefaultValues(seriesData, seriesIndex, colors) {
10
10
  return (0, _extends2.default)({}, seriesData, {
11
11
  id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
12
12
  color: seriesData.color ?? colors[seriesIndex % colors.length]
13
13
  });
14
- };
15
- var _default = exports.default = getSeriesWithDefaultValues;
14
+ }
@@ -12,7 +12,7 @@ var _legend = _interopRequireDefault(require("./bar/legend"));
12
12
  var _getColor = _interopRequireDefault(require("./bar/getColor"));
13
13
  var _tooltip = _interopRequireWildcard(require("./bar/tooltip"));
14
14
  var _tooltipPosition = _interopRequireDefault(require("./bar/tooltipPosition"));
15
- var _getSeriesWithDefaultValues = _interopRequireDefault(require("./bar/getSeriesWithDefaultValues"));
15
+ var _getSeriesWithDefaultValues = require("./bar/getSeriesWithDefaultValues");
16
16
  const barSeriesConfig = exports.barSeriesConfig = {
17
17
  seriesProcessor: _seriesProcessor.default,
18
18
  colorProcessor: _getColor.default,
@@ -22,5 +22,5 @@ const barSeriesConfig = exports.barSeriesConfig = {
22
22
  axisTooltipGetter: _tooltip.axisTooltipGetter,
23
23
  xExtremumGetter: _extremums.getExtremumX,
24
24
  yExtremumGetter: _extremums.getExtremumY,
25
- getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default
25
+ getSeriesWithDefaultValues: _getSeriesWithDefaultValues.getSeriesWithDefaultValues
26
26
  };
@@ -5,15 +5,15 @@ export type AnimationData = {
5
5
  y: number;
6
6
  width: number;
7
7
  height: number;
8
- yOrigin: number;
9
- xOrigin: number;
10
- layout: BarSeriesType['layout'];
11
8
  };
12
9
  export interface ProcessedBarSeriesData {
13
10
  seriesId: SeriesId;
14
11
  data: ProcessedBarData[];
15
12
  barLabel?: BarSeriesType['barLabel'];
16
13
  barLabelPlacement?: BarSeriesType['barLabelPlacement'];
14
+ layout: 'vertical' | 'horizontal';
15
+ xOrigin: number;
16
+ yOrigin: number;
17
17
  }
18
18
  export interface ProcessedBarData extends AnimationData {
19
19
  seriesId: SeriesId;
@@ -26,4 +26,7 @@ export interface MaskData extends AnimationData {
26
26
  id: string;
27
27
  hasNegative: boolean;
28
28
  hasPositive: boolean;
29
+ xOrigin: number;
30
+ yOrigin: number;
31
+ layout: 'horizontal' | 'vertical';
29
32
  }
@@ -9,8 +9,9 @@ exports.useBarPlotData = useBarPlotData;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _getColor = _interopRequireDefault(require("./seriesConfig/bar/getColor"));
11
11
  var _hooks = require("../hooks");
12
- var _checkScaleErrors = require("./checkScaleErrors");
12
+ var _checkBarChartScaleErrors = require("./checkBarChartScaleErrors");
13
13
  var _useBarSeries = require("../hooks/useBarSeries");
14
+ var _getBandSize = require("../internals/getBandSize");
14
15
  function useBarPlotData(drawingArea, xAxes, yAxes) {
15
16
  const seriesData = (0, _useBarSeries.useBarSeriesContext)() ?? {
16
17
  series: {},
@@ -35,14 +36,17 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
35
36
  return seriesIds.map(seriesId => {
36
37
  const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
37
38
  const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
39
+ const layout = series[seriesId].layout;
38
40
  const xAxisConfig = xAxes[xAxisId];
39
41
  const yAxisConfig = yAxes[yAxisId];
40
42
  const verticalLayout = series[seriesId].layout === 'vertical';
41
43
  const reverse = (verticalLayout ? yAxisConfig.reverse : xAxisConfig.reverse) ?? false;
42
- (0, _checkScaleErrors.checkScaleErrors)(verticalLayout, seriesId, series[seriesId], xAxisId, xAxes, yAxisId, yAxes);
44
+ (0, _checkBarChartScaleErrors.checkBarChartScaleErrors)(verticalLayout, seriesId, series[seriesId].stackedData.length, xAxisId, xAxes, yAxisId, yAxes);
43
45
  const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
44
46
  const xScale = xAxisConfig.scale;
45
47
  const yScale = yAxisConfig.scale;
48
+ const xOrigin = Math.round(xScale(0) ?? 0);
49
+ const yOrigin = Math.round(yScale(0) ?? 0);
46
50
  const colorGetter = (0, _getColor.default)(series[seriesId], xAxes[xAxisId], yAxes[yAxisId]);
47
51
  const seriesDataPoints = [];
48
52
  for (let dataIndex = 0; dataIndex < baseScaleConfig.data.length; dataIndex += 1) {
@@ -61,10 +65,7 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
61
65
  const stackId = series[seriesId].stack;
62
66
  const result = (0, _extends2.default)({
63
67
  seriesId,
64
- dataIndex,
65
- layout: series[seriesId].layout,
66
- xOrigin: Math.round(xScale(0) ?? 0),
67
- yOrigin: Math.round(yScale(0) ?? 0)
68
+ dataIndex
68
69
  }, barDimensions, {
69
70
  color: colorGetter(dataIndex),
70
71
  value: series[seriesId].data[dataIndex],
@@ -80,16 +81,16 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
80
81
  height: 0,
81
82
  hasNegative: false,
82
83
  hasPositive: false,
83
- layout: result.layout,
84
- xOrigin: xScale(0),
85
- yOrigin: yScale(0),
84
+ layout,
85
+ xOrigin,
86
+ yOrigin,
86
87
  x: 0,
87
88
  y: 0
88
89
  };
89
90
  }
90
91
  const mask = masks[result.maskId];
91
- mask.width = result.layout === 'vertical' ? result.width : mask.width + result.width;
92
- mask.height = result.layout === 'vertical' ? mask.height + result.height : result.height;
92
+ mask.width = layout === 'vertical' ? result.width : mask.width + result.width;
93
+ mask.height = layout === 'vertical' ? mask.height + result.height : result.height;
93
94
  mask.x = Math.min(mask.x === 0 ? Infinity : mask.x, result.x);
94
95
  mask.y = Math.min(mask.y === 0 ? Infinity : mask.y, result.y);
95
96
  const value = result.value ?? 0;
@@ -101,7 +102,10 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
101
102
  seriesId,
102
103
  barLabel: series[seriesId].barLabel,
103
104
  barLabelPlacement: series[seriesId].barLabelPlacement,
104
- data: seriesDataPoints
105
+ data: seriesDataPoints,
106
+ layout,
107
+ xOrigin,
108
+ yOrigin
105
109
  };
106
110
  });
107
111
  });
@@ -110,34 +114,6 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
110
114
  masksData: Object.values(masks)
111
115
  };
112
116
  }
113
-
114
- /**
115
- * Solution of the equations
116
- * W = barWidth * N + offset * (N-1)
117
- * offset / (offset + barWidth) = r
118
- * @param bandWidth The width available to place bars.
119
- * @param numberOfGroups The number of bars to place in that space.
120
- * @param gapRatio The ratio of the gap between bars over the bar width.
121
- * @returns The bar width and the offset between bars.
122
- */
123
- function getBandSize({
124
- bandWidth: W,
125
- numberOfGroups: N,
126
- gapRatio: r
127
- }) {
128
- if (r === 0) {
129
- return {
130
- barWidth: W / N,
131
- offset: 0
132
- };
133
- }
134
- const barWidth = W / (N + (N - 1) * r);
135
- const offset = r * barWidth;
136
- return {
137
- barWidth,
138
- offset
139
- };
140
- }
141
117
  function shouldInvertStartCoordinate(verticalLayout, baseValue, reverse) {
142
118
  const isVerticalAndPositive = verticalLayout && baseValue > 0;
143
119
  const isHorizontalAndNegative = !verticalLayout && baseValue < 0;
@@ -159,11 +135,7 @@ function getBarDimensions(params) {
159
135
  const {
160
136
  barWidth,
161
137
  offset
162
- } = getBandSize({
163
- bandWidth: baseScaleConfig.scale.bandwidth(),
164
- numberOfGroups,
165
- gapRatio: baseScaleConfig.barGapRatio
166
- });
138
+ } = (0, _getBandSize.getBandSize)(baseScaleConfig.scale.bandwidth(), numberOfGroups, baseScaleConfig.barGapRatio);
167
139
  const barOffset = groupIndex * (barWidth + offset);
168
140
  const xScale = xAxisConfig.scale;
169
141
  const yScale = yAxisConfig.scale;