@mui/x-charts 8.14.0 → 8.15.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 (164) hide show
  1. package/BarChart/BarChart.js +8 -0
  2. package/BarChart/BarChart.plugins.d.ts +2 -1
  3. package/BarChart/BarChart.plugins.js +2 -1
  4. package/BarChart/useBarChartProps.js +4 -2
  5. package/BarChart/useBarPlotData.js +20 -33
  6. package/CHANGELOG.md +202 -0
  7. package/ChartContainer/ChartContainer.js +8 -0
  8. package/ChartContainer/useChartContainerProps.js +4 -2
  9. package/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
  10. package/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +9 -0
  11. package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
  12. package/ChartsBrushOverlay/ChartsBrushOverlay.js +102 -0
  13. package/ChartsBrushOverlay/index.d.ts +4 -0
  14. package/ChartsBrushOverlay/index.js +19 -0
  15. package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  16. package/ChartsReferenceLine/ChartsXReferenceLine.js +13 -8
  17. package/ChartsReferenceLine/ChartsYReferenceLine.js +13 -8
  18. package/ChartsReferenceLine/common.d.ts +3 -1
  19. package/ChartsReferenceLine/common.js +3 -1
  20. package/ChartsTooltip/ChartsTooltipContainer.js +20 -2
  21. package/ChartsXAxis/getVisibleLabels.js +45 -25
  22. package/Gauge/Gauge.js +2 -9
  23. package/Gauge/GaugeReferenceArc.d.ts +4 -1
  24. package/Gauge/GaugeReferenceArc.js +12 -3
  25. package/Gauge/GaugeValueArc.d.ts +4 -1
  26. package/Gauge/GaugeValueArc.js +16 -8
  27. package/Gauge/GaugeValueText.js +3 -1
  28. package/LineChart/LineChart.js +8 -0
  29. package/LineChart/LineChart.plugins.d.ts +2 -1
  30. package/LineChart/LineChart.plugins.js +2 -1
  31. package/LineChart/useLineChartProps.js +4 -2
  32. package/ScatterChart/ScatterChart.js +8 -0
  33. package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  34. package/ScatterChart/ScatterChart.plugins.js +2 -1
  35. package/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
  36. package/ScatterChart/useScatterChartProps.js +5 -3
  37. package/SparkLineChart/SparkLineChart.js +8 -0
  38. package/esm/BarChart/BarChart.js +8 -0
  39. package/esm/BarChart/BarChart.plugins.d.ts +2 -1
  40. package/esm/BarChart/BarChart.plugins.js +2 -1
  41. package/esm/BarChart/useBarChartProps.js +4 -2
  42. package/esm/BarChart/useBarPlotData.js +20 -33
  43. package/esm/ChartContainer/ChartContainer.js +8 -0
  44. package/esm/ChartContainer/useChartContainerProps.js +4 -2
  45. package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
  46. package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +2 -0
  47. package/esm/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
  48. package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +95 -0
  49. package/esm/ChartsBrushOverlay/index.d.ts +4 -0
  50. package/esm/ChartsBrushOverlay/index.js +2 -0
  51. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  52. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +14 -9
  53. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +14 -9
  54. package/esm/ChartsReferenceLine/common.d.ts +3 -1
  55. package/esm/ChartsReferenceLine/common.js +2 -0
  56. package/esm/ChartsTooltip/ChartsTooltipContainer.js +20 -2
  57. package/esm/ChartsXAxis/getVisibleLabels.js +45 -25
  58. package/esm/Gauge/Gauge.js +2 -9
  59. package/esm/Gauge/GaugeReferenceArc.d.ts +4 -1
  60. package/esm/Gauge/GaugeReferenceArc.js +11 -2
  61. package/esm/Gauge/GaugeValueArc.d.ts +4 -1
  62. package/esm/Gauge/GaugeValueArc.js +16 -8
  63. package/esm/Gauge/GaugeValueText.js +3 -1
  64. package/esm/LineChart/LineChart.js +8 -0
  65. package/esm/LineChart/LineChart.plugins.d.ts +2 -1
  66. package/esm/LineChart/LineChart.plugins.js +2 -1
  67. package/esm/LineChart/useLineChartProps.js +4 -2
  68. package/esm/ScatterChart/ScatterChart.js +8 -0
  69. package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  70. package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
  71. package/esm/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
  72. package/esm/ScatterChart/useScatterChartProps.js +5 -3
  73. package/esm/SparkLineChart/SparkLineChart.js +8 -0
  74. package/esm/hooks/index.d.ts +2 -1
  75. package/esm/hooks/index.js +2 -1
  76. package/esm/hooks/useBrush.d.ts +18 -0
  77. package/esm/hooks/useBrush.js +16 -0
  78. package/esm/index.d.ts +2 -1
  79. package/esm/index.js +2 -1
  80. package/esm/internals/Flatbush.d.ts +63 -0
  81. package/esm/internals/Flatbush.js +468 -0
  82. package/esm/internals/domUtils.d.ts +9 -4
  83. package/esm/internals/domUtils.js +115 -52
  84. package/esm/internals/index.d.ts +1 -0
  85. package/esm/internals/index.js +1 -0
  86. package/esm/internals/plugins/allPlugins.d.ts +4 -3
  87. package/esm/internals/plugins/allPlugins.js +2 -1
  88. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -10
  89. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +2 -2
  90. package/esm/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
  91. package/esm/internals/plugins/featurePlugins/useChartBrush/index.js +3 -0
  92. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
  93. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +109 -0
  94. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
  95. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +75 -0
  96. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +72 -0
  97. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +1 -0
  98. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
  99. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
  100. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
  101. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
  102. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +6 -2
  103. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
  104. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
  105. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +19 -0
  106. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +41 -0
  107. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
  108. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
  109. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
  110. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
  111. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +33 -0
  112. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +40 -81
  113. package/esm/internals/plugins/utils/selectors.d.ts +1 -1
  114. package/esm/locales/elGR.js +97 -99
  115. package/esm/models/seriesType/scatter.d.ts +2 -0
  116. package/esm/tests/constants.js +1 -0
  117. package/esm/themeAugmentation/components.d.ts +3 -0
  118. package/esm/themeAugmentation/overrides.d.ts +2 -0
  119. package/hooks/index.d.ts +2 -1
  120. package/hooks/index.js +12 -0
  121. package/hooks/useBrush.d.ts +18 -0
  122. package/hooks/useBrush.js +21 -0
  123. package/index.d.ts +2 -1
  124. package/index.js +13 -1
  125. package/internals/Flatbush.d.ts +63 -0
  126. package/internals/Flatbush.js +477 -0
  127. package/internals/domUtils.d.ts +9 -4
  128. package/internals/domUtils.js +119 -54
  129. package/internals/index.d.ts +1 -0
  130. package/internals/index.js +12 -0
  131. package/internals/plugins/allPlugins.d.ts +4 -3
  132. package/internals/plugins/allPlugins.js +2 -1
  133. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -10
  134. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +2 -2
  135. package/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
  136. package/internals/plugins/featurePlugins/useChartBrush/index.js +38 -0
  137. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
  138. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +117 -0
  139. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
  140. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +82 -0
  141. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +72 -0
  142. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +5 -0
  143. package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
  144. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
  145. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
  146. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
  147. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +6 -2
  148. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
  149. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
  150. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +19 -0
  151. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +43 -1
  152. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
  153. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
  154. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
  155. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
  156. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +39 -0
  157. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +39 -80
  158. package/internals/plugins/utils/selectors.d.ts +1 -1
  159. package/locales/elGR.js +97 -99
  160. package/models/seriesType/scatter.d.ts +2 -0
  161. package/package.json +5 -4
  162. package/tests/constants.js +7 -0
  163. package/themeAugmentation/components.d.ts +3 -0
  164. package/themeAugmentation/overrides.d.ts +2 -0
