@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,90 @@
1
+ import { type ChartPluginSignature } from "../../models/index.js";
2
+ import { type UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
3
+ import { type SeriesItemIdentifier } from "../../../../models/index.js";
4
+ import { type ChartSeriesType } from "../../../../models/seriesType/config.js";
5
+ export type VisibilityIdentifier<T extends ChartSeriesType = ChartSeriesType> = Partial<SeriesItemIdentifier<T>> & (SeriesItemIdentifier<T> extends {
6
+ subType?: infer U;
7
+ } ? {
8
+ type: T;
9
+ subType: U;
10
+ } : {
11
+ type: T;
12
+ });
13
+ export type VisibilityMap = Map<string, VisibilityIdentifier>;
14
+ export type IsItemVisibleFunction = {
15
+ /**
16
+ * Function to check if an item is visible based on its identifier.
17
+ *
18
+ * @param {VisibilityIdentifier} identifier The identifier of the item to check.
19
+ * @returns {boolean} Whether the item is visible.
20
+ */
21
+ (identifier: VisibilityIdentifier): boolean;
22
+ };
23
+ export interface UseChartVisibilityManagerInstance<T extends ChartSeriesType> {
24
+ /**
25
+ * Hide an item by its identifier.
26
+ *
27
+ * @param {VisibilityIdentifier} identifier The identifier of the item to hide.
28
+ */
29
+ hideItem(identifier: VisibilityIdentifier<T>): void;
30
+ /**
31
+ * Show an item by its identifier.
32
+ *
33
+ * @param {VisibilityIdentifier} identifier The identifier of the item to show.
34
+ */
35
+ showItem(identifier: VisibilityIdentifier<T>): void;
36
+ /**
37
+ * Toggle the visibility of an item by its identifier.
38
+ *
39
+ * @param {VisibilityIdentifier} identifier The identifier of the item to toggle.
40
+ */
41
+ toggleItemVisibility(identifier: VisibilityIdentifier<T>): void;
42
+ }
43
+ export interface UseChartVisibilityManagerParameters<T extends ChartSeriesType> {
44
+ /**
45
+ * Callback fired when any hidden identifiers change.
46
+ * @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
47
+ */
48
+ onHiddenItemsChange?: (hiddenItems: VisibilityIdentifier<T>[]) => void;
49
+ /**
50
+ * List of hidden series and/or items.
51
+ *
52
+ * Different chart types use different keys.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * [
57
+ * {
58
+ * type: 'pie',
59
+ * seriesId: 'series-1',
60
+ * dataIndex: 3,
61
+ * },
62
+ * {
63
+ * type: 'line',
64
+ * seriesId: 'series-2',
65
+ * }
66
+ * ]
67
+ * ```
68
+ */
69
+ hiddenItems?: VisibilityIdentifier<T>[];
70
+ }
71
+ export type UseChartVisibilityManagerDefaultizedParameters<T extends ChartSeriesType> = UseChartVisibilityManagerParameters<T>;
72
+ export interface UseChartVisibilityManagerState {
73
+ visibilityManager: {
74
+ /**
75
+ * Map of hidden identifiers by their serialized form.
76
+ */
77
+ visibilityMap: VisibilityMap;
78
+ /**
79
+ * Internal information to know if the user controls the state or not.
80
+ */
81
+ isControlled: boolean;
82
+ };
83
+ }
84
+ export type UseChartVisibilityManagerSignature<T extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
85
+ instance: UseChartVisibilityManagerInstance<T>;
86
+ state: UseChartVisibilityManagerState;
87
+ params: UseChartVisibilityManagerParameters<T>;
88
+ defaultizedParams: UseChartVisibilityManagerDefaultizedParameters<T>;
89
+ dependencies: [UseChartSeriesSignature];
90
+ }>;
@@ -0,0 +1,4 @@
1
+ import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
2
+ import type { ChartSeriesConfig } from "../../models/index.js";
3
+ import type { VisibilityIdentifier, VisibilityMap } from "./useChartVisibilityManager.types.js";
4
+ export declare const visibilityParamToMap: (hiddenItems: VisibilityIdentifier[] | undefined, seriesConfig: ChartSeriesConfig<ChartSeriesType>) => VisibilityMap;
@@ -0,0 +1,11 @@
1
+ import { serializeIdentifier } from "../../corePlugins/useChartSeries/serializeIdentifier.js";
2
+ export const visibilityParamToMap = (hiddenItems, seriesConfig) => {
3
+ const visibilityMap = new Map();
4
+ if (hiddenItems) {
5
+ hiddenItems.forEach(identifier => {
6
+ const uniqueId = serializeIdentifier(seriesConfig, identifier);
7
+ visibilityMap.set(uniqueId, identifier);
8
+ });
9
+ }
10
+ return visibilityMap;
11
+ };
@@ -0,0 +1,2 @@
1
+ import type { ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
2
+ export type IdentifierSerializer<TSeriesType extends ChartSeriesType> = (identifier: ChartsSeriesConfig[TSeriesType]['itemIdentifier']) => string;
@@ -7,4 +7,5 @@ export * from "./seriesLayout.types.js";
7
7
  export * from "./tooltipGetter.types.js";
8
8
  export * from "./tooltipItemPositionGetter.types.js";
9
9
  export * from "./legendGetter.types.js";
10
- export * from "./getSeriesWithDefaultValues.types.js";
10
+ export * from "./getSeriesWithDefaultValues.types.js";
11
+ export * from "./identifierSerializer.types.js";
@@ -7,4 +7,5 @@ export * from "./seriesLayout.types.js";
7
7
  export * from "./tooltipGetter.types.js";
8
8
  export * from "./tooltipItemPositionGetter.types.js";
9
9
  export * from "./legendGetter.types.js";
10
- export * from "./getSeriesWithDefaultValues.types.js";
10
+ export * from "./getSeriesWithDefaultValues.types.js";
11
+ export * from "./identifierSerializer.types.js";
@@ -9,6 +9,7 @@ import { type GetSeriesWithDefaultValues } from "./getSeriesWithDefaultValues.ty
9
9
  import { type TooltipItemPositionGetter } from "./tooltipItemPositionGetter.types.js";
10
10
  import { type SeriesLayoutGetter } from "./seriesLayout.types.js";
11
11
  import { type KeyboardFocusHandler } from "../../featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js";
12
+ import { type IdentifierSerializer } from "./identifierSerializer.types.js";
12
13
  export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
13
14
  seriesProcessor: SeriesProcessor<TSeriesType>;
14
15
  /**
@@ -21,6 +22,12 @@ export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
21
22
  tooltipItemPositionGetter?: TooltipItemPositionGetter<TSeriesType>;
22
23
  getSeriesWithDefaultValues: GetSeriesWithDefaultValues<TSeriesType>;
23
24
  keyboardFocusHandler?: KeyboardFocusHandler<TSeriesType>;
25
+ /**
26
+ * A function to serialize the series item identifier into a unique string.
27
+ * @param {ChartsSeriesConfig[TSeriesType]['itemIdentifier']} identifier The series item identifier.
28
+ * @returns {string} A unique string representation of the identifier.
29
+ */
30
+ identifierSerializer: IdentifierSerializer<TSeriesType>;
24
31
  } & (TSeriesType extends CartesianChartSeriesType ? {
25
32
  xExtremumGetter: CartesianExtremumGetter<TSeriesType>;
26
33
  yExtremumGetter: CartesianExtremumGetter<TSeriesType>;
@@ -1,12 +1,13 @@
1
1
  import type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleOrdinal, ScalePoint, ScalePower, ScaleSequential, ScaleThreshold, ScaleTime, ScaleSymLog, NumberValue } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { type SxProps } from '@mui/system/styleFunctionSx';
3
- import { type MakeOptional, type MakeRequired } from '@mui/x-internals/types';
3
+ import { type HasProperty, type MakeOptional, type MakeRequired } from '@mui/x-internals/types';
4
4
  import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
5
5
  import { type ChartsAxisClasses } from "../ChartsAxis/axisClasses.js";
6
6
  import type { TickParams } from "../hooks/useTicks.js";
7
7
  import type { ChartsTextProps } from "../ChartsText/index.js";
8
8
  import type { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.js";
9
9
  import type { OrdinalTimeTicks } from "./timeTicks.js";
10
+ import { type ChartsTypeFeatureFlags } from "./featureFlags.js";
10
11
  export type AxisId = string | number;
11
12
  export type D3Scale<Domain extends {
12
13
  toString(): string;
@@ -133,7 +134,7 @@ type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends Chart
133
134
  position?: 'top' | 'bottom' | 'none';
134
135
  /**
135
136
  * The height of the axis.
136
- * @default 30
137
+ * @default 45 if an axis label is provided, 25 otherwise.
137
138
  */
138
139
  height?: number;
139
140
  } : AxisProps extends ChartsYAxisProps ? {
@@ -149,7 +150,7 @@ type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends Chart
149
150
  position?: 'left' | 'right' | 'none';
150
151
  /**
151
152
  * The width of the axis.
152
- * @default 30
153
+ * @default 65 if an axis label is provided, 45 otherwise.
153
154
  */
154
155
  width?: number;
155
156
  } : {
@@ -521,7 +522,7 @@ export interface ChartsAxisData {
521
522
  /**
522
523
  * The mapping of series ids to their value for this particular axis index.
523
524
  */
524
- seriesValues: Record<string, number | null | undefined>;
525
+ seriesValues: Record<string, HasProperty<ChartsTypeFeatureFlags, 'seriesValueOverride'> extends true ? ChartsTypeFeatureFlags['seriesValuesOverride'] : number | null | undefined>;
525
526
  }
526
527
  export type CartesianDirection = 'x' | 'y';
527
528
  export type PolarDirection = 'rotation' | 'radius';
@@ -0,0 +1 @@
1
+ export interface ChartsTypeFeatureFlags {}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from "./seriesType/index.js";
2
2
  export * from "./stacking.js";
3
3
  export * from "./slots/index.js";
4
+ export * from "./featureFlags.js";
4
5
  export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisItemIdentifier, AxisValueFormatterContext } from "./axis.js";
5
6
  export type { PropsFromSlot } from '@mui/x-internals/slots';
6
7
  export type { Position } from "./position.js";
@@ -1,6 +1,7 @@
1
1
  export * from "./seriesType/index.js";
2
2
  export * from "./stacking.js";
3
3
  export * from "./slots/index.js";
4
+ export * from "./featureFlags.js";
4
5
 
5
6
  // Utils shared across the X packages
6
7
  export {};
@@ -0,0 +1,13 @@
1
+ import type * as React from 'react';
2
+ import type { BarItemIdentifier } from "../models/index.js";
3
+ declare module '@mui/x-charts/BarChart' {
4
+ interface BarPlotProps {
5
+ /**
6
+ * Callback fired when a bar item is clicked.
7
+ * @param {MouseEvent | React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
8
+ * It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
9
+ * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
10
+ */
11
+ onItemClick?(event: MouseEvent | React.MouseEvent<SVGElement, MouseEvent>, barItemIdentifier: BarItemIdentifier): void;
12
+ }
13
+ }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.23.0
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,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.appendAtKey = appendAtKey;
7
+ /**
8
+ * Given a map of arrays, appends a value to the array at the given key.
9
+ * If no array exists at that key, one is created and the value appended.
10
+ * @param map Map of arrays
11
+ * @param key Key to append the value at
12
+ * @param value Value to append
13
+ */
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
+ }
@@ -8,6 +8,7 @@ exports.createGetNextSeriesFocusedItem = createGetNextSeriesFocusedItem;
8
8
  exports.createGetPreviousIndexFocusedItem = createGetPreviousIndexFocusedItem;
9
9
  exports.createGetPreviousSeriesFocusedItem = createGetPreviousSeriesFocusedItem;
10
10
  var _getPreviousNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries");
11
+ var _getMaxSeriesLength = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength");
11
12
  var _useChartSeries = require("./plugins/corePlugins/useChartSeries");
12
13
  var _getNextNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries");
13
14
  var _seriesHasData = require("./seriesHasData");
@@ -24,11 +25,12 @@ function createGetNextIndexFocusedItem(compatibleSeriesTypes) {
24
25
  type = nextSeries.type;
25
26
  seriesId = nextSeries.seriesId;
26
27
  }
27
- const dataLength = processedSeries[type].series[seriesId].data.length;
28
+ const maxLength = (0, _getMaxSeriesLength.getMaxSeriesLength)(processedSeries, compatibleSeriesTypes);
29
+ const dataIndex = Math.min(maxLength - 1, currentItem?.dataIndex == null ? 0 : currentItem.dataIndex + 1);
28
30
  return {
29
31
  type,
30
32
  seriesId,
31
- dataIndex: ((currentItem?.dataIndex ?? -1) + 1) % dataLength
33
+ dataIndex
32
34
  };
33
35
  };
