@mui/x-charts 8.3.0 → 8.4.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 (96) hide show
  1. package/BarChart/BarChart.js +3 -2
  2. package/CHANGELOG.md +206 -10
  3. package/ChartContainer/ChartContainer.js +1 -1
  4. package/ChartsAxis/axisClasses.d.ts +5 -0
  5. package/ChartsAxis/axisClasses.js +1 -1
  6. package/ChartsGrid/ChartsHorizontalGrid.js +2 -1
  7. package/ChartsGrid/ChartsVerticalGrid.js +2 -1
  8. package/ChartsLegend/ChartsLegend.js +1 -0
  9. package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
  10. package/ChartsSurface/ChartsSurface.js +1 -0
  11. package/ChartsXAxis/ChartsXAxis.js +9 -17
  12. package/ChartsYAxis/ChartsYAxis.js +6 -9
  13. package/Gauge/Gauge.js +1 -0
  14. package/Gauge/GaugeContainer.js +1 -0
  15. package/Gauge/GaugeProvider.js +1 -3
  16. package/LineChart/AnimatedLine.js +1 -0
  17. package/LineChart/LineChart.js +3 -2
  18. package/LineChart/LineHighlightPlot.js +1 -4
  19. package/LineChart/MarkPlot.js +1 -4
  20. package/PieChart/PieArc.js +1 -0
  21. package/PieChart/PieArcLabel.js +1 -0
  22. package/PieChart/PieChart.js +7 -6
  23. package/RadarChart/RadarChart.js +3 -2
  24. package/ScatterChart/Scatter.js +3 -11
  25. package/ScatterChart/ScatterChart.js +5 -4
  26. package/SparkLineChart/SparkLineChart.js +31 -26
  27. package/Toolbar/ToolbarButton.js +1 -0
  28. package/context/ChartProvider/ChartContext.js +1 -3
  29. package/esm/BarChart/BarChart.js +3 -2
  30. package/esm/ChartContainer/ChartContainer.js +1 -1
  31. package/esm/ChartsAxis/axisClasses.d.ts +5 -0
  32. package/esm/ChartsAxis/axisClasses.js +1 -1
  33. package/esm/ChartsGrid/ChartsHorizontalGrid.js +2 -1
  34. package/esm/ChartsGrid/ChartsVerticalGrid.js +2 -1
  35. package/esm/ChartsLegend/ChartsLegend.js +1 -0
  36. package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
  37. package/esm/ChartsSurface/ChartsSurface.js +1 -0
  38. package/esm/ChartsXAxis/ChartsXAxis.js +9 -17
  39. package/esm/ChartsYAxis/ChartsYAxis.js +6 -9
  40. package/esm/Gauge/Gauge.js +1 -0
  41. package/esm/Gauge/GaugeContainer.js +1 -0
  42. package/esm/Gauge/GaugeProvider.js +1 -3
  43. package/esm/LineChart/AnimatedLine.js +1 -0
  44. package/esm/LineChart/LineChart.js +3 -2
  45. package/esm/LineChart/LineHighlightPlot.js +1 -4
  46. package/esm/LineChart/MarkPlot.js +1 -4
  47. package/esm/PieChart/PieArc.js +1 -0
  48. package/esm/PieChart/PieArcLabel.js +1 -0
  49. package/esm/PieChart/PieChart.js +5 -4
  50. package/esm/RadarChart/RadarChart.js +3 -2
  51. package/esm/ScatterChart/Scatter.js +3 -11
  52. package/esm/ScatterChart/ScatterChart.js +5 -4
  53. package/esm/SparkLineChart/SparkLineChart.js +31 -26
  54. package/esm/Toolbar/ToolbarButton.js +1 -0
  55. package/esm/context/ChartProvider/ChartContext.js +1 -3
  56. package/esm/hooks/useTicks.d.ts +1 -4
  57. package/esm/hooks/useTicks.js +29 -28
  58. package/esm/index.js +1 -1
  59. package/esm/internals/constants.d.ts +1 -1
  60. package/esm/internals/constants.js +1 -1
  61. package/esm/internals/consumeSlots.js +2 -1
  62. package/esm/internals/consumeThemeProps.js +3 -1
  63. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
  64. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
  65. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -2
  66. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
  67. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +3 -1
  68. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
  69. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  70. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +8 -0
  71. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -2
  72. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
  73. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
  74. package/esm/internals/ticks.d.ts +6 -0
  75. package/esm/internals/ticks.js +22 -0
  76. package/hooks/useTicks.d.ts +1 -4
  77. package/hooks/useTicks.js +29 -29
  78. package/index.js +1 -1
  79. package/internals/constants.d.ts +1 -1
  80. package/internals/constants.js +2 -2
  81. package/internals/consumeSlots.js +2 -1
  82. package/internals/consumeThemeProps.js +3 -1
  83. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
  84. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
  85. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -3
  86. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
  87. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +3 -1
  88. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
  89. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  90. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +8 -0
  91. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +3 -3
  92. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
  93. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
  94. package/internals/ticks.d.ts +6 -0
  95. package/internals/ticks.js +29 -0
  96. package/package.json +3 -3
