@mui/x-charts 7.12.1 → 7.14.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 (128) hide show
  1. package/BarChart/BarChart.js +2 -0
  2. package/BarChart/BarPlot.js +4 -3
  3. package/BarChart/extremums.js +46 -9
  4. package/CHANGELOG.md +162 -1
  5. package/ChartContainer/ChartContainer.d.ts +3 -3
  6. package/ChartContainer/ChartContainer.js +4 -2
  7. package/ChartContainer/useChartContainerProps.d.ts +4 -2
  8. package/ChartContainer/useChartContainerProps.js +3 -3
  9. package/ChartContainer/useDefaultizeAxis.d.ts +3 -1
  10. package/ChartContainer/useDefaultizeAxis.js +16 -5
  11. package/ChartsAxisHighlight/ChartsAxisHighlight.js +23 -9
  12. package/ChartsGrid/ChartsGrid.js +6 -4
  13. package/ChartsTooltip/utils.js +4 -2
  14. package/ChartsXAxis/ChartsXAxis.js +25 -8
  15. package/ChartsYAxis/ChartsYAxis.js +19 -7
  16. package/LineChart/AreaPlot.js +11 -1
  17. package/LineChart/LineChart.js +2 -0
  18. package/LineChart/extremums.js +23 -18
  19. package/PieChart/PieChart.js +2 -0
  20. package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  21. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -1
  22. package/ScatterChart/ScatterChart.js +2 -0
  23. package/ScatterChart/extremums.js +30 -22
  24. package/SparkLineChart/SparkLineChart.js +2 -0
  25. package/context/CartesianProvider/Cartesian.types.d.ts +59 -0
  26. package/context/CartesianProvider/Cartesian.types.js +5 -0
  27. package/context/CartesianProvider/CartesianContext.d.ts +1 -22
  28. package/context/CartesianProvider/CartesianProvider.d.ts +3 -23
  29. package/context/CartesianProvider/CartesianProvider.js +4 -7
  30. package/context/CartesianProvider/computeValue.d.ts +18 -31
  31. package/context/CartesianProvider/computeValue.js +20 -23
  32. package/context/CartesianProvider/defaultizeAxis.d.ts +1 -0
  33. package/context/CartesianProvider/getAxisExtremum.d.ts +3 -2
  34. package/context/CartesianProvider/getAxisExtremum.js +10 -11
  35. package/context/CartesianProvider/index.d.ts +1 -0
  36. package/context/CartesianProvider/index.js +12 -0
  37. package/context/CartesianProvider/useCartesianContext.d.ts +1 -1
  38. package/context/CartesianProvider/zoom.d.ts +10 -0
  39. package/context/CartesianProvider/zoom.js +26 -0
  40. package/context/DrawingProvider.d.ts +7 -2
  41. package/context/DrawingProvider.js +11 -3
  42. package/context/PluginProvider/ExtremumGetter.types.d.ts +12 -2
  43. package/esm/BarChart/BarChart.js +2 -0
  44. package/esm/BarChart/BarPlot.js +4 -3
  45. package/esm/BarChart/extremums.js +46 -9
  46. package/esm/ChartContainer/ChartContainer.js +5 -3
  47. package/esm/ChartContainer/useChartContainerProps.js +3 -3
  48. package/esm/ChartContainer/useDefaultizeAxis.js +16 -5
  49. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +23 -9
  50. package/esm/ChartsGrid/ChartsGrid.js +6 -4
  51. package/esm/ChartsTooltip/utils.js +4 -2
  52. package/esm/ChartsXAxis/ChartsXAxis.js +25 -8
  53. package/esm/ChartsYAxis/ChartsYAxis.js +19 -7
  54. package/esm/LineChart/AreaPlot.js +11 -1
  55. package/esm/LineChart/LineChart.js +2 -0
  56. package/esm/LineChart/extremums.js +23 -18
  57. package/esm/PieChart/PieChart.js +2 -0
  58. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  59. package/esm/ScatterChart/ScatterChart.js +2 -0
  60. package/esm/ScatterChart/extremums.js +30 -22
  61. package/esm/SparkLineChart/SparkLineChart.js +2 -0
  62. package/esm/context/CartesianProvider/Cartesian.types.js +1 -0
  63. package/esm/context/CartesianProvider/CartesianProvider.js +4 -7
  64. package/esm/context/CartesianProvider/computeValue.js +20 -23
  65. package/esm/context/CartesianProvider/getAxisExtremum.js +10 -11
  66. package/esm/context/CartesianProvider/index.js +1 -0
  67. package/esm/context/CartesianProvider/zoom.js +19 -0
  68. package/esm/context/DrawingProvider.js +11 -3
  69. package/esm/hooks/useAxisEvents.js +3 -1
  70. package/esm/hooks/useTicks.js +5 -2
  71. package/esm/internals/domUtils.js +16 -3
  72. package/esm/internals/index.js +3 -0
  73. package/esm/internals/isInfinity.js +3 -0
  74. package/esm/models/axis.js +5 -0
  75. package/esm/tests/firePointerEvent.js +35 -0
  76. package/hooks/useAxisEvents.js +3 -1
  77. package/hooks/useTicks.js +5 -2
  78. package/index.js +1 -1
  79. package/internals/defaultizeColor.d.ts +1 -0
  80. package/internals/domUtils.d.ts +2 -0
  81. package/internals/domUtils.js +19 -5
  82. package/internals/index.d.ts +2 -0
  83. package/internals/index.js +17 -1
  84. package/internals/isInfinity.d.ts +1 -0
  85. package/internals/isInfinity.js +9 -0
  86. package/models/axis.d.ts +6 -0
  87. package/models/axis.js +5 -0
  88. package/models/seriesType/line.d.ts +10 -0
  89. package/modern/BarChart/BarChart.js +2 -0
  90. package/modern/BarChart/BarPlot.js +4 -3
  91. package/modern/BarChart/extremums.js +46 -9
  92. package/modern/ChartContainer/ChartContainer.js +5 -3
  93. package/modern/ChartContainer/useChartContainerProps.js +3 -3
  94. package/modern/ChartContainer/useDefaultizeAxis.js +16 -5
  95. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +23 -9
  96. package/modern/ChartsGrid/ChartsGrid.js +6 -4
  97. package/modern/ChartsTooltip/utils.js +4 -2
  98. package/modern/ChartsXAxis/ChartsXAxis.js +25 -8
  99. package/modern/ChartsYAxis/ChartsYAxis.js +19 -7
  100. package/modern/LineChart/AreaPlot.js +11 -1
  101. package/modern/LineChart/LineChart.js +2 -0
  102. package/modern/LineChart/extremums.js +23 -18
  103. package/modern/PieChart/PieChart.js +2 -0
  104. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  105. package/modern/ScatterChart/ScatterChart.js +2 -0
  106. package/modern/ScatterChart/extremums.js +30 -22
  107. package/modern/SparkLineChart/SparkLineChart.js +2 -0
  108. package/modern/context/CartesianProvider/Cartesian.types.js +1 -0
  109. package/modern/context/CartesianProvider/CartesianProvider.js +4 -7
  110. package/modern/context/CartesianProvider/computeValue.js +20 -23
  111. package/modern/context/CartesianProvider/getAxisExtremum.js +10 -11
  112. package/modern/context/CartesianProvider/index.js +1 -0
  113. package/modern/context/CartesianProvider/zoom.js +19 -0
  114. package/modern/context/DrawingProvider.js +11 -3
  115. package/modern/hooks/useAxisEvents.js +3 -1
  116. package/modern/hooks/useTicks.js +5 -2
  117. package/modern/index.js +1 -1
  118. package/modern/internals/domUtils.js +16 -3
  119. package/modern/internals/index.js +3 -0
  120. package/modern/internals/isInfinity.js +3 -0
  121. package/modern/models/axis.js +5 -0
  122. package/modern/tests/firePointerEvent.js +35 -0
  123. package/package.json +4 -4
  124. package/tests/firePointerEvent.js +42 -0
  125. package/context/CartesianProvider/normalizeAxis.d.ts +0 -5
  126. package/context/CartesianProvider/normalizeAxis.js +0 -23
  127. package/esm/context/CartesianProvider/normalizeAxis.js +0 -15
  128. package/modern/context/CartesianProvider/normalizeAxis.js +0 -15
