@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
@@ -6,25 +6,9 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { animated, useTransition } from '@react-spring/web';
9
- import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
10
- import { styled } from '@mui/material/styles';
11
9
  import { useStringInterpolator } from "../internals/useStringInterpolator.js";
12
10
  import { AppearingMask } from "./AppearingMask.js";
13
11
  import { jsx as _jsx } from "react/jsx-runtime";
14
- export const LineElementPath = styled(animated.path, {
15
- name: 'MuiLineElement',
16
- slot: 'Root',
17
- overridesResolver: (_, styles) => styles.root
18
- })(({
19
- ownerState
20
- }) => ({
21
- strokeWidth: 2,
22
- strokeLinejoin: 'round',
23
- fill: 'none',
24
- stroke: ownerState.gradientId && `url(#${ownerState.gradientId})` || ownerState.isHighlighted && d3Color(ownerState.color).brighter(0.5).formatHex() || ownerState.color,
25
- transition: 'opacity 0.2s ease-in, stroke 0.2s ease-in',
26
- opacity: ownerState.isFaded ? 0.3 : 1
27
- }));
28
12
  /**
29
13
  * Demos:
30
14
  *
@@ -59,10 +43,15 @@ function AnimatedLine(props) {
59
43
  return /*#__PURE__*/_jsx(AppearingMask, {
60
44
  skipAnimation: skipAnimation,
61
45
  id: `${ownerState.id}-line-clip`,
62
- children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(LineElementPath, _extends({}, other, {
63
- ownerState: ownerState,
64
- d: style.value.to(interpolator)
65
- })))
46
+ children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(animated.path, _extends({
47
+ d: style.value.to(interpolator),
48
+ stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
49
+ strokeWidth: 2,
50
+ strokeLinejoin: "round",
51
+ fill: "none",
52
+ filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
53
+ opacity: ownerState.isFaded ? 0.3 : 1
54
+ }, other)))
66
55
  });
67
56
  }
68
57
  process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
2
+ import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
3
3
  import { AnimatedAreaProps } from './AnimatedArea';
4
4
  import { SeriesId } from '../models/seriesType/common';