34
36
  }
@@ -45,11 +47,12 @@ function createGetPreviousIndexFocusedItem(compatibleSeriesTypes) {
45
47
  type = previousSeries.type;
46
48
  seriesId = previousSeries.seriesId;
47
49
  }
48
- const dataLength = processedSeries[type].series[seriesId].data.length;
50
+ const maxLength = (0, _getMaxSeriesLength.getMaxSeriesLength)(processedSeries, compatibleSeriesTypes);
51
+ const dataIndex = Math.max(0, currentItem?.dataIndex == null ? maxLength - 1 : currentItem.dataIndex - 1);
49
52
  return {
50
53
  type,
51
54
  seriesId,
52
- dataIndex: (dataLength + (currentItem?.dataIndex ?? 1) - 1) % dataLength
55
+ dataIndex
53
56
  };
54
57
  };
55
58
  }
@@ -64,11 +67,11 @@ function createGetNextSeriesFocusedItem(compatibleSeriesTypes) {
64
67
  }
65
68
  type = nextSeries.type;
66
69
  seriesId = nextSeries.seriesId;
67
- const dataLength = processedSeries[type].series[seriesId].data.length;
70
+ const dataIndex = currentItem?.dataIndex == null ? 0 : currentItem.dataIndex;
68
71
  return {
69
72
  type,
70
73
  seriesId,
71
- dataIndex: Math.min(dataLength - 1, currentItem?.dataIndex ?? 0)
74
+ dataIndex
72
75
  };
