@mui/x-charts 8.22.1 → 8.24.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 (354) hide show
  1. package/BarChart/BarChart.js +39 -0
  2. package/BarChart/BarChart.plugins.d.ts +2 -1
  3. package/BarChart/BarChart.plugins.js +2 -1
  4. package/BarChart/BarElement.js +1 -1
  5. package/BarChart/BarLabel/BarLabel.d.ts +2 -0
  6. package/BarChart/BarLabel/BarLabel.js +8 -3
  7. package/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
  8. package/BarChart/BarLabel/BarLabelItem.js +4 -2
  9. package/BarChart/BarPlot.d.ts +12 -2
  10. package/BarChart/BarPlot.js +29 -86
  11. package/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
  12. package/BarChart/BatchBarPlot/BarGroup.js +142 -0
  13. package/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
  14. package/BarChart/BatchBarPlot/BatchBarPlot.js +140 -0
  15. package/BarChart/BatchBarPlot/index.d.ts +1 -0
  16. package/BarChart/BatchBarPlot/index.js +12 -0
  17. package/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
  18. package/BarChart/BatchBarPlot/useCreateBarPaths.js +53 -0
  19. package/BarChart/FocusedBar.js +6 -2
  20. package/BarChart/IndividualBarPlot.d.ts +21 -0
  21. package/BarChart/IndividualBarPlot.js +106 -0
  22. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
  23. package/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
  24. package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +23 -0
  25. package/BarChart/seriesConfig/bar/legend.js +1 -0
  26. package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -2
  27. package/BarChart/seriesConfig/index.js +5 -1
  28. package/BarChart/types.d.ts +2 -0
  29. package/BarChart/useBarChartProps.d.ts +6 -2
  30. package/BarChart/useBarChartProps.js +4 -2
  31. package/BarChart/useBarPlotData.d.ts +1 -1
  32. package/BarChart/useBarPlotData.js +23 -4
  33. package/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
  34. package/BarChart/useRegisterItemClickHandlers.js +72 -0
  35. package/CHANGELOG.md +211 -0
  36. package/ChartContainer/ChartContainer.js +34 -0
  37. package/ChartContainer/useChartContainerProps.js +6 -2
  38. package/ChartsLegend/ChartsLegend.js +2 -2
  39. package/ChartsLegend/legendContext.types.d.ts +12 -0
  40. package/ChartsLegend/onClickContextBuilder.js +2 -1
  41. package/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
  42. package/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
  43. package/ChartsReferenceLine/common.d.ts +1 -1
  44. package/ChartsReferenceLine/common.js +4 -1
  45. package/ChartsTooltip/ChartsTooltipContainer.js +25 -21
  46. package/Gauge/GaugeContainer.js +4 -1
  47. package/LineChart/AnimatedLine.js +7 -3
  48. package/LineChart/AppearingMask.js +4 -1
  49. package/LineChart/CircleMarkElement.d.ts +5 -0
  50. package/LineChart/CircleMarkElement.js +13 -5
  51. package/LineChart/FocusedLineMark.js +6 -2
  52. package/LineChart/LineChart.js +30 -0
  53. package/LineChart/LineChart.plugins.d.ts +2 -1
  54. package/LineChart/LineChart.plugins.js +2 -1
  55. package/LineChart/LineElement.d.ts +4 -0
  56. package/LineChart/LineElement.js +7 -3
  57. package/LineChart/MarkElement.d.ts +5 -0
  58. package/LineChart/MarkElement.js +17 -10
  59. package/LineChart/markElementClasses.d.ts +0 -1
  60. package/LineChart/seriesConfig/index.js +5 -1
  61. package/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  62. package/LineChart/seriesConfig/keyboardFocusHandler.js +23 -0
  63. package/LineChart/seriesConfig/legend.js +1 -0
  64. package/LineChart/seriesConfig/seriesProcessor.js +2 -2
  65. package/PieChart/FocusedPieArc.js +6 -3
  66. package/PieChart/PieArcLabel.d.ts +2 -0
  67. package/PieChart/PieArcLabel.js +5 -2
  68. package/PieChart/PieChart.js +35 -5
  69. package/PieChart/PieChart.plugins.d.ts +2 -1
  70. package/PieChart/PieChart.plugins.js +2 -1
  71. package/PieChart/dataTransform/useTransformData.js +1 -1
  72. package/PieChart/seriesConfig/index.js +5 -1
  73. package/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  74. package/PieChart/seriesConfig/keyboardFocusHandler.js +23 -0
  75. package/PieChart/seriesConfig/legend.js +6 -3
  76. package/RadarChart/RadarChart.js +30 -0
  77. package/RadarChart/RadarChart.plugins.d.ts +3 -2
  78. package/RadarChart/RadarChart.plugins.js +2 -1
  79. package/RadarChart/seriesConfig/index.js +3 -1
  80. package/RadarChart/seriesConfig/legend.js +1 -0
  81. package/ScatterChart/BatchScatter.js +8 -14
  82. package/ScatterChart/FocusedScatterMark.js +1 -1
  83. package/ScatterChart/ScatterChart.js +30 -0
  84. package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  85. package/ScatterChart/ScatterChart.plugins.js +2 -1
  86. package/ScatterChart/seriesConfig/index.js +5 -1
  87. package/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  88. package/ScatterChart/seriesConfig/keyboardFocusHandler.js +23 -0
  89. package/ScatterChart/seriesConfig/legend.js +1 -0
  90. package/SparkLineChart/SparkLineChart.js +46 -0
  91. package/esm/BarChart/BarChart.js +39 -0
  92. package/esm/BarChart/BarChart.plugins.d.ts +2 -1
  93. package/esm/BarChart/BarChart.plugins.js +2 -1
  94. package/esm/BarChart/BarElement.js +1 -1
  95. package/esm/BarChart/BarLabel/BarLabel.d.ts +2 -0
  96. package/esm/BarChart/BarLabel/BarLabel.js +8 -3
  97. package/esm/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
  98. package/esm/BarChart/BarLabel/BarLabelItem.js +4 -2
  99. package/esm/BarChart/BarPlot.d.ts +12 -2
  100. package/esm/BarChart/BarPlot.js +29 -86
  101. package/esm/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
  102. package/esm/BarChart/BatchBarPlot/BarGroup.js +134 -0
  103. package/esm/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
  104. package/esm/BarChart/BatchBarPlot/BatchBarPlot.js +133 -0
  105. package/esm/BarChart/BatchBarPlot/index.d.ts +1 -0
  106. package/esm/BarChart/BatchBarPlot/index.js +1 -0
  107. package/esm/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
  108. package/esm/BarChart/BatchBarPlot/useCreateBarPaths.js +46 -0
  109. package/esm/BarChart/FocusedBar.js +6 -2
  110. package/esm/BarChart/IndividualBarPlot.d.ts +21 -0
  111. package/esm/BarChart/IndividualBarPlot.js +98 -0
  112. package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
  113. package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
  114. package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.js +17 -0
  115. package/esm/BarChart/seriesConfig/bar/legend.js +1 -0
  116. package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +1 -1
  117. package/esm/BarChart/seriesConfig/index.js +5 -1
  118. package/esm/BarChart/types.d.ts +2 -0
  119. package/esm/BarChart/useBarChartProps.d.ts +6 -2
  120. package/esm/BarChart/useBarChartProps.js +4 -3
  121. package/esm/BarChart/useBarPlotData.d.ts +1 -1
  122. package/esm/BarChart/useBarPlotData.js +20 -1
  123. package/esm/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
  124. package/esm/BarChart/useRegisterItemClickHandlers.js +67 -0
  125. package/esm/ChartContainer/ChartContainer.js +34 -0
  126. package/esm/ChartContainer/useChartContainerProps.js +6 -2
  127. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  128. package/esm/ChartsLegend/legendContext.types.d.ts +12 -0
  129. package/esm/ChartsLegend/onClickContextBuilder.js +2 -1
  130. package/esm/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
  131. package/esm/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
  132. package/esm/ChartsReferenceLine/common.d.ts +1 -1
  133. package/esm/ChartsReferenceLine/common.js +4 -1
  134. package/esm/ChartsTooltip/ChartsTooltipContainer.js +26 -22
  135. package/esm/Gauge/GaugeContainer.js +4 -1
  136. package/esm/LineChart/AnimatedLine.js +7 -3
  137. package/esm/LineChart/AppearingMask.js +4 -1
  138. package/esm/LineChart/CircleMarkElement.d.ts +5 -0
  139. package/esm/LineChart/CircleMarkElement.js +13 -5
  140. package/esm/LineChart/FocusedLineMark.js +6 -2
  141. package/esm/LineChart/LineChart.js +30 -0
  142. package/esm/LineChart/LineChart.plugins.d.ts +2 -1
  143. package/esm/LineChart/LineChart.plugins.js +2 -1
  144. package/esm/LineChart/LineElement.d.ts +4 -0
  145. package/esm/LineChart/LineElement.js +7 -3
  146. package/esm/LineChart/MarkElement.d.ts +5 -0
  147. package/esm/LineChart/MarkElement.js +17 -10
  148. package/esm/LineChart/markElementClasses.d.ts +0 -1
  149. package/esm/LineChart/seriesConfig/index.js +5 -1
  150. package/esm/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  151. package/esm/LineChart/seriesConfig/keyboardFocusHandler.js +17 -0
  152. package/esm/LineChart/seriesConfig/legend.js +1 -0
  153. package/esm/LineChart/seriesConfig/seriesProcessor.js +1 -1
  154. package/esm/PieChart/FocusedPieArc.js +5 -2
  155. package/esm/PieChart/PieArcLabel.d.ts +2 -0
  156. package/esm/PieChart/PieArcLabel.js +5 -2
  157. package/esm/PieChart/PieChart.js +35 -5
  158. package/esm/PieChart/PieChart.plugins.d.ts +2 -1
  159. package/esm/PieChart/PieChart.plugins.js +2 -1
  160. package/esm/PieChart/dataTransform/useTransformData.js +1 -1
  161. package/esm/PieChart/seriesConfig/index.js +5 -1
  162. package/esm/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  163. package/esm/PieChart/seriesConfig/keyboardFocusHandler.js +17 -0
  164. package/esm/PieChart/seriesConfig/legend.js +6 -3
  165. package/esm/RadarChart/RadarChart.js +30 -0
  166. package/esm/RadarChart/RadarChart.plugins.d.ts +3 -2
  167. package/esm/RadarChart/RadarChart.plugins.js +2 -1
  168. package/esm/RadarChart/seriesConfig/index.js +3 -1
  169. package/esm/RadarChart/seriesConfig/legend.js +1 -0
  170. package/esm/ScatterChart/BatchScatter.js +5 -11
  171. package/esm/ScatterChart/FocusedScatterMark.js +1 -1
  172. package/esm/ScatterChart/ScatterChart.js +30 -0
  173. package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  174. package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
  175. package/esm/ScatterChart/seriesConfig/index.js +5 -1
  176. package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  177. package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.js +17 -0
  178. package/esm/ScatterChart/seriesConfig/legend.js +1 -0
  179. package/esm/SparkLineChart/SparkLineChart.js +46 -0
  180. package/esm/hooks/useFocusedItem.d.ts +1 -12
  181. package/esm/hooks/useFocusedItem.js +3 -10
  182. package/esm/hooks/useIsItemFocused.d.ts +4 -3
  183. package/esm/hooks/useIsItemFocused.js +1 -1
  184. package/esm/hooks/useIsItemFocusedGetter.d.ts +3 -2
  185. package/esm/hooks/useIsItemFocusedGetter.js +2 -1
  186. package/esm/index.js +1 -1
  187. package/esm/internals/appendAtKey.d.ts +8 -0
  188. package/esm/internals/appendAtKey.js +17 -0
  189. package/esm/internals/commonNextFocusItem.d.ts +14 -0
  190. package/esm/internals/commonNextFocusItem.js +88 -0
  191. package/esm/internals/getBarDimensions.d.ts +1 -2
  192. package/esm/internals/identifierSerializer.d.ts +9 -0
  193. package/esm/internals/identifierSerializer.js +6 -0
  194. package/esm/internals/index.d.ts +7 -3
  195. package/esm/internals/index.js +7 -3
  196. package/esm/internals/invertScale.d.ts +6 -2
  197. package/esm/internals/invertScale.js +9 -1
  198. package/esm/internals/plugins/allPlugins.d.ts +4 -3
  199. package/esm/internals/plugins/allPlugins.js +2 -1
  200. package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
  201. package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +18 -0
  202. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
  203. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
  204. package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
  205. package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +74 -0
  206. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
  207. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
  208. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
  209. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +83 -0
  210. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
  211. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +1 -0
  212. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
  213. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +12 -105
  214. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
  215. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -15
  216. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
  217. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
  218. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +6 -0
  219. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
  220. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +18 -0
  221. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
  222. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +9 -0
  223. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
  224. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +18 -0
  225. package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -10
  226. package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +2 -2
  227. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
  228. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +3 -0
  229. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
  230. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +5 -0
  231. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
  232. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +78 -0
  233. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
  234. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +19 -0
  235. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
  236. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +1 -0
  237. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
  238. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +11 -0
  239. package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
  240. package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.js +1 -0
  241. package/esm/internals/plugins/models/seriesConfig/index.d.ts +2 -1
  242. package/esm/internals/plugins/models/seriesConfig/index.js +2 -1
  243. package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +9 -0
  244. package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  245. package/esm/internals/seriesHasData.d.ts +4 -0
  246. package/esm/internals/seriesHasData.js +8 -0
  247. package/esm/internals/stacking/index.d.ts +1 -0
  248. package/esm/internals/stacking/index.js +1 -0
  249. package/esm/internals/stacking/offset/index.d.ts +1 -0
  250. package/esm/internals/stacking/offset/index.js +1 -0
  251. package/esm/internals/stacking/offset/offsetDiverging.d.ts +8 -0
  252. package/esm/internals/stacking/offset/offsetDiverging.js +47 -0
  253. package/esm/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
  254. package/esm/internals/{stackSeries.js → stacking/stackSeries.js} +8 -6
  255. package/esm/models/axis.d.ts +5 -4
  256. package/esm/models/featureFlags.d.ts +1 -0
  257. package/esm/models/featureFlags.js +1 -0
  258. package/esm/models/index.d.ts +1 -0
  259. package/esm/models/index.js +1 -0
  260. package/esm/models/seriesType/index.d.ts +3 -1
  261. package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
  262. package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.js +1 -0
  263. package/hooks/useFocusedItem.d.ts +1 -12
  264. package/hooks/useFocusedItem.js +1 -10
  265. package/hooks/useIsItemFocused.d.ts +4 -3
  266. package/hooks/useIsItemFocused.js +1 -1
  267. package/hooks/useIsItemFocusedGetter.d.ts +3 -2
  268. package/hooks/useIsItemFocusedGetter.js +2 -1
  269. package/index.js +1 -1
  270. package/internals/appendAtKey.d.ts +8 -0
  271. package/internals/appendAtKey.js +23 -0
  272. package/internals/commonNextFocusItem.d.ts +14 -0
  273. package/internals/commonNextFocusItem.js +97 -0
  274. package/internals/getBarDimensions.d.ts +1 -2
  275. package/internals/identifierSerializer.d.ts +9 -0
  276. package/internals/identifierSerializer.js +16 -0
  277. package/internals/index.d.ts +7 -3
  278. package/internals/index.js +55 -11
  279. package/internals/invertScale.d.ts +6 -2
  280. package/internals/invertScale.js +10 -1
  281. package/internals/plugins/allPlugins.d.ts +4 -3
  282. package/internals/plugins/allPlugins.js +2 -1
  283. package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
  284. package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +25 -0
  285. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
  286. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
  287. package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
  288. package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +81 -0
  289. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
  290. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
  291. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
  292. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +89 -0
  293. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
  294. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +5 -0
  295. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
  296. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +11 -104
  297. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
  298. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -16
  299. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
  300. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
  301. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +12 -0
  302. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
  303. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +23 -0
  304. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
  305. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +15 -0
  306. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
  307. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +23 -0
  308. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -10
  309. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +1 -1
  310. package/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
  311. package/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +39 -0
  312. package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
  313. package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +12 -0
  314. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
  315. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +85 -0
  316. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
  317. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +25 -0
  318. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
  319. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +5 -0
  320. package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
  321. package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +18 -0
  322. package/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
  323. package/internals/plugins/models/seriesConfig/identifierSerializer.types.js +5 -0
  324. package/internals/plugins/models/seriesConfig/index.d.ts +2 -1
  325. package/internals/plugins/models/seriesConfig/index.js +11 -0
  326. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +9 -0
  327. package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  328. package/internals/seriesHasData.d.ts +4 -0
  329. package/internals/seriesHasData.js +14 -0
  330. package/internals/stacking/index.d.ts +1 -0
  331. package/internals/stacking/index.js +16 -0
  332. package/internals/stacking/offset/index.d.ts +1 -0
  333. package/internals/stacking/offset/index.js +16 -0
  334. package/internals/stacking/offset/offsetDiverging.d.ts +8 -0
  335. package/internals/stacking/offset/offsetDiverging.js +53 -0
  336. package/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
  337. package/internals/{stackSeries.js → stacking/stackSeries.js} +3 -1
  338. package/models/axis.d.ts +5 -4
  339. package/models/featureFlags.d.ts +1 -0
  340. package/models/featureFlags.js +5 -0
  341. package/models/index.d.ts +1 -0
  342. package/models/index.js +11 -0
  343. package/models/seriesType/index.d.ts +3 -1
  344. package/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
  345. package/moduleAugmentation/barChartBatchRendererOnItemClick.js +5 -0
  346. package/package.json +14 -4
  347. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
  348. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -4
  349. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
  350. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -92
  351. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
  352. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -10
  353. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
  354. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -99
