@mui/x-charts 7.6.1 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/BarChart/BarChart.d.ts +1 -1
  2. package/BarChart/BarChart.js +2 -2
  3. package/BarChart/BarPlot.js +2 -2
  4. package/BarChart/formatter.js +2 -2
  5. package/BarChart/getColor.d.ts +1 -1
  6. package/BarChart/getColor.js +4 -4
  7. package/BarChart/plugin.d.ts +2 -0
  8. package/BarChart/plugin.js +17 -0
  9. package/CHANGELOG.md +147 -0
  10. package/ChartContainer/ChartContainer.d.ts +15 -3
  11. package/ChartContainer/ChartContainer.js +70 -22
  12. package/ChartContainer/defaultPlugins.d.ts +2 -0
  13. package/ChartContainer/defaultPlugins.js +11 -0
  14. package/ChartContainer/usePluginsMerge.d.ts +10 -0
  15. package/ChartContainer/usePluginsMerge.js +39 -0
  16. package/ChartsLegend/ChartsLegend.js +2 -2
  17. package/ChartsLegend/utils.js +4 -1
  18. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
  19. package/ChartsOverlay/index.d.ts +1 -0
  20. package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
  21. package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
  22. package/ChartsText/ChartsText.js +1 -3
  23. package/ChartsTooltip/ChartsAxisTooltipContent.js +9 -15
  24. package/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
  25. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +5 -4
  26. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  27. package/ChartsTooltip/utils.d.ts +1 -7
  28. package/ChartsTooltip/utils.js +2 -10
  29. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
  30. package/ChartsXAxis/ChartsXAxis.js +17 -19
  31. package/ChartsYAxis/ChartsYAxis.js +17 -19
  32. package/LineChart/AreaPlot.js +2 -2
  33. package/LineChart/LineChart.d.ts +2 -2
  34. package/LineChart/LineChart.js +3 -3
  35. package/LineChart/LineHighlightPlot.js +2 -2
  36. package/LineChart/LinePlot.js +2 -2
  37. package/LineChart/MarkPlot.js +2 -2
  38. package/LineChart/formatter.js +2 -2
  39. package/LineChart/getColor.d.ts +1 -1
  40. package/LineChart/getColor.js +2 -2
  41. package/LineChart/plugin.d.ts +2 -0
  42. package/LineChart/plugin.js +17 -0
  43. package/PieChart/PieChart.d.ts +2 -2
  44. package/PieChart/PieChart.js +3 -3
  45. package/PieChart/PiePlot.js +2 -2
  46. package/PieChart/plugin.d.ts +2 -0
  47. package/PieChart/plugin.js +14 -0
  48. package/ResponsiveChartContainer/ResizableContainer.d.ts +10 -0
  49. package/ResponsiveChartContainer/ResizableContainer.js +32 -0
  50. package/ResponsiveChartContainer/ResponsiveChartContainer.js +32 -24
  51. package/ScatterChart/ScatterChart.d.ts +2 -2
  52. package/ScatterChart/ScatterChart.js +3 -3
  53. package/ScatterChart/ScatterPlot.js +2 -2
  54. package/ScatterChart/formatter.js +2 -3
  55. package/ScatterChart/getColor.d.ts +1 -1
  56. package/ScatterChart/getColor.js +2 -2
  57. package/ScatterChart/plugin.d.ts +2 -0
  58. package/ScatterChart/plugin.js +17 -0
  59. package/SparkLineChart/SparkLineChart.d.ts +9 -4
  60. package/SparkLineChart/SparkLineChart.js +58 -2
  61. package/context/CartesianContextProvider.d.ts +21 -10
  62. package/context/CartesianContextProvider.js +7 -20
  63. package/context/ColorProvider.d.ts +12 -0
  64. package/context/ColorProvider.js +25 -0
  65. package/context/DrawingProvider.d.ts +3 -1
  66. package/context/DrawingProvider.js +9 -2
  67. package/context/HighlightedProvider/HighlightedContext.d.ts +2 -1
  68. package/context/HighlightedProvider/HighlightedContext.js +8 -5
  69. package/context/HighlightedProvider/HighlightedProvider.js +15 -12
  70. package/context/HighlightedProvider/useHighlighted.js +6 -3
  71. package/context/HighlightedProvider/useItemHighlighted.js +2 -8
  72. package/context/SeriesContextProvider.d.ts +16 -5
  73. package/context/SeriesContextProvider.js +14 -17
  74. package/context/context.types.d.ts +4 -0
  75. package/context/context.types.js +5 -0
  76. package/esm/BarChart/BarChart.js +2 -2
  77. package/esm/BarChart/BarPlot.js +2 -2
  78. package/esm/BarChart/formatter.js +1 -1
  79. package/esm/BarChart/getColor.js +4 -4
  80. package/esm/BarChart/plugin.js +10 -0
  81. package/esm/ChartContainer/ChartContainer.js +71 -23
  82. package/esm/ChartContainer/defaultPlugins.js +5 -0
  83. package/esm/ChartContainer/usePluginsMerge.js +31 -0
  84. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  85. package/esm/ChartsLegend/utils.js +4 -1
  86. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
  87. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
  88. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
  89. package/esm/ChartsText/ChartsText.js +1 -3
  90. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
  91. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
  92. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +5 -4
  93. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  94. package/esm/ChartsTooltip/utils.js +2 -8
  95. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
  96. package/esm/ChartsXAxis/ChartsXAxis.js +17 -19
  97. package/esm/ChartsYAxis/ChartsYAxis.js +17 -19
  98. package/esm/LineChart/AreaPlot.js +2 -2
  99. package/esm/LineChart/LineChart.js +3 -3
  100. package/esm/LineChart/LineHighlightPlot.js +2 -2
  101. package/esm/LineChart/LinePlot.js +2 -2
  102. package/esm/LineChart/MarkPlot.js +2 -2
  103. package/esm/LineChart/formatter.js +1 -1
  104. package/esm/LineChart/getColor.js +2 -2
  105. package/esm/LineChart/plugin.js +10 -0
  106. package/esm/PieChart/PieChart.js +3 -3
  107. package/esm/PieChart/PiePlot.js +2 -2
  108. package/esm/PieChart/plugin.js +7 -0
  109. package/esm/ResponsiveChartContainer/ResizableContainer.js +26 -0
  110. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +31 -23
  111. package/esm/ScatterChart/ScatterChart.js +3 -3
  112. package/esm/ScatterChart/ScatterPlot.js +2 -2
  113. package/esm/ScatterChart/formatter.js +1 -1
  114. package/esm/ScatterChart/getColor.js +2 -2
  115. package/esm/ScatterChart/plugin.js +10 -0
  116. package/esm/SparkLineChart/SparkLineChart.js +58 -2
  117. package/esm/context/CartesianContextProvider.js +7 -20
  118. package/esm/context/ColorProvider.js +16 -0
  119. package/esm/context/DrawingProvider.js +9 -2
  120. package/esm/context/HighlightedProvider/HighlightedContext.js +8 -5
  121. package/esm/context/HighlightedProvider/HighlightedProvider.js +15 -12
  122. package/esm/context/HighlightedProvider/useHighlighted.js +6 -3
  123. package/esm/context/HighlightedProvider/useItemHighlighted.js +2 -6
  124. package/esm/context/SeriesContextProvider.js +14 -17
  125. package/esm/context/context.types.js +1 -0
  126. package/esm/hooks/index.js +1 -0
  127. package/esm/hooks/useColor.js +9 -0
  128. package/esm/hooks/useColorScale.js +27 -0
  129. package/esm/hooks/useInteractionItemProps.js +2 -2
  130. package/esm/hooks/useReducedMotion.js +7 -0
  131. package/esm/hooks/useSeries.js +6 -3
  132. package/esm/hooks/useSvgRef.js +6 -3
  133. package/esm/internals/configInit.js +20 -0
  134. package/esm/internals/defaultizeValueFormatter.js +2 -3
  135. package/esm/internals/index.js +27 -0
  136. package/esm/internals/isCartesian.js +7 -0
  137. package/esm/internals/warning.js +13 -0
  138. package/esm/models/index.js +1 -0
  139. package/esm/models/plugin.js +1 -0
  140. package/esm/models/seriesType/index.js +6 -0
  141. package/hooks/index.d.ts +1 -0
  142. package/hooks/index.js +12 -0
  143. package/hooks/useColor.d.ts +4 -0
  144. package/hooks/useColor.js +17 -0
  145. package/hooks/useColorScale.d.ts +4 -0
  146. package/hooks/useColorScale.js +37 -0
  147. package/hooks/useInteractionItemProps.js +1 -1
  148. package/hooks/useReducedMotion.js +7 -0
  149. package/hooks/useSeries.d.ts +6 -11
  150. package/hooks/useSeries.js +6 -3
  151. package/hooks/useSvgRef.js +6 -3
  152. package/hooks/useTicks.d.ts +4 -2
  153. package/index.js +1 -1
  154. package/internals/configInit.d.ts +9 -0
  155. package/internals/configInit.js +26 -0
  156. package/internals/defaultizeColor.d.ts +8 -8
  157. package/internals/defaultizeValueFormatter.d.ts +1 -2
  158. package/internals/defaultizeValueFormatter.js +2 -3
  159. package/internals/index.d.ts +17 -0
  160. package/internals/index.js +203 -0
  161. package/internals/isCartesian.d.ts +7 -0
  162. package/internals/isCartesian.js +14 -0
  163. package/internals/package.json +6 -0
  164. package/internals/warning.d.ts +1 -0
  165. package/internals/warning.js +19 -0
  166. package/models/axis.d.ts +4 -5
  167. package/models/index.d.ts +1 -0
  168. package/models/index.js +11 -0
  169. package/models/plugin.d.ts +16 -0
  170. package/models/plugin.js +5 -0
  171. package/models/seriesType/config.d.ts +30 -5
  172. package/models/seriesType/index.d.ts +8 -11
  173. package/models/seriesType/index.js +6 -0
  174. package/modern/BarChart/BarChart.js +2 -2
  175. package/modern/BarChart/BarPlot.js +2 -2
  176. package/modern/BarChart/formatter.js +1 -1
  177. package/modern/BarChart/getColor.js +4 -4
  178. package/modern/BarChart/plugin.js +10 -0
  179. package/modern/ChartContainer/ChartContainer.js +71 -23
  180. package/modern/ChartContainer/defaultPlugins.js +5 -0
  181. package/modern/ChartContainer/usePluginsMerge.js +31 -0
  182. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  183. package/modern/ChartsLegend/utils.js +4 -1
  184. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
  185. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
  186. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
  187. package/modern/ChartsText/ChartsText.js +1 -3
  188. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
  189. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
  190. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +5 -4
  191. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  192. package/modern/ChartsTooltip/utils.js +2 -8
  193. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
  194. package/modern/ChartsXAxis/ChartsXAxis.js +17 -19
  195. package/modern/ChartsYAxis/ChartsYAxis.js +17 -19
  196. package/modern/LineChart/AreaPlot.js +2 -2
  197. package/modern/LineChart/LineChart.js +3 -3
  198. package/modern/LineChart/LineHighlightPlot.js +2 -2
  199. package/modern/LineChart/LinePlot.js +2 -2
  200. package/modern/LineChart/MarkPlot.js +2 -2
  201. package/modern/LineChart/formatter.js +1 -1
  202. package/modern/LineChart/getColor.js +2 -2
  203. package/modern/LineChart/plugin.js +10 -0
  204. package/modern/PieChart/PieChart.js +3 -3
  205. package/modern/PieChart/PiePlot.js +2 -2
  206. package/modern/PieChart/plugin.js +7 -0
  207. package/modern/ResponsiveChartContainer/ResizableContainer.js +26 -0
  208. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +31 -23
  209. package/modern/ScatterChart/ScatterChart.js +3 -3
  210. package/modern/ScatterChart/ScatterPlot.js +2 -2
  211. package/modern/ScatterChart/formatter.js +1 -1
  212. package/modern/ScatterChart/getColor.js +2 -2
  213. package/modern/ScatterChart/plugin.js +10 -0
  214. package/modern/SparkLineChart/SparkLineChart.js +58 -2
  215. package/modern/context/CartesianContextProvider.js +7 -20
  216. package/modern/context/ColorProvider.js +16 -0
  217. package/modern/context/DrawingProvider.js +9 -2
  218. package/modern/context/HighlightedProvider/HighlightedContext.js +8 -5
  219. package/modern/context/HighlightedProvider/HighlightedProvider.js +15 -12
  220. package/modern/context/HighlightedProvider/useHighlighted.js +6 -3
  221. package/modern/context/HighlightedProvider/useItemHighlighted.js +2 -6
  222. package/modern/context/SeriesContextProvider.js +14 -17
  223. package/modern/context/context.types.js +1 -0
  224. package/modern/hooks/index.js +1 -0
  225. package/modern/hooks/useColor.js +9 -0
  226. package/modern/hooks/useColorScale.js +27 -0
  227. package/modern/hooks/useInteractionItemProps.js +2 -2
  228. package/modern/hooks/useReducedMotion.js +7 -0
  229. package/modern/hooks/useSeries.js +6 -3
  230. package/modern/hooks/useSvgRef.js +6 -3
  231. package/modern/index.js +1 -1
  232. package/modern/internals/configInit.js +20 -0
  233. package/modern/internals/defaultizeValueFormatter.js +2 -3
  234. package/modern/internals/index.js +27 -0
  235. package/modern/internals/isCartesian.js +7 -0
  236. package/modern/internals/warning.js +13 -0
  237. package/modern/models/index.js +1 -0
  238. package/modern/models/plugin.js +1 -0
  239. package/modern/models/seriesType/index.js +6 -0
  240. package/package.json +2 -2
  241. package/themeAugmentation/components.d.ts +12 -12
  242. package/esm/internals/colorGetter.js +0 -22
  243. package/internals/colorGetter.d.ts +0 -7
  244. package/internals/colorGetter.js +0 -29
  245. package/modern/internals/colorGetter.js +0 -22
