@mui/x-charts 7.10.0 → 7.11.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 (299) hide show
  1. package/BarChart/BarChart.js +2 -2
  2. package/BarChart/BarElement.d.ts +2 -1
  3. package/BarChart/BarLabel/BarLabelItem.d.ts +2 -1
  4. package/BarChart/BarPlot.js +8 -8
  5. package/BarChart/checkScaleErrors.d.ts +4 -4
  6. package/BarChart/checkScaleErrors.js +11 -11
  7. package/BarChart/extremums.js +4 -1
  8. package/BarChart/formatter.js +2 -2
  9. package/BarChart/useBarChartProps.js +38 -33
  10. package/CHANGELOG.md +169 -0
  11. package/ChartContainer/ChartContainer.d.ts +28 -2
  12. package/ChartContainer/ChartContainer.js +25 -66
  13. package/ChartContainer/useChartContainerHooks.d.ts +1 -1
  14. package/ChartContainer/useChartContainerHooks.js +2 -2
  15. package/ChartContainer/useChartContainerProps.d.ts +86 -0
  16. package/ChartContainer/useChartContainerProps.js +95 -0
  17. package/ChartContainer/useDefaultizeAxis.d.ts +36 -0
  18. package/ChartContainer/useDefaultizeAxis.js +29 -0
  19. package/ChartsAxis/ChartsAxis.js +4 -4
  20. package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  21. package/ChartsLegend/ChartsLegend.d.ts +3 -12
  22. package/ChartsLegend/ContinuousColorLegend.d.ts +65 -0
  23. package/ChartsLegend/ContinuousColorLegend.js +398 -0
  24. package/ChartsLegend/DefaultChartsLegend.d.ts +7 -50
  25. package/ChartsLegend/DefaultChartsLegend.js +13 -198
  26. package/ChartsLegend/LegendPerItem.d.ts +61 -0
  27. package/ChartsLegend/LegendPerItem.js +151 -0
  28. package/ChartsLegend/PiecewiseColorLegend.d.ts +26 -0
  29. package/ChartsLegend/PiecewiseColorLegend.js +169 -0
  30. package/ChartsLegend/chartsLegend.types.d.ts +31 -0
  31. package/ChartsLegend/chartsLegend.types.js +5 -0
  32. package/ChartsLegend/index.d.ts +2 -0
  33. package/ChartsLegend/index.js +22 -0
  34. package/ChartsLegend/legend.types.d.ts +62 -0
  35. package/ChartsLegend/legend.types.js +5 -0
  36. package/ChartsLegend/legendItemsPlacement.d.ts +3 -0
  37. package/ChartsLegend/legendItemsPlacement.js +79 -0
  38. package/ChartsLegend/useAxis.d.ts +7 -0
  39. package/ChartsLegend/useAxis.js +47 -0
  40. package/ChartsLegend/utils.d.ts +1 -8
  41. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
  42. package/ChartsOverlay/ChartsOverlay.d.ts +3 -2
  43. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +1 -1
  44. package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  45. package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
  46. package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
  47. package/ChartsSurface.js +3 -1
  48. package/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
  49. package/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
  50. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +30 -20
  51. package/ChartsXAxis/ChartsXAxis.js +1 -1
  52. package/ChartsYAxis/ChartsYAxis.js +15 -3
  53. package/Gauge/Gauge.d.ts +1 -4
  54. package/Gauge/Gauge.js +9 -6
  55. package/Gauge/GaugeContainer.js +8 -4
  56. package/Gauge/GaugeProvider.js +9 -9
  57. package/LineChart/AnimatedArea.js +2 -2
  58. package/LineChart/AnimatedLine.js +2 -2
  59. package/LineChart/AreaElement.d.ts +2 -1
  60. package/LineChart/AreaPlot.js +10 -6
  61. package/LineChart/LineChart.js +5 -2
  62. package/LineChart/LineElement.d.ts +2 -1
  63. package/LineChart/LineHighlightPlot.d.ts +2 -1
  64. package/LineChart/LineHighlightPlot.js +17 -5
  65. package/LineChart/LinePlot.js +10 -6
  66. package/LineChart/MarkElement.js +2 -2
  67. package/LineChart/MarkPlot.js +13 -25
  68. package/LineChart/extremums.js +4 -1
  69. package/LineChart/formatter.js +2 -2
  70. package/LineChart/useLineChartProps.js +38 -33
  71. package/PieChart/PieArc.js +1 -0
  72. package/PieChart/PieChart.d.ts +1 -4
  73. package/PieChart/PieChart.js +40 -34
  74. package/PieChart/PiePlot.js +6 -6
  75. package/PieChart/getPieCoordinates.js +3 -3
  76. package/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -20
  77. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +5 -1
  78. package/ResponsiveChartContainer/useChartContainerDimensions.js +8 -4
  79. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +20 -0
  80. package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +73 -0
  81. package/ScatterChart/Scatter.js +6 -9
  82. package/ScatterChart/ScatterChart.js +4 -1
  83. package/ScatterChart/ScatterPlot.js +6 -3
  84. package/ScatterChart/extremums.js +8 -2
  85. package/ScatterChart/useScatterChartProps.js +35 -30
  86. package/SparkLineChart/SparkLineChart.js +27 -22
  87. package/context/CartesianProvider/CartesianContext.d.ts +1 -1
  88. package/context/CartesianProvider/CartesianProvider.d.ts +2 -3
  89. package/context/CartesianProvider/CartesianProvider.js +18 -7
  90. package/context/CartesianProvider/computeValue.d.ts +32 -9
  91. package/context/CartesianProvider/computeValue.js +20 -16
  92. package/context/CartesianProvider/defaultizeAxis.d.ts +36 -0
  93. package/context/CartesianProvider/defaultizeAxis.js +21 -0
  94. package/context/CartesianProvider/index.d.ts +0 -1
  95. package/context/CartesianProvider/index.js +1 -3
  96. package/context/CartesianProvider/normalizeAxis.d.ts +1 -1
  97. package/context/CartesianProvider/normalizeAxis.js +2 -2
  98. package/context/DrawingProvider.d.ts +12 -0
  99. package/context/DrawingProvider.js +15 -2
  100. package/context/HighlightedProvider/HighlightedProvider.js +2 -2
  101. package/context/SeriesContextProvider.js +1 -1
  102. package/context/ZAxisContextProvider.d.ts +1 -1
  103. package/context/ZAxisContextProvider.js +1 -1
  104. package/esm/BarChart/BarChart.js +2 -2
  105. package/esm/BarChart/BarPlot.js +8 -8
  106. package/esm/BarChart/checkScaleErrors.js +11 -11
  107. package/esm/BarChart/extremums.js +4 -1
  108. package/esm/BarChart/formatter.js +2 -2
  109. package/esm/BarChart/useBarChartProps.js +38 -33
  110. package/esm/ChartContainer/ChartContainer.js +25 -66
  111. package/esm/ChartContainer/useChartContainerHooks.js +2 -2
  112. package/esm/ChartContainer/useChartContainerProps.js +87 -0
  113. package/esm/ChartContainer/useDefaultizeAxis.js +19 -0
  114. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  115. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  116. package/esm/ChartsLegend/ContinuousColorLegend.js +390 -0
  117. package/esm/ChartsLegend/DefaultChartsLegend.js +14 -198
  118. package/esm/ChartsLegend/LegendPerItem.js +141 -0
  119. package/esm/ChartsLegend/PiecewiseColorLegend.js +161 -0
  120. package/esm/ChartsLegend/chartsLegend.types.js +1 -0
  121. package/esm/ChartsLegend/index.js +2 -0
  122. package/esm/ChartsLegend/legend.types.js +1 -0
  123. package/esm/ChartsLegend/legendItemsPlacement.js +72 -0
  124. package/esm/ChartsLegend/useAxis.js +39 -0
  125. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
  126. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  127. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
  128. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
  129. package/esm/ChartsSurface.js +3 -1
  130. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
  131. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
  132. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +30 -20
  133. package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
  134. package/esm/ChartsYAxis/ChartsYAxis.js +15 -3
  135. package/esm/Gauge/Gauge.js +8 -5
  136. package/esm/Gauge/GaugeContainer.js +8 -4
  137. package/esm/Gauge/GaugeProvider.js +1 -1
  138. package/esm/LineChart/AnimatedArea.js +1 -1
  139. package/esm/LineChart/AnimatedLine.js +1 -1
  140. package/esm/LineChart/AreaPlot.js +10 -6
  141. package/esm/LineChart/LineChart.js +5 -2
  142. package/esm/LineChart/LineHighlightPlot.js +17 -5
  143. package/esm/LineChart/LinePlot.js +10 -6
  144. package/esm/LineChart/MarkElement.js +1 -1
  145. package/esm/LineChart/MarkPlot.js +12 -24
  146. package/esm/LineChart/extremums.js +4 -1
  147. package/esm/LineChart/formatter.js +2 -2
  148. package/esm/LineChart/useLineChartProps.js +38 -33
  149. package/esm/PieChart/PieArc.js +1 -0
  150. package/esm/PieChart/PieChart.js +39 -33
  151. package/esm/PieChart/PiePlot.js +1 -1
  152. package/esm/PieChart/getPieCoordinates.js +1 -1
  153. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -20
  154. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +8 -4
  155. package/esm/ResponsiveChartContainer/useResponsiveChartContainerProps.js +65 -0
  156. package/esm/ScatterChart/Scatter.js +6 -9
  157. package/esm/ScatterChart/ScatterChart.js +4 -1
  158. package/esm/ScatterChart/ScatterPlot.js +6 -3
  159. package/esm/ScatterChart/extremums.js +8 -2
  160. package/esm/ScatterChart/useScatterChartProps.js +35 -30
  161. package/esm/SparkLineChart/SparkLineChart.js +27 -22
  162. package/esm/context/CartesianProvider/CartesianProvider.js +18 -7
  163. package/esm/context/CartesianProvider/computeValue.js +20 -16
  164. package/esm/context/CartesianProvider/defaultizeAxis.js +13 -0
  165. package/esm/context/CartesianProvider/index.js +1 -3
  166. package/esm/context/CartesianProvider/normalizeAxis.js +2 -2
  167. package/esm/context/DrawingProvider.js +15 -2
  168. package/esm/context/HighlightedProvider/HighlightedProvider.js +2 -2
  169. package/esm/context/SeriesContextProvider.js +1 -1
  170. package/esm/context/ZAxisContextProvider.js +1 -1
  171. package/esm/hooks/useAxisEvents.js +14 -17
  172. package/esm/hooks/useDrawingArea.js +5 -3
  173. package/esm/hooks/useReducedMotion.js +4 -2
  174. package/esm/internals/SlotComponentPropsFromProps.js +1 -0
  175. package/esm/internals/cleanId.js +6 -0
  176. package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -2
  177. package/esm/internals/geometry.js +1 -1
  178. package/esm/internals/{utils.js → getPercentageValue.js} +1 -13
  179. package/esm/internals/getSymbol.js +5 -0
  180. package/esm/internals/index.js +3 -1
  181. package/esm/internals/isDefined.js +3 -0
  182. package/esm/internals/notNull.js +3 -0
  183. package/esm/internals/ts-generic.js +1 -0
  184. package/esm/internals/warning.js +19 -11
  185. package/hooks/useAxisEvents.js +14 -17
  186. package/hooks/useDrawingArea.js +5 -3
  187. package/hooks/useReducedMotion.js +4 -2
  188. package/index.js +1 -1
  189. package/internals/SlotComponentPropsFromProps.d.ts +1 -0
  190. package/internals/SlotComponentPropsFromProps.js +5 -0
  191. package/internals/cleanId.d.ts +4 -0
  192. package/internals/cleanId.js +12 -0
  193. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +6 -0
  194. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -2
  195. package/internals/defaultizeColor.d.ts +7 -0
  196. package/internals/geometry.js +1 -1
  197. package/internals/getPercentageValue.d.ts +7 -0
  198. package/internals/{utils.js → getPercentageValue.js} +1 -15
  199. package/internals/getSymbol.d.ts +2 -0
  200. package/internals/getSymbol.js +11 -0
  201. package/internals/index.d.ts +3 -1
  202. package/internals/index.js +25 -5
  203. package/internals/isDefined.d.ts +1 -0
  204. package/internals/isDefined.js +9 -0
  205. package/internals/notNull.d.ts +1 -0
  206. package/internals/notNull.js +9 -0
  207. package/internals/ts-generic.d.ts +5 -0
  208. package/internals/ts-generic.js +5 -0
  209. package/internals/warning.d.ts +2 -1
  210. package/internals/warning.js +21 -12
  211. package/models/axis.d.ts +5 -2
  212. package/models/helpers.d.ts +1 -0
  213. package/models/seriesType/common.d.ts +10 -0
  214. package/models/seriesType/config.d.ts +2 -16
  215. package/models/seriesType/scatter.d.ts +5 -0
  216. package/modern/BarChart/BarChart.js +2 -2
  217. package/modern/BarChart/BarPlot.js +8 -8
  218. package/modern/BarChart/checkScaleErrors.js +11 -11
  219. package/modern/BarChart/extremums.js +4 -1
  220. package/modern/BarChart/formatter.js +2 -2
  221. package/modern/BarChart/useBarChartProps.js +38 -33
  222. package/modern/ChartContainer/ChartContainer.js +25 -66
  223. package/modern/ChartContainer/useChartContainerHooks.js +2 -2
  224. package/modern/ChartContainer/useChartContainerProps.js +87 -0
  225. package/modern/ChartContainer/useDefaultizeAxis.js +19 -0
  226. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  227. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  228. package/modern/ChartsLegend/ContinuousColorLegend.js +390 -0
  229. package/modern/ChartsLegend/DefaultChartsLegend.js +14 -198
  230. package/modern/ChartsLegend/LegendPerItem.js +141 -0
  231. package/modern/ChartsLegend/PiecewiseColorLegend.js +161 -0
  232. package/modern/ChartsLegend/chartsLegend.types.js +1 -0
  233. package/modern/ChartsLegend/index.js +2 -0
  234. package/modern/ChartsLegend/legend.types.js +1 -0
  235. package/modern/ChartsLegend/legendItemsPlacement.js +72 -0
  236. package/modern/ChartsLegend/useAxis.js +39 -0
  237. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
  238. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  239. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
  240. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
  241. package/modern/ChartsSurface.js +3 -1
  242. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +7 -3
  243. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
  244. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +30 -20
  245. package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
  246. package/modern/ChartsYAxis/ChartsYAxis.js +15 -3
  247. package/modern/Gauge/Gauge.js +8 -5
  248. package/modern/Gauge/GaugeContainer.js +8 -4
  249. package/modern/Gauge/GaugeProvider.js +1 -1
  250. package/modern/LineChart/AnimatedArea.js +1 -1
  251. package/modern/LineChart/AnimatedLine.js +1 -1
  252. package/modern/LineChart/AreaPlot.js +10 -6
  253. package/modern/LineChart/LineChart.js +5 -2
  254. package/modern/LineChart/LineHighlightPlot.js +17 -5
  255. package/modern/LineChart/LinePlot.js +10 -6
  256. package/modern/LineChart/MarkElement.js +1 -1
  257. package/modern/LineChart/MarkPlot.js +12 -24
  258. package/modern/LineChart/extremums.js +4 -1
  259. package/modern/LineChart/formatter.js +2 -2
  260. package/modern/LineChart/useLineChartProps.js +38 -33
  261. package/modern/PieChart/PieArc.js +1 -0
  262. package/modern/PieChart/PieChart.js +39 -33
  263. package/modern/PieChart/PiePlot.js +1 -1
  264. package/modern/PieChart/getPieCoordinates.js +1 -1
  265. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -20
  266. package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +8 -4
  267. package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +65 -0
  268. package/modern/ScatterChart/Scatter.js +6 -9
  269. package/modern/ScatterChart/ScatterChart.js +4 -1
  270. package/modern/ScatterChart/ScatterPlot.js +6 -3
  271. package/modern/ScatterChart/extremums.js +8 -2
  272. package/modern/ScatterChart/useScatterChartProps.js +35 -30
  273. package/modern/SparkLineChart/SparkLineChart.js +27 -22
  274. package/modern/context/CartesianProvider/CartesianProvider.js +18 -7
  275. package/modern/context/CartesianProvider/computeValue.js +20 -16
  276. package/modern/context/CartesianProvider/defaultizeAxis.js +13 -0
  277. package/modern/context/CartesianProvider/index.js +1 -3
  278. package/modern/context/CartesianProvider/normalizeAxis.js +2 -2
  279. package/modern/context/DrawingProvider.js +15 -2
  280. package/modern/context/HighlightedProvider/HighlightedProvider.js +2 -2
  281. package/modern/context/SeriesContextProvider.js +1 -1
  282. package/modern/context/ZAxisContextProvider.js +1 -1
  283. package/modern/hooks/useAxisEvents.js +14 -17
  284. package/modern/hooks/useDrawingArea.js +5 -3
  285. package/modern/hooks/useReducedMotion.js +4 -2
  286. package/modern/index.js +1 -1
  287. package/modern/internals/SlotComponentPropsFromProps.js +1 -0
  288. package/modern/internals/cleanId.js +6 -0
  289. package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -2
  290. package/modern/internals/geometry.js +1 -1
  291. package/modern/internals/{utils.js → getPercentageValue.js} +1 -13
  292. package/modern/internals/getSymbol.js +5 -0
  293. package/modern/internals/index.js +3 -1
  294. package/modern/internals/isDefined.js +3 -0
  295. package/modern/internals/notNull.js +3 -0
  296. package/modern/internals/ts-generic.js +1 -0
  297. package/modern/internals/warning.js +19 -11
  298. package/package.json +4 -4
  299. package/internals/utils.d.ts +0 -18