@@ -282,6 +282,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
282
282
  slotProps: _propTypes.default.object,
283
283
  slots: _propTypes.default.object,
284
284
  stroke: _propTypes.default.string,
285
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
285
286
  tickFontSize: _propTypes.default.number,
286
287
  tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
287
288
  tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
@@ -334,6 +335,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
334
335
  slotProps: _propTypes.default.object,
335
336
  slots: _propTypes.default.object,
336
337
  stroke: _propTypes.default.string,
338
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
337
339
  tickFontSize: _propTypes.default.number,
338
340
  tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
339
341
  tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
@@ -200,6 +200,7 @@ function BarPlot(props) {
200
200
  barLabel
201
201
  } = props,
202
202
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
203
+ const withoutBorderRadius = !borderRadius || borderRadius <= 0;
203
204
  const transition = (0, _web.useTransition)(completedData, {
204
205
  keys: bar => `${bar.seriesId}-${bar.dataIndex}`,
205
206
  from: leaveStyle,
@@ -208,7 +209,7 @@ function BarPlot(props) {
208
209
  update: enterStyle,
209
210
  immediate: skipAnimation
210
211
  });
211
- const maskTransition = (0, _web.useTransition)(masksData, {
212
+ const maskTransition = (0, _web.useTransition)(withoutBorderRadius ? [] : masksData, {
212
213
  keys: v => v.id,
213
214
  from: leaveStyle,
214
215
  leave: leaveStyle,
@@ -217,7 +218,7 @@ function BarPlot(props) {
217
218
  immediate: skipAnimation
218
219
  });
219
220
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
220
- children: [maskTransition((style, {
221
+ children: [!withoutBorderRadius && maskTransition((style, {
221
222
  id,
222
223
  hasPositive,
223
224
  hasNegative,
@@ -251,7 +252,7 @@ function BarPlot(props) {
251
252
  }),
252
253
  style: style
253
254
  }));
254
- if (!borderRadius || borderRadius <= 0) {
255
+ if (withoutBorderRadius) {
255
256
  return barElement;
256
257
  }
257
258
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
@@ -4,34 +4,71 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getExtremumY = exports.getExtremumX = void 0;
7
+ const createResult = (data, direction) => {
8
+ if (direction === 'x') {
9
+ return {
10
+ x: data,
11
+ y: null
12
+ };
13
+ }
14
+ return {
15
+ x: null,
16
+ y: data
17
+ };
18
+ };
7
19
  const getBaseExtremum = params => {
8
20
  const {
9
- axis
21
+ axis,
22
+ getFilters,
23
+ isDefaultAxis
10
24
  } = params;
11
- const minX = Math.min(...(axis.data ?? []));
12
- const maxX = Math.max(...(axis.data ?? []));
25
+ const filter = getFilters?.({
26
+ currentAxisId: axis.id,
27
+ isDefaultAxis
28
+ });
29
+ const data = filter ? axis.data?.filter((_, i) => filter({
30
+ x: null,
31
+ y: null
32
+ }, i)) : axis.data;
33
+ const minX = Math.min(...(data ?? []));
34
+ const maxX = Math.max(...(data ?? []));
13
35
  return [minX, maxX];
14
36
  };
15
- const getValueExtremum = params => {
37
+ const getValueExtremum = direction => params => {
16
38
  const {
17
39
  series,
18
40
  axis,
41
+ getFilters,
19
42
  isDefaultAxis
20
43
  } = params;
21
44
  return Object.keys(series).filter(seriesId => {
22
45
  const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
23
46
  return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
24
47
  }).reduce((acc, seriesId) => {
25
- const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]) ?? [null, null];
26
- return [acc[0] === null ? seriesMin : Math.min(seriesMin, acc[0]), acc[1] === null ? seriesMax : Math.max(seriesMax, acc[1])];
27
- }, [null, null]);
48
+ const {
49
+ stackedData
50
+ } = series[seriesId];
51
+ const filter = getFilters?.({
52
+ currentAxisId: axis.id,
53
+ isDefaultAxis,
54
+ seriesXAxisId: series[seriesId].xAxisId ?? series[seriesId].xAxisKey,
55
+ seriesYAxisId: series[seriesId].yAxisId ?? series[seriesId].yAxisKey
56
+ });
57
+ const [seriesMin, seriesMax] = stackedData?.reduce((seriesAcc, values, index) => {
58
+ if (filter && (!filter(createResult(values[0], direction), index) || !filter(createResult(values[1], direction), index))) {
59
+ return seriesAcc;
60
+ }
61
+ return [Math.min(...values, seriesAcc[0]), Math.max(...values, seriesAcc[1])];
62
+ }, [Infinity, -Infinity]) ?? [Infinity, -Infinity];
63
+ return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
64
+ }, [Infinity, -Infinity]);
28
65
  };
29
66
  const getExtremumX = params => {
30
67
  // Notice that bar should be all horizontal or all vertical.
31
68
  // Don't think it's a problem for now
32
69
  const isHorizontal = Object.keys(params.series).some(seriesId => params.series[seriesId].layout === 'horizontal');
33
70
  if (isHorizontal) {
34
- return getValueExtremum(params);
71
+ return getValueExtremum('x')(params);
35
72
  }
36
73
  return getBaseExtremum(params);
37
74
  };
@@ -41,6 +78,6 @@ const getExtremumY = params => {
41
78
  if (isHorizontal) {
42
79
  return getBaseExtremum(params);
43
80
  }
44
- return getValueExtremum(params);
81
+ return getValueExtremum('y')(params);
45
82
  };
46
83
  exports.getExtremumY = getExtremumY;
package/CHANGELOG.md CHANGED
@@ -3,6 +3,167 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.14.0
7
+
8
+ _Aug 23, 2024_
9
+
10
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 💫 Allow [filtering the axis on zoom](https://mui.com/x/react-charts/zoom-and-pan/#zoom-filtering), making the axis adapt by removing values outside the view.
13
+
14
+ <img width="600" src="https://github.com/user-attachments/assets/e65bbd00-d2a8-4136-81cd-3598f1373c16" alt="filtering the axis on zoom" />
15
+
16
+ - 📊 Improve bar chart performances
17
+ - 🌍 Improve Czech (cs-CZ) and Hebrew (he-IL) locales on the Data Grid
18
+ - 🌍 Improve Chinese (zh-HK), Hebrew (he-IL), and Vietnamese (vi-VN) locales on the Date and Time Pickers
19
+ - 🐞 Bugfixes
20
+
21
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@7.14.0`
26
+
27
+ - [DataGrid] Use readonly array result for `getTreeDataPath` (#11743) @pcorpet
28
+ - [DataGrid] Use `event.key` for `Tab` and `Escape` keys (#14170) @k-rajat19
29
+ - [DataGrid] Introduce selectors with arguments (#14236) @MBilalShafi
30
+ - [DataGrid] include `api` in `gridCellParams` interface (#14201) @k-rajat19
31
+ - [l10n] Improve Czech (cs-CZ) locale (#14135) @chirimiri22
32
+ - [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
33
+
34
+ #### `@mui/x-data-grid-pro@7.14.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@7.14.0`.
37
+
38
+ #### `@mui/x-data-grid-premium@7.14.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
39
+
40
+ Same changes as in `@mui/x-data-grid-pro@7.14.0`, plus:
41
+
42
+ - [DataGridPremium] Fix clipboard paste not working for a single cell on non-first page (#14261) @arminmeh
43
+ - [DataGridPremium] Fix `onCellSelectionModelChange` not triggered when additional cell range is selected (#14199) @arminmeh
44
+
45
+ ### Date and Time Pickers
46
+
47
+ #### `@mui/x-date-pickers@7.14.0`
48
+
49
+ - [l10n] Improve Chinese (zh-HK) locale (#13289) @yeeharn
50
+ - [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
51
+ - [l10n] Improve Vietnamese (vi-VN) locale (#14238) @locnbk2002
52
+ - [TimePicker] Handle `Space` and `Enter` on the `TimeClock` component @arthurbalduini
53
+
54
+ #### `@mui/x-date-pickers-pro@7.14.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@7.14.0`.
57
+
58
+ ### Charts
59
+
60
+ #### `@mui/x-charts@7.14.0`
61
+
62
+ - [charts] Fix grid overflow with zooming (#14280) @alexfauquette
63
+ - [charts] Improve bar chart performances (#14278) @alexfauquette
64
+ - [charts] Test pointer events (#14042) @alexfauquette
65
+ - [charts] Use `isPointInside` function for both graphs and axis (#14222) @JCQuintas
66
+
67
+ #### `@mui/x-charts-pro@7.0.0-alpha.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-charts@7.14.0`, plus:
70
+
71
+ - [charts-pro] Zoom axis filtering (#14121) @JCQuintas
72
+
73
+ ### Docs
74
+
75
+ - [docs] Consistent use of UTC and timezones (#14250) @oliviertassinari
76
+ - [docs] Fix missing leading slashes in URLs (#14249) @oliviertassinari
77
+ - [docs] Dash usage revision on pickers pages (#14260) @arthurbalduini
78
+
79
+ ### Core
80
+
81
+ - [core] Follow JSDocs convention @oliviertassinari
82
+ - [core] Prepare for material v6 (#14143) @LukasTy
83
+ - [code-infra] Set up `eslint-plugin-testing-library` (#14232) @LukasTy
84
+ - [infra] Updated mui-x roadmap links with new project URL (#14271) @michelengelen
85
+
86
+ ## 7.13.0
87
+
88
+ _Aug 16, 2024_
89
+
90
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
91
+
92
+ - 💫 Allow to [edit the label](https://mui.com/x/react-tree-view/rich-tree-view/editing/) of Tree View's items.
93
+
94
+ <img width="344" src="https://github.com/user-attachments/assets/1a6cf765-2dc8-4906-bd93-139086eed148" alt="Item label editing" />
95
+
96
+ - 🔧 Improve rows accessibility on the Data Grid features "Tree Data" and "Row Grouping". Certain "Row Grouping" accessibility updates will only be applied if experimental feature flag is enabled. See the [documentation](https://mui.com/x/react-data-grid/row-grouping/#accessibility-changes-in-v8) for more information.
97
+ - 🌍 Improve Vietnamese (vi-VN) locale on the Data Grid
98
+ - 🐞 Bugfixes
99
+
100
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
101
+
102
+ ### Data Grid
103
+
104
+ #### `@mui/x-data-grid@7.13.0`
105
+
106
+ - [DataGrid] Fix CSV export for `null` and `undefined` values (#14166) @k-rajat19
107
+ - [DataGrid] Fix error logged during skeleton loading with nested data grid (#14186) @KenanYusuf
108
+ - [DataGrid] Remove needless check in `useGridStateInitialization` (#14181) @k-rajat19
109
+ - [DataGrid] Add recipe for persisting filters in local storage (#14208) @cherniavskii
110
+ - [l10n] Improve Vietnamese (vi-VN) locale (#14216) @hungnd-casso
111
+
112
+ #### `@mui/x-data-grid-pro@7.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
113
+
114
+ Same changes as in `@mui/x-data-grid@7.13.0`, plus:
115
+
116
+ - [DataGridPro] Fix Tree Data and Row Grouping rows accessibility (#13623) @arminmeh
117
+
118
+ #### `@mui/x-data-grid-premium@7.13.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
119
+
120
+ Same changes as in `@mui/x-data-grid-pro@7.13.0`.
121
+
122
+ ### Date and Time Pickers
123
+
124
+ #### `@mui/x-date-pickers@7.13.0`
125
+
126
+ - [pickers] Fix date and time merging to retain milliseconds (#14173) @LukasTy
127
+
128
+ #### `@mui/x-date-pickers-pro@7.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
129
+
130
+ Same changes as in `@mui/x-date-pickers@7.13.0`.
131
+
132
+ ### Charts
133
+
134
+ #### `@mui/x-charts@7.13.0`
135
+
136
+ - [charts] Add `baseline` property to the `LineChart` `series` (#14153) @JCQuintas
137
+ - [charts] Fix issue where tooltip would disappear on mouse click (#14187) @alexfauquette
138
+ - [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
139
+ - [charts] Support axis with the same value for all data points (#14191) @alexfauquette
140
+
141
+ #### `@mui/x-charts-pro@7.0.0-alpha.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
142
+
143
+ Same changes as in `@mui/x-charts@7.13.0`.
144
+
145
+ ### Tree View
146
+
147
+ #### `@mui/x-tree-view@7.13.0`
148
+
149
+ - [TreeView] Add label editing feature (#13388) @noraleonte
150
+ - [TreeView] Fix the parameters passed for the `canMoveItemToNewPosition` prop (#14176) @flaviendelangle
151
+
152
+ ### Docs
153
+
154
+ - [docs] Extract dataset in the Line chart docs (#14034) @alexfauquette
155
+ - [docs] Remove redundant encoding in the mock data source server (#14185) @MBilalShafi
156
+ - [docs] Use Netflix financial results to document bar charts (#13991) @alexfauquette
157
+ - [docs] Remove relience of abbreviations (#14226) @oliviertassinari
158
+
159
+ ### Core
160
+
161
+ - [core] Bump monorepo (#14141) @Janpot
162
+ - [core] Fix ESLint issue (#14207) @LukasTy
163
+ - [core] Fix Netlify build cache issue (#14182) @cherniavskii
164
+ - [code-infra] Refactor Netlify `cache-docs` plugin setup (#14105) @LukasTy
165
+ - [internals] Move utils needed for tree view virtualization to shared package (#14202) @flaviendelangle
166
+
6
167
  ## 7.12.1
7
168
 
8
169
  _Aug 8, 2024_
@@ -51,7 +212,7 @@ Same changes as in `@mui/x-date-pickers@7.12.1`.
51
212
  - [charts] Fix charts vendor publish config (#14073) @JCQuintas
52
213
  - [charts] Move `plugins` to `PluginProvider` (#14056) @JCQuintas
53
214
 
54
- #### `@mui/x-date-charts-pro@7.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
215
+ #### `@mui/x-charts-pro@7.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
55
216
 
56
217
  Same changes as in `@mui/x-charts@7.12.1`, plus:
57
218
 
@@ -2,12 +2,12 @@ import * as React from 'react';
2
2
  import { DrawingProviderProps } from '../context/DrawingProvider';
3
3
  import { SeriesProviderProps } from '../context/SeriesProvider';
4
4
  import { ChartsSurfaceProps } from '../ChartsSurface';
5
- import { CartesianContextProviderProps } from '../context/CartesianProvider';
5
+ import { CartesianProviderProps } from '../context/CartesianProvider';
6
6
  import { HighlightedProviderProps, ZAxisContextProviderProps } from '../context';
7
7
  import { PluginProviderProps } from '../context/PluginProvider';
8
8
  import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../models/axis';
9
9
  import { MakeOptional } from '../models/helpers';
10
- export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, 'seriesFormatters'> & Omit<DrawingProviderProps, 'svgRef'> & Pick<CartesianContextProviderProps, 'dataset'> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps, 'children'> & {
10
+ export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, 'seriesFormatters'> & Omit<DrawingProviderProps, 'svgRef'> & Pick<CartesianProviderProps, 'dataset'> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps, 'children'> & {
11
11
  /**
12
12
  * The configuration of the x-axes.
13
13
  * If not provided, a default axis config is used.
@@ -22,7 +22,7 @@ export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderP
22
22
  yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[];
23
23
  children?: React.ReactNode;
24
24
  };
25
- declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, "seriesFormatters"> & Omit<DrawingProviderProps, "svgRef"> & Pick<CartesianContextProviderProps, "dataset"> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps, "children"> & {
25
+ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, "seriesFormatters"> & Omit<DrawingProviderProps, "svgRef"> & Pick<CartesianProviderProps, "dataset"> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps, "children"> & {
26
26
  /**
27
27
  * The configuration of the x-axes.
28
28
  * If not provided, a default axis config is used.
@@ -25,7 +25,7 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
25
25
  children,
26
26
  drawingProviderProps,
27
27
  seriesProviderProps,
28
- cartesianContextProps,
28
+ cartesianProviderProps,
29
29
  zAxisContextProps,
30
30
  highlightedProviderProps,
31
31
  chartsSurfaceProps,
@@ -34,7 +34,7 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
34
34
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DrawingProvider.DrawingProvider, (0, _extends2.default)({}, drawingProviderProps, {
35
35
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PluginProvider.PluginProvider, (0, _extends2.default)({}, pluginProviderProps, {
36
36
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SeriesProvider.SeriesProvider, (0, _extends2.default)({}, seriesProviderProps, {
37
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianProvider.CartesianContextProvider, (0, _extends2.default)({}, cartesianContextProps, {
37
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianProvider.CartesianProvider, (0, _extends2.default)({}, cartesianProviderProps, {
38
38
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ZAxisContextProvider, (0, _extends2.default)({}, zAxisContextProps, {
39
39
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InteractionProvider.InteractionProvider, {
40
40
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.HighlightedProvider, (0, _extends2.default)({}, highlightedProviderProps, {
@@ -164,6 +164,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
164
164
  slotProps: _propTypes.default.object,
165
165
  slots: _propTypes.default.object,
166
166
  stroke: _propTypes.default.string,
167
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
167
168
  tickFontSize: _propTypes.default.number,
168
169
  tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
169
170
  tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
@@ -216,6 +217,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
216
217
  slotProps: _propTypes.default.object,
217
218
  slots: _propTypes.default.object,
218
219
  stroke: _propTypes.default.string,
220
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
219
221
  tickFontSize: _propTypes.default.number,
220
222
  tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
221
223
  tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { DrawingProviderProps } from '../context/DrawingProvider';
3
- import type { CartesianContextProviderProps } from '../context/CartesianProvider';
3
+ import type { CartesianProviderProps } from '../context/CartesianProvider';
4
4
  import type { SeriesProviderProps } from '../context/SeriesProvider';
5
5
  import type { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
6
6
  import type { ChartContainerProps } from './ChartContainer';
@@ -11,7 +11,7 @@ export declare const useChartContainerProps: (props: ChartContainerProps, ref: R
11
11
  children: React.ReactNode;
12
12
  drawingProviderProps: Omit<DrawingProviderProps, "children">;
13
13
  seriesProviderProps: Omit<SeriesProviderProps, "children">;
14
- cartesianContextProps: Omit<CartesianContextProviderProps, "children">;
14
+ cartesianProviderProps: Omit<CartesianProviderProps, "children">;
15
15
  zAxisContextProps: Omit<ZAxisContextProviderProps, "children">;
16
16
  highlightedProviderProps: Omit<HighlightedProviderProps, "children">;
17
17
  chartsSurfaceProps: ChartsSurfaceProps & {
@@ -26,6 +26,7 @@ export declare const useChartContainerProps: (props: ChartContainerProps, ref: R
26
26
  label?: string | undefined;
27
27
  max?: (number | Date) | undefined;
28
28
  min?: (number | Date) | undefined;
29
+ sx?: import("@mui/system").SxProps | undefined;
29
30
  classes?: Partial<import("..").ChartsAxisClasses> | undefined;
30
31
  slots?: Partial<import("../internals").ChartsAxisSlots> | undefined;
31
32
  slotProps?: Partial<import("../internals").ChartsAxisSlotProps> | undefined;
@@ -58,6 +59,7 @@ export declare const useChartContainerProps: (props: ChartContainerProps, ref: R
58
59
  label?: string | undefined;
59
60
  max?: (number | Date) | undefined;
60
61
  min?: (number | Date) | undefined;
62
+ sx?: import("@mui/system").SxProps | undefined;
61
63
  classes?: Partial<import("..").ChartsAxisClasses> | undefined;
62
64
  slots?: Partial<import("../internals").ChartsAxisSlots> | undefined;
63
65
  slotProps?: Partial<import("../internals").ChartsAxisSlotProps> | undefined;
@@ -39,7 +39,7 @@ const useChartContainerProps = (props, ref) => {
39
39
  const chartSurfaceRef = (0, _useForkRef.default)(ref, svgRef);
40
40
  (0, _useReducedMotion.useReducedMotion)(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
41
41
 
42
- const [defaultizedXAxis, defaultizedYAxis] = (0, _useDefaultizeAxis.useDefaultizeAxis)(xAxis, yAxis);
42
+ const [defaultizedXAxis, defaultizedYAxis] = (0, _useDefaultizeAxis.useDefaultizeAxis)(xAxis, yAxis, dataset);
43
43
  const drawingProviderProps = {
44
44
  width,
45
45
  height,
@@ -54,7 +54,7 @@ const useChartContainerProps = (props, ref) => {
54
54
  colors,
55
55
  dataset
56
56
  };
57
- const cartesianContextProps = {
57
+ const cartesianProviderProps = {
58
58
  xAxis: defaultizedXAxis,
59
59
  yAxis: defaultizedYAxis,
60
60
  dataset
@@ -80,7 +80,7 @@ const useChartContainerProps = (props, ref) => {
80
80
  children,
81
81
  drawingProviderProps,
82
82
  seriesProviderProps,
83
- cartesianContextProps,
83
+ cartesianProviderProps,
84
84
  zAxisContextProps,
85
85
  highlightedProviderProps,
86
86
  chartsSurfaceProps,
@@ -1,7 +1,8 @@
1
1
  import { MakeOptional } from '../models/helpers';
2
2
  import { AxisConfig, ScaleName } from '../models';
3
3
  import { ChartsAxisProps } from '../models/axis';
4
- export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, inYAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined) => {
4
+ import { DatasetType } from '../models/seriesType/config';
5
+ export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, inYAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, dataset: DatasetType | undefined) => {
5
6
  reverse?: boolean | undefined;
6
7
  fill?: string | undefined;
7
8
  stroke?: string | undefined;
@@ -9,6 +10,7 @@ export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleN
9
10
  label?: string | undefined;
10
11
  max?: (number | Date) | undefined;
11
12
  min?: (number | Date) | undefined;
13
+ sx?: import("@mui/system").SxProps | undefined;
12
14
  classes?: Partial<import("..").ChartsAxisClasses> | undefined;
13
15
  slots?: Partial<import("../models/axis").ChartsAxisSlots> | undefined;
14
16
  slotProps?: Partial<import("../models/axis").ChartsAxisSlotProps> | undefined;
@@ -10,7 +10,7 @@ var React = _interopRequireWildcard(require("react"));
10
10
  var _constants = require("../constants");
11
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
- const defaultizeAxis = (inAxis, axisName) => {
13
+ const defaultizeAxis = (inAxis, dataset, axisName) => {
14
14
  const DEFAULT_AXIS_KEY = axisName === 'x' ? _constants.DEFAULT_X_AXIS_KEY : _constants.DEFAULT_Y_AXIS_KEY;
15
15
  return [...(inAxis?.map((axis, index) => (0, _extends2.default)({
16
16
  id: `defaultized-${axisName}-axis-${index}`
@@ -19,11 +19,22 @@ const defaultizeAxis = (inAxis, axisName) => {
19
19
  }) => id === DEFAULT_AXIS_KEY) === -1 ? [{
20
20
  id: DEFAULT_AXIS_KEY,
21
21
  scaleType: 'linear'
22
- }] : [])];
22
+ }] : [])].map(axisConfig => {
23
+ const dataKey = axisConfig.dataKey;
24
+ if (dataKey === undefined || axisConfig.data !== undefined) {
25
+ return axisConfig;
26
+ }
27
+ if (dataset === undefined) {
28
+ throw Error(`MUI X: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
29
+ }
30
+ return (0, _extends2.default)({}, axisConfig, {
31
+ data: dataset.map(d => d[dataKey])
32
+ });
33
+ });
23
34
  };
24
- const useDefaultizeAxis = (inXAxis, inYAxis) => {
25
- const xAxis = React.useMemo(() => defaultizeAxis(inXAxis, 'x'), [inXAxis]);
26
- const yAxis = React.useMemo(() => defaultizeAxis(inYAxis, 'y'), [inYAxis]);
35
+ const useDefaultizeAxis = (inXAxis, inYAxis, dataset) => {
36
+ const xAxis = React.useMemo(() => defaultizeAxis(inXAxis, dataset, 'x'), [inXAxis, dataset]);
37
+ const yAxis = React.useMemo(() => defaultizeAxis(inYAxis, dataset, 'y'), [inYAxis, dataset]);
27
38
  return [xAxis, yAxis];
28
39
  };
29
40
  exports.useDefaultizeAxis = useDefaultizeAxis;
@@ -36,16 +36,30 @@ const ChartsAxisHighlightPath = exports.ChartsAxisHighlightPath = (0, _styles.st
36
36
  slot: 'Root',
37
37
  overridesResolver: (_, styles) => styles.root
38
38
  })(({
39
- ownerState,
40
39
  theme
41
- }) => (0, _extends2.default)({
42
- pointerEvents: 'none'
43
- }, ownerState.axisHighlight === 'band' && {
44
- fill: theme.palette.mode === 'light' ? 'gray' : 'white',
45
- fillOpacity: 0.1
46
- }, ownerState.axisHighlight === 'line' && {
47
- strokeDasharray: '5 2',
48
- stroke: theme.palette.mode === 'light' ? '#000000' : '#ffffff'
40
+ }) => ({
41
+ pointerEvents: 'none',
42
+ variants: [{
43
+ props: {
44
+ axisHighlight: 'band'
45
+ },
46
+ style: (0, _extends2.default)({
47
+ fill: 'white',
48
+ fillOpacity: 0.1
49
+ }, theme.applyStyles('light', {
50
+ fill: 'gray'
51
+ }))
52
+ }, {
53
+ props: {
54
+ axisHighlight: 'line'
55
+ },
56
+ style: (0, _extends2.default)({
57
+ strokeDasharray: '5 2',
58
+ stroke: '#ffffff'
59
+ }, theme.applyStyles('light', {
60
+ stroke: '#000000'
61
+ }))
62
+ }]
49
63
  }));
50
64
  /**
51
65
  * Demos:
@@ -14,6 +14,7 @@ var _styles = require("@mui/material/styles");
14
14
  var _CartesianProvider = require("../context/CartesianProvider");
15
15
  var _useTicks = require("../hooks/useTicks");
16
16
  var _chartsGridClasses = require("./chartsGridClasses");
17
+ var _useDrawingArea = require("../hooks/useDrawingArea");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  const _excluded = ["vertical", "horizontal"];
19
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -62,6 +63,7 @@ function ChartsGrid(props) {
62
63
  props,
63
64
  name: 'MuiChartsGrid'
64
65
  });
66
+ const drawingArea = (0, _useDrawingArea.useDrawingArea)();
65
67
  const {
66
68
  vertical,
67
69
  horizontal
@@ -102,8 +104,8 @@ function ChartsGrid(props) {
102
104
  formattedValue,
103
105
  offset
104
106
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridLine, {
105
- y1: yScale.range()[0],
106
- y2: yScale.range()[1],
107
+ y1: drawingArea.top,
108
+ y2: drawingArea.top + drawingArea.height,
107
109
  x1: offset,
108
110
  x2: offset,
109
111
  className: classes.verticalLine
@@ -113,8 +115,8 @@ function ChartsGrid(props) {
113
115
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridLine, {
114
116
  y1: offset,
115
117
  y2: offset,
116
- x1: xScale.range()[0],
117
- x2: xScale.range()[1],
118
+ x1: drawingArea.left,
119
+ x2: drawingArea.left + drawingArea.width,
118
120
  className: classes.horizontalLine
119
121
  }, `horizontal-${formattedValue}`))]
120
122
  }));
@@ -59,8 +59,10 @@ function useMouseTracker() {
59
59
  if (element === null) {
60
60
  return () => {};
61
61
  }
62
- const handleOut = () => {
63
- setMousePosition(null);
62
+ const handleOut = event => {
63
+ if (event.pointerType !== 'mouse') {
64
+ setMousePosition(null);
65
+ }
64
66
  };
65
67
  const handleMove = event => {
66
68
  setMousePosition({