@mui/x-charts-pro 7.0.0-alpha.1 → 7.0.0-alpha.3

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 (45) hide show
  1. package/BarChartPro/BarChartPro.js +6 -1
  2. package/CHANGELOG.md +151 -2
  3. package/ChartContainerPro/ChartContainerPro.js +2 -0
  4. package/Heatmap/Heatmap.js +9 -2
  5. package/LineChartPro/LineChartPro.js +6 -1
  6. package/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +2 -0
  7. package/ScatterChartPro/ScatterChartPro.js +8 -1
  8. package/context/CartesianProviderPro/CartesianProviderPro.js +44 -8
  9. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +12 -0
  10. package/context/CartesianProviderPro/createAxisFilterMapper.js +60 -0
  11. package/context/ZoomProvider/Zoom.types.d.ts +10 -0
  12. package/context/ZoomProvider/defaultizeZoom.js +2 -1
  13. package/index.js +1 -1
  14. package/internals/utils/releaseInfo.js +1 -1
  15. package/modern/BarChartPro/BarChartPro.js +6 -1
  16. package/modern/ChartContainerPro/ChartContainerPro.js +2 -0
  17. package/modern/Heatmap/Heatmap.js +9 -2
  18. package/modern/LineChartPro/LineChartPro.js +6 -1
  19. package/modern/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +2 -0
  20. package/modern/ScatterChartPro/ScatterChartPro.js +8 -1
  21. package/modern/context/CartesianProviderPro/CartesianProviderPro.js +44 -8
  22. package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +60 -0
  23. package/modern/context/ZoomProvider/defaultizeZoom.js +2 -1
  24. package/modern/index.js +1 -1
  25. package/modern/internals/utils/releaseInfo.js +1 -1
  26. package/modern/themeAugmentation/index.js +4 -0
  27. package/node/BarChartPro/BarChartPro.js +6 -1
  28. package/node/ChartContainerPro/ChartContainerPro.js +2 -0
  29. package/node/Heatmap/Heatmap.js +9 -2
  30. package/node/LineChartPro/LineChartPro.js +6 -1
  31. package/node/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +2 -0
  32. package/node/ScatterChartPro/ScatterChartPro.js +8 -1
  33. package/node/context/CartesianProviderPro/CartesianProviderPro.js +45 -8
  34. package/node/context/CartesianProviderPro/createAxisFilterMapper.js +68 -0
  35. package/node/context/ZoomProvider/defaultizeZoom.js +2 -1
  36. package/node/index.js +1 -1
  37. package/node/internals/utils/releaseInfo.js +1 -1
  38. package/node/themeAugmentation/index.js +49 -0
  39. package/package.json +8 -8
  40. package/themeAugmentation/components.d.ts +25 -0
  41. package/themeAugmentation/index.d.ts +4 -0
  42. package/themeAugmentation/index.js +4 -0
  43. package/themeAugmentation/overrides.d.ts +13 -0
  44. package/themeAugmentation/package.json +6 -0
  45. package/themeAugmentation/props.d.ts +22 -0
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["zoom", "onZoomChange"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useThemeProps } from '@mui/material/styles';
6
7
  import { BarPlot } from '@mui/x-charts/BarChart';
7
8
  import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
8
9
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
@@ -28,7 +29,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
29
  *