@@ -61,13 +61,14 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
61
61
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
62
62
  "data-drawing-container": true,
63
63
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
64
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
65
- trigger: "item"
66
- }, props.slotProps?.tooltip)), children]
67
- }))]
64
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), children]
65
+ })), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
66
+ trigger: "item"
67
+ }, props.slotProps?.tooltip))]
68
68
  }))
69
69
  }));
70
70
  });
71
+ if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
71
72
  process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
72
73
  // ----------------------------- Warning --------------------------------
73
74
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -15,7 +15,8 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
15
15
  var _ChartsClipPath = require("../ChartsClipPath");
16
16
  var _BarChart = require("../BarChart");
17
17
  var _LineChart = require("../LineChart");
18
- var _ChartContainer = require("../ChartContainer");
18
+ var _ChartDataProvider = require("../ChartDataProvider");
19
+ var _ChartsSurface = require("../ChartsSurface");
19
20
  var _constants = require("../constants");
20
21
  var _ChartsTooltip = require("../ChartsTooltip");
21
22
  var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
@@ -78,8 +79,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
78
79
  }
79
80
  return typeof color === 'function' ? mode => [color(mode)] : [color];
80
81
  }, [color]);
81
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({}, other, {
82
- ref: ref,
82
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartDataProvider.ChartDataProvider, {
83
83
  series: [(0, _extends2.default)({
84
84
  type: plotType,
85
85
  data,
@@ -92,7 +92,6 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
92
92
  width: width,
93
93
  height: height,
94
94
  margin: margin,
95
- className: className,
96
95
  xAxis: [(0, _extends2.default)({
97
96
  id: _constants.DEFAULT_X_AXIS_KEY,
98
97
  scaleType: plotType === 'bar' ? 'band' : 'point',
@@ -109,34 +108,40 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
109
108
  position: 'none'
110
109
  })],
111
110
  colors: colors,
112
- sx: sx,
113
111
  disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
114
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
115
- clipPath: `url(#${clipPathId})`,
116
- children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
117
- skipAnimation: true,
118
- slots: slots,
119
- slotProps: slotProps
120
- }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
122
- skipAnimation: true,
123
- slots: slots,
124
- slotProps: slotProps
125
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
112
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({
113
+ className: className,
114
+ ref: ref,
115
+ sx: sx
116
+ }, other, {
117
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
118
+ clipPath: `url(#${clipPathId})`,
119
+ children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
126
120
  skipAnimation: true,
127
121
  slots: slots,
128
122
  slotProps: slotProps
123
+ }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
125
+ skipAnimation: true,
126
+ slots: slots,
127
+ slotProps: slotProps
128
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
129
+ skipAnimation: true,
130
+ slots: slots,
131
+ slotProps: slotProps
132
+ })]
129
133
  })]
