@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
@@ -0,0 +1,3 @@
1
+ import type { KeyboardFocusHandler } from "../../../internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js";
2
+ declare const keyboardFocusHandler: KeyboardFocusHandler<'bar', 'bar' | 'line' | 'scatter'>;
3
+ export default keyboardFocusHandler;
@@ -0,0 +1,17 @@
1
+ import { createGetNextIndexFocusedItem, createGetPreviousIndexFocusedItem, createGetNextSeriesFocusedItem, createGetPreviousSeriesFocusedItem } from "../../../internals/commonNextFocusItem.js";
2
+ const outSeriesTypes = new Set(['bar', 'line', 'scatter']);
3
+ const keyboardFocusHandler = event => {
4
+ switch (event.key) {
5
+ case 'ArrowRight':
6
+ return createGetNextIndexFocusedItem(outSeriesTypes);
7
+ case 'ArrowLeft':
8
+ return createGetPreviousIndexFocusedItem(outSeriesTypes);
9
+ case 'ArrowDown':
10
+ return createGetPreviousSeriesFocusedItem(outSeriesTypes);
11
+ case 'ArrowUp':
12
+ return createGetNextSeriesFocusedItem(outSeriesTypes);
13
+ default:
14
+ return null;
15
+ }
16
+ };
17
+ export default keyboardFocusHandler;
@@ -10,6 +10,7 @@ const legendGetter = params => {
10
10
  return acc;
11
11
  }