@@ -1,205 +1,18 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["rotate", "dominantBaseline"],
4
- _excluded2 = ["label"];
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["drawingArea", "seriesToDisplay"];
5
4
  import * as React from 'react';
6
5
  import PropTypes from 'prop-types';
7
- import { NoSsr } from '@mui/base/NoSsr';
8
- import { useTheme, styled } from '@mui/material/styles';
9
- import { ChartsText } from '../ChartsText';
10
- import { getWordsByLines } from '../internals/getWordsByLines';
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- export const ChartsLegendRoot = styled('g', {
13
- name: 'MuiChartsLegend',
14
- slot: 'Root',
15
- overridesResolver: (props, styles) => styles.root
16
- })({});
17
- /**
18
- * Transforms number or partial padding object to a defaultized padding object.
19
- */
20
- const getStandardizedPadding = padding => {
21
- if (typeof padding === 'number') {
22
- return {
23
- left: padding,
24
- right: padding,
25
- top: padding,
26
- bottom: padding
27
- };
28
- }
29
- return _extends({
30
- left: 0,
31
- right: 0,
32
- top: 0,
33
- bottom: 0
34
- }, padding);
35
- };
6
+ import { LegendPerItem } from './LegendPerItem';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
36
8
  function DefaultChartsLegend(props) {
37
9
  const {
38
- hidden,
39
- position,
40
- direction,
41
- seriesToDisplay,
42
- drawingArea,
43
- classes,
44
- itemMarkWidth = 20,
45
- itemMarkHeight = 20,
46
- markGap = 5,
47
- itemGap = 10,
48
- padding: paddingProps = 10,
49
- labelStyle: inLabelStyle
50
- } = props;
51
- const theme = useTheme();
52
- const isRTL = theme.direction === 'rtl';
53
- const labelStyle = React.useMemo(() => _extends({}, theme.typography.subtitle1, {
54
- color: 'inherit',
55
- dominantBaseline: 'central',
56
- textAnchor: 'start',
57
- fill: (theme.vars || theme).palette.text.primary,
58
- lineHeight: 1
59
- }, inLabelStyle),
60
- // To say to TS that the dominantBaseline and textAnchor are correct
61
- [inLabelStyle, theme]);
62
- const padding = React.useMemo(() => getStandardizedPadding(paddingProps), [paddingProps]);
63
- const getItemSpace = React.useCallback((label, inStyle = {}) => {
64
- const style = _objectWithoutPropertiesLoose(inStyle, _excluded);
65
- const linesSize = getWordsByLines({
66
- style,
67
- needsComputation: true,
68
- text: label
69
- });
70
- const innerSize = {
71
- innerWidth: itemMarkWidth + markGap + Math.max(...linesSize.map(size => size.width)),
72
- innerHeight: Math.max(itemMarkHeight, linesSize.length * linesSize[0].height)
73
- };
74
- return _extends({}, innerSize, {
75
- outerWidth: innerSize.innerWidth + itemGap,
76
- outerHeight: innerSize.innerHeight + itemGap
77
- });
78
- }, [itemGap, itemMarkHeight, itemMarkWidth, markGap]);
79
- const totalWidth = drawingArea.left + drawingArea.width + drawingArea.right;
80
- const totalHeight = drawingArea.top + drawingArea.height + drawingArea.bottom;
81
- const availableWidth = totalWidth - padding.left - padding.right;
82
- const availableHeight = totalHeight - padding.top - padding.bottom;
83
- const [seriesWithPosition, legendWidth, legendHeight] = React.useMemo(() => {
84
- // Start at 0, 0. Will be modified later by padding and position.
85
- let x = 0;
86
- let y = 0;
87
-
88
- // total values used to align legend later.
89
- let totalWidthUsed = 0;
90
- let totalHeightUsed = 0;
91
- let rowIndex = 0;
92
- const rowMaxHeight = [0];
93
- const seriesWithRawPosition = seriesToDisplay.map(_ref => {
94
- let {
95
- label
96
- } = _ref,
97
- other = _objectWithoutPropertiesLoose(_ref, _excluded2);
98
- const itemSpace = getItemSpace(label, labelStyle);
99
- const rep = _extends({}, other, {
100
- label,
101
- positionX: x,
102
- positionY: y,
103
- innerHeight: itemSpace.innerHeight,
104
- innerWidth: itemSpace.innerWidth,
105
- outerHeight: itemSpace.outerHeight,
106
- outerWidth: itemSpace.outerWidth,
107
- rowIndex
108
- });
109
- if (direction === 'row') {
110
- if (x + itemSpace.innerWidth > availableWidth) {
111
- // This legend item would create overflow along the x-axis, so we start a new row.
112
- x = 0;
113
- y += rowMaxHeight[rowIndex];
114
- rowIndex += 1;
115
- if (rowMaxHeight.length <= rowIndex) {
116
- rowMaxHeight.push(0);
117
- }
118
- rep.positionX = x;
119
- rep.positionY = y;
120
- rep.rowIndex = rowIndex;
121
- }
122
- totalWidthUsed = Math.max(totalWidthUsed, x + itemSpace.outerWidth);
123
- totalHeightUsed = Math.max(totalHeightUsed, y + itemSpace.outerHeight);
124
- rowMaxHeight[rowIndex] = Math.max(rowMaxHeight[rowIndex], itemSpace.outerHeight);
125
- x += itemSpace.outerWidth;
126
- }
127
- if (direction === 'column') {
128
- if (y + itemSpace.innerHeight > availableHeight) {
129
- // This legend item would create overflow along the y-axis, so we start a new column.
130
- x = totalWidthUsed + itemGap;
131
- y = 0;
132
- rowIndex = 0;
133
- rep.positionX = x;
134
- rep.positionY = y;
135
- rep.rowIndex = rowIndex;
136
- }
137
- if (rowMaxHeight.length <= rowIndex) {
138
- rowMaxHeight.push(0);
139
- }
140
- totalWidthUsed = Math.max(totalWidthUsed, x + itemSpace.outerWidth);
141
- totalHeightUsed = Math.max(totalHeightUsed, y + itemSpace.outerHeight);
142
- rowIndex += 1;
143
- y += itemSpace.outerHeight;
144
- }
145
- return rep;
146
- });
147
- return [seriesWithRawPosition.map(item => _extends({}, item, {
148
- positionY: item.positionY + (direction === 'row' ? rowMaxHeight[item.rowIndex] / 2 // Get the center of the entire row
149
- : item.outerHeight / 2) // Get the center of the item
150
- })), totalWidthUsed, totalHeightUsed];
151
- }, [seriesToDisplay, getItemSpace, labelStyle, direction, availableWidth, availableHeight, itemGap]);
152
- const gapX = React.useMemo(() => {
153
- switch (position.horizontal) {
154
- case 'left':
155
- return padding.left;
156
- case 'right':
157
- return totalWidth - padding.right - legendWidth;
158
- default:
159
- return (totalWidth - legendWidth) / 2;
160
- }
161
- }, [position.horizontal, padding.left, padding.right, totalWidth, legendWidth]);
162
- const gapY = React.useMemo(() => {
163
- switch (position.vertical) {
164
- case 'top':
165
- return padding.top;
166
- case 'bottom':
167
- return totalHeight - padding.bottom - legendHeight;
168
- default:
169
- return (totalHeight - legendHeight) / 2;
170
- }
171
- }, [position.vertical, padding.top, padding.bottom, totalHeight, legendHeight]);
172
- if (hidden) {
173
- return null;
174
- }
175
- return /*#__PURE__*/_jsx(NoSsr, {
176
- children: /*#__PURE__*/_jsx(ChartsLegendRoot, {
177
- className: classes.root,
178
- children: seriesWithPosition.map(({
179
- id,
180
- label,
181
- color,
182
- positionX,
183
- positionY
184
- }) => /*#__PURE__*/_jsxs("g", {
185
- className: classes.series,
186
- transform: `translate(${gapX + (isRTL ? legendWidth - positionX : positionX)} ${gapY + positionY})`,
187
- children: [/*#__PURE__*/_jsx("rect", {
188
- className: classes.mark,
189
- x: isRTL ? -itemMarkWidth : 0,
190
- y: -itemMarkHeight / 2,
191
- width: itemMarkWidth,
192
- height: itemMarkHeight,
193
- fill: color
194
- }), /*#__PURE__*/_jsx(ChartsText, {
195
- style: labelStyle,
196
- text: label,
197
- x: (isRTL ? -1 : 1) * (itemMarkWidth + markGap),
198
- y: 0
199
- })]
200
- }, id))
201
- })
202
- });
10
+ seriesToDisplay
11
+ } = props,
12
+ other = _objectWithoutPropertiesLoose(props, _excluded);
13
+ return /*#__PURE__*/_jsx(LegendPerItem, _extends({}, other, {
14
+ itemsToDisplay: seriesToDisplay
15
+ }));
203
16
  }