130
- })]
131
- }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
132
- slots: slots,
133
- slotProps: slotProps
134
- }), disableClipping ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
135
- id: clipPathId,
136
- offset: clipPathOffset
137
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), children]
138
- }));
134
+ }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
135
+ slots: slots,
136
+ slotProps: slotProps
137
+ }), disableClipping ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
138
+ id: clipPathId,
139
+ offset: clipPathOffset
140
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), children]
141
+ })), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
142
+ });
139
143
  });
144
+ if (process.env.NODE_ENV !== "production") SparkLineChart.displayName = "SparkLineChart";
140
145
  process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
141
146
  // ----------------------------- Warning --------------------------------
142
147
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -17,6 +17,7 @@ const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(func
17
17
  ref: ref
18
18
  }, props));
19
19
  });
20
+ if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
20
21
  process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
21
22
  // ----------------------------- Warning --------------------------------
22
23
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -10,6 +10,4 @@ var React = _interopRequireWildcard(require("react"));
10
10
  * @ignore - internal component.
11
11
  */
12
12
  const ChartContext = exports.ChartContext = /*#__PURE__*/React.createContext(null);
13
- if (process.env.NODE_ENV !== 'production') {
14
- ChartContext.displayName = 'ChartContext';
15
- }
13
+ if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";
@@ -57,11 +57,12 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
57
57
  children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
58
58
  children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
59
59
  children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
60
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
61
- }))]
60
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
61
+ })), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
62
62
  }))
63
63
  }));
64
64
  });
65
+ if (process.env.NODE_ENV !== "production") BarChart.displayName = "BarChart";
65
66
  process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
66
67
  // ----------------------------- Warning --------------------------------
67
68
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -45,7 +45,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
45
45
  });
46
46
 
47
47
  // @ts-ignore
48
-
48
+ if (process.env.NODE_ENV !== "production") ChartContainer.displayName = "ChartContainer";
49
49
  process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
50
50
  // ----------------------------- Warning --------------------------------
51
51
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -27,6 +27,11 @@ export interface ChartsAxisClasses {
27
27
  left: string;
28
28
  /** Styles applied to the right axis. */
29
29
  right: string;
30
+ /**
31
+ * Styles applied to the root element for the axis with the given ID.
32
+ * Needs to be suffixed with the axis ID: `.${axisClasses.id}-${axisId}`.
33
+ */
34
+ id: string;
30
35
  }
31
36
  export type ChartsAxisClassKey = keyof ChartsAxisClasses;
32
37
  export declare function getAxisUtilityClass(slot: string): string;
@@ -3,4 +3,4 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
3
  export function getAxisUtilityClass(slot) {
4
4
  return generateUtilityClass('MuiChartsAxis', slot);
5
5
  }
6
- export const axisClasses = generateUtilityClasses('MuiChartsAxis', ['root', 'line', 'tickContainer', 'tick', 'tickLabel', 'label', 'directionX', 'directionY', 'top', 'bottom', 'left', 'right']);
6
+ export const axisClasses = generateUtilityClasses('MuiChartsAxis', ['root', 'line', 'tickContainer', 'tick', 'tickLabel', 'label', 'directionX', 'directionY', 'top', 'bottom', 'left', 'right', 'id']);
@@ -20,7 +20,8 @@ export function ChartsGridHorizontal(props) {
20
20
  const yTicks = useTicks({
21
21
  scale,
22
22
  tickNumber,
23
- tickInterval
23
+ tickInterval,
24
+ direction: 'y'
24
25
  });
25
26
  return /*#__PURE__*/_jsx(React.Fragment, {
26
27
  children: yTicks.map(({
@@ -20,7 +20,8 @@ export function ChartsGridVertical(props) {
20
20
  const xTicks = useTicks({
21
21
  scale,
22
22
  tickNumber,
23
- tickInterval
23
+ tickInterval,
24
+ direction: 'x'
24
25
  });
25
26
  return /*#__PURE__*/_jsx(React.Fragment, {
26
27
  children: xTicks.map(({
@@ -100,6 +100,7 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
100
100
  })
101
101
  }));
102
102
  }));
103
+ if (process.env.NODE_ENV !== "production") ChartsLegend.displayName = "ChartsLegend";
103
104
  process.env.NODE_ENV !== "production" ? ChartsLegend.propTypes = {
104
105
  // ----------------------------- Warning --------------------------------
105
106
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -9,9 +9,7 @@ import { useThemeProps } from '@mui/material/styles';
9
9
  import { DEFAULT_LOCALE } from "../locales/enUS.js";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  export const ChartsLocalizationContext = /*#__PURE__*/React.createContext(null);
12
- if (process.env.NODE_ENV !== 'production') {
13
- ChartsLocalizationContext.displayName = 'ChartsLocalizationContext';
14
- }
12
+ if (process.env.NODE_ENV !== "production") ChartsLocalizationContext.displayName = "ChartsLocalizationContext";
15
13
  /**
16
14
  * Demos:
17
15
  *
@@ -86,6 +86,7 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inPro
86
86
  }), /*#__PURE__*/_jsx(ChartsAxesGradients, {}), hasIntrinsicSize && children]
87
87
  }));
88
88
  });