@@ -101,6 +101,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
101
101
  * Defines the border radius of the bar element.
102
102
  */
103
103
  borderRadius: _propTypes.default.number,
104
+ /**
105
+ * Configuration for the brush interaction.
106
+ */
107
+ brushConfig: _propTypes.default.shape({
108
+ enabled: _propTypes.default.bool,
109
+ preventHighlight: _propTypes.default.bool,
110
+ preventTooltip: _propTypes.default.bool
111
+ }),
104
112
  children: _propTypes.default.node,
105
113
  className: _propTypes.default.string,
106
114
  /**
@@ -4,5 +4,6 @@ import { UseChartInteractionSignature } from "../internals/plugins/featurePlugin
4
4
  import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
5
5
  import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
6
6
  import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
7
- export type BarChartPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
7
+ import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
8
+ export type BarChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
8
9
  export declare const BAR_CHART_PLUGINS: ConvertSignaturesIntoPlugins<BarChartPluginSignatures>;
@@ -9,4 +9,5 @@ var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useCha
9
9
  var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
10
10
  var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
11
11
  var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
12
- const BAR_CHART_PLUGINS = exports.BAR_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartKeyboardNavigation.useChartKeyboardNavigation];
12
+ var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
13
+ const BAR_CHART_PLUGINS = exports.BAR_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartKeyboardNavigation.useChartKeyboardNavigation];
@@ -13,7 +13,7 @@ var React = _interopRequireWildcard(require("react"));
13
13
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
14
14
  var _constants = require("../constants");
15
15
  var _BarChart = require("./BarChart.plugins");
16
- const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar"];
16
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar", "brushConfig"];
17
17
  /**
18
18
  * A helper function that extracts BarChartProps from the input props
19
19
  * and returns an object with props for the children components of BarChart.
@@ -45,7 +45,8 @@ const useBarChartProps = props => {
45
45
  onHighlightChange,
46
46
  borderRadius,
47
47
  barLabel,
48
- className
48
+ className,
49
+ brushConfig
49
50
  } = props,
50
51
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
51
52
  const id = (0, _useId.default)();
@@ -102,6 +103,7 @@ const useBarChartProps = props => {
102
103
  disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
103
104
  className,
104
105
  skipAnimation,
106
+ brushConfig,
105
107
  plugins: _BarChart.BAR_CHART_PLUGINS
106
108
  });
107
109
  const barPlotProps = {
@@ -36,6 +36,7 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
36
36
  const xAxisConfig = xAxes[xAxisId];
37
37
  const yAxisConfig = yAxes[yAxisId];
38
38
  const verticalLayout = series[seriesId].layout === 'vertical';
39
+ const reverse = (verticalLayout ? yAxisConfig.reverse : xAxisConfig.reverse) ?? false;
39
40
  (0, _checkScaleErrors.checkScaleErrors)(verticalLayout, seriesId, series[seriesId], xAxisId, xAxes, yAxisId, yAxes);
40
41
  const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
41
42
  const xScale = xAxisConfig.scale;
@@ -57,19 +58,20 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
57
58
  layout,
58
59
  minBarSize
59
60
  } = series[seriesId];
60
- const seriesDataPoints = baseScaleConfig.data.map((baseValue, dataIndex) => {
61
- if (currentSeriesData[dataIndex] == null) {
62
- return null;
61
+ const seriesDataPoints = [];
62
+ for (let dataIndex = 0; dataIndex < baseScaleConfig.data.length; dataIndex += 1) {
63
+ const baseValue = baseScaleConfig.data[dataIndex];
64
+ const seriesValue = currentSeriesData[dataIndex];
65
+ if (seriesValue == null) {
66
+ continue;
63
67
  }
64
68
  const values = stackedData[dataIndex];
65
69
  const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
66
70
  const minValueCoord = Math.round(Math.min(...valueCoordinates));
67
71
  const maxValueCoord = Math.round(Math.max(...valueCoordinates));
68
72
  const stackId = series[seriesId].stack;
69
- const {
70
- barSize,
71
- startCoordinate
72
- } = getValueCoordinate(verticalLayout, minValueCoord, maxValueCoord, currentSeriesData[dataIndex], minBarSize);
73
+ const barSize = seriesValue === 0 ? 0 : Math.max(minBarSize, maxValueCoord - minValueCoord);
74
+ const startCoordinate = shouldInvertStartCoordinate(verticalLayout, seriesValue, reverse) ? maxValueCoord - barSize : minValueCoord;
73
75
  const result = {
74
76
  seriesId,
75
77
  dataIndex,
@@ -85,7 +87,7 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
85
87
  maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
86
88
  };
87
89
  if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
88
- return null;
90
+ continue;
89
91
  }
90
92
  if (!masks[result.maskId]) {
91
93
  masks[result.maskId] = {
@@ -106,10 +108,11 @@ function useBarPlotData(drawingArea, xAxes, yAxes) {
106
108
  mask.height = result.layout === 'vertical' ? mask.height + result.height : result.height;
107
109
  mask.x = Math.min(mask.x === 0 ? Infinity : mask.x, result.x);
108
110
  mask.y = Math.min(mask.y === 0 ? Infinity : mask.y, result.y);
109
- mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
110
- mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
111
- return result;
112
- }).filter(rectangle => rectangle !== null);
111
+ const value = result.value ?? 0;
112
+ mask.hasNegative = mask.hasNegative || (reverse ? value > 0 : value < 0);
113
+ mask.hasPositive = mask.hasPositive || (reverse ? value < 0 : value > 0);
114
+ seriesDataPoints.push(result);
115
+ }
113
116
  return {
114
117
  seriesId,
115
118
  data: seriesDataPoints
@@ -149,25 +152,9 @@ function getBandSize({
149
152
  offset
150
153
  };
151
154
  }
152
- function getValueCoordinate(isVertical, minValueCoord, maxValueCoord, baseValue, minBarSize) {
153
- if (baseValue === 0 || baseValue == null) {
154
- return {
155
- barSize: 0,
156
- startCoordinate: minValueCoord
157
- };
158
- }
159
- const isSizeLessThanMin = maxValueCoord - minValueCoord < minBarSize;
160
- const barSize = isSizeLessThanMin ? minBarSize : maxValueCoord - minValueCoord;
161
- const isVerticalAndPositive = isVertical && baseValue >= 0;
162
- const isHorizontalAndNegative = !isVertical && baseValue < 0;
163
- if (isSizeLessThanMin && (isVerticalAndPositive || isHorizontalAndNegative)) {
164
- return {
165
- barSize,
166
- startCoordinate: maxValueCoord - barSize
167
- };
168
- }
169
- return {
170
- barSize,
171
- startCoordinate: minValueCoord
172
- };
155
+ function shouldInvertStartCoordinate(verticalLayout, baseValue, reverse) {
156
+ const isVerticalAndPositive = verticalLayout && baseValue > 0;
157
+ const isHorizontalAndNegative = !verticalLayout && baseValue < 0;
158
+ const invertStartCoordinate = isVerticalAndPositive || isHorizontalAndNegative;
159
+ return reverse ? !invertStartCoordinate : invertStartCoordinate;
173
160
  }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,208 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.15.0
9
+
10
+ _Oct 23, 2025_
11
+
12
+ We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🖌️ Add new [`brush` charts interaction](https://mui.com/x/react-charts/brush/) for building custom behavior.
15
+ ![brush visualization example](https://github.com/user-attachments/assets/60c382a1-e418-4736-8dcb-1567c4e361e3)
16
+ - ⚡️ Performance improvements for large bar charts
17
+ - 🤖 Data Grid AI assistant can now [visualize the query results](https://mui.com/x/react-data-grid/ai-assistant/#data-visualization) by controlling the chart integration settings
18
+ - 📦 DataGrid uses an internal MUI fork of ExcelJS that does not depend on vulnerable versions of NPM packages
19
+ - 🐞 Bugfixes
20
+ - 📚 Documentation improvements
21
+
22
+ Special thanks go out to the community members for their valuable contributions:
23
+ @ZagrebaAlex
24
+
25
+ The following are all team members who have contributed to this release:
26
+ @alexfauquette, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @KenanYusuf, @prakhargupta1, @rita-codes, @siriwatknp, @arminmeh, @brijeshb42, @noraleonte
27
+
28
+ ### Data Grid
29
+
30
+ #### `@mui/x-data-grid@8.15.0`
31
+
32
+ - [DataGrid] Fix `dataSource.fetchRows` API's return type (#20068) @arminmeh
33
+
34
+ #### `@mui/x-data-grid-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
35
+
36
+ Same changes as in `@mui/x-data-grid@8.15.0`, plus:
37
+
38
+ - [DataGridPro] Keep children in the tree after parent row is re-fetched with the data source (#19934) @arminmeh
39
+ - [DataGridPro] Support scroll shadows customization (#19982) @KenanYusuf
40
+
41
+ #### `@mui/x-data-grid-premium@8.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
42
+
43
+ Same changes as in `@mui/x-data-grid-pro@8.15.0`, plus:
44
+
45
+ - [DataGridPremium] Use ExcelJS fork (#19796) @cherniavskii
46
+ - [DataGridPremium] Support data visualization in AI Assistant (#19831) @arminmeh
47
+
48
+ ### Date and Time Pickers
49
+
50
+ #### `@mui/x-date-pickers@8.15.0`
51
+
52
+ Internal changes.
53
+
54
+ #### `@mui/x-date-pickers-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
55
+
56
+ Same changes as in `@mui/x-date-pickers@8.15.0`.
57
+
58
+ ### Charts
59
+
60
+ #### `@mui/x-charts@8.15.0`
61
+
62
+ - [charts] Add `ChartsBrushOverlay` and allow brush configuration (#19956) @JCQuintas
63
+ - [charts] Add `getStringSize` benchmark. Remove benchmarks from built package. (#19995) @bernardobelchior
64
+ - [charts] Batch string size measurement (#19994) @bernardobelchior
65
+ - [charts] Fix console issue (#20025) @JCQuintas
66
+ - [charts] Fix is[ZoomFeature]Enabled type (#20058) @alexfauquette
67
+ - [charts] Fix reference line middle spacing (#20004) @JCQuintas
68
+ - [charts] Improve `getStringSize` and `batchMeasureStrings` performance (#19996) @bernardobelchior
69
+ - [charts] Improve deep export script (#20007) @JCQuintas
70
+ - [charts] Improve string measurement benchmarks (#19999) @bernardobelchior
71
+ - [charts] Measure string sizes using SVG elements (#19981) @bernardobelchior
72
+ - [l10n] Improve Greek (gr-GR) locale (#20060) @ZagrebaAlex
73
+
74
+ #### `@mui/x-charts-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
75
+
76
+ Same changes as in `@mui/x-charts@8.15.0`, plus:
77
+
78
+ - [charts-pro] Fix pan with `axis.reverse` (#20031) @JCQuintas
79
+
80
+ #### `@mui/x-charts-premium@8.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
81
+
82
+ Same changes as in `@mui/x-charts-pro@8.15.0`.
83
+
84
+ ### Tree View
85
+
86
+ #### `@mui/x-tree-view@8.15.0`
87
+
88
+ - [tree view] Multi character type-ahead (#19942) @noraleonte
89
+
90
+ #### `@mui/x-tree-view-pro@8.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
91
+
92
+ Same changes as in `@mui/x-tree-view@8.15.0`.
93
+
94
+ ### Codemod
95
+
96
+ #### `@mui/x-codemod@8.14.0`
97
+
98
+ Internal changes.
99
+
100
+ ### Docs
101
+
102
+ - [docs] Add overview section for scatter chart and heatmap (#19888) @prakhargupta1
103
+ - [docs] Add charts bell curve example (#20003) @JCQuintas
104
+ - [docs] Add grouped multiple fields for Data Grid row grouping recipe (#19964) @siriwatknp
105
+ - [docs] Add Data Grid loading state recipe (#19958) @siriwatknp
106
+
107
+ ### Core
108
+
109
+ - [code-infra] Remove @mui/monorepo usage for react versioning (#19894) @Janpot
110
+ - [code-infra] Remove invalid `environment: 'browser'` from vitest browser config (#19993) @bernardobelchior
111
+ - [code-infra] Remove unused babel aliases (#19987) @Janpot
112
+ - [code-infra] Turn on all testing-library eslint rules (#19946) @brijeshb42
113
+ - [docs-infra] Fix broken hash link (#20062) @Janpot
114
+
115
+ ## 8.14.1
116
+
117
+ _Oct 16, 2025_
118
+
119
+ We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
120
+
121
+ - 🚀 Charts have optimized data structures for closest point calculations — initial render times reduced by ~25% for 1,000+ data points, with greater gains at larger scales (#19790) @bernardobelchior
122
+ - 🐞 Bugfixes
123
+ - 📚 Documentation improvements
124
+
125
+ Special thanks go out to the community members for their valuable contributions:
126
+ @djpremier, @jacknot, @justdoit1897, @mellis481, @sai6855
127
+
128
+ The following are all team members who have contributed to this release:
129
+ @arminmeh, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @noraleonte, @siriwatknp
130
+
131
+ ### Data Grid
132
+
133
+ #### `@mui/x-data-grid@8.14.1`
134
+
135
+ - [DataGrid] Fix cell not rerendering on `isCellEditable` prop change (#19898) @cherniavskii
136
+ - [DataGrid] Fix virtualizer memory leaks (#19886) @cherniavskii
137
+ - [DataGrid] Fix tree data unable to deselect row for exclude model (#19846) @siriwatknp
138
+ - [l10n] Improve Italian (it-IT) locale (#19322) @jacknot and (#19940) @justdoit1897
139
+
140
+ #### `@mui/x-data-grid-pro@8.14.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
141
+
142
+ Same changes as in `@mui/x-data-grid@8.14.1`, plus:
143
+
144
+ - [DataGridPro] Clear cache before new request to the nested request queue after a row has been edited (#19873) @arminmeh
145
+
146
+ #### `@mui/x-data-grid-premium@8.14.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
147
+
148
+ Same changes as in `@mui/x-data-grid-pro@8.14.1`.
149
+
150
+ ### Date and Time Pickers
151
+
152
+ #### `@mui/x-date-pickers@8.14.1`
153
+
154
+ Internal changes.
155
+
156
+ #### `@mui/x-date-pickers-pro@8.14.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
157
+
158
+ Same changes as in `@mui/x-date-pickers@8.14.1`.
159
+
160
+ ### Charts
161
+
162
+ #### `@mui/x-charts@8.14.1`
163
+
164
+ - [charts] Fix `minBarSize` when y-axis is reversed (#19932) @bernardobelchior
165
+ - [charts] Fix bar chart border radius when axis is reversed (#19895) @bernardobelchior
166
+ - [charts] Fix scatter chart `datasetKeys.id` not being optional (#19897) @bernardobelchior
167
+ - [charts] Use more performant data structure for closest point (#19790) @bernardobelchior
168
+ - [charts] Fix `GaugeValueArc` having wrong class (#19965) @bernardobelchior
169
+ - [charts] Fix `undefined` path when highlight empty line chart axis (#19969) @bernardobelchior
170
+
171
+ #### `@mui/x-charts-pro@8.14.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
172
+
173
+ Same changes as in `@mui/x-charts@8.14.1`, plus:
174
+
175
+ - [charts-pro] Add `highlighting` to Sankey chart (#19662) @JCQuintas
176
+
177
+ #### `@mui/x-charts-premium@8.14.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
178
+
179
+ Same changes as in `@mui/x-charts-pro@8.14.1`.
180
+
181
+ ### Tree View
182
+
183
+ #### `@mui/x-tree-view@8.14.1`
184
+
185
+ - [tree view] Do not forward the `ownerState` to the icon (#19772) @flaviendelangle
186
+
187
+ #### `@mui/x-tree-view-pro@8.14.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
188
+
189
+ Same changes as in `@mui/x-tree-view@8.14.1`.
190
+
191
+ ### Codemod
192
+
193
+ #### `@mui/x-codemod@8.14.0`
194
+
195
+ Internal changes.
196
+
197
+ ### Docs
198
+
199
+ - [docs] Add `'bumpX'` and `'bumpY'` curve types to the interpolation demo (#19676) @djpremier
200
+ - [docs] Add scatter chart with linear regression demo (#19900) @bernardobelchior
201
+ - [docs] Correctly describe Data Grid's row selection behavior (#19968) @arminmeh
202
+ - [docs] Fix `isExpanded` type in tree view docs (#19092) @mellis481
203
+
204
+ ### Core
205
+
206
+ - [code-infra] Disable Netlify cache plugin (#19950) @Janpot
207
+ - [code-infra] Lint json through eslint (#19890) @Janpot
208
+ - [docs-infra] Use published netlify cache plugin package (#19929) @brijeshb42
209
+
8
210
  ## 8.14.0
9
211
 
10
212
  _Oct 9, 2025_
@@ -61,6 +61,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
61
61
  apiRef: _propTypes.default.shape({
62
62
  current: _propTypes.default.object
63
63
  }),
64
+ /**
65
+ * Configuration for the brush interaction.
66
+ */
67
+ brushConfig: _propTypes.default.shape({
68
+ enabled: _propTypes.default.bool,
69
+ preventHighlight: _propTypes.default.bool,
70
+ preventTooltip: _propTypes.default.bool
71
+ }),
64
72
  children: _propTypes.default.node,