204
17
  process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
205
18
  // ----------------------------- Warning --------------------------------
@@ -209,12 +22,15 @@ process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
209
22
  /**
210
23
  * Override or extend the styles applied to the component.
211
24
  */
212
- classes: PropTypes.object.isRequired,
25
+ classes: PropTypes.object,
213
26
  /**
214
27
  * The direction of the legend layout.
215
28
  * The default depends on the chart.
216
29
  */
217
30
  direction: PropTypes.oneOf(['column', 'row']).isRequired,
31
+ /**
32
+ * @deprecated Use the `useDrawingArea` hook instead.
33
+ */
218
34
  drawingArea: PropTypes.shape({
219
35
  bottom: PropTypes.number.isRequired,
220
36
  height: PropTypes.number.isRequired,
@@ -0,0 +1,141 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["rotate", "dominantBaseline"];
4
+ import * as React from 'react';
5
+ import { NoSsr } from '@mui/base/NoSsr';
6
+ import { useTheme, styled } from '@mui/material/styles';
7
+ import { ChartsText } from '../ChartsText';
8
+ import { getWordsByLines } from '../internals/getWordsByLines';
9
+ import { legendItemPlacements } from './legendItemsPlacement';
10
+ import { useDrawingArea } from '../hooks/useDrawingArea';
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ export const ChartsLegendRoot = styled('g', {
13
+ name: 'MuiChartsLegend',
14
+ slot: 'Root',
15
+ overridesResolver: (props, styles) => styles.root
16
+ })({});
17
+ /**
18
+ * Transforms number or partial padding object to a defaultized padding object.
19
+ */
20
+ const getStandardizedPadding = padding => {
21
+ if (typeof padding === 'number') {
22
+ return {
23
+ left: padding,
24
+ right: padding,
25
+ top: padding,
26
+ bottom: padding
27
+ };
28
+ }
29
+ return _extends({
30
+ left: 0,
31
+ right: 0,
32
+ top: 0,
33
+ bottom: 0
34
+ }, padding);
35
+ };
36
+
37
+ /**
38
+ * Internal component to display an array of items as a legend.
39
+ * Used for series legend, and threshold color legend.
40
+ * @ignore - Do not document
41
+ */
42
+ export function LegendPerItem(props) {
43
+ const {
44
+ hidden,
45
+ position,
46
+ direction,
47
+ itemsToDisplay,
48
+ classes,
49
+ itemMarkWidth = 20,
50
+ itemMarkHeight = 20,
51
+ markGap = 5,
52
+ itemGap = 10,
53
+ padding: paddingProps = 10,
54
+ labelStyle: inLabelStyle
55
+ } = props;
56
+ const theme = useTheme();
57
+ const isRTL = theme.direction === 'rtl';
58
+ const drawingArea = useDrawingArea();
59
+ const labelStyle = React.useMemo(() => _extends({}, theme.typography.subtitle1, {
60
+ color: 'inherit',
61
+ dominantBaseline: 'central',
62
+ textAnchor: 'start',
63
+ fill: (theme.vars || theme).palette.text.primary,
64
+ lineHeight: 1
65
+ }, inLabelStyle),
66
+ // To say to TS that the dominantBaseline and textAnchor are correct
67
+ [inLabelStyle, theme]);
68
+ const padding = React.useMemo(() => getStandardizedPadding(paddingProps), [paddingProps]);
69
+ const getItemSpace = React.useCallback((label, inStyle = {}) => {
70
+ const style = _objectWithoutPropertiesLoose(inStyle, _excluded);
71
+ const linesSize = getWordsByLines({
72
+ style,
73
+ needsComputation: true,
74
+ text: label
75
+ });
76
+ const innerSize = {
77
+ innerWidth: itemMarkWidth + markGap + Math.max(...linesSize.map(size => size.width)),
78
+ innerHeight: Math.max(itemMarkHeight, linesSize.length * linesSize[0].height)
79
+ };
80
+ return _extends({}, innerSize, {
81
+ outerWidth: innerSize.innerWidth + itemGap,
82
+ outerHeight: innerSize.innerHeight + itemGap
83
+ });
84
+ }, [itemGap, itemMarkHeight, itemMarkWidth, markGap]);
85
+ const totalWidth = drawingArea.left + drawingArea.width + drawingArea.right;
86
+ const totalHeight = drawingArea.top + drawingArea.height + drawingArea.bottom;
87
+ const availableWidth = totalWidth - padding.left - padding.right;
88
+ const availableHeight = totalHeight - padding.top - padding.bottom;
89
+ const [itemsWithPosition, legendWidth, legendHeight] = React.useMemo(() => legendItemPlacements(itemsToDisplay, getItemSpace, labelStyle, direction, availableWidth, availableHeight, itemGap), [itemsToDisplay, getItemSpace, labelStyle, direction, availableWidth, availableHeight, itemGap]);
90
+ const gapX = React.useMemo(() => {
91
+ switch (position.horizontal) {
92
+ case 'left':
93
+ return padding.left;
94
+ case 'right':
95
+ return totalWidth - padding.right - legendWidth;
96
+ default:
97
+ return (totalWidth - legendWidth) / 2;
98
+ }
99
+ }, [position.horizontal, padding.left, padding.right, totalWidth, legendWidth]);
100
+ const gapY = React.useMemo(() => {
101
+ switch (position.vertical) {
102
+ case 'top':
103
+ return padding.top;
104
+ case 'bottom':
105
+ return totalHeight - padding.bottom - legendHeight;
106
+ default:
107
+ return (totalHeight - legendHeight) / 2;
108
+ }
109
+ }, [position.vertical, padding.top, padding.bottom, totalHeight, legendHeight]);
110
+ if (hidden) {
111
+ return null;
112
+ }
113
+ return /*#__PURE__*/_jsx(NoSsr, {
114
+ children: /*#__PURE__*/_jsx(ChartsLegendRoot, {
115
+ className: classes?.root,
116
+ children: itemsWithPosition.map(({
117
+ id,
118
+ label,
119
+ color,
120
+ positionX,
121
+ positionY
122
+ }) => /*#__PURE__*/_jsxs("g", {
123
+ className: classes?.series,
124
+ transform: `translate(${gapX + (isRTL ? legendWidth - positionX : positionX)} ${gapY + positionY})`,
125
+ children: [/*#__PURE__*/_jsx("rect", {
126
+ className: classes?.mark,
127
+ x: isRTL ? -itemMarkWidth : 0,
128
+ y: -itemMarkHeight / 2,
129
+ width: itemMarkWidth,
130
+ height: itemMarkHeight,
131
+ fill: color
132
+ }), /*#__PURE__*/_jsx(ChartsText, {
133
+ style: labelStyle,
134
+ text: label,
135
+ x: (isRTL ? -1 : 1) * (itemMarkWidth + markGap),
136
+ y: 0
137
+ })]
138
+ }, id))
139
+ })
140
+ });
141
+ }
@@ -0,0 +1,161 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["axisDirection", "axisId", "hideFirst", "hideLast", "labelFormatter"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { useAxis } from './useAxis';
7
+ import { LegendPerItem } from './LegendPerItem';
8
+ import { notNull } from '../internals/notNull';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ function defaultLabelFormatter(params) {
11
+ if (params.min === null) {
12
+ return `<${params.formattedMax}`;
13
+ }
14
+ if (params.max === null) {
15
+ return `>${params.formattedMin}`;
16
+ }
17
+ return `${params.formattedMin}-${params.formattedMax}`;
18
+ }
19
+ function PiecewiseColorLegend(props) {
20
+ const {
21
+ axisDirection,
22
+ axisId,
23
+ hideFirst,
24
+ hideLast,
25
+ labelFormatter = defaultLabelFormatter
26
+ } = props,
27
+ other = _objectWithoutPropertiesLoose(props, _excluded);
28
+ const axisItem = useAxis({
29
+ axisDirection,
30
+ axisId
31
+ });
32
+ const colorMap = axisItem?.colorMap;
33
+ if (!colorMap || !colorMap.type || colorMap.type !== 'piecewise') {
34
+ return null;
35
+ }
36
+ const valueFormatter = v => axisItem.valueFormatter?.(v, {
37
+ location: 'legend'
38
+ }) ?? v.toLocaleString();
39
+ const formattedLabels = colorMap.thresholds.map(valueFormatter);
40
+ const itemsToDisplay = colorMap.colors.map((color, index) => {
41
+ const isFirst = index === 0;
42
+ const isLast = index === colorMap.colors.length - 1;
43
+ if (hideFirst && isFirst || hideLast && isLast) {
44
+ return null;
45
+ }
46
+ const label = labelFormatter(_extends({}, index === 0 ? {
47
+ min: null,
48
+ formattedMin: null
49
+ } : {
50
+ min: colorMap.thresholds[index - 1],
51
+ formattedMin: formattedLabels[index - 1]
52
+ }, index === colorMap.colors.length - 1 ? {
53
+ max: null,
54
+ formattedMax: null
55
+ } : {
56
+ max: colorMap.thresholds[index],
57
+ formattedMax: formattedLabels[index]
58
+ }));
59
+ if (label === null) {
60
+ return null;
61
+ }
62
+ return {
63
+ id: label,
64
+ color,
65
+ label
66
+ };
67
+ }).filter(notNull);
68
+ return /*#__PURE__*/_jsx(LegendPerItem, _extends({}, other, {
69
+ itemsToDisplay: itemsToDisplay
70
+ }));
71
+ }
72
+ process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
73
+ // ----------------------------- Warning --------------------------------
74
+ // | These PropTypes are generated from the TypeScript type definitions |
75
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
76
+ // ----------------------------------------------------------------------
77
+ /**
78
+ * The axis direction containing the color configuration to represent.
79
+ * @default 'z'
80
+ */
81
+ axisDirection: PropTypes.oneOf(['x', 'y', 'z']),
82
+ /**
83
+ * The id of the axis item with the color configuration to represent.
84
+ * @default The first axis item.
85
+ */
86
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
87
+ /**
88
+ * Override or extend the styles applied to the component.
89
+ */
90
+ classes: PropTypes.object,
91
+ /**
92
+ * The direction of the legend layout.
93
+ * The default depends on the chart.
94
+ */
95
+ direction: PropTypes.oneOf(['column', 'row']).isRequired,
96
+ /**
97
+ * Set to true to hide the legend.
98
+ * @default false
99
+ */
100
+ hidden: PropTypes.bool,
101
+ /**
102
+ * Hide the first item of the legend, corresponding to the [-infinity, min] piece.
103
+ * @default false
104
+ */
105
+ hideFirst: PropTypes.bool,
106
+ /**
107
+ * Hide the last item of the legend, corresponding to the [max, +infinity] piece.
108
+ * @default false
109
+ */
110
+ hideLast: PropTypes.bool,
111
+ /**
112
+ * Space between two legend items (in px).
113
+ * @default 10
114
+ */
115
+ itemGap: PropTypes.number,
116
+ /**
117
+ * Height of the item mark (in px).
118
+ * @default 20
119
+ */
120
+ itemMarkHeight: PropTypes.number,
121
+ /**
122
+ * Width of the item mark (in px).
123
+ * @default 20
124
+ */
125
+ itemMarkWidth: PropTypes.number,
126
+ /**
127
+ * Format the legend labels.
128
+ * @param {PiecewiseLabelFormatterParams} params The bound of the piece to format.
129
+ * @returns {string|null} The displayed label, or `null` to skip the item.
130
+ */
131
+ labelFormatter: PropTypes.func,
132
+ /**
133
+ * Style applied to legend labels.
134
+ * @default theme.typography.subtitle1
135
+ */
136
+ labelStyle: PropTypes.object,
137
+ /**
138
+ * Space between the mark and the label (in px).
139
+ * @default 5
140
+ */
141
+ markGap: PropTypes.number,
142
+ /**
143
+ * Legend padding (in px).
144
+ * Can either be a single number, or an object with top, left, bottom, right properties.
145
+ * @default 10
146
+ */
147
+ padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
148
+ bottom: PropTypes.number,
149
+ left: PropTypes.number,
150
+ right: PropTypes.number,
151
+ top: PropTypes.number
152
+ })]),
153
+ /**
154
+ * The position of the legend.
155
+ */
156
+ position: PropTypes.shape({
157
+ horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
158
+ vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
159
+ }).isRequired
160
+ } : void 0;
161
+ export { PiecewiseColorLegend };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,6 @@
1
1
  export * from './ChartsLegend';
