@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
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["trigger", "position", "anchor", "classes", "children"];
6
6
  import * as React from 'react';
7
+ import * as ReactDOM from 'react-dom';
7
8
  import PropTypes from 'prop-types';
8
9
  import HTMLElementType from '@mui/utils/HTMLElementType';
9
10
  import useLazyRef from '@mui/utils/useLazyRef';
@@ -21,7 +22,7 @@ import { selectorChartsInteractionPolarAxisTooltip } from "../internals/plugins/
21
22
  import { useAxisSystem } from "../hooks/useAxisSystem.js";
22
23
  import { useSvgRef } from "../hooks/index.js";
23
24
  import { selectorBrushShouldPreventTooltip } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
24
- import { jsx as _jsx } from "react/jsx-runtime";
25
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
26
  const selectorReturnFalse = () => false;
26
27
  const selectorReturnNull = () => null;
27
28
  function getIsOpenSelector(trigger, axisSystem, shouldPreventBecauseOfBrush) {
@@ -72,6 +73,7 @@ function ChartsTooltipContainer(inProps) {
72
73
  } = props,
73
74
  other = _objectWithoutPropertiesLoose(props, _excluded);
74
75
  const svgRef = useSvgRef();
76
+ const anchorRef = React.useRef(null);
75
77
  const classes = useUtilityClasses(propClasses);
76
78
  const pointerType = usePointerType();
77
79
  const isFineMainPointer = useIsFineMainPointer();
@@ -93,18 +95,11 @@ function ChartsTooltipContainer(inProps) {
93
95
  return () => {};
94
96
  }
95
97
  if (itemPosition !== null) {
96
- const positionUpdate = rafThrottle(() => {
97
- // eslint-disable-next-line react-compiler/react-compiler
98
- positionRef.current = {
99
- x: svgElement.getBoundingClientRect().left + (itemPosition?.x ?? 0),
100
- y: svgElement.getBoundingClientRect().top + (itemPosition?.y ?? 0)
101
- };
102
- popperRef.current?.update();
103
- });
104
- positionUpdate();
105
- return () => positionUpdate.clear();
98
+ // Tooltip position is already handled by the anchor element
99
+ return undefined;
106
100
  }
107
101
  const pointerUpdate = rafThrottle((x, y) => {
102
+ // eslint-disable-next-line react-compiler/react-compiler
108
103
  positionRef.current = {
109
104
  x,
110
105
  y
@@ -124,7 +119,7 @@ function ChartsTooltipContainer(inProps) {
124
119
  pointerUpdate.clear();
125
120
  };
126
121
  }, [svgRef, positionRef, itemPosition]);
127
- const anchorEl = React.useMemo(() => ({
122
+ const pointerAnchorEl = React.useMemo(() => ({
128
123
  getBoundingClientRect: () => ({
129
124
  x: positionRef.current.x,
130
125
  y: positionRef.current.y,
@@ -166,16 +161,25 @@ function ChartsTooltipContainer(inProps) {
166
161
  if (trigger === 'none') {
167
162
  return null;
168
163
  }
169
- return /*#__PURE__*/_jsx(NoSsr, {
170
- children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({}, other, {
171
- className: classes?.root,
172
- open: isOpen,
173
- placement: other.placement ?? position ?? (isMouse ? 'right-start' : 'top'),
174
- popperRef: popperRef,
175
- anchorEl: anchorEl,
176
- modifiers: modifiers,
177
- children: children
178
- }))
164
+ if (itemPosition !== null && anchorRef.current) {
165
+ anchorRef.current.setAttribute('x', String(itemPosition.x));
166
+ anchorRef.current.setAttribute('y', String(itemPosition.y));
167
+ }
168
+ return /*#__PURE__*/_jsxs(React.Fragment, {
169
+ children: [svgRef.current && /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/_jsx("rect", {
170
+ ref: anchorRef,
171
+ display: "hidden"
172
+ }), svgRef.current), /*#__PURE__*/_jsx(NoSsr, {
173
+ children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({}, other, {
174
+ className: classes?.root,
175
+ open: isOpen,
176
+ placement: other.placement ?? position ?? (pointerType !== null && isMouse ? 'right-start' : 'top'),
177
+ popperRef: popperRef,
178
+ anchorEl: itemPosition ? anchorRef.current : pointerAnchorEl,
179
+ modifiers: modifiers,
180
+ children: children
181
+ }))
182
+ })]
179
183
  });
180
184
  }
181
185
  process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
@@ -11,7 +11,10 @@ import { GaugeProvider } from "./GaugeProvider.js";
11
11
  import { ChartProvider } from "../context/ChartProvider/index.js";
12
12
  import { defaultizeMargin } from "../internals/defaultizeMargin.js";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- const GStyled = styled('g')(({
14
+ const GStyled = styled('g', {
15
+ slot: 'internal',
16
+ shouldForwardProp: undefined
17
+ })(({
15
18
  theme
16
19
  }) => ({
17
20
  '& text': {
@@ -24,9 +24,12 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
24
24
  ownerState
25
25
  } = props,
26
26
  other = _objectWithoutPropertiesLoose(props, _excluded);
27
- const animateProps = useAnimateLine(_extends({}, props, {
27
+ const animateProps = useAnimateLine({
28
+ d: props.d,
29
+ skipAnimation,
28
30
  ref
29
- }));
31
+ });
32
+ const fadedOpacity = ownerState.isFaded ? 0.3 : 1;
30
33
  return /*#__PURE__*/_jsx(AppearingMask, {
31
34
  skipAnimation: skipAnimation,
32
35
  id: `${ownerState.id}-line-clip`,
@@ -36,7 +39,7 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
36
39
  strokeLinejoin: "round",
37
40
  fill: "none",
38
41
  filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
39
- opacity: ownerState.isFaded ? 0.3 : 1,
42
+ opacity: ownerState.hidden ? 0 : fadedOpacity,
40
43
  "data-series": ownerState.id,
41
44
  "data-highlighted": ownerState.isHighlighted || undefined,
42
45
  "data-faded": ownerState.isFaded || undefined
@@ -54,6 +57,7 @@ process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
54
57
  classes: PropTypes.object,
55
58
  color: PropTypes.string.isRequired,
56
59
  gradientId: PropTypes.string,
60
+ hidden: PropTypes.bool,
57
61
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
58
62
  isFaded: PropTypes.bool.isRequired,
59
63
  isHighlighted: PropTypes.bool.isRequired
@@ -8,7 +8,10 @@ import { cleanId } from "../internals/cleanId.js";
8
8
  import { useChartId, useDrawingArea } from "../hooks/index.js";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  export const appearingMaskClasses = generateUtilityClasses('MuiAppearingMask', ['animate']);
11
- const AnimatedRect = styled('rect')({
11
+ const AnimatedRect = styled('rect', {
12
+ slot: 'internal',
13
+ shouldForwardProp: undefined
14
+ })({
12
15
  animationName: 'animate-width',
13
16
  animationTimingFunction: ANIMATION_TIMING_FUNCTION,
14
17
  animationDuration: '0s',
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { type MarkElementOwnerState } from "./markElementClasses.js";
3
3
  export type CircleMarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & {
4
+ /**
5
+ * If `true`, the marker is hidden.
6
+ * @default false
7
+ */
8
+ hidden?: boolean;
4
9
  /**
5
10
  * If `true`, animations are skipped.
6
11
  * @default false
@@ -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 = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation", "isFaded", "isHighlighted"];
5
+ const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation", "isFaded", "isHighlighted", "shape", "hidden"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled, useTheme } from '@mui/material/styles';
@@ -10,7 +10,10 @@ import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/a
10
10
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
11
11
  import { markElementClasses, useUtilityClasses } from "./markElementClasses.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- const Circle = styled('circle')({
13
+ const Circle = styled('circle', {
14
+ slot: 'internal',
15
+ shouldForwardProp: undefined
16
+ })({
14
17
  [`&.${markElementClasses.animate}`]: {
15
18
  transitionDuration: `${ANIMATION_DURATION_MS}ms`,
16
19
  transitionProperty: 'cx, cy, opacity',
@@ -42,6 +45,10 @@ function CircleMarkElement(props) {
42
45
  skipAnimation,
43
46
  isFaded = false,
44
47
  isHighlighted = false
48
+ // @ts-expect-error, prevents it from being passed to the svg element
49
+ ,
50
+
51
+ hidden
45
52
  } = props,
46
53
  other = _objectWithoutPropertiesLoose(props, _excluded);
47
54
  const theme = useTheme();
@@ -55,7 +62,6 @@ function CircleMarkElement(props) {
55
62
  classes: innerClasses,
56
63
  isHighlighted,
57
64
  isFaded,
58
- color,
59
65
  skipAnimation
60
66
  };
61
67
  const classes = useUtilityClasses(ownerState);
@@ -68,10 +74,12 @@ function CircleMarkElement(props) {
68
74
  strokeWidth: 2,
69
75
  className: classes.root,
70
76
  onClick: onClick,
71
- cursor: onClick ? 'pointer' : 'unset'
77
+ cursor: onClick ? 'pointer' : 'unset',
78
+ pointerEvents: hidden ? 'none' : undefined
72
79
  }, interactionProps, {
73
80
  "data-highlighted": isHighlighted || undefined,
74
- "data-faded": isFaded || undefined
81
+ "data-faded": isFaded || undefined,
82
+ opacity: hidden ? 0 : 1
75
83
  }));
76
84
  }
77
85
  process.env.NODE_ENV !== "production" ? CircleMarkElement.propTypes = {
@@ -20,7 +20,11 @@ export function FocusedLineMark() {
20
20
  if (focusedItem === null || focusedItem.type !== 'line' || !lineSeries) {
21
21
  return null;
22
22
  }
23
- const series = lineSeries?.series[focusedItem.seriesId];
23
+ const series = lineSeries.series[focusedItem.seriesId];
24
+ if (series.data[focusedItem.dataIndex] == null) {
25
+ // Handle missing data
26
+ return null;
27
+ }
24
28
  const xAxisId = series.xAxisId ?? xAxisIds[0];
25
29
  const yAxisId = series.yAxisId ?? yAxisIds[0];
26
30
  return /*#__PURE__*/_jsx("rect", {
@@ -138,6 +138,31 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
138
138
  * The height of the chart in px. If not defined, it takes the height of the parent element.
139
139
  */
140
140
  height: PropTypes.number,
141
+ /**
142
+ * List of hidden series and/or items.
143
+ *
144
+ * Different chart types use different keys.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * [
149
+ * {
150
+ * type: 'pie',
151
+ * seriesId: 'series-1',
152
+ * dataIndex: 3,
153
+ * },
154
+ * {
155
+ * type: 'line',
156
+ * seriesId: 'series-2',
157
+ * }
158
+ * ]
159
+ * ```
160
+ */
161
+ hiddenItems: PropTypes.arrayOf(PropTypes.shape({
162
+ dataIndex: PropTypes.number,
163
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
164
+ type: PropTypes.oneOf(['line']).isRequired
165
+ })),
141
166
  /**
142
167
  * If `true`, the legend is not rendered.
143
168
  */
@@ -195,6 +220,11 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
195
220
  * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
196
221
  */
197
222
  onAxisClick: PropTypes.func,
223
+ /**
224
+ * Callback fired when any hidden identifiers change.
225
+ * @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
226
+ */
227
+ onHiddenItemsChange: PropTypes.func,
198
228
  /**
199
229
  * The callback fired when the highlighted item changes.
200
230
  *
@@ -6,5 +6,6 @@ import { type UseChartHighlightSignature } from "../internals/plugins/featurePlu
6
6
  import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
7
7
  import { type ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
8
8
  import { type UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
9
- export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'line'>, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
9
+ import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
10
+ export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'line'>, UseChartHighlightSignature, UseChartVisibilityManagerSignature<'line'>, UseChartKeyboardNavigationSignature];
10
11
  export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;
@@ -5,4 +5,5 @@ import { useChartInteraction } from "../internals/plugins/featurePlugins/useChar
5
5
  import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
6
6
  import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
7
7
  import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
8
- export const LINE_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartKeyboardNavigation];
8
+ import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
9
+ export const LINE_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartKeyboardNavigation];
@@ -23,6 +23,8 @@ export interface LineElementOwnerState {
23
23
  isFaded: boolean;
24
24
  isHighlighted: boolean;
25
25
  classes?: Partial<LineElementClasses>;
26
+ /** If `true`, the line is hidden. */
27
+ hidden?: boolean;
26
28
  }
27
29
  export declare function getLineElementUtilityClass(slot: string): string;
28
30
  export declare const lineElementClasses: LineElementClasses;
@@ -38,6 +40,8 @@ export interface LineElementSlotProps {
38
40
  }
39
41
  export interface LineElementProps extends Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedLineProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
40
42
  d: string;
43
+ /** If `true`, the line is hidden. */
44
+ hidden?: boolean;
41
45
  /**
42
46
  * The props used for each component slot.
43
47
  * @default {}
@@ -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 = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
5
+ const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick", "hidden"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import composeClasses from '@mui/utils/composeClasses';
@@ -47,7 +47,8 @@ function LineElement(props) {
47
47
  gradientId,
48
48
  slots,
49
49
  slotProps,
50
- onClick
50
+ onClick,
51
+ hidden
51
52
  } = props,
52
53
  other = _objectWithoutPropertiesLoose(props, _excluded);
53
54
  const interactionProps = useInteractionItemProps({
@@ -66,7 +67,8 @@ function LineElement(props) {
66
67
  color,
67
68
  gradientId,
68
69
  isFaded,
69
- isHighlighted
70
+ isHighlighted,
71
+ hidden
70
72
  };
71
73
  const classes = useUtilityClasses(ownerState);
72
74
  const Line = slots?.line ?? AnimatedLine;
@@ -91,6 +93,8 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
91
93
  color: PropTypes.string.isRequired,
92
94
  d: PropTypes.string.isRequired,
93
95
  gradientId: PropTypes.string,
96
+ /** If `true`, the line is hidden. */
97
+ hidden: PropTypes.bool,
94
98
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
95
99
  /**
96
100
  * If `true`, animations are skipped.
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { type MarkElementOwnerState } from "./markElementClasses.js";
3
3
  export type MarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & {
4
+ /**
5
+ * If `true`, the marker is hidden.
6
+ * @default false
7
+ */
8
+ hidden?: boolean;
4
9
  /**
5
10
  * If `true`, animations are skipped.
6
11
  * @default false
@@ -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 = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation", "isFaded", "isHighlighted"];
5
+ const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation", "isFaded", "isHighlighted", "hidden", "style"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled } from '@mui/material/styles';
@@ -16,12 +16,9 @@ const MarkElementPath = styled('path', {
16
16
  name: 'MuiMarkElement',
17
17
  slot: 'Root'
18
18
  })(({
19
- ownerState,
20
19
  theme
21
20
  }) => ({
22
21
  fill: (theme.vars || theme).palette.background.paper,
23
- stroke: ownerState.color,
24
- strokeWidth: 2,
25
22
  [`&.${markElementClasses.animate}`]: {
26
23
  transitionDuration: `${ANIMATION_DURATION_MS}ms`,
27
24
  transitionProperty: 'transform, transform-origin, opacity',
@@ -50,7 +47,9 @@ function MarkElement(props) {
50
47
  onClick,
51
48
  skipAnimation,
52
49
  isFaded = false,
53
- isHighlighted = false
50
+ isHighlighted = false,
51
+ hidden,
52
+ style
54
53
  } = props,
55
54
  other = _objectWithoutPropertiesLoose(props, _excluded);
56
55
  const interactionProps = useInteractionItemProps({
@@ -63,23 +62,26 @@ function MarkElement(props) {
63
62
  classes: innerClasses,
64
63
  isHighlighted,
65
64
  isFaded,
66
- color,
67
65
  skipAnimation
68
66
  };
69
67
  const classes = useUtilityClasses(ownerState);
70
68
  return /*#__PURE__*/_jsx(MarkElementPath, _extends({}, other, {
71
- style: {
69
+ style: _extends({}, style, {
72
70
  transform: `translate(${x}px, ${y}px)`,
73
71
  transformOrigin: `${x}px ${y}px`
74
- },
72
+ }),
75
73
  ownerState: ownerState,
76
74
  className: classes.root,
77
75
  d: d3Symbol(d3SymbolsFill[getSymbol(shape)])(),
78
76
  onClick: onClick,
79
- cursor: onClick ? 'pointer' : 'unset'
77
+ cursor: onClick ? 'pointer' : 'unset',
78
+ pointerEvents: hidden ? 'none' : undefined
80
79
  }, interactionProps, {
81
80
  "data-highlighted": isHighlighted || undefined,
82
- "data-faded": isFaded || undefined
81
+ "data-faded": isFaded || undefined,
82
+ opacity: hidden ? 0 : 1,
83
+ strokeWidth: 2,
84
+ stroke: color
83
85
  }));
84
86
  }
85
87
  process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
@@ -92,6 +94,11 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
92
94
  * The index to the element in the series' data array.
93
95
  */
94
96
  dataIndex: PropTypes.number.isRequired,
97
+ /**
98
+ * If `true`, the marker is hidden.
99
+ * @default false
100
+ */
101
+ hidden: PropTypes.bool,
95
102
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
96
103
  /**
97
104
  * If `true`, the marker is faded.
@@ -17,7 +17,6 @@ export interface MarkElementClasses {
17
17
  export type MarkElementClassKey = keyof MarkElementClasses;
18
18
  export interface MarkElementOwnerState {
19
19
  id: SeriesId;
20
- color: string;
21
20
  isFaded: boolean;
22
21
  isHighlighted: boolean;
23
22
  classes?: Partial<MarkElementClasses>;
@@ -6,6 +6,7 @@ import tooltipGetter, { axisTooltipGetter } from "./tooltip.js";
6
6
  import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
7
7
  import tooltipItemPositionGetter from "./tooltipPosition.js";
8
8
  import keyboardFocusHandler from "./keyboardFocusHandler.js";
9
+ import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
9
10
  export const lineSeriesConfig = {
10
11
  colorProcessor: getColor,
11
12
  seriesProcessor,
@@ -16,5 +17,6 @@ export const lineSeriesConfig = {
16
17
  xExtremumGetter: getExtremumX,
17
18
  yExtremumGetter: getExtremumY,
18
19
  getSeriesWithDefaultValues,
19
- keyboardFocusHandler
20
+ keyboardFocusHandler,
21
+ identifierSerializer: identifierSerializerSeriesIdDataIndex
20
22
  };
@@ -10,6 +10,7 @@ const legendGetter = params => {
10
10
  return acc;
11
11
  }
12
12
  acc.push({
13
+ type: 'line',
13
14
  markType: series[seriesId].labelMarkType,
14
15
  id: seriesId,
15
16
  seriesId,
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ const _excluded = ["arcLabelRadius"];
4
6
  import * as React from 'react';
5
7
  import { useTheme } from '@mui/material/styles';
6
8
  import { useFocusedItem } from "../hooks/useFocusedItem.js";
@@ -30,7 +32,8 @@ export function FocusedPieArc(props) {
30
32
  return null;
31
33
  }
32
34
  const item = series.data[focusedItem.dataIndex];
33
- const arcSizes = getModifiedArcProperties(series, pieSeriesLayout[focusedItem.seriesId], isHighlighted, isFaded);
35
+ const _getModifiedArcProper = getModifiedArcProperties(series, pieSeriesLayout[focusedItem.seriesId], isHighlighted, isFaded),
36
+ arcSizes = _objectWithoutPropertiesLoose(_getModifiedArcProper, _excluded);
34
37
  return /*#__PURE__*/_jsx(PieArc, _extends({
35
38
  transform: `translate(${pieSeriesLayout[series.id].center.x}, ${pieSeriesLayout[series.id].center.y})`,
36
39
  startAngle: item.startAngle,
@@ -36,6 +36,7 @@ export type PieArcLabelProps = PieArcLabelOwnerState & Omit<React.SVGProps<SVGTe
36
36
  paddingAngle: number;
37
37
  skipAnimation: boolean;
38
38
  formattedArcLabel?: string | null;
39
+ hidden?: boolean;
39
40
  };
40
41
  declare const PieArcLabel: React.ForwardRefExoticComponent<PieArcLabelOwnerState & Omit<React.SVGProps<SVGTextElement>, "ref" | "color" | "id"> & {
41
42
  startAngle: number;
@@ -47,5 +48,6 @@ declare const PieArcLabel: React.ForwardRefExoticComponent<PieArcLabelOwnerState
47
48
  paddingAngle: number;
48
49
  skipAnimation: boolean;
49
50
  formattedArcLabel?: string | null;
51
+ hidden?: boolean;
50
52
  } & React.RefAttributes<SVGTextElement>>;
51
53
  export { PieArcLabel };
@@ -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 = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "skipAnimation"];
5
+ const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "skipAnimation", "hidden"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import composeClasses from '@mui/utils/composeClasses';
@@ -67,7 +67,8 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
67
67
  formattedArcLabel,
68
68
  isHighlighted,
69
69
  isFaded,
70
- skipAnimation
70
+ skipAnimation,
71
+ hidden
71
72
  } = props,
72
73
  other = _objectWithoutPropertiesLoose(props, _excluded);
73
74
  const ownerState = {
@@ -92,6 +93,7 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
92
93
  return /*#__PURE__*/_jsx(PieArcLabelRoot, _extends({
93
94
  className: classes.root
94
95
  }, other, animatedProps, {
96
+ opacity: hidden ? 0 : 1,
95
97
  children: formattedArcLabel
96
98
  }));
97
99
  });
@@ -107,6 +109,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
107
109
  cornerRadius: PropTypes.number.isRequired,
108
110
  endAngle: PropTypes.number.isRequired,
109
111
  formattedArcLabel: PropTypes.string,
112
+ hidden: PropTypes.bool,
110
113
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
111
114
  innerRadius: PropTypes.number.isRequired,
112
115
  isFaded: PropTypes.bool.isRequired,
@@ -73,15 +73,15 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
73
73
  plugins: PIE_CHART_PLUGINS
74
74
  }), ref);
75
75
  const Tooltip = slots?.tooltip ?? ChartsTooltip;
76
- const Toolbar = props.slots?.toolbar;
76
+ const Toolbar = slots?.toolbar;
77
77
  return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
78
78
  children: /*#__PURE__*/_jsxs(ChartsWrapper, {
79
- legendPosition: props.slotProps?.legend?.position,
80
- legendDirection: props.slotProps?.legend?.direction ?? 'vertical',
79
+ legendPosition: slotProps?.legend?.position,
80
+ legendDirection: slotProps?.legend?.direction ?? 'vertical',
81
81
  sx: sx,
82
82
  hideLegend: hideLegend ?? false,
83
- children: [showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
84
- direction: props.slotProps?.legend?.direction ?? 'vertical',
83
+ children: [showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
84
+ direction: slotProps?.legend?.direction ?? 'vertical',
85
85
  slots: slots,
86
86
  slotProps: slotProps
87
87
  }), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
@@ -126,6 +126,31 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
126
126
  * The height of the chart in px. If not defined, it takes the height of the parent element.
127
127
  */
128
128
  height: PropTypes.number,
129
+ /**
130
+ * List of hidden series and/or items.
131
+ *
132
+ * Different chart types use different keys.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * [
137
+ * {
138
+ * type: 'pie',
139
+ * seriesId: 'series-1',
140
+ * dataIndex: 3,
141
+ * },
142
+ * {
143
+ * type: 'line',
144
+ * seriesId: 'series-2',
145
+ * }
146
+ * ]
147
+ * ```
148
+ */
149
+ hiddenItems: PropTypes.arrayOf(PropTypes.shape({
150
+ dataIndex: PropTypes.number,
151
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
152
+ type: PropTypes.oneOf(['pie']).isRequired
153
+ })),
129
154
  /**
130
155
  * If `true`, the legend is not rendered.
131
156
  */
@@ -164,6 +189,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
164
189
  right: PropTypes.number,
165
190
  top: PropTypes.number
166
191
  })]),
192
+ /**
193
+ * Callback fired when any hidden identifiers change.
194
+ * @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
195
+ */
196
+ onHiddenItemsChange: PropTypes.func,
167
197
  /**
168
198
  * The callback fired when the highlighted item changes.
169
199
  *
@@ -3,5 +3,6 @@ import { type UseChartTooltipSignature } from "../internals/plugins/featurePlugi
3
3
  import { type UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
4
4
  import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
5
5
  import { type ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
6
- export type PieChartPluginSignatures = [UseChartTooltipSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
6
+ import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
7
+ export type PieChartPluginSignatures = [UseChartTooltipSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVisibilityManagerSignature<'pie'>, UseChartKeyboardNavigationSignature];
7
8
  export declare const PIE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<PieChartPluginSignatures>;
@@ -2,4 +2,5 @@ import { useChartInteraction } from "../internals/plugins/featurePlugins/useChar
2
2
  import { useChartTooltip } from "../internals/plugins/featurePlugins/useChartTooltip/index.js";
3
3
  import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
4
4
  import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
5
- export const PIE_CHART_PLUGINS = [useChartTooltip, useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
5
+ import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
6
+ export const PIE_CHART_PLUGINS = [useChartTooltip, useChartInteraction, useChartHighlight, useChartVisibilityManager, useChartKeyboardNavigation];
@@ -6,6 +6,7 @@ import seriesLayout from "./seriesLayout.js";
6
6
  import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
7
7
  import tooltipItemPositionGetter from "./tooltipPosition.js";
8
8
  import keyboardFocusHandler from "./keyboardFocusHandler.js";
9
+ import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
9
10
  export const pieSeriesConfig = {
10
11
  colorProcessor: getColor,
11
12
  seriesProcessor,
@@ -14,5 +15,6 @@ export const pieSeriesConfig = {
14
15
  tooltipGetter,
15
16
  tooltipItemPositionGetter,
16
17
  getSeriesWithDefaultValues,
17
- keyboardFocusHandler
18
+ keyboardFocusHandler,
19
+ identifierSerializer: identifierSerializerSeriesIdDataIndex
18
20
  };