@mui/x-charts 6.18.0 → 6.18.2

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 (182) hide show
  1. package/BarChart/BarChart.d.ts +7 -0
  2. package/BarChart/BarChart.js +41 -4
  3. package/CHANGELOG.md +116 -5
  4. package/ChartsAxis/ChartsAxis.js +5 -5
  5. package/ChartsAxis/axisClasses.d.ts +2 -2
  6. package/ChartsLegend/ChartsLegend.d.ts +1 -0
  7. package/ChartsLegend/ChartsLegend.js +1 -1
  8. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  9. package/ChartsLegend/chartsLegendClasses.js +2 -2
  10. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
  11. package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
  12. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
  13. package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
  14. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
  15. package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
  16. package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
  17. package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
  18. package/ChartsReferenceLine/common.d.ts +41 -0
  19. package/ChartsReferenceLine/common.js +27 -0
  20. package/ChartsReferenceLine/index.d.ts +2 -0
  21. package/ChartsReferenceLine/index.js +27 -0
  22. package/ChartsReferenceLine/package.json +6 -0
  23. package/ChartsSurface.d.ts +11 -0
  24. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
  25. package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  26. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +1 -1
  27. package/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  28. package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
  29. package/ChartsTooltip/ChartsTooltip.js +13 -5
  30. package/ChartsTooltip/ChartsTooltipTable.js +3 -3
  31. package/ChartsTooltip/chartsTooltipClasses.d.ts +21 -0
  32. package/ChartsTooltip/chartsTooltipClasses.js +12 -0
  33. package/ChartsTooltip/index.d.ts +1 -0
  34. package/ChartsTooltip/index.js +11 -0
  35. package/ChartsTooltip/utils.d.ts +1 -1
  36. package/ChartsTooltip/utils.js +2 -2
  37. package/ChartsXAxis/ChartsXAxis.js +9 -5
  38. package/ChartsYAxis/ChartsYAxis.js +9 -5
  39. package/LineChart/LineChart.d.ts +7 -0
  40. package/LineChart/LineChart.js +41 -4
  41. package/LineChart/LineHighlightPlot.js +1 -1
  42. package/LineChart/MarkPlot.js +2 -1
  43. package/PieChart/PieArc.d.ts +5 -2
  44. package/PieChart/PieArc.js +17 -2
  45. package/PieChart/PieArcLabel.d.ts +1 -1
  46. package/PieChart/PieArcLabel.js +5 -10
  47. package/PieChart/PieArcLabelPlot.js +2 -2
  48. package/PieChart/PieArcPlot.js +2 -2
  49. package/PieChart/PieChart.js +34 -4
  50. package/PieChart/index.d.ts +4 -2
  51. package/PieChart/index.js +37 -27
  52. package/ResponsiveChartContainer/index.d.ts +13 -3
  53. package/ScatterChart/ScatterChart.js +34 -4
  54. package/SparkLineChart/SparkLineChart.js +22 -0
  55. package/context/CartesianContextProvider.d.ts +21 -1
  56. package/context/CartesianContextProvider.js +11 -0
  57. package/context/DrawingProvider.d.ts +18 -0
  58. package/context/DrawingProvider.js +6 -0
  59. package/context/HighlightProvider.d.ts +17 -0
  60. package/context/InteractionProvider.d.ts +6 -0
  61. package/context/SeriesContextProvider.d.ts +5 -0
  62. package/esm/BarChart/BarChart.js +41 -4
  63. package/esm/ChartsAxis/ChartsAxis.js +6 -5
  64. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  65. package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
  66. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  67. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  68. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  69. package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  70. package/esm/ChartsReferenceLine/common.js +20 -0
  71. package/esm/ChartsReferenceLine/index.js +2 -0
  72. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  73. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  74. package/esm/ChartsTooltip/ChartsTooltip.js +15 -7
  75. package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -3
  76. package/esm/ChartsTooltip/chartsTooltipClasses.js +5 -0
  77. package/esm/ChartsTooltip/index.js +2 -1
  78. package/esm/ChartsTooltip/utils.js +1 -1
  79. package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
  80. package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
  81. package/esm/LineChart/LineChart.js +41 -4
  82. package/esm/LineChart/LineHighlightPlot.js +1 -1
  83. package/esm/LineChart/MarkPlot.js +2 -1
  84. package/esm/PieChart/PieArc.js +18 -2
  85. package/esm/PieChart/PieArcLabel.js +7 -11
  86. package/esm/PieChart/PieArcLabelPlot.js +1 -1
  87. package/esm/PieChart/PieArcPlot.js +1 -1
  88. package/esm/PieChart/PieChart.js +34 -4
  89. package/esm/PieChart/index.js +2 -2
  90. package/esm/ScatterChart/ScatterChart.js +34 -4
  91. package/esm/SparkLineChart/SparkLineChart.js +22 -0
  92. package/esm/context/CartesianContextProvider.js +11 -0
  93. package/esm/context/DrawingProvider.js +6 -0
  94. package/esm/index.js +1 -0
  95. package/esm/internals/geometry.js +2 -2
  96. package/hooks/useScale.d.ts +2 -2
  97. package/index.d.ts +1 -0
  98. package/index.js +12 -1
  99. package/internals/components/ChartsText.d.ts +1 -1
  100. package/internals/geometry.d.ts +2 -2
  101. package/internals/geometry.js +2 -2
  102. package/internals/isBandScale.d.ts +3 -1
  103. package/internals/utils.d.ts +5 -0
  104. package/legacy/BarChart/BarChart.js +41 -4
  105. package/legacy/ChartsAxis/ChartsAxis.js +6 -5
  106. package/legacy/ChartsLegend/ChartsLegend.js +2 -2
  107. package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
  108. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  109. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  110. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  111. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  112. package/legacy/ChartsReferenceLine/common.js +20 -0
  113. package/legacy/ChartsReferenceLine/index.js +2 -0
  114. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  115. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  116. package/legacy/ChartsTooltip/ChartsTooltip.js +20 -12
  117. package/legacy/ChartsTooltip/ChartsTooltipTable.js +3 -3
  118. package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
  119. package/legacy/ChartsTooltip/index.js +2 -1
  120. package/legacy/ChartsTooltip/utils.js +1 -1
  121. package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
  122. package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
  123. package/legacy/LineChart/LineChart.js +41 -4
  124. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  125. package/legacy/LineChart/MarkPlot.js +2 -1
  126. package/legacy/PieChart/PieArc.js +18 -2
  127. package/legacy/PieChart/PieArcLabel.js +7 -11
  128. package/legacy/PieChart/PieArcLabelPlot.js +1 -1
  129. package/legacy/PieChart/PieArcPlot.js +1 -1
  130. package/legacy/PieChart/PieChart.js +34 -4
  131. package/legacy/PieChart/index.js +2 -2
  132. package/legacy/ScatterChart/ScatterChart.js +34 -4
  133. package/legacy/SparkLineChart/SparkLineChart.js +22 -0
  134. package/legacy/context/CartesianContextProvider.js +11 -0
  135. package/legacy/context/DrawingProvider.js +6 -0
  136. package/legacy/index.js +2 -1
  137. package/legacy/internals/geometry.js +2 -2
  138. package/models/axis.d.ts +33 -13
  139. package/models/layout.d.ts +6 -0
  140. package/models/seriesType/common.d.ts +16 -0
  141. package/modern/BarChart/BarChart.js +41 -4
  142. package/modern/ChartsAxis/ChartsAxis.js +5 -5
  143. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  144. package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
  145. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  146. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
  147. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
  148. package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  149. package/modern/ChartsReferenceLine/common.js +20 -0
  150. package/modern/ChartsReferenceLine/index.js +2 -0
  151. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  152. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  153. package/modern/ChartsTooltip/ChartsTooltip.js +15 -7
  154. package/modern/ChartsTooltip/ChartsTooltipTable.js +3 -3
  155. package/modern/ChartsTooltip/chartsTooltipClasses.js +5 -0
  156. package/modern/ChartsTooltip/index.js +2 -1
  157. package/modern/ChartsTooltip/utils.js +1 -1
  158. package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
  159. package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
  160. package/modern/LineChart/LineChart.js +41 -4
  161. package/modern/LineChart/LineHighlightPlot.js +1 -1
  162. package/modern/LineChart/MarkPlot.js +2 -1
  163. package/modern/PieChart/PieArc.js +18 -2
  164. package/modern/PieChart/PieArcLabel.js +7 -11
  165. package/modern/PieChart/PieArcLabelPlot.js +1 -1
  166. package/modern/PieChart/PieArcPlot.js +1 -1
  167. package/modern/PieChart/PieChart.js +34 -4
  168. package/modern/PieChart/index.js +2 -2
  169. package/modern/ScatterChart/ScatterChart.js +34 -4
  170. package/modern/SparkLineChart/SparkLineChart.js +22 -0
  171. package/modern/context/CartesianContextProvider.js +11 -0
  172. package/modern/context/DrawingProvider.js +6 -0
  173. package/modern/index.js +2 -1
  174. package/modern/internals/geometry.js +2 -2
  175. package/package.json +1 -1
  176. package/themeAugmentation/components.d.ts +1 -0
  177. package/themeAugmentation/overrides.d.ts +2 -0
  178. package/ChartsTooltip/tooltipClasses.d.ts +0 -13
  179. package/ChartsTooltip/tooltipClasses.js +0 -12
  180. package/esm/ChartsTooltip/tooltipClasses.js +0 -5
  181. package/legacy/ChartsTooltip/tooltipClasses.js +0 -5
  182. package/modern/ChartsTooltip/tooltipClasses.js +0 -5
