@mui/x-charts 9.0.3 → 9.0.4
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/BarChart/FocusedBar.js +3 -0
- package/BarChart/FocusedBar.mjs +3 -0
- package/CHANGELOG.md +87 -0
- package/ChartsTooltip/useAxesTooltip.js +11 -3
- package/ChartsTooltip/useAxesTooltip.mjs +11 -3
- package/LineChart/FocusedLineMark.js +3 -0
- package/LineChart/FocusedLineMark.mjs +3 -0
- package/LineChart/seriesConfig/getItemAtPosition.js +12 -35
- package/LineChart/seriesConfig/getItemAtPosition.mjs +10 -33
- package/PieChart/FocusedPieArc.js +3 -0
- package/PieChart/FocusedPieArc.mjs +3 -0
- package/RadarChart/FocusedRadarMark.js +3 -0
- package/RadarChart/FocusedRadarMark.mjs +3 -0
- package/ScatterChart/FocusedScatterMark.js +3 -0
- package/ScatterChart/FocusedScatterMark.mjs +3 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/commonNextFocusItem.js +62 -8
- package/internals/commonNextFocusItem.mjs +62 -8
- package/internals/findClosestIndex.d.mts +5 -0
- package/internals/findClosestIndex.d.ts +5 -0
- package/internals/findClosestIndex.js +27 -0
- package/internals/findClosestIndex.mjs +22 -0
- package/internals/getAsNumber.d.mts +1 -0
- package/internals/getAsNumber.d.ts +1 -0
- package/internals/getAsNumber.js +9 -0
- package/internals/getAsNumber.mjs +3 -0
- package/internals/index.d.mts +1 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +12 -0
- package/internals/index.mjs +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +4 -21
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs +4 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.mts +30 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.ts +30 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.js +57 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs +51 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +7 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.mjs +7 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +7 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.mjs +7 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +9 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +9 -3
- package/package.json +143 -143
package/BarChart/FocusedBar.js
CHANGED
|
@@ -30,6 +30,9 @@ function FocusedBar(props) {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
const series = barSeries.series[focusedItem.seriesId];
|
|
33
|
+
if (!series || series.hidden) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
33
36
|
if (series.data[focusedItem.dataIndex] == null) {
|
|
34
37
|
// Handle missing data
|
|
35
38
|
return null;
|
package/BarChart/FocusedBar.mjs
CHANGED
|
@@ -23,6 +23,9 @@ export function FocusedBar(props) {
|
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
25
|
const series = barSeries.series[focusedItem.seriesId];
|
|
26
|
+
if (!series || series.hidden) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
26
29
|
if (series.data[focusedItem.dataIndex] == null) {
|
|
27
30
|
// Handle missing data
|
|
28
31
|
return null;
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.0.4
|
|
4
|
+
|
|
5
|
+
_Apr 28, 2026_
|
|
6
|
+
|
|
7
|
+
We'd like to extend a big thank you to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
8
|
+
|
|
9
|
+
- Fix Pickers previous (v9.0.3) release ensuring the latest `@mui/x-internals` version usage
|
|
10
|
+
|
|
11
|
+
The following team members contributed to this release:
|
|
12
|
+
@alexfauquette, @JCQuintas, @LukasTy, @mj12albert
|
|
13
|
+
|
|
14
|
+
### Data Grid
|
|
15
|
+
|
|
16
|
+
#### `@mui/x-data-grid@9.0.4`
|
|
17
|
+
|
|
18
|
+
Internal changes.
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid-pro@9.0.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
21
|
+
|
|
22
|
+
Same changes as in `@mui/x-data-grid@9.0.4`.
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid-premium@9.0.4` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
25
|
+
|
|
26
|
+
Same changes as in `@mui/x-data-grid-pro@9.0.4`.
|
|
27
|
+
|
|
28
|
+
### Date and Time Pickers
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-date-pickers@9.0.4`
|
|
31
|
+
|
|
32
|
+
Internal changes.
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-date-pickers-pro@9.0.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-date-pickers@9.0.4`.
|
|
37
|
+
|
|
38
|
+
### Charts
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-charts@9.0.4`
|
|
41
|
+
|
|
42
|
+
- [charts] Exclude hidden series and items from keyboard navigation (alt approach) (#22221) @JCQuintas
|
|
43
|
+
- [charts] Fix line interaction with `area` and `conectNulls` (#22227) @alexfauquette
|
|
44
|
+
- [charts] Implement the continuous case of `getAxisIndex` for rotation axis (#22230) @alexfauquette
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-charts-pro@9.0.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
47
|
+
|
|
48
|
+
Same changes as in `@mui/x-charts@9.0.4`.
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-charts-premium@9.0.4` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
51
|
+
|
|
52
|
+
Same changes as in `@mui/x-charts-pro@9.0.4` plus:
|
|
53
|
+
|
|
54
|
+
- [charts-premium] Add `showMark` and `shape` properties to radial line (#22226) @alexfauquette
|
|
55
|
+
|
|
56
|
+
### Tree View
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-tree-view@9.0.4`
|
|
59
|
+
|
|
60
|
+
Internal changes.
|
|
61
|
+
|
|
62
|
+
#### `@mui/x-tree-view-pro@9.0.4` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
63
|
+
|
|
64
|
+
Same changes as in `@mui/x-tree-view@9.0.4`.
|
|
65
|
+
|
|
66
|
+
### Scheduler
|
|
67
|
+
|
|
68
|
+
#### `@mui/x-scheduler@9.0.4`
|
|
69
|
+
|
|
70
|
+
Internal changes.
|
|
71
|
+
|
|
72
|
+
#### `@mui/x-scheduler-premium@9.0.4` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
73
|
+
|
|
74
|
+
Same changes as in `@mui/x-scheduler@9.0.4`.
|
|
75
|
+
|
|
76
|
+
### Codemod
|
|
77
|
+
|
|
78
|
+
#### `@mui/x-codemod@9.0.4`
|
|
79
|
+
|
|
80
|
+
Internal changes.
|
|
81
|
+
|
|
82
|
+
### Docs
|
|
83
|
+
|
|
84
|
+
- [docs] Update WCAG links (#22234) @mj12albert
|
|
85
|
+
|
|
86
|
+
### Core
|
|
87
|
+
|
|
88
|
+
- [code-infra] Avoid overriding `renovate` `ignoredPaths` (#22228) @LukasTy
|
|
89
|
+
|
|
3
90
|
## 9.0.3
|
|
4
91
|
|
|
5
92
|
_Apr 27, 2026_
|
|
@@ -34,7 +34,15 @@ function defaultAxisTooltipConfig(axis, dataIndex, axisDirection) {
|
|
|
34
34
|
seriesItems: []
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
function getSeriesMark(series) {
|
|
38
|
+
if (!('showMark' in series) || !series.showMark) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
if ('shape' in series && series.shape) {
|
|
42
|
+
return series.shape;
|
|
43
|
+
}
|
|
44
|
+
return 'circle';
|
|
45
|
+
}
|
|
38
46
|
/**
|
|
39
47
|
* Returns the axes to display in the tooltip and the series item related to them.
|
|
40
48
|
*/
|
|
@@ -169,7 +177,7 @@ function useAxesTooltip(params) {
|
|
|
169
177
|
formattedValue,
|
|
170
178
|
formattedLabel,
|
|
171
179
|
markType: seriesToAdd.labelMarkType,
|
|
172
|
-
markShape:
|
|
180
|
+
markShape: getSeriesMark(seriesToAdd)
|
|
173
181
|
});
|
|
174
182
|
}
|
|
175
183
|
});
|
|
@@ -213,7 +221,7 @@ function useAxesTooltip(params) {
|
|
|
213
221
|
formattedValue,
|
|
214
222
|
formattedLabel,
|
|
215
223
|
markType: seriesToAdd.labelMarkType,
|
|
216
|
-
markShape:
|
|
224
|
+
markShape: getSeriesMark(seriesToAdd)
|
|
217
225
|
});
|
|
218
226
|
}
|
|
219
227
|
});
|
|
@@ -29,7 +29,15 @@ function defaultAxisTooltipConfig(axis, dataIndex, axisDirection) {
|
|
|
29
29
|
seriesItems: []
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
function getSeriesMark(series) {
|
|
33
|
+
if (!('showMark' in series) || !series.showMark) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if ('shape' in series && series.shape) {
|
|
37
|
+
return series.shape;
|
|
38
|
+
}
|
|
39
|
+
return 'circle';
|
|
40
|
+
}
|
|
33
41
|
/**
|
|
34
42
|
* Returns the axes to display in the tooltip and the series item related to them.
|
|
35
43
|
*/
|
|
@@ -164,7 +172,7 @@ export function useAxesTooltip(params) {
|
|
|
164
172
|
formattedValue,
|
|
165
173
|
formattedLabel,
|
|
166
174
|
markType: seriesToAdd.labelMarkType,
|
|
167
|
-
markShape:
|
|
175
|
+
markShape: getSeriesMark(seriesToAdd)
|
|
168
176
|
});
|
|
169
177
|
}
|
|
170
178
|
});
|
|
@@ -208,7 +216,7 @@ export function useAxesTooltip(params) {
|
|
|
208
216
|
formattedValue,
|
|
209
217
|
formattedLabel,
|
|
210
218
|
markType: seriesToAdd.labelMarkType,
|
|
211
|
-
markShape:
|
|
219
|
+
markShape: getSeriesMark(seriesToAdd)
|
|
212
220
|
});
|
|
213
221
|
}
|
|
214
222
|
});
|
|
@@ -26,6 +26,9 @@ function FocusedLineMark() {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
const series = lineSeries.series[focusedItem.seriesId];
|
|
29
|
+
if (!series || series.hidden) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
29
32
|
if (series.data[focusedItem.dataIndex] == null) {
|
|
30
33
|
// Handle missing data
|
|
31
34
|
return null;
|
|
@@ -21,6 +21,9 @@ export function FocusedLineMark() {
|
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
const series = lineSeries.series[focusedItem.seriesId];
|
|
24
|
+
if (!series || series.hidden) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
24
27
|
if (series.data[focusedItem.dataIndex] == null) {
|
|
25
28
|
// Handle missing data
|
|
26
29
|
return null;
|
|
@@ -8,6 +8,7 @@ var _useChartCartesianAxisRendering = require("../../internals/plugins/featurePl
|
|
|
8
8
|
var _seriesSelectorOfType = require("../../internals/seriesSelectorOfType");
|
|
9
9
|
var _getAxisValue = require("../../internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue");
|
|
10
10
|
var _scaleGuards = require("../../internals/scaleGuards");
|
|
11
|
+
var _getAsNumber = require("../../internals/getAsNumber");
|
|
11
12
|
var _getValueToPositionMapper = require("../../hooks/getValueToPositionMapper");
|
|
12
13
|
var _curveEvaluation = require("./curveEvaluation");
|
|
13
14
|
/**
|
|
@@ -43,13 +44,12 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
43
44
|
|
|
44
45
|
// For continuous axes, find the two adjacent data points surrounding pointX.
|
|
45
46
|
const xValue = scale.invert(pointX);
|
|
46
|
-
const xAsNumber =
|
|
47
|
-
const getAsNumber = v => v instanceof Date ? v.getTime() : v;
|
|
47
|
+
const xAsNumber = (0, _getAsNumber.getAsNumber)(xValue);
|
|
48
48
|
|
|
49
49
|
// Find the rightmost index where data[i] <= xValue.
|
|
50
50
|
let leftIndex = -1;
|
|
51
51
|
for (let i = 0; i < axisData.length; i += 1) {
|
|
52
|
-
if (getAsNumber(axisData[i]) <= xAsNumber) {
|
|
52
|
+
if ((0, _getAsNumber.getAsNumber)(axisData[i]) <= xAsNumber) {
|
|
53
53
|
leftIndex = i;
|
|
54
54
|
} else {
|
|
55
55
|
break;
|
|
@@ -60,7 +60,7 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
62
|
if (leftIndex === axisData.length - 1) {
|
|
63
|
-
if (getAsNumber(axisData[leftIndex]) < xAsNumber) {
|
|
63
|
+
if ((0, _getAsNumber.getAsNumber)(axisData[leftIndex]) < xAsNumber) {
|
|
64
64
|
// Pointer is strictly past the last data point — out of range.
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
@@ -90,6 +90,7 @@ function getBaselinePixelY(baseline, yScale, stackedY0) {
|
|
|
90
90
|
if (baseline === 'min') {
|
|
91
91
|
return yScale.range()[0];
|
|
92
92
|
}
|
|
93
|
+
|
|
93
94
|
// Default: use the stacked baseline value.
|
|
94
95
|
const value = yScale(stackedY0);
|
|
95
96
|
if (Number.isNaN(value)) {
|
|
@@ -192,6 +193,9 @@ function getItemAtPosition(state, point) {
|
|
|
192
193
|
connectNulls,
|
|
193
194
|
curve
|
|
194
195
|
} = seriesItem;
|
|
196
|
+
if (!connectNulls && (data[left] == null || data[right] == null)) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
195
199
|
const dataIndex = (0, _getAxisValue.getAxisIndex)(xAxis, point.x);
|
|
196
200
|
if (dataIndex === -1) {
|
|
197
201
|
continue;
|
|
@@ -249,7 +253,7 @@ function getItemAtPosition(state, point) {
|
|
|
249
253
|
}
|
|
250
254
|
|
|
251
255
|
// Step 2: If the closest line is within the proximity threshold, pick it.
|
|
252
|
-
if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD) {
|
|
256
|
+
if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD && !series.series[closestItem.seriesId].area) {
|
|
253
257
|
return closestItem;
|
|
254
258
|
}
|
|
255
259
|
|
|
@@ -261,8 +265,8 @@ function getItemAtPosition(state, point) {
|
|
|
261
265
|
for (let g = stackingGroups.length - 1; g >= 0; g -= 1) {
|
|
262
266
|
const groupIds = stackingGroups[g].ids;
|
|
263
267
|
|
|
264
|
-
// Iterate in
|
|
265
|
-
for (let i =
|
|
268
|
+
// Iterate in direct order cause the `useAreaPlotData` is already doing a reverse order.
|
|
269
|
+
for (let i = 0; i < groupIds.length; i += 1) {
|
|
266
270
|
const seriesId = groupIds[i];
|
|
267
271
|
const seriesItem = series.series[seriesId];
|
|
268
272
|
if (seriesItem.hidden || !seriesItem.area) {
|
|
@@ -292,12 +296,7 @@ function getItemAtPosition(state, point) {
|
|
|
292
296
|
} = seriesItem;
|
|
293
297
|
|
|
294
298
|
// Check for null gaps at bracket points.
|
|
295
|
-
|
|
296
|
-
const rightIsNull = data[right] == null;
|
|
297
|
-
if (leftIsNull && rightIsNull) {
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
if ((leftIsNull || rightIsNull) && !connectNulls) {
|
|
299
|
+
if ((data[left] == null || data[right] == null) && !connectNulls) {
|
|
301
300
|
continue;
|
|
302
301
|
}
|
|
303
302
|
const xScale = xAxis.scale;
|
|
@@ -308,28 +307,6 @@ function getItemAtPosition(state, point) {
|
|
|
308
307
|
continue;
|
|
309
308
|
}
|
|
310
309
|
const getPixelX = idx => xPosition(xData[idx]);
|
|
311
|
-
if (left === right) {
|
|
312
|
-
// Ordinal axis or pointer exactly on a data point.
|
|
313
|
-
const stacked = visibleStackedData[left];
|
|
314
|
-
if (!stacked) {
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
const yBottom = getBaselinePixelY(baseline, yScale, stacked[0]);
|
|
318
|
-
const yTop = yScale(stacked[1]);
|
|
319
|
-
if ([yBottom, yTop].some(v => v == null || Number.isNaN(v))) {
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
const yMin = Math.min(yBottom, yTop);
|
|
323
|
-
const yMax = Math.max(yBottom, yTop);
|
|
324
|
-
if (point.y >= yMin && point.y <= yMax) {
|
|
325
|
-
return {
|
|
326
|
-
type: 'line',
|
|
327
|
-
seriesId,
|
|
328
|
-
dataIndex: left
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
310
|
|
|
334
311
|
// Build pixel-coordinate points for the top and bottom curves,
|
|
335
312
|
// then evaluate them at the pointer's x using the actual d3 curve.
|
|
@@ -2,6 +2,7 @@ import { selectorChartXAxis, selectorChartYAxis } from "../../internals/plugins/
|
|
|
2
2
|
import { selectorAllSeriesOfType } from "../../internals/seriesSelectorOfType.mjs";
|
|
3
3
|
import { getAxisIndex } from "../../internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs";
|
|
4
4
|
import { isOrdinalScale } from "../../internals/scaleGuards.mjs";
|
|
5
|
+
import { getAsNumber } from "../../internals/getAsNumber.mjs";
|
|
5
6
|
import { getValueToPositionMapper } from "../../hooks/getValueToPositionMapper.mjs";
|
|
6
7
|
import { evaluateCurveY } from "./curveEvaluation.mjs";
|
|
7
8
|
|
|
@@ -38,8 +39,7 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
38
39
|
|
|
39
40
|
// For continuous axes, find the two adjacent data points surrounding pointX.
|
|
40
41
|
const xValue = scale.invert(pointX);
|
|
41
|
-
const xAsNumber = xValue
|
|
42
|
-
const getAsNumber = v => v instanceof Date ? v.getTime() : v;
|
|
42
|
+
const xAsNumber = getAsNumber(xValue);
|
|
43
43
|
|
|
44
44
|
// Find the rightmost index where data[i] <= xValue.
|
|
45
45
|
let leftIndex = -1;
|
|
@@ -85,6 +85,7 @@ function getBaselinePixelY(baseline, yScale, stackedY0) {
|
|
|
85
85
|
if (baseline === 'min') {
|
|
86
86
|
return yScale.range()[0];
|
|
87
87
|
}
|
|
88
|
+
|
|
88
89
|
// Default: use the stacked baseline value.
|
|
89
90
|
const value = yScale(stackedY0);
|
|
90
91
|
if (Number.isNaN(value)) {
|
|
@@ -187,6 +188,9 @@ export default function getItemAtPosition(state, point) {
|
|
|
187
188
|
connectNulls,
|
|
188
189
|
curve
|
|
189
190
|
} = seriesItem;
|
|
191
|
+
if (!connectNulls && (data[left] == null || data[right] == null)) {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
190
194
|
const dataIndex = getAxisIndex(xAxis, point.x);
|
|
191
195
|
if (dataIndex === -1) {
|
|
192
196
|
continue;
|
|
@@ -244,7 +248,7 @@ export default function getItemAtPosition(state, point) {
|
|
|
244
248
|
}
|
|
245
249
|
|
|
246
250
|
// Step 2: If the closest line is within the proximity threshold, pick it.
|
|
247
|
-
if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD) {
|
|
251
|
+
if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD && !series.series[closestItem.seriesId].area) {
|
|
248
252
|
return closestItem;
|
|
249
253
|
}
|
|
250
254
|
|
|
@@ -256,8 +260,8 @@ export default function getItemAtPosition(state, point) {
|
|
|
256
260
|
for (let g = stackingGroups.length - 1; g >= 0; g -= 1) {
|
|
257
261
|
const groupIds = stackingGroups[g].ids;
|
|
258
262
|
|
|
259
|
-
// Iterate in
|
|
260
|
-
for (let i =
|
|
263
|
+
// Iterate in direct order cause the `useAreaPlotData` is already doing a reverse order.
|
|
264
|
+
for (let i = 0; i < groupIds.length; i += 1) {
|
|
261
265
|
const seriesId = groupIds[i];
|
|
262
266
|
const seriesItem = series.series[seriesId];
|
|
263
267
|
if (seriesItem.hidden || !seriesItem.area) {
|
|
@@ -287,12 +291,7 @@ export default function getItemAtPosition(state, point) {
|
|
|
287
291
|
} = seriesItem;
|
|
288
292
|
|
|
289
293
|
// Check for null gaps at bracket points.
|
|
290
|
-
|
|
291
|
-
const rightIsNull = data[right] == null;
|
|
292
|
-
if (leftIsNull && rightIsNull) {
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
if ((leftIsNull || rightIsNull) && !connectNulls) {
|
|
294
|
+
if ((data[left] == null || data[right] == null) && !connectNulls) {
|
|
296
295
|
continue;
|
|
297
296
|
}
|
|
298
297
|
const xScale = xAxis.scale;
|
|
@@ -303,28 +302,6 @@ export default function getItemAtPosition(state, point) {
|
|
|
303
302
|
continue;
|
|
304
303
|
}
|
|
305
304
|
const getPixelX = idx => xPosition(xData[idx]);
|
|
306
|
-
if (left === right) {
|
|
307
|
-
// Ordinal axis or pointer exactly on a data point.
|
|
308
|
-
const stacked = visibleStackedData[left];
|
|
309
|
-
if (!stacked) {
|
|
310
|
-
continue;
|
|
311
|
-
}
|
|
312
|
-
const yBottom = getBaselinePixelY(baseline, yScale, stacked[0]);
|
|
313
|
-
const yTop = yScale(stacked[1]);
|
|
314
|
-
if ([yBottom, yTop].some(v => v == null || Number.isNaN(v))) {
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
const yMin = Math.min(yBottom, yTop);
|
|
318
|
-
const yMax = Math.max(yBottom, yTop);
|
|
319
|
-
if (point.y >= yMin && point.y <= yMax) {
|
|
320
|
-
return {
|
|
321
|
-
type: 'line',
|
|
322
|
-
seriesId,
|
|
323
|
-
dataIndex: left
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
305
|
|
|
329
306
|
// Build pixel-coordinate points for the top and bottom curves,
|
|
330
307
|
// then evaluate them at the pointer's x using the actual d3 curve.
|
|
@@ -38,6 +38,9 @@ function FocusedPieArc(props) {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
const item = series.data[focusedItem.dataIndex];
|
|
41
|
+
if (!item || item.hidden) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
41
44
|
const _getModifiedArcProper = (0, _getModifiedArcProperties.getModifiedArcProperties)(series, pieSeriesLayout[focusedItem.seriesId], isHighlighted, isFaded),
|
|
42
45
|
arcSizes = (0, _objectWithoutPropertiesLoose2.default)(_getModifiedArcProper, _excluded);
|
|
43
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArc.PieArc, (0, _extends2.default)({
|
|
@@ -32,6 +32,9 @@ export function FocusedPieArc(props) {
|
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
const item = series.data[focusedItem.dataIndex];
|
|
35
|
+
if (!item || item.hidden) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
35
38
|
const _getModifiedArcProper = getModifiedArcProperties(series, pieSeriesLayout[focusedItem.seriesId], isHighlighted, isFaded),
|
|
36
39
|
arcSizes = _objectWithoutPropertiesLoose(_getModifiedArcProper, _excluded);
|
|
37
40
|
return /*#__PURE__*/_jsx(PieArc, _extends({
|
|
@@ -20,6 +20,9 @@ function FocusedRadarMark(props) {
|
|
|
20
20
|
if (!focusedItem || focusedItem.type !== 'radar' || seriesCoordinates.length === 0) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
+
if (seriesCoordinates[0].hidden) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
23
26
|
const point = seriesCoordinates[0].points[focusedItem.dataIndex];
|
|
24
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", (0, _extends2.default)({
|
|
25
28
|
fill: "none",
|
|
@@ -13,6 +13,9 @@ export function FocusedRadarMark(props) {
|
|
|
13
13
|
if (!focusedItem || focusedItem.type !== 'radar' || seriesCoordinates.length === 0) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
+
if (seriesCoordinates[0].hidden) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
16
19
|
const point = seriesCoordinates[0].points[focusedItem.dataIndex];
|
|
17
20
|
return /*#__PURE__*/_jsx("rect", _extends({
|
|
18
21
|
fill: "none",
|
|
@@ -38,6 +38,9 @@ function FocusedScatterMark(_ref) {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
const series = scatterSeries?.series[focusedItem.seriesId];
|
|
41
|
+
if (!series || series.hidden) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
41
44
|
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
42
45
|
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
43
46
|
const getXPosition = (0, _hooks.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
@@ -31,6 +31,9 @@ export function FocusedScatterMark(_ref) {
|
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
const series = scatterSeries?.series[focusedItem.seriesId];
|
|
34
|
+
if (!series || series.hidden) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
34
37
|
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
35
38
|
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
36
39
|
const getXPosition = getValueToPositionMapper(xAxis[xAxisId].scale);
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -10,8 +10,13 @@ exports.createGetPreviousSeriesFocusedItem = createGetPreviousSeriesFocusedItem;
|
|
|
10
10
|
var _getPreviousNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries");
|
|
11
11
|
var _getMaxSeriesLength = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength");
|
|
12
12
|
var _getNextNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries");
|
|
13
|
+
var _findVisibleDataIndex = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex");
|
|
13
14
|
var _seriesHasData = require("./seriesHasData");
|
|
14
15
|
var _useChartSeries = require("./plugins/corePlugins/useChartSeries/useChartSeries.selectors");
|
|
16
|
+
function isSeriesHidden(processedSeries, type, seriesId) {
|
|
17
|
+
const seriesItem = processedSeries[type]?.series[seriesId];
|
|
18
|
+
return Boolean(seriesItem && 'hidden' in seriesItem && seriesItem.hidden);
|
|
19
|
+
}
|
|
15
20
|
function createGetNextIndexFocusedItem(
|
|
16
21
|
/**
|
|
17
22
|
* The set of series types compatible with this navigation action.
|
|
@@ -25,7 +30,7 @@ allowCycles = false) {
|
|
|
25
30
|
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
26
31
|
let seriesId = currentItem?.seriesId;
|
|
27
32
|
let type = currentItem?.type;
|
|
28
|
-
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
|
|
33
|
+
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId) || isSeriesHidden(processedSeries, type, seriesId)) {
|
|
29
34
|
const nextSeries = (0, _getNextNonEmptySeries.getNextNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
30
35
|
if (nextSeries === null) {
|
|
31
36
|
return null;
|
|
@@ -40,10 +45,22 @@ allowCycles = false) {
|
|
|
40
45
|
} else {
|
|
41
46
|
dataIndex = Math.min(maxLength - 1, dataIndex);
|
|
42
47
|
}
|
|
48
|
+
const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
|
|
49
|
+
processedSeries,
|
|
50
|
+
type,
|
|
51
|
+
seriesId,
|
|
52
|
+
startIndex: dataIndex,
|
|
53
|
+
dataLength: maxLength,
|
|
54
|
+
direction: 1,
|
|
55
|
+
allowCycles
|
|
56
|
+
});
|
|
57
|
+
if (visibleDataIndex === null) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
43
60
|
return {
|
|
44
61
|
type: type,
|
|
45
62
|
seriesId,
|
|
46
|
-
dataIndex
|
|
63
|
+
dataIndex: visibleDataIndex
|
|
47
64
|
};
|
|
48
65
|
};
|
|
49
66
|
}
|
|
@@ -60,7 +77,7 @@ allowCycles = false) {
|
|
|
60
77
|
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
61
78
|
let seriesId = currentItem?.seriesId;
|
|
62
79
|
let type = currentItem?.type;
|
|
63
|
-
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
|
|
80
|
+
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId) || isSeriesHidden(processedSeries, type, seriesId)) {
|
|
64
81
|
const previousSeries = (0, _getPreviousNonEmptySeries.getPreviousNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
65
82
|
if (previousSeries === null) {
|
|
66
83
|
return null;
|
|
@@ -75,10 +92,22 @@ allowCycles = false) {
|
|
|
75
92
|
} else {
|
|
76
93
|
dataIndex = Math.max(0, dataIndex);
|
|
77
94
|
}
|
|
95
|
+
const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
|
|
96
|
+
processedSeries,
|
|
97
|
+
type,
|
|
98
|
+
seriesId,
|
|
99
|
+
startIndex: dataIndex,
|
|
100
|
+
dataLength: maxLength,
|
|
101
|
+
direction: -1,
|
|
102
|
+
allowCycles
|
|
103
|
+
});
|
|
104
|
+
if (visibleDataIndex === null) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
78
107
|
return {
|
|
79
108
|
type: type,
|
|
80
109
|
seriesId,
|
|
81
|
-
dataIndex
|
|
110
|
+
dataIndex: visibleDataIndex
|
|
82
111
|
};
|
|
83
112
|
};
|
|
84
113
|
}
|
|
@@ -97,11 +126,24 @@ compatibleSeriesTypes) {
|
|
|
97
126
|
}
|
|
98
127
|
type = nextSeries.type;
|
|
99
128
|
seriesId = nextSeries.seriesId;
|
|
100
|
-
const
|
|
129
|
+
const data = processedSeries[type].series[seriesId].data;
|
|
130
|
+
const startIndex = currentItem?.dataIndex == null ? 0 : Math.min(currentItem.dataIndex, data.length - 1);
|
|
131
|
+
const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
|
|
132
|
+
processedSeries,
|
|
133
|
+
type,
|
|
134
|
+
seriesId,
|
|
135
|
+
startIndex,
|
|
136
|
+
dataLength: data.length,
|
|
137
|
+
direction: 1,
|
|
138
|
+
allowCycles: true
|
|
139
|
+
});
|
|
140
|
+
if (visibleDataIndex === null) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
101
143
|
return {
|
|
102
144
|
type: type,
|
|
103
145
|
seriesId,
|
|
104
|
-
dataIndex
|
|
146
|
+
dataIndex: visibleDataIndex
|
|
105
147
|
};
|
|
106
148
|
};
|
|
107
149
|
}
|
|
@@ -121,11 +163,23 @@ compatibleSeriesTypes) {
|
|
|
121
163
|
type = previousSeries.type;
|
|
122
164
|
seriesId = previousSeries.seriesId;
|
|
123
165
|
const data = processedSeries[type].series[seriesId].data;
|
|
124
|
-
const
|
|
166
|
+
const startIndex = currentItem?.dataIndex == null ? data.length - 1 : Math.min(currentItem.dataIndex, data.length - 1);
|
|
167
|
+
const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
|
|
168
|
+
processedSeries,
|
|
169
|
+
type,
|
|
170
|
+
seriesId,
|
|
171
|
+
startIndex,
|
|
172
|
+
dataLength: data.length,
|
|
173
|
+
direction: -1,
|
|
174
|
+
allowCycles: true
|
|
175
|
+
});
|
|
176
|
+
if (visibleDataIndex === null) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
125
179
|
return {
|
|
126
180
|
type: type,
|
|
127
181
|
seriesId,
|
|
128
|
-
dataIndex
|
|
182
|
+
dataIndex: visibleDataIndex
|
|
129
183
|
};
|
|
130
184
|
};
|
|
131
185
|
}
|