@@ -4,11 +4,13 @@ import useForkRef from '@mui/utils/useForkRef';
4
4
  import { DrawingProvider } from '../context/DrawingProvider';
5
5
  import { SeriesContextProvider } from '../context/SeriesContextProvider';
6
6
  import { InteractionProvider } from '../context/InteractionProvider';
7
+ import { ColorProvider } from '../context/ColorProvider';
7
8
  import { useReducedMotion } from '../hooks/useReducedMotion';
8
9
  import { ChartsSurface } from '../ChartsSurface';
9
10
  import { CartesianContextProvider } from '../context/CartesianContextProvider';
10
11
  import { ChartsAxesGradients } from '../internals/components/ChartsAxesGradients';
11
- import { HighlightedProvider } from '../context';
12
+ import { HighlightedProvider, ZAxisContextProvider } from '../context';
13
+ import { usePluginsMerge } from './usePluginsMerge';
12
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
15
  const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
14
16
  const {
@@ -18,6 +20,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
18
20
  margin,
19
21
  xAxis,
20
22
  yAxis,
23
+ zAxis,
21
24
  colors,
22
25
  dataset,
23
26
  sx,
@@ -26,10 +29,17 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
26
29
  disableAxisListener,
27
30
  highlightedItem,
28
31
  onHighlightChange,
32
+ plugins,
29
33
  children
30
34
  } = props;