29
30
  * - [BarChart API](https://mui.com/x/api/charts/bar-chart/)
30
31
  */
31
- const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(props, ref) {
32
+ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps, ref) {
33
+ const props = useThemeProps({
34
+ props: inProps,
35
+ name: 'MuiBarChartPro'
36
+ });
32
37
  const {
33
38
  zoom,
34
39
  onZoomChange
package/CHANGELOG.md CHANGED
@@ -3,6 +3,155 @@
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.15.0
7
+
8
+ _Aug 29, 2024_
9
+
10
+ We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 💫 Support Material UI v6 (`@mui/material@6`) peer dependency (#14142) @cherniavskii
13
+
14
+ You can now use MUI X components with either v5 or v6 of `@mui/material` package 🎉
15
+
16
+ - 🐞 Bugfixes
17
+
18
+ ### Data Grid
19
+
20
+ #### `@mui/x-data-grid-pro@7.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
21
+
22
+ - [DataGridPro] Export `GridRowReorderCell` component (#14079) @genepaul
23
+
24
+ #### `@mui/x-data-grid-premium@7.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
25
+
26
+ Same changes as in `@mui/x-data-grid-pro@7.15.0`.
27
+
28
+ ### Date and Time Pickers
29
+
30
+ #### `@mui/x-date-pickers@7.15.0`
31
+
32
+ - [pickers] Add `onTouchStart` handler for `TimeClock` (#14305) @arthurbalduini
33
+
34
+ #### `@mui/x-date-pickers-pro@7.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-date-pickers@7.15.0`, plus:
37
+
38
+ - [DateTimeRangePicker] Fix date format resolving from views on 24hr locales (#14341) @arthurbalduini
39
+
40
+ ### Charts
41
+
42
+ #### `@mui/x-charts@7.15.0`
43
+
44
+ - [charts] Add missing `themeAugmentation` in pro plan (#14313) @lhilgert9
45
+ - [charts] Fix `LineChart` transition stopping before completion (#14366) @JCQuintas
46
+ - [charts] Fix tooltip with horizontal layout (#14337) @alexfauquette
47
+ - [charts] Keep axis root classe usage explicit (#14378) @alexfauquette
48
+
49
+ #### `@mui/x-charts-pro@7.0.0-alpha.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-charts@7.15.0`, plus:
52
+
53
+ - [charts pro] Avoid relative reference to `@mui/x-charts` package (#14335) @LukasTy
54
+
55
+ ### Docs
56
+
57
+ - [docs] Fix sentence case `h2` @oliviertassinari
58
+ - [docs] Clarify contribution guide references @oliviertassinari
59
+ - [docs] Fix Stack Overflow issue canned response @oliviertassinari
60
+ - [docs] Fix outdated link to support page @oliviertassinari
61
+ - [docs] Fix use of Material UI @oliviertassinari
62
+ - [docs] Update deprecated props in docs (#14295) @JCQuintas
63
+
64
+ ### Core
65
+
66
+ - [core] Allow only v5.x for `MUI Core` renovate group (#14382) @LukasTy
67
+ - [core] Avoid visual regression when using `@mui/material@6` (#14357) @cherniavskii
68
+ - [core] Remove renovate rule targeting only `next` releases of `@mui/docs` (#14364) @LukasTy
69
+ - [core] Support `@mui/material@6` peer dependency (#14142) @cherniavskii
70
+ - [core] Use `useRtl` instead of `useTheme` to access direction (#14359) @LukasTy
71
+ - [code-infra] Typecheck nested folders in playground (#14352) @JCQuintas
72
+ - [infra] Fix Issue cleanup action @oliviertassinari
73
+ - [license] Prepare renaming of argument names @oliviertassinari
74
+
75
+ ## 7.14.0
76
+
77
+ _Aug 23, 2024_
78
+
79
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
80
+
81
+ - 💫 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.
82
+
83
+ <img width="600" src="https://github.com/user-attachments/assets/e65bbd00-d2a8-4136-81cd-3598f1373c16" alt="filtering the axis on zoom" />
84
+
85
+ - 📊 Improve bar chart performances
86
+ - 🌍 Improve Czech (cs-CZ) and Hebrew (he-IL) locales on the Data Grid
87
+ - 🌍 Improve Chinese (zh-HK), Hebrew (he-IL), and Vietnamese (vi-VN) locales on the Date and Time Pickers
88
+ - 🐞 Bugfixes
89
+
90
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
91
+
92
+ ### Data Grid
93
+
94
+ #### `@mui/x-data-grid@7.14.0`
95
+
96
+ - [DataGrid] Use readonly array result for `getTreeDataPath` (#11743) @pcorpet
97
+ - [DataGrid] Use `event.key` for `Tab` and `Escape` keys (#14170) @k-rajat19
98
+ - [DataGrid] Introduce selectors with arguments (#14236) @MBilalShafi
99
+ - [DataGrid] include `api` in `gridCellParams` interface (#14201) @k-rajat19
100
+ - [l10n] Improve Czech (cs-CZ) locale (#14135) @chirimiri22
101
+ - [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
102
+
103
+ #### `@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')
104
+
105
+ Same changes as in `@mui/x-data-grid@7.14.0`.
106
+
107
+ #### `@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')
108
+
109
+ Same changes as in `@mui/x-data-grid-pro@7.14.0`, plus:
110
+
111
+ - [DataGridPremium] Fix clipboard paste not working for a single cell on non-first page (#14261) @arminmeh
112
+ - [DataGridPremium] Fix `onCellSelectionModelChange` not triggered when additional cell range is selected (#14199) @arminmeh
113
+
114
+ ### Date and Time Pickers
115
+
116
+ #### `@mui/x-date-pickers@7.14.0`
117
+
118
+ - [l10n] Improve Chinese (zh-HK) locale (#13289) @yeeharn
119
+ - [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
120
+ - [l10n] Improve Vietnamese (vi-VN) locale (#14238) @locnbk2002
121
+ - [TimePicker] Handle `Space` and `Enter` on the `TimeClock` component @arthurbalduini
122
+
123
+ #### `@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')
124
+
125
+ Same changes as in `@mui/x-date-pickers@7.14.0`.
126
+
127
+ ### Charts
128
+
129
+ #### `@mui/x-charts@7.14.0`
130
+
131
+ - [charts] Fix grid overflow with zooming (#14280) @alexfauquette
132
+ - [charts] Improve bar chart performances (#14278) @alexfauquette
133
+ - [charts] Test pointer events (#14042) @alexfauquette
134
+ - [charts] Use `isPointInside` function for both graphs and axis (#14222) @JCQuintas
135
+
136
+ #### `@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')
137
+
138
+ Same changes as in `@mui/x-charts@7.14.0`, plus:
139
+
140
+ - [charts-pro] Zoom axis filtering (#14121) @JCQuintas
141
+
142
+ ### Docs
143
+
144
+ - [docs] Consistent use of UTC and timezones (#14250) @oliviertassinari
145
+ - [docs] Fix missing leading slashes in URLs (#14249) @oliviertassinari
146
+ - [docs] Dash usage revision on pickers pages (#14260) @arthurbalduini
147
+
148
+ ### Core
149
+
150
+ - [core] Follow JSDocs convention @oliviertassinari
151
+ - [core] Prepare for material v6 (#14143) @LukasTy
152
+ - [code-infra] Set up `eslint-plugin-testing-library` (#14232) @LukasTy
153
+ - [infra] Updated mui-x roadmap links with new project URL (#14271) @michelengelen
154
+
6
155
  ## 7.13.0
7
156
 
8
157
  _Aug 16, 2024_
@@ -58,7 +207,7 @@ Same changes as in `@mui/x-date-pickers@7.13.0`.
58
207
  - [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
59
208
  - [charts] Support axis with the same value for all data points (#14191) @alexfauquette
60
209
 
61
- #### `@mui/x-date-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')
210
+ #### `@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')
62
211
 
63
212
  Same changes as in `@mui/x-charts@7.13.0`.
64
213
 
@@ -132,7 +281,7 @@ Same changes as in `@mui/x-date-pickers@7.12.1`.
132
281
  - [charts] Fix charts vendor publish config (#14073) @JCQuintas
133
282
  - [charts] Move `plugins` to `PluginProvider` (#14056) @JCQuintas
134
283
 
135
- #### `@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')
284
+ #### `@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')
136
285
 
137
286
  Same changes as in `@mui/x-charts@7.12.1`, plus:
138
287
 
@@ -178,6 +178,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
178
178
  tickSize: PropTypes.number,
179
179
  valueFormatter: PropTypes.func,
180
180
  zoom: PropTypes.oneOfType([PropTypes.shape({
181
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
181
182
  maxEnd: PropTypes.number,
182
183
  maxSpan: PropTypes.number,
183
184
  minSpan: PropTypes.number,
@@ -239,6 +240,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
239
240
  tickSize: PropTypes.number,
240
241
  valueFormatter: PropTypes.func,
241
242
  zoom: PropTypes.oneOfType([PropTypes.shape({
243
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
242
244
  maxEnd: PropTypes.number,
243
245
  maxSpan: PropTypes.number,
244
246
  minSpan: PropTypes.number,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
4
+ import { useThemeProps } from '@mui/material/styles';
5
5
  import useId from '@mui/utils/useId';
6
+ import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
6
7
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
7
8
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
8
9
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
@@ -15,7 +16,11 @@ import { DefaultHeatmapTooltip } from './DefaultHeatmapTooltip';
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
17
18
  const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
18
- const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(props, ref) {
19
+ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
20
+ const props = useThemeProps({
21
+ props: inProps,
22
+ name: 'MuiHeatmap'
23
+ });
19
24
  const {
20
25
  xAxis,
21
26
  yAxis,
@@ -289,6 +294,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
289
294
  tickSize: PropTypes.number,
290
295
  valueFormatter: PropTypes.func,
291
296
  zoom: PropTypes.oneOfType([PropTypes.shape({
297
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
292
298
  maxEnd: PropTypes.number,
293
299
  maxSpan: PropTypes.number,
294
300
  minSpan: PropTypes.number,
@@ -352,6 +358,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
352
358
  tickSize: PropTypes.number,
353
359
  valueFormatter: PropTypes.func,
354
360
  zoom: PropTypes.oneOfType([PropTypes.shape({
361
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
355
362
  maxEnd: PropTypes.number,
356
363
  maxSpan: PropTypes.number,
357
364
  minSpan: PropTypes.number,
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["zoom", "onZoomChange"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useThemeProps } from '@mui/material/styles';
6
7
  import { AreaPlot, LineHighlightPlot, LinePlot, MarkPlot } from '@mui/x-charts/LineChart';
7
8
  import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
8
9
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
@@ -27,7 +28,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
28
  *
28
29
  * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
29
30
  */
30
- const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(props, ref) {
31
+ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps, ref) {
32
+ const props = useThemeProps({
33
+ props: inProps,
34
+ name: 'MuiLineChartPro'
35
+ });
31
36
  const {
32
37
  zoom,
33
38
  onZoomChange
@@ -155,6 +155,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
155
155
  tickSize: PropTypes.number,
156
156
  valueFormatter: PropTypes.func,
157
157
  zoom: PropTypes.oneOfType([PropTypes.shape({
158
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
158
159
  maxEnd: PropTypes.number,
159
160
  maxSpan: PropTypes.number,
160
161
  minSpan: PropTypes.number,
@@ -216,6 +217,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
216
217
  tickSize: PropTypes.number,
217
218
  valueFormatter: PropTypes.func,
218
219
  zoom: PropTypes.oneOfType([PropTypes.shape({
220
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
219
221
  maxEnd: PropTypes.number,
220
222
  maxSpan: PropTypes.number,
221
223
  minSpan: PropTypes.number,
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["zoom", "onZoomChange"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useThemeProps } from '@mui/material/styles';
6
7
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
7
8
  import { ScatterPlot } from '@mui/x-charts/ScatterChart';
8
9
  import { ZAxisContextProvider } from '@mui/x-charts/context';
@@ -26,7 +27,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
27
  *
27
28
  * - [ScatterChart API](https://mui.com/x/api/charts/scatter-chart/)
28
29
  */
29
- const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(props, ref) {
30
+ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(inProps, ref) {
31
+ const props = useThemeProps({
32
+ props: inProps,
33
+ name: 'MuiScatterChartPro'
34
+ });
30
35
  const {
31
36
  zoom,
32
37
  onZoomChange
@@ -284,6 +289,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
284
289
  tickSize: PropTypes.number,
285
290
  valueFormatter: PropTypes.func,
286
291
  zoom: PropTypes.oneOfType([PropTypes.shape({
292
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
287
293
  maxEnd: PropTypes.number,
288
294
  maxSpan: PropTypes.number,
289
295
  minSpan: PropTypes.number,
@@ -345,6 +351,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
345
351
  tickSize: PropTypes.number,
346
352
  valueFormatter: PropTypes.func,
347
353
  zoom: PropTypes.oneOfType([PropTypes.shape({
354
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
348
355
  maxEnd: PropTypes.number,
349
356
  maxSpan: PropTypes.number,
350
357
  minSpan: PropTypes.number,
@@ -1,6 +1,8 @@
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
@@ -9,34 +11,68 @@ 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: {
@@ -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,60 @@
1
+ import { getAxisExtremum, isDefined, getScale } from '@mui/x-charts/internals';
2
+ export const createAxisFilterMapper = ({
3
+ zoomData,
4
+ extremumGetter,
5
+ formattedSeries,
6
+ direction
7
+ }) => (axis, axisIndex) => {
8
+ if (typeof axis.zoom !== 'object' || axis.zoom.filterMode !== 'discard') {
9
+ return null;
10
+ }
11
+ const zoom = zoomData?.find(({
12
+ axisId
13
+ }) => axisId === axis.id);
14
+ if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
15
+ // No zoom, or zoom with all data visible
16
+ return null;
17
+ }
18
+ let extremums = [];
19
+ const scaleType = axis.scaleType;
20
+ if (scaleType === 'point' || scaleType === 'band') {
21
+ extremums = [0, (axis.data?.length ?? 1) - 1];
22
+ } else {
23
+ extremums = getAxisExtremum(axis, extremumGetter, axisIndex === 0, formattedSeries);
24
+ }
25
+ let min;
26
+ let max;
27
+
28
+ // @ts-expect-error The function defaults to linear scale if the scaleType is not recognized.
29
+ [min, max] = getScale(scaleType, extremums, [0, 100]).nice().domain();
30
+ min = min instanceof Date ? min.getTime() : min;
31
+ max = max instanceof Date ? max.getTime() : max;
32
+ const minVal = min + zoom.start * (max - min) / 100;
33
+ const maxVal = min + zoom.end * (max - min) / 100;
34
+ return (value, dataIndex) => {
35
+ const val = value[direction] ?? axis.data?.[dataIndex];
36
+ if (val == null) {
37
+ // If the value does not exist because of missing data point, or out of range index, we just ignore.
38
+ return true;
39
+ }
40
+ if (axis.scaleType === 'point' || axis.scaleType === 'band' || typeof val === 'string') {
41
+ return dataIndex >= minVal && dataIndex <= maxVal;
42
+ }
43
+ return val >= minVal && val <= maxVal;
44
+ };
45
+ };
46
+ export const createGetAxisFilters = filters => ({
47
+ currentAxisId,
48
+ seriesXAxisId,
49
+ seriesYAxisId,
50
+ isDefaultAxis
51
+ }) => {
52
+ return (value, dataIndex) => {
53
+ const axisId = currentAxisId === seriesXAxisId ? seriesYAxisId : seriesXAxisId;
54
+ if (!axisId || isDefaultAxis) {
55
+ return Object.values(filters ?? {})[0]?.(value, dataIndex) ?? true;
56
+ }
57
+ const data = [seriesYAxisId, seriesXAxisId].filter(id => id !== currentAxisId).map(id => filters[id ?? '']).filter(isDefined);
58
+ return data.every(f => f(value, dataIndex));
59
+ };
60
+ };
@@ -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.1
2
+ * @mui/x-charts-pro v7.0.0-alpha.3
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 = "MTcyMzc1NTYwMDAwMA==";
3
+ const releaseInfo = "MTcyNDg4MjQwMDAwMA==";
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
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["zoom", "onZoomChange"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useThemeProps } from '@mui/material/styles';
6
7
  import { BarPlot } from '@mui/x-charts/BarChart';
7
8
  import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
8
9
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
@@ -28,7 +29,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
29
  *
29
30
  * - [BarChart API](https://mui.com/x/api/charts/bar-chart/)
30
31
  */
31
- const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(props, ref) {
32
+ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps, ref) {
33
+ const props = useThemeProps({
34
+ props: inProps,
35
+ name: 'MuiBarChartPro'
36
+ });
32
37
  const {
33
38
  zoom,
34
39
  onZoomChange
@@ -178,6 +178,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
178
178
  tickSize: PropTypes.number,
179
179
  valueFormatter: PropTypes.func,
180
180
  zoom: PropTypes.oneOfType([PropTypes.shape({
181
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
181
182
  maxEnd: PropTypes.number,
182
183
  maxSpan: PropTypes.number,
183
184
  minSpan: PropTypes.number,
@@ -239,6 +240,7 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
239
240
  tickSize: PropTypes.number,
240
241
  valueFormatter: PropTypes.func,
241
242
  zoom: PropTypes.oneOfType([PropTypes.shape({
243
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
242
244
  maxEnd: PropTypes.number,
243
245
  maxSpan: PropTypes.number,
244
246
  minSpan: PropTypes.number,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
4
+ import { useThemeProps } from '@mui/material/styles';
5
5
  import useId from '@mui/utils/useId';
6
+ import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
6
7
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
7
8
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
8
9
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
@@ -15,7 +16,11 @@ import { DefaultHeatmapTooltip } from './DefaultHeatmapTooltip';
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
17
18
  const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
18
- const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(props, ref) {
19
+ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
20
+ const props = useThemeProps({
21
+ props: inProps,
22
+ name: 'MuiHeatmap'
23
+ });
19
24
  const {
20
25
  xAxis,
21
26
  yAxis,
@@ -289,6 +294,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
289
294
  tickSize: PropTypes.number,
290
295
  valueFormatter: PropTypes.func,
291
296
  zoom: PropTypes.oneOfType([PropTypes.shape({
297
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
292
298
  maxEnd: PropTypes.number,
293
299
  maxSpan: PropTypes.number,
294
300
  minSpan: PropTypes.number,
@@ -352,6 +358,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
352
358
  tickSize: PropTypes.number,
353
359
  valueFormatter: PropTypes.func,
354
360
  zoom: PropTypes.oneOfType([PropTypes.shape({
361
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
355
362
  maxEnd: PropTypes.number,
356
363
  maxSpan: PropTypes.number,
357
364
  minSpan: PropTypes.number,
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["zoom", "onZoomChange"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useThemeProps } from '@mui/material/styles';
6
7
  import { AreaPlot, LineHighlightPlot, LinePlot, MarkPlot } from '@mui/x-charts/LineChart';
7
8
  import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
8
9
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
@@ -27,7 +28,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
28
  *
28
29
  * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
29
30
  */
30
- const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(props, ref) {
31
+ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps, ref) {
32
+ const props = useThemeProps({
33
+ props: inProps,
34
+ name: 'MuiLineChartPro'
35
+ });
31
36
  const {
32
37
  zoom,
33
38
  onZoomChange
@@ -155,6 +155,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
155
155
  tickSize: PropTypes.number,
156
156
  valueFormatter: PropTypes.func,
157
157
  zoom: PropTypes.oneOfType([PropTypes.shape({
158
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
158
159
  maxEnd: PropTypes.number,
159
160
  maxSpan: PropTypes.number,
160
161
  minSpan: PropTypes.number,
@@ -216,6 +217,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
216
217
  tickSize: PropTypes.number,
217
218
  valueFormatter: PropTypes.func,
218
219
  zoom: PropTypes.oneOfType([PropTypes.shape({
220
+ filterMode: PropTypes.oneOf(['discard', 'keep']),
219
221
  maxEnd: PropTypes.number,
220
222
  maxSpan: PropTypes.number,
221
223
  minSpan: PropTypes.number,