89
+ if (process.env.NODE_ENV !== "production") ChartsSurface.displayName = "ChartsSurface";
89
90
  process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
90
91
  // ----------------------------- Warning --------------------------------
91
92
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -31,10 +31,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
31
  const useUtilityClasses = ownerState => {
32
32
  const {
33
33
  classes,
34
- position
34
+ position,
35
+ id
35
36
  } = ownerState;
36
37
  const slots = {
37
- root: ['root', 'directionX', position],
38
+ root: ['root', 'directionX', position, `id-${id}`],
38
39
  line: ['line'],
39
40
  tickContainer: ['tickContainer'],
40
41
  tick: ['tick'],
@@ -56,7 +57,7 @@ function getVisibleLabels(xTicks, {
56
57
  tickLabelMinGap,
57
58
  reverse,
58
59
  isMounted,
59
- isPointInside
60
+ isXInside
60
61
  }) {
61
62
  const getTickLabelSize = tick => {
62
63
  if (!isMounted || tick.formattedValue === undefined) {
@@ -91,7 +92,7 @@ function getVisibleLabels(xTicks, {
91
92
  if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
92
93
  return false;
93
94
  }
94
- if (!isPointInside(textPosition)) {
95
+ if (!isXInside(textPosition)) {
95
96
  return false;
96
97
  }
97
98
 
@@ -250,7 +251,8 @@ function ChartsXAxis(inProps) {
250
251
  valueFormatter,
251
252
  tickInterval,
252
253
  tickPlacement,
253
- tickLabelPlacement
254
+ tickLabelPlacement,
255
+ direction: 'x'
254
256
  });
255
257
  const visibleLabels = getVisibleLabels(xTicks, {
256
258
  tickLabelStyle: axisTickLabelProps.style,
@@ -258,12 +260,7 @@ function ChartsXAxis(inProps) {
258
260
  tickLabelMinGap,
259
261
  reverse,
260
262
  isMounted,
261
- isPointInside: x => instance.isPointInside({
262
- x,
263
- y: -1
264
- }, {
265
- direction: 'x'
266
- })
263
+ isXInside: instance.isXInside
267
264
  });
268
265
  const axisLabelProps = useSlotProps({
269
266
  elementType: Label,
@@ -311,12 +308,7 @@ function ChartsXAxis(inProps) {
311
308
  } = item;
312
309
  const xTickLabel = labelOffset ?? 0;
313
310
  const yTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
314
- const showTick = instance.isPointInside({
315
- x: tickOffset,
316
- y: -1
317
- }, {
318
- direction: 'x'
319
- });
311
+ const showTick = instance.isXInside(tickOffset);
320
312
  const tickLabel = tickLabels.get(item);
321
313
  const showTickLabel = visibleLabels.has(item);
322
314
  return /*#__PURE__*/_jsxs("g", {
@@ -28,10 +28,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
28
  const useUtilityClasses = ownerState => {
29
29
  const {
30
30
  classes,
31
- position
31
+ position,
32
+ id
32
33
  } = ownerState;
33
34
  const slots = {
34
- root: ['root', 'directionY', position],
35
+ root: ['root', 'directionY', position, `id-${id}`],
35
36
  line: ['line'],
36
37
  tickContainer: ['tickContainer'],
37
38
  tick: ['tick'],
@@ -156,7 +157,8 @@ function ChartsYAxis(inProps) {
156
157
  valueFormatter,
157
158
  tickPlacement,
158
159
  tickLabelPlacement,
159
- tickInterval
160
+ tickInterval,
161
+ direction: 'y'
160
162
  });
161
163
  const positionSign = position === 'right' ? 1 : -1;
162
164
  const tickFontSize = typeof tickLabelStyle?.fontSize === 'number' ? tickLabelStyle.fontSize : 12;
@@ -235,12 +237,7 @@ function ChartsYAxis(inProps) {
235
237
  const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
236
238
  const yTickLabel = labelOffset;
237
239
  const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
238
- const showLabel = instance.isPointInside({
239
- x: -1,
240
- y: tickOffset
241
- }, {
242
- direction: 'y'
243
- });
240
+ const showLabel = instance.isYInside(tickOffset);
244
241
  const tickLabel = tickLabels.get(item);
245
242
  if (!showLabel) {
246
243
  return null;
@@ -48,6 +48,7 @@ const Gauge = /*#__PURE__*/React.forwardRef(function Gauge(props, ref) {
48
48
  }), children]
49
49
  }));
50
50
  });
51
+ if (process.env.NODE_ENV !== "production") Gauge.displayName = "Gauge";
51
52
  process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
52
53
  // ----------------------------- Warning --------------------------------
53
54
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -78,6 +78,7 @@ const GaugeContainer = /*#__PURE__*/React.forwardRef(function GaugeContainer(pro
78
78
  })
79
79
  });
80
80
  });
81
+ if (process.env.NODE_ENV !== "production") GaugeContainer.displayName = "GaugeContainer";
81
82
  process.env.NODE_ENV !== "production" ? GaugeContainer.propTypes = {
82
83
  // ----------------------------- Warning --------------------------------
83
84
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -21,9 +21,7 @@ export const GaugeContext = /*#__PURE__*/React.createContext({
21
21
  maxRadius: 0,
22
22
  valueAngle: null
23
23
  });
24
- if (process.env.NODE_ENV !== 'production') {
25
- GaugeContext.displayName = 'GaugeContext';
26
- }
24
+ if (process.env.NODE_ENV !== "production") GaugeContext.displayName = "GaugeContext";
27
25
  export function GaugeProvider(props) {
28
26
  const {
29
27
  value = null,
@@ -40,6 +40,7 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
40
40
  }, other, animateProps))
41
41
  });
42
42
  });