@@ -0,0 +1,70 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { ChartsXReferenceLine } from './ChartsXReferenceLine';
5
+ import { ChartsYReferenceLine } from './ChartsYReferenceLine';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ function ChartsReferenceLine(props) {
8
+ if (props.x !== undefined && props.y !== undefined) {
9
+ throw new Error('MUI-X: The ChartsReferenceLine can not have both `x` and `y` props set.');
10
+ }
11
+ if (props.x === undefined && props.y === undefined) {
12
+ throw new Error('MUI-X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
13
+ }
14
+ if (props.x !== undefined) {
15
+ return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
16
+ }
17
+ return /*#__PURE__*/_jsx(ChartsYReferenceLine, _extends({}, props));
18
+ }
19
+ process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
20
+ // ----------------------------- Warning --------------------------------
21
+ // | These PropTypes are generated from the TypeScript type definitions |
22
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
23
+ // ----------------------------------------------------------------------
24
+ /**
25
+ * The id of the axis used for the reference value.
26
+ * @default The `id` of the first defined axis.
27
+ */
28
+ axisId: PropTypes.string,
29
+ /**
30
+ * Override or extend the styles applied to the component.
31
+ */
32
+ classes: PropTypes.object,
33
+ /**
34
+ * The label to display along the reference line.
35
+ */
36
+ label: PropTypes.string,
37
+ /**
38
+ * The alignment if the label is in the chart drawing area.
39
+ * @default 'middle'
40
+ */
41
+ labelAlign: PropTypes.oneOf(['end', 'middle', 'start']),
42
+ /**
43
+ * The style applied to the label.
44
+ */
45
+ labelStyle: PropTypes.object,
46
+ /**
47
+ * The style applied to the line.
48
+ */
49
+ lineStyle: PropTypes.object,
50
+ /**
51
+ * Additional space arround the label in px.
52
+ * Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
53
+ * @default 5
54
+ */
55
+ spacing: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
56
+ x: PropTypes.number,
57
+ y: PropTypes.number
58
+ })]),
59
+ /**
60
+ * The x value associated with the reference line.
61
+ * If defined the reference line will be vertical.
62
+ */
63
+ x: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]),
64
+ /**
65
+ * The y value associated with the reference line.
66
+ * If defined the reference line will be horizontal.
67
+ */
68
+ y: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
69
+ } : void 0;
70
+ export { ChartsReferenceLine };
@@ -0,0 +1,104 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import composeClasses from '@mui/utils/composeClasses';
4
+ import { useDrawingArea, useXScale } from '../hooks';
5
+ import { ReferenceLineRoot } from './common';
6
+ import { ChartsText } from '../internals/components/ChartsText';
7
+ import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ const getTextParams = ({
11
+ top,
12
+ height,
13
+ spacingY,
14
+ labelAlign = 'middle'
15
+ }) => {
16
+ switch (labelAlign) {
17
+ case 'start':
18
+ return {
19
+ y: top + spacingY,
20
+ style: {
21
+ dominantBaseline: 'hanging',
22
+ textAnchor: 'start'
23
+ }
24
+ };
25
+ case 'end':
26
+ return {
27
+ y: top + height - spacingY,
28
+ style: {
29
+ dominantBaseline: 'auto',
30
+ textAnchor: 'start'
31
+ }
32
+ };
33
+ default:
34
+ return {
35
+ y: top + height / 2,
36
+ style: {
37
+ dominantBaseline: 'central',
38
+ textAnchor: 'start'
39
+ }
40
+ };
41
+ }
42
+ };
43
+ export function getXReferenceLineClasses(classes) {
44
+ return composeClasses({
45
+ root: ['root', 'vertical'],
46
+ line: ['line'],
47
+ label: ['label']
48
+ }, getReferenceLineUtilityClass, classes);
49
+ }
50
+ let warnedOnce = false;
51
+ function ChartsXReferenceLine(props) {
52
+ const {
53
+ x,
54
+ label = '',
55
+ spacing = 5,
56
+ classes: inClasses,
57
+ labelAlign,
58
+ lineStyle,
59
+ labelStyle,
60
+ axisId
61
+ } = props;
62
+ const {
63
+ top,
64
+ height
65
+ } = useDrawingArea();
66
+ const xAxisScale = useXScale(axisId);
67
+ const xPosition = xAxisScale(x);
68
+ if (xPosition === undefined) {
69
+ if (process.env.NODE_ENV !== 'production') {
70
+ if (!warnedOnce) {
71
+ warnedOnce = true;
72
+ console.error(`MUI X: the value ${x} does not exist in the data of x axis with id ${axisId}.`);
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+ const d = `M ${xPosition} ${top} l 0 ${height}`;
78
+ const classes = getXReferenceLineClasses(inClasses);
79
+ const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
80
+ const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
81
+ const textParams = _extends({
82
+ x: xPosition + spacingX,
83
+ text: label,
84
+ fontSize: 12
85
+ }, getTextParams({
86
+ top,
87
+ height,
88
+ spacingY,
89
+ labelAlign
90
+ }), {
91
+ className: classes.label
92
+ });
93
+ return /*#__PURE__*/_jsxs(ReferenceLineRoot, {
94
+ className: classes.root,
95
+ children: [/*#__PURE__*/_jsx("path", {
96
+ d: d,
97
+ className: classes.line,
98
+ style: lineStyle
99
+ }), /*#__PURE__*/_jsx(ChartsText, _extends({}, textParams, {
100
+ style: _extends({}, textParams.style, labelStyle)
101
+ }))]
102
+ });
103
+ }
104
+ export { ChartsXReferenceLine };
@@ -0,0 +1,104 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import composeClasses from '@mui/utils/composeClasses';
4
+ import { useDrawingArea, useYScale } from '../hooks';
5
+ import { ReferenceLineRoot } from './common';
6
+ import { ChartsText } from '../internals/components/ChartsText';
7
+ import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ const getTextParams = ({
11
+ left,
12
+ width,
13
+ spacingX,
14
+ labelAlign = 'middle'
15
+ }) => {
16
+ switch (labelAlign) {
17
+ case 'start':
18
+ return {
19
+ x: left + spacingX,
20
+ style: {
21
+ dominantBaseline: 'auto',
22
+ textAnchor: 'start'
23
+ }
24
+ };
25
+ case 'end':
26
+ return {
27
+ x: left + width - spacingX,
28
+ style: {
29
+ dominantBaseline: 'auto',
30
+ textAnchor: 'end'
31
+ }
32
+ };
33
+ default:
34
+ return {
35
+ x: left + width / 2,
36
+ style: {
37
+ dominantBaseline: 'auto',
38
+ textAnchor: 'middle'
39
+ }
40
+ };
41
+ }
42
+ };
43
+ let warnedOnce = false;
44
+ export function getYReferenceLineClasses(classes) {
45
+ return composeClasses({
46
+ root: ['root', 'horizontal'],
47
+ line: ['line'],
48
+ label: ['label']
49
+ }, getReferenceLineUtilityClass, classes);
50
+ }
51
+ function ChartsYReferenceLine(props) {
52
+ const {
53
+ y,
54
+ label = '',
55
+ spacing = 5,
56
+ classes: inClasses,
57
+ labelAlign,
58
+ lineStyle,
59
+ labelStyle,
60
+ axisId
61
+ } = props;
62
+ const {
63
+ left,
64
+ width
65
+ } = useDrawingArea();
66
+ const yAxisScale = useYScale(axisId);
67
+ const yPosition = yAxisScale(y);
68
+ if (yPosition === undefined) {
69
+ if (process.env.NODE_ENV !== 'production') {
70
+ if (!warnedOnce) {
71
+ warnedOnce = true;
72
+ console.error(`MUI X: the value ${y} does not exist in the data of y axis with id ${axisId}.`);
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+ const d = `M ${left} ${yPosition} l ${width} 0`;
78
+ const classes = getYReferenceLineClasses(inClasses);
79
+ const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
80
+ const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
81
+ const textParams = _extends({
82
+ y: yPosition - spacingY,
83
+ text: label,
84
+ fontSize: 12
85
+ }, getTextParams({
86
+ left,
87
+ width,
88
+ spacingX,
89
+ labelAlign
90
+ }), {
91
+ className: classes.label
92
+ });
93
+ return /*#__PURE__*/_jsxs(ReferenceLineRoot, {
94
+ className: classes.root,
95
+ children: [/*#__PURE__*/_jsx("path", {
96
+ d: d,
97
+ className: classes.line,
98
+ style: lineStyle
99
+ }), /*#__PURE__*/_jsx(ChartsText, _extends({}, textParams, {
100
+ style: _extends({}, textParams.style, labelStyle)
101
+ }))]
102
+ });
103
+ }
104
+ export { ChartsYReferenceLine };
@@ -0,0 +1,6 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ export function getReferenceLineUtilityClass(slot) {
4
+ return generateUtilityClass('MuiChartsReferenceLine', slot);
5
+ }
6
+ export const referenceLineClasses = generateUtilityClasses('MuiChartsReferenceLine', ['root', 'vertical', 'horizontal', 'line', 'label']);
@@ -0,0 +1,20 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { styled } from '@mui/material/styles';
3
+ import { referenceLineClasses } from './chartsReferenceLineClasses';
4
+ export const ReferenceLineRoot = styled('g')(({
5
+ theme
6
+ }) => ({
7
+ [`& .${referenceLineClasses.line}`]: {
8
+ fill: 'none',
9
+ stroke: (theme.vars || theme).palette.text.primary,
10
+ shapeRendering: 'crispEdges',
11
+ strokeWidth: 1,
12
+ pointerEvents: 'none'
13
+ },
14
+ [`& .${referenceLineClasses.label}`]: _extends({
15
+ fill: (theme.vars || theme).palette.text.primary,
16
+ stroke: 'none',
17
+ pointerEvents: 'none',
18
+ fontSize: 12
19
+ }, theme.typography.body1)
20
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './ChartsReferenceLine';
2
+ export * from './chartsReferenceLineClasses';
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import clsx from 'clsx';
3
4
  import Typography from '@mui/material/Typography';
4
5
  import { useSlotProps } from '@mui/base/utils';
5
6
  import { SeriesContext } from '../context/SeriesContextProvider';
@@ -24,6 +25,7 @@ export function DefaultChartsAxisContent(props) {
24
25
  sx: sx,
25
26
  className: classes.root,
26
27
  children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
28
+ className: classes.table,
27
29
  children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
28
30
  children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
29
31
  children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
@@ -46,21 +48,23 @@ export function DefaultChartsAxisContent(props) {
46
48
  return null;
47
49
  }
48
50
  return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
51
+ className: classes.row,
49
52
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
50
- className: classes.markCell,
53
+ className: clsx(classes.markCell, classes.cell),
51
54
  children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
52
55
  ownerState: {
53
56
  color
54
57
  },
55
- boxShadow: 1
58
+ boxShadow: 1,
59
+ className: classes.mark
56
60
  })
57
61
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
58
- className: classes.labelCell,
62
+ className: clsx(classes.labelCell, classes.cell),
59
63
  children: label ? /*#__PURE__*/_jsx(Typography, {
60
64
  children: label
61
65
  }) : null
62
66
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
63
- className: classes.valueCell,
67
+ className: clsx(classes.valueCell, classes.cell),
64
68
  children: /*#__PURE__*/_jsx(Typography, {
65
69
  children: formattedValue
66
70
  })
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import clsx from 'clsx';
3
4
  import { useSlotProps } from '@mui/base/utils';
4
5
  import { SeriesContext } from '../context/SeriesContextProvider';
5
6
  import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
@@ -33,20 +34,23 @@ export function DefaultChartsItemContent(props) {
33
34
  sx: sx,
34
35
  className: classes.root,
35
36
  children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
37
+ className: classes.table,
36
38
  children: /*#__PURE__*/_jsx("tbody", {
37
39
  children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
40
+ className: classes.row,
38
41
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
39
- className: classes.markCell,
42
+ className: clsx(classes.markCell, classes.cell),
40
43
  children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
41
44
  ownerState: {
42
45
  color
43
- }
46
+ },
47
+ className: classes.mark
44
48
  })
45
49
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
46
- className: classes.labelCell,
50
+ className: clsx(classes.labelCell, classes.cell),
47
51
  children: displayedLabel
48
52
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
49
- className: classes.valueCell,
53
+ className: clsx(classes.valueCell, classes.cell),
50
54
  children: formattedValue
51
55
  })]
52
56
  })
@@ -2,15 +2,15 @@ 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 composeClasses from '@mui/utils/composeClasses';
5
- import { styled } from '@mui/material/styles';
5
+ import { styled, useThemeProps } from '@mui/material/styles';
6
6
  import { Popper } from '@mui/base/Popper';
7
7
  import { NoSsr } from '@mui/base/NoSsr';
8
8
  import { useSlotProps } from '@mui/base/utils';
9
9
  import { InteractionContext } from '../context/InteractionProvider';
10
- import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
10
+ import { generateVirtualElement, useMouseTracker, getTooltipHasData } from './utils';
11
11
  import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
12
12
  import { ChartsAxisTooltipContent } from './ChartsAxisTooltipContent';
13
- import { getTooltipUtilityClass } from './tooltipClasses';
13
+ import { getChartsTooltipUtilityClass } from './chartsTooltipClasses';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  const useUtilityClasses = ownerState => {
16
16
  const {
@@ -18,11 +18,15 @@ const useUtilityClasses = ownerState => {
18
18
  } = ownerState;
19
19
  const slots = {
20
20
  root: ['root'],
21
+ table: ['table'],
22
+ row: ['row'],
23
+ cell: ['cell'],
24
+ mark: ['mark'],
21
25
  markCell: ['markCell'],
22
26
  labelCell: ['labelCell'],
23
27
  valueCell: ['valueCell']
24
28
  };
25
- return composeClasses(slots, getTooltipUtilityClass, classes);
29
+ return composeClasses(slots, getChartsTooltipUtilityClass, classes);
26
30
  };
27
31
  const ChartsTooltipRoot = styled(Popper, {
28
32
  name: 'MuiChartsTooltip',
@@ -45,23 +49,27 @@ const ChartsTooltipRoot = styled(Popper, {
45
49
  * - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
46
50
  */
47
51
  function ChartsTooltip(props) {
52
+ const themeProps = useThemeProps({
53
+ props,
54
+ name: 'MuiChartsTooltip'
55
+ });
48
56
  const {
49
57
  trigger = 'axis',
50
58
  itemContent,
51
59
  axisContent,
52
60
  slots,
53
61
  slotProps
54
- } = props;
62
+ } = themeProps;
55
63
  const mousePosition = useMouseTracker();
56
64
  const {
57
65
  item,
58
66
  axis
59
67
  } = React.useContext(InteractionContext);
60
68
  const displayedData = trigger === 'item' ? item : axis;
61
- const tooltipHasData = getTootipHasData(trigger, displayedData);
69
+ const tooltipHasData = getTooltipHasData(trigger, displayedData);
62
70
  const popperOpen = mousePosition !== null && tooltipHasData;
63
71
  const classes = useUtilityClasses({
64
- classes: props.classes
72
+ classes: themeProps.classes
65
73
  });
66
74
  const PopperComponent = slots?.popper ?? ChartsTooltipRoot;
67
75
  const popperProps = useSlotProps({
@@ -1,6 +1,6 @@
1
1
  import Box from '@mui/system/Box';
2
2
  import { styled } from '@mui/material/styles';
3
- import { tooltipClasses } from './tooltipClasses';
3
+ import { chartsTooltipClasses } from './chartsTooltipClasses';
4
4
  export const ChartsTooltipPaper = styled('div', {
5
5
  name: 'MuiChartsTooltip',
6
6
  slot: 'Container'
@@ -45,10 +45,10 @@ export const ChartsTooltipCell = styled('td', {
45
45
  }) => ({
46
46
  verticalAlign: 'middle',
47
47
  color: (theme.vars || theme).palette.text.secondary,
48
- [`&.${tooltipClasses.labelCell}`]: {
48
+ [`&.${chartsTooltipClasses.labelCell}`]: {
49
49
  paddingLeft: theme.spacing(1)
50
50
  },
51
- [`&.${tooltipClasses.valueCell}`]: {
51
+ [`&.${chartsTooltipClasses.valueCell}`]: {
52
52
  paddingLeft: theme.spacing(4),
53
53
  color: (theme.vars || theme).palette.text.primary
54
54
  },
@@ -0,0 +1,5 @@
1
+ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ export function getChartsTooltipUtilityClass(slot) {
3
+ return generateUtilityClass('MuiChartsTooltip', slot);
4
+ }
5
+ export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
@@ -1 +1,2 @@
1
- export * from './ChartsTooltip';
1
+ export * from './ChartsTooltip';
2
+ export * from './chartsTooltipClasses';
@@ -71,7 +71,7 @@ export function useMouseTracker() {
71
71
  }, [svgRef]);
72
72
  return mousePosition;
73
73
  }
74
- export function getTootipHasData(trigger, displayedData) {
74
+ export function getTooltipHasData(trigger, displayedData) {
75
75
  if (trigger === 'item') {
76
76
  return displayedData !== null;
77
77
  }
@@ -106,17 +106,20 @@ function ChartsXAxis(inProps) {
106
106
  props: _extends({}, defaultProps, inProps),
107
107
  name: 'MuiChartsXAxis'
108
108
  });
109
+ const {
110
+ xAxisIds
111
+ } = React.useContext(CartesianContext);
109
112
  const _React$useContext = React.useContext(CartesianContext),
110
- _props$axisId = props.axisId,
113
+ _ref = props.axisId ?? xAxisIds[0],
111
114
  {
112
115
  xAxis: {
113
- [_props$axisId]: {
116
+ [_ref]: {
114
117
  scale: xScale,
115
118
  tickNumber
116
119
  }
117
120
  }
118
121
  } = _React$useContext,
119
- settings = _objectWithoutPropertiesLoose(_React$useContext.xAxis[_props$axisId], _excluded);
122
+ settings = _objectWithoutPropertiesLoose(_React$useContext.xAxis[_ref], _excluded);
120
123
  const isMounted = useMounted();
121
124
  const defaultizedProps = _extends({}, defaultProps, settings, props);
122
125
  const {
@@ -234,9 +237,10 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
234
237
  // | To update them edit the TypeScript types and run "yarn proptypes" |
235
238
  // ----------------------------------------------------------------------
236
239
  /**
237
- * Id of the axis to render.
240
+ * The id of the axis to render.
241
+ * If undefined, it will be the first defined axis.
238
242
  */
239
- axisId: PropTypes.string.isRequired,
243
+ axisId: PropTypes.string,
240
244
  /**
241
245
  * Override or extend the styles applied to the component.
242
246
  */
@@ -52,17 +52,20 @@ function ChartsYAxis(inProps) {
52
52
  props: _extends({}, defaultProps, inProps),
53
53
  name: 'MuiChartsYAxis'
54
54
  });
55
+ const {
56
+ yAxisIds
57
+ } = React.useContext(CartesianContext);
55
58
  const _React$useContext = React.useContext(CartesianContext),
56
- _props$axisId = props.axisId,
59
+ _ref = props.axisId ?? yAxisIds[0],
57
60
  {
58
61
  yAxis: {
59
- [_props$axisId]: {
62
+ [_ref]: {
60
63
  scale: yScale,
61
64
  tickNumber
62
65
  }
63
66
  }
64
67
  } = _React$useContext,
65
- settings = _objectWithoutPropertiesLoose(_React$useContext.yAxis[_props$axisId], _excluded);
68
+ settings = _objectWithoutPropertiesLoose(_React$useContext.yAxis[_ref], _excluded);
66
69
  const defaultizedProps = _extends({}, defaultProps, settings, props);
67
70
  const {
68
71
  position,
@@ -167,9 +170,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
167
170
  // | To update them edit the TypeScript types and run "yarn proptypes" |
168
171
  // ----------------------------------------------------------------------
169
172
  /**
170
- * Id of the axis to render.
173
+ * The id of the axis to render.
174
+ * If undefined, it will be the first defined axis.
171
175
  */
172
- axisId: PropTypes.string.isRequired,
176
+ axisId: PropTypes.string,
173
177
  /**
174
178
  * Override or extend the styles applied to the component.
175
179
  */