65
73
  className: _propTypes.default.string,
66
74
  /**
@@ -9,7 +9,7 @@ exports.useChartContainerProps = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var _allPlugins = require("../internals/plugins/allPlugins");
12
- const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation"];
12
+ const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation", "brushConfig"];
13
13
  const useChartContainerProps = (props, ref) => {
14
14
  const _ref = props,
15
15
  {
@@ -44,7 +44,8 @@ const useChartContainerProps = (props, ref) => {
44
44
  slots,
45
45
  slotProps,
46
46
  experimentalFeatures,
47
- enableKeyboardNavigation
47
+ enableKeyboardNavigation,
48
+ brushConfig
48
49
  } = _ref,
49
50
  other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
50
51
  const chartsSurfaceProps = (0, _extends2.default)({
@@ -79,6 +80,7 @@ const useChartContainerProps = (props, ref) => {
79
80
  seriesConfig,
80
81
  experimentalFeatures,
81
82
  enableKeyboardNavigation,
83
+ brushConfig,
82
84
  plugins: plugins ?? _allPlugins.DEFAULT_PLUGINS,
83
85
  slots,
84
86
  slotProps
@@ -0,0 +1,12 @@
1
+ export interface BrushOverlayClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the brush lines. */
5
+ rect: string;
6
+ /** Styles applied when the brush is selecting the x axis. */
7
+ x: string;
8
+ /** Styles applied when the brush is selecting the y axis. */
9
+ y: string;
10
+ }
11
+ export type BrushOverlayClassKey = keyof BrushOverlayClasses;
12
+ export declare const brushOverlayClasses: BrushOverlayClasses;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.brushOverlayClasses = void 0;
8
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
9
+ const brushOverlayClasses = exports.brushOverlayClasses = (0, _generateUtilityClasses.default)('MuiChartsBrushOverlay', ['root', 'rect', 'x', 'y']);
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export interface ChartsBrushOverlayProps {}
3
+ /**
4
+ * Component that renders visual feedback during brush interaction
5
+ */
6
+ export declare function ChartsBrushOverlay(props: ChartsBrushOverlayProps): React.JSX.Element | null;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.ChartsBrushOverlay = ChartsBrushOverlay;
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var React = _interopRequireWildcard(require("react"));
12
+ var _clsx = _interopRequireDefault(require("clsx"));
13
+ var _styles = require("@mui/material/styles");
14
+ var _ChartsBrushOverlay = require("./ChartsBrushOverlay.classes");
15
+ var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions");
16
+ var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
17
+ var _useSelector = require("../internals/store/useSelector");
18
+ var _useStore = require("../internals/store/useStore");
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
+ function BrushRect(props) {
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", (0, _extends2.default)({
22
+ className: _ChartsBrushOverlay.brushOverlayClasses.rect,
23
+ strokeWidth: 1,
24
+ fillOpacity: 0.2,
25
+ pointerEvents: 'none'
26
+ }, props));
27
+ }
28
+ /**
29
+ * Component that renders visual feedback during brush interaction
30
+ */
31
+ function ChartsBrushOverlay(props) {
32
+ const store = (0, _useStore.useStore)();
33
+ const drawingArea = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartDrawingArea);
34
+ const theme = (0, _styles.useTheme)();
35
+ const brushStartX = (0, _useSelector.useSelector)(store, _useChartBrush.selectorBrushStartX);
36
+ const brushStartY = (0, _useSelector.useSelector)(store, _useChartBrush.selectorBrushStartY);
37
+ const brushCurrentX = (0, _useSelector.useSelector)(store, _useChartBrush.selectorBrushCurrentX);
38
+ const brushCurrentY = (0, _useSelector.useSelector)(store, _useChartBrush.selectorBrushCurrentY);
39
+ const brushConfig = (0, _useSelector.useSelector)(store, _useChartBrush.selectorBrushConfig);
40
+ if (brushStartX === null || brushStartY === null || brushCurrentX === null || brushCurrentY === null) {
41
+ return null;
42
+ }
43
+ const {
44
+ left,
45
+ top,
46
+ width,
47
+ height
48
+ } = drawingArea;
49
+
50
+ // Clamp coordinates to drawing area
51
+ const clampX = x => Math.max(left, Math.min(left + width, x));
52
+ const clampY = y => Math.max(top, Math.min(top + height, y));
53
+ const startX = clampX(brushStartX);
54
+ const startY = clampY(brushStartY);
55
+ const currentX = clampX(brushCurrentX);
56
+ const currentY = clampY(brushCurrentY);
57
+ const rectColor = theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white;
58
+
59
+ // For scatter charts, show only the rectangle without guide lines
60
+ if (brushConfig === 'xy') {
61
+ const rectWidth = currentX - startX;
62
+ const rectHeight = currentY - startY;
63
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
64
+ className: (0, _clsx.default)(_ChartsBrushOverlay.brushOverlayClasses.root, _ChartsBrushOverlay.brushOverlayClasses.x, _ChartsBrushOverlay.brushOverlayClasses.y),
65
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BrushRect, (0, _extends2.default)({
66
+ fill: rectColor,
67
+ x: rectWidth >= 0 ? startX : currentX,
68
+ y: rectHeight >= 0 ? startY : currentY,
69
+ width: Math.abs(rectWidth),
70
+ height: Math.abs(rectHeight)
71
+ }, props))
72
+ });
73
+ }
74
+ if (brushConfig === 'y') {
75
+ const minY = Math.min(startY, currentY);
76
+ const maxY = Math.max(startY, currentY);
77
+ const rectHeight = maxY - minY;
78
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
79
+ className: (0, _clsx.default)(_ChartsBrushOverlay.brushOverlayClasses.root, _ChartsBrushOverlay.brushOverlayClasses.y),
80
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BrushRect, (0, _extends2.default)({
81
+ fill: rectColor,
82
+ x: left,
83
+ y: minY,
84
+ width: width,
85
+ height: rectHeight
86
+ }, props))
87
+ });
88
+ }
89
+ const minX = Math.min(startX, currentX);
90
+ const maxX = Math.max(startX, currentX);
91
+ const rectWidth = maxX - minX;
92
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
93
+ className: (0, _clsx.default)(_ChartsBrushOverlay.brushOverlayClasses.root, _ChartsBrushOverlay.brushOverlayClasses.x),
94
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BrushRect, (0, _extends2.default)({
95
+ fill: rectColor,
96
+ x: minX,
97
+ y: top,
98
+ width: rectWidth,
99
+ height: height
100
+ }, props))
101
+ });
102
+ }
@@ -0,0 +1,4 @@
1
+ export { ChartsBrushOverlay } from "./ChartsBrushOverlay.js";
2
+ export type { ChartsBrushOverlayProps } from "./ChartsBrushOverlay.js";
3
+ export { brushOverlayClasses } from "./ChartsBrushOverlay.classes.js";
4
+ export type { BrushOverlayClasses, BrushOverlayClassKey } from "./ChartsBrushOverlay.classes.js";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ChartsBrushOverlay", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ChartsBrushOverlay.ChartsBrushOverlay;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "brushOverlayClasses", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _ChartsBrushOverlay2.brushOverlayClasses;
16
+ }
17
+ });
18
+ var _ChartsBrushOverlay = require("./ChartsBrushOverlay");
19
+ var _ChartsBrushOverlay2 = require("./ChartsBrushOverlay.classes");
@@ -63,7 +63,7 @@ process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
63
63
  /**
64
64
  * Additional space around the label in px.
65
65
  * Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
66
- * @default 5
66
+ * @default { x: 0, y: 5 } on a horizontal line and { x: 5, y: 0 } on a vertical line.
67
67
  */