43
+ if (process.env.NODE_ENV !== "production") AnimatedLine.displayName = "AnimatedLine";
43
44
  process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
44
45
  // ----------------------------- Warning --------------------------------
45
46
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -65,11 +65,12 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
65
65
  })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
66
66
  "data-drawing-container": true,
67
67
  children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
68
- }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
69
- }))]
68
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
69
+ })), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
70
70
  }))
71
71
  }));
72
72
  });
73
+ if (process.env.NODE_ENV !== "production") LineChart.displayName = "LineChart";
73
74
  process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
74
75
  // ----------------------------- Warning --------------------------------
75
76
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -84,10 +84,7 @@ function LineHighlightPlot(props) {
84
84
  const x = xScale(xData[highlightedIndex]);
85
85
  const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
86
86
 
87
- if (!instance.isPointInside({
88
- x,
89
- y
90
- })) {
87
+ if (!instance.isPointInside(x, y)) {
91
88
  return null;
92
89
  }
93
90
  const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
@@ -122,10 +122,7 @@ function MarkPlot(props) {
122
122
  // Remove missing data point
123
123
  return false;
124
124
  }
125
- if (!instance.isPointInside({
126
- x,
127
- y
128
- })) {
125
+ if (!instance.isPointInside(x, y)) {
129
126
  // Remove out of range
130
127
  return false;
131
128
  }
@@ -97,6 +97,7 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
97
97
  strokeLinejoin: "round"
98
98
  }, other, interactionProps, animatedProps));