12
12
  acc.push({
13
+ type: 'bar',
13
14
  markType: series[seriesId].labelMarkType,
14
15
  id: seriesId,
15
16
  seriesId,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { stack as d3Stack } from '@mui/x-charts-vendor/d3-shape';
3
3
  import { warnOnce } from '@mui/x-internals/warning';
4
- import { getStackingGroups } from "../../../internals/stackSeries.js";
4
+ import { getStackingGroups } from "../../../internals/stacking/index.js";
5
5
  const barValueFormatter = v => v == null ? '' : v.toLocaleString();
6
6
  const seriesProcessor = (params, dataset) => {
7
7
  const {
@@ -2,9 +2,11 @@ import { getExtremumX, getExtremumY } from "./bar/extremums.js";
2
2
  import seriesProcessor from "./bar/seriesProcessor.js";
3
3
  import legendGetter from "./bar/legend.js";
4
4
  import getColor from "./bar/getColor.js";
5
+ import keyboardFocusHandler from "./bar/keyboardFocusHandler.js";
5
6
  import tooltipGetter, { axisTooltipGetter } from "./bar/tooltip.js";
6
7
  import tooltipItemPositionGetter from "./bar/tooltipPosition.js";
7
8
  import { getSeriesWithDefaultValues } from "./bar/getSeriesWithDefaultValues.js";
9
+ import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
8
10
  export const barSeriesConfig = {
9
11
  seriesProcessor,
10
12
  colorProcessor: getColor,
@@ -14,5 +16,7 @@ export const barSeriesConfig = {
14
16
  axisTooltipGetter,
15
17
  xExtremumGetter: getExtremumX,
16
18
  yExtremumGetter: getExtremumY,
17
- getSeriesWithDefaultValues
19
+ getSeriesWithDefaultValues,
20
+ keyboardFocusHandler,
21
+ identifierSerializer: identifierSerializerSeriesIdDataIndex
18
22
  };
@@ -15,12 +15,14 @@ export interface ProcessedBarSeriesData {
15
15
  xOrigin: number;
16
16
  yOrigin: number;
17
17
  }
18
+ export type BorderRadiusSide = 'top' | 'bottom' | 'left' | 'right';
18
19
  export interface ProcessedBarData extends AnimationData {
19
20
  seriesId: SeriesId;
20
21
  dataIndex: number;
21
22
  color: string;
22
23
  value: number | null;
23
24
  maskId: string;
25
+ borderRadiusSide?: BorderRadiusSide;
24
26
  }
25
27
  export interface MaskData extends AnimationData {
26
28
  id: string;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { BarChartProps } from "./BarChart.js";
2
+ import { type BarChartProps, type BarSeries } from "./BarChart.js";
3
3
  import { type ChartContainerProps } from "../ChartContainer/index.js";
4
4
  import { type BarPlotProps } from "./BarPlot.js";
5
5
  import { type ChartsGridProps } from "../ChartsGrid/index.js";
@@ -10,6 +10,10 @@ import { type ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.js";
10
10
  import { type ChartsLegendSlotExtension } from "../ChartsLegend/index.js";
11
11
  import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
12
12
  import { type BarChartPluginSignatures } from "./BarChart.plugins.js";
13
+ export interface UseBarChartPropsExtensions {}
14
+ export type UseBarChartProps = Omit<BarChartProps, 'series'> & Omit<{
15
+ series: ReadonlyArray<BarSeries>;
16
+ }, keyof UseBarChartPropsExtensions> & UseBarChartPropsExtensions;
13
17
  /**
14
18
  * A helper function that extracts BarChartProps from the input props
15
19
  * and returns an object with props for the children components of BarChart.
@@ -17,7 +21,7 @@ import { type BarChartPluginSignatures } from "./BarChart.plugins.js";
17
21
  * @param props The input props for BarChart
18
22
  * @returns An object with props for the children components of BarChart
19
23
  */
20
- export declare const useBarChartProps: (props: BarChartProps) => {
24
+ export declare const useBarChartProps: (props: UseBarChartProps) => {
21
25
  chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
22
26
  chartContainerProps: ChartContainerProps<"bar", BarChartPluginSignatures>;
23
27
  barPlotProps: BarPlotProps;
@@ -2,12 +2,11 @@
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 = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar", "brushConfig"];
5
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar", "brushConfig", "renderer"];
6
6
  import * as React from 'react';
7
7
  import useId from '@mui/utils/useId';
8
8
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
9
9
  import { BAR_CHART_PLUGINS } from "./BarChart.plugins.js";
10
-
11
10
  /**
12
11
  * A helper function that extracts BarChartProps from the input props
13
12
  * and returns an object with props for the children components of BarChart.
@@ -40,7 +39,8 @@ export const useBarChartProps = props => {
40
39
  borderRadius,
41
40
  barLabel,
42
41
  className,
43
- brushConfig
42
+ brushConfig,
43
+ renderer
44
44
  } = props,
45
45
  other = _objectWithoutPropertiesLoose(props, _excluded);
46
46
  const id = useId();
@@ -105,6 +105,7 @@ export const useBarChartProps = props => {
105
105
  slots,
106
106
  slotProps,
107
107
  borderRadius,
108
+ renderer,
108
109
  barLabel
109
110
  };
110
111
  const gridProps = {
@@ -1,7 +1,7 @@
1
1
  import { type ChartsXAxisProps, type ChartsYAxisProps } from "../models/axis.js";
2
- import { type ChartDrawingArea } from "../hooks/index.js";
3
2
  import { type MaskData, type ProcessedBarSeriesData } from "./types.js";
4
3
  import { type ComputedAxisConfig } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js";
4
+ import { type ChartDrawingArea } from "../hooks/useDrawingArea.js";
5
5
  export declare function useBarPlotData(drawingArea: ChartDrawingArea, xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): {
6
6
  completedData: ProcessedBarSeriesData[];
7
7
  masksData: MaskData[];
@@ -1,9 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import getColor from "./seriesConfig/bar/getColor.js";
3
- import { useChartId, useXAxes, useYAxes } from "../hooks/index.js";
3
+ import { useXAxes, useYAxes } from "../hooks/useAxis.js";
4
4
  import { checkBarChartScaleErrors } from "./checkBarChartScaleErrors.js";
5
5
  import { useBarSeriesContext } from "../hooks/useBarSeries.js";
6
6
  import { getBarDimensions } from "../internals/getBarDimensions.js";
7
+ import { useChartId } from "../hooks/useChartId.js";
7
8
  export function useBarPlotData(drawingArea, xAxes, yAxes) {
8
9
  const seriesData = useBarSeriesContext() ?? {
9
10
  series: {},
@@ -25,6 +26,8 @@ export function useBarPlotData(drawingArea, xAxes, yAxes) {
25
26
  const xMax = drawingArea.left + drawingArea.width;
26
27
  const yMin = drawingArea.top;
27
28
  const yMax = drawingArea.top + drawingArea.height;
29
+ const lastNegativePerIndex = new Map();
30
+ const lastPositivePerIndex = new Map();
28
31
  return seriesIds.map(seriesId => {
29
32
  const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
30
33
  const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
@@ -66,6 +69,22 @@ export function useBarPlotData(drawingArea, xAxes, yAxes) {
66
69
  if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
67
70
  continue;
68
71
  }
72
+ const lastNegative = lastNegativePerIndex.get(dataIndex);
73
+ const lastPositive = lastPositivePerIndex.get(dataIndex);
74
+ const sign = (reverse ? -1 : 1) * Math.sign(result.value ?? 0);
75
+ if (sign > 0) {
76
+ if (lastPositive) {
77
+ delete lastPositive.borderRadiusSide;
78
+ }
79
+ result.borderRadiusSide = verticalLayout ? 'top' : 'right';
80
+ lastPositivePerIndex.set(dataIndex, result);
81
+ } else if (sign < 0) {
82
+ if (lastNegative) {
83
+ delete lastNegative.borderRadiusSide;
84
+ }
85
+ result.borderRadiusSide = verticalLayout ? 'bottom' : 'left';
86
+ lastNegativePerIndex.set(dataIndex, result);
87
+ }
69
88
  if (!masks[result.maskId]) {
70
89
  masks[result.maskId] = {
71
90
  id: result.maskId,
@@ -0,0 +1,6 @@
1
+ import { type BarItemIdentifier } from "../models/seriesType/index.js";
2
+ /**
3
+ * Hook that registers pointer event handlers for chart item clicking.
4
+ * @param onItemClick Callback for item click events.
5
+ */
6
+ export declare function useRegisterItemClickHandlers(onItemClick: ((event: MouseEvent, barItemIdentifier: BarItemIdentifier) => void) | undefined): void;
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { useSvgRef } from "../hooks/useSvgRef.js";
5
+ import { useChartContext } from "../context/ChartProvider/index.js";
6
+ import { getSVGPoint } from "../internals/getSVGPoint.js";
7
+ import { useStore } from "../internals/store/useStore.js";
8
+ import { selectorBarItemAtPosition } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js";
9
+
10
+ /**
11
+ * Hook that registers pointer event handlers for chart item clicking.
12
+ * @param onItemClick Callback for item click events.
13
+ */
14
+ export function useRegisterItemClickHandlers(onItemClick) {
15
+ const {
16
+ instance
17
+ } = useChartContext();
18
+ const svgRef = useSvgRef();
19
+ const store = useStore();
20
+ React.useEffect(() => {
21
+ const element = svgRef.current;
22
+ if (!element || !onItemClick) {
23
+ return undefined;
24
+ }
25
+ let lastPointerUp = null;
26
+ const onClick = function onClick(event) {
27
+ let point = event;
28
+
29
+ /* The click event doesn't contain decimal values in clientX/Y, but the pointermove does.
30
+ * This caused a problem when rendering many bars that were thinner than a pixel where the tooltip or the highlight
31
+ * would refer to a different bar than the click since those rely on the pointermove event.
32
+ * As a fix, we use the pointerup event to get the decimal values and check if the pointer up event was close enough
33
+ * to the click event (1px difference in each direction); if so, then we can use the pointerup's clientX/Y; if not,
34
+ * we default to the click event's clientX/Y. */
35
+ if (lastPointerUp) {
36
+ if (Math.abs(event.clientX - lastPointerUp.clientX) <= 1 && Math.abs(event.clientY - lastPointerUp.clientY) <= 1) {
37
+ point = {
38
+ clientX: lastPointerUp.clientX,
39
+ clientY: lastPointerUp.clientY
40
+ };
41
+ }
42
+ }
43
+ lastPointerUp = null;
44
+ const svgPoint = getSVGPoint(element, point);
45
+ if (!instance.isPointInside(svgPoint.x, svgPoint.y)) {
46
+ return;
47
+ }
48
+ const item = selectorBarItemAtPosition(store.state, svgPoint);
49
+ if (item) {
50
+ onItemClick(event, {
51
+ type: 'bar',
52
+ seriesId: item.seriesId,
53
+ dataIndex: item.dataIndex
54
+ });
55
+ }
56
+ };
57
+ const onPointerUp = function onPointerUp(event) {
58
+ lastPointerUp = event;
59
+ };
60
+ element.addEventListener('click', onClick);
61
+ element.addEventListener('pointerup', onPointerUp);
62
+ return () => {
63
+ element.removeEventListener('click', onClick);
64
+ element.removeEventListener('pointerup', onPointerUp);
65
+ };
66
+ }, [instance, onItemClick, store, svgRef]);
67
+ }
@@ -95,6 +95,35 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
95
95
  * The height of the chart in px. If not defined, it takes the height of the parent element.
96
96
  */
97
97
  height: PropTypes.number,
98
+ /**
99
+ * List of hidden series and/or items.
100
+ *
101
+ * Different chart types use different keys.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * [
106
+ * {
107
+ * type: 'pie',
108
+ * seriesId: 'series-1',
109
+ * dataIndex: 3,
110
+ * },
111
+ * {
112
+ * type: 'line',
113
+ * seriesId: 'series-2',
114
+ * }
115
+ * ]
116
+ * ```
117
+ */
118
+ hiddenItems: PropTypes.arrayOf(PropTypes.shape({
119
+ dataIndex: PropTypes.any,
120
+ seriesId: PropTypes.shape({
121
+ toLocaleString: PropTypes.func.isRequired,
122
+ toString: PropTypes.func.isRequired,
123
+ valueOf: PropTypes.func.isRequired
124
+ }),
125
+ type: PropTypes.object.isRequired
126
+ })),
98
127
  /**
99
128
  * The controlled axis highlight.
100
129
  * Identified by the axis id, and data index.
@@ -139,6 +168,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
139
168
  * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
140
169
  */
141
170
  onAxisClick: PropTypes.func,
171
+ /**
172
+ * Callback fired when any hidden identifiers change.
173
+ * @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
174
+ */
175
+ onHiddenItemsChange: PropTypes.func,
142
176
  /**
143
177
  * The callback fired when the highlighted item changes.
144
178
  *
@@ -2,7 +2,7 @@
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 = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation", "brushConfig"];
5
+ const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation", "brushConfig", "onHiddenItemsChange", "hiddenItems"];
6
6
  import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
7
7
  export const useChartContainerProps = (props, ref) => {
8
8
  const _ref = props,
@@ -39,7 +39,9 @@ export const useChartContainerProps = (props, ref) => {
39
39
  slotProps,
40
40
  experimentalFeatures,
41
41
  enableKeyboardNavigation,
42
- brushConfig
42
+ brushConfig,
43
+ onHiddenItemsChange,
44
+ hiddenItems
43
45
  } = _ref,
44
46
  other = _objectWithoutPropertiesLoose(_ref, _excluded);
45
47
  const chartsSurfaceProps = _extends({
@@ -75,6 +77,8 @@ export const useChartContainerProps = (props, ref) => {
75
77
  experimentalFeatures,
76
78
  enableKeyboardNavigation,
77
79
  brushConfig,
80
+ onHiddenItemsChange,
81
+ hiddenItems,
78
82
  plugins: plugins ?? DEFAULT_PLUGINS,
79
83
  slots,
80
84
  slotProps
@@ -82,7 +82,7 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
82
82
  children: data.items.map((item, i) => {
83
83
  return /*#__PURE__*/_jsx("li", {
84
84
  className: classes?.item,
85
- "data-series": item.id,
85
+ "data-series": item.seriesId,
86
86
  children: /*#__PURE__*/_jsxs(Element, {
87
87
  className: classes?.series,
88
88
  role: onItemClick ? 'button' : undefined,
@@ -99,7 +99,7 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
99
99
  children: item.label
100
100
  })]
101
101
  })
102
- }, item.id);
102
+ }, `${item.seriesId}-${item.dataIndex}`);
103
103
  })
104
104
  }));
