@mui/x-charts-pro 7.0.0-alpha.0 → 7.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/ChartContainerPro/ChartContainerPro.js +9 -5
  3. package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
  4. package/ChartContainerPro/useChartContainerProProps.js +2 -2
  5. package/Heatmap/Heatmap.js +4 -0
  6. package/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +4 -0
  7. package/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.d.ts +1 -1
  8. package/ScatterChartPro/ScatterChartPro.js +4 -0
  9. package/context/CartesianProviderPro/CartesianProviderPro.d.ts +4 -4
  10. package/context/CartesianProviderPro/CartesianProviderPro.js +46 -10
  11. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +12 -0
  12. package/context/CartesianProviderPro/createAxisFilterMapper.js +61 -0
  13. package/context/ZoomProvider/Zoom.types.d.ts +10 -0
  14. package/context/ZoomProvider/defaultizeZoom.js +2 -1
  15. package/index.js +1 -1
  16. package/internals/utils/releaseInfo.js +1 -1
  17. package/modern/ChartContainerPro/ChartContainerPro.js +9 -5
  18. package/modern/ChartContainerPro/useChartContainerProProps.js +2 -2
  19. package/modern/Heatmap/Heatmap.js +4 -0
  20. package/modern/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +4 -0
  21. package/modern/ScatterChartPro/ScatterChartPro.js +4 -0
  22. package/modern/context/CartesianProviderPro/CartesianProviderPro.js +46 -10
  23. package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +61 -0
  24. package/modern/context/ZoomProvider/defaultizeZoom.js +2 -1
  25. package/modern/index.js +1 -1
  26. package/modern/internals/utils/releaseInfo.js +1 -1
  27. package/node/ChartContainerPro/ChartContainerPro.js +8 -4
  28. package/node/ChartContainerPro/useChartContainerProProps.js +2 -2
  29. package/node/Heatmap/Heatmap.js +4 -0
  30. package/node/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +4 -0
  31. package/node/ScatterChartPro/ScatterChartPro.js +4 -0
  32. package/node/context/CartesianProviderPro/CartesianProviderPro.js +47 -10
  33. package/node/context/CartesianProviderPro/createAxisFilterMapper.js +69 -0
  34. package/node/context/ZoomProvider/defaultizeZoom.js +2 -1
  35. package/node/index.js +1 -1
  36. package/node/internals/utils/releaseInfo.js +1 -1
  37. package/package.json +6 -6
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
 
@@ -6,7 +6,7 @@ import { HighlightedProvider, ZAxisContextProvider } from '@mui/x-charts/context
6
6
  import { ChartsAxesGradients, DrawingProvider, InteractionProvider, PluginProvider, SeriesProvider } from '@mui/x-charts/internals';
7
7
  import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
8
8
  import { getReleaseInfo } from '../internals/utils/releaseInfo';
9
- import { CartesianContextProviderPro } from '../context/CartesianProviderPro';
9
+ import { CartesianProviderPro } from '../context/CartesianProviderPro';
10
10
  import { ZoomProvider } from '../context/ZoomProvider';