73
76
  };
74
77
  }
@@ -83,11 +86,12 @@ function createGetPreviousSeriesFocusedItem(compatibleSeriesTypes) {
83
86
  }
84
87
  type = previousSeries.type;
85
88
  seriesId = previousSeries.seriesId;
86
- const dataLength = processedSeries[type].series[seriesId].data.length;
89
+ const data = processedSeries[type].series[seriesId].data;
90
+ const dataIndex = currentItem?.dataIndex == null ? data.length - 1 : currentItem.dataIndex;
87
91
  return {
88
92
  type,
89
93
  seriesId,
90
- dataIndex: Math.min(dataLength - 1, currentItem?.dataIndex ?? 0)
94
+ dataIndex
91
95
  };
92
96
  };
93
97
  }
@@ -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,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.typeSerializer = exports.seriesIdSerializer = exports.identifierSerializerSeriesIdDataIndex = exports.dataIndexSerializer = void 0;
7
+ const typeSerializer = type => `Type(${type})`;
8
+ exports.typeSerializer = typeSerializer;
9
+ const seriesIdSerializer = id => `Series(${id})`;
10
+ exports.seriesIdSerializer = seriesIdSerializer;
11
+ const dataIndexSerializer = dataIndex => dataIndex === undefined ? '' : `Index(${dataIndex})`;
12
+ exports.dataIndexSerializer = dataIndexSerializer;
13
+ const identifierSerializerSeriesIdDataIndex = identifier => {
14
+ return `${typeSerializer(identifier.type)}${seriesIdSerializer(identifier.seriesId)}${dataIndexSerializer(identifier.dataIndex)}`;
15
+ };
16
+ exports.identifierSerializerSeriesIdDataIndex = identifierSerializerSeriesIdDataIndex;
@@ -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";
@@ -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";
@@ -13,12 +13,13 @@ var _exportNames = {
13
13
  useLineChartProps: true,
14
14
  useAreaPlotData: true,
15
15
  useLinePlotData: true,
16
- useBarChartProps: true,
17
16
  useBarPlotData: true,
18
17
  useRadarChartProps: true,
19
18
  useSkipAnimation: true,
19
+ useRegisterPointerInteractions: true,
20
20
  getCartesianAxisTriggerTooltip: true,
21
21
  getCartesianAxisIndex: true,
22
+ getSeriesColorFn: true,
22
23
  checkBarChartScaleErrors: true,
23
24
  getBandSize: true,
24
25
  getAxisExtrema: true
@@ -53,22 +54,22 @@ Object.defineProperty(exports, "getCartesianAxisTriggerTooltip", {
53
54
  return _getAxisTriggerTooltip.getAxisTriggerTooltip;
54
55
  }
55
56
  });
