@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,4 +2,5 @@ import { useChartPolarAxis } from "../internals/plugins/featurePlugins/useChartP
2
2
  import { useChartTooltip } from "../internals/plugins/featurePlugins/useChartTooltip/index.js";
3
3
  import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
4
4
  import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
5
- export const RADAR_PLUGINS = [useChartTooltip, useChartInteraction, useChartPolarAxis, useChartHighlight];
5
+ import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
6
+ export const RADAR_PLUGINS = [useChartTooltip, useChartInteraction, useChartPolarAxis, useChartHighlight, useChartVisibilityManager];
@@ -5,6 +5,7 @@ import legendGetter from "./legend.js";
5
5
  import tooltipGetter, { axisTooltipGetter } from "./tooltip.js";
6
6
  import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
7
7
  import tooltipItemPositionGetter from "./tooltipPosition.js";
8
+ import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
8
9
  export const radarSeriesConfig = {
9
10
  colorProcessor: getColor,
10
11
  seriesProcessor,
@@ -14,5 +15,6 @@ export const radarSeriesConfig = {
14
15
  axisTooltipGetter,
15
16
  getSeriesWithDefaultValues,
16
17
  radiusExtremumGetter,
17
- rotationExtremumGetter
18
+ rotationExtremumGetter,
19
+ identifierSerializer: identifierSerializerSeriesIdDataIndex
18
20
  };
@@ -10,6 +10,7 @@ const legendGetter = params => {
10
10
  return acc;
11
11
  }
12
12
  acc.push({
13
+ type: 'radar',
13
14
  id: seriesId,
14
15
  seriesId,
15
16
  color: series[seriesId].color,
@@ -6,21 +6,12 @@ import { useUtilityClasses } from "./scatterClasses.js";
6
6
  import { useChartContext } from "../context/ChartProvider/index.js";
7
7
  import { getValueToPositionMapper } from "../hooks/useScale.js";
8
8
  import { selectorChartIsSeriesFaded, selectorChartIsSeriesHighlighted, selectorChartSeriesUnfadedItem, selectorChartSeriesHighlightedItem } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
9
+ import { appendAtKey } from "../internals/appendAtKey.js";
9
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
11
  const MAX_POINTS_PER_PATH = 1000;
11
12
  /* In an SVG arc, if the arc starts and ends at the same point, it is not rendered, so we add a tiny
12
13
  * value to one of the coordinates to ensure that the arc is rendered. */
13
14
  const ALMOST_ZERO = 0.01;
14
- function appendAtKey(map, key, value) {
15
- let bucket = map.get(key);
16
- if (!bucket) {
17
- bucket = [value];
18
- map.set(key, bucket);
19
- } else {
20
- bucket.push(value);
21
- }
22
- return bucket;
23
- }
24
15
  function createPath(x, y, markerSize) {
25
16
  return `M${x - markerSize} ${y} a${markerSize} ${markerSize} 0 1 1 0 ${ALMOST_ZERO}`;
26
17
  }
@@ -81,7 +72,10 @@ function BatchScatterPaths(props) {
81
72
  }
82
73
  const MemoBatchScatterPaths = /*#__PURE__*/React.memo(BatchScatterPaths);
83
74
  if (process.env.NODE_ENV !== "production") MemoBatchScatterPaths.displayName = "MemoBatchScatterPaths";
84
- const Group = styled('g')({
75
+ const Group = styled('g', {
76
+ slot: 'internal',
77
+ shouldForwardProp: undefined
78
+ })({
85
79
  '&[data-faded="true"]': {
86
80
  opacity: 0.3
87
81
  },
@@ -18,7 +18,7 @@ export function FocusedScatterMark(props) {
18
18
  yAxis,
19
19
  yAxisIds
20
20
  } = useYAxes();
21
- if (focusedItem === null || focusedItem.seriesType !== 'scatter' || !scatterSeries) {
21
+ if (focusedItem === null || focusedItem.type !== 'scatter' || !scatterSeries) {
22
22
  return null;
23
23
  }
24
24
  const series = scatterSeries?.series[focusedItem.seriesId];
@@ -124,6 +124,31 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
124
124
  * The height of the chart in px. If not defined, it takes the height of the parent element.
125
125
  */
126
126
  height: PropTypes.number,
127
+ /**
128
+ * List of hidden series and/or items.
129
+ *
130
+ * Different chart types use different keys.
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * [
135
+ * {
136
+ * type: 'pie',
137
+ * seriesId: 'series-1',
138
+ * dataIndex: 3,
139
+ * },
140
+ * {
141
+ * type: 'line',
142
+ * seriesId: 'series-2',
143
+ * }
144
+ * ]
145
+ * ```
146
+ */
147
+ hiddenItems: PropTypes.arrayOf(PropTypes.shape({
148
+ dataIndex: PropTypes.number,
149
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
150
+ type: PropTypes.oneOf(['scatter']).isRequired
151
+ })),
127
152
  /**
128
153
  * If `true`, the legend is not rendered.
129
154
  */
@@ -169,6 +194,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
169
194
  * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
170
195
  */
171
196
  onAxisClick: PropTypes.func,
197
+ /**
198
+ * Callback fired when any hidden identifiers change.
199
+ * @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
200
+ */
201
+ onHiddenItemsChange: PropTypes.func,
172
202
  /**
173
203
  * The callback fired when the highlighted item changes.
174
204
  *
@@ -7,5 +7,6 @@ import { type ConvertSignaturesIntoPlugins } from "../internals/plugins/models/h
7
7
  import { type UseChartClosestPointSignature } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
8
8
  import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
9
9
  import { type UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
10
- export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
10
+ import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
11
+ export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
11
12
  export declare const SCATTER_CHART_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartPluginSignatures>;
@@ -6,4 +6,5 @@ import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartH
6
6
  import { useChartClosestPoint } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
7
7
  import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
8
8
  import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
9
- export const SCATTER_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation];
9
+ import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
10
+ export const SCATTER_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, useChartKeyboardNavigation];
@@ -5,6 +5,8 @@ import legendGetter from "./legend.js";
5
5
  import tooltipGetter from "./tooltip.js";
6
6
  import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
7
7
  import tooltipItemPositionGetter from "./tooltipPosition.js";
8
+ import keyboardFocusHandler from "./keyboardFocusHandler.js";
9
+ import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
8
10
  export const scatterSeriesConfig = {
9
11
  seriesProcessor,
10
12
  colorProcessor: getColor,
@@ -13,5 +15,7 @@ export const scatterSeriesConfig = {
13
15
  tooltipItemPositionGetter,
14
16
  xExtremumGetter: getExtremumX,
15
17
  yExtremumGetter: getExtremumY,
16
- getSeriesWithDefaultValues
18
+ getSeriesWithDefaultValues,
19
+ keyboardFocusHandler,
20
+ identifierSerializer: identifierSerializerSeriesIdDataIndex
17
21
  };
@@ -0,0 +1,3 @@
1
+ import type { KeyboardFocusHandler } from "../../internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js";
2
+ declare const keyboardFocusHandler: KeyboardFocusHandler<'scatter', '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: 'scatter',
13
14
  markType: series[seriesId].labelMarkType,
14
15
  id: seriesId,
15
16
  seriesId,
@@ -241,6 +241,47 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
241
241
  * The height of the chart in px. If not defined, it takes the height of the parent element.
242
242
  */
243
243
  height: PropTypes.number,
244
+ /**
245
+ * List of hidden series and/or items.
246
+ *
247
+ * Different chart types use different keys.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * [
252
+ * {
253
+ * type: 'pie',
254
+ * seriesId: 'series-1',
255
+ * dataIndex: 3,
256
+ * },
257
+ * {
258
+ * type: 'line',
259
+ * seriesId: 'series-2',
260
+ * }
261
+ * ]
262
+ * ```
263
+ */
264
+ hiddenItems: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
265
+ dataIndex: PropTypes.number,
266
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
267
+ type: PropTypes.oneOf(['bar']).isRequired
268
+ }), PropTypes.shape({
269
+ dataIndex: PropTypes.number,
270
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
271
+ type: PropTypes.oneOf(['line']).isRequired
272
+ }), PropTypes.shape({
273
+ dataIndex: PropTypes.number,
274
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
275
+ type: PropTypes.oneOf(['scatter']).isRequired
276
+ }), PropTypes.shape({
277
+ dataIndex: PropTypes.number,
278
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
279
+ type: PropTypes.oneOf(['pie']).isRequired
280
+ }), PropTypes.shape({
281
+ dataIndex: PropTypes.number,
282
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
283
+ type: PropTypes.oneOf(['radar']).isRequired
284
+ })]).isRequired),
244
285
  /**
245
286
  * The controlled axis highlight.
246
287
  * Identified by the axis id, and data index.
@@ -286,6 +327,11 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
286
327
  * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
287
328
  */
288
329
  onAxisClick: PropTypes.func,
330
+ /**
331
+ * Callback fired when any hidden identifiers change.
332
+ * @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
333
+ */
334
+ onHiddenItemsChange: PropTypes.func,
289
335
  /**
290
336
  * The callback fired when the highlighted item changes.
291
337
  *
@@ -1,15 +1,4 @@
1
- import { type ChartSeriesType } from "../models/seriesType/config.js";
2
- import { type SeriesId } from "../models/seriesType/common.js";
3
- export type FocusedItemData = {
4
- seriesType: ChartSeriesType;
5
- seriesId: SeriesId;
6
- dataIndex: number;
7
- };
8
1
  /**
9
2
  * Get the focused item from keyboard navigation.
10
3
  */
11
- export declare function useFocusedItem(): {
12
- seriesType: "line" | "bar" | "scatter" | "pie";
13
- seriesId: SeriesId;
14
- dataIndex: number;
15
- } | null;
4
+ export declare function useFocusedItem(): import("../index.js").FocusedItemIdentifier<keyof import("../internals/index.js").ChartsSeriesConfig> | null;
@@ -1,19 +1,12 @@
1
1
  'use client';
2
2
 
3
- import * as React from 'react';
4
3
  import { useStore } from "../internals/store/useStore.js";
5
- import { selectorChartsFocusedSeriesType, selectorChartsFocusedSeriesId, selectorChartsFocusedDataIndex } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
4
+ import { selectorChartsFocusedItem } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
5
+
6
6
  /**
7
7
  * Get the focused item from keyboard navigation.
8
8
  */
9
9
  export function useFocusedItem() {
10
10
  const store = useStore();
11
- const focusedSeriesType = store.use(selectorChartsFocusedSeriesType);
12
- const focusedSeriesId = store.use(selectorChartsFocusedSeriesId);
13
- const focusedDataIndex = store.use(selectorChartsFocusedDataIndex);
14
- return React.useMemo(() => focusedSeriesType === undefined || focusedSeriesId === undefined || focusedDataIndex === undefined ? null : {
15
- seriesType: focusedSeriesType,
16
- seriesId: focusedSeriesId,
17
- dataIndex: focusedDataIndex
18
- }, [focusedSeriesType, focusedSeriesId, focusedDataIndex]);
11
+ return store.use(selectorChartsFocusedItem);
19
12
  }
@@ -1,11 +1,12 @@
1
- import { type FocusedItemData } from "./useFocusedItem.js";
2
- type UseItemFocusedParams = FocusedItemData;
1
+ import type { ChartSeriesType } from "../models/seriesType/config.js";
2
+ import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
3
+ type UseItemFocusedParams = FocusedItemIdentifier<ChartSeriesType>;
3
4
  /**
4
5
  * A hook to check if an item has the focus.
5
6
  *
6
7
  * If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
7
8
  *
8
- * @param {FocusedItemData} item is the item to check
9
+ * @param {FocusedItemIdentifier} item is the item to check
9
10
  * @returns {boolean} the focus state
10
11
  */
11
12
  export declare function useIsItemFocused(item: UseItemFocusedParams): boolean;
@@ -7,7 +7,7 @@ import { selectorChartsItemIsFocused } from "../internals/plugins/featurePlugins
7
7
  *
8
8
  * If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
9
9
  *
10
- * @param {FocusedItemData} item is the item to check
10
+ * @param {FocusedItemIdentifier} item is the item to check
11
11
  * @returns {boolean} the focus state
12
12
  */
13
13
  export function useIsItemFocused(item) {
@@ -1,8 +1,9 @@
1
- import { type FocusedItemData } from "./useFocusedItem.js";
1
+ import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
2
+ import type { ChartSeriesType } from "../models/seriesType/config.js";
2
3
  /**
3
4
  * A hook to check focus state of multiple items.
4
5
  * If you're interested by a single one, consider using `useIsItemFocused`.
5
6
  *
6
7
  * @returns {(item: FocusedItemData) => boolean} callback to get the state of the item.
7
8
  */
8
- export declare function useIsItemFocusedGetter(): (item: FocusedItemData) => boolean;
9
+ export declare function useIsItemFocusedGetter(): (item: FocusedItemIdentifier<ChartSeriesType>) => boolean;
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
3
4
  import { useFocusedItem } from "./useFocusedItem.js";
4
5
 
5
6
  /**
@@ -10,5 +11,5 @@ import { useFocusedItem } from "./useFocusedItem.js";
10
11
  */
11
12
  export function useIsItemFocusedGetter() {
12
13
  const focusedItem = useFocusedItem();
13
- return item => focusedItem !== null && focusedItem.seriesType === item.seriesType && focusedItem.seriesId === item.seriesId && focusedItem.dataIndex === item.dataIndex;
14
+ return item => focusedItem !== null && fastObjectShallowCompare(focusedItem, item);
14
15
  }
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.22.1
2
+ * @mui/x-charts v8.24.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Given a map of arrays, appends a value to the array at the given key.
3
+ * If no array exists at that key, one is created and the value appended.
4
+ * @param map Map of arrays
5
+ * @param key Key to append the value at
6
+ * @param value Value to append
7
+ */
8
+ export declare function appendAtKey<K, V>(map: Map<K, V[]>, key: K, value: V): V[];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Given a map of arrays, appends a value to the array at the given key.
3
+ * If no array exists at that key, one is created and the value appended.
4
+ * @param map Map of arrays
5
+ * @param key Key to append the value at
6
+ * @param value Value to append
7
+ */
8
+ export function appendAtKey(map, key, value) {
9
+ let bucket = map.get(key);
10
+ if (!bucket) {
11
+ bucket = [value];
12
+ map.set(key, bucket);
13
+ } else {
14
+ bucket.push(value);
15
+ }
16
+ return bucket;
17
+ }
@@ -0,0 +1,14 @@
1
+ import type { UseChartKeyboardNavigationSignature } from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
2
+ import type { ChartState } from "./plugins/models/chart.js";
3
+ import type { ChartSeriesType } from "../models/seriesType/config.js";
4
+ import type { FocusedItemIdentifier, SeriesId, SeriesItemIdentifier } from "../models/seriesType/index.js";
5
+ type ReturnedItem<OutSeriesType extends ChartSeriesType> = {
6
+ type: OutSeriesType;
7
+ seriesId: SeriesId;
8
+ dataIndex: number;
9
+ } | null;
10
+ export declare function createGetNextIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: FocusedItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
11
+ export declare function createGetPreviousIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
12
+ export declare function createGetNextSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
13
+ export declare function createGetPreviousSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
14
+ export {};
@@ -0,0 +1,88 @@
1
+ import { getPreviousNonEmptySeries } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js";
2
+ import { getMaxSeriesLength } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js";
3
+ import { selectorChartSeriesProcessed } from "./plugins/corePlugins/useChartSeries/index.js";
4
+ import { getNextNonEmptySeries } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js";
5
+ import { seriesHasData } from "./seriesHasData.js";
6
+ export function createGetNextIndexFocusedItem(compatibleSeriesTypes) {
7
+ return function getNextIndexFocusedItem(currentItem, state) {
8
+ const processedSeries = selectorChartSeriesProcessed(state);
9
+ let seriesId = currentItem?.seriesId;
10
+ let type = currentItem?.type;
11
+ if (!type || seriesId == null || !seriesHasData(processedSeries, type, seriesId)) {
12
+ const nextSeries = getNextNonEmptySeries(processedSeries, compatibleSeriesTypes, type, seriesId);
13
+ if (nextSeries === null) {
14
+ return null;
15
+ }
16
+ type = nextSeries.type;
17
+ seriesId = nextSeries.seriesId;
18
+ }
19
+ const maxLength = getMaxSeriesLength(processedSeries, compatibleSeriesTypes);
20
+ const dataIndex = Math.min(maxLength - 1, currentItem?.dataIndex == null ? 0 : currentItem.dataIndex + 1);
21
+ return {
22
+ type,
23
+ seriesId,
24
+ dataIndex
25
+ };
26
+ };
27
+ }
28
+ export function createGetPreviousIndexFocusedItem(compatibleSeriesTypes) {
29
+ return function getPreviousIndexFocusedItem(currentItem, state) {
30
+ const processedSeries = selectorChartSeriesProcessed(state);
31
+ let seriesId = currentItem?.seriesId;
32
+ let type = currentItem?.type;
33
+ if (!type || seriesId == null || !seriesHasData(processedSeries, type, seriesId)) {
34
+ const previousSeries = getPreviousNonEmptySeries(processedSeries, compatibleSeriesTypes, type, seriesId);
35
+ if (previousSeries === null) {
36
+ return null;
37
+ }
38
+ type = previousSeries.type;
39
+ seriesId = previousSeries.seriesId;
40
+ }
41
+ const maxLength = getMaxSeriesLength(processedSeries, compatibleSeriesTypes);
42
+ const dataIndex = Math.max(0, currentItem?.dataIndex == null ? maxLength - 1 : currentItem.dataIndex - 1);
43
+ return {
44
+ type,
45
+ seriesId,
46
+ dataIndex
47
+ };
48
+ };
49
+ }
50
+ export function createGetNextSeriesFocusedItem(compatibleSeriesTypes) {
51
+ return function getNextSeriesFocusedItem(currentItem, state) {
52
+ const processedSeries = selectorChartSeriesProcessed(state);
53
+ let seriesId = currentItem?.seriesId;
54
+ let type = currentItem?.type;
55
+ const nextSeries = getNextNonEmptySeries(processedSeries, compatibleSeriesTypes, type, seriesId);
56
+ if (nextSeries === null) {
57
+ return null; // No series to move the focus to.
58
+ }
59
+ type = nextSeries.type;
60
+ seriesId = nextSeries.seriesId;
61
+ const dataIndex = currentItem?.dataIndex == null ? 0 : currentItem.dataIndex;
62
+ return {
63
+ type,
64
+ seriesId,
65
+ dataIndex
66
+ };
67
+ };
68
+ }
69
+ export function createGetPreviousSeriesFocusedItem(compatibleSeriesTypes) {
70
+ return function getPreviousSeriesFocusedItem(currentItem, state) {
71
+ const processedSeries = selectorChartSeriesProcessed(state);
72
+ let seriesId = currentItem?.seriesId;
73
+ let type = currentItem?.type;
74
+ const previousSeries = getPreviousNonEmptySeries(processedSeries, compatibleSeriesTypes, type, seriesId);
75
+ if (previousSeries === null) {
76
+ return null; // No series to move the focus to.
77
+ }
78
+ type = previousSeries.type;
79
+ seriesId = previousSeries.seriesId;
80
+ const data = processedSeries[type].series[seriesId].data;
81
+ const dataIndex = currentItem?.dataIndex == null ? data.length - 1 : currentItem.dataIndex;
82
+ return {
83
+ type,
84
+ seriesId,
85
+ dataIndex
86
+ };
87
+ };
88
+ }
@@ -1,5 +1,4 @@
1
- import type { ScaleName, ChartsXAxisProps, ChartsYAxisProps } from "../models/index.js";
2
- import type { ComputedAxis } from "../models/axis.js";
1
+ import type { ChartsXAxisProps, ChartsYAxisProps, ComputedAxis, ScaleName } from "../models/axis.js";
3
2
  import type { ChartSeriesDefaultized } from "../models/seriesType/config.js";
4
3
  export declare function getBarDimensions(params: {
5
4
  verticalLayout: boolean;
@@ -0,0 +1,9 @@
1
+ import type { SeriesId } from "../models/index.js";
2
+ export declare const typeSerializer: (type: string) => string;
3
+ export declare const seriesIdSerializer: (id: SeriesId) => string;
4
+ export declare const dataIndexSerializer: (dataIndex?: number) => string;
5
+ export declare const identifierSerializerSeriesIdDataIndex: (identifier: {
6
+ type: string;
7
+ seriesId: SeriesId;
8
+ dataIndex?: number;
9
+ }) => string;
@@ -0,0 +1,6 @@
1
+ export const typeSerializer = type => `Type(${type})`;
2
+ export const seriesIdSerializer = id => `Series(${id})`;
3
+ export const dataIndexSerializer = dataIndex => dataIndex === undefined ? '' : `Index(${dataIndex})`;
4
+ export const identifierSerializerSeriesIdDataIndex = identifier => {
5
+ return `${typeSerializer(identifier.type)}${seriesIdSerializer(identifier.seriesId)}${dataIndexSerializer(identifier.dataIndex)}`;
6
+ };
@@ -12,13 +12,14 @@ export { scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
12
12
  export { useLineChartProps } from "../LineChart/useLineChartProps.js";
13
13
  export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
14
14
  export { useLinePlotData } from "../LineChart/useLinePlotData.js";
15
- export { useBarChartProps } from "../BarChart/useBarChartProps.js";
15
+ export * from "../BarChart/useBarChartProps.js";
16
16
  export { useBarPlotData } from "../BarChart/useBarPlotData.js";
17
17
  export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
18
18
  export * from "../ChartContainer/useChartContainerProps.js";
19
19
  export * from "../ChartDataProvider/useChartDataProviderProps.js";
20
20
  export * from "./seriesSelectorOfType.js";
21
21
  export { useSkipAnimation } from "../hooks/useSkipAnimation.js";
22
+ export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
22
23
  export * from "./plugins/corePlugins/useChartId/index.js";
23
24
  export * from "./plugins/corePlugins/useChartSeries/index.js";
24
25
  export * from "./plugins/corePlugins/useChartDimensions/index.js";
@@ -29,6 +30,7 @@ export * from "./plugins/featurePlugins/useChartPolarAxis/index.js";
29
30
  export * from "./plugins/featurePlugins/useChartTooltip/index.js";
30
31
  export * from "./plugins/featurePlugins/useChartInteraction/index.js";
31
32
  export * from "./plugins/featurePlugins/useChartHighlight/index.js";
33
+ export * from "./plugins/featurePlugins/useChartVisibilityManager/index.js";
32
34
  export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
33
35
  export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
34
36
  export * from "./plugins/featurePlugins/useChartBrush/index.js";
@@ -47,7 +49,7 @@ export * from "./getLabel.js";
47
49
  export * from "./getSVGPoint.js";
48
50
  export * from "./isDefined.js";
49
51
  export * from "./getScale.js";
50
- export * from "./stackSeries.js";
52
+ export * from "./stacking/index.js";
51
53
  export * from "./getCurve.js";
52
54
  export * from "./consumeSlots.js";
53
55
  export * from "./consumeThemeProps.js";
@@ -58,6 +60,7 @@ export * from "./dateHelpers.js";
58
60
  export * from "./invertScale.js";
59
61
  export * from "./scaleGuards.js";
60
62
  export * from "./findMinMax.js";
63
+ export { getSeriesColorFn } from "./getSeriesColorFn.js";
61
64
  export { checkBarChartScaleErrors } from "../BarChart/checkBarChartScaleErrors.js";
62
65
  export { getBandSize } from "./getBandSize.js";
63
66
  export { getAxisExtrema } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js";
@@ -71,4 +74,5 @@ export * from "./plugins/models/index.js";
71
74
  export * from "./material/index.js";
72
75
  export * from "./createSvgIcon.js";
73
76
  export * from "./constants.js";
74
- export * from "./scales/index.js";
77
+ export * from "./scales/index.js";
78
+ export * from "./identifierSerializer.js";
@@ -15,13 +15,14 @@ export { scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
15
15
  export { useLineChartProps } from "../LineChart/useLineChartProps.js";
16
16
  export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
17
17
  export { useLinePlotData } from "../LineChart/useLinePlotData.js";
18
- export { useBarChartProps } from "../BarChart/useBarChartProps.js";
18
+ export * from "../BarChart/useBarChartProps.js";
19
19
  export { useBarPlotData } from "../BarChart/useBarPlotData.js";
20
20
  export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
21
21
  export * from "../ChartContainer/useChartContainerProps.js";
22
22
  export * from "../ChartDataProvider/useChartDataProviderProps.js";
23
23
  export * from "./seriesSelectorOfType.js";
24
24
  export { useSkipAnimation } from "../hooks/useSkipAnimation.js";
25
+ export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
25
26
 
26
27
  // plugins
27
28
  export * from "./plugins/corePlugins/useChartId/index.js";
@@ -34,6 +35,7 @@ export * from "./plugins/featurePlugins/useChartPolarAxis/index.js";
34
35
  export * from "./plugins/featurePlugins/useChartTooltip/index.js";
35
36
  export * from "./plugins/featurePlugins/useChartInteraction/index.js";
36
37
  export * from "./plugins/featurePlugins/useChartHighlight/index.js";
38
+ export * from "./plugins/featurePlugins/useChartVisibilityManager/index.js";
37
39
  export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
38
40
  export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
39
41
  export * from "./plugins/featurePlugins/useChartBrush/index.js";
@@ -57,7 +59,7 @@ export * from "./getLabel.js";
57
59
  export * from "./getSVGPoint.js";
58
60
  export * from "./isDefined.js";
59
61
  export * from "./getScale.js";
60
- export * from "./stackSeries.js";
62
+ export * from "./stacking/index.js";
61
63
  export * from "./getCurve.js";
62
64
  export * from "./consumeSlots.js";
63
65
  export * from "./consumeThemeProps.js";
@@ -68,6 +70,7 @@ export * from "./dateHelpers.js";
68
70
  export * from "./invertScale.js";
69
71
  export * from "./scaleGuards.js";
70
72
  export * from "./findMinMax.js";
73
+ export { getSeriesColorFn } from "./getSeriesColorFn.js";
71
74
  export { checkBarChartScaleErrors } from "../BarChart/checkBarChartScaleErrors.js";
72
75
  export { getBandSize } from "./getBandSize.js";
73
76
 
@@ -85,4 +88,5 @@ export * from "./plugins/models/index.js";
85
88
  export * from "./material/index.js";
86
89
  export * from "./createSvgIcon.js";
87
90
  export * from "./constants.js";
88
- export * from "./scales/index.js";
91
+ export * from "./scales/index.js";
92
+ export * from "./identifierSerializer.js";
@@ -1,2 +1,6 @@
1
- import { type D3Scale } from "../models/axis.js";
2
- export declare function invertScale<T>(scale: D3Scale, data: readonly T[], value: number): number | Date | T;
1
+ import { type D3OrdinalScale, type D3Scale } from "../models/axis.js";
2
+ export declare function invertScale<T>(scale: D3Scale, data: readonly T[], value: number): number | Date | T;
3
+ /**
4
+ * Get the data index for a given value on an ordinal scale.
5
+ */
6
+ export declare function getDataIndexForOrdinalScaleValue(scale: D3OrdinalScale, value: number): number;