68
68
  spacing: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
69
69
  x: _propTypes.default.number,
@@ -21,12 +21,17 @@ var _jsxRuntime = require("react/jsx-runtime");
21
21
  const getTextParams = ({
22
22
  top,
23
23
  height,
24
- spacingY,
24
+ spacing,
25
+ position,
25
26
  labelAlign = 'middle'
26
27
  }) => {
28
+ const defaultSpacingOtherAxis = labelAlign === 'middle' ? _common.DEFAULT_SPACING_MIDDLE_OTHER_AXIS : _common.DEFAULT_SPACING;
29
+ const spacingX = (typeof spacing === 'object' ? spacing.x : spacing) ?? _common.DEFAULT_SPACING;
30
+ const spacingY = (typeof spacing === 'object' ? spacing.y : defaultSpacingOtherAxis) ?? defaultSpacingOtherAxis;
27
31
  switch (labelAlign) {
28
32
  case 'start':
29
33
  return {
34
+ x: position + spacingX,
30
35
  y: top + spacingY,
31
36
  style: {
32
37
  dominantBaseline: 'hanging',
@@ -35,6 +40,7 @@ const getTextParams = ({
35
40
  };
36
41
  case 'end':
37
42
  return {
43
+ x: position + spacingX,
38
44
  y: top + height - spacingY,
39
45
  style: {
40
46
  dominantBaseline: 'auto',
@@ -43,7 +49,8 @@ const getTextParams = ({
43
49
  };
44
50
  default:
45
51
  return {
46
- y: top + height / 2,
52
+ x: position + spacingX,
53
+ y: top + height / 2 + spacingY,
47
54
  style: {
48
55
  dominantBaseline: 'central',
49
56
  textAnchor: 'start'
@@ -62,9 +69,9 @@ function ChartsXReferenceLine(props) {
62
69
  const {
63
70
  x,
64
71
  label = '',
65
- spacing = 5,
72
+ spacing,
66
73
  classes: inClasses,
67
- labelAlign,
74
+ labelAlign = 'middle',
68
75
  lineStyle,
69
76
  labelStyle,
70
77
  axisId
@@ -83,16 +90,14 @@ function ChartsXReferenceLine(props) {
83
90
  }
84
91
  const d = `M ${xPosition} ${top} l 0 ${height}`;
85
92
  const classes = getXReferenceLineClasses(inClasses);
86
- const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
87
- const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
88
93
  const textParams = (0, _extends2.default)({
89
- x: xPosition + spacingX,
90
94
  text: label,
91
95
  fontSize: 12
92
96
  }, getTextParams({
93
97
  top,
94
98
  height,
95
- spacingY,
99
+ spacing,
100
+ position: xPosition,
96
101
  labelAlign
97
102
  }), {
98
103
  className: classes.label