99
99
  });
100
+ if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
100
101
  process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
101
102
  // ----------------------------- Warning --------------------------------
102
103
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -92,6 +92,7 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
92
92
  children: formattedArcLabel
93
93
  }));
94
94
  });
95
+ if (process.env.NODE_ENV !== "production") PieArcLabel.displayName = "PieArcLabel";
95
96
  process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
96
97
  // ----------------------------- Warning --------------------------------
97
98
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -95,13 +95,14 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
95
95
  loading: loading,
96
96
  slots: slots,
97
97
  slotProps: slotProps
98
- }), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({
99
- trigger: "item"
100
- }, slotProps?.tooltip)), children]
101
- }))]
98
+ }), children]
99
+ })), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({
100
+ trigger: "item"
101
+ }, slotProps?.tooltip))]
102
102
  })
103
103
  }));
104
104
  });
105
+ if (process.env.NODE_ENV !== "production") PieChart.displayName = "PieChart";
105
106
  process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
106
107
  // ----------------------------- Warning --------------------------------
107
108
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -36,11 +36,12 @@ const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, re
36
36
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
37
37
  children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
38
38
  ref: ref,
39
- children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), children]
40
- }))]
39
+ children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), children]
40
+ })), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
41
41
  }))
42
42
  }));
43
43
  });
44
+ if (process.env.NODE_ENV !== "production") RadarChart.displayName = "RadarChart";
44
45
  process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
45
46
  // ----------------------------- Warning --------------------------------
46
47
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -54,19 +54,11 @@ function Scatter(props) {
54
54
  const scatterPoint = series.data[i];
55
55
  const x = getXPosition(scatterPoint.x);
56
56
  const y = getYPosition(scatterPoint.y);
57
- const isInRange = instance.isPointInside({
58
- x,
59
- y
60
- });
61
- const pointCtx = {
62
- type: 'scatter',
63
- seriesId: series.id,
64
- dataIndex: i
65
- };
57
+ const isInRange = instance.isPointInside(x, y);
66
58
  if (isInRange) {
67
59
  const currentItem = {
68
- seriesId: pointCtx.seriesId,
69
- dataIndex: pointCtx.dataIndex
60
+ seriesId: series.id,
61
+ dataIndex: i
70
62
  };
71
63
  const isItemHighlighted = isHighlighted(currentItem);
72
64
  temp.push({
@@ -54,13 +54,14 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
54
54
  children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
55
55
  "data-drawing-container": true,
56
56
  children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
57
- }), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({
58
- trigger: "item"
59
- }, props.slotProps?.tooltip)), children]
60
- }))]
57
+ }), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), children]
58
+ })), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({
59
+ trigger: "item"
60
+ }, props.slotProps?.tooltip))]
61
61
  }))
62
62
  }));
63
63
  });
64
+ if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
64
65
  process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
65
66
  // ----------------------------- Warning --------------------------------
66
67
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -9,7 +9,8 @@ import useId from '@mui/utils/useId';
9
9
  import { ChartsClipPath } from "../ChartsClipPath/index.js";
10
10
  import { BarPlot } from "../BarChart/index.js";
11
11
  import { LinePlot, AreaPlot, LineHighlightPlot } from "../LineChart/index.js";
12
- import { ChartContainer } from "../ChartContainer/index.js";
12
+ import { ChartDataProvider } from "../ChartDataProvider/index.js";
13
+ import { ChartsSurface } from "../ChartsSurface/index.js";
13
14
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
14
15
  import { ChartsTooltip } from "../ChartsTooltip/index.js";