56
- Object.defineProperty(exports, "scatterSeriesConfig", {
57
+ Object.defineProperty(exports, "getSeriesColorFn", {
57
58
  enumerable: true,
58
59
  get: function () {
59
- return _seriesConfig.scatterSeriesConfig;
60
+ return _getSeriesColorFn.getSeriesColorFn;
60
61
  }
61
62
  });
62
- Object.defineProperty(exports, "useAreaPlotData", {
63
+ Object.defineProperty(exports, "scatterSeriesConfig", {
63
64
  enumerable: true,
64
65
  get: function () {
65
- return _useAreaPlotData.useAreaPlotData;
66
+ return _seriesConfig.scatterSeriesConfig;
66
67
  }
67
68
  });
68
- Object.defineProperty(exports, "useBarChartProps", {
69
+ Object.defineProperty(exports, "useAreaPlotData", {
69
70
  enumerable: true,
70
71
  get: function () {
71
- return _useBarChartProps.useBarChartProps;
72
+ return _useAreaPlotData.useAreaPlotData;
72
73
  }
73
74
  });
74
75
  Object.defineProperty(exports, "useBarPlotData", {
@@ -107,6 +108,12 @@ Object.defineProperty(exports, "useRadarChartProps", {
107
108
  return _useRadarChartProps.useRadarChartProps;
108
109
  }
109
110
  });
111
+ Object.defineProperty(exports, "useRegisterPointerInteractions", {
112
+ enumerable: true,
113
+ get: function () {
114
+ return _useRegisterPointerInteractions.useRegisterPointerInteractions;
115
+ }
116
+ });
110
117
  Object.defineProperty(exports, "useScatterChartProps", {
111
118
  enumerable: true,
112
119
  get: function () {
@@ -201,6 +208,17 @@ var _useLineChartProps = require("../LineChart/useLineChartProps");
201
208
  var _useAreaPlotData = require("../LineChart/useAreaPlotData");
202
209
  var _useLinePlotData = require("../LineChart/useLinePlotData");
203
210
  var _useBarChartProps = require("../BarChart/useBarChartProps");
211
+ Object.keys(_useBarChartProps).forEach(function (key) {
212
+ if (key === "default" || key === "__esModule") return;
213
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
214
+ if (key in exports && exports[key] === _useBarChartProps[key]) return;
215
+ Object.defineProperty(exports, key, {
216
+ enumerable: true,
217
+ get: function () {
218
+ return _useBarChartProps[key];
219
+ }
220
+ });
221
+ });
204
222
  var _useBarPlotData = require("../BarChart/useBarPlotData");
205
223
  var _useRadarChartProps = require("../RadarChart/useRadarChartProps");
206
224
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
@@ -240,6 +258,7 @@ Object.keys(_seriesSelectorOfType).forEach(function (key) {
240
258
  });
241
259
  });
242
260
  var _useSkipAnimation = require("../hooks/useSkipAnimation");
261
+ var _useRegisterPointerInteractions = require("./plugins/featurePlugins/shared/useRegisterPointerInteractions");
243
262
  var _useChartId = require("./plugins/corePlugins/useChartId");
244
263
  Object.keys(_useChartId).forEach(function (key) {
245
264
  if (key === "default" || key === "__esModule") return;
@@ -360,6 +379,18 @@ Object.keys(_useChartHighlight).forEach(function (key) {
360
379
  }
361
380
  });
362
381
  });
382
+ var _useChartVisibilityManager = require("./plugins/featurePlugins/useChartVisibilityManager");
383
+ Object.keys(_useChartVisibilityManager).forEach(function (key) {
384
+ if (key === "default" || key === "__esModule") return;
385
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
386
+ if (key in exports && exports[key] === _useChartVisibilityManager[key]) return;
387
+ Object.defineProperty(exports, key, {
388
+ enumerable: true,
389
+ get: function () {
390
+ return _useChartVisibilityManager[key];
391
+ }
392
+ });
393
+ });
363
394
  var _useChartKeyboardNavigation = require("./plugins/featurePlugins/useChartKeyboardNavigation");
364
395
  Object.keys(_useChartKeyboardNavigation).forEach(function (key) {
365
396
  if (key === "default" || key === "__esModule") return;
@@ -686,6 +717,7 @@ Object.keys(_findMinMax).forEach(function (key) {
686
717
  }
687
718
  });
688
719
  });
720
+ var _getSeriesColorFn = require("./getSeriesColorFn");
689
721
  var _checkBarChartScaleErrors = require("../BarChart/checkBarChartScaleErrors");
690
722
  var _getBandSize = require("./getBandSize");
691
723
  var _getAxisExtrema = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema");
@@ -820,4 +852,16 @@ Object.keys(_scales).forEach(function (key) {
820
852
  return _scales[key];
821
853
  }
822
854
  });
855
+ });
856
+ var _identifierSerializer = require("./identifierSerializer");
857
+ Object.keys(_identifierSerializer).forEach(function (key) {
858
+ if (key === "default" || key === "__esModule") return;
859
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
860
+ if (key in exports && exports[key] === _identifierSerializer[key]) return;
861
+ Object.defineProperty(exports, key, {
862
+ enumerable: true,
863
+ get: function () {
864
+ return _identifierSerializer[key];
865
+ }
866
+ });
823
867
  });
@@ -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;
@@ -3,12 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getDataIndexForOrdinalScaleValue = getDataIndexForOrdinalScaleValue;
6
7
  exports.invertScale = invertScale;
7
8
  var _scaleGuards = require("./scaleGuards");
8
9
  function invertScale(scale, data, value) {
9
10
  if ((0, _scaleGuards.isOrdinalScale)(scale)) {
10
- const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
11
+ const dataIndex = getDataIndexForOrdinalScaleValue(scale, value);
11
12
  return data[dataIndex];
12
13
  }
13
14
  return scale.invert(value);
15
+ }
16
+
17
+ /**
18
+ * Get the data index for a given value on an ordinal scale.
19
+ */
20
+ function getDataIndexForOrdinalScaleValue(scale, value) {
21
+ const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
22
+ return dataIndex;
14
23
  }
@@ -7,7 +7,8 @@ import { type UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarA
7
7
  import { type UseChartClosestPointSignature } from "./featurePlugins/useChartClosestPoint/index.js";
8
8
  import { type UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
9
9
  import { type UseChartBrushSignature } from "./featurePlugins/useChartBrush/index.js";
10
+ import { type UseChartVisibilityManagerSignature } from "./featurePlugins/useChartVisibilityManager/index.js";
10
11
  import { type UseChartTooltipSignature } from "./featurePlugins/useChartTooltip/index.js";
11
- export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
12
- export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<TSeries>, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
13
- export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartTooltipSignature>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
12
+ export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVisibilityManagerSignature<TSeries>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
13
+ export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<TSeries>, UseChartHighlightSignature, UseChartVisibilityManagerSignature<TSeries>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
14
+ export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartTooltipSignature>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartVisibilityManagerSignature<any>>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
@@ -11,7 +11,8 @@ var _useChartKeyboardNavigation = require("./featurePlugins/useChartKeyboardNavi
11
11
  var _useChartClosestPoint = require("./featurePlugins/useChartClosestPoint");
12
12
  var _useChartZAxis = require("./featurePlugins/useChartZAxis");
13
13
  var _useChartBrush = require("./featurePlugins/useChartBrush");
14
+ var _useChartVisibilityManager = require("./featurePlugins/useChartVisibilityManager");
14
15
  var _useChartTooltip = require("./featurePlugins/useChartTooltip");
15
16
  // This file should be removed after creating all plugins in favor of a file per chart type.
16
17
 
17
- const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
18
+ const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartVisibilityManager.useChartVisibilityManager, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
@@ -0,0 +1,14 @@
1
+ import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
2
+ import type { ChartSeriesConfig } from "../../models/index.js";
3
+ /**
4
+ * Serializes a series item identifier into a unique string using the appropriate serializer
5
+ * from the provided series configuration.
6
+ *
7
+ * @param {ChartSeriesConfig<ChartSeriesType>} seriesConfig - The configuration object for chart series.
8
+ * @param {SeriesItemIdentifier<ChartSeriesType>} identifier - The series item identifier to serialize.
9
+ * @returns {string} A unique string representation of the identifier.
10
+ * @throws Will throw an error if no serializer is found for the given series type.
11
+ */
12
+ export declare const serializeIdentifier: <T extends ChartSeriesType, U extends {
13
+ type: T;
14
+ }>(seriesConfig: ChartSeriesConfig<T>, identifier: U) => string;