@mui/x-charts 8.23.0 → 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 (262) 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/BarLabel/BarLabel.d.ts +2 -0
  5. package/BarChart/BarLabel/BarLabel.js +8 -3
  6. package/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
  7. package/BarChart/BarLabel/BarLabelItem.js +4 -2
  8. package/BarChart/BarPlot.d.ts +12 -2
  9. package/BarChart/BarPlot.js +29 -86
  10. package/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
  11. package/BarChart/BatchBarPlot/BarGroup.js +142 -0
  12. package/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
  13. package/BarChart/BatchBarPlot/BatchBarPlot.js +140 -0
  14. package/BarChart/BatchBarPlot/index.d.ts +1 -0
  15. package/BarChart/BatchBarPlot/index.js +12 -0
  16. package/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
  17. package/BarChart/BatchBarPlot/useCreateBarPaths.js +53 -0
  18. package/BarChart/FocusedBar.js +5 -1
  19. package/BarChart/IndividualBarPlot.d.ts +21 -0
  20. package/BarChart/IndividualBarPlot.js +106 -0
  21. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
  22. package/BarChart/seriesConfig/bar/legend.js +1 -0
  23. package/BarChart/seriesConfig/index.js +3 -1
  24. package/BarChart/types.d.ts +2 -0
  25. package/BarChart/useBarChartProps.d.ts +6 -2
  26. package/BarChart/useBarChartProps.js +4 -2
  27. package/BarChart/useBarPlotData.d.ts +1 -1
  28. package/BarChart/useBarPlotData.js +23 -4
  29. package/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
  30. package/BarChart/useRegisterItemClickHandlers.js +72 -0
  31. package/CHANGELOG.md +111 -1
  32. package/ChartContainer/ChartContainer.js +34 -0
  33. package/ChartContainer/useChartContainerProps.js +6 -2
  34. package/ChartsLegend/ChartsLegend.js +2 -2
  35. package/ChartsLegend/legendContext.types.d.ts +12 -0
  36. package/ChartsLegend/onClickContextBuilder.js +2 -1
  37. package/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
  38. package/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
  39. package/ChartsReferenceLine/common.d.ts +1 -1
  40. package/ChartsReferenceLine/common.js +4 -1
  41. package/ChartsTooltip/ChartsTooltipContainer.js +25 -21
  42. package/Gauge/GaugeContainer.js +4 -1
  43. package/LineChart/AnimatedLine.js +7 -3
  44. package/LineChart/AppearingMask.js +4 -1
  45. package/LineChart/CircleMarkElement.d.ts +5 -0
  46. package/LineChart/CircleMarkElement.js +13 -5
  47. package/LineChart/FocusedLineMark.js +5 -1
  48. package/LineChart/LineChart.js +30 -0
  49. package/LineChart/LineChart.plugins.d.ts +2 -1
  50. package/LineChart/LineChart.plugins.js +2 -1
  51. package/LineChart/LineElement.d.ts +4 -0
  52. package/LineChart/LineElement.js +7 -3
  53. package/LineChart/MarkElement.d.ts +5 -0
  54. package/LineChart/MarkElement.js +17 -10
  55. package/LineChart/markElementClasses.d.ts +0 -1
  56. package/LineChart/seriesConfig/index.js +3 -1
  57. package/LineChart/seriesConfig/legend.js +1 -0
  58. package/PieChart/FocusedPieArc.js +5 -2
  59. package/PieChart/PieArcLabel.d.ts +2 -0
  60. package/PieChart/PieArcLabel.js +5 -2
  61. package/PieChart/PieChart.js +35 -5
  62. package/PieChart/PieChart.plugins.d.ts +2 -1
  63. package/PieChart/PieChart.plugins.js +2 -1
  64. package/PieChart/seriesConfig/index.js +3 -1
  65. package/PieChart/seriesConfig/legend.js +6 -3
  66. package/RadarChart/RadarChart.js +30 -0
  67. package/RadarChart/RadarChart.plugins.d.ts +3 -2
  68. package/RadarChart/RadarChart.plugins.js +2 -1
  69. package/RadarChart/seriesConfig/index.js +3 -1
  70. package/RadarChart/seriesConfig/legend.js +1 -0
  71. package/ScatterChart/BatchScatter.js +8 -14
  72. package/ScatterChart/ScatterChart.js +30 -0
  73. package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  74. package/ScatterChart/ScatterChart.plugins.js +2 -1
  75. package/ScatterChart/seriesConfig/index.js +3 -1
  76. package/ScatterChart/seriesConfig/legend.js +1 -0
  77. package/SparkLineChart/SparkLineChart.js +46 -0
  78. package/esm/BarChart/BarChart.js +39 -0
  79. package/esm/BarChart/BarChart.plugins.d.ts +2 -1
  80. package/esm/BarChart/BarChart.plugins.js +2 -1
  81. package/esm/BarChart/BarLabel/BarLabel.d.ts +2 -0
  82. package/esm/BarChart/BarLabel/BarLabel.js +8 -3
  83. package/esm/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
  84. package/esm/BarChart/BarLabel/BarLabelItem.js +4 -2
  85. package/esm/BarChart/BarPlot.d.ts +12 -2
  86. package/esm/BarChart/BarPlot.js +29 -86
  87. package/esm/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
  88. package/esm/BarChart/BatchBarPlot/BarGroup.js +134 -0
  89. package/esm/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
  90. package/esm/BarChart/BatchBarPlot/BatchBarPlot.js +133 -0
  91. package/esm/BarChart/BatchBarPlot/index.d.ts +1 -0
  92. package/esm/BarChart/BatchBarPlot/index.js +1 -0
  93. package/esm/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
  94. package/esm/BarChart/BatchBarPlot/useCreateBarPaths.js +46 -0
  95. package/esm/BarChart/FocusedBar.js +5 -1
  96. package/esm/BarChart/IndividualBarPlot.d.ts +21 -0
  97. package/esm/BarChart/IndividualBarPlot.js +98 -0
  98. package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
  99. package/esm/BarChart/seriesConfig/bar/legend.js +1 -0
  100. package/esm/BarChart/seriesConfig/index.js +3 -1
  101. package/esm/BarChart/types.d.ts +2 -0
  102. package/esm/BarChart/useBarChartProps.d.ts +6 -2
  103. package/esm/BarChart/useBarChartProps.js +4 -3
  104. package/esm/BarChart/useBarPlotData.d.ts +1 -1
  105. package/esm/BarChart/useBarPlotData.js +20 -1
  106. package/esm/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
  107. package/esm/BarChart/useRegisterItemClickHandlers.js +67 -0
  108. package/esm/ChartContainer/ChartContainer.js +34 -0
  109. package/esm/ChartContainer/useChartContainerProps.js +6 -2
  110. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  111. package/esm/ChartsLegend/legendContext.types.d.ts +12 -0
  112. package/esm/ChartsLegend/onClickContextBuilder.js +2 -1
  113. package/esm/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
  114. package/esm/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
  115. package/esm/ChartsReferenceLine/common.d.ts +1 -1
  116. package/esm/ChartsReferenceLine/common.js +4 -1
  117. package/esm/ChartsTooltip/ChartsTooltipContainer.js +26 -22
  118. package/esm/Gauge/GaugeContainer.js +4 -1
  119. package/esm/LineChart/AnimatedLine.js +7 -3
  120. package/esm/LineChart/AppearingMask.js +4 -1
  121. package/esm/LineChart/CircleMarkElement.d.ts +5 -0
  122. package/esm/LineChart/CircleMarkElement.js +13 -5
  123. package/esm/LineChart/FocusedLineMark.js +5 -1
  124. package/esm/LineChart/LineChart.js +30 -0
  125. package/esm/LineChart/LineChart.plugins.d.ts +2 -1
  126. package/esm/LineChart/LineChart.plugins.js +2 -1
  127. package/esm/LineChart/LineElement.d.ts +4 -0
  128. package/esm/LineChart/LineElement.js +7 -3
  129. package/esm/LineChart/MarkElement.d.ts +5 -0
  130. package/esm/LineChart/MarkElement.js +17 -10
  131. package/esm/LineChart/markElementClasses.d.ts +0 -1
  132. package/esm/LineChart/seriesConfig/index.js +3 -1
  133. package/esm/LineChart/seriesConfig/legend.js +1 -0
  134. package/esm/PieChart/FocusedPieArc.js +4 -1
  135. package/esm/PieChart/PieArcLabel.d.ts +2 -0
  136. package/esm/PieChart/PieArcLabel.js +5 -2
  137. package/esm/PieChart/PieChart.js +35 -5
  138. package/esm/PieChart/PieChart.plugins.d.ts +2 -1
  139. package/esm/PieChart/PieChart.plugins.js +2 -1
  140. package/esm/PieChart/seriesConfig/index.js +3 -1
  141. package/esm/PieChart/seriesConfig/legend.js +6 -3
  142. package/esm/RadarChart/RadarChart.js +30 -0
  143. package/esm/RadarChart/RadarChart.plugins.d.ts +3 -2
  144. package/esm/RadarChart/RadarChart.plugins.js +2 -1
  145. package/esm/RadarChart/seriesConfig/index.js +3 -1
  146. package/esm/RadarChart/seriesConfig/legend.js +1 -0
  147. package/esm/ScatterChart/BatchScatter.js +5 -11
  148. package/esm/ScatterChart/ScatterChart.js +30 -0
  149. package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  150. package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
  151. package/esm/ScatterChart/seriesConfig/index.js +3 -1
  152. package/esm/ScatterChart/seriesConfig/legend.js +1 -0
  153. package/esm/SparkLineChart/SparkLineChart.js +46 -0
  154. package/esm/index.js +1 -1
  155. package/esm/internals/appendAtKey.d.ts +8 -0
  156. package/esm/internals/appendAtKey.js +17 -0
  157. package/esm/internals/commonNextFocusItem.js +12 -8
  158. package/esm/internals/getBarDimensions.d.ts +1 -2
  159. package/esm/internals/identifierSerializer.d.ts +9 -0
  160. package/esm/internals/identifierSerializer.js +6 -0
  161. package/esm/internals/index.d.ts +6 -2
  162. package/esm/internals/index.js +6 -2
  163. package/esm/internals/invertScale.d.ts +6 -2
  164. package/esm/internals/invertScale.js +9 -1
  165. package/esm/internals/plugins/allPlugins.d.ts +4 -3
  166. package/esm/internals/plugins/allPlugins.js +2 -1
  167. package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
  168. package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +18 -0
  169. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
  170. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
  171. package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
  172. package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +74 -0
  173. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
  174. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
  175. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
  176. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +83 -0
  177. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
  178. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +6 -0
  179. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +7 -34
  180. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
  181. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +9 -0
  182. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +10 -32
  183. package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
  184. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
  185. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +3 -0
  186. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
  187. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +5 -0
  188. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
  189. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +78 -0
  190. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
  191. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +19 -0
  192. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
  193. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +1 -0
  194. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
  195. package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +11 -0
  196. package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
  197. package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.js +1 -0
  198. package/esm/internals/plugins/models/seriesConfig/index.d.ts +2 -1
  199. package/esm/internals/plugins/models/seriesConfig/index.js +2 -1
  200. package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +7 -0
  201. package/esm/models/axis.d.ts +5 -4
  202. package/esm/models/featureFlags.d.ts +1 -0
  203. package/esm/models/featureFlags.js +1 -0
  204. package/esm/models/index.d.ts +1 -0
  205. package/esm/models/index.js +1 -0
  206. package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
  207. package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.js +1 -0
  208. package/index.js +1 -1
  209. package/internals/appendAtKey.d.ts +8 -0
  210. package/internals/appendAtKey.js +23 -0
  211. package/internals/commonNextFocusItem.js +12 -8
  212. package/internals/getBarDimensions.d.ts +1 -2
  213. package/internals/identifierSerializer.d.ts +9 -0
  214. package/internals/identifierSerializer.js +16 -0
  215. package/internals/index.d.ts +6 -2
  216. package/internals/index.js +51 -7
  217. package/internals/invertScale.d.ts +6 -2
  218. package/internals/invertScale.js +10 -1
  219. package/internals/plugins/allPlugins.d.ts +4 -3
  220. package/internals/plugins/allPlugins.js +2 -1
  221. package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
  222. package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +25 -0
  223. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
  224. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
  225. package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
  226. package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +81 -0
  227. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
  228. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
  229. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
  230. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +89 -0
  231. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
  232. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +12 -0
  233. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +6 -34
  234. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
  235. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +15 -0
  236. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +9 -32
  237. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
  238. package/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
  239. package/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +39 -0
  240. package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
  241. package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +12 -0
  242. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
  243. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +85 -0
  244. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
  245. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +25 -0
  246. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
  247. package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +5 -0
  248. package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
  249. package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +18 -0
  250. package/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
  251. package/internals/plugins/models/seriesConfig/identifierSerializer.types.js +5 -0
  252. package/internals/plugins/models/seriesConfig/index.d.ts +2 -1
  253. package/internals/plugins/models/seriesConfig/index.js +11 -0
  254. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +7 -0
  255. package/models/axis.d.ts +5 -4
  256. package/models/featureFlags.d.ts +1 -0
  257. package/models/featureFlags.js +5 -0
  258. package/models/index.d.ts +1 -0
  259. package/models/index.js +11 -0
  260. package/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
  261. package/moduleAugmentation/barChartBatchRendererOnItemClick.js +5 -0
  262. package/package.json +13 -3