15
16
  import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
@@ -71,8 +72,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
71
72
  }
72
73
  return typeof color === 'function' ? mode => [color(mode)] : [color];
73
74
  }, [color]);
74
- return /*#__PURE__*/_jsxs(ChartContainer, _extends({}, other, {
75
- ref: ref,
75
+ return /*#__PURE__*/_jsxs(ChartDataProvider, {
76
76
  series: [_extends({
77
77
  type: plotType,
78
78
  data,
@@ -85,7 +85,6 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
85
85
  width: width,
86
86
  height: height,
87
87
  margin: margin,
88
- className: className,
89
88
  xAxis: [_extends({
90
89
  id: DEFAULT_X_AXIS_KEY,
91
90
  scaleType: plotType === 'bar' ? 'band' : 'point',
@@ -102,34 +101,40 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
102
101
  position: 'none'
103
102
  })],
104
103
  colors: colors,
105
- sx: sx,
106
104
  disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
107
- children: [/*#__PURE__*/_jsxs("g", {
108
- clipPath: `url(#${clipPathId})`,
109
- children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
110
- skipAnimation: true,
111
- slots: slots,
112
- slotProps: slotProps
113
- }), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
114
- children: [/*#__PURE__*/_jsx(AreaPlot, {
115
- skipAnimation: true,
116
- slots: slots,
117
- slotProps: slotProps
118
- }), /*#__PURE__*/_jsx(LinePlot, {
105
+ children: [/*#__PURE__*/_jsxs(ChartsSurface, _extends({
106
+ className: className,
107
+ ref: ref,
108
+ sx: sx
109
+ }, other, {
110
+ children: [/*#__PURE__*/_jsxs("g", {
111
+ clipPath: `url(#${clipPathId})`,
112
+ children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
119
113
  skipAnimation: true,
120
114
  slots: slots,
121
115
  slotProps: slotProps
116
+ }), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
117
+ children: [/*#__PURE__*/_jsx(AreaPlot, {
118
+ skipAnimation: true,
119
+ slots: slots,
120
+ slotProps: slotProps
121
+ }), /*#__PURE__*/_jsx(LinePlot, {
122
+ skipAnimation: true,
123
+ slots: slots,
124
+ slotProps: slotProps
125
+ })]
122
126
  })]
123
- })]
124
- }), plotType === 'line' && /*#__PURE__*/_jsx(LineHighlightPlot, {
125
- slots: slots,
126
- slotProps: slotProps
127
- }), disableClipping ? null : /*#__PURE__*/_jsx(ChartsClipPath, {
128
- id: clipPathId,
129
- offset: clipPathOffset
130
- }), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), showTooltip && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), children]
131
- }));
127
+ }), plotType === 'line' && /*#__PURE__*/_jsx(LineHighlightPlot, {
128
+ slots: slots,
129
+ slotProps: slotProps
130
+ }), disableClipping ? null : /*#__PURE__*/_jsx(ChartsClipPath, {
131
+ id: clipPathId,
132
+ offset: clipPathOffset
133
+ }), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), children]
134
+ })), showTooltip && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
135
+ });
132
136
  });
137
+ if (process.env.NODE_ENV !== "production") SparkLineChart.displayName = "SparkLineChart";
133
138
  process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
134
139
  // ----------------------------- Warning --------------------------------
135
140
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -9,6 +9,7 @@ const ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props
9
9
  ref: ref
10
10
  }, props));
11
11
  });
12
+ if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
12
13
  process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
13
14
  // ----------------------------- Warning --------------------------------
14
15
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -3,6 +3,4 @@ import * as React from 'react';
3
3
  * @ignore - internal component.
4
4
  */
5
5
  export const ChartContext = /*#__PURE__*/React.createContext(null);
6
- if (process.env.NODE_ENV !== 'production') {
7
- ChartContext.displayName = 'ChartContext';
8
- }
6
+ if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";