@mui/x-charts 8.22.0 → 8.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarElement.js +1 -1
- package/BarChart/BarLabel/BarLabel.types.d.ts +3 -3
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelPlot.d.ts +9 -9
- package/BarChart/BarLabel/getBarLabel.d.ts +3 -3
- package/BarChart/FocusedBar.js +1 -1
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +23 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -2
- package/BarChart/seriesConfig/index.js +3 -1
- package/CHANGELOG.md +202 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -3
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -3
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +6 -7
- package/ChartsSurface/ChartsSurface.js +7 -8
- package/ChartsTooltip/ChartsTooltipContainer.js +4 -5
- package/ChartsTooltip/useAxisTooltip.js +3 -4
- package/ChartsTooltip/useItemTooltip.js +2 -3
- package/ChartsWrapper/ChartsWrapper.js +2 -3
- package/LineChart/FocusedLineMark.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -2
- package/LineChart/MarkPlot.js +1 -2
- package/LineChart/seriesConfig/index.js +3 -1
- package/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/LineChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/LineChart/seriesConfig/seriesProcessor.js +2 -2
- package/PieChart/FocusedPieArc.d.ts +2 -0
- package/PieChart/FocusedPieArc.js +58 -0
- package/PieChart/PieArcPlot.js +3 -31
- package/PieChart/PieChart.js +2 -1
- package/PieChart/dataTransform/getModifiedArcProperties.d.ts +11 -0
- package/PieChart/dataTransform/getModifiedArcProperties.js +42 -0
- package/PieChart/dataTransform/useTransformData.js +16 -21
- package/PieChart/seriesConfig/index.js +3 -1
- package/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/PieChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/PieChart/seriesConfig/tooltipPosition.js +11 -20
- package/RadarChart/RadarAxis/useRadarAxis.js +1 -2
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +3 -4
- package/RadarChart/RadarGrid/useRadarGridData.js +1 -2
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -2
- package/ScatterChart/BatchScatter.js +4 -5
- package/ScatterChart/FocusedScatterMark.js +1 -1
- package/ScatterChart/Scatter.js +1 -2
- package/ScatterChart/seriesConfig/index.js +3 -1
- package/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/ScatterChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/esm/BarChart/BarElement.js +1 -1
- package/esm/BarChart/BarLabel/BarLabel.types.d.ts +3 -3
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +9 -9
- package/esm/BarChart/BarLabel/getBarLabel.d.ts +3 -3
- package/esm/BarChart/FocusedBar.js +1 -1
- package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.js +17 -0
- package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +1 -1
- package/esm/BarChart/seriesConfig/index.js +3 -1
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -3
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -3
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +6 -7
- package/esm/ChartsSurface/ChartsSurface.js +7 -8
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -5
- package/esm/ChartsTooltip/useAxisTooltip.js +3 -4
- package/esm/ChartsTooltip/useItemTooltip.js +2 -3
- package/esm/ChartsWrapper/ChartsWrapper.js +2 -3
- package/esm/LineChart/FocusedLineMark.js +1 -1
- package/esm/LineChart/LineHighlightPlot.js +1 -2
- package/esm/LineChart/MarkPlot.js +1 -2
- package/esm/LineChart/seriesConfig/index.js +3 -1
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/LineChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/PieChart/FocusedPieArc.d.ts +2 -0
- package/esm/PieChart/FocusedPieArc.js +51 -0
- package/esm/PieChart/PieArcPlot.js +5 -33
- package/esm/PieChart/PieChart.js +2 -1
- package/esm/PieChart/dataTransform/getModifiedArcProperties.d.ts +11 -0
- package/esm/PieChart/dataTransform/getModifiedArcProperties.js +36 -0
- package/esm/PieChart/dataTransform/useTransformData.js +16 -21
- package/esm/PieChart/seriesConfig/index.js +3 -1
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/PieChart/seriesConfig/tooltipPosition.js +11 -20
- package/esm/RadarChart/RadarAxis/useRadarAxis.js +1 -2
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +3 -4
- package/esm/RadarChart/RadarGrid/useRadarGridData.js +1 -2
- package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -2
- package/esm/ScatterChart/BatchScatter.js +4 -5
- package/esm/ScatterChart/FocusedScatterMark.js +1 -1
- package/esm/ScatterChart/Scatter.js +1 -2
- package/esm/ScatterChart/seriesConfig/index.js +3 -1
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/hooks/useAxis.js +8 -9
- package/esm/hooks/useAxisSystem.js +2 -3
- package/esm/hooks/useBrush.js +1 -2
- package/esm/hooks/useChartId.js +1 -2
- package/esm/hooks/useDataset.js +1 -2
- package/esm/hooks/useDrawingArea.js +1 -2
- package/esm/hooks/useFocusedItem.d.ts +1 -12
- package/esm/hooks/useFocusedItem.js +3 -11
- package/esm/hooks/useInteractionItemProps.d.ts +3 -2
- package/esm/hooks/useInteractionItemProps.js +13 -2
- package/esm/hooks/useIsItemFocused.d.ts +4 -3
- package/esm/hooks/useIsItemFocused.js +2 -3
- package/esm/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/esm/hooks/useIsItemFocusedGetter.js +2 -1
- package/esm/hooks/useItemHighlighted.js +2 -3
- package/esm/hooks/useItemHighlightedGetter.js +2 -3
- package/esm/hooks/useLegend.js +1 -2
- package/esm/hooks/usePieSeries.js +1 -2
- package/esm/hooks/useSeries.js +1 -2
- package/esm/hooks/useSkipAnimation.js +1 -2
- package/esm/hooks/useZAxis.js +1 -2
- package/esm/index.js +1 -1
- package/esm/internals/commonNextFocusItem.d.ts +14 -0
- package/esm/internals/commonNextFocusItem.js +84 -0
- package/esm/internals/index.d.ts +1 -2
- package/esm/internals/index.js +1 -2
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +1 -2
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +1 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +5 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js +1 -2
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +5 -6
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +4 -1
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +12 -105
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -15
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +45 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +40 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +6 -7
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -9
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
- package/esm/internals/seriesHasData.d.ts +4 -0
- package/esm/internals/seriesHasData.js +8 -0
- package/esm/internals/seriesSelectorOfType.js +2 -3
- package/esm/internals/stacking/index.d.ts +1 -0
- package/esm/internals/stacking/index.js +1 -0
- package/esm/internals/stacking/offset/index.d.ts +1 -0
- package/esm/internals/stacking/offset/index.js +1 -0
- package/esm/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/esm/internals/stacking/offset/offsetDiverging.js +47 -0
- package/esm/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/esm/internals/{stackSeries.js → stacking/stackSeries.js} +8 -6
- package/esm/models/seriesType/config.d.ts +0 -2
- package/esm/models/seriesType/index.d.ts +3 -1
- package/hooks/useAxis.js +8 -9
- package/hooks/useAxisSystem.js +2 -3
- package/hooks/useBrush.js +1 -2
- package/hooks/useChartId.js +1 -2
- package/hooks/useDataset.js +1 -2
- package/hooks/useDrawingArea.js +1 -2
- package/hooks/useFocusedItem.d.ts +1 -12
- package/hooks/useFocusedItem.js +1 -11
- package/hooks/useInteractionItemProps.d.ts +3 -2
- package/hooks/useInteractionItemProps.js +13 -2
- package/hooks/useIsItemFocused.d.ts +4 -3
- package/hooks/useIsItemFocused.js +2 -3
- package/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/hooks/useIsItemFocusedGetter.js +2 -1
- package/hooks/useItemHighlighted.js +2 -3
- package/hooks/useItemHighlightedGetter.js +2 -3
- package/hooks/useLegend.js +1 -2
- package/hooks/usePieSeries.js +1 -2
- package/hooks/useSeries.js +1 -2
- package/hooks/useSkipAnimation.js +1 -2
- package/hooks/useZAxis.js +1 -2
- package/index.js +1 -1
- package/internals/commonNextFocusItem.d.ts +14 -0
- package/internals/commonNextFocusItem.js +93 -0
- package/internals/index.d.ts +1 -2
- package/internals/index.js +4 -16
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -2
- package/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +1 -2
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +1 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +5 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js +1 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +5 -6
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +4 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +11 -104
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -16
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +51 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +46 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +6 -7
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -9
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +1 -1
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
- package/internals/seriesHasData.d.ts +4 -0
- package/internals/seriesHasData.js +14 -0
- package/internals/seriesSelectorOfType.js +2 -3
- package/internals/stacking/index.d.ts +1 -0
- package/internals/stacking/index.js +16 -0
- package/internals/stacking/offset/index.d.ts +1 -0
- package/internals/stacking/offset/index.js +16 -0
- package/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/internals/stacking/offset/offsetDiverging.js +53 -0
- package/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/internals/{stackSeries.js → stacking/stackSeries.js} +3 -1
- package/models/seriesType/config.d.ts +0 -2
- package/models/seriesType/index.d.ts +3 -1
- package/package.json +4 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -92
- package/esm/internals/store/useSelector.d.ts +0 -2
- package/esm/internals/store/useSelector.js +0 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -10
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -99
- package/internals/store/useSelector.d.ts +0 -2
- package/internals/store/useSelector.js +0 -8
|
@@ -13,6 +13,7 @@ var _legend = _interopRequireDefault(require("./legend"));
|
|
|
13
13
|
var _tooltip = _interopRequireWildcard(require("./tooltip"));
|
|
14
14
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
15
15
|
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
16
|
+
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
16
17
|
const lineSeriesConfig = exports.lineSeriesConfig = {
|
|
17
18
|
colorProcessor: _getColor.default,
|
|
18
19
|
seriesProcessor: _seriesProcessor.default,
|
|
@@ -22,5 +23,6 @@ const lineSeriesConfig = exports.lineSeriesConfig = {
|
|
|
22
23
|
axisTooltipGetter: _tooltip.axisTooltipGetter,
|
|
23
24
|
xExtremumGetter: _extremums.getExtremumX,
|
|
24
25
|
yExtremumGetter: _extremums.getExtremumY,
|
|
25
|
-
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default
|
|
26
|
+
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
|
|
27
|
+
keyboardFocusHandler: _keyboardFocusHandler.default
|
|
26
28
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _commonNextFocusItem = require("../../internals/commonNextFocusItem");
|
|
8
|
+
const outSeriesTypes = new Set(['bar', 'line', 'scatter']);
|
|
9
|
+
const keyboardFocusHandler = event => {
|
|
10
|
+
switch (event.key) {
|
|
11
|
+
case 'ArrowRight':
|
|
12
|
+
return (0, _commonNextFocusItem.createGetNextIndexFocusedItem)(outSeriesTypes);
|
|
13
|
+
case 'ArrowLeft':
|
|
14
|
+
return (0, _commonNextFocusItem.createGetPreviousIndexFocusedItem)(outSeriesTypes);
|
|
15
|
+
case 'ArrowDown':
|
|
16
|
+
return (0, _commonNextFocusItem.createGetPreviousSeriesFocusedItem)(outSeriesTypes);
|
|
17
|
+
case 'ArrowUp':
|
|
18
|
+
return (0, _commonNextFocusItem.createGetNextSeriesFocusedItem)(outSeriesTypes);
|
|
19
|
+
default:
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = keyboardFocusHandler;
|
|
@@ -8,13 +8,13 @@ exports.default = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
10
10
|
var _warning = require("@mui/x-internals/warning");
|
|
11
|
-
var
|
|
11
|
+
var _stacking = require("../../internals/stacking");
|
|
12
12
|
const seriesProcessor = (params, dataset) => {
|
|
13
13
|
const {
|
|
14
14
|
seriesOrder,
|
|
15
15
|
series
|
|
16
16
|
} = params;
|
|
17
|
-
const stackingGroups = (0,
|
|
17
|
+
const stackingGroups = (0, _stacking.getStackingGroups)((0, _extends2.default)({}, params, {
|
|
18
18
|
defaultStrategy: {
|
|
19
19
|
stackOffset: 'none'
|
|
20
20
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.FocusedPieArc = FocusedPieArc;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _useFocusedItem = require("../hooks/useFocusedItem");
|
|
14
|
+
var _usePieSeries = require("../hooks/usePieSeries");
|
|
15
|
+
var _PieArc = require("./PieArc");
|
|
16
|
+
var _useItemHighlighted = require("../hooks/useItemHighlighted");
|
|
17
|
+
var _getModifiedArcProperties = require("./dataTransform/getModifiedArcProperties");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
function FocusedPieArc(props) {
|
|
20
|
+
const theme = (0, _styles.useTheme)();
|
|
21
|
+
const focusedItem = (0, _useFocusedItem.useFocusedItem)();
|
|
22
|
+
const pieSeriesLayout = (0, _usePieSeries.usePieSeriesLayout)();
|
|
23
|
+
const {
|
|
24
|
+
isHighlighted,
|
|
25
|
+
isFaded
|
|
26
|
+
} = (0, _useItemHighlighted.useItemHighlighted)(focusedItem);
|
|
27
|
+
const pieSeries = (0, _usePieSeries.usePieSeriesContext)();
|
|
28
|
+
if (focusedItem === null || focusedItem.type !== 'pie' || !pieSeries) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const series = pieSeries?.series[focusedItem.seriesId];
|
|
32
|
+
const {
|
|
33
|
+
center,
|
|
34
|
+
radius
|
|
35
|
+
} = pieSeriesLayout[focusedItem.seriesId];
|
|
36
|
+
if (!series || !center || !radius) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const item = series.data[focusedItem.dataIndex];
|
|
40
|
+
const arcSizes = (0, _getModifiedArcProperties.getModifiedArcProperties)(series, pieSeriesLayout[focusedItem.seriesId], isHighlighted, isFaded);
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArc.PieArc, (0, _extends2.default)({
|
|
42
|
+
transform: `translate(${pieSeriesLayout[series.id].center.x}, ${pieSeriesLayout[series.id].center.y})`,
|
|
43
|
+
startAngle: item.startAngle,
|
|
44
|
+
endAngle: item.endAngle,
|
|
45
|
+
color: "transparent",
|
|
46
|
+
pointerEvents: "none",
|
|
47
|
+
skipInteraction: true,
|
|
48
|
+
skipAnimation: true,
|
|
49
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
50
|
+
id: series.id,
|
|
51
|
+
className: _PieArc.pieArcClasses.focusIndicator,
|
|
52
|
+
dataIndex: focusedItem.dataIndex,
|
|
53
|
+
isFaded: false,
|
|
54
|
+
isHighlighted: false,
|
|
55
|
+
isFocused: false,
|
|
56
|
+
strokeWidth: 3
|
|
57
|
+
}, arcSizes, props));
|
|
58
|
+
}
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -11,8 +11,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var _styles = require("@mui/material/styles");
|
|
15
|
-
var _useFocusedItem = require("../hooks/useFocusedItem");
|
|
16
14
|
var _PieArc = require("./PieArc");
|
|
17
15
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
18
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -35,7 +33,6 @@ function PieArcPlot(props) {
|
|
|
35
33
|
skipAnimation
|
|
36
34
|
} = props,
|
|
37
35
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
|
-
const theme = (0, _styles.useTheme)();
|
|
39
36
|
const transformedData = (0, _useTransformData.useTransformData)({
|
|
40
37
|
innerRadius,
|
|
41
38
|
outerRadius,
|
|
@@ -46,18 +43,12 @@ function PieArcPlot(props) {
|
|
|
46
43
|
faded,
|
|
47
44
|
data
|
|
48
45
|
});
|
|
49
|
-
const {
|
|
50
|
-
dataIndex,
|
|
51
|
-
seriesId,
|
|
52
|
-
seriesType
|
|
53
|
-
} = (0, _useFocusedItem.useFocusedItem)() ?? {};
|
|
54
|
-
const focusedItem = dataIndex !== undefined && seriesId === id && seriesType === 'pie' ? transformedData[dataIndex] : null;
|
|
55
46
|
if (data.length === 0) {
|
|
56
47
|
return null;
|
|
57
48
|
}
|
|
58
49
|
const Arc = slots?.pieArc ?? _PieArc.PieArc;
|
|
59
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
60
|
-
children:
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
|
|
51
|
+
children: transformedData.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Arc, (0, _extends2.default)({
|
|
61
52
|
startAngle: item.startAngle,
|
|
62
53
|
endAngle: item.endAngle,
|
|
63
54
|
paddingAngle: item.paddingAngle,
|
|
@@ -78,26 +69,7 @@ function PieArcPlot(props) {
|
|
|
78
69
|
dataIndex: index
|
|
79
70
|
}, item);
|
|
80
71
|
})
|
|
81
|
-
}, slotProps?.pieArc), item.dataIndex))
|
|
82
|
-
startAngle: focusedItem.startAngle,
|
|
83
|
-
endAngle: focusedItem.endAngle,
|
|
84
|
-
paddingAngle: focusedItem.paddingAngle,
|
|
85
|
-
innerRadius: focusedItem.innerRadius,
|
|
86
|
-
color: "transparent",
|
|
87
|
-
pointerEvents: "none",
|
|
88
|
-
skipInteraction: true,
|
|
89
|
-
outerRadius: focusedItem.outerRadius,
|
|
90
|
-
cornerRadius: focusedItem.cornerRadius,
|
|
91
|
-
skipAnimation: true,
|
|
92
|
-
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
93
|
-
id: id,
|
|
94
|
-
className: _PieArc.pieArcClasses.focusIndicator,
|
|
95
|
-
dataIndex: focusedItem.dataIndex,
|
|
96
|
-
isFaded: false,
|
|
97
|
-
isHighlighted: false,
|
|
98
|
-
isFocused: false,
|
|
99
|
-
strokeWidth: 3
|
|
100
|
-
})]
|
|
72
|
+
}, slotProps?.pieArc), item.dataIndex))
|
|
101
73
|
}));
|
|
102
74
|
}
|
|
103
75
|
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
package/PieChart/PieChart.js
CHANGED
|
@@ -23,6 +23,7 @@ var _useChartContainerProps = require("../ChartContainer/useChartContainerProps"
|
|
|
23
23
|
var _ChartsWrapper = require("../ChartsWrapper");
|
|
24
24
|
var _PieChart2 = require("./PieChart.plugins");
|
|
25
25
|
var _defaultizeMargin = require("../internals/defaultizeMargin");
|
|
26
|
+
var _FocusedPieArc = require("./FocusedPieArc");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
28
|
const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
28
29
|
/**
|
|
@@ -95,7 +96,7 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
95
96
|
slots: slots,
|
|
96
97
|
slotProps: slotProps,
|
|
97
98
|
onItemClick: onItemClick
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
99
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedPieArc.FocusedPieArc, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
99
100
|
loading: loading,
|
|
100
101
|
slots: slots,
|
|
101
102
|
slotProps: slotProps
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DefaultizedPieSeriesType, PieSeriesLayout } from "../../models/seriesType/pie.js";
|
|
2
|
+
/**
|
|
3
|
+
* Function that returns arc properties after applying transformation from highlight/fade states.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getModifiedArcProperties(seriesDef: Pick<DefaultizedPieSeriesType, 'cornerRadius' | 'paddingAngle' | 'id' | 'highlighted' | 'faded' | 'data'>, seriesLayout: Pick<PieSeriesLayout, 'radius'>, isHighlighted: boolean, isFaded: boolean): {
|
|
6
|
+
paddingAngle: number;
|
|
7
|
+
innerRadius: number;
|
|
8
|
+
outerRadius: number;
|
|
9
|
+
cornerRadius: number;
|
|
10
|
+
arcLabelRadius: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getModifiedArcProperties = getModifiedArcProperties;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _angleConversion = require("../../internals/angleConversion");
|
|
10
|
+
/**
|
|
11
|
+
* Function that returns arc properties after applying transformation from highlight/fade states.
|
|
12
|
+
*/
|
|
13
|
+
function getModifiedArcProperties(seriesDef, seriesLayout, isHighlighted, isFaded) {
|
|
14
|
+
const {
|
|
15
|
+
faded,
|
|
16
|
+
highlighted,
|
|
17
|
+
paddingAngle: basePaddingAngle = 0,
|
|
18
|
+
cornerRadius: baseCornerRadius = 0
|
|
19
|
+
} = seriesDef;
|
|
20
|
+
const {
|
|
21
|
+
radius: {
|
|
22
|
+
inner: baseInnerRadius = 0,
|
|
23
|
+
label: baseArcLabelRadius,
|
|
24
|
+
outer: baseOuterRadius
|
|
25
|
+
}
|
|
26
|
+
} = seriesLayout;
|
|
27
|
+
const attributesOverride = (0, _extends2.default)({
|
|
28
|
+
additionalRadius: 0
|
|
29
|
+
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
30
|
+
const paddingAngle = Math.max(0, (0, _angleConversion.deg2rad)(attributesOverride.paddingAngle ?? basePaddingAngle));
|
|
31
|
+
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
32
|
+
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
33
|
+
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
34
|
+
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
35
|
+
return {
|
|
36
|
+
paddingAngle,
|
|
37
|
+
innerRadius,
|
|
38
|
+
outerRadius,
|
|
39
|
+
cornerRadius,
|
|
40
|
+
arcLabelRadius
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -11,18 +11,13 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useItemHighlightedGetter = require("../../hooks/useItemHighlightedGetter");
|
|
13
13
|
var _useIsItemFocusedGetter = require("../../hooks/useIsItemFocusedGetter");
|
|
14
|
-
var
|
|
14
|
+
var _getModifiedArcProperties = require("./getModifiedArcProperties");
|
|
15
15
|
function useTransformData(series) {
|
|
16
16
|
const {
|
|
17
17
|
id: seriesId,
|
|
18
18
|
data,
|
|
19
19
|
faded,
|
|
20
|
-
highlighted
|
|
21
|
-
paddingAngle: basePaddingAngle = 0,
|
|
22
|
-
innerRadius: baseInnerRadius = 0,
|
|
23
|
-
arcLabelRadius: baseArcLabelRadius,
|
|
24
|
-
outerRadius: baseOuterRadius,
|
|
25
|
-
cornerRadius: baseCornerRadius = 0
|
|
20
|
+
highlighted
|
|
26
21
|
} = series;
|
|
27
22
|
const {
|
|
28
23
|
isFaded: isItemFaded,
|
|
@@ -37,29 +32,29 @@ function useTransformData(series) {
|
|
|
37
32
|
const isHighlighted = isItemHighlighted(currentItem);
|
|
38
33
|
const isFaded = !isHighlighted && isItemFaded(currentItem);
|
|
39
34
|
const isFocused = isItemFocused({
|
|
40
|
-
|
|
35
|
+
type: 'pie',
|
|
41
36
|
seriesId,
|
|
42
37
|
dataIndex: itemIndex
|
|
43
38
|
});
|
|
39
|
+
|
|
40
|
+
// TODO v9: Replace the second argument with the result of useSeriesLayout
|
|
41
|
+
const arcSizes = (0, _getModifiedArcProperties.getModifiedArcProperties)(series, {
|
|
42
|
+
radius: {
|
|
43
|
+
inner: series.innerRadius ?? 0,
|
|
44
|
+
outer: series.outerRadius,
|
|
45
|
+
label: series.arcLabelRadius ?? 0,
|
|
46
|
+
available: 0
|
|
47
|
+
}
|
|
48
|
+
}, isHighlighted, isFaded);
|
|
44
49
|
const attributesOverride = (0, _extends2.default)({
|
|
45
50
|
additionalRadius: 0
|
|
46
51
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
47
|
-
const paddingAngle = Math.max(0, (0, _angleConversion.deg2rad)(attributesOverride.paddingAngle ?? basePaddingAngle));
|
|
48
|
-
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
49
|
-
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
50
|
-
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
51
|
-
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
52
52
|
return (0, _extends2.default)({}, item, attributesOverride, {
|
|
53
53
|
dataIndex: itemIndex,
|
|
54
54
|
isFaded,
|
|
55
55
|
isHighlighted,
|
|
56
|
-
isFocused
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
outerRadius,
|
|
60
|
-
cornerRadius,
|
|
61
|
-
arcLabelRadius
|
|
62
|
-
});
|
|
63
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, isItemFocused, seriesId]);
|
|
56
|
+
isFocused
|
|
57
|
+
}, arcSizes);
|
|
58
|
+
}), [data, seriesId, isItemHighlighted, isItemFaded, isItemFocused, series, faded, highlighted]);
|
|
64
59
|
return dataWithHighlight;
|
|
65
60
|
}
|
|
@@ -12,6 +12,7 @@ var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
|
12
12
|
var _seriesLayout = _interopRequireDefault(require("./seriesLayout"));
|
|
13
13
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
14
14
|
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
15
|
+
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
15
16
|
const pieSeriesConfig = exports.pieSeriesConfig = {
|
|
16
17
|
colorProcessor: _getColor.default,
|
|
17
18
|
seriesProcessor: _seriesProcessor.default,
|
|
@@ -19,5 +20,6 @@ const pieSeriesConfig = exports.pieSeriesConfig = {
|
|
|
19
20
|
legendGetter: _legend.default,
|
|
20
21
|
tooltipGetter: _tooltip.default,
|
|
21
22
|
tooltipItemPositionGetter: _tooltipPosition.default,
|
|
22
|
-
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default
|
|
23
|
+
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
|
|
24
|
+
keyboardFocusHandler: _keyboardFocusHandler.default
|
|
23
25
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _commonNextFocusItem = require("../../internals/commonNextFocusItem");
|
|
8
|
+
const outSeriesTypes = new Set(['pie']);
|
|
9
|
+
const keyboardFocusHandler = event => {
|
|
10
|
+
switch (event.key) {
|
|
11
|
+
case 'ArrowRight':
|
|
12
|
+
return (0, _commonNextFocusItem.createGetNextIndexFocusedItem)(outSeriesTypes);
|
|
13
|
+
case 'ArrowLeft':
|
|
14
|
+
return (0, _commonNextFocusItem.createGetPreviousIndexFocusedItem)(outSeriesTypes);
|
|
15
|
+
case 'ArrowDown':
|
|
16
|
+
return (0, _commonNextFocusItem.createGetPreviousSeriesFocusedItem)(outSeriesTypes);
|
|
17
|
+
case 'ArrowUp':
|
|
18
|
+
return (0, _commonNextFocusItem.createGetNextSeriesFocusedItem)(outSeriesTypes);
|
|
19
|
+
default:
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = keyboardFocusHandler;
|
|
@@ -5,46 +5,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _findMinMax = require("../../internals/findMinMax");
|
|
8
|
-
var _getPercentageValue = require("../../internals/getPercentageValue");
|
|
9
|
-
var _getPieCoordinates = require("../getPieCoordinates");
|
|
10
8
|
const tooltipItemPositionGetter = params => {
|
|
11
9
|
const {
|
|
12
10
|
series,
|
|
13
|
-
drawingArea,
|
|
14
11
|
identifier,
|
|
15
|
-
placement
|
|
12
|
+
placement,
|
|
13
|
+
seriesLayout
|
|
16
14
|
} = params;
|
|
17
15
|
if (!identifier || identifier.dataIndex === undefined) {
|
|
18
16
|
return null;
|
|
19
17
|
}
|
|
20
18
|
const itemSeries = series.pie?.series[identifier.seriesId];
|
|
21
|
-
|
|
19
|
+
const layout = seriesLayout.pie?.[identifier.seriesId];
|
|
20
|
+
if (itemSeries == null || layout == null) {
|
|
22
21
|
return null;
|
|
23
22
|
}
|
|
24
23
|
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = (0, _getPieCoordinates.getPieCoordinates)({
|
|
29
|
-
cx: itemSeries.cx,
|
|
30
|
-
cy: itemSeries.cy
|
|
31
|
-
}, drawingArea);
|
|
24
|
+
center,
|
|
25
|
+
radius
|
|
26
|
+
} = layout;
|
|
32
27
|
const {
|
|
33
|
-
data
|
|
34
|
-
innerRadius: baseInnerRadius = 0,
|
|
35
|
-
outerRadius: baseOuterRadius
|
|
28
|
+
data
|
|
36
29
|
} = itemSeries;
|
|
37
|
-
const innerRadius = Math.max(0, (0, _getPercentageValue.getPercentageValue)(baseInnerRadius ?? 0, availableRadius));
|
|
38
|
-
const outerRadius = Math.max(0, (0, _getPercentageValue.getPercentageValue)(baseOuterRadius ?? availableRadius, availableRadius));
|
|
39
30
|
const dataItem = data[identifier.dataIndex];
|
|
40
31
|
if (!dataItem) {
|
|
41
32
|
return null;
|
|
42
33
|
}
|
|
43
34
|
|
|
44
35
|
// Compute the 4 corner points of the arc to get the bounding box.
|
|
45
|
-
const points = [[
|
|
46
|
-
x:
|
|
47
|
-
y:
|
|
36
|
+
const points = [[radius.inner, dataItem.startAngle], [radius.inner, dataItem.endAngle], [radius.outer, dataItem.startAngle], [radius.outer, dataItem.endAngle]].map(([r, angle]) => ({
|
|
37
|
+
x: center.x + r * Math.sin(angle),
|
|
38
|
+
y: center.y - r * Math.cos(angle)
|
|
48
39
|
}));
|
|
49
40
|
const [x0, x1] = (0, _findMinMax.findMinMax)(points.map(p => p.x));
|
|
50
41
|
const [y0, y1] = (0, _findMinMax.findMinMax)(points.map(p => p.y));
|
|
@@ -12,7 +12,6 @@ var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChar
|
|
|
12
12
|
var _scaleGuards = require("../../internals/scaleGuards");
|
|
13
13
|
var _degToRad = require("../../internals/degToRad");
|
|
14
14
|
var _clampAngle = require("../../internals/clampAngle");
|
|
15
|
-
var _useSelector = require("../../internals/store/useSelector");
|
|
16
15
|
var _angleConversion = require("../../internals/angleConversion");
|
|
17
16
|
/**
|
|
18
17
|
* Returns an array with on item par metrics with the different point to label.
|
|
@@ -34,7 +33,7 @@ function useRadarAxis(params) {
|
|
|
34
33
|
const {
|
|
35
34
|
cx,
|
|
36
35
|
cy
|
|
37
|
-
} =
|
|
36
|
+
} = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
38
37
|
if (metric === undefined || !rotationScale || rotationScale.domain().length === 0) {
|
|
39
38
|
return null;
|
|
40
39
|
}
|
|
@@ -7,7 +7,6 @@ exports.useRadarAxisHighlight = useRadarAxisHighlight;
|
|
|
7
7
|
var _useAxis = require("../../hooks/useAxis");
|
|
8
8
|
var _useRadarSeries = require("../../hooks/useRadarSeries");
|
|
9
9
|
var _useScale = require("../../hooks/useScale");
|
|
10
|
-
var _useSelector = require("../../internals/store/useSelector");
|
|
11
10
|
var _useStore = require("../../internals/store/useStore");
|
|
12
11
|
var _useChartContext = require("../../context/ChartProvider/useChartContext");
|
|
13
12
|
var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
@@ -23,9 +22,9 @@ function useRadarAxisHighlight() {
|
|
|
23
22
|
instance
|
|
24
23
|
} = (0, _useChartContext.useChartContext)();
|
|
25
24
|
const store = (0, _useStore.useStore)();
|
|
26
|
-
const rotationAxisIndex =
|
|
27
|
-
const rotationAxisValue =
|
|
28
|
-
const center =
|
|
25
|
+
const rotationAxisIndex = store.use(_useChartPolarInteraction.selectorChartsInteractionRotationAxisIndex);
|
|
26
|
+
const rotationAxisValue = store.use(_useChartPolarInteraction.selectorChartsInteractionRotationAxisValue);
|
|
27
|
+
const center = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
29
28
|
const highlightedIndex = rotationAxisIndex;
|
|
30
29
|
if (!rotationScale) {
|
|
31
30
|
return null;
|
|
@@ -8,7 +8,6 @@ var _useScale = require("../../hooks/useScale");
|
|
|
8
8
|
var _hooks = require("../../hooks");
|
|
9
9
|
var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
10
10
|
var _useChartContext = require("../../context/ChartProvider/useChartContext");
|
|
11
|
-
var _useSelector = require("../../internals/store/useSelector");
|
|
12
11
|
function useRadarGridData() {
|
|
13
12
|
const {
|
|
14
13
|
instance,
|
|
@@ -21,7 +20,7 @@ function useRadarGridData() {
|
|
|
21
20
|
const {
|
|
22
21
|
cx,
|
|
23
22
|
cy
|
|
24
|
-
} =
|
|
23
|
+
} = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
25
24
|
if (!rotationScale || rotationScale.domain().length === 0) {
|
|
26
25
|
return null;
|
|
27
26
|
}
|
|
@@ -9,7 +9,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
10
10
|
var _getSVGPoint = require("../../internals/getSVGPoint");
|
|
11
11
|
var _coordinateTransformation = require("../../internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation");
|
|
12
|
-
var _useSelector = require("../../internals/store/useSelector");
|
|
13
12
|
var _getAxisIndex = require("../../internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex");
|
|
14
13
|
var _useStore = require("../../internals/store/useStore");
|
|
15
14
|
var _useSvgRef = require("../../hooks/useSvgRef");
|
|
@@ -22,7 +21,7 @@ function useRadarRotationIndex() {
|
|
|
22
21
|
const svgRef = (0, _useSvgRef.useSvgRef)();
|
|
23
22
|
const store = (0, _useStore.useStore)();
|
|
24
23
|
const rotationAxis = (0, _useAxis.useRotationAxis)();
|
|
25
|
-
const center =
|
|
24
|
+
const center = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
26
25
|
const rotationIndexGetter = React.useCallback(function rotationIndexGetter(event) {
|
|
27
26
|
const element = svgRef.current;
|
|
28
27
|
if (!element || !rotationAxis) {
|
|
@@ -11,7 +11,6 @@ var _styles = require("@mui/material/styles");
|
|
|
11
11
|
var _scatterClasses = require("./scatterClasses");
|
|
12
12
|
var _ChartProvider = require("../context/ChartProvider");
|
|
13
13
|
var _useScale = require("../hooks/useScale");
|
|
14
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
15
14
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
16
|
const MAX_POINTS_PER_PATH = 1000;
|
|
@@ -125,10 +124,10 @@ function BatchScatter(props) {
|
|
|
125
124
|
const {
|
|
126
125
|
store
|
|
127
126
|
} = (0, _ChartProvider.useChartContext)();
|
|
128
|
-
const isSeriesHighlighted =
|
|
129
|
-
const isSeriesFaded =
|
|
130
|
-
const seriesHighlightedItem =
|
|
131
|
-
const seriesUnfadedItem =
|
|
127
|
+
const isSeriesHighlighted = store.use(_useChartHighlight.selectorChartIsSeriesHighlighted, series.id);
|
|
128
|
+
const isSeriesFaded = store.use(_useChartHighlight.selectorChartIsSeriesFaded, series.id);
|
|
129
|
+
const seriesHighlightedItem = store.use(_useChartHighlight.selectorChartSeriesHighlightedItem, series.id);
|
|
130
|
+
const seriesUnfadedItem = store.use(_useChartHighlight.selectorChartSeriesUnfadedItem, series.id);
|
|
132
131
|
const highlightedModifier = 1.2;
|
|
133
132
|
const markerSize = series.markerSize * (isSeriesHighlighted ? highlightedModifier : 1);
|
|
134
133
|
const classes = (0, _scatterClasses.useUtilityClasses)(inClasses);
|
|
@@ -25,7 +25,7 @@ function FocusedScatterMark(props) {
|
|
|
25
25
|
yAxis,
|
|
26
26
|
yAxisIds
|
|
27
27
|
} = (0, _hooks.useYAxes)();
|
|
28
|
-
if (focusedItem === null || focusedItem.
|
|
28
|
+
if (focusedItem === null || focusedItem.type !== 'scatter' || !scatterSeries) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
const series = scatterSeries?.series[focusedItem.seriesId];
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -14,7 +14,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
14
14
|
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
15
15
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
16
16
|
var _useStore = require("../internals/store/useStore");
|
|
17
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
18
17
|
var _useItemHighlightedGetter = require("../hooks/useItemHighlightedGetter");
|
|
19
18
|
var _useChartClosestPoint = require("../internals/plugins/featurePlugins/useChartClosestPoint");
|
|
20
19
|
var _ScatterMarker = require("./ScatterMarker");
|
|
@@ -48,7 +47,7 @@ function Scatter(props) {
|
|
|
48
47
|
instance
|
|
49
48
|
} = (0, _ChartProvider.useChartContext)();
|
|
50
49
|
const store = (0, _useStore.useStore)();
|
|
51
|
-
const isVoronoiEnabled =
|
|
50
|
+
const isVoronoiEnabled = store.use(_useChartClosestPoint.selectorChartsIsVoronoiEnabled);
|
|
52
51
|
const skipInteractionHandlers = isVoronoiEnabled || series.disableHover;
|
|
53
52
|
const {
|
|
54
53
|
isFaded,
|
|
@@ -12,6 +12,7 @@ var _legend = _interopRequireDefault(require("./legend"));
|
|
|
12
12
|
var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
13
13
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
14
14
|
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
15
|
+
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
15
16
|
const scatterSeriesConfig = exports.scatterSeriesConfig = {
|
|
16
17
|
seriesProcessor: _seriesProcessor.default,
|
|
17
18
|
colorProcessor: _getColor.default,
|
|
@@ -20,5 +21,6 @@ const scatterSeriesConfig = exports.scatterSeriesConfig = {
|
|
|
20
21
|
tooltipItemPositionGetter: _tooltipPosition.default,
|
|
21
22
|
xExtremumGetter: _extremums.getExtremumX,
|
|
22
23
|
yExtremumGetter: _extremums.getExtremumY,
|
|
23
|
-
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default
|
|
24
|
+
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
|
|
25
|
+
keyboardFocusHandler: _keyboardFocusHandler.default
|
|
24
26
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { KeyboardFocusHandler } from "../../internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js";
|
|
2
|
+
declare const keyboardFocusHandler: KeyboardFocusHandler<'scatter', 'bar' | 'line' | 'scatter'>;
|
|
3
|
+
export default keyboardFocusHandler;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _commonNextFocusItem = require("../../internals/commonNextFocusItem");
|
|
8
|
+
const outSeriesTypes = new Set(['bar', 'line', 'scatter']);
|
|
9
|
+
const keyboardFocusHandler = event => {
|
|
10
|
+
switch (event.key) {
|
|
11
|
+
case 'ArrowRight':
|
|
12
|
+
return (0, _commonNextFocusItem.createGetNextIndexFocusedItem)(outSeriesTypes);
|
|
13
|
+
case 'ArrowLeft':
|
|
14
|
+
return (0, _commonNextFocusItem.createGetPreviousIndexFocusedItem)(outSeriesTypes);
|
|
15
|
+
case 'ArrowDown':
|
|
16
|
+
return (0, _commonNextFocusItem.createGetPreviousSeriesFocusedItem)(outSeriesTypes);
|
|
17
|
+
case 'ArrowUp':
|
|
18
|
+
return (0, _commonNextFocusItem.createGetNextSeriesFocusedItem)(outSeriesTypes);
|
|
19
|
+
default:
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = keyboardFocusHandler;
|
|
@@ -11,7 +11,7 @@ export interface BarLabelOwnerState {
|
|
|
11
11
|
layout: 'vertical' | 'horizontal';
|
|
12
12
|
classes?: Partial<BarLabelClasses>;
|
|
13
13
|
}
|
|
14
|
-
export type BarItem
|
|
14
|
+
export type BarItem = {
|
|
15
15
|
/**
|
|
16
16
|
* The series id of the bar.
|
|
17
17
|
*/
|
|
@@ -23,7 +23,7 @@ export type BarItem<V extends BarValueType | null = BarValueType | null> = {
|
|
|
23
23
|
/**
|
|
24
24
|
* The value of the data point.
|
|
25
25
|
*/
|
|
26
|
-
value:
|
|
26
|
+
value: BarValueType | null;
|
|
27
27
|
};
|
|
28
28
|
export type BarLabelContext = {
|
|
29
29
|
bar: {
|
|
@@ -39,4 +39,4 @@ export type BarLabelContext = {
|
|
|
39
39
|
width: number;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
export type BarLabelFunction
|
|
42
|
+
export type BarLabelFunction = (item: BarItem, context: BarLabelContext) => string | null | undefined;
|