2
2
  export * from './DefaultChartsLegend';
3
+ export * from './ContinuousColorLegend';
4
+ export * from './PiecewiseColorLegend';
3
5
  export * from './chartsLegendClasses';
4
6
  export * from './utils';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,72 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["label"];
4
+ export function legendItemPlacements(itemsToDisplay, getItemSpace, labelStyle, direction, availableWidth, availableHeight, itemGap) {
5
+ // Start at 0, 0. Will be modified later by padding and position.
6
+ let x = 0;
7
+ let y = 0;
8
+
9
+ // total values used to align legend later.
10
+ let totalWidthUsed = 0;
11
+ let totalHeightUsed = 0;
12
+ let rowIndex = 0;
13
+ const rowMaxHeight = [0];
14
+ const seriesWithRawPosition = itemsToDisplay.map(_ref => {
15
+ let {
16
+ label
17
+ } = _ref,
18
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
19
+ const itemSpace = getItemSpace(label, labelStyle);
20
+ const rep = _extends({}, other, {
21
+ label,
22
+ positionX: x,
23
+ positionY: y,
24
+ innerHeight: itemSpace.innerHeight,
25
+ innerWidth: itemSpace.innerWidth,
26
+ outerHeight: itemSpace.outerHeight,
27
+ outerWidth: itemSpace.outerWidth,
28
+ rowIndex
29
+ });
30
+ if (direction === 'row') {
31
+ if (x + itemSpace.innerWidth > availableWidth) {
32
+ // This legend item would create overflow along the x-axis, so we start a new row.
33
+ x = 0;
34
+ y += rowMaxHeight[rowIndex];
35
+ rowIndex += 1;
36
+ if (rowMaxHeight.length <= rowIndex) {
37
+ rowMaxHeight.push(0);
38
+ }
39
+ rep.positionX = x;
40
+ rep.positionY = y;
41
+ rep.rowIndex = rowIndex;
42
+ }
43
+ totalWidthUsed = Math.max(totalWidthUsed, x + itemSpace.outerWidth);
44
+ totalHeightUsed = Math.max(totalHeightUsed, y + itemSpace.outerHeight);
45
+ rowMaxHeight[rowIndex] = Math.max(rowMaxHeight[rowIndex], itemSpace.outerHeight);
46
+ x += itemSpace.outerWidth;
47
+ }
48
+ if (direction === 'column') {
49
+ if (y + itemSpace.innerHeight > availableHeight) {
50
+ // This legend item would create overflow along the y-axis, so we start a new column.
51
+ x = totalWidthUsed + itemGap;
52
+ y = 0;
53
+ rowIndex = 0;
54
+ rep.positionX = x;
55
+ rep.positionY = y;
56
+ rep.rowIndex = rowIndex;
57
+ }
58
+ if (rowMaxHeight.length <= rowIndex) {
59
+ rowMaxHeight.push(0);
60
+ }
61
+ totalWidthUsed = Math.max(totalWidthUsed, x + itemSpace.outerWidth);
62
+ totalHeightUsed = Math.max(totalHeightUsed, y + itemSpace.outerHeight);
63
+ rowIndex += 1;
64
+ y += itemSpace.outerHeight;
65
+ }
66
+ return rep;
67
+ });
68
+ return [seriesWithRawPosition.map(item => _extends({}, item, {
69
+ positionY: item.positionY + (direction === 'row' ? rowMaxHeight[item.rowIndex] / 2 // Get the center of the entire row
70
+ : item.outerHeight / 2) // Get the center of the item
71
+ })), totalWidthUsed, totalHeightUsed];
72
+ }
@@ -0,0 +1,39 @@
1
+ import * as React from 'react';
2
+ import { ZAxisContext } from '../context/ZAxisContextProvider';
3
+ import { useCartesianContext } from '../context/CartesianProvider/useCartesianContext';
4
+ /**
5
+ * Helper to select an axis definition according to its direction and id.
6
+ */
7
+ export function useAxis({
8
+ axisDirection,
9
+ axisId
10
+ }) {
11
+ const {
12
+ xAxis,
13
+ xAxisIds,
14
+ yAxis,
15
+ yAxisIds
16
+ } = useCartesianContext();
17
+ const {
18
+ zAxis,
19
+ zAxisIds
20
+ } = React.useContext(ZAxisContext);
21
+ switch (axisDirection) {
22
+ case 'x':
23
+ {
24
+ const id = typeof axisId === 'string' ? axisId : xAxisIds[axisId ?? 0];
25
+ return xAxis[id];
26
+ }
27
+ case 'y':
28
+ {
29
+ const id = typeof axisId === 'string' ? axisId : yAxisIds[axisId ?? 0];
30
+ return yAxis[id];
31
+ }
32
+ case 'z':
33
+ default:
34
+ {
35
+ const id = typeof axisId === 'string' ? axisId : zAxisIds[axisId ?? 0];
36
+ return zAxis[id];
37
+ }
38
+ }
39
+ }
@@ -37,7 +37,9 @@ function ChartsOnAxisClickHandler(props) {
37
37
  Object.keys(series).filter(seriesType => ['bar', 'line'].includes(seriesType)).forEach(seriesType => {
38
38
  series[seriesType]?.seriesOrder.forEach(seriesId => {
39
39
  const seriesItem = series[seriesType].series[seriesId];
40
- const axisKey = isXaxis ? seriesItem.xAxisKey : seriesItem.yAxisKey;
40
+ const providedXAxisId = seriesItem.xAxisId ?? seriesItem.xAxisKey;
41
+ const providedYAxisId = seriesItem.yAxisId ?? seriesItem.yAxisKey;
42
+ const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
41
43
  if (axisKey === undefined || axisKey === USED_AXIS_ID) {
42
44
  seriesValues[seriesId] = seriesItem.data[dataIndex];
43
45
  }
@@ -10,10 +10,10 @@ function ChartsReferenceLine(props) {
10
10
  y
11
11
  } = props;
12
12
  if (x !== undefined && y !== undefined) {
13
- throw new Error('MUI X Charts: The ChartsReferenceLine cannot have both `x` and `y` props set.');
13
+ throw new Error('MUI X: The ChartsReferenceLine cannot have both `x` and `y` props set.');
14
14
  }
15
15
  if (x === undefined && y === undefined) {
16
- throw new Error('MUI X Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
16
+ throw new Error('MUI X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
17
17
  }
18
18
  if (x !== undefined) {
19
19
  return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));