@@ -2,20 +2,20 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
5
+ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel", "renderer"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled } from '@mui/material/styles';
9
9
  import { barElementClasses } from "./barElementClasses.js";
10
- import { BarElement } from "./BarElement.js";
11
10
  import { useDrawingArea, useXAxes, useYAxes } from "../hooks/index.js";
12
- import { BarClipPath } from "./BarClipPath.js";
13
11
  import { BarLabelPlot } from "./BarLabel/BarLabelPlot.js";
14
12
  import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
15
13
  import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
16
14
  import { useBarPlotData } from "./useBarPlotData.js";
17
15
  import { useUtilityClasses } from "./barClasses.js";
18
16
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
17
+ import { IndividualBarPlot } from "./IndividualBarPlot.js";
18
+ import { BatchBarPlot } from "./BatchBarPlot/index.js";
19
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
20
  const BarPlotRoot = styled('g', {
21
21
  name: 'MuiBarPlot',
@@ -44,11 +44,13 @@ function BarPlot(props) {
44
44
  skipAnimation: inSkipAnimation,
45
45
  onItemClick,
46
46
  borderRadius,
47
- barLabel
47
+ barLabel,
48
+ renderer
48
49
  } = props,
49
50
  other = _objectWithoutPropertiesLoose(props, _excluded);
50
51
  const isZoomInteracting = useInternalIsZoomInteracting();
51
52
  const skipAnimation = useSkipAnimation(isZoomInteracting || inSkipAnimation);
53
+ const batchSkipAnimation = useSkipAnimation(inSkipAnimation);
52
54
  const {
53
55
  xAxis: xAxes
54
56
  } = useXAxes();
@@ -59,86 +61,22 @@ function BarPlot(props) {
59
61
  completedData,
60
62
  masksData
61
63
  } = useBarPlotData(useDrawingArea(), xAxes, yAxes);
62
- const withoutBorderRadius = !borderRadius || borderRadius <= 0;
63
64
  const classes = useUtilityClasses();
65
+ const BarElementPlot = renderer === 'svg-batch' ? BatchBarPlot : IndividualBarPlot;
64
66
  return /*#__PURE__*/_jsxs(BarPlotRoot, {
65
67
  className: classes.root,
66
- children: [!withoutBorderRadius && masksData.map(({
67
- id,
68
- x,
69
- y,
70
- xOrigin,
71
- yOrigin,
72
- width,
73
- height,
74
- hasPositive,
75
- hasNegative,
76
- layout
77
- }) => {
78
- return /*#__PURE__*/_jsx(BarClipPath, {
79
- maskId: id,
80
- borderRadius: borderRadius,
81
- hasNegative: hasNegative,
82
- hasPositive: hasPositive,
83
- layout: layout,
84
- x: x,
85
- y: y,
86
- xOrigin: xOrigin,
87
- yOrigin: yOrigin,
88
- width: width,
89
- height: height,
90
- skipAnimation: skipAnimation ?? false
91
- }, id);
92
- }), completedData.map(({
93
- seriesId,
94
- layout,
95
- xOrigin,
96
- yOrigin,
97
- data
98
- }) => {
99
- return /*#__PURE__*/_jsx("g", {
100
- "data-series": seriesId,
101
- className: classes.series,
102
- children: data.map(({
103
- dataIndex,
104
- color,
105
- maskId,
106
- x,
107
- y,
108
- width,
109
- height
110
- }) => {
111
- const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
112
- id: seriesId,
113
- dataIndex: dataIndex,
114
- color: color,
115
- skipAnimation: skipAnimation ?? false,
116
- layout: layout ?? 'vertical',
117
- x: x,
118
- xOrigin: xOrigin,
119
- y: y,
120
- yOrigin: yOrigin,
121
- width: width,
122
- height: height
123
- }, other, {
124
- onClick: onItemClick && (event => {
125
- onItemClick(event, {
126
- type: 'bar',
127
- seriesId,
128
- dataIndex
129
- });
130
- })
131
- }), dataIndex);
132
- if (withoutBorderRadius) {
133
- return barElement;
134
- }
135
- return /*#__PURE__*/_jsx("g", {
136
- clipPath: `url(#${maskId})`,
137
- children: barElement
138
- }, dataIndex);
139
- })
140
- }, seriesId);
141
- }), completedData.map(processedSeries => /*#__PURE__*/_jsx(BarLabelPlot, _extends({
68
+ children: [/*#__PURE__*/_jsx(BarElementPlot, _extends({
69
+ completedData: completedData,
70
+ masksData: masksData
71
+ /* The batch renderer doesn't animate bars after the initial mount. Providing skipAnimation was causing an issue
72
+ * where bars would animate again after a zoom interaction because skipAnimation would change from true to false. */,
73
+ skipAnimation: renderer === 'svg-batch' ? batchSkipAnimation : skipAnimation,
74
+ onItemClick:
75
+ /* `onItemClick` accepts a `MouseEvent` when the renderer is "svg-batch" and a `React.MouseEvent` otherwise,
76
+ * so we need this cast to prevent TypeScript from complaining. */
77
+ onItemClick,
78
+ borderRadius: borderRadius
79
+ }, other)), completedData.map(processedSeries => /*#__PURE__*/_jsx(BarLabelPlot, _extends({
142
80
  className: classes.seriesLabels,
143
81
  processedSeries: processedSeries,
144
82
  skipAnimation: skipAnimation,
@@ -152,6 +90,7 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
152
90
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
153
91
  // ----------------------------------------------------------------------
154
92
  /**
93
+ * @deprecated Use `barLabel` in the chart series instead.
155
94
  * If provided, the function will be used to format the label of the bar.
156
95
  * It can be set to 'value' to display the current value.
157
96
  * @param {BarItem} item The item to format.
@@ -159,11 +98,6 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
159
98
  * @returns {string} The formatted label.
160
99
  */
161
100
  barLabel: PropTypes.oneOfType([PropTypes.oneOf(['value']), PropTypes.func]),
162
- /**
163
- * The placement of the bar label.
164
- * It controls whether the label is rendered inside or outside the bar.
165
- */
166
- barLabelPlacement: PropTypes.oneOf(['outside', 'inside']),
167
101
  /**
168
102
  * Defines the border radius of the bar element.
169
103
  */
@@ -174,6 +108,15 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
174
108
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
175
109
  */
176
110
  onItemClick: PropTypes.func,
111
+ /**
112
+ * The type of renderer to use for the bar plot.
113
+ * - `svg-single`: Renders every bar in a `<rect />` element.
114
+ * - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
115
+ * Read more: https://mui.com/x/react-charts/bars/#performance
116
+ *
117
+ * @default 'svg-single'
118
+ */
119
+ renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
177
120
  /**
178
121
  * If `true`, animations are skipped.
179
122
  * @default undefined
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ interface BarGroupProps extends React.HTMLAttributes<SVGGElement> {
3
+ skipAnimation: boolean;
4
+ layout: 'horizontal' | 'vertical' | undefined;
5
+ xOrigin: number;
6
+ yOrigin: number;
7
+ }
8
+ export declare function BarGroup({
9
+ skipAnimation,
10
+ layout,
11
+ xOrigin,
12
+ yOrigin,
13
+ ...props
14
+ }: BarGroupProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,134 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["skipAnimation", "layout", "xOrigin", "yOrigin"],
4
+ _excluded2 = ["children", "layout", "xOrigin", "yOrigin"];
5
+ import { styled } from '@mui/material/styles';
6
+ import * as React from 'react';
7
+ import useId from '@mui/utils/useId';
8
+ import { useStore } from "../../internals/store/useStore.js";
9
+ import { selectorChartDrawingArea } from "../../internals/plugins/corePlugins/useChartDimensions/index.js";
10
+ import { ANIMATION_DURATION_MS } from "../../internals/animation/animation.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const PathGroup = styled('g')({
13
+ '&[data-faded="true"]': {
14
+ opacity: 0.3
15
+ },
16
+ '& path': {
17
+ /* The browser must do hit testing to know which element a pointer is interacting with.
18
+ * With many data points, we create many paths causing significant time to be spent in the hit test phase.
19
+ * To fix this issue, we disable pointer events for the descendant paths.
20
+ *
21
+ * Ideally, users should be able to override this in case they need pointer events to be enabled,
22
+ * but it can affect performance negatively, especially with many data points. */
23
+ pointerEvents: 'none'
24
+ }
25
+ });
26
+ export function BarGroup(_ref) {
27
+ let {
28
+ skipAnimation,
29
+ layout,
30
+ xOrigin,
31
+ yOrigin
32
+ } = _ref,
33
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
34
+ if (skipAnimation) {
35
+ return /*#__PURE__*/_jsx(PathGroup, _extends({}, props));
36
+ }
37
+ return /*#__PURE__*/_jsx(AnimatedGroup, _extends({}, props, {
38
+ layout: layout,
39
+ xOrigin: xOrigin,
40
+ yOrigin: yOrigin
41
+ }));
42
+ }
43
+ const AnimatedRect = styled('rect')({
44
+ '@keyframes scaleInX': {
45
+ from: {
46
+ transform: 'scaleX(0)'
47
+ },
48
+ to: {
49
+ transform: 'scaleX(1)'
50
+ }
51
+ },
52
+ '@keyframes scaleInY': {
53
+ from: {
54
+ transform: 'scaleY(0)'
55
+ },
56
+ to: {
57
+ transform: 'scaleY(1)'
58
+ }
59
+ },
60
+ animationDuration: `${ANIMATION_DURATION_MS}ms`,
61
+ animationFillMode: 'forwards',
62
+ '&[data-orientation="horizontal"]': {
63
+ animationName: 'scaleInX'
64
+ },
65
+ '&[data-orientation="vertical"]': {
66
+ animationName: 'scaleInY'
67
+ }
68
+ });
69
+ function AnimatedGroup(_ref2) {
70
+ let {
71
+ children,
72
+ layout,
73
+ xOrigin,
74
+ yOrigin
75
+ } = _ref2,
76
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
77
+ const store = useStore();
78
+ const drawingArea = store.use(selectorChartDrawingArea);
79
+ const clipPathId = useId();
80
+ const animateChildren = [];
81
+ if (layout === 'horizontal') {
82
+ animateChildren.push(/*#__PURE__*/_jsx(AnimatedRect, {
83
+ "data-orientation": "horizontal",
84
+ x: drawingArea.left,
85
+ width: xOrigin - drawingArea.left,
86
+ y: drawingArea.top,
87
+ height: drawingArea.height,
88
+ style: {
89
+ transformOrigin: `${xOrigin}px ${drawingArea.top + drawingArea.height / 2}px`
90
+ }
91
+ }, "left"));
92
+ animateChildren.push(/*#__PURE__*/_jsx(AnimatedRect, {
93
+ "data-orientation": "horizontal",
94
+ x: xOrigin,
95
+ width: drawingArea.left + drawingArea.width - xOrigin,
96
+ y: drawingArea.top,
97
+ height: drawingArea.height,
98
+ style: {
99
+ transformOrigin: `${xOrigin}px ${drawingArea.top + drawingArea.height / 2}px`
100
+ }
101
+ }, "right"));
102
+ } else {
103
+ animateChildren.push(/*#__PURE__*/_jsx(AnimatedRect, {
104
+ "data-orientation": "vertical",
105
+ x: drawingArea.left,
106
+ width: drawingArea.width,
107
+ y: drawingArea.top,
108
+ height: yOrigin - drawingArea.top,
109
+ style: {
110
+ transformOrigin: `${drawingArea.left + drawingArea.width / 2}px ${yOrigin}px`
111
+ }
112
+ }, "top"));
113
+ animateChildren.push(/*#__PURE__*/_jsx(AnimatedRect, {
114
+ "data-orientation": "vertical",
115
+ x: drawingArea.left,
116
+ width: drawingArea.width,
117
+ y: yOrigin,
118
+ height: drawingArea.top + drawingArea.height - yOrigin,
119
+ style: {
120
+ transformOrigin: `${drawingArea.left + drawingArea.width / 2}px ${yOrigin}px`
121
+ }
122
+ }, "bottom"));
123
+ }
124
+ return /*#__PURE__*/_jsxs(React.Fragment, {
125
+ children: [/*#__PURE__*/_jsx("clipPath", {
126
+ id: clipPathId,
127
+ children: animateChildren
128
+ }), /*#__PURE__*/_jsx(PathGroup, _extends({
129
+ clipPath: `url(#${clipPathId})`
130
+ }, props, {
131
+ children: children
132
+ }))]
133
+ });
134
+ }
@@ -0,0 +1,12 @@
1
+ import type { BarItemIdentifier } from "../../models/index.js";
2
+ import { type IndividualBarPlotProps } from "../IndividualBarPlot.js";
3
+ interface BatchBarPlotProps extends Omit<IndividualBarPlotProps, 'onItemClick'> {
4
+ onItemClick?: (event: MouseEvent, barItemIdentifier: BarItemIdentifier) => void;
5
+ }
6
+ export declare function BatchBarPlot({
7
+ completedData,
8
+ borderRadius,
9
+ onItemClick,
10
+ skipAnimation
11
+ }: BatchBarPlotProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,133 @@
1
+ import * as React from 'react';
2
+ import { useSvgRef } from "../../hooks/index.js";
3
+ import { useUtilityClasses } from "../barClasses.js";
4
+ import { useChartContext } from "../../context/ChartProvider/useChartContext.js";
5
+ import { selectorChartIsSeriesFaded, selectorChartIsSeriesHighlighted, selectorChartSeriesHighlightedItem, selectorChartSeriesUnfadedItem } from "../../internals/plugins/featurePlugins/useChartHighlight/index.js";
6
+ import { useRegisterItemClickHandlers } from "../useRegisterItemClickHandlers.js";
7
+ import { createPath, useCreateBarPaths } from "./useCreateBarPaths.js";
8
+ import { BarGroup } from "./BarGroup.js";
9
+ import { useRegisterPointerInteractions } from "../../internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
10
+ import { selectorBarItemAtPosition } from "../../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ export function BatchBarPlot({
13
+ completedData,
14
+ borderRadius = 0,
15
+ onItemClick,
16
+ skipAnimation = false
17
+ }) {
18
+ const prevCursorRef = React.useRef(null);
19
+ const svgRef = useSvgRef();
20
+ const onItemEnter = onItemClick ? () => {
21
+ const svg = svgRef.current;
22
+ if (!svg) {
23
+ return;
24
+ }
25
+ if (prevCursorRef.current == null) {
26
+ prevCursorRef.current = svg.style.cursor;
27
+ // eslint-disable-next-line react-compiler/react-compiler
28
+ svg.style.cursor = 'pointer';
29
+ }
30
+ } : undefined;
31
+ const onItemLeave = onItemClick ? () => {
32
+ const svg = svgRef.current;
33
+ if (!svg) {
34
+ return;
35
+ }
36
+ if (prevCursorRef.current != null) {
37
+ svg.style.cursor = prevCursorRef.current;
38
+ prevCursorRef.current = null;
39
+ }
40
+ } : undefined;
41
+ useRegisterPointerInteractions(selectorBarItemAtPosition, onItemEnter, onItemLeave);
42
+ useRegisterItemClickHandlers(onItemClick);
43
+ return /*#__PURE__*/_jsx(React.Fragment, {
44
+ children: completedData.map(series => /*#__PURE__*/_jsx(SeriesBatchPlot, {
45
+ series: series,
46
+ borderRadius: borderRadius,
47
+ skipAnimation: skipAnimation
48
+ }, series.seriesId))
49
+ });
50
+ }
51
+ const MemoFadedHighlightedBars = /*#__PURE__*/React.memo(FadedHighlightedBars);
52
+ if (process.env.NODE_ENV !== "production") MemoFadedHighlightedBars.displayName = "MemoFadedHighlightedBars";
53
+ function SeriesBatchPlot({
54
+ series,
55
+ borderRadius,
56
+ skipAnimation
57
+ }) {
58
+ const classes = useUtilityClasses();
59
+ const {
60
+ store
61
+ } = useChartContext();
62
+ const isSeriesHighlighted = store.use(selectorChartIsSeriesHighlighted, series.seriesId);
63
+ const isSeriesFaded = store.use(selectorChartIsSeriesFaded, series.seriesId);
64
+ return /*#__PURE__*/_jsxs(React.Fragment, {
65
+ children: [/*#__PURE__*/_jsx(BarGroup, {
66
+ className: classes.series,
67
+ "data-series": series.seriesId,
68
+ layout: series.layout,
69
+ xOrigin: series.xOrigin,
70
+ yOrigin: series.yOrigin,
71
+ skipAnimation: skipAnimation,
72
+ "data-faded": isSeriesFaded || undefined,
73
+ "data-highlighted": isSeriesHighlighted || undefined,
74
+ children: /*#__PURE__*/_jsx(BatchBarSeriesPlot, {
75
+ processedSeries: series,
76
+ borderRadius: borderRadius
77
+ })
78
+ }), /*#__PURE__*/_jsx(MemoFadedHighlightedBars, {
79
+ processedSeries: series,
80
+ borderRadius: borderRadius
81
+ })]
82
+ });
83
+ }
84
+ function BatchBarSeriesPlot({
85
+ processedSeries,
86
+ borderRadius
87
+ }) {
88
+ const paths = useCreateBarPaths(processedSeries, borderRadius);
89
+ const children = [];
90
+ let i = 0;
91
+ for (const [fill, dArray] of paths.entries()) {
92
+ for (const d of dArray) {
93
+ children.push(/*#__PURE__*/_jsx("path", {
94
+ fill: fill,
95
+ d: d
96
+ }, i));
97
+ i += 1;
98
+ }
99
+ }
100
+ return /*#__PURE__*/_jsx(React.Fragment, {
101
+ children: children
102
+ });
103
+ }
104
+ function FadedHighlightedBars({
105
+ processedSeries,
106
+ borderRadius
107
+ }) {
108
+ const {
109
+ store
110
+ } = useChartContext();
111
+ const seriesHighlightedDataIndex = store.use(selectorChartSeriesHighlightedItem, processedSeries.seriesId);
112
+ const seriesUnfadedDataIndex = store.use(selectorChartSeriesUnfadedItem, processedSeries.seriesId);
113
+ const seriesHighlightedItem = seriesHighlightedDataIndex != null ? processedSeries.data.find(v => v.dataIndex === seriesHighlightedDataIndex) || null : null;
114
+ const seriesUnfadedItem = seriesUnfadedDataIndex != null ? processedSeries.data.find(v => v.dataIndex === seriesUnfadedDataIndex) || null : null;
115
+ const siblings = [];
116
+ if (seriesHighlightedItem != null) {
117
+ siblings.push(/*#__PURE__*/_jsx("path", {
118
+ fill: seriesHighlightedItem.color,
119
+ filter: "brightness(120%)",
120
+ "data-highlighted": true,
121
+ d: createPath(seriesHighlightedItem, borderRadius)
122
+ }, `highlighted-${processedSeries.seriesId}`));
123
+ }
124
+ if (seriesUnfadedItem != null) {
125
+ siblings.push(/*#__PURE__*/_jsx("path", {
126
+ fill: seriesUnfadedItem.color,
127
+ d: createPath(seriesUnfadedItem, borderRadius)
128
+ }, `unfaded-${seriesUnfadedItem.seriesId}`));
129
+ }
130
+ return /*#__PURE__*/_jsx(React.Fragment, {
131
+ children: siblings
132
+ });
133
+ }
@@ -0,0 +1 @@
1
+ export { BatchBarPlot } from "./BatchBarPlot.js";
@@ -0,0 +1 @@
1
+ export { BatchBarPlot } from "./BatchBarPlot.js";
@@ -0,0 +1,8 @@
1
+ import type { ProcessedBarData, ProcessedBarSeriesData } from "../types.js";
2
+ export declare function createPath(barData: ProcessedBarData, borderRadius: number): string;
3
+ /**
4
+ * Hook that creates bar paths for a given series data. Used by the batch bar renderer.
5
+ * @param seriesData
6
+ * @param borderRadius
7
+ */
8
+ export declare function useCreateBarPaths(seriesData: ProcessedBarSeriesData, borderRadius: number): Map<string, string[]>;
@@ -0,0 +1,46 @@
1
+ import { appendAtKey } from "../../internals/appendAtKey.js";
2
+ const MAX_POINTS_PER_PATH = 1000;
3
+ function generateBarPath(x, y, width, height, topLeftBorderRadius, topRightBorderRadius, bottomRightBorderRadius, bottomLeftBorderRadius) {
4
+ const tLBR = Math.min(topLeftBorderRadius, width / 2, height / 2);
5
+ const tRBR = Math.min(topRightBorderRadius, width / 2, height / 2);
6
+ const bRBR = Math.min(bottomRightBorderRadius, width / 2, height / 2);
7
+ const bLBR = Math.min(bottomLeftBorderRadius, width / 2, height / 2);
8
+ return `M${x + tLBR},${y}
9
+ h${width - tLBR - tRBR}
10
+ a${tRBR},${tRBR} 0 0 1 ${tRBR},${tRBR}
11
+ v${height - tRBR - bRBR}
12
+ a${bRBR},${bRBR} 0 0 1 -${bRBR},${bRBR}
13
+ h-${width - bRBR - bLBR}
14
+ a${bLBR},${bLBR} 0 0 1 -${bLBR},-${bLBR}
15
+ v-${height - bLBR - tLBR}
16
+ a${tLBR},${tLBR} 0 0 1 ${tLBR},-${tLBR}
17
+ Z`;
18
+ }
19
+ export function createPath(barData, borderRadius) {
20
+ return generateBarPath(barData.x, barData.y, barData.width, barData.height, barData.borderRadiusSide === 'left' || barData.borderRadiusSide === 'top' ? borderRadius : 0, barData.borderRadiusSide === 'right' || barData.borderRadiusSide === 'top' ? borderRadius : 0, barData.borderRadiusSide === 'right' || barData.borderRadiusSide === 'bottom' ? borderRadius : 0, barData.borderRadiusSide === 'left' || barData.borderRadiusSide === 'bottom' ? borderRadius : 0);
21
+ }
22
+
23
+ /**
24
+ * Hook that creates bar paths for a given series data. Used by the batch bar renderer.
25
+ * @param seriesData
26
+ * @param borderRadius
27
+ */
28
+ export function useCreateBarPaths(seriesData, borderRadius) {
29
+ const paths = new Map();
30
+ const temporaryPaths = new Map();
31
+ for (let j = 0; j < seriesData.data.length; j += 1) {
32
+ const barData = seriesData.data[j];
33
+ const pathString = createPath(barData, borderRadius);
34
+ const tempPath = appendAtKey(temporaryPaths, barData.color, pathString);
35
+ if (tempPath.length >= MAX_POINTS_PER_PATH) {
36
+ appendAtKey(paths, barData.color, tempPath.join(''));
37
+ temporaryPaths.delete(barData.color);
38
+ }
39
+ }
40
+ for (const [fill, tempPath] of temporaryPaths.entries()) {
41
+ if (tempPath.length > 0) {
42
+ appendAtKey(paths, fill, tempPath.join(''));
43
+ }
44
+ }
45
+ return paths;
46
+ }
@@ -19,10 +19,14 @@ export function FocusedBar(props) {
19
19
  yAxis,
20
20
  yAxisIds
21
21
  } = useYAxes();
22
- if (focusedItem === null || focusedItem.seriesType !== 'bar' || !barSeries) {
22
+ if (focusedItem === null || focusedItem.type !== 'bar' || !barSeries) {
23
+ return null;
24
+ }
25
+ const series = barSeries.series[focusedItem.seriesId];
26
+ if (series.data[focusedItem.dataIndex] == null) {
27
+ // Handle missing data
23
28
  return null;
24
29
  }
25
- const series = barSeries?.series[focusedItem.seriesId];
26
30
  const xAxisId = series.xAxisId ?? xAxisIds[0];
27
31
  const yAxisId = series.yAxisId ?? yAxisIds[0];
28
32
  const xAxisConfig = xAxis[xAxisId];
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { type BarPlotSlotProps, type BarPlotSlots } from "./BarPlot.js";
3
+ import { type BarItemIdentifier } from "../models/index.js";
4
+ import { type MaskData, type ProcessedBarSeriesData } from "./types.js";
5
+ export interface IndividualBarPlotProps {
6
+ completedData: ProcessedBarSeriesData[];
7
+ masksData: MaskData[];
8
+ borderRadius?: number;
9
+ skipAnimation?: boolean;
10
+ onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, barItemIdentifier: BarItemIdentifier) => void;
11
+ slotProps?: BarPlotSlotProps;
12
+ slots?: BarPlotSlots;
13
+ }
14
+ export declare function IndividualBarPlot({
15
+ completedData,
16
+ masksData,
17
+ borderRadius,
18
+ onItemClick,
19
+ skipAnimation,
20
+ ...other
21
+ }: IndividualBarPlotProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,98 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["completedData", "masksData", "borderRadius", "onItemClick", "skipAnimation"];
4
+ import * as React from 'react';
5
+ import { BarElement } from "./BarElement.js";
6
+ import { useUtilityClasses } from "./barClasses.js";
7
+ import { BarClipPath } from "./BarClipPath.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export function IndividualBarPlot(_ref) {
10
+ let {
11
+ completedData,
12
+ masksData,
13
+ borderRadius,
14
+ onItemClick,
15
+ skipAnimation
16
+ } = _ref,
17
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
18
+ const classes = useUtilityClasses();
19
+ const withoutBorderRadius = !borderRadius || borderRadius <= 0;
20
+ return /*#__PURE__*/_jsxs(React.Fragment, {
21
+ children: [!withoutBorderRadius && masksData.map(({
22
+ id,
23
+ x,
24
+ y,
25
+ xOrigin,
26
+ yOrigin,
27
+ width,
28
+ height,
29
+ hasPositive,
30
+ hasNegative,
31
+ layout
32
+ }) => {
33
+ return /*#__PURE__*/_jsx(BarClipPath, {
34
+ maskId: id,
35
+ borderRadius: borderRadius,
36
+ hasNegative: hasNegative,
37
+ hasPositive: hasPositive,
38
+ layout: layout,
39
+ x: x,
40
+ y: y,
41
+ xOrigin: xOrigin,
42
+ yOrigin: yOrigin,
43
+ width: width,
44
+ height: height,
45
+ skipAnimation: skipAnimation ?? false
46
+ }, id);
47
+ }), completedData.map(({
48
+ seriesId,
49
+ layout,
50
+ xOrigin,
51
+ yOrigin,
52
+ data
53
+ }) => {
54
+ return /*#__PURE__*/_jsx("g", {
55
+ "data-series": seriesId,
56
+ className: classes.series,
57
+ children: data.map(({
58
+ dataIndex,
59
+ color,
60
+ maskId,
61
+ x,
62
+ y,
63
+ width,
64
+ height
65
+ }) => {
66
+ const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
67
+ id: seriesId,
68
+ dataIndex: dataIndex,
69
+ color: color,
70
+ skipAnimation: skipAnimation ?? false,
71
+ layout: layout ?? 'vertical',
72
+ x: x,
73
+ xOrigin: xOrigin,
74
+ y: y,
75
+ yOrigin: yOrigin,
76
+ width: width,
77
+ height: height
78
+ }, other, {
79
+ onClick: onItemClick && (event => {
80
+ onItemClick(event, {
81
+ type: 'bar',
82
+ seriesId,
83
+ dataIndex
84
+ });
85
+ })
86
+ }), dataIndex);
87
+ if (withoutBorderRadius) {
88
+ return barElement;
89
+ }
90
+ return /*#__PURE__*/_jsx("g", {
91
+ clipPath: `url(#${maskId})`,
92
+ children: barElement
93
+ }, dataIndex);
94
+ })
95
+ }, seriesId);
96
+ })]
97
+ });
98
+ }
@@ -9,7 +9,7 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
9
9
  layout?: "horizontal" | "vertical";
10
10
  stackOffset?: import("../../../index.js").StackOffsetType;
11
11
  minBarSize?: number;
12
- barLabel?: "value" | ((item: import("../../index.js").BarItem, context: import("../../index.js").BarLabelContext) => string | null | undefined);
12
+ barLabel?: "value" | ((item: import("@mui/x-charts/BarChart").BarItem, context: import("@mui/x-charts/BarChart").BarLabelContext) => string | null | undefined);
13
13
  barLabelPlacement?: "center" | "outside";
14
14
  valueFormatter?: import("../../../internals/index.js").SeriesValueFormatter<number | null> | undefined;
15
15
  highlightScope?: import("../../../index.js").HighlightScope;