105
105
  }));
@@ -1,6 +1,7 @@
1
1
  import { type ChartsLabelMarkProps } from "../ChartsLabel/ChartsLabelMark.js";
2
2
  import { type PieItemId } from "../models/index.js";
3
3
  import { type SeriesId } from "../models/seriesType/common.js";
4
+ import type { ChartSeriesType } from "../models/seriesType/config.js";
4
5
  interface LegendItemContextBase {
5
6
  /**
6
7
  * The color used in the legend
@@ -15,8 +16,14 @@ export interface LegendItemParams extends Partial<Omit<SeriesLegendItemContext,
15
16
  /**
16
17
  * The identifier of the legend element.
17
18
  * Used for internal purpose such as `key` props
19
+ * @deprecated use `seriesId` and `dataIndex` instead
18
20
  */
19
21
  id: number | string;
22
+ /**
23
+ * The type of the series
24
+ * This property is always defined, but marked as optional to avoid breaking changes. It will become required in a future major version.
25
+ */
26
+ type?: ChartSeriesType;
20
27
  markType: ChartsLabelMarkProps['type'];
21
28
  }
22
29
  export interface SeriesLegendItemContext extends LegendItemContextBase {
@@ -32,8 +39,13 @@ export interface SeriesLegendItemContext extends LegendItemContextBase {
32
39
  seriesId: SeriesId;
33
40
  /**
34
41
  * The identifier of the pie item
42
+ * @deprecated use `dataIndex` instead
35
43
  */
36
44
  itemId?: PieItemId;
45
+ /**
46
+ * The data index of the item in the series data array
47
+ */
48
+ dataIndex?: number;
37
49
  }
38
50
  export interface PiecewiseColorLegendItemContext extends LegendItemContextBase {
39
51
  /**
@@ -3,5 +3,6 @@ export const seriesContextBuilder = context => ({
3
3
  color: context.color,
4
4
  label: context.label,
5
5
  seriesId: context.seriesId,
6
- itemId: context.itemId
6
+ itemId: context.itemId,
7
+ dataIndex: context.dataIndex
7
8
  });
@@ -7,7 +7,10 @@ import { styled } from '@mui/material/styles';
7
7
  import { useDrawingArea } from "../hooks/useDrawingArea.js";
8
8
  import { useChartsLocalization } from "../hooks/useChartsLocalization.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
- const StyledText = styled('text')(({
10
+ const StyledText = styled('text', {
11
+ slot: 'internal',
12
+ shouldForwardProp: undefined
13
+ })(({
11
14
  theme
12
15
  }) => _extends({}, theme.typography.body2, {
13
16
  stroke: 'none',
@@ -7,7 +7,10 @@ import { styled } from '@mui/material/styles';
7
7
  import { useDrawingArea } from "../hooks/useDrawingArea.js";
8
8
  import { useChartsLocalization } from "../hooks/useChartsLocalization.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
- const StyledText = styled('text')(({
10
+ const StyledText = styled('text', {
11
+ slot: 'internal',
12
+ shouldForwardProp: undefined
13
+ })(({
11
14
  theme
12
15
  }) => _extends({}, theme.typography.body2, {
13
16
  stroke: 'none',
@@ -40,4 +40,4 @@ export type CommonChartsReferenceLineProps = {
40
40
  */
41
41
  classes?: Partial<ChartsReferenceLineClasses>;
42
42
  };
43
- export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
43
+ export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
@@ -3,7 +3,10 @@ import { styled } from '@mui/material/styles';
3
3
  import { referenceLineClasses } from "./chartsReferenceLineClasses.js";
4
4
  export const DEFAULT_SPACING = 5;
5
5
  export const DEFAULT_SPACING_MIDDLE_OTHER_AXIS = 0;
6
- export const ReferenceLineRoot = styled('g')(({
6
+ export const ReferenceLineRoot = styled('g', {
7
+ slot: 'internal',
8
+ shouldForwardProp: undefined
9
+ })(({
7
10
  theme
8
11
  }) => ({
9
12
  [`& .${referenceLineClasses.line}`]: {
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["trigger", "position", "anchor", "classes", "children"];
6
6
  import * as React from 'react';
7
+ import * as ReactDOM from 'react-dom';
7
8
  import PropTypes from 'prop-types';
8
9
  import HTMLElementType from '@mui/utils/HTMLElementType';
9
10
  import useLazyRef from '@mui/utils/useLazyRef';
@@ -21,7 +22,7 @@ import { selectorChartsInteractionPolarAxisTooltip } from "../internals/plugins/
21
22
  import { useAxisSystem } from "../hooks/useAxisSystem.js";
22
23
  import { useSvgRef } from "../hooks/index.js";
23
24
  import { selectorBrushShouldPreventTooltip } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
24
- import { jsx as _jsx } from "react/jsx-runtime";
25
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
26
  const selectorReturnFalse = () => false;
26
27
  const selectorReturnNull = () => null;
27
28
  function getIsOpenSelector(trigger, axisSystem, shouldPreventBecauseOfBrush) {
@@ -72,6 +73,7 @@ function ChartsTooltipContainer(inProps) {
72
73
  } = props,
73
74
  other = _objectWithoutPropertiesLoose(props, _excluded);
74
75
  const svgRef = useSvgRef();
76
+ const anchorRef = React.useRef(null);
75
77
  const classes = useUtilityClasses(propClasses);
76
78
  const pointerType = usePointerType();
77
79
  const isFineMainPointer = useIsFineMainPointer();
@@ -93,18 +95,11 @@ function ChartsTooltipContainer(inProps) {
93
95
  return () => {};
94
96
  }
95
97
  if (itemPosition !== null) {
96
- const positionUpdate = rafThrottle(() => {
97
- // eslint-disable-next-line react-compiler/react-compiler
98
- positionRef.current = {
99
- x: svgElement.getBoundingClientRect().left + (itemPosition?.x ?? 0),
100
- y: svgElement.getBoundingClientRect().top + (itemPosition?.y ?? 0)
101
- };
102
- popperRef.current?.update();
103
- });
104
- positionUpdate();
105
- return () => positionUpdate.clear();
98
+ // Tooltip position is already handled by the anchor element
99
+ return undefined;
106
100
  }
107
101
  const pointerUpdate = rafThrottle((x, y) => {
102
+ // eslint-disable-next-line react-compiler/react-compiler
108
103
  positionRef.current = {
109
104
  x,
110
105
  y
@@ -124,7 +119,7 @@ function ChartsTooltipContainer(inProps) {
124
119
  pointerUpdate.clear();
125
120
  };
126
121
  }, [svgRef, positionRef, itemPosition]);
127
- const anchorEl = React.useMemo(() => ({
122
+ const pointerAnchorEl = React.useMemo(() => ({
128
123
  getBoundingClientRect: () => ({
129
124
  x: positionRef.current.x,
130
125
  y: positionRef.current.y,
@@ -166,16 +161,25 @@ function ChartsTooltipContainer(inProps) {
166
161
  if (trigger === 'none') {
167
162
  return null;
168
163
  }
169
- return /*#__PURE__*/_jsx(NoSsr, {
170
- children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({}, other, {
171
- className: classes?.root,
172
- open: isOpen,
173
- placement: other.placement ?? position ?? (isMouse ? 'right-start' : 'top'),
174
- popperRef: popperRef,
175
- anchorEl: anchorEl,
176
- modifiers: modifiers,
177
- children: children
178
- }))
164
+ if (itemPosition !== null && anchorRef.current) {
165
+ anchorRef.current.setAttribute('x', String(itemPosition.x));
166
+ anchorRef.current.setAttribute('y', String(itemPosition.y));
167
+ }
168
+ return /*#__PURE__*/_jsxs(React.Fragment, {
169
+ children: [svgRef.current && /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/_jsx("rect", {
170
+ ref: anchorRef,
171
+ display: "hidden"
172
+ }), svgRef.current), /*#__PURE__*/_jsx(NoSsr, {
173
+ children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({}, other, {
174
+ className: classes?.root,
175
+ open: isOpen,
176
+ placement: other.placement ?? position ?? (pointerType !== null && isMouse ? 'right-start' : 'top'),
177
+ popperRef: popperRef,
178
+ anchorEl: itemPosition ? anchorRef.current : pointerAnchorEl,
179
+ modifiers: modifiers,
180
+ children: children
181
+ }))
182
+ })]
179
183
  });
180
184
  }
181
185
  process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
@@ -11,7 +11,10 @@ import { GaugeProvider } from "./GaugeProvider.js";
11
11
  import { ChartProvider } from "../context/ChartProvider/index.js";
12
12
  import { defaultizeMargin } from "../internals/defaultizeMargin.js";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- const GStyled = styled('g')(({
14
+ const GStyled = styled('g', {
15
+ slot: 'internal',
16
+ shouldForwardProp: undefined
17
+ })(({
15
18
  theme
16
19
  }) => ({
17
20
  '& text': {
@@ -24,9 +24,12 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
24
24
  ownerState
25
25
  } = props,
26
26
  other = _objectWithoutPropertiesLoose(props, _excluded);
27
- const animateProps = useAnimateLine(_extends({}, props, {
27
+ const animateProps = useAnimateLine({
28
+ d: props.d,
29
+ skipAnimation,
28
30
  ref
29
- }));
31
+ });
32
+ const fadedOpacity = ownerState.isFaded ? 0.3 : 1;
30
33
  return /*#__PURE__*/_jsx(AppearingMask, {
31
34
  skipAnimation: skipAnimation,
32
35
  id: `${ownerState.id}-line-clip`,
@@ -36,7 +39,7 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
36
39
  strokeLinejoin: "round",
37
40
  fill: "none",
38
41
  filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
39
- opacity: ownerState.isFaded ? 0.3 : 1,
42
+ opacity: ownerState.hidden ? 0 : fadedOpacity,
40
43
  "data-series": ownerState.id,
41
44
  "data-highlighted": ownerState.isHighlighted || undefined,
42
45
  "data-faded": ownerState.isFaded || undefined
@@ -54,6 +57,7 @@ process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
54
57
  classes: PropTypes.object,
55
58
  color: PropTypes.string.isRequired,
56
59
  gradientId: PropTypes.string,
60
+ hidden: PropTypes.bool,
57
61
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
58
62
  isFaded: PropTypes.bool.isRequired,
59
63
  isHighlighted: PropTypes.bool.isRequired
@@ -8,7 +8,10 @@ import { cleanId } from "../internals/cleanId.js";
8
8
  import { useChartId, useDrawingArea } from "../hooks/index.js";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  export const appearingMaskClasses = generateUtilityClasses('MuiAppearingMask', ['animate']);
11
- const AnimatedRect = styled('rect')({
11
+ const AnimatedRect = styled('rect', {
12
+ slot: 'internal',
13
+ shouldForwardProp: undefined
14
+ })({
12
15
  animationName: 'animate-width',
13
16
  animationTimingFunction: ANIMATION_TIMING_FUNCTION,
14
17
  animationDuration: '0s',
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { type MarkElementOwnerState } from "./markElementClasses.js";
3
3
  export type CircleMarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & {
4
+ /**
5
+ * If `true`, the marker is hidden.
6
+ * @default false
7
+ */
8
+ hidden?: boolean;
4
9
  /**
5
10
  * If `true`, animations are skipped.
6
11
  * @default false