@mui/x-charts 7.22.3 → 8.0.0-alpha.1

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 (415) hide show
  1. package/BarChart/AnimatedBarElement.d.ts +15 -0
  2. package/BarChart/AnimatedBarElement.js +21 -0
  3. package/BarChart/BarChart.d.ts +11 -16
  4. package/BarChart/BarChart.js +9 -59
  5. package/BarChart/BarElement.d.ts +6 -1343
  6. package/BarChart/BarElement.js +10 -20
  7. package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
  8. package/BarChart/BarPlot.js +24 -6
  9. package/BarChart/extremums.js +3 -3
  10. package/BarChart/useBarChartProps.d.ts +2 -4
  11. package/BarChart/useBarChartProps.js +4 -11
  12. package/CHANGELOG.md +348 -12
  13. package/ChartContainer/ChartContainer.d.ts +4 -38
  14. package/ChartContainer/ChartContainer.js +15 -44
  15. package/ChartContainer/ResizableContainer.d.ts +22 -0
  16. package/ChartContainer/ResizableContainer.js +60 -0
  17. package/ChartContainer/useChartContainerProps.d.ts +8 -92
  18. package/ChartContainer/useChartContainerProps.js +29 -59
  19. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
  20. package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  21. package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
  22. package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
  23. package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  24. package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
  25. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  26. package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
  27. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  28. package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
  29. package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  30. package/ChartsAxisHighlight/index.d.ts +3 -0
  31. package/ChartsAxisHighlight/index.js +4 -1
  32. package/ChartsGrid/ChartsGrid.js +1 -1
  33. package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
  34. package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  35. package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
  36. package/ChartsGrid/ChartsVerticalGrid.js +3 -3
  37. package/ChartsLegend/ChartsLegend.js +0 -3
  38. package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
  39. package/ChartsLegend/DefaultChartsLegend.js +1 -12
  40. package/ChartsLegend/LegendPerItem.d.ts +3 -3
  41. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
  42. package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
  43. package/ChartsSurface/ChartsSurface.d.ts +0 -15
  44. package/ChartsSurface/ChartsSurface.js +35 -34
  45. package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
  46. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
  47. package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  48. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
  49. package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  50. package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
  51. package/ChartsTooltip/ChartsTooltip.js +162 -107
  52. package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
  53. package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
  54. package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
  55. package/ChartsTooltip/chartsTooltipClasses.js +18 -2
  56. package/ChartsTooltip/index.d.ts +3 -3
  57. package/ChartsTooltip/index.js +2 -3
  58. package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
  59. package/ChartsTooltip/useAxisTooltip.js +21 -21
  60. package/ChartsTooltip/useItemTooltip.d.ts +1 -1
  61. package/ChartsTooltip/useItemTooltip.js +8 -7
  62. package/ChartsTooltip/utils.d.ts +5 -16
  63. package/ChartsTooltip/utils.js +45 -50
  64. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
  65. package/Gauge/Gauge.d.ts +1 -1
  66. package/Gauge/Gauge.js +0 -6
  67. package/Gauge/GaugeContainer.d.ts +3 -3
  68. package/Gauge/GaugeContainer.js +60 -61
  69. package/LineChart/AnimatedArea.d.ts +0 -1333
  70. package/LineChart/AnimatedArea.js +9 -18
  71. package/LineChart/AnimatedLine.d.ts +0 -1333
  72. package/LineChart/AnimatedLine.js +9 -20
  73. package/LineChart/AreaElement.d.ts +1 -1
  74. package/LineChart/AreaPlot.js +14 -8
  75. package/LineChart/CircleMarkElement.js +6 -5
  76. package/LineChart/LineChart.d.ts +11 -17
  77. package/LineChart/LineChart.js +9 -60
  78. package/LineChart/LineElement.d.ts +1 -1
  79. package/LineChart/LineHighlightPlot.d.ts +1 -1
  80. package/LineChart/LineHighlightPlot.js +8 -11
  81. package/LineChart/LinePlot.js +14 -8
  82. package/LineChart/MarkElement.js +6 -5
  83. package/LineChart/MarkPlot.js +2 -6
  84. package/LineChart/extremums.js +10 -6
  85. package/LineChart/useLineChartProps.d.ts +2 -4
  86. package/LineChart/useLineChartProps.js +4 -11
  87. package/PieChart/PieArc.d.ts +0 -5
  88. package/PieChart/PieArc.js +1 -10
  89. package/PieChart/PieArcPlot.js +0 -5
  90. package/PieChart/PieChart.d.ts +10 -39
  91. package/PieChart/PieChart.js +20 -137
  92. package/PieChart/PiePlot.js +2 -2
  93. package/PieChart/getPieCoordinates.d.ts +2 -2
  94. package/README.md +4 -4
  95. package/ScatterChart/Scatter.js +6 -5
  96. package/ScatterChart/ScatterChart.d.ts +11 -17
  97. package/ScatterChart/ScatterChart.js +11 -60
  98. package/ScatterChart/ScatterPlot.js +3 -6
  99. package/ScatterChart/extremums.js +6 -6
  100. package/ScatterChart/useScatterChartProps.d.ts +2 -4
  101. package/ScatterChart/useScatterChartProps.js +3 -12
  102. package/SparkLineChart/SparkLineChart.d.ts +7 -8
  103. package/SparkLineChart/SparkLineChart.js +6 -33
  104. package/context/CartesianProvider/defaultizeAxis.d.ts +1 -1
  105. package/context/ChartDataProvider/ChartDataProvider.d.ts +31 -0
  106. package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
  107. package/context/ChartDataProvider/index.d.ts +1 -0
  108. package/context/ChartDataProvider/index.js +1 -0
  109. package/context/ChartDataProvider/useChartDataProviderProps.d.ts +94 -0
  110. package/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
  111. package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +12 -12
  112. package/{modern/ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
  113. package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
  114. package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
  115. package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
  116. package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
  117. package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  118. package/context/DrawingAreaProvider/index.d.ts +3 -0
  119. package/context/DrawingAreaProvider/index.js +3 -0
  120. package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
  121. package/context/HighlightedProvider/HighlightedProvider.js +1 -16
  122. package/context/InteractionProvider.d.ts +5 -48
  123. package/context/InteractionProvider.js +8 -64
  124. package/context/InteractionSelectors.d.ts +359 -0
  125. package/context/InteractionSelectors.js +12 -0
  126. package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
  127. package/context/SizeProvider/Size.types.d.ts +30 -0
  128. package/context/SizeProvider/SizeContext.d.ts +4 -0
  129. package/context/SizeProvider/SizeContext.js +13 -0
  130. package/context/SizeProvider/SizeProvider.d.ts +11 -0
  131. package/context/SizeProvider/SizeProvider.js +26 -0
  132. package/context/SizeProvider/index.d.ts +4 -0
  133. package/context/SizeProvider/index.js +4 -0
  134. package/context/SizeProvider/useChartContainerDimensions.d.ts +9 -0
  135. package/{modern/ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
  136. package/context/SizeProvider/useSize.d.ts +5 -0
  137. package/context/SizeProvider/useSize.js +13 -0
  138. package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
  139. package/context/SvgRefProvider/SvgRef.types.js +1 -0
  140. package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
  141. package/context/SvgRefProvider/SvgRefContext.js +17 -0
  142. package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
  143. package/context/SvgRefProvider/SvgRefProvider.js +24 -0
  144. package/context/SvgRefProvider/index.d.ts +4 -0
  145. package/context/SvgRefProvider/index.js +4 -0
  146. package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
  147. package/context/SvgRefProvider/useSurfaceRef.js +14 -0
  148. package/context/ZAxisContextProvider.d.ts +1 -1
  149. package/context/index.d.ts +2 -0
  150. package/context/index.js +2 -1
  151. package/hooks/useAxisEvents.js +32 -19
  152. package/hooks/useChartId.js +2 -2
  153. package/hooks/useDrawingArea.d.ts +2 -2
  154. package/hooks/useDrawingArea.js +2 -2
  155. package/hooks/useInteractionItemProps.js +19 -12
  156. package/hooks/useSvgRef.js +3 -3
  157. package/index.d.ts +1 -2
  158. package/index.js +2 -3
  159. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
  160. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  161. package/internals/computeAxisValue.d.ts +2 -2
  162. package/internals/defaultizeColor.d.ts +1 -8
  163. package/internals/getSymbol.js +19 -3
  164. package/internals/index.d.ts +7 -6
  165. package/internals/index.js +7 -6
  166. package/internals/plugins/models/index.d.ts +35 -0
  167. package/internals/plugins/models/index.js +1 -0
  168. package/internals/plugins/utils/ChartStore.d.ts +12 -0
  169. package/internals/plugins/utils/ChartStore.js +26 -0
  170. package/internals/plugins/utils/ChartsStore.d.ts +12 -0
  171. package/internals/plugins/utils/ChartsStore.js +26 -0
  172. package/internals/plugins/utils/selectors.d.ts +9 -0
  173. package/internals/plugins/utils/selectors.js +37 -0
  174. package/internals/useCharts.d.ts +6 -0
  175. package/internals/useCharts.js +29 -0
  176. package/internals/useSelector.d.ts +4 -0
  177. package/internals/useSelector.js +6 -0
  178. package/internals/useStore.d.ts +2 -0
  179. package/internals/useStore.js +17 -0
  180. package/internals/useStringInterpolator.js +1 -0
  181. package/models/seriesType/bar.d.ts +1 -1
  182. package/models/seriesType/common.d.ts +0 -10
  183. package/models/seriesType/config.d.ts +1 -1
  184. package/models/seriesType/line.d.ts +1 -1
  185. package/models/seriesType/pie.d.ts +1 -1
  186. package/models/seriesType/scatter.d.ts +1 -6
  187. package/modern/BarChart/AnimatedBarElement.js +21 -0
  188. package/modern/BarChart/BarChart.js +9 -59
  189. package/modern/BarChart/BarElement.js +10 -20
  190. package/modern/BarChart/BarPlot.js +24 -6
  191. package/modern/BarChart/extremums.js +3 -3
  192. package/modern/BarChart/useBarChartProps.js +4 -11
  193. package/modern/ChartContainer/ChartContainer.js +15 -44
  194. package/modern/ChartContainer/ResizableContainer.js +60 -0
  195. package/modern/ChartContainer/useChartContainerProps.js +29 -59
  196. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
  197. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
  198. package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
  199. package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
  200. package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
  201. package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
  202. package/modern/ChartsAxisHighlight/index.js +4 -1
  203. package/modern/ChartsGrid/ChartsGrid.js +1 -1
  204. package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
  205. package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
  206. package/modern/ChartsLegend/ChartsLegend.js +0 -3
  207. package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
  208. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
  209. package/modern/ChartsSurface/ChartsSurface.js +35 -34
  210. package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
  211. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
  212. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
  213. package/modern/ChartsTooltip/ChartsTooltip.js +162 -107
  214. package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
  215. package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
  216. package/modern/ChartsTooltip/index.js +2 -3
  217. package/modern/ChartsTooltip/useAxisTooltip.js +21 -21
  218. package/modern/ChartsTooltip/useItemTooltip.js +8 -7
  219. package/modern/ChartsTooltip/utils.js +45 -50
  220. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
  221. package/modern/Gauge/Gauge.js +0 -6
  222. package/modern/Gauge/GaugeContainer.js +60 -61
  223. package/modern/LineChart/AnimatedArea.js +9 -18
  224. package/modern/LineChart/AnimatedLine.js +9 -20
  225. package/modern/LineChart/AreaPlot.js +14 -8
  226. package/modern/LineChart/CircleMarkElement.js +6 -5
  227. package/modern/LineChart/LineChart.js +9 -60
  228. package/modern/LineChart/LineHighlightPlot.js +8 -11
  229. package/modern/LineChart/LinePlot.js +14 -8
  230. package/modern/LineChart/MarkElement.js +6 -5
  231. package/modern/LineChart/MarkPlot.js +2 -6
  232. package/modern/LineChart/extremums.js +10 -6
  233. package/modern/LineChart/useLineChartProps.js +4 -11
  234. package/modern/PieChart/PieArc.js +1 -10
  235. package/modern/PieChart/PieArcPlot.js +0 -5
  236. package/modern/PieChart/PieChart.js +20 -137
  237. package/modern/PieChart/PiePlot.js +2 -2
  238. package/modern/ScatterChart/Scatter.js +6 -5
  239. package/modern/ScatterChart/ScatterChart.js +11 -60
  240. package/modern/ScatterChart/ScatterPlot.js +3 -6
  241. package/modern/ScatterChart/extremums.js +6 -6
  242. package/modern/ScatterChart/useScatterChartProps.js +3 -12
  243. package/modern/SparkLineChart/SparkLineChart.js +6 -33
  244. package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
  245. package/modern/context/ChartDataProvider/index.js +1 -0
  246. package/modern/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
  247. package/{ChartContainer → modern/context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
  248. package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
  249. package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
  250. package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
  251. package/modern/context/DrawingAreaProvider/index.js +3 -0
  252. package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
  253. package/modern/context/InteractionProvider.js +8 -64
  254. package/modern/context/InteractionSelectors.js +12 -0
  255. package/modern/context/SizeProvider/Size.types.js +1 -0
  256. package/modern/context/SizeProvider/SizeContext.js +13 -0
  257. package/modern/context/SizeProvider/SizeProvider.js +26 -0
  258. package/modern/context/SizeProvider/index.js +4 -0
  259. package/{ResponsiveChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +15 -7
  260. package/modern/context/SizeProvider/useSize.js +13 -0
  261. package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
  262. package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
  263. package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
  264. package/modern/context/SvgRefProvider/index.js +4 -0
  265. package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
  266. package/modern/context/index.js +2 -1
  267. package/modern/hooks/useAxisEvents.js +32 -19
  268. package/modern/hooks/useChartId.js +2 -2
  269. package/modern/hooks/useDrawingArea.js +2 -2
  270. package/modern/hooks/useInteractionItemProps.js +19 -12
  271. package/modern/hooks/useSvgRef.js +3 -3
  272. package/modern/index.js +2 -3
  273. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  274. package/modern/internals/getSymbol.js +19 -3
  275. package/modern/internals/index.js +7 -6
  276. package/modern/internals/plugins/models/index.js +1 -0
  277. package/modern/internals/plugins/utils/ChartStore.js +26 -0
  278. package/modern/internals/plugins/utils/ChartsStore.js +26 -0
  279. package/modern/internals/plugins/utils/selectors.js +37 -0
  280. package/modern/internals/useCharts.js +29 -0
  281. package/modern/internals/useSelector.js +6 -0
  282. package/modern/internals/useStore.js +17 -0
  283. package/modern/internals/useStringInterpolator.js +1 -0
  284. package/node/BarChart/AnimatedBarElement.js +28 -0
  285. package/node/BarChart/BarChart.js +9 -59
  286. package/node/BarChart/BarElement.js +11 -21
  287. package/node/BarChart/BarPlot.js +22 -4
  288. package/node/BarChart/extremums.js +3 -3
  289. package/node/BarChart/useBarChartProps.js +4 -11
  290. package/node/ChartContainer/ChartContainer.js +14 -43
  291. package/node/ChartContainer/ResizableContainer.js +68 -0
  292. package/node/ChartContainer/useChartContainerProps.js +29 -60
  293. package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
  294. package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
  295. package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
  296. package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
  297. package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
  298. package/node/ChartsAxisHighlight/index.js +33 -0
  299. package/node/ChartsGrid/ChartsGrid.js +2 -2
  300. package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
  301. package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
  302. package/node/ChartsLegend/ChartsLegend.js +0 -3
  303. package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
  304. package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
  305. package/node/ChartsSurface/ChartsSurface.js +35 -34
  306. package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
  307. package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
  308. package/node/ChartsTooltip/ChartsTooltip.js +161 -106
  309. package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
  310. package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
  311. package/node/ChartsTooltip/index.js +19 -28
  312. package/node/ChartsTooltip/useAxisTooltip.js +21 -21
  313. package/node/ChartsTooltip/useItemTooltip.js +8 -7
  314. package/node/ChartsTooltip/utils.js +46 -53
  315. package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +51 -40
  316. package/node/Gauge/Gauge.js +0 -6
  317. package/node/Gauge/GaugeContainer.js +60 -61
  318. package/node/LineChart/AnimatedArea.js +9 -19
  319. package/node/LineChart/AnimatedLine.js +9 -21
  320. package/node/LineChart/AreaPlot.js +13 -7
  321. package/node/LineChart/CircleMarkElement.js +6 -5
  322. package/node/LineChart/LineChart.js +9 -60
  323. package/node/LineChart/LineHighlightPlot.js +8 -11
  324. package/node/LineChart/LinePlot.js +13 -7
  325. package/node/LineChart/MarkElement.js +6 -5
  326. package/node/LineChart/MarkPlot.js +2 -6
  327. package/node/LineChart/extremums.js +10 -6
  328. package/node/LineChart/useLineChartProps.js +4 -11
  329. package/node/PieChart/PieArc.js +1 -10
  330. package/node/PieChart/PieArcPlot.js +0 -5
  331. package/node/PieChart/PieChart.js +20 -137
  332. package/node/PieChart/PiePlot.js +2 -2
  333. package/node/ScatterChart/Scatter.js +6 -5
  334. package/node/ScatterChart/ScatterChart.js +11 -60
  335. package/node/ScatterChart/ScatterPlot.js +3 -6
  336. package/node/ScatterChart/extremums.js +6 -6
  337. package/node/ScatterChart/useScatterChartProps.js +3 -12
  338. package/node/SparkLineChart/SparkLineChart.js +6 -33
  339. package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
  340. package/node/context/ChartDataProvider/index.js +16 -0
  341. package/node/context/ChartDataProvider/useChartDataProviderProps.js +72 -0
  342. package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
  343. package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
  344. package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
  345. package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
  346. package/node/context/DrawingAreaProvider/index.js +38 -0
  347. package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
  348. package/node/context/InteractionProvider.js +9 -66
  349. package/node/context/InteractionSelectors.js +18 -0
  350. package/node/context/SizeProvider/Size.types.js +5 -0
  351. package/node/context/SizeProvider/SizeContext.js +20 -0
  352. package/node/context/SizeProvider/SizeProvider.js +29 -0
  353. package/node/context/SizeProvider/index.js +49 -0
  354. package/node/{ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
  355. package/node/context/SizeProvider/useSize.js +20 -0
  356. package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
  357. package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
  358. package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
  359. package/node/context/SvgRefProvider/index.js +49 -0
  360. package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
  361. package/node/context/index.js +10 -2
  362. package/node/hooks/useAxisEvents.js +33 -19
  363. package/node/hooks/useChartId.js +2 -2
  364. package/node/hooks/useDrawingArea.js +2 -2
  365. package/node/hooks/useInteractionItemProps.js +20 -13
  366. package/node/hooks/useSvgRef.js +3 -3
  367. package/node/index.js +5 -16
  368. package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
  369. package/node/internals/getSymbol.js +19 -3
  370. package/node/internals/index.js +64 -44
  371. package/node/internals/plugins/models/index.js +5 -0
  372. package/node/internals/plugins/utils/ChartStore.js +33 -0
  373. package/node/internals/plugins/utils/ChartsStore.js +33 -0
  374. package/node/internals/plugins/utils/selectors.js +44 -0
  375. package/node/internals/useCharts.js +36 -0
  376. package/node/internals/useSelector.js +13 -0
  377. package/node/internals/useStore.js +24 -0
  378. package/node/internals/useStringInterpolator.js +2 -0
  379. package/package.json +8 -6
  380. package/themeAugmentation/props.d.ts +1 -2
  381. package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
  382. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  383. package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
  384. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  385. package/ResponsiveChartContainer/ResizableContainer.d.ts +0 -9
  386. package/ResponsiveChartContainer/ResizableContainer.js +0 -26
  387. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
  388. package/ResponsiveChartContainer/index.d.ts +0 -1
  389. package/ResponsiveChartContainer/index.js +0 -1
  390. package/ResponsiveChartContainer/package.json +0 -6
  391. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +0 -6
  392. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
  393. package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
  394. package/internals/SlotComponentPropsFromProps.d.ts +0 -1
  395. package/models/helpers.d.ts +0 -3
  396. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
  397. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
  398. package/modern/ResponsiveChartContainer/ResizableContainer.js +0 -26
  399. package/modern/ResponsiveChartContainer/index.js +0 -1
  400. package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
  401. package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
  402. package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
  403. package/node/ResponsiveChartContainer/ResizableContainer.js +0 -32
  404. package/node/ResponsiveChartContainer/index.js +0 -16
  405. package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
  406. /package/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
  407. /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
  408. /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  409. /package/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
  410. /package/{modern/internals/SlotComponentPropsFromProps.js → context/DrawingAreaProvider/DrawingArea.types.js} +0 -0
  411. /package/{modern/models/helpers.js → context/SizeProvider/Size.types.js} +0 -0
  412. /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  413. /package/node/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
  414. /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
  415. /package/node/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
@@ -0,0 +1,37 @@
1
+ import { lruMemoize, createSelectorCreator } from 'reselect';
2
+ const reselectCreateSelector = createSelectorCreator({
3
+ memoize: lruMemoize,
4
+ memoizeOptions: {
5
+ maxSize: 1,
6
+ equalityCheck: Object.is
7
+ }
8
+ });
9
+ const cache = new WeakMap();
10
+ /**
11
+ * Method wrapping reselect's createSelector to provide caching for chart instances.
12
+ *
13
+ */
14
+ export const createSelector = (...createSelectorArgs) => {
15
+ const selector = (state, selectorArgs) => {
16
+ const cacheKey = state.cacheKey;
17
+
18
+ // If there is no cache for the current chart instance, create one.
19
+ let cacheForCurrentChartInstance = cache.get(cacheKey);
20
+ if (!cacheForCurrentChartInstance) {
21
+ cacheForCurrentChartInstance = new Map();
22
+ cache.set(cacheKey, cacheForCurrentChartInstance);
23
+ }
24
+
25
+ // If there is a cached selector, execute it.
26
+ const cachedSelector = cacheForCurrentChartInstance.get(createSelectorArgs);
27
+ if (cachedSelector) {
28
+ return cachedSelector(state, selectorArgs);
29
+ }
30
+
31
+ // Otherwise, create a new selector and cache it and execute it.
32
+ const fn = reselectCreateSelector(...createSelectorArgs);
33
+ cacheForCurrentChartInstance.set(createSelectorArgs, fn);
34
+ return fn(state, selectorArgs);
35
+ };
36
+ return selector;
37
+ };
@@ -0,0 +1,6 @@
1
+ import { ChartStore } from './plugins/utils/ChartStore';
2
+ export declare function useCharts(): {
3
+ contextValue: {
4
+ store: ChartStore;
5
+ };
6
+ };
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { ChartStore } from "./plugins/utils/ChartStore.js";
3
+ let globalId = 0;
4
+ export function useCharts() {
5
+ const storeRef = React.useRef(null);
6
+ if (storeRef.current == null) {
7
+ // eslint-disable-next-line react-compiler/react-compiler
8
+ globalId += 1;
9
+ const initialState = {
10
+ interaction: {
11
+ item: null,
12
+ axis: {
13
+ x: null,
14
+ y: null
15
+ }
16
+ },
17
+ cacheKey: {
18
+ id: globalId
19
+ }
20
+ };
21
+ storeRef.current = new ChartStore(initialState);
22
+ }
23
+ const contextValue = React.useMemo(() => ({
24
+ store: storeRef.current
25
+ }), []);
26
+ return {
27
+ contextValue
28
+ };
29
+ }
@@ -0,0 +1,4 @@
1
+ import { ChartState } from './plugins/models';
2
+ import { ChartsSelector } from './plugins/utils/selectors';
3
+ import { ChartStore } from './plugins/utils/ChartStore';
4
+ export declare const useSelector: <TArgs, TValue>(store: ChartStore, selector: ChartsSelector<ChartState, TArgs, TValue>, args?: TArgs, equals?: (a: TValue, b: TValue) => boolean) => TValue;
@@ -0,0 +1,6 @@
1
+ import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
2
+ const defaultCompare = Object.is;
3
+ export const useSelector = (store, selector, args = undefined, equals = defaultCompare) => {
4
+ const selectorWithArgs = state => selector(state, args);
5
+ return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, selectorWithArgs, equals);
6
+ };
@@ -0,0 +1,2 @@
1
+ import { ChartStore } from './plugins/utils/ChartStore';
2
+ export declare function useStore(skipError?: boolean): ChartStore;
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { ChartsContext } from "../context/InteractionProvider.js";
3
+ export function useStore(skipError) {
4
+ const charts = React.useContext(ChartsContext);
5
+ if (skipError) {
6
+ // TODO: Remove once store is used by all charts.
7
+ // This line is only for `useAxisEvents` which is in the surface of the Gauge.
8
+ // But the Gauge don't have store yet because it does not need the interaction provider.
9
+ // Will be fixed when every thing move to the store since every component will have access to it.
10
+ // @ts-ignore
11
+ return charts?.store;
12
+ }
13
+ if (!charts) {
14
+ throw new Error(['MUI X: Could not find the charts context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
15
+ }
16
+ return charts.store;
17
+ }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-compiler/react-compiler */
1
2
  import * as React from 'react';
2
3
  import { interpolateString } from '@mui/x-charts-vendor/d3-interpolate';
3
4
  function usePrevious(value) {
@@ -1,4 +1,4 @@
1
- import { DefaultizedProps } from '../helpers';
1
+ import { DefaultizedProps } from '@mui/x-internals/types';
2
2
  import type { StackOffsetType } from '../stacking';
3
3
  import { CartesianSeriesType, CommonSeriesType, CommonDefaultizedProps, StackableSeriesType } from './common';
4
4
  export interface BarSeriesType extends CommonSeriesType<number | null>, CartesianSeriesType, StackableSeriesType {
@@ -25,16 +25,6 @@ export type CommonSeriesType<TValue> = {
25
25
  };
26
26
  export type CommonDefaultizedProps = 'id' | 'valueFormatter' | 'data';
27
27
  export type CartesianSeriesType = {
28
- /**
29
- * The id of the x-axis used to render the series.
30
- * @deprecated Use `xAxisId` instead
31
- */
32
- xAxisKey?: string;
33
- /**
34
- * The id of the y-axis used to render the series.
35
- * @deprecated Use `xAxisId` instead
36
- */
37
- yAxisKey?: string;
38
28
  /**
39
29
  * The id of the x-axis used to render the series.
40
30
  */
@@ -1,8 +1,8 @@
1
+ import { DefaultizedProps, MakeOptional } from '@mui/x-internals/types';
1
2
  import { ScatterSeriesType, DefaultizedScatterSeriesType, ScatterItemIdentifier, ScatterValueType } from './scatter';
2
3
  import { LineSeriesType, DefaultizedLineSeriesType, LineItemIdentifier } from './line';
3
4
  import { BarItemIdentifier, BarSeriesType, DefaultizedBarSeriesType } from './bar';
4
5
  import { PieSeriesType, DefaultizedPieSeriesType, PieItemIdentifier, PieValueType, DefaultizedPieValueType } from './pie';
5
- import { DefaultizedProps, MakeOptional } from '../helpers';
6
6
  export interface ChartsSeriesConfig {
7
7
  bar: {
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { DefaultizedProps } from '../helpers';
1
+ import { DefaultizedProps } from '@mui/x-internals/types';
2
2
  import type { StackOffsetType } from '../stacking';
3
3
  import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, SeriesId, StackableSeriesType } from './common';
4
4
  export type CurveType = 'catmullRom' | 'linear' | 'monotoneX' | 'monotoneY' | 'natural' | 'step' | 'stepBefore' | 'stepAfter';
@@ -1,5 +1,5 @@
1
1
  import { PieArcDatum as D3PieArcDatum } from '@mui/x-charts-vendor/d3-shape';
2
- import { DefaultizedProps } from '../helpers';
2
+ import { DefaultizedProps } from '@mui/x-internals/types';
3
3
  import { CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
4
4
  export type PieItemId = string | number;
5
5
  export type PieValueType = {
@@ -1,4 +1,4 @@
1
- import { DefaultizedProps } from '../helpers';
1
+ import { DefaultizedProps } from '@mui/x-internals/types';
2
2
  import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
3
3
  export type ScatterValueType = {
4
4
  x: number;
@@ -22,11 +22,6 @@ export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType>, C
22
22
  * @default false
23
23
  */
24
24
  disableHover?: boolean;
25
- /**
26
- * The id of the z-axis used to render the series.
27
- * @deprecated Use `zAxisId` instead.
28
- */
29
- zAxisKey?: string;
30
25
  /**
31
26
  * The id of the z-axis used to render the series.
32
27
  */
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ const _excluded = ["ownerState"];
6
+ import * as React from 'react';
7
+ import { animated } from '@react-spring/web';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ /**
10
+ * @ignore - internal component.
11
+ */
12
+ export function AnimatedBarElement(props) {
13
+ const {
14
+ ownerState
15
+ } = props,
16
+ other = _objectWithoutPropertiesLoose(props, _excluded);
17
+ return /*#__PURE__*/_jsx(animated.rect, _extends({}, other, {
18
+ filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
19
+ opacity: ownerState.isFaded ? 0.3 : 1
20
+ }));
21
+ }
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useThemeProps } from '@mui/material/styles';
7
7
  import { BarPlot } from "./BarPlot.js";
8
- import { ResponsiveChartContainer } from "../ResponsiveChartContainer/index.js";
8
+ import { ChartContainer } from "../ChartContainer/index.js";
9
9
  import { ChartsAxis } from "../ChartsAxis/index.js";
10
10
  import { ChartsTooltip } from "../ChartsTooltip/index.js";
11
11
  import { ChartsLegend } from "../ChartsLegend/index.js";
@@ -43,15 +43,15 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
43
43
  chartsAxisProps,
44
44
  axisHighlightProps,
45
45
  legendProps,
46
- tooltipProps,
47
46
  children
48
47
  } = useBarChartProps(props);
49
- return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({
48
+ const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
49
+ return /*#__PURE__*/_jsxs(ChartContainer, _extends({
50
50
  ref: ref
51
51
  }, chartContainerProps, {
52
52
  children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
53
53
  children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
54
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
54
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
55
55
  }));
56
56
  });
57
57
  process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
@@ -63,7 +63,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
63
63
  * The configuration of axes highlight.
64
64
  * Default is set to 'band' in the bar direction.
65
65
  * Depends on `layout` prop.
66
- * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
66
+ * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
67
67
  */
68
68
  axisHighlight: PropTypes.shape({
69
69
  x: PropTypes.oneOf(['band', 'line', 'none']),
@@ -116,6 +116,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
116
116
  * The height of the chart in px. If not defined, it takes the height of the parent element.
117
117
  */
118
118
  height: PropTypes.number,
119
+ /**
120
+ * If `true`, the legend is not rendered.
121
+ */
122
+ hideLegend: PropTypes.bool,
119
123
  /**
120
124
  * The item currently highlighted. Turns highlighting into a controlled prop.
121
125
  */
@@ -134,32 +138,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
134
138
  * @default yAxisIds[0] The id of the first provided axis
135
139
  */
136
140
  leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
137
- /**
138
- * @deprecated Consider using `slotProps.legend` instead.
139
- */
140
- legend: PropTypes.shape({
141
- classes: PropTypes.object,
142
- direction: PropTypes.oneOf(['column', 'row']),
143
- hidden: PropTypes.bool,
144
- itemGap: PropTypes.number,
145
- itemMarkHeight: PropTypes.number,
146
- itemMarkWidth: PropTypes.number,
147
- labelStyle: PropTypes.object,
148
- markGap: PropTypes.number,
149
- onItemClick: PropTypes.func,
150
- padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
151
- bottom: PropTypes.number,
152
- left: PropTypes.number,
153
- right: PropTypes.number,
154
- top: PropTypes.number
155
- })]),
156
- position: PropTypes.shape({
157
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
158
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
159
- }),
160
- slotProps: PropTypes.object,
161
- slots: PropTypes.object
162
- }),
163
141
  /**
164
142
  * If `true`, a loading overlay is displayed.
165
143
  * @default false
@@ -196,16 +174,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
196
174
  * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
197
175
  */
198
176
  onItemClick: PropTypes.func,
199
- /**
200
- * The chart will try to wait for the parent container to resolve its size
201
- * before it renders for the first time.
202
- *
203
- * This can be useful in some scenarios where the chart appear to grow after
204
- * the first render, like when used inside a grid.
205
- *
206
- * @default false
207
- */
208
- resolveSizeBeforeRender: PropTypes.bool,
209
177
  /**
210
178
  * Indicate which axis to display the right of the charts.
211
179
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -234,30 +202,12 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
234
202
  slots: PropTypes.object,
235
203
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
236
204
  title: PropTypes.string,
237
- /**
238
- * The configuration of the tooltip.
239
- * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
240
- */
241
- tooltip: PropTypes.shape({
242
- axisContent: PropTypes.elementType,
243
- classes: PropTypes.object,
244
- itemContent: PropTypes.elementType,
245
- slotProps: PropTypes.object,
246
- slots: PropTypes.object,
247
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
248
- }),
249
205
  /**
250
206
  * Indicate which axis to display the top of the charts.
251
207
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
252
208
  * @default null
253
209
  */
254
210
  topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
255
- viewBox: PropTypes.shape({
256
- height: PropTypes.number,
257
- width: PropTypes.number,
258
- x: PropTypes.number,
259
- y: PropTypes.number
260
- }),
261
211
  /**
262
212
  * The width of the chart in px. If not defined, it takes the width of the parent element.
263
213
  */
@@ -8,39 +8,27 @@ import PropTypes from 'prop-types';
8
8
  import composeClasses from '@mui/utils/composeClasses';
9
9
  import useSlotProps from '@mui/utils/useSlotProps';
10
10
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
11
- import { styled } from '@mui/material/styles';
12
11
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
13
- import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
14
- import { animated } from '@react-spring/web';
15
12
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
16
13
  import { useItemHighlighted } from "../context/index.js";
14
+ import { AnimatedBarElement } from "./AnimatedBarElement.js";
17
15
  import { jsx as _jsx } from "react/jsx-runtime";
18
16
  export function getBarElementUtilityClass(slot) {
19
17
  return generateUtilityClass('MuiBarElement', slot);
20
18
  }
21
- export const barElementClasses = generateUtilityClasses('MuiBarElement', ['root']);
19
+ export const barElementClasses = generateUtilityClasses('MuiBarElement', ['root', 'highlighted', 'faded']);
22
20
  const useUtilityClasses = ownerState => {
23
21
  const {
24
22
  classes,
25
- id
23
+ id,
24
+ isHighlighted,
25
+ isFaded
26
26
  } = ownerState;
27
27
  const slots = {
28
- root: ['root', `series-${id}`]
28
+ root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
29
29
  };
30
30
  return composeClasses(slots, getBarElementUtilityClass, classes);
31
31
  };
32
- export const BarElementPath = styled(animated.rect, {
33
- name: 'MuiBarElement',
34
- slot: 'Root',
35
- overridesResolver: (_, styles) => styles.root
36
- })(({
37
- ownerState
38
- }) => ({
39
- stroke: 'none',
40
- fill: ownerState.isHighlighted ? d3Color(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
41
- transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
42
- opacity: ownerState.isFaded && 0.3 || 1
43
- }));
44
32
  function BarElement(props) {
45
33
  const {
46
34
  id,
@@ -70,7 +58,7 @@ function BarElement(props) {
70
58
  isHighlighted
71
59
  };
72
60
  const classes = useUtilityClasses(ownerState);
73
- const Bar = slots?.bar ?? BarElementPath;
61
+ const Bar = slots?.bar ?? AnimatedBarElement;
74
62
  const barProps = useSlotProps({
75
63
  elementType: Bar,
76
64
  externalSlotProps: slotProps?.bar,
@@ -82,7 +70,9 @@ function BarElement(props) {
82
70
  }), {
83
71
  style,
84
72
  onClick,
85
- cursor: onClick ? 'pointer' : 'unset'
73
+ cursor: onClick ? 'pointer' : 'unset',
74
+ stroke: 'none',
75
+ fill: color
86
76
  }),
87
77
  className: classes.root,
88
78
  ownerState
@@ -6,10 +6,11 @@ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useTransition } from '@react-spring/web';
9
+ import { styled } from '@mui/material/styles';
9
10
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
10
- import { BarElement } from "./BarElement.js";
11
+ import { BarElement, barElementClasses } from "./BarElement.js";
11
12
  import getColor from "./getColor.js";
12
- import { useChartId } from "../hooks/index.js";
13
+ import { useChartId, useDrawingArea } from "../hooks/index.js";
13
14
  import { BarClipPath } from "./BarClipPath.js";
14
15
  import { BarLabelPlot } from "./BarLabel/BarLabelPlot.js";
15
16
  import { checkScaleErrors } from "./checkScaleErrors.js";
@@ -51,6 +52,7 @@ const useAggregatedData = () => {
51
52
  seriesOrder: []
52
53
  };
53
54
  const axisData = useCartesianContext();
55
+ const drawingArea = useDrawingArea();
54
56
  const chartId = useChartId();
55
57
  const {
56
58
  series,
@@ -68,9 +70,13 @@ const useAggregatedData = () => {
68
70
  const data = stackingGroups.flatMap(({
69
71
  ids: groupIds
70
72
  }, groupIndex) => {
73
+ const xMin = drawingArea.left;
74
+ const xMax = drawingArea.left + drawingArea.width;
75
+ const yMin = drawingArea.top;
76
+ const yMax = drawingArea.top + drawingArea.height;
71
77
  return groupIds.flatMap(seriesId => {
72
- const xAxisId = series[seriesId].xAxisId ?? series[seriesId].xAxisKey ?? defaultXAxisId;
73
- const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey ?? defaultYAxisId;
78
+ const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
79
+ const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
74
80
  const xAxisConfig = xAxis[xAxisId];
75
81
  const yAxisConfig = yAxis[yAxisId];
76
82
  const verticalLayout = series[seriesId].layout === 'vertical';
@@ -111,6 +117,9 @@ const useAggregatedData = () => {
111
117
  value: series[seriesId].data[dataIndex],
112
118
  maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
113
119
  };
120
+ if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
121
+ return null;
122
+ }
114
123
  if (!masks[result.maskId]) {
115
124
  masks[result.maskId] = {
116
125
  id: result.maskId,
@@ -133,7 +142,7 @@ const useAggregatedData = () => {
133
142
  mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
134
143
  mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
135
144
  return result;
136
- });
145
+ }).filter(rectangle => rectangle !== null);
137
146
  });
138
147
  });
139
148
  return {
@@ -171,6 +180,15 @@ const enterStyle = ({
171
180
  height,
172
181
  width
173
182
  });
183
+ const BarPlotRoot = styled('g', {
184
+ name: 'MuiBarPlot',
185
+ slot: 'Root',
186
+ overridesResolver: (_, styles) => styles.root
187
+ })({
188
+ [`& .${barElementClasses.root}`]: {
189
+ transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
190
+ }
191
+ });
174
192
 
175
193
  /**
176
194
  * Demos:
@@ -213,7 +231,7 @@ function BarPlot(props) {
213
231
  update: enterStyle,
214
232
  immediate: skipAnimation
215
233
  });
216
- return /*#__PURE__*/_jsxs(React.Fragment, {
234
+ return /*#__PURE__*/_jsxs(BarPlotRoot, {
217
235
  children: [!withoutBorderRadius && maskTransition((style, {
218
236
  id,
219
237
  hasPositive,
@@ -36,7 +36,7 @@ const getValueExtremum = direction => params => {
36
36
  isDefaultAxis
37
37
  } = params;
38
38
  return Object.keys(series).filter(seriesId => {
39
- const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
39
+ const yAxisId = series[seriesId].yAxisId;
40
40
  return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
41
41
  }).reduce((acc, seriesId) => {
42
42
  const {
@@ -45,8 +45,8 @@ const getValueExtremum = direction => params => {
45
45
  const filter = getFilters?.({
46
46
  currentAxisId: axis.id,
47
47
  isDefaultAxis,
48
- seriesXAxisId: series[seriesId].xAxisId ?? series[seriesId].xAxisKey,
49
- seriesYAxisId: series[seriesId].yAxisId ?? series[seriesId].yAxisKey
48
+ seriesXAxisId: series[seriesId].xAxisId,
49
+ seriesYAxisId: series[seriesId].yAxisId
50
50
  });
51
51
  const [seriesMin, seriesMax] = stackedData?.reduce((seriesAcc, values, index) => {
52
52
  if (filter && (!filter(createResult(values[0], direction), index) || !filter(createResult(values[1], direction), index))) {
@@ -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 = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "axisHighlight", "legend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className"];
5
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
6
6
  import useId from '@mui/utils/useId';
7
7
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
8
8
  /**
@@ -23,10 +23,8 @@ export const useBarChartProps = props => {
23
23
  colors,
24
24
  dataset,
25
25
  sx,
26
- tooltip,
27
26
  onAxisClick,
28
27
  axisHighlight,
29
- legend,
30
28
  grid,
31
29
  topAxis,
32
30
  leftAxis,
@@ -75,7 +73,7 @@ export const useBarChartProps = props => {
75
73
  sx,
76
74
  highlightedItem,
77
75
  onHighlightChange,
78
- disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
76
+ disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
79
77
  className,
80
78
  skipAnimation
81
79
  });
@@ -117,14 +115,10 @@ export const useBarChartProps = props => {
117
115
  } : {
118
116
  x: 'band'
119
117
  }, axisHighlight);
120
- const legendProps = _extends({}, legend, {
118
+ const legendProps = {
121
119
  slots,
122
120
  slotProps
123
- });
124
- const tooltipProps = _extends({}, tooltip, {
125
- slots,
126
- slotProps
127
- });
121
+ };
128
122
  return {
129
123
  chartContainerProps,
130
124
  barPlotProps,
@@ -136,7 +130,6 @@ export const useBarChartProps = props => {
136
130
  chartsAxisProps,
137
131
  axisHighlightProps,
138
132
  legendProps,
139
- tooltipProps,
140
133
  children
141
134
  };
142
135
  };
@@ -3,45 +3,22 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { DrawingProvider } from "../context/DrawingProvider.js";
7
- import { SeriesProvider } from "../context/SeriesProvider/index.js";
8
- import { InteractionProvider } from "../context/InteractionProvider.js";
9
- import { ChartsSurface } from "../ChartsSurface/index.js";
10
- import { CartesianProvider } from "../context/CartesianProvider/index.js";
11
- import { ChartsAxesGradients } from "../internals/components/ChartsAxesGradients/index.js";
12
- import { HighlightedProvider, ZAxisContextProvider } from "../context/index.js";
13
- import { PluginProvider } from "../context/PluginProvider/index.js";
6
+ import { ChartDataProvider } from "../context/ChartDataProvider/index.js";
7
+ import { ResizableContainer } from "./ResizableContainer.js";
14
8
  import { useChartContainerProps } from "./useChartContainerProps.js";
15
- import { AnimationProvider } from "../context/AnimationProvider/index.js";
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { ChartsSurface } from "../ChartsSurface/index.js";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
17
11
  const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
18
12
  const {
13
+ chartDataProviderProps,
19
14
  children,
20
- drawingProviderProps,
21
- seriesProviderProps,
22
- cartesianProviderProps,
23
- zAxisContextProps,
24
- highlightedProviderProps,
25
- chartsSurfaceProps,
26
- pluginProviderProps,
27
- animationProviderProps
15
+ resizableContainerProps,
16
+ chartsSurfaceProps
28
17
  } = useChartContainerProps(props, ref);
29
- return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
30
- children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
31
- children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
32
- children: /*#__PURE__*/_jsx(CartesianProvider, _extends({}, cartesianProviderProps, {
33
- children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
34
- children: /*#__PURE__*/_jsx(InteractionProvider, {
35
- children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
36
- children: /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
37
- children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
38
- children: children
39
- }))]
40
- }))
41
- }))
42
- })
43
- }))
44
- }))
18
+ return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
19
+ children: /*#__PURE__*/_jsx(ResizableContainer, _extends({}, resizableContainerProps, {
20
+ children: /*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
21
+ children: children
45
22
  }))
46
23
  }))
47
24
  }));
@@ -70,9 +47,9 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
70
47
  */
71
48
  disableAxisListener: PropTypes.bool,
72
49
  /**
73
- * The height of the chart in px.
50
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
74
51
  */
75
- height: PropTypes.number.isRequired,
52
+ height: PropTypes.number,
76
53
  /**
77
54
  * The item currently highlighted. Turns highlighting into a controlled prop.
78
55
  */
@@ -116,16 +93,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
116
93
  skipAnimation: PropTypes.bool,
117
94
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
118
95
  title: PropTypes.string,
119
- viewBox: PropTypes.shape({
120
- height: PropTypes.number,
121
- width: PropTypes.number,
122
- x: PropTypes.number,
123
- y: PropTypes.number
124
- }),
125
96
  /**
126
- * The width of the chart in px.
97
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
127
98
  */
128
- width: PropTypes.number.isRequired,
99
+ width: PropTypes.number,
129
100
  /**
130
101
  * The configuration of the x-axes.
131
102
  * If not provided, a default axis config is used.