@@ -0,0 +1 @@
1
+ export { BatchBarPlot } from "./BatchBarPlot.js";
@@ -0,0 +1 @@
1
+ export { BatchBarPlot } from "./BatchBarPlot.js";
@@ -0,0 +1,8 @@
1
+ import type { ProcessedBarData, ProcessedBarSeriesData } from "../types.js";
2
+ export declare function createPath(barData: ProcessedBarData, borderRadius: number): string;
3
+ /**
4
+ * Hook that creates bar paths for a given series data. Used by the batch bar renderer.
5
+ * @param seriesData
6
+ * @param borderRadius
7
+ */
8
+ export declare function useCreateBarPaths(seriesData: ProcessedBarSeriesData, borderRadius: number): Map<string, string[]>;
@@ -0,0 +1,46 @@
1
+ import { appendAtKey } from "../../internals/appendAtKey.js";
2
+ const MAX_POINTS_PER_PATH = 1000;
3
+ function generateBarPath(x, y, width, height, topLeftBorderRadius, topRightBorderRadius, bottomRightBorderRadius, bottomLeftBorderRadius) {
4
+ const tLBR = Math.min(topLeftBorderRadius, width / 2, height / 2);
5
+ const tRBR = Math.min(topRightBorderRadius, width / 2, height / 2);
6
+ const bRBR = Math.min(bottomRightBorderRadius, width / 2, height / 2);
7
+ const bLBR = Math.min(bottomLeftBorderRadius, width / 2, height / 2);
8
+ return `M${x + tLBR},${y}
9
+ h${width - tLBR - tRBR}
10
+ a${tRBR},${tRBR} 0 0 1 ${tRBR},${tRBR}
11
+ v${height - tRBR - bRBR}
12
+ a${bRBR},${bRBR} 0 0 1 -${bRBR},${bRBR}
13
+ h-${width - bRBR - bLBR}
14
+ a${bLBR},${bLBR} 0 0 1 -${bLBR},-${bLBR}
15
+ v-${height - bLBR - tLBR}
16
+ a${tLBR},${tLBR} 0 0 1 ${tLBR},-${tLBR}
17
+ Z`;
18
+ }
19
+ export function createPath(barData, borderRadius) {
20
+ return generateBarPath(barData.x, barData.y, barData.width, barData.height, barData.borderRadiusSide === 'left' || barData.borderRadiusSide === 'top' ? borderRadius : 0, barData.borderRadiusSide === 'right' || barData.borderRadiusSide === 'top' ? borderRadius : 0, barData.borderRadiusSide === 'right' || barData.borderRadiusSide === 'bottom' ? borderRadius : 0, barData.borderRadiusSide === 'left' || barData.borderRadiusSide === 'bottom' ? borderRadius : 0);
21
+ }
22
+
23
+ /**
24
+ * Hook that creates bar paths for a given series data. Used by the batch bar renderer.
25
+ * @param seriesData
26
+ * @param borderRadius
27
+ */
28
+ export function useCreateBarPaths(seriesData, borderRadius) {
29
+ const paths = new Map();
30
+ const temporaryPaths = new Map();
31
+ for (let j = 0; j < seriesData.data.length; j += 1) {
32
+ const barData = seriesData.data[j];
33
+ const pathString = createPath(barData, borderRadius);
34
+ const tempPath = appendAtKey(temporaryPaths, barData.color, pathString);
35
+ if (tempPath.length >= MAX_POINTS_PER_PATH) {
36
+ appendAtKey(paths, barData.color, tempPath.join(''));
37
+ temporaryPaths.delete(barData.color);
38
+ }
39
+ }
40
+ for (const [fill, tempPath] of temporaryPaths.entries()) {
41
+ if (tempPath.length > 0) {
42
+ appendAtKey(paths, fill, tempPath.join(''));
43
+ }
44
+ }
45
+ return paths;
46
+ }
@@ -22,7 +22,11 @@ export function FocusedBar(props) {
22
22
  if (focusedItem === null || focusedItem.type !== 'bar' || !barSeries) {
23
23
  return null;
24
24
  }
25
- const series = barSeries?.series[focusedItem.seriesId];
25
+ const series = barSeries.series[focusedItem.seriesId];
26
+ if (series.data[focusedItem.dataIndex] == null) {
27
+ // Handle missing data
28
+ return null;
29
+ }
26
30
  const xAxisId = series.xAxisId ?? xAxisIds[0];
27
31
  const yAxisId = series.yAxisId ?? yAxisIds[0];
28
32
  const xAxisConfig = xAxis[xAxisId];
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { type BarPlotSlotProps, type BarPlotSlots } from "./BarPlot.js";
3
+ import { type BarItemIdentifier } from "../models/index.js";
4
+ import { type MaskData, type ProcessedBarSeriesData } from "./types.js";
5
+ export interface IndividualBarPlotProps {
6
+ completedData: ProcessedBarSeriesData[];
7
+ masksData: MaskData[];
8
+ borderRadius?: number;
9
+ skipAnimation?: boolean;
10
+ onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, barItemIdentifier: BarItemIdentifier) => void;
11
+ slotProps?: BarPlotSlotProps;
12
+ slots?: BarPlotSlots;
13
+ }
14
+ export declare function IndividualBarPlot({
15
+ completedData,
16
+ masksData,
17
+ borderRadius,
18
+ onItemClick,
19
+ skipAnimation,
20
+ ...other
21
+ }: IndividualBarPlotProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,98 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["completedData", "masksData", "borderRadius", "onItemClick", "skipAnimation"];
4
+ import * as React from 'react';
5
+ import { BarElement } from "./BarElement.js";
6
+ import { useUtilityClasses } from "./barClasses.js";
7
+ import { BarClipPath } from "./BarClipPath.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export function IndividualBarPlot(_ref) {
10
+ let {
11
+ completedData,
12
+ masksData,
13
+ borderRadius,
14
+ onItemClick,
15
+ skipAnimation
16
+ } = _ref,
17
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
18
+ const classes = useUtilityClasses();
19
+ const withoutBorderRadius = !borderRadius || borderRadius <= 0;
20
+ return /*#__PURE__*/_jsxs(React.Fragment, {
21
+ children: [!withoutBorderRadius && masksData.map(({
22
+ id,
23
+ x,
24
+ y,
25
+ xOrigin,
26
+ yOrigin,
27
+ width,
28
+ height,
29
+ hasPositive,
30
+ hasNegative,
31
+ layout
32
+ }) => {
33
+ return /*#__PURE__*/_jsx(BarClipPath, {
34
+ maskId: id,
35
+ borderRadius: borderRadius,
36
+ hasNegative: hasNegative,
37
+ hasPositive: hasPositive,
38
+ layout: layout,
39
+ x: x,
40
+ y: y,
41
+ xOrigin: xOrigin,
42
+ yOrigin: yOrigin,
43
+ width: width,
44
+ height: height,
45
+ skipAnimation: skipAnimation ?? false
46
+ }, id);
47
+ }), completedData.map(({
48
+ seriesId,
49
+ layout,
50
+ xOrigin,
51
+ yOrigin,
52
+ data
53
+ }) => {
54
+ return /*#__PURE__*/_jsx("g", {
55
+ "data-series": seriesId,
56
+ className: classes.series,
57
+ children: data.map(({
58
+ dataIndex,
59
+ color,
60
+ maskId,
61
+ x,
62
+ y,
63
+ width,
64
+ height
65
+ }) => {
66
+ const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
67
+ id: seriesId,
68
+ dataIndex: dataIndex,
69
+ color: color,
70
+ skipAnimation: skipAnimation ?? false,
71
+ layout: layout ?? 'vertical',
72
+ x: x,
73
+ xOrigin: xOrigin,
74
+ y: y,
75
+ yOrigin: yOrigin,
76
+ width: width,
77
+ height: height
78
+ }, other, {
79
+ onClick: onItemClick && (event => {
80
+ onItemClick(event, {
81
+ type: 'bar',
82
+ seriesId,
83
+ dataIndex
84
+ });
85
+ })
86
+ }), dataIndex);
87
+ if (withoutBorderRadius) {
88
+ return barElement;
89
+ }
90
+ return /*#__PURE__*/_jsx("g", {
91
+ clipPath: `url(#${maskId})`,
92
+ children: barElement
93
+ }, dataIndex);
94
+ })
95
+ }, seriesId);
96
+ })]
97
+ });
98
+ }
@@ -9,7 +9,7 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ba
9
9
  layout?: "horizontal" | "vertical";