5
5
  export interface AreaElementClasses {
@@ -5,9 +5,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { styled } from '@mui/material/styles';
8
9
  import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
9
10
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
10
- import { AreaElement } from "./AreaElement.js";
11
+ import { AreaElement, areaElementClasses } from "./AreaElement.js";
11
12
  import { getValueToPositionMapper } from "../hooks/useScale.js";
12
13
  import getCurveFactory from "../internals/getCurve.js";
13
14
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
@@ -15,6 +16,15 @@ import { useChartGradient } from "../internals/components/ChartsAxesGradients/in
15
16
  import { useLineSeries } from "../hooks/useSeries.js";
16
17
  import { useSkipAnimation } from "../context/AnimationProvider/index.js";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ const AreaPlotRoot = styled('g', {
20
+ name: 'MuiAreaPlot',
21
+ slot: 'Root',
22
+ overridesResolver: (_, styles) => styles.root
23
+ })({
24
+ [`& .${areaElementClasses.root}`]: {
25
+ transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
26
+ }
27
+ });
18
28
  const useAggregatedData = () => {
19
29
  const seriesData = useLineSeries();
20
30
  const axisData = useCartesianContext();
@@ -42,17 +52,13 @@ const useAggregatedData = () => {
42
52
  return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
43
53
  .map(seriesId => {
44
54
  const {
45
- xAxisId: xAxisIdProp,
46
- yAxisId: yAxisIdProp,
47
- xAxisKey = defaultXAxisId,
48
- yAxisKey = defaultYAxisId,
55
+ xAxisId = defaultXAxisId,
56
+ yAxisId = defaultYAxisId,
49
57
  stackedData,
50
58
  data,
51
59
  connectNulls,
52
60
  baseline
53
61
  } = series[seriesId];
54
- const xAxisId = xAxisIdProp ?? xAxisKey;
55
- const yAxisId = yAxisIdProp ?? yAxisKey;
56
62
  const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
57
63
  const yScale = yAxis[yAxisId].scale;
58
64
  const xData = xAxis[xAxisId].data;
@@ -121,7 +127,7 @@ function AreaPlot(props) {
121
127
  const skipAnimation = useSkipAnimation(inSkipAnimation);
122
128
  const getGradientId = useChartGradient();
123
129
  const completedData = useAggregatedData();
124
- return /*#__PURE__*/_jsx("g", _extends({}, other, {
130
+ return /*#__PURE__*/_jsx(AreaPlotRoot, _extends({}, other, {
125
131
  children: completedData.map(({
126
132
  d,
127
133
  seriesId,
@@ -8,10 +8,12 @@ import PropTypes from 'prop-types';
8
8
  import { useTheme } from '@mui/material/styles';
9
9
  import { warnOnce } from '@mui/x-internals/warning';
10
10
  import { animated, useSpring } from '@react-spring/web';
11
- import { InteractionContext } from "../context/InteractionProvider.js";
12
11
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
13
12
  import { useItemHighlighted } from "../context/index.js";
14
13
  import { useUtilityClasses } from "./markElementClasses.js";
14
+ import { useSelector } from "../internals/useSelector.js";
15
+ import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
16
+ import { useStore } from "../internals/useStore.js";
15
17
  import { jsx as _jsx } from "react/jsx-runtime";
16
18
  /**
17
19
  * The line mark element that only render circle for performance improvement.
@@ -49,9 +51,8 @@ function CircleMarkElement(props) {
49
51
  } = useItemHighlighted({
50
52
  seriesId: id
51
53
  });
52
- const {
53
- axis
54
- } = React.useContext(InteractionContext);
54
+ const store = useStore();
55
+ const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
55
56
  const position = useSpring({
56
57
  to: {
57
58
  x,
@@ -62,7 +63,7 @@ function CircleMarkElement(props) {
62
63
  const ownerState = {
63
64
  id,
64
65
  classes: innerClasses,
65
- isHighlighted: axis.x?.index === dataIndex || isHighlighted,
66
+ isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
66
67
  isFaded,
67
68
  color
68
69
  };
@@ -1,49 +1,43 @@
1
1
  import * as React from 'react';
2
+ import { MakeOptional } from '@mui/x-internals/types';
2
3
  import { AreaPlotProps, AreaPlotSlotProps, AreaPlotSlots } from './AreaPlot';
3
4
  import { LinePlotProps, LinePlotSlotProps, LinePlotSlots } from './LinePlot';
4
- import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
5
+ import { ChartContainerProps } from '../ChartContainer';
5
6
  import { MarkPlotProps, MarkPlotSlotProps, MarkPlotSlots } from './MarkPlot';
6
7
  import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
7
8
  import { LineSeriesType } from '../models/seriesType/line';
8
- import { MakeOptional } from '../models/helpers';
9
- import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
10
- import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
9
+ import { ChartsTooltipSlots, ChartsTooltipSlotProps } from '../ChartsTooltip/ChartTooltip.types';
10
+ import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
11
11
  import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
12
12
  import { ChartsAxisSlotProps, ChartsAxisSlots } from '../models/axis';
13
13
  import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from './LineHighlightPlot';
14
14
  import { ChartsGridProps } from '../ChartsGrid';
15
15
  import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
16
16
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
17
- export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots<'line'>, ChartsOverlaySlots {
17
+ export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {
18
18
  }
19
- export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'line'>, ChartsOverlaySlotProps {
19
+ export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {
20
20
  }
21
- export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
21
+ export interface LineChartProps extends Omit<ChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
22
22
  /**
23
23
  * The series to display in the line chart.
24
24
  * An array of [[LineSeriesType]] objects.
25
25
  */
26
26
  series: MakeOptional<LineSeriesType, 'type'>[];
27
- /**
28
- * The configuration of the tooltip.
29
- * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
30
- * @default { trigger: 'item' }
31
- */
32
- tooltip?: ChartsTooltipProps<'line'>;
33
27
  /**
34
28
  * Option to display a cartesian grid in the background.
35
29
  */
36
30
  grid?: Pick<ChartsGridProps, 'vertical' | 'horizontal'>;
37
31
  /**
38
32
  * The configuration of axes highlight.
39
- * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
33
+ * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
40
34
  * @default { x: 'line' }
41
35
  */
42
36
  axisHighlight?: ChartsAxisHighlightProps;
43
37
  /**
44
- * @deprecated Consider using `slotProps.legend` instead.
38
+ * If `true`, the legend is not rendered.
45
39
  */
46
- legend?: ChartsLegendProps;
40
+ hideLegend?: boolean;
47
41
  /**
48
42
  * If `true`, render the line highlight item.
49
43
  */
@@ -90,5 +84,5 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
90
84
  *
91
85
  * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
92
86
  */
93
- declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<unknown>>;
87
+ declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<SVGSVGElement>>;
94
88
  export { LineChart };
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { useThemeProps } from '@mui/material/styles';
7
7
  import { AreaPlot } from "./AreaPlot.js";
8
8
  import { LinePlot } from "./LinePlot.js";
9
- import { ResponsiveChartContainer } from "../ResponsiveChartContainer/index.js";
9
+ import { ChartContainer } from "../ChartContainer/index.js";
10
10
  import { MarkPlot } from "./MarkPlot.js";
11
11
  import { ChartsAxis } from "../ChartsAxis/ChartsAxis.js";
12
12
  import { ChartsTooltip } from "../ChartsTooltip/index.js";
@@ -48,10 +48,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
48
48
  axisHighlightProps,
49
49
  lineHighlightPlotProps,
50
50
  legendProps,
51
- tooltipProps,
52
51
  children
53
52
  } = useLineChartProps(props);
54
- return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({
53
+ const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
54
+ return /*#__PURE__*/_jsxs(ChartContainer, _extends({
55
55
  ref: ref
56
56
  }, chartContainerProps, {
57
57
  children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
@@ -59,7 +59,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
59
59
  })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
60
60
  "data-drawing-container": true,
61
61
  children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
62
- }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
62
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
63
63
  }));
64
64
  });
65
65
  process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
@@ -69,7 +69,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
69
69
  // ----------------------------------------------------------------------
70
70
  /**
71
71
  * The configuration of axes highlight.
72
- * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
72
+ * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
73
73
  * @default { x: 'line' }
74
74
  */
75
75
  axisHighlight: PropTypes.shape({
@@ -119,6 +119,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
119
119
  * The height of the chart in px. If not defined, it takes the height of the parent element.
120
120
  */
121
121
  height: PropTypes.number,
122
+ /**
123
+ * If `true`, the legend is not rendered.
124
+ */
125
+ hideLegend: PropTypes.bool,
122
126
  /**
123
127
  * The item currently highlighted. Turns highlighting into a controlled prop.
124
128
  */
@@ -132,32 +136,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
132
136
  * @default yAxisIds[0] The id of the first provided axis
133
137
  */
134
138
  leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
135
- /**
136
- * @deprecated Consider using `slotProps.legend` instead.
137
- */
138
- legend: PropTypes.shape({
139
- classes: PropTypes.object,
140
- direction: PropTypes.oneOf(['column', 'row']),
141
- hidden: PropTypes.bool,
142
- itemGap: PropTypes.number,
143
- itemMarkHeight: PropTypes.number,
144
- itemMarkWidth: PropTypes.number,
145
- labelStyle: PropTypes.object,
146
- markGap: PropTypes.number,
147
- onItemClick: PropTypes.func,
148
- padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
149
- bottom: PropTypes.number,
150
- left: PropTypes.number,
151
- right: PropTypes.number,
152
- top: PropTypes.number
153
- })]),
154
- position: PropTypes.shape({
155
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
156
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
157
- }),
158
- slotProps: PropTypes.object,
159
- slots: PropTypes.object
160
- }),
161
139
  /**
162
140
  * If `true`, a loading overlay is displayed.
163
141
  * @default false
@@ -200,16 +178,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
200
178
  * Callback fired when a mark element is clicked.
201
179
  */
202
180
  onMarkClick: PropTypes.func,
203
- /**
204
- * The chart will try to wait for the parent container to resolve its size
205
- * before it renders for the first time.
206
- *
207
- * This can be useful in some scenarios where the chart appear to grow after
208
- * the first render, like when used inside a grid.
209
- *
210
- * @default false
211
- */
212
- resolveSizeBeforeRender: PropTypes.bool,
213
181
  /**
214
182
  * Indicate which axis to display the right of the charts.
215
183
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -238,31 +206,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
238
206
  slots: PropTypes.object,
239
207
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
240
208
  title: PropTypes.string,
241
- /**
242
- * The configuration of the tooltip.
243
- * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
244
- * @default { trigger: 'item' }
245
- */
246
- tooltip: PropTypes.shape({
247
- axisContent: PropTypes.elementType,
248
- classes: PropTypes.object,
249
- itemContent: PropTypes.elementType,
250
- slotProps: PropTypes.object,
251
- slots: PropTypes.object,
252
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
253
- }),
254
209
  /**
255
210
  * Indicate which axis to display the top of the charts.
256
211
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
257
212
  * @default null
258
213
  */
259
214
  topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
260
- viewBox: PropTypes.shape({
261
- height: PropTypes.number,
262
- width: PropTypes.number,
263
- x: PropTypes.number,
264
- y: PropTypes.number
265
- }),
266
215
  /**
267
216
  * The width of the chart in px. If not defined, it takes the width of the parent element.
268
217
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
2
+ import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
3
3
  import { AnimatedLineProps } from './AnimatedLine';
4
4
  import { SeriesId } from '../models/seriesType/common';
5
5
  export interface LineElementClasses {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SlotComponentPropsFromProps } from '../internals/SlotComponentPropsFromProps';
2
+ import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
3
3
  import { LineHighlightElementProps } from './LineHighlightElement';
4
4
  export interface LineHighlightPlotSlots {
5
5
  lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
@@ -5,14 +5,16 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["slots", "slotProps"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { useStore } from "../internals/useStore.js";
9
+ import { useSelector } from "../internals/useSelector.js";
8
10
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
9
11
  import { LineHighlightElement } from "./LineHighlightElement.js";
10
12
  import { getValueToPositionMapper } from "../hooks/useScale.js";
11
- import { InteractionContext } from "../context/InteractionProvider.js";
12
13
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
13
14
  import getColor from "./getColor.js";
14
15
  import { useLineSeries } from "../hooks/useSeries.js";
15
16
  import { useDrawingArea } from "../hooks/useDrawingArea.js";
17
+ import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
16
18
  import { jsx as _jsx } from "react/jsx-runtime";
17
19
  /**
18
20
  * Demos:
@@ -33,10 +35,9 @@ function LineHighlightPlot(props) {
33
35
  const seriesData = useLineSeries();
34
36
  const axisData = useCartesianContext();
35
37
  const drawingArea = useDrawingArea();
36
- const {
37
- axis
38
- } = React.useContext(InteractionContext);
39
- const highlightedIndex = axis.x?.index;
38
+ const store = useStore();
39
+ const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
40
+ const highlightedIndex = xAxisIdentifier?.index;
40
41
  if (highlightedIndex === undefined) {
41
42
  return null;
42
43
  }
@@ -62,16 +63,12 @@ function LineHighlightPlot(props) {
62
63
  }) => {
63
64
  return groupIds.flatMap(seriesId => {
64
65
  const {
65
- xAxisId: xAxisIdProp,
66
- yAxisId: yAxisIdProp,
67
- xAxisKey = defaultXAxisId,
68
- yAxisKey = defaultYAxisId,
66
+ xAxisId = defaultXAxisId,
67
+ yAxisId = defaultYAxisId,
69
68
  stackedData,
70
69
  data,
71
70
  disableHighlight
72
71
  } = series[seriesId];
73
- const xAxisId = xAxisIdProp ?? xAxisKey;
74
- const yAxisId = yAxisIdProp ?? yAxisKey;
75
72
  if (disableHighlight || data[highlightedIndex] == null) {
76
73
  return null;
77
74
  }
@@ -5,9 +5,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { styled } from '@mui/material/styles';
8
9
  import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
9
10
  import { useCartesianContext } from "../context/CartesianProvider/index.js";
10
- import { LineElement } from "./LineElement.js";
11
+ import { LineElement, lineElementClasses } from "./LineElement.js";
11
12
  import { getValueToPositionMapper } from "../hooks/useScale.js";
12
13
  import getCurveFactory from "../internals/getCurve.js";
13
14
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
@@ -15,6 +16,15 @@ import { useChartGradient } from "../internals/components/ChartsAxesGradients/in
15
16
  import { useLineSeries } from "../hooks/useSeries.js";
16
17
  import { useSkipAnimation } from "../context/AnimationProvider/index.js";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ const LinePlotRoot = styled('g', {
20
+ name: 'MuiAreaPlot',
21
+ slot: 'Root',
22
+ overridesResolver: (_, styles) => styles.root
23
+ })({
24
+ [`& .${lineElementClasses.root}`]: {
25
+ transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
26
+ }
27
+ });
18
28
  const useAggregatedData = () => {
19
29
  const seriesData = useLineSeries();
20
30
  const axisData = useCartesianContext();
@@ -41,16 +51,12 @@ const useAggregatedData = () => {
41
51
  }) => {
42
52
  return groupIds.flatMap(seriesId => {
43
53
  const {
44
- xAxisId: xAxisIdProp,
45
- yAxisId: yAxisIdProp,
46
- xAxisKey = defaultXAxisId,
47
- yAxisKey = defaultYAxisId,
54
+ xAxisId = defaultXAxisId,
55
+ yAxisId = defaultYAxisId,
48
56
  stackedData,
49
57
  data,
50
58
  connectNulls
51
59
  } = series[seriesId];
52
- const xAxisId = xAxisIdProp ?? xAxisKey;
53
- const yAxisId = yAxisIdProp ?? yAxisKey;
54
60
  const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
55
61
  const yScale = yAxis[yAxisId].scale;
56
62
  const xData = xAxis[xAxisId].data;
@@ -102,7 +108,7 @@ function LinePlot(props) {
102
108
  const skipAnimation = useSkipAnimation(inSkipAnimation);
103
109
  const getGradientId = useChartGradient();
104
110
  const completedData = useAggregatedData();
105
- return /*#__PURE__*/_jsx("g", _extends({}, other, {
111
+ return /*#__PURE__*/_jsx(LinePlotRoot, _extends({}, other, {
106
112
  children: completedData.map(({
107
113
  d,
108
114
  seriesId,
@@ -9,10 +9,12 @@ import { styled } from '@mui/material/styles';
9
9
  import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-vendor/d3-shape';
10
10
  import { animated, to, useSpring } from '@react-spring/web';
11
11
  import { getSymbol } from "../internals/getSymbol.js";
12
- import { InteractionContext } from "../context/InteractionProvider.js";
13
12
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
14
13
  import { useItemHighlighted } from "../context/index.js";
15
14
  import { useUtilityClasses } from "./markElementClasses.js";
15
+ import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
16
+ import { useSelector } from "../internals/useSelector.js";
17
+ import { useStore } from "../internals/useStore.js";
16
18
  import { jsx as _jsx } from "react/jsx-runtime";
17
19
  const MarkElementPath = styled(animated.path, {
18
20
  name: 'MuiMarkElement',
@@ -56,9 +58,8 @@ function MarkElement(props) {
56
58
  } = useItemHighlighted({
57
59
  seriesId: id
58
60
  });
59
- const {
60
- axis
61
- } = React.useContext(InteractionContext);
61
+ const store = useStore();
62
+ const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
62
63
  const position = useSpring({
63
64
  to: {
64
65
  x,
@@ -69,7 +70,7 @@ function MarkElement(props) {
69
70
  const ownerState = {
70
71
  id,
71
72
  classes: innerClasses,
72
- isHighlighted: axis.x?.index === dataIndex || isHighlighted,
73
+ isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
73
74
  isFaded,
74
75
  color
75
76
  };
@@ -63,10 +63,8 @@ function MarkPlot(props) {
63
63
  }) => {
64
64
  return groupIds.map(seriesId => {
65
65
  const {
66
- xAxisId: xAxisIdProp,
67
- yAxisId: yAxisIdProp,
68
- xAxisKey = defaultXAxisId,
69
- yAxisKey = defaultYAxisId,
66
+ xAxisId = defaultXAxisId,
67
+ yAxisId = defaultYAxisId,
70
68
  stackedData,
71
69
  data,
72
70
  showMark = true
@@ -74,8 +72,6 @@ function MarkPlot(props) {
74
72
  if (showMark === false) {
75
73
  return null;
76
74
  }
77
- const xAxisId = xAxisIdProp ?? xAxisKey;
78
- const yAxisId = yAxisIdProp ?? yAxisKey;
79
75
  const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
80
76
  const yScale = yAxis[yAxisId].scale;
81
77
  const xData = xAxis[xAxisId].data;
@@ -6,8 +6,11 @@ export const getExtremumX = params => {
6
6
  const maxX = Math.max(...(axis.data ?? []));
7
7
  return [minX, maxX];
8
8
  };
9
- function getSeriesExtremums(getValues, stackedData, filter) {
9
+ function getSeriesExtremums(getValues, data, stackedData, filter) {
10
10
  return stackedData.reduce((seriesAcc, stackedValue, index) => {
11
+ if (data[index] === null) {
12
+ return seriesAcc;
13
+ }
11
14
  const [base, value] = getValues(stackedValue);
12
15
  if (filter && (!filter({
13
16
  y: base,
@@ -29,24 +32,25 @@ export const getExtremumY = params => {
29
32
  getFilters
30
33
  } = params;
31
34
  return Object.keys(series).filter(seriesId => {
32
- const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
35
+ const yAxisId = series[seriesId].yAxisId;
33
36
  return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
34
37
  }).reduce((acc, seriesId) => {
35
38
  const {
36
39
  area,
37
- stackedData
40
+ stackedData,
41
+ data
38
42
  } = series[seriesId];
39
43
  const isArea = area !== undefined;
40
44
  const filter = getFilters?.({
41
45
  currentAxisId: axis.id,
42
46
  isDefaultAxis,
43
- seriesXAxisId: series[seriesId].xAxisId ?? series[seriesId].xAxisKey,
44
- seriesYAxisId: series[seriesId].yAxisId ?? series[seriesId].yAxisKey
47
+ seriesXAxisId: series[seriesId].xAxisId,
48
+ seriesYAxisId: series[seriesId].yAxisId
45
49
  });
46
50
 
47
51
  // Since this series is not used to display an area, we do not consider the base (the d[0]).
48
52
  const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
49
- const seriesExtremums = getSeriesExtremums(getValues, stackedData, filter);
53
+ const seriesExtremums = getSeriesExtremums(getValues, data, stackedData, filter);
50
54
  const [seriesMin, seriesMax] = seriesExtremums;
51
55
  return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
52
56
  }, [Infinity, -Infinity]);
@@ -5,8 +5,7 @@ import { ChartsGridProps } from '../ChartsGrid';
5
5
  import { ChartsLegendProps } from '../ChartsLegend';
6
6
  import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
7
7
  import { ChartsOverlayProps } from '../ChartsOverlay';
8
- import { ChartsTooltipProps } from '../ChartsTooltip';
9
- import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
8
+ import { ChartContainerProps } from '../ChartContainer';
10
9
  import { AreaPlotProps } from './AreaPlot';
11
10
  import type { LineChartProps } from './LineChart';
12
11
  import { LineHighlightPlotProps } from './LineHighlightPlot';
@@ -20,7 +19,7 @@ import { MarkPlotProps } from './MarkPlot';
20
19
  * @returns An object with props for the children components of LineChart
21
20
  */
22
21
  export declare const useLineChartProps: (props: LineChartProps) => {
23
- chartContainerProps: ResponsiveChartContainerProps;
22
+ chartContainerProps: ChartContainerProps;
24
23
  axisClickHandlerProps: ChartsOnAxisClickHandlerProps;
25
24
  gridProps: ChartsGridProps;
26
25
  clipPathProps: ChartsClipPathProps;
@@ -35,6 +34,5 @@ export declare const useLineChartProps: (props: LineChartProps) => {
35
34
  axisHighlightProps: ChartsAxisHighlightProps;
36
35
  lineHighlightPlotProps: LineHighlightPlotProps;
37
36
  legendProps: ChartsLegendProps;
38
- tooltipProps: ChartsTooltipProps<"line">;
39
37
  children: import("react").ReactNode;
40
38
  };
@@ -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", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "legend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "experimentalMarkRendering"];
5
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "experimentalMarkRendering"];
6
6
  import useId from '@mui/utils/useId';
7
7
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
8
8
  /**
@@ -23,14 +23,12 @@ export const useLineChartProps = props => {
23
23
  colors,
24
24
  dataset,
25
25
  sx,
26
- tooltip,
27
26
  onAxisClick,
28
27
  onAreaClick,
29
28
  onLineClick,
30
29
  onMarkClick,
31
30
  axisHighlight,
32
31
  disableLineItemHighlight,
33
- legend,
34
32
  grid,
35
33
  topAxis,
36
34
  leftAxis,
@@ -70,7 +68,7 @@ export const useLineChartProps = props => {
70
68
  sx,
71
69
  highlightedItem,
72
70
  onHighlightChange,
73
- disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
71
+ disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
74
72
  className,
75
73
  skipAnimation
76
74
  });
@@ -124,14 +122,10 @@ export const useLineChartProps = props => {
124
122
  slots,
125
123
  slotProps
126
124
  };
127
- const legendProps = _extends({}, legend, {
125
+ const legendProps = {
128
126
  slots,
129
127
  slotProps
130
- });
131
- const tooltipProps = _extends({}, tooltip, {
132
- slots,
133
- slotProps
134
- });
128
+ };
135
129
  return {
136
130
  chartContainerProps,
137
131
  axisClickHandlerProps,
@@ -146,7 +140,6 @@ export const useLineChartProps = props => {
146
140
  axisHighlightProps,
147
141
  lineHighlightPlotProps,
148
142
  legendProps,
149
- tooltipProps,
150
143
  children
151
144
  };
152
145
  };