31
35
  const svgRef = React.useRef(null);
32
36
  const handleRef = useForkRef(ref, svgRef);
37
+ const {
38
+ xExtremumGetters,
39
+ yExtremumGetters,
40
+ seriesFormatters,
41
+ colorProcessors
42
+ } = usePluginsMerge(plugins);
33
43
  useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
34
44
 
35
45
  return /*#__PURE__*/_jsx(DrawingProvider, {
@@ -37,27 +47,37 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
37
47
  height: height,
38
48
  margin: margin,
39
49
  svgRef: svgRef,
40
- children: /*#__PURE__*/_jsx(SeriesContextProvider, {
41
- series: series,
42
- colors: colors,
43
- dataset: dataset,
44
- children: /*#__PURE__*/_jsx(CartesianContextProvider, {
45
- xAxis: xAxis,
46
- yAxis: yAxis,
50
+ children: /*#__PURE__*/_jsx(ColorProvider, {
51
+ colorProcessors: colorProcessors,
52
+ children: /*#__PURE__*/_jsx(SeriesContextProvider, {
53
+ series: series,
54
+ colors: colors,
47
55
  dataset: dataset,
48
- children: /*#__PURE__*/_jsx(InteractionProvider, {
49
- children: /*#__PURE__*/_jsx(HighlightedProvider, {
50
- highlightedItem: highlightedItem,
51
- onHighlightChange: onHighlightChange,
52
- children: /*#__PURE__*/_jsxs(ChartsSurface, {
53
- width: width,
54
- height: height,
55
- ref: handleRef,
56
- sx: sx,
57
- title: title,
58
- desc: desc,
59
- disableAxisListener: disableAxisListener,
60
- children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), children]
56
+ seriesFormatters: seriesFormatters,
57
+ children: /*#__PURE__*/_jsx(CartesianContextProvider, {
58
+ xAxis: xAxis,
59
+ yAxis: yAxis,
60
+ dataset: dataset,
61
+ xExtremumGetters: xExtremumGetters,
62
+ yExtremumGetters: yExtremumGetters,
63
+ children: /*#__PURE__*/_jsx(ZAxisContextProvider, {
64
+ zAxis: zAxis,
65
+ dataset: dataset,
66
+ children: /*#__PURE__*/_jsx(InteractionProvider, {
67
+ children: /*#__PURE__*/_jsx(HighlightedProvider, {
68
+ highlightedItem: highlightedItem,
69
+ onHighlightChange: onHighlightChange,
70
+ children: /*#__PURE__*/_jsxs(ChartsSurface, {
71
+ width: width,
72
+ height: height,
73
+ ref: handleRef,
74
+ sx: sx,
75
+ title: title,
76
+ desc: desc,
77
+ disableAxisListener: disableAxisListener,
78
+ children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), children]
79
+ })
80
+ })
61
81
  })
62
82
  })
63
83
  })
@@ -117,6 +137,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
117
137
  * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
118
138
  */
119
139
  onHighlightChange: PropTypes.func,
140
+ /**
141
+ * An array of plugins defining how to preprocess data.
142
+ * If not provided, the container supports line, bar, scatter and pie charts.
143
+ */
144
+ plugins: PropTypes.arrayOf(PropTypes.object),
120
145
  /**
121
146
  * The array of series to display.
122
147
  * Each type of series has its own specificity.
@@ -170,7 +195,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
170
195
  labelStyle: PropTypes.object,
171
196
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
172
197
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
173
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
198
+ position: PropTypes.oneOf(['bottom', 'top']),
174
199
  reverse: PropTypes.bool,
175
200
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
176
201
  slotProps: PropTypes.object,
@@ -223,7 +248,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
223
248
  labelStyle: PropTypes.object,
224
249
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
225
250
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
226
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
251
+ position: PropTypes.oneOf(['left', 'right']),
227
252
  reverse: PropTypes.bool,
228
253
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
229
254
  slotProps: PropTypes.object,
@@ -240,6 +265,29 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
240
265
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
241
266
  tickSize: PropTypes.number,
242
267
  valueFormatter: PropTypes.func
268
+ })),
269
+ /**
270
+ * The configuration of the z-axes.
271
+ */
272
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
273
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
274
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
275
+ type: PropTypes.oneOf(['ordinal']).isRequired,
276
+ unknownColor: PropTypes.string,
277
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
278
+ }), PropTypes.shape({
279
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
280
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
281
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
282
+ type: PropTypes.oneOf(['continuous']).isRequired
283
+ }), PropTypes.shape({
284
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
285
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
286
+ type: PropTypes.oneOf(['piecewise']).isRequired
287
+ })]),
288
+ data: PropTypes.array,
289
+ dataKey: PropTypes.string,
290
+ id: PropTypes.string
243
291
  }))
244
292
  } : void 0;
245
293
  export { ChartContainer };
@@ -0,0 +1,5 @@
1
+ import { plugin as barPlugin } from '../BarChart/plugin';
2
+ import { plugin as scatterPlugin } from '../ScatterChart/plugin';
3
+ import { plugin as linePlugin } from '../LineChart/plugin';
4
+ import { plugin as piePlugin } from '../PieChart/plugin';
5
+ export const defaultPlugins = [barPlugin, scatterPlugin, linePlugin, piePlugin];
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { defaultPlugins } from './defaultPlugins';
3
+ export function usePluginsMerge(plugins) {
4
+ const defaultizedPlugins = plugins ?? defaultPlugins;
5
+ return React.useMemo(() => {
6
+ const seriesFormatters = {};
7
+ const colorProcessors = {};
8
+ const xExtremumGetters = {};
9
+ const yExtremumGetters = {};
10
+ for (let i = 0; i < defaultizedPlugins.length; i += 1) {
11
+ const plugin = defaultizedPlugins[i];
12
+
13
+ // To remove those any we will need to solve this union discrimination issue:
14
+ // https://www.typescriptlang.org/play/?#code/FDAuE8AcFMAIDkCuBbARtATgYQPYDsAzASwHNYBeWAb2FlgGsi8ATALlgHI8V0MOBuWrBwwMAQ1A4M7ABQAPdtzSYAlBQB8sJb0EBfEBBiwAyqAxMSuQqQrUhjFuw4BnMxYFCRmCVNkLYruZ4JGrkmoEWeiAAxviuWqhWxCTsSMrY+Mm2VAxMbLAARNqYBQA0wqI+0rByGrAATLAAVDWw+rF48YFJpOymQZaZNpQ5DvkFEcFlFd6S1bVhsAAG9S0AJFRyukttMXGgsB3JzrYA2niJQyTl3VcAugZQcADylXPOALJikJAW2ULFDAAflSPEwPRIpw4XnEcw4d1KQkmJBBJjcwQhUJhVXhiN0gmAHXi2LmXx+FnYr1mUk+31+wWy+JABCksBkABtoAcjjYcARDldnGoaCA6AB6MWwADqUnoJxw9FgRH5AHc4L9ooroGJogALQ5iZxwPJEABuRGYiDE7PASJVRFAerZPJIADoxsKhHRooa4FwwXxWF66DNYVIyfTIS73Xk7rZoySpIIQyHUBhtfRkyGfUbOMiOEGU3RExgIxZTtGxnHKAm3kng8xoAQxIh2aBC0W0xms-pvftqLkWOUS2141chBLYABJDimuB4HBKxtiWBiVA4RAHXU4FWwSSwTkHAAqxlgiBYmFcYhYAusbrGq5vtepGFX6YPTHo0GYnjrpbp5ZVrYJZ6EAA
15
+ seriesFormatters[plugin.seriesType] = plugin.seriesFormatter;
16
+ colorProcessors[plugin.seriesType] = plugin.colorProcessor;
17
+ if (plugin.xExtremumGetter) {
18
+ xExtremumGetters[plugin.seriesType] = plugin.xExtremumGetter;
19
+ }
20
+ if (plugin.yExtremumGetter) {
21
+ yExtremumGetters[plugin.seriesType] = plugin.yExtremumGetter;
22
+ }
23
+ }
24
+ return {
25
+ seriesFormatters,
26
+ colorProcessors,
27
+ xExtremumGetters,
28
+ yExtremumGetters
29
+ };
30
+ }, [defaultizedPlugins]);
31
+ }
@@ -5,10 +5,10 @@ import { useSlotProps } from '@mui/base/utils';
5
5
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
6
6
  import { useThemeProps, useTheme } from '@mui/material/styles';
7
7
  import { getSeriesToDisplay } from './utils';
8
- import { SeriesContext } from '../context/SeriesContextProvider';
9
8
  import { getLegendUtilityClass } from './chartsLegendClasses';
10
9
  import { DefaultChartsLegend } from './DefaultChartsLegend';
11
10
  import { useDrawingArea } from '../hooks';
11
+ import { useSeries } from '../hooks/useSeries';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  const useUtilityClasses = ownerState => {
14
14
  const {
@@ -47,7 +47,7 @@ function ChartsLegend(inProps) {
47
47
  theme
48
48
  }));
49
49
  const drawingArea = useDrawingArea();
50
- const series = React.useContext(SeriesContext);
50
+ const series = useSeries();
51
51
  const seriesToDisplay = getSeriesToDisplay(series);
52
52
  const ChartLegendRender = slots?.legend ?? DefaultChartsLegend;
53
53
  const chartLegendRenderProps = useSlotProps({
@@ -9,5 +9,8 @@ const legendGetter = {
9
9
  pie: getPieLegend
10
10
  };
11
11
  export function getSeriesToDisplay(series) {
12
- return Object.keys(series).flatMap(seriesType => legendGetter[seriesType](series[seriesType]));
12
+ return Object.keys(series).flatMap(seriesType => {
13
+ const getter = legendGetter[seriesType];
14
+ return getter === undefined ? [] : getter(series[seriesType]);
15
+ });
13
16
  }
@@ -1,16 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { SvgContext } from '../context/DrawingProvider';
4
3
  import { InteractionContext } from '../context/InteractionProvider';
5
4
  import { CartesianContext } from '../context/CartesianContextProvider';
6
- import { SeriesContext } from '../context/SeriesContextProvider';
5
+ import { useSeries } from '../hooks/useSeries';
6
+ import { useSvgRef } from '../hooks';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  function ChartsOnAxisClickHandler(props) {
9
9
  const {
10
10
  onAxisClick
11
11
  } = props;
12
- const svgRef = React.useContext(SvgContext);
13
- const series = React.useContext(SeriesContext);
12
+ const svgRef = useSvgRef();
13
+ const series = useSeries();
14
14
  const {
15
15
  axis
16
16
  } = React.useContext(InteractionContext);
@@ -5,6 +5,7 @@ import { useDrawingArea, useXScale } from '../hooks';
5
5
  import { ReferenceLineRoot } from './common';
6
6
  import { ChartsText } from '../ChartsText';
7
7
  import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
8
+ import { buildWarning } from '../internals/warning';
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const getTextParams = ({
10
11
  top,
@@ -46,7 +47,7 @@ export function getXReferenceLineClasses(classes) {
46
47
  label: ['label']
47
48
  }, getReferenceLineUtilityClass, classes);
48
49
  }
49
- let warnedOnce = false;
50
+ const valueError = buildWarning((value, id) => `MUI X Charts: the value ${value} does not exist in the data of x axis with id ${id}.`, 'error');
50
51
  function ChartsXReferenceLine(props) {
51
52
  const {
52
53
  x,
@@ -66,10 +67,7 @@ function ChartsXReferenceLine(props) {
66
67
  const xPosition = xAxisScale(x);
67
68
  if (xPosition === undefined) {
68
69
  if (process.env.NODE_ENV !== 'production') {
69
- if (!warnedOnce) {
70
- warnedOnce = true;
71
- console.error(`MUI X Charts: the value ${x} does not exist in the data of x axis with id ${axisId}.`);
72
- }
70
+ valueError(x, axisId);
73
71
  }
74
72
  return null;
75
73
  }
@@ -5,6 +5,7 @@ import { useDrawingArea, useYScale } from '../hooks';
5
5
  import { ReferenceLineRoot } from './common';
6
6
  import { ChartsText } from '../ChartsText';
7
7
  import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
8
+ import { buildWarning } from '../internals/warning';
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const getTextParams = ({
10
11
  left,
@@ -39,7 +40,6 @@ const getTextParams = ({
39
40
  };
40
41
  }
41
42
  };
42
- let warnedOnce = false;
43
43
  export function getYReferenceLineClasses(classes) {
44
44
  return composeClasses({
45
45
  root: ['root', 'horizontal'],
@@ -47,6 +47,7 @@ export function getYReferenceLineClasses(classes) {
47
47
  label: ['label']
48
48
  }, getReferenceLineUtilityClass, classes);
49
49
  }
50
+ const valueError = buildWarning((value, id) => `MUI X Charts: the value ${value} does not exist in the data of y axis with id ${id}.`, 'error');
50
51
  function ChartsYReferenceLine(props) {
51
52
  const {
52
53
  y,
@@ -66,10 +67,7 @@ function ChartsYReferenceLine(props) {
66
67
  const yPosition = yAxisScale(y);
67
68
  if (yPosition === undefined) {
68
69
  if (process.env.NODE_ENV !== 'production') {
69
- if (!warnedOnce) {
70
- warnedOnce = true;
71
- console.error(`MUI X Charts: the value ${y} does not exist in the data of y axis with id ${axisId}.`);
72
- }
70
+ valueError(y, axisId);
73
71
  }
74
72
  return null;
75
73
  }
@@ -49,10 +49,8 @@ function ChartsText(props) {
49
49
  if (angle) {
50
50
  transforms.push(`rotate(${angle}, ${x}, ${y})`);
51
51
  }
52
- if (transforms.length) {
53
- textProps.transform = transforms.join(' ');
54
- }
55
52
  return /*#__PURE__*/_jsx("text", _extends({}, textProps, {
53
+ transform: transforms.length > 0 ? transforms.join(' ') : undefined,
56
54
  x: x,
57
55
  y: y,
58
56
  textAnchor: textAnchor,
@@ -2,12 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { useSlotProps } from '@mui/base/utils';
5
- import { SeriesContext } from '../context/SeriesContextProvider';
6
5
  import { CartesianContext } from '../context/CartesianContextProvider';
7
6
  import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
8
- import { isCartesianSeriesType } from './utils';
9
- import colorGetter from '../internals/colorGetter';
10
7
  import { ZAxisContext } from '../context/ZAxisContextProvider';
8
+ import { useColorProcessor } from '../hooks/useColor';
9
+ import { isCartesianSeriesType } from '../internals/isCartesian';
10
+ import { useSeries } from '../hooks/useSeries';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  function ChartsAxisTooltipContent(props) {
13
13
  const {
@@ -30,7 +30,8 @@ function ChartsAxisTooltipContent(props) {
30
30
  zAxisIds,
31
31
  zAxis
32
32
  } = React.useContext(ZAxisContext);
33
- const series = React.useContext(SeriesContext);
33
+ const series = useSeries();
34
+ const colorProcessors = useColorProcessor();
34
35
  const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
35
36
  const relevantSeries = React.useMemo(() => {
36
37
  const rep = [];
@@ -40,15 +41,8 @@ function ChartsAxisTooltipContent(props) {
40
41
  const axisKey = isXaxis ? item.xAxisKey : item.yAxisKey;
41
42
  if (axisKey === undefined || axisKey === USED_AXIS_ID) {
42
43
  const seriesToAdd = series[seriesType].series[seriesId];
43
- let getColor;
44
- switch (seriesToAdd.type) {
45
- case 'scatter':
46
- getColor = colorGetter(seriesToAdd, xAxis[seriesToAdd.xAxisKey ?? xAxisIds[0]], yAxis[seriesToAdd.yAxisKey ?? yAxisIds[0]], zAxis[seriesToAdd.zAxisKey ?? zAxisIds[0]]);
47
- break;
48
- default:
49
- getColor = colorGetter(seriesToAdd, xAxis[seriesToAdd.xAxisKey ?? xAxisIds[0]], yAxis[seriesToAdd.yAxisKey ?? yAxisIds[0]]);
50
- break;
51
- }
44
+ const zAxisKey = seriesToAdd.zAxisKey ?? zAxisIds[0];
45
+ const getColor = colorProcessors[seriesType]?.(seriesToAdd, xAxis[seriesToAdd.xAxisKey ?? xAxisIds[0]], yAxis[seriesToAdd.yAxisKey ?? yAxisIds[0]], zAxisKey && zAxis[zAxisKey]) ?? (() => '');
52
46
  rep.push(_extends({}, seriesToAdd, {
53
47
  getColor
54
48
  }));
@@ -56,7 +50,7 @@ function ChartsAxisTooltipContent(props) {
56
50
  });
57
51
  });
58
52
  return rep;
59
- }, [USED_AXIS_ID, isXaxis, series, xAxis, xAxisIds, yAxis, yAxisIds, zAxis, zAxisIds]);
53
+ }, [USED_AXIS_ID, colorProcessors, isXaxis, series, xAxis, xAxisIds, yAxis, yAxisIds, zAxis, zAxisIds]);
60
54
  const relevantAxis = React.useMemo(() => {
61
55
  return isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
62
56
  }, [USED_AXIS_ID, isXaxis, xAxis, yAxis]);
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { useSlotProps } from '@mui/base/utils';
5
- import { SeriesContext } from '../context/SeriesContextProvider';
6
5
  import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent';
7
6
  import { CartesianContext } from '../context/CartesianContextProvider';
8
- import colorGetter from '../internals/colorGetter';
9
7
  import { ZAxisContext } from '../context/ZAxisContextProvider';
8
+ import { useColorProcessor } from '../hooks/useColor';
9
+ import { useSeries } from '../hooks/useSeries';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  function ChartsItemTooltipContent(props) {
12
12
  const {
@@ -16,7 +16,7 @@ function ChartsItemTooltipContent(props) {
16
16
  classes,
17
17
  contentProps
18
18
  } = props;
19
- const series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId];
19
+ const series = useSeries()[itemData.type].series[itemData.seriesId];
20
20
  const {
21
21
  xAxis,
22
22
  yAxis,
@@ -27,21 +27,11 @@ function ChartsItemTooltipContent(props) {
27
27
  zAxis,
28
28
  zAxisIds
29
29
  } = React.useContext(ZAxisContext);
30
- const defaultXAxisId = xAxisIds[0];
31
- const defaultYAxisId = yAxisIds[0];
32
- const defaultZAxisId = zAxisIds[0];
33
- let getColor;
34
- switch (series.type) {
35
- case 'pie':
36
- getColor = colorGetter(series);
37
- break;
38
- case 'scatter':
39
- getColor = colorGetter(series, xAxis[series.xAxisKey ?? defaultXAxisId], yAxis[series.yAxisKey ?? defaultYAxisId], zAxis[series.zAxisKey ?? defaultZAxisId]);
40
- break;
41
- default:
42
- getColor = colorGetter(series, xAxis[series.xAxisKey ?? defaultXAxisId], yAxis[series.yAxisKey ?? defaultYAxisId]);
43
- break;
44
- }
30
+ const colorProcessors = useColorProcessor();
31
+ const xAxisKey = series.xAxisKey ?? xAxisIds[0];
32
+ const yAxisKey = series.yAxisKey ?? yAxisIds[0];
33
+ const zAxisKey = series.zAxisKey ?? zAxisIds[0];
34
+ const getColor = colorProcessors[series.type]?.(series, xAxisKey && xAxis[xAxisKey], yAxisKey && yAxis[yAxisKey], zAxisKey && zAxis[zAxisKey]) ?? (() => '');
45
35
  const Content = content ?? DefaultChartsItemTooltipContent;
46
36
  const chartTooltipContentProps = useSlotProps({
47
37
  elementType: Content,
@@ -3,8 +3,9 @@ import PropTypes from 'prop-types';
3
3
  import clsx from 'clsx';
4
4
  import Typography from '@mui/material/Typography';
5
5
  import { ChartsTooltipCell, ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipMark, ChartsTooltipRow } from './ChartsTooltipTable';
6
- import { isCartesianSeries, utcFormatter } from './utils';
6
+ import { utcFormatter } from './utils';
7
7
  import { getLabel } from '../internals/getLabel';
8
+ import { isCartesianSeries } from '../internals/isCartesian';
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  function DefaultChartsAxisTooltipContent(props) {
10
11
  const {
@@ -37,7 +38,6 @@ function DefaultChartsAxisTooltipContent(props) {
37
38
  })
38
39
  }), /*#__PURE__*/_jsx("tbody", {
39
40
  children: series.filter(isCartesianSeries).map(({
40
- color,
41
41
  id,
42
42
  label,
43
43
  valueFormatter,
@@ -52,12 +52,13 @@ function DefaultChartsAxisTooltipContent(props) {
52
52
  return null;
53
53
  }
54
54
  const formattedLabel = getLabel(label, 'tooltip');
55
+ const color = getColor(dataIndex);
55
56
  return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
56
57
  className: classes.row,
57
58
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
58
59
  className: clsx(classes.markCell, classes.cell),
59
- children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
60
- color: getColor(dataIndex) ?? color,
60
+ children: color && /*#__PURE__*/_jsx(ChartsTooltipMark, {
61
+ color: color,
61
62
  className: classes.mark
62
63
  })
63
64
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
@@ -23,7 +23,7 @@ function DefaultChartsItemTooltipContent(props) {
23
23
  color: getColor(itemData.dataIndex),
24
24
  displayedLabel: getLabel(series.data[itemData.dataIndex].label, 'tooltip')
25
25
  } : {
26
- color: getColor(itemData.dataIndex) ?? series.color,
26
+ color: getColor(itemData.dataIndex),
27
27
  displayedLabel: getLabel(series.label, 'tooltip')
28
28
  };
29
29
  const value = series.type === 'pie' ? _extends({}, series.data[itemData.dataIndex], {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SvgContext } from '../context/DrawingProvider';
2
+ import { useSvgRef } from '../hooks';
3
3
  export function generateVirtualElement(mousePosition) {
4
4
  if (mousePosition === null) {
5
5
  return {
@@ -44,7 +44,7 @@ export function generateVirtualElement(mousePosition) {
44
44
  };
45
45
  }
46
46
  export function useMouseTracker() {
47
- const svgRef = React.useContext(SvgContext);
47
+ const svgRef = useSvgRef();
48
48
 
49
49
  // Use a ref to avoid rerendering on every mousemove event.
50
50
  const [mousePosition, setMousePosition] = React.useState(null);
@@ -84,12 +84,6 @@ export function getTooltipHasData(trigger, displayedData) {
84
84
  const hasAxisYData = displayedData.y !== null;
85
85
  return hasAxisXData || hasAxisYData;
86
86
  }
87
- export function isCartesianSeriesType(seriesType) {
88
- return ['bar', 'line', 'scatter'].includes(seriesType);
89
- }
90
- export function isCartesianSeries(series) {
91
- return isCartesianSeriesType(series.type);
92
- }
93
87
  export function utcFormatter(v) {
94
88
  if (v instanceof Date) {
95
89
  return v.toUTCString();
@@ -4,11 +4,11 @@ import { Delaunay } from 'd3-delaunay';
4
4
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
5
  import { InteractionContext } from '../context/InteractionProvider';
6
6
  import { CartesianContext } from '../context/CartesianContextProvider';
7
- import { SeriesContext } from '../context/SeriesContextProvider';
8
7
  import { getValueToPositionMapper } from '../hooks/useScale';
9
8
  import { getSVGPoint } from '../internals/utils';
10
9
  import { useDrawingArea, useSvgRef } from '../hooks';
11
10
  import { useHighlighted } from '../context';
11
+ import { useScatterSeries } from '../hooks/useSeries';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  function ChartsVoronoiHandler(props) {
14
14
  const {
@@ -34,7 +34,7 @@ function ChartsVoronoiHandler(props) {
34
34
  const {
35
35
  series,
36
36
  seriesOrder
37
- } = React.useContext(SeriesContext).scatter ?? {};
37
+ } = useScatterSeries() ?? {};
38
38
  const voronoiRef = React.useRef({});
39
39
  const delauneyRef = React.useRef(undefined);
40
40
  const {
@@ -104,27 +104,23 @@ const defaultProps = {
104
104
  * - [ChartsXAxis API](https://mui.com/x/api/charts/charts-x-axis/)
105
105
  */
106
106
  function ChartsXAxis(inProps) {
107
- const props = useThemeProps({
108
- props: _extends({}, defaultProps, inProps),
109
- name: 'MuiChartsXAxis'
110
- });
111
107
  const {
112
- xAxisIds
108
+ xAxisIds,
109
+ xAxis
113
110
  } = React.useContext(CartesianContext);
114
- const _React$useContext = React.useContext(CartesianContext),
115
- _ref = props.axisId ?? xAxisIds[0],
111
+ const _xAxis = xAxis[inProps.axisId ?? xAxisIds[0]],
116
112
  {
117
- xAxis: {
118
- [_ref]: {
119
- scale: xScale,
120
- tickNumber,
121
- reverse
122
- }
123
- }
124
- } = _React$useContext,
125
- settings = _objectWithoutPropertiesLoose(_React$useContext.xAxis[_ref], _excluded);
113
+ scale: xScale,
114
+ tickNumber,
115
+ reverse
116
+ } = _xAxis,
117
+ settings = _objectWithoutPropertiesLoose(_xAxis, _excluded);
126
118
  const isMounted = useMounted();
127
- const defaultizedProps = _extends({}, defaultProps, settings, props);
119
+ const themedProps = useThemeProps({
120
+ props: _extends({}, settings, inProps),
121
+ name: 'MuiChartsXAxis'
122
+ });
123
+ const defaultizedProps = _extends({}, defaultProps, themedProps);
128
124
  const {
129
125
  position,
130
126
  disableLine,
@@ -314,10 +310,12 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
314
310
  */
315
311
  tickFontSize: PropTypes.number,
316
312
  /**
317
- * Defines which ticks are displayed. Its value can be:
313
+ * Defines which ticks are displayed.
314
+ * Its value can be:
318
315
  * - 'auto' In such case the ticks are computed based on axis scale and other parameters.
319
- * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
316
+ * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has "point" scale.
320
317
  * - an array containing the values where ticks should be displayed.
318
+ * @see See {@link https://mui.com/x/react-charts/axis/#fixed-tick-positions}
321
319
  * @default 'auto'
322
320
  */
323
321
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["scale", "tickNumber"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
@@ -47,25 +47,21 @@ const defaultProps = {
47
47
  * - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
48
48
  */
49
49
  function ChartsYAxis(inProps) {
50
- const props = useThemeProps({
51
- props: _extends({}, defaultProps, inProps),
52
- name: 'MuiChartsYAxis'
53
- });
54
50
  const {
55
- yAxisIds
51
+ yAxisIds,
52
+ yAxis
56
53
  } = React.useContext(CartesianContext);
57
- const _React$useContext = React.useContext(CartesianContext),
58
- _ref = props.axisId ?? yAxisIds[0],
54
+ const _yAxis = yAxis[inProps.axisId ?? yAxisIds[0]],
59
55
  {
60
- yAxis: {
61
- [_ref]: {
62
- scale: yScale,
63
- tickNumber
64
- }
65
- }
66
- } = _React$useContext,
67
- settings = _objectWithoutPropertiesLoose(_React$useContext.yAxis[_ref], _excluded);
68
- const defaultizedProps = _extends({}, defaultProps, settings, props);
56
+ scale: yScale,
57
+ tickNumber
58
+ } = _yAxis,
59
+ settings = _objectWithoutPropertiesLoose(_yAxis, _excluded);
60
+ const themedProps = useThemeProps({
61
+ props: _extends({}, settings, inProps),
62
+ name: 'MuiChartsYAxis'
63
+ });
64
+ const defaultizedProps = _extends({}, defaultProps, themedProps);
69
65
  const {
70
66
  position,
71
67
  disableLine,
@@ -250,10 +246,12 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
250
246
  */
251
247
  tickFontSize: PropTypes.number,
252
248
  /**
253
- * Defines which ticks are displayed. Its value can be:
249
+ * Defines which ticks are displayed.
250
+ * Its value can be:
254
251
  * - 'auto' In such case the ticks are computed based on axis scale and other parameters.
255
- * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
252
+ * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has "point" scale.
256
253
  * - an array containing the values where ticks should be displayed.
254
+ * @see See {@link https://mui.com/x/react-charts/axis/#fixed-tick-positions}
257
255
  * @default 'auto'
258
256
  */
259
257
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),