@mui/x-charts 7.0.0 → 7.1.1

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.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,179 @@
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
- ## v7.0.0
6
+ ## 7.1.1
7
+
8
+ _Apr 5, 2024_
9
+
10
+ We'd like to offer a big thanks to the 19 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Add `setItemExpansion` Tree View API method (#12595) @flaviendelangle
13
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-BR), and Spanish (es-ES) locale on the Data Grid
14
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-BR), and Ukrainian (uk-UA) locale on the Pickers
15
+ - 🐞 Bugfixes
16
+ - 📚 Documentation improvements
17
+
18
+ ### Data Grid
19
+
20
+ #### `@mui/x-data-grid@7.1.1`
21
+
22
+ - [DataGrid] Allow higher packages' props to be used in MIT (#12365) @MBilalShafi
23
+ - [DataGrid] Fix RTL mode (#12583) @romgrk
24
+ - [DataGrid] Fix `ColDefChangesGridNoSnap` demo crash (#12663) @MBilalShafi
25
+ - [DataGrid] Fix server-side filter demo not working (#12662) @MBilalShafi
26
+ - [DataGrid] Log error if `rowCount` is used with client-side pagination (#12448) @michelengelen
27
+ - [DataGrid] Remove `GridFormatterParams` completely (#12660) @romgrk
28
+ - [DataGrid] Restore main slot (#12657) @romgrk
29
+ - [l10n] Improve Persian (fa-IR) locale (#12630) @amirhosseinzf
30
+ - [l10n] Improve Portuguese (pt-BR) locale (#12618) @hugoalkimim
31
+ - [l10n] Improve Spanish (es-ES) locale (#12606) @aitor40
32
+
33
+ #### `@mui/x-data-grid-pro@7.1.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
34
+
35
+ Same changes as in `@mui/x-data-grid@7.1.1`.
36
+
37
+ #### `@mui/x-data-grid-premium@7.1.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
38
+
39
+ Same changes as in `@mui/x-data-grid-pro@7.1.1`.
40
+
41
+ ### Date and Time Pickers
42
+
43
+ #### `@mui/x-date-pickers@7.1.1`
44
+
45
+ - [fields] Fix `readOnly` behavior (#12609) @LukasTy
46
+ - [l10n] Improve Persian (fa-IR) locale (#12632) @misafari
47
+ - [l10n] Improve Portuguese (pt-BR) locale (#12613) @cnHealth
48
+ - [l10n] Improve Ukrainian (uk-UA) locale (#12627) @alexkobylansky
49
+
50
+ #### `@mui/x-date-pickers-pro@7.1.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-date-pickers@7.1.1`, plus:
53
+
54
+ - [DateTimeRangePicker] Fix selection on same day (#12604) @LukasTy
55
+
56
+ ### Charts
57
+
58
+ #### `@mui/x-charts@7.1.1`
59
+
60
+ - [charts] Fix `tickInterval` usage for y-axis (#12592) @alexfauquette
61
+ - [charts] Fix Scatter series highlight when `id` is a `number` (#12677) @JCQuintas
62
+ - [charts] Fix TS error when using `sx` property on `ChartsTooltip` (#12659) @JCQuintas
63
+
64
+ ### Tree View
65
+
66
+ #### `@mui/x-tree-view@7.1.1`
67
+
68
+ - [TreeView] Add JSDoc to all `publicAPI` methods (#12649) @flaviendelangle
69
+ - [TreeView] Create `RichTreeViewPro` component (not released yet) (#12610) @flaviendelangle
70
+ - [TreeView] Create pro package (not released yet) (#12240) @flaviendelangle
71
+ - [TreeView] Fix typo in errors (#12623) @alissa-tung
72
+ - [TreeView] New API method: `setItemExpansion` (#12595) @flaviendelangle
73
+
74
+ ### Docs
75
+
76
+ - [docs] Add a recipe for the `checkboxSelectionVisibleOnly` prop (#12646) @michelengelen
77
+ - [docs] Explain the use of `_action: 'delete'` in `processRowUpdate` (#12670) @michelengelen
78
+ - [docs] Fix formatting and typo on migration guide @oliviertassinari
79
+ - [docs] Fix formatting in changelog @oliviertassinari
80
+ - [docs] Fix grammar in TreeView migration doc (#12615) @joshkel
81
+ - [docs] Fix missing closing props in `PieShapeNoSnap` demo (#12636) @alp-ex
82
+ - [docs] Fix type arguments in Custom Field page (#12619) @Juneezee
83
+ - [docs] Fix typo in `getItemId` prop description (#12637) @flaviendelangle
84
+ - [docs] Make the Charts `margin` usage more visible (#12591) @alexfauquette
85
+ - [docs] Match IE 11 spacing with Material UI @oliviertassinari
86
+ - [docs] Move data grid interfaces to standard API page layout (#12016) @alexfauquette
87
+ - [docs] Remove ` around @default values (#12158) @alexfauquette
88
+ - [docs] Remove `day` from the default `dayOfWeekFormatter` function params (#12644) @LukasTy
89
+ - [docs] Use `TreeItem2` for icon expansion example on `RichTreeView` (#12563) @flaviendelangle
90
+
91
+ ### Core
92
+
93
+ - [core] Add cherry-pick `master` to `v6` action (#12648) @LukasTy
94
+ - [core] Fix typo in `@mui/x-tree-view-pro/themeAugmentation` (#12674) @flaviendelangle
95
+ - [core] Introduce `describeTreeView` to run test on `SimpleTreeView` and `RichTreeView`, using `TreeItem` and `TreeItem2` + migrate expansion tests (#12428) @flaviendelangle
96
+ - [core] Limit `test-types` CI step allowed memory (#12651) @LukasTy
97
+ - [core] Remove explicit `express` package (#12602) @LukasTy
98
+ - [core] Update to new embedded translations in the docs package (#12232) @Janpot
99
+ - [core] Use PR labels to identify the package a `l10n` PR belongs to (#12639) @LukasTy
100
+ - [core] Use `describeTreeView` for selection tests (#12647) @flaviendelangle
101
+ - [docs-infra] Adjust the links to search for issues (#11995) @michelengelen
102
+ - [infra] Polish support survey experience (#12624) @oliviertassinari
103
+ - [support-infra] Replace author association with a permission check in survey action (#12068) @michelengelen
104
+ - [support-infra] Fix user permission check (#12669) @michelengelen
105
+ - [test] Fix Tree View test import (#12668) @LukasTy
106
+
107
+ ## 7.1.0
108
+
109
+ _Mar 28, 2024_
110
+
111
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
112
+
113
+ - 🚀 Add `resizeThrottleMs` prop (#12556) @romgrk
114
+ - 🌍 Improve Chinese (Hong Kong) (zh-HK) and Italian (it-IT) locale on the Pickers
115
+ - 🐞 Bugfixes
116
+ - 📚 Documentation improvements
117
+
118
+ ### Data Grid
119
+
120
+ #### `@mui/x-data-grid@7.1.0`
121
+
122
+ - [DataGrid] Add `resizeThrottleMs` prop (#12556) @romgrk
123
+ - [DataGrid] Do not publish `rowEditStop` event if row has fields with errors (#11383) @cherniavskii
124
+ - [DataGrid] Fix bug in suspense (#12553) @romgrk
125
+ - [DataGrid] Fix missing class name in the `GridToolbarQuickFilter` component (#12484) @jhawkins11
126
+
127
+ #### `@mui/x-data-grid-pro@7.1.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
128
+
129
+ Same changes as in `@mui/x-data-grid@7.1.0`.
130
+
131
+ #### `@mui/x-data-grid-premium@7.1.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
132
+
133
+ Same changes as in `@mui/x-data-grid-pro@7.1.0`.
134
+
135
+ ### Date and Time Pickers
136
+
137
+ #### `@mui/x-date-pickers@7.1.0`
138
+
139
+ - [fields] Fix placeholder override (#12589) @flaviendelangle
140
+ - [l10n] Improve Chinese (Hong Kong) (zh-HK) locale (#12547) @samchiu90
141
+ - [l10n] Improve Italian (it-IT) locale (#12549) @antomanc
142
+ - [pickers] Prepare compatibility with `@mui/zero-runtime` (stop using `ownerState` in `styled`) (#12003) @flaviendelangle
143
+
144
+ #### `@mui/x-date-pickers-pro@7.1.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
145
+
146
+ Same changes as in `@mui/x-date-pickers@7.1.0`, plus:
147
+
148
+ - [DateRangePicker] Fix selection behavior with single input field when `readOnly` (#12593) @LukasTy
149
+
150
+ ### Charts
151
+
152
+ #### `@mui/x-charts@7.1.0`
153
+
154
+ - [charts] Fix tooltip causing crash on data change (#12571) @Rishi556
155
+
156
+ ### Tree View
157
+
158
+ #### `@mui/x-tree-view@7.1.0`
159
+
160
+ - [TreeView] Do not use outdated version of the state to compute new label first char in `RichTreeView` (#12512) @flaviendelangle
161
+
162
+ ### Docs
163
+
164
+ - [docs] Add example to add a second icon next to the field's opening button (#12524) @flaviendelangle
165
+ - [docs] Add missing note to Data Grid migration guide (#12557) @romgrk
166
+ - [docs] Fix Charts title for SEO (#12545) @oliviertassinari
167
+ - [docs] Fix small typo (#12558) @diogoparente
168
+ - [docs] Improve codemod related documentation (#12582) @MBilalShafi
169
+ - [docs] Reduce noise in migration docs side navigation (#12552) @cherniavskii
170
+ - [docs] Sync static images from core repository (#12525) @LukasTy
171
+
172
+ ### Core
173
+
174
+ - [core] Fix `l10n` script on Windows (#12550) @LukasTy
175
+ - [core] Include `DateTimeRangePicker` tag in `releaseChangelog` (#12526) @LukasTy
176
+ - [core] Upgrade monorepo (#12536) @cherniavskii
177
+
178
+ ## 7.0.0
7
179
 
8
180
  _Mar 22, 2024_
9
181
 
@@ -459,13 +631,13 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
459
631
 
460
632
  - 🎁 Introduce a new DOM structure for the field components that provides a better accessibility
461
633
  - 🚀 Simplify Data Grid DOM structure for improved performance (#12013) @romgrk
462
- - 🕥 The support for IE11 has been removed (#12151) @flaviendelangle
634
+ - 🕥 The support for IE 11 has been removed (#12151) @flaviendelangle
463
635
  - 🐞 Bugfixes
464
636
  - 📚 Documentation improvements
465
637
 
466
638
  ### Breaking changes
467
639
 
468
- - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
640
+ - The support for IE 11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE 11 is no longer included.
469
641
 
470
642
  ### Data Grid
471
643
 
@@ -570,7 +742,7 @@ These components are no longer exported from `@mui/x-charts`:
570
742
 
571
743
  ### Tree View / `@mui/x-tree-view@7.0.0-beta.4`
572
744
 
573
- - [TreeView] Stop using custom `findIndex` to support IE11 (#12129) @flaviendelangle
745
+ - [TreeView] Stop using custom `findIndex` to support IE 11 (#12129) @flaviendelangle
574
746
 
575
747
  ### Docs
576
748
 
@@ -2800,6 +2972,76 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
2800
2972
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
2801
2973
  - [license] Correctly throw errors (#10924) @oliviertassinari
2802
2974
 
2975
+ ## 6.19.9
2976
+
2977
+ _Apr 5, 2024_
2978
+
2979
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
2980
+
2981
+ - 🐞 Bugfixes
2982
+ - 📚 Documentation improvements
2983
+
2984
+ ### Data Grid
2985
+
2986
+ #### `@mui/x-data-grid@6.19.9`
2987
+
2988
+ - [DataGrid] Remove legacy editing API event: `rowEditCommit` (#12087) @MBilalShafi
2989
+
2990
+ #### `@mui/x-data-grid-pro@6.19.9` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
2991
+
2992
+ Same changes as in `@mui/x-data-grid@6.19.9`.
2993
+
2994
+ #### `@mui/x-data-grid-premium@6.19.9` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
2995
+
2996
+ Same changes as in `@mui/x-data-grid-pro@6.19.9`.
2997
+
2998
+ ### Date Pickers
2999
+
3000
+ #### `@mui/x-date-pickers@6.19.9`
3001
+
3002
+ No changes.
3003
+
3004
+ #### `@mui/x-date-pickers-pro@6.19.9` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3005
+
3006
+ - [DateRangePicker] Fix selection behavior with single input field when `readOnly` (#12605) @LukasTy
3007
+
3008
+ ### Docs
3009
+
3010
+ - [docs] Add a recipe for the `checkboxSelectionVisibleOnly` prop (#12667) @michelengelen
3011
+ - [docs] Explain the use of `_action: 'delete'` in `processRowUpdate` (#12673) @michelengelen
3012
+
3013
+ ### Core
3014
+
3015
+ - [core] Use Circle CI context (#12607) @cherniavskii
3016
+
3017
+ ## 6.19.8
3018
+
3019
+ _Mar 20, 2024_
3020
+
3021
+ We'd like to offer a big thanks to the 3 contributors who made this release possible.
3022
+
3023
+ ### Data Grid
3024
+
3025
+ #### `@mui/x-data-grid@6.19.8`
3026
+
3027
+ - [DataGrid] Fix `ElementType` usage (#12505) @cherniavskii
3028
+ - [DataGrid] Fix cell value formatting on copy (#12483) @sai6855
3029
+ - [DataGrid] Fix checkbox selection when filtering (#12485) @g1mishra
3030
+
3031
+ #### `@mui/x-data-grid-pro@6.19.8` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3032
+
3033
+ Same changes as in `@mui/x-data-grid@6.19.8`.
3034
+
3035
+ #### `@mui/x-data-grid-premium@6.19.8` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
3036
+
3037
+ Same changes as in `@mui/x-data-grid-pro@6.19.8`, plus:
3038
+
3039
+ - [DataGridPremium] Add support for confirmation before clipboard paste (#12466) @cherniavskii
3040
+
3041
+ ### Docs
3042
+
3043
+ - [docs] Update links to v7 (#12495) @cherniavskii
3044
+
2803
3045
  ## 6.19.7
2804
3046
 
2805
3047
  _Mar 14, 2024_
@@ -1,9 +1,16 @@
1
1
  import * as React from 'react';
2
- import { PopperProps } from '@mui/base/Popper';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ import { PopperProps as BasePopperProps } from '@mui/base/Popper';
3
4
  import { TriggerOptions } from './utils';
4
5
  import { ChartsItemContentProps } from './ChartsItemTooltipContent';
5
6
  import { ChartsAxisContentProps } from './ChartsAxisTooltipContent';
6
7
  import { ChartsTooltipClasses } from './chartsTooltipClasses';
8
+ export type PopperProps = BasePopperProps & {
9
+ /**
10
+ * The system prop that allows defining system overrides as well as additional CSS styles.
11
+ */
12
+ sx?: SxProps<Theme>;
13
+ };
7
14
  export interface ChartsTooltipSlots {
8
15
  /**
9
16
  * Custom component for the tooltip popper.
@@ -19,7 +19,7 @@ function DefaultChartsItemTooltipContent(props) {
19
19
  sx,
20
20
  classes
21
21
  } = props;
22
- if (itemData.dataIndex === undefined) {
22
+ if (itemData.dataIndex === undefined || !series.data[itemData.dataIndex]) {
23
23
  return null;
24
24
  }
25
25
  const {
@@ -8,8 +8,8 @@ export type ChartsVoronoiHandlerProps = {
8
8
  voronoiMaxRadius?: number | undefined;
9
9
  /**
10
10
  * Callback fired when clicking on a scatter item.
11
- * @param {MouseEvent} event Mouse event catched at the svg level
12
- * @param {ScatterItemIdentifier} scatterItemIdentifier Identify whihc item got clicked
11
+ * @param {MouseEvent} event Mouse event caught at the svg level
12
+ * @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
13
13
  */
14
14
  onItemClick?: (event: MouseEvent, scatterItemIdentifier: ScatterItemIdentifier) => void;
15
15
  };
@@ -44,6 +44,7 @@ function ChartsVoronoiHandler(props) {
44
44
  seriesOrder
45
45
  } = React.useContext(_SeriesContextProvider.SeriesContext).scatter ?? {};
46
46
  const voronoiRef = React.useRef({});
47
+ const delauneyRef = React.useRef(undefined);
47
48
  const defaultXAxisId = xAxisIds[0];
48
49
  const defaultYAxisId = yAxisIds[0];
49
50
  (0, _useEnhancedEffect.default)(() => {
@@ -82,12 +83,13 @@ function ChartsVoronoiHandler(props) {
82
83
  y
83
84
  }) => [getXPosition(x), getYPosition(y)]);
84
85
  voronoiRef.current[seriesId] = {
86
+ seriesId,
85
87
  startIndex: points.length,
86
88
  endIndex: points.length + seriesPoints.length
87
89
  };
88
90
  points = points.concat(seriesPoints);
89
91
  });
90
- voronoiRef.current.delauney = new _d3Delaunay.Delaunay(points);
92
+ delauneyRef.current = new _d3Delaunay.Delaunay(points);
91
93
  }, [defaultXAxisId, defaultYAxisId, series, seriesOrder, xAxis, yAxis]);
92
94
  React.useEffect(() => {
93
95
  const element = svgRef.current;
@@ -95,7 +97,7 @@ function ChartsVoronoiHandler(props) {
95
97
  return undefined;
96
98
  }
97
99
 
98
- // TODO: A perf optimisation of voronoi could be to use the last point as the intial point for the next search.
100
+ // TODO: A perf optimisation of voronoi could be to use the last point as the initial point for the next search.
99
101
  function getClosestPoint(event) {
100
102
  // Get mouse coordinate in global SVG space
101
103
  const svgPoint = (0, _utils.getSVGPoint)(svgRef.current, event);
@@ -104,26 +106,23 @@ function ChartsVoronoiHandler(props) {
104
106
  if (outsideX || outsideY) {
105
107
  return 'outside-chart';
106
108
  }
107
- if (!voronoiRef.current.delauney) {
109
+ if (!delauneyRef.current) {
108
110
  return 'no-point-found';
109
111
  }
110
- const closestPointIndex = voronoiRef.current.delauney?.find(svgPoint.x, svgPoint.y);
112
+ const closestPointIndex = delauneyRef.current.find(svgPoint.x, svgPoint.y);
111
113
  if (closestPointIndex === undefined) {
112
114
  return 'no-point-found';
113
115
  }
114
- const seriesId = Object.keys(voronoiRef.current).find(id => {
115
- if (id === 'delauney') {
116
- return false;
117
- }
118
- return 2 * closestPointIndex >= voronoiRef.current[id].startIndex && 2 * closestPointIndex < voronoiRef.current[id].endIndex;
116
+ const closestSeries = Object.values(voronoiRef.current).find(value => {
117
+ return 2 * closestPointIndex >= value.startIndex && 2 * closestPointIndex < value.endIndex;
119
118
  });
120
- if (seriesId === undefined) {
119
+ if (closestSeries === undefined) {
121
120
  return 'no-point-found';
122
121
  }
123
- const dataIndex = (2 * closestPointIndex - voronoiRef.current[seriesId].startIndex) / 2;
122
+ const dataIndex = (2 * closestPointIndex - voronoiRef.current[closestSeries.seriesId].startIndex) / 2;
124
123
  if (voronoiMaxRadius !== undefined) {
125
- const pointX = voronoiRef.current.delauney.points[2 * closestPointIndex];
126
- const pointY = voronoiRef.current.delauney.points[2 * closestPointIndex + 1];
124
+ const pointX = delauneyRef.current.points[2 * closestPointIndex];
125
+ const pointY = delauneyRef.current.points[2 * closestPointIndex + 1];
127
126
  const dist2 = (pointX - svgPoint.x) ** 2 + (pointY - svgPoint.y) ** 2;
128
127
  if (dist2 > voronoiMaxRadius ** 2) {
129
128
  // The closest point is too far to be considered.
@@ -131,7 +130,7 @@ function ChartsVoronoiHandler(props) {
131
130
  }
132
131
  }
133
132
  return {
134
- seriesId,
133
+ seriesId: closestSeries.seriesId,
135
134
  dataIndex
136
135
  };
137
136
  }
@@ -209,8 +208,8 @@ process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
209
208
  // ----------------------------------------------------------------------
210
209
  /**
211
210
  * Callback fired when clicking on a scatter item.
212
- * @param {MouseEvent} event Mouse event catched at the svg level
213
- * @param {ScatterItemIdentifier} scatterItemIdentifier Identify whihc item got clicked
211
+ * @param {MouseEvent} event Mouse event caught at the svg level
212
+ * @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
214
213
  */
215
214
  onItemClick: _propTypes.default.func,
216
215
  /**
@@ -89,7 +89,8 @@ function ChartsYAxis(inProps) {
89
89
  slots,
90
90
  slotProps,
91
91
  tickPlacement,
92
- tickLabelPlacement
92
+ tickLabelPlacement,
93
+ tickInterval
93
94
  } = defaultizedProps;
94
95
  const theme = (0, _styles.useTheme)();
95
96
  const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
@@ -107,7 +108,8 @@ function ChartsYAxis(inProps) {
107
108
  tickNumber,
108
109
  valueFormatter,
109
110
  tickPlacement,
110
- tickLabelPlacement
111
+ tickLabelPlacement,
112
+ tickInterval
111
113
  });
112
114
  const positionSign = position === 'right' ? 1 : -1;
113
115
  const labelRefPoint = {
@@ -11,7 +11,7 @@ function DefaultChartsItemTooltipContent(props) {
11
11
  sx,
12
12
  classes
13
13
  } = props;
14
- if (itemData.dataIndex === undefined) {
14
+ if (itemData.dataIndex === undefined || !series.data[itemData.dataIndex]) {
15
15
  return null;
16
16
  }
17
17
  const {
@@ -35,6 +35,7 @@ function ChartsVoronoiHandler(props) {
35
35
  seriesOrder
36
36
  } = React.useContext(SeriesContext).scatter ?? {};
37
37
  const voronoiRef = React.useRef({});
38
+ const delauneyRef = React.useRef(undefined);
38
39
  const defaultXAxisId = xAxisIds[0];
39
40
  const defaultYAxisId = yAxisIds[0];
40
41
  useEnhancedEffect(() => {
@@ -73,12 +74,13 @@ function ChartsVoronoiHandler(props) {
73
74
  y
74
75
  }) => [getXPosition(x), getYPosition(y)]);
75
76
  voronoiRef.current[seriesId] = {
77
+ seriesId,
76
78
  startIndex: points.length,
77
79
  endIndex: points.length + seriesPoints.length
78
80
  };
79
81
  points = points.concat(seriesPoints);
80
82
  });
81
- voronoiRef.current.delauney = new Delaunay(points);
83
+ delauneyRef.current = new Delaunay(points);
82
84
  }, [defaultXAxisId, defaultYAxisId, series, seriesOrder, xAxis, yAxis]);
83
85
  React.useEffect(() => {
84
86
  const element = svgRef.current;
@@ -86,7 +88,7 @@ function ChartsVoronoiHandler(props) {
86
88
  return undefined;
87
89
  }
88
90
 
89
- // TODO: A perf optimisation of voronoi could be to use the last point as the intial point for the next search.
91
+ // TODO: A perf optimisation of voronoi could be to use the last point as the initial point for the next search.
90
92
  function getClosestPoint(event) {
91
93
  // Get mouse coordinate in global SVG space
92
94
  const svgPoint = getSVGPoint(svgRef.current, event);
@@ -95,26 +97,23 @@ function ChartsVoronoiHandler(props) {
95
97
  if (outsideX || outsideY) {
96
98
  return 'outside-chart';
97
99
  }
98
- if (!voronoiRef.current.delauney) {
100
+ if (!delauneyRef.current) {
99
101
  return 'no-point-found';
100
102
  }
101
- const closestPointIndex = voronoiRef.current.delauney?.find(svgPoint.x, svgPoint.y);
103
+ const closestPointIndex = delauneyRef.current.find(svgPoint.x, svgPoint.y);
102
104
  if (closestPointIndex === undefined) {
103
105
  return 'no-point-found';
104
106
  }
105
- const seriesId = Object.keys(voronoiRef.current).find(id => {
106
- if (id === 'delauney') {
107
- return false;
108
- }
109
- return 2 * closestPointIndex >= voronoiRef.current[id].startIndex && 2 * closestPointIndex < voronoiRef.current[id].endIndex;
107
+ const closestSeries = Object.values(voronoiRef.current).find(value => {
108
+ return 2 * closestPointIndex >= value.startIndex && 2 * closestPointIndex < value.endIndex;
110
109
  });
111
- if (seriesId === undefined) {
110
+ if (closestSeries === undefined) {
112
111
  return 'no-point-found';
113
112
  }
114
- const dataIndex = (2 * closestPointIndex - voronoiRef.current[seriesId].startIndex) / 2;
113
+ const dataIndex = (2 * closestPointIndex - voronoiRef.current[closestSeries.seriesId].startIndex) / 2;
115
114
  if (voronoiMaxRadius !== undefined) {
116
- const pointX = voronoiRef.current.delauney.points[2 * closestPointIndex];
117
- const pointY = voronoiRef.current.delauney.points[2 * closestPointIndex + 1];
115
+ const pointX = delauneyRef.current.points[2 * closestPointIndex];
116
+ const pointY = delauneyRef.current.points[2 * closestPointIndex + 1];
118
117
  const dist2 = (pointX - svgPoint.x) ** 2 + (pointY - svgPoint.y) ** 2;
119
118
  if (dist2 > voronoiMaxRadius ** 2) {
120
119
  // The closest point is too far to be considered.
@@ -122,7 +121,7 @@ function ChartsVoronoiHandler(props) {
122
121
  }
123
122
  }
124
123
  return {
125
- seriesId,
124
+ seriesId: closestSeries.seriesId,
126
125
  dataIndex
127
126
  };
128
127
  }
@@ -200,8 +199,8 @@ process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
200
199
  // ----------------------------------------------------------------------
201
200
  /**
202
201
  * Callback fired when clicking on a scatter item.
203
- * @param {MouseEvent} event Mouse event catched at the svg level
204
- * @param {ScatterItemIdentifier} scatterItemIdentifier Identify whihc item got clicked
202
+ * @param {MouseEvent} event Mouse event caught at the svg level
203
+ * @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
205
204
  */
206
205
  onItemClick: PropTypes.func,
207
206
  /**
@@ -81,7 +81,8 @@ function ChartsYAxis(inProps) {
81
81
  slots,
82
82
  slotProps,
83
83
  tickPlacement,
84
- tickLabelPlacement
84
+ tickLabelPlacement,
85
+ tickInterval
85
86
  } = defaultizedProps;
86
87
  const theme = useTheme();
87
88
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -99,7 +100,8 @@ function ChartsYAxis(inProps) {
99
100
  tickNumber,
100
101
  valueFormatter,
101
102
  tickPlacement,
102
- tickLabelPlacement
103
+ tickLabelPlacement,
104
+ tickInterval
103
105
  });
104
106
  const positionSign = position === 'right' ? 1 : -1;
105
107
  const labelRefPoint = {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0
2
+ * @mui/x-charts v7.1.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,7 +11,7 @@ function DefaultChartsItemTooltipContent(props) {
11
11
  sx,
12
12
  classes
13
13
  } = props;
14
- if (itemData.dataIndex === undefined) {
14
+ if (itemData.dataIndex === undefined || !series.data[itemData.dataIndex]) {
15
15
  return null;
16
16
  }
17
17
  const {
@@ -35,6 +35,7 @@ function ChartsVoronoiHandler(props) {
35
35
  seriesOrder
36
36
  } = React.useContext(SeriesContext).scatter ?? {};
37
37
  const voronoiRef = React.useRef({});
38
+ const delauneyRef = React.useRef(undefined);
38
39
  const defaultXAxisId = xAxisIds[0];
39
40
  const defaultYAxisId = yAxisIds[0];
40
41
  useEnhancedEffect(() => {
@@ -73,12 +74,13 @@ function ChartsVoronoiHandler(props) {
73
74
  y
74
75
  }) => [getXPosition(x), getYPosition(y)]);
75
76
  voronoiRef.current[seriesId] = {
77
+ seriesId,
76
78
  startIndex: points.length,
77
79
  endIndex: points.length + seriesPoints.length
78
80
  };
79
81
  points = points.concat(seriesPoints);
80
82
  });
81
- voronoiRef.current.delauney = new Delaunay(points);
83
+ delauneyRef.current = new Delaunay(points);
82
84
  }, [defaultXAxisId, defaultYAxisId, series, seriesOrder, xAxis, yAxis]);
83
85
  React.useEffect(() => {
84
86
  const element = svgRef.current;
@@ -86,7 +88,7 @@ function ChartsVoronoiHandler(props) {
86
88
  return undefined;
87
89
  }
88
90
 
89
- // TODO: A perf optimisation of voronoi could be to use the last point as the intial point for the next search.
91
+ // TODO: A perf optimisation of voronoi could be to use the last point as the initial point for the next search.
90
92
  function getClosestPoint(event) {
91
93
  // Get mouse coordinate in global SVG space
92
94
  const svgPoint = getSVGPoint(svgRef.current, event);
@@ -95,26 +97,23 @@ function ChartsVoronoiHandler(props) {
95
97
  if (outsideX || outsideY) {
96
98
  return 'outside-chart';
97
99
  }
98
- if (!voronoiRef.current.delauney) {
100
+ if (!delauneyRef.current) {
99
101
  return 'no-point-found';
100
102
  }
101
- const closestPointIndex = voronoiRef.current.delauney?.find(svgPoint.x, svgPoint.y);
103
+ const closestPointIndex = delauneyRef.current.find(svgPoint.x, svgPoint.y);
102
104
  if (closestPointIndex === undefined) {
103
105
  return 'no-point-found';
104
106
  }
105
- const seriesId = Object.keys(voronoiRef.current).find(id => {
106
- if (id === 'delauney') {
107
- return false;
108
- }
109
- return 2 * closestPointIndex >= voronoiRef.current[id].startIndex && 2 * closestPointIndex < voronoiRef.current[id].endIndex;
107
+ const closestSeries = Object.values(voronoiRef.current).find(value => {
108
+ return 2 * closestPointIndex >= value.startIndex && 2 * closestPointIndex < value.endIndex;
110
109
  });
111
- if (seriesId === undefined) {
110
+ if (closestSeries === undefined) {
112
111
  return 'no-point-found';
113
112
  }
114
- const dataIndex = (2 * closestPointIndex - voronoiRef.current[seriesId].startIndex) / 2;
113
+ const dataIndex = (2 * closestPointIndex - voronoiRef.current[closestSeries.seriesId].startIndex) / 2;
115
114
  if (voronoiMaxRadius !== undefined) {
116
- const pointX = voronoiRef.current.delauney.points[2 * closestPointIndex];
117
- const pointY = voronoiRef.current.delauney.points[2 * closestPointIndex + 1];
115
+ const pointX = delauneyRef.current.points[2 * closestPointIndex];
116
+ const pointY = delauneyRef.current.points[2 * closestPointIndex + 1];
118
117
  const dist2 = (pointX - svgPoint.x) ** 2 + (pointY - svgPoint.y) ** 2;
119
118
  if (dist2 > voronoiMaxRadius ** 2) {
120
119
  // The closest point is too far to be considered.
@@ -122,7 +121,7 @@ function ChartsVoronoiHandler(props) {
122
121
  }
123
122
  }
124
123
  return {
125
- seriesId,
124
+ seriesId: closestSeries.seriesId,
126
125
  dataIndex
127
126
  };
128
127
  }
@@ -200,8 +199,8 @@ process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
200
199
  // ----------------------------------------------------------------------
201
200
  /**
202
201
  * Callback fired when clicking on a scatter item.
203
- * @param {MouseEvent} event Mouse event catched at the svg level
204
- * @param {ScatterItemIdentifier} scatterItemIdentifier Identify whihc item got clicked
202
+ * @param {MouseEvent} event Mouse event caught at the svg level
203
+ * @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
205
204
  */
206
205
  onItemClick: PropTypes.func,
207
206
  /**
@@ -81,7 +81,8 @@ function ChartsYAxis(inProps) {
81
81
  slots,
82
82
  slotProps,
83
83
  tickPlacement,
84
- tickLabelPlacement
84
+ tickLabelPlacement,
85
+ tickInterval
85
86
  } = defaultizedProps;
86
87
  const theme = useTheme();
87
88
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -99,7 +100,8 @@ function ChartsYAxis(inProps) {
99
100
  tickNumber,
100
101
  valueFormatter,
101
102
  tickPlacement,
102
- tickLabelPlacement
103
+ tickLabelPlacement,
104
+ tickInterval
103
105
  });
104
106
  const positionSign = position === 'right' ? 1 : -1;
105
107
  const labelRefPoint = {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0
2
+ * @mui/x-charts v7.1.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.0.0",
4
- "description": "The community edition of the charts components (MUI X).",
3
+ "version": "7.1.1",
4
+ "description": "The community edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
7
7
  "license": "MIT",