10
10
  stackOffset?: import("../../../index.js").StackOffsetType;
11
11
  minBarSize?: number;
12
- barLabel?: "value" | ((item: import("../../index.js").BarItem, context: import("../../index.js").BarLabelContext) => string | null | undefined);
12
+ barLabel?: "value" | ((item: import("@mui/x-charts/BarChart").BarItem, context: import("@mui/x-charts/BarChart").BarLabelContext) => string | null | undefined);
13
13
  barLabelPlacement?: "center" | "outside";
14
14
  valueFormatter?: import("../../../internals/index.js").SeriesValueFormatter<number | null> | undefined;
15
15
  highlightScope?: import("../../../index.js").HighlightScope;
@@ -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,
@@ -6,6 +6,7 @@ import keyboardFocusHandler from "./bar/keyboardFocusHandler.js";
6
6
  import tooltipGetter, { axisTooltipGetter } from "./bar/tooltip.js";
7
7
  import tooltipItemPositionGetter from "./bar/tooltipPosition.js";
8
8
  import { getSeriesWithDefaultValues } from "./bar/getSeriesWithDefaultValues.js";
9
+ import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
9
10
  export const barSeriesConfig = {
10
11
  seriesProcessor,
11
12
  colorProcessor: getColor,
@@ -16,5 +17,6 @@ export const barSeriesConfig = {
16
17
  xExtremumGetter: getExtremumX,
17
18
  yExtremumGetter: getExtremumY,
18
19
  getSeriesWithDefaultValues,
19
- keyboardFocusHandler
20
+ keyboardFocusHandler,
21
+ identifierSerializer: identifierSerializerSeriesIdDataIndex
20
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}`]: {