11
11
  import { useChartContainerProProps } from './useChartContainerProProps';
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -18,7 +18,7 @@ const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainer(
18
18
  seriesProviderProps,
19
19
  zAxisContextProps,
20
20
  highlightedProviderProps,
21
- cartesianContextProps,
21
+ cartesianProviderProps,
22
22
  chartsSurfaceProps,
23
23
  pluginProviderProps,
24
24
  children
@@ -26,9 +26,9 @@ const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainer(
26
26
  useLicenseVerifier('x-charts-pro', releaseInfo);
27
27
  return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
28
28
  children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
29
- children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
30
- children: /*#__PURE__*/_jsx(ZoomProvider, _extends({}, zoomProviderProps, {
31
- children: /*#__PURE__*/_jsx(CartesianContextProviderPro, _extends({}, cartesianContextProps, {
29
+ children: /*#__PURE__*/_jsx(ZoomProvider, _extends({}, zoomProviderProps, {
30
+ children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
31
+ children: /*#__PURE__*/_jsx(CartesianProviderPro, _extends({}, cartesianProviderProps, {
32
32
  children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
33
33
  children: /*#__PURE__*/_jsx(InteractionProvider, {
34
34
  children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
@@ -165,6 +165,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
165
165
  slotProps: PropTypes.object,
166
166
  slots: PropTypes.object,
167
167
  stroke: PropTypes.string,
168
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
168
169
  tickFontSize: PropTypes.number,
169
170
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
170
171
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -177,6 +178,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
177
178
  tickSize: PropTypes.number,
178
179
  valueFormatter: PropTypes.func,
179
180
  zoom: PropTypes.oneOfType([PropTypes.shape({
181
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
180
182
  maxEnd: PropTypes.number,
181
183
  maxSpan: PropTypes.number,
182
184
  minSpan: PropTypes.number,
@@ -225,6 +227,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
225
227
  slotProps: PropTypes.object,
226
228
  slots: PropTypes.object,
227
229
  stroke: PropTypes.string,
230
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
228
231
  tickFontSize: PropTypes.number,
229
232
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
230
233
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -237,6 +240,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
237
240
  tickSize: PropTypes.number,
238
241
  valueFormatter: PropTypes.func,
239
242
  zoom: PropTypes.oneOfType([PropTypes.shape({
243
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
240
244
  maxEnd: PropTypes.number,
241
245
  maxSpan: PropTypes.number,
242
246
  minSpan: PropTypes.number,
@@ -6,7 +6,7 @@ export declare const useChartContainerProProps: (props: ChartContainerProProps,
6
6
  drawingProviderProps: Omit<import("@mui/x-charts/internals").DrawingProviderProps, "children">;
7
7
  pluginProviderProps: Omit<import("@mui/x-charts/internals").PluginProviderProps, "children">;
8
8
  seriesProviderProps: Omit<import("@mui/x-charts/internals").SeriesProviderProps, "children">;
9
- cartesianContextProps: Omit<import("@mui/x-charts/internals").CartesianContextProviderProps, "children">;
9
+ cartesianProviderProps: Omit<import("@mui/x-charts/internals").CartesianProviderProps, "children">;
10
10
  zAxisContextProps: Omit<import("@mui/x-charts/internals").ZAxisContextProviderProps, "children">;
11
11
  highlightedProviderProps: Omit<import("@mui/x-charts").HighlightedProviderProps, "children">;
12
12
  chartsSurfaceProps: import("@mui/x-charts").ChartsSurfaceProps & {
@@ -11,7 +11,7 @@ export const useChartContainerProProps = (props, ref) => {
11
11
  children,
12
12
  drawingProviderProps,
13
13
  seriesProviderProps,
14
- cartesianContextProps,
14
+ cartesianProviderProps,
15
15
  zAxisContextProps,
16
16
  highlightedProviderProps,
17
17
  chartsSurfaceProps,
@@ -31,7 +31,7 @@ export const useChartContainerProProps = (props, ref) => {
31
31
  drawingProviderProps,
32
32
  pluginProviderProps,
33
33
  seriesProviderProps,
34
- cartesianContextProps,
34
+ cartesianProviderProps,
35
35
  zAxisContextProps,
36
36
  highlightedProviderProps,
37
37
  chartsSurfaceProps
@@ -276,6 +276,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
276
276
  slotProps: PropTypes.object,
277
277
  slots: PropTypes.object,
278
278
  stroke: PropTypes.string,
279
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
279
280
  tickFontSize: PropTypes.number,
280
281
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
281
282
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -288,6 +289,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
288
289
  tickSize: PropTypes.number,
289
290
  valueFormatter: PropTypes.func,
290
291
  zoom: PropTypes.oneOfType([PropTypes.shape({
292
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
291
293
  maxEnd: PropTypes.number,
292
294
  maxSpan: PropTypes.number,
293
295
  minSpan: PropTypes.number,
@@ -338,6 +340,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
338
340
  slotProps: PropTypes.object,
339
341
  slots: PropTypes.object,
340
342
  stroke: PropTypes.string,
343
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
341
344
  tickFontSize: PropTypes.number,
342
345
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
343
346
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -350,6 +353,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
350
353
  tickSize: PropTypes.number,
351
354
  valueFormatter: PropTypes.func,
352
355
  zoom: PropTypes.oneOfType([PropTypes.shape({
356
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
353
357
  maxEnd: PropTypes.number,
354
358
  maxSpan: PropTypes.number,
355
359
  minSpan: PropTypes.number,
@@ -142,6 +142,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
142
142
  slotProps: PropTypes.object,
143
143
  slots: PropTypes.object,
144
144
  stroke: PropTypes.string,
145
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
145
146
  tickFontSize: PropTypes.number,
146
147
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
147
148
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -154,6 +155,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
154
155
  tickSize: PropTypes.number,
155
156
  valueFormatter: PropTypes.func,
156
157
  zoom: PropTypes.oneOfType([PropTypes.shape({
158
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
157
159
  maxEnd: PropTypes.number,
158
160
  maxSpan: PropTypes.number,
159
161
  minSpan: PropTypes.number,
@@ -202,6 +204,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
202
204
  slotProps: PropTypes.object,
203
205
  slots: PropTypes.object,
204
206
  stroke: PropTypes.string,
207
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
205
208
  tickFontSize: PropTypes.number,
206
209
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
207
210
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -214,6 +217,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
214
217
  tickSize: PropTypes.number,
215
218
  valueFormatter: PropTypes.func,
216
219
  zoom: PropTypes.oneOfType([PropTypes.shape({
220
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
217
221
  maxEnd: PropTypes.number,
218
222
  maxSpan: PropTypes.number,
219
223
  minSpan: PropTypes.number,
@@ -16,9 +16,9 @@ export declare const useResponsiveChartContainerProProps: (props: ResponsiveChar
16
16
  height?: number;
17
17
  } | undefined;
18
18
  plugins?: import("@mui/x-charts/internals").ChartsPlugin<import("@mui/x-charts/internals").ChartSeriesType>[] | undefined;
19
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
19
20
  series: (import("@mui/x-charts").ScatterSeriesType | import("@mui/x-charts").LineSeriesType | import("@mui/x-charts").BarSeriesType | import("@mui/x-charts").PieSeriesType<import("@mui/x-charts/internals").MakeOptional<import("@mui/x-charts").PieValueType, "id">> | import("../models").HeatmapSeriesType)[];
20
21
  onHighlightChange?: ((highlightedItem: import("@mui/x-charts").HighlightItemData | null) => void) | undefined;
21
- sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
22
22
  zAxis?: import("@mui/x-charts/internals").MakeOptional<import("@mui/x-charts/internals").ZAxisConfig, "id">[] | undefined;
23
23
  dataset?: import("@mui/x-charts/internals").DatasetType | undefined;
24
24
  colors?: import("@mui/x-charts").ChartsColorPalette | undefined;
@@ -271,6 +271,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
271
271
  slotProps: PropTypes.object,
272
272
  slots: PropTypes.object,
273
273
  stroke: PropTypes.string,
274
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
274
275
  tickFontSize: PropTypes.number,
275
276
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
276
277
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -283,6 +284,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
283
284
  tickSize: PropTypes.number,
284
285
  valueFormatter: PropTypes.func,
285
286
  zoom: PropTypes.oneOfType([PropTypes.shape({
287
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
286
288
  maxEnd: PropTypes.number,
287
289
  maxSpan: PropTypes.number,
288
290
  minSpan: PropTypes.number,
@@ -331,6 +333,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
331
333
  slotProps: PropTypes.object,
332
334
  slots: PropTypes.object,
333
335
  stroke: PropTypes.string,
336
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
334
337
  tickFontSize: PropTypes.number,
335
338
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
336
339
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -343,6 +346,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
343
346
  tickSize: PropTypes.number,
344
347
  valueFormatter: PropTypes.func,
345
348
  zoom: PropTypes.oneOfType([PropTypes.shape({
349
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
346
350
  maxEnd: PropTypes.number,
347
351
  maxSpan: PropTypes.number,
348
352
  minSpan: PropTypes.number,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { CartesianContextProviderProps } from '@mui/x-charts/internals';
3
- export interface CartesianContextProviderProProps extends CartesianContextProviderProps {
2
+ import { CartesianProviderProps } from '@mui/x-charts/internals';
3
+ export interface CartesianProviderProProps extends CartesianProviderProps {
4
4
  }
5
- declare function CartesianContextProviderPro(props: CartesianContextProviderProProps): React.JSX.Element;
6
- export { CartesianContextProviderPro };
5
+ declare function CartesianProviderPro(props: CartesianProviderProProps): React.JSX.Element;
6
+ export { CartesianProviderPro };
@@ -1,42 +1,78 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
2
3
  import { useDrawingArea, useSeries, CartesianContext, cartesianProviderUtils, useXExtremumGetter, useYExtremumGetter } from '@mui/x-charts/internals';
3
4
  import { useZoom } from '../ZoomProvider/useZoom';
5
+ import { createAxisFilterMapper, createGetAxisFilters } from './createAxisFilterMapper';
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  const {
6
8
  computeValue
7
9
  } = cartesianProviderUtils;
8
- function CartesianContextProviderPro(props) {
10
+ function CartesianProviderPro(props) {
9
11
  const {
10
12
  xAxis,
11
13
  yAxis,
12
- dataset,
13
14
  children
14
15
  } = props;
15
16
  const formattedSeries = useSeries();
16
17
  const drawingArea = useDrawingArea();
17
18
  const {
18
- zoomData
19
+ zoomData,
20
+ options
19
21
  } = useZoom();
20
22
  const xExtremumGetters = useXExtremumGetter();
21
23
  const yExtremumGetters = useYExtremumGetter();
24
+ const getFilters = React.useMemo(() => {
25
+ const xMapper = createAxisFilterMapper({
26
+ zoomData,
27
+ extremumGetter: xExtremumGetters,
28
+ formattedSeries,
29
+ direction: 'x'
30
+ });
31
+ const yMapper = createAxisFilterMapper({
32
+ zoomData,
33
+ extremumGetter: yExtremumGetters,
34
+ formattedSeries,
35
+ direction: 'y'
36
+ });
37
+ const xFilters = xAxis.reduce((acc, axis, index) => {
38
+ const filter = xMapper(axis, index);
39
+ if (filter !== null) {
40
+ acc[axis.id] = filter;
41
+ }
42
+ return acc;
43
+ }, {});
44
+ const yFilters = yAxis.reduce((acc, axis, index) => {
45
+ const filter = yMapper(axis, index);
46
+ if (filter !== null) {
47
+ acc[axis.id] = filter;
48
+ }
49
+ return acc;
50
+ }, {});
51
+ if (Object.keys(xFilters).length === 0 && Object.keys(yFilters).length === 0) {
52
+ return undefined;
53
+ }
54
+ return createGetAxisFilters(_extends({}, xFilters, yFilters));
55
+ }, [formattedSeries, xAxis, xExtremumGetters, yAxis, yExtremumGetters, zoomData]);
22
56
  const xValues = React.useMemo(() => computeValue({
23
57
  drawingArea,
24
58
  formattedSeries,
25
59
  axis: xAxis,
26
60
  extremumGetters: xExtremumGetters,
27
- dataset,
28
61
  axisDirection: 'x',
29
- zoomData
30
- }), [drawingArea, formattedSeries, xAxis, xExtremumGetters, dataset, zoomData]);
62
+ zoomData,
63
+ zoomOptions: options,
64
+ getFilters
65
+ }), [drawingArea, formattedSeries, xAxis, xExtremumGetters, zoomData, options, getFilters]);
31
66
  const yValues = React.useMemo(() => computeValue({
32
67
  drawingArea,
33
68
  formattedSeries,
34
69
  axis: yAxis,
35
70
  extremumGetters: yExtremumGetters,
36
- dataset,
37
71
  axisDirection: 'y',
38
- zoomData
39
- }), [drawingArea, formattedSeries, yAxis, yExtremumGetters, dataset, zoomData]);
72
+ zoomData,
73
+ zoomOptions: options,
74
+ getFilters
75
+ }), [drawingArea, formattedSeries, yAxis, yExtremumGetters, zoomData, options, getFilters]);
40
76
  const value = React.useMemo(() => ({
41
77
  isInitialized: true,
42
78
  data: {
@@ -51,4 +87,4 @@ function CartesianContextProviderPro(props) {
51
87
  children: children
52
88
  });
53
89
  }
54
- export { CartesianContextProviderPro };
90
+ export { CartesianProviderPro };
@@ -0,0 +1,12 @@
1
+ import { FormattedSeries, ExtremumGettersConfig, ExtremumFilter, ZoomAxisFilters, GetZoomAxisFilters } from '@mui/x-charts/internals';
2
+ import { ChartsAxisProps, ScaleName, AxisConfig } from '@mui/x-charts';
3
+ import { ZoomData } from '../ZoomProvider';
4
+ type CreateAxisFilterMapperParams = {
5
+ zoomData: ZoomData[];
6
+ extremumGetter: ExtremumGettersConfig;
7
+ formattedSeries: FormattedSeries;
8
+ direction: 'x' | 'y';
9
+ };
10
+ export declare const createAxisFilterMapper: ({ zoomData, extremumGetter, formattedSeries, direction }: CreateAxisFilterMapperParams) => (axis: AxisConfig<ScaleName, any, ChartsAxisProps>, axisIndex: number) => ExtremumFilter | null;
11
+ export declare const createGetAxisFilters: (filters: ZoomAxisFilters) => GetZoomAxisFilters;
12
+ export {};
@@ -0,0 +1,61 @@
1
+ import { getAxisExtremum, isDefined } from '@mui/x-charts/internals';
2
+ import { getScale } from '../../../../x-charts/src/internals/getScale';
3
+ export const createAxisFilterMapper = ({
4
+ zoomData,
5
+ extremumGetter,
6
+ formattedSeries,
7
+ direction
8
+ }) => (axis, axisIndex) => {
9
+ if (typeof axis.zoom !== 'object' || axis.zoom.filterMode !== 'discard') {
10
+ return null;
11
+ }
12
+ const zoom = zoomData?.find(({
13
+ axisId
14
+ }) => axisId === axis.id);
15
+ if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
16
+ // No zoom, or zoom with all data visible
17
+ return null;
18
+ }
19
+ let extremums = [];
20
+ const scaleType = axis.scaleType;
21
+ if (scaleType === 'point' || scaleType === 'band') {
22
+ extremums = [0, (axis.data?.length ?? 1) - 1];
23
+ } else {
24
+ extremums = getAxisExtremum(axis, extremumGetter, axisIndex === 0, formattedSeries);
25
+ }
26
+ let min;
27
+ let max;
28
+
29
+ // @ts-expect-error The function defaults to linear scale if the scaleType is not recognized.
30
+ [min, max] = getScale(scaleType, extremums, [0, 100]).nice().domain();
31
+ min = min instanceof Date ? min.getTime() : min;
32
+ max = max instanceof Date ? max.getTime() : max;
33
+ const minVal = min + zoom.start * (max - min) / 100;
34
+ const maxVal = min + zoom.end * (max - min) / 100;
35
+ return (value, dataIndex) => {
36
+ const val = value[direction] ?? axis.data?.[dataIndex];
37
+ if (val == null) {
38
+ // If the value does not exist because of missing data point, or out of range index, we just ignore.
39
+ return true;
40
+ }
41
+ if (axis.scaleType === 'point' || axis.scaleType === 'band' || typeof val === 'string') {
42
+ return dataIndex >= minVal && dataIndex <= maxVal;
43
+ }
44
+ return val >= minVal && val <= maxVal;
45
+ };
46
+ };
47
+ export const createGetAxisFilters = filters => ({
48
+ currentAxisId,
49
+ seriesXAxisId,
50
+ seriesYAxisId,
51
+ isDefaultAxis
52
+ }) => {
53
+ return (value, dataIndex) => {
54
+ const axisId = currentAxisId === seriesXAxisId ? seriesYAxisId : seriesXAxisId;
55
+ if (!axisId || isDefaultAxis) {
56
+ return Object.values(filters ?? {})[0]?.(value, dataIndex) ?? true;
57
+ }
58
+ const data = [seriesYAxisId, seriesXAxisId].filter(id => id !== currentAxisId).map(id => filters[id ?? '']).filter(isDefined);
59
+ return data.every(f => f(value, dataIndex));
60
+ };
61
+ };
@@ -93,6 +93,16 @@ export type ZoomOptions = {
93
93
  * @default true
94
94
  */
95
95
  panning?: boolean;
96
+ /**
97
+ * Defines how to filter the axis data when it is outside of the zoomed range of this axis.
98
+ *
99
+ * - `keep`: The data outside the zoomed range is kept. And the other axes will stay the same.
100
+ * - `discard`: The data outside the zoomed range is discarded for the other axes.
101
+ * The other axes will be adjusted to fit the zoomed range.
102
+ *
103
+ * @default 'keep'
104
+ */
105
+ filterMode?: 'discard' | 'keep';
96
106
  };
97
107
  export type ZoomData = {
98
108
  /**
@@ -6,7 +6,8 @@ const defaultZoomOptions = {
6
6
  step: 5,
7
7
  minSpan: 10,
8
8
  maxSpan: 100,
9
- panning: true
9
+ panning: true,
10
+ filterMode: 'keep'
10
11
  };
11
12
  export const defaultizeZoom = (axis, axisDirection) => {
12
13
  if (!axis) {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts-pro v7.0.0-alpha.0
2
+ * @mui/x-charts-pro v7.0.0-alpha.2
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcyMzE1NDQwMDAwMA==";
3
+ const releaseInfo = "MTcyNDM2MDQwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat