@mui/x-charts 8.22.0 → 8.22.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/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/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
- package/CHANGELOG.md +101 -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/LineHighlightPlot.js +1 -2
- package/LineChart/MarkPlot.js +1 -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 +15 -20
- 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/Scatter.js +1 -2
- 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/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -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/LineHighlightPlot.js +1 -2
- package/esm/LineChart/MarkPlot.js +1 -2
- 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 +15 -20
- 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/Scatter.js +1 -2
- 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.js +3 -4
- package/esm/hooks/useInteractionItemProps.d.ts +3 -2
- package/esm/hooks/useInteractionItemProps.js +13 -2
- package/esm/hooks/useIsItemFocused.js +1 -2
- 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/index.d.ts +0 -1
- package/esm/internals/index.js +0 -1
- 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/useChartPolarAxis/useChartPolarAxis.js +6 -7
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
- 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/seriesSelectorOfType.js +2 -3
- package/esm/models/seriesType/config.d.ts +0 -2
- 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.js +3 -4
- package/hooks/useInteractionItemProps.d.ts +3 -2
- package/hooks/useInteractionItemProps.js +13 -2
- package/hooks/useIsItemFocused.js +1 -2
- 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/index.d.ts +0 -1
- package/internals/index.js +0 -12
- 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/useChartPolarAxis/useChartPolarAxis.js +6 -7
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
- package/internals/seriesSelectorOfType.js +2 -3
- package/models/seriesType/config.d.ts +0 -2
- package/package.json +1 -1
- package/esm/internals/store/useSelector.d.ts +0 -2
- package/esm/internals/store/useSelector.js +0 -2
- package/internals/store/useSelector.d.ts +0 -2
- package/internals/store/useSelector.js +0 -8
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
5
4
|
import { selectorChartsItemIsFocused } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
5
|
/**
|
|
7
6
|
* A hook to check if an item has the focus.
|
|
@@ -13,5 +12,5 @@ import { selectorChartsItemIsFocused } from "../internals/plugins/featurePlugins
|
|
|
13
12
|
*/
|
|
14
13
|
export function useIsItemFocused(item) {
|
|
15
14
|
const store = useStore();
|
|
16
|
-
return
|
|
15
|
+
return store.use(selectorChartsItemIsFocused, item);
|
|
17
16
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
5
4
|
import { selectorChartsIsFaded, selectorChartsIsHighlighted } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
6
5
|
/**
|
|
7
6
|
* A hook to check the highlighted state of the item.
|
|
@@ -14,8 +13,8 @@ import { selectorChartsIsFaded, selectorChartsIsHighlighted } from "../internals
|
|
|
14
13
|
*/
|
|
15
14
|
export function useItemHighlighted(item) {
|
|
16
15
|
const store = useStore();
|
|
17
|
-
const isHighlighted =
|
|
18
|
-
const isFaded =
|
|
16
|
+
const isHighlighted = store.use(selectorChartsIsHighlighted, item);
|
|
17
|
+
const isFaded = store.use(selectorChartsIsFaded, item);
|
|
19
18
|
return {
|
|
20
19
|
isHighlighted,
|
|
21
20
|
isFaded: !isHighlighted && isFaded
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
4
3
|
import { useStore } from "../internals/store/useStore.js";
|
|
5
4
|
import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback } from "../internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js";
|
|
6
5
|
/**
|
|
@@ -13,8 +12,8 @@ import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback } fr
|
|
|
13
12
|
*/
|
|
14
13
|
export function useItemHighlightedGetter() {
|
|
15
14
|
const store = useStore();
|
|
16
|
-
const isHighlighted =
|
|
17
|
-
const isFaded =
|
|
15
|
+
const isHighlighted = store.use(selectorChartsIsHighlightedCallback);
|
|
16
|
+
const isFaded = store.use(selectorChartsIsFadedCallback);
|
|
18
17
|
return {
|
|
19
18
|
isHighlighted,
|
|
20
19
|
isFaded
|
package/esm/hooks/useLegend.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { selectorChartSeriesConfig } from "../internals/plugins/corePlugins/useChartSeries/index.js";
|
|
4
4
|
import { useSeries } from "./useSeries.js";
|
|
5
5
|
import { useStore } from "../internals/store/useStore.js";
|
|
6
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
7
6
|
function getSeriesToDisplay(series, seriesConfig) {
|
|
8
7
|
return Object.keys(series).flatMap(seriesType => {
|
|
9
8
|
const getter = seriesConfig[seriesType].legendGetter;
|
|
@@ -23,7 +22,7 @@ function getSeriesToDisplay(series, seriesConfig) {
|
|
|
23
22
|
export function useLegend() {
|
|
24
23
|
const series = useSeries();
|
|
25
24
|
const store = useStore();
|
|
26
|
-
const seriesConfig =
|
|
25
|
+
const seriesConfig = store.use(selectorChartSeriesConfig);
|
|
27
26
|
return {
|
|
28
27
|
items: getSeriesToDisplay(series, seriesConfig)
|
|
29
28
|
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { useSeriesOfType, useAllSeriesOfType } from "../internals/seriesSelectorOfType.js";
|
|
4
4
|
import { useStore } from "../internals/store/useStore.js";
|
|
5
5
|
import { selectorChartSeriesLayout } from "../internals/plugins/corePlugins/useChartSeries/index.js";
|
|
6
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Get access to the internal state of pie series.
|
|
@@ -48,6 +47,6 @@ export function usePieSeriesContext() {
|
|
|
48
47
|
*/
|
|
49
48
|
export function usePieSeriesLayout() {
|
|
50
49
|
const store = useStore();
|
|
51
|
-
const seriesLayout =
|
|
50
|
+
const seriesLayout = store.use(selectorChartSeriesLayout);
|
|
52
51
|
return seriesLayout.pie ?? {};
|
|
53
52
|
}
|
package/esm/hooks/useSeries.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
5
4
|
import { selectorChartSeriesProcessed } from "../internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js";
|
|
6
5
|
/**
|
|
7
6
|
* Get access to the internal state of series.
|
|
@@ -11,5 +10,5 @@ import { selectorChartSeriesProcessed } from "../internals/plugins/corePlugins/u
|
|
|
11
10
|
*/
|
|
12
11
|
export function useSeries() {
|
|
13
12
|
const store = useStore();
|
|
14
|
-
return
|
|
13
|
+
return store.use(selectorChartSeriesProcessed);
|
|
15
14
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { selectorChartSkipAnimation } from "../internals/plugins/corePlugins/useChartAnimation/index.js";
|
|
4
4
|
import { useStore } from "../internals/store/useStore.js";
|
|
5
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* A hook to get if chart animations should be skipped.
|
|
@@ -11,6 +10,6 @@ import { useSelector } from "../internals/store/useSelector.js";
|
|
|
11
10
|
*/
|
|
12
11
|
export function useSkipAnimation(skipAnimation) {
|
|
13
12
|
const store = useStore();
|
|
14
|
-
const storeSkipAnimation =
|
|
13
|
+
const storeSkipAnimation = store.use(selectorChartSkipAnimation);
|
|
15
14
|
return skipAnimation || storeSkipAnimation;
|
|
16
15
|
}
|
package/esm/hooks/useZAxis.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { useStore } from "../internals/store/useStore.js";
|
|
4
4
|
import { selectorChartZAxis } from "../internals/plugins/featurePlugins/useChartZAxis/index.js";
|
|
5
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
6
5
|
export function useZAxes() {
|
|
7
6
|
const store = useStore();
|
|
8
7
|
const {
|
|
9
8
|
axis: zAxis,
|
|
10
9
|
axisIds: zAxisIds
|
|
11
|
-
} =
|
|
10
|
+
} = store.use(selectorChartZAxis) ?? {
|
|
12
11
|
axis: {},
|
|
13
12
|
axisIds: []
|
|
14
13
|
};
|
package/esm/index.js
CHANGED
package/esm/internals/index.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugi
|
|
|
37
37
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
|
38
38
|
export * from "./store/useCharts.js";
|
|
39
39
|
export * from "./store/useStore.js";
|
|
40
|
-
export * from "./store/useSelector.js";
|
|
41
40
|
export * from "../BarChart/BarChart.plugins.js";
|
|
42
41
|
export * from "../LineChart/LineChart.plugins.js";
|
|
43
42
|
export * from "../ScatterChart/ScatterChart.plugins.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -42,7 +42,6 @@ export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugi
|
|
|
42
42
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
|
43
43
|
export * from "./store/useCharts.js";
|
|
44
44
|
export * from "./store/useStore.js";
|
|
45
|
-
export * from "./store/useSelector.js";
|
|
46
45
|
|
|
47
46
|
// plugins configs
|
|
48
47
|
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import { useEffectAfterFirstRender } from '@mui/x-internals/useEffectAfterFirstRender';
|
|
6
6
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
7
7
|
import ownerWindow from '@mui/utils/ownerWindow';
|
|
8
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
9
8
|
import { DEFAULT_MARGINS } from "../../../../constants/index.js";
|
|
10
9
|
import { selectorChartDrawingArea } from "./useChartDimensions.selectors.js";
|
|
11
10
|
import { defaultizeMargin } from "../../../defaultizeMargin.js";
|
|
@@ -136,7 +135,7 @@ export const useChartDimensions = ({
|
|
|
136
135
|
stateRef.current.displayError = false;
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
|
-
const drawingArea =
|
|
138
|
+
const drawingArea = store.use(selectorChartDrawingArea);
|
|
140
139
|
const isXInside = React.useCallback(x => x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width, [drawingArea.left, drawingArea.width]);
|
|
141
140
|
const isYInside = React.useCallback(y => y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height, [drawingArea.height, drawingArea.top]);
|
|
142
141
|
const isPointInside = React.useCallback((x, y, targetElement) => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
5
4
|
import { useStore } from "../../../store/useStore.js";
|
|
6
5
|
import { selectorChartSeriesConfig } from "./useChartSeries.selectors.js";
|
|
7
6
|
export function useColorProcessor(seriesType) {
|
|
8
7
|
const store = useStore();
|
|
9
|
-
const seriesConfig =
|
|
8
|
+
const seriesConfig = store.use(selectorChartSeriesConfig);
|
|
10
9
|
const colorProcessors = React.useMemo(() => {
|
|
11
10
|
const rep = {};
|
|
12
11
|
Object.keys(seriesConfig).forEach(seriesT => {
|
|
@@ -5,7 +5,6 @@ import useEventCallback from '@mui/utils/useEventCallback';
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
7
7
|
import { getSVGPoint } from "../../../getSVGPoint.js";
|
|
8
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
9
8
|
import { selectorIsBrushEnabled } from "./useChartBrush.selectors.js";
|
|
10
9
|
export const useChartBrush = ({
|
|
11
10
|
store,
|
|
@@ -13,7 +12,7 @@ export const useChartBrush = ({
|
|
|
13
12
|
instance,
|
|
14
13
|
params
|
|
15
14
|
}) => {
|
|
16
|
-
const isEnabled =
|
|
15
|
+
const isEnabled = store.use(selectorIsBrushEnabled);
|
|
17
16
|
useEnhancedEffect(() => {
|
|
18
17
|
store.set('brush', _extends({}, store.state.brush, {
|
|
19
18
|
enabled: params.brushConfig.enabled,
|
|
@@ -7,7 +7,6 @@ import { useStoreEffect } from '@mui/x-internals/store';
|
|
|
7
7
|
import { useAssertModelConsistency } from '@mui/x-internals/useAssertModelConsistency';
|
|
8
8
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
9
9
|
import { rainbowSurgePalette } from "../../../../colorPalettes/index.js";
|
|
10
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
11
10
|
import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/useChartDimensions.selectors.js";
|
|
12
11
|
import { selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/useChartSeries.selectors.js";
|
|
13
12
|
import { defaultizeXAxis, defaultizeYAxis } from "./defaultizeAxis.js";
|
|
@@ -37,17 +36,17 @@ export const useChartCartesianAxis = ({
|
|
|
37
36
|
warnOnce([`MUI X Charts: The following axis ids are duplicated: ${Array.from(duplicates).join(', ')}.`, `Please make sure that each axis has a unique id.`].join('\n'), 'error');
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
const drawingArea =
|
|
41
|
-
const processedSeries =
|
|
42
|
-
const isInteractionEnabled =
|
|
39
|
+
const drawingArea = store.use(selectorChartDrawingArea);
|
|
40
|
+
const processedSeries = store.use(selectorChartSeriesProcessed);
|
|
41
|
+
const isInteractionEnabled = store.use(selectorChartsInteractionIsInitialized);
|
|
43
42
|
const {
|
|
44
43
|
axis: xAxisWithScale,
|
|
45
44
|
axisIds: xAxisIds
|
|
46
|
-
} =
|
|
45
|
+
} = store.use(selectorChartXAxis);
|
|
47
46
|
const {
|
|
48
47
|
axis: yAxisWithScale,
|
|
49
48
|
axisIds: yAxisIds
|
|
50
|
-
} =
|
|
49
|
+
} = store.use(selectorChartYAxis);
|
|
51
50
|
useAssertModelConsistency({
|
|
52
51
|
warningPrefix: 'MUI X Charts',
|
|
53
52
|
componentName: 'Chart',
|
package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
4
3
|
import { useStore } from "../../../store/useStore.js";
|
|
5
4
|
import { selectorChartZoomIsInteracting } from "./useChartCartesianAxisRendering.selectors.js";
|
|
6
5
|
/**
|
|
@@ -14,6 +13,6 @@ import { selectorChartZoomIsInteracting } from "./useChartCartesianAxisRendering
|
|
|
14
13
|
*/
|
|
15
14
|
export function useInternalIsZoomInteracting() {
|
|
16
15
|
const store = useStore();
|
|
17
|
-
const isInteracting =
|
|
16
|
+
const isInteracting = store.use(selectorChartZoomIsInteracting);
|
|
18
17
|
return isInteracting;
|
|
19
18
|
}
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import { getSVGPoint } from "../../../getSVGPoint.js";
|
|
8
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
9
8
|
import { selectorChartAxisZoomData, selectorChartSeriesEmptyFlatbushMap, selectorChartSeriesFlatbushMap, selectorChartXAxis, selectorChartYAxis, selectorChartZoomIsInteracting } from "../useChartCartesianAxis/index.js";
|
|
10
9
|
import { selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/useChartSeries.selectors.js";
|
|
11
10
|
import { findClosestPoints } from "./findClosestPoints.js";
|
|
@@ -23,17 +22,17 @@ export const useChartClosestPoint = ({
|
|
|
23
22
|
const {
|
|
24
23
|
axis: xAxis,
|
|
25
24
|
axisIds: xAxisIds
|
|
26
|
-
} =
|
|
25
|
+
} = store.use(selectorChartXAxis);
|
|
27
26
|
const {
|
|
28
27
|
axis: yAxis,
|
|
29
28
|
axisIds: yAxisIds
|
|
30
|
-
} =
|
|
31
|
-
const zoomIsInteracting =
|
|
29
|
+
} = store.use(selectorChartYAxis);
|
|
30
|
+
const zoomIsInteracting = store.use(selectorChartZoomIsInteracting);
|
|
32
31
|
const {
|
|
33
32
|
series,
|
|
34
33
|
seriesOrder
|
|
35
|
-
} =
|
|
36
|
-
const flatbushMap =
|
|
34
|
+
} = store.use(selectorChartSeriesProcessed)?.scatter ?? {};
|
|
35
|
+
const flatbushMap = store.use(zoomIsInteracting ? selectorChartSeriesEmptyFlatbushMap : selectorChartSeriesFlatbushMap);
|
|
37
36
|
const defaultXAxisId = xAxisIds[0];
|
|
38
37
|
const defaultYAxisId = yAxisIds[0];
|
|
39
38
|
useEnhancedEffect(() => {
|
|
@@ -41,10 +41,13 @@ export const useChartHighlight = ({
|
|
|
41
41
|
});
|
|
42
42
|
const setHighlight = useEventCallback(newItem => {
|
|
43
43
|
const prevHighlight = store.state.highlight;
|
|
44
|
-
if (
|
|
44
|
+
if (fastObjectShallowCompare(prevHighlight.item, newItem)) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
params.onHighlightChange?.(newItem);
|
|
48
|
+
if (prevHighlight.isControlled) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
48
51
|
store.set('highlight', {
|
|
49
52
|
item: newItem,
|
|
50
53
|
lastUpdate: 'pointer',
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
6
|
-
import { useSelector } from "../../../store/useSelector.js";
|
|
7
6
|
import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/useChartDimensions.selectors.js";
|
|
8
7
|
import { defaultizeAxis } from "./defaultizeAxis.js";
|
|
9
8
|
import { selectorChartsInteractionIsInitialized } from "../useChartInteraction/index.js";
|
|
@@ -32,18 +31,18 @@ export const useChartPolarAxis = ({
|
|
|
32
31
|
warnOnce([`MUI X Charts: The following axis ids are duplicated: ${Array.from(duplicates).join(', ')}.`, `Please make sure that each axis has a unique id.`].join('\n'), 'error');
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
const drawingArea =
|
|
36
|
-
const processedSeries =
|
|
37
|
-
const center =
|
|
38
|
-
const isInteractionEnabled =
|
|
34
|
+
const drawingArea = store.use(selectorChartDrawingArea);
|
|
35
|
+
const processedSeries = store.use(selectorChartSeriesProcessed);
|
|
36
|
+
const center = store.use(selectorChartPolarCenter);
|
|
37
|
+
const isInteractionEnabled = store.use(selectorChartsInteractionIsInitialized);
|
|
39
38
|
const {
|
|
40
39
|
axis: rotationAxisWithScale,
|
|
41
40
|
axisIds: rotationAxisIds
|
|
42
|
-
} =
|
|
41
|
+
} = store.use(selectorChartRotationAxis);
|
|
43
42
|
const {
|
|
44
43
|
axis: radiusAxisWithScale,
|
|
45
44
|
axisIds: radiusAxisIds
|
|
46
|
-
} =
|
|
45
|
+
} = store.use(selectorChartRadiusAxis);
|
|
47
46
|
|
|
48
47
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useChartPolarAxis`
|
|
49
48
|
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import type { ChartPluginSignature } from "../../models/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
3
|
+
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
3
4
|
export interface UseChartTooltipInstance {
|
|
4
5
|
/**
|
|
5
6
|
* Setter for the item the user is pointing at.
|
|
6
|
-
* @param {
|
|
7
|
+
* @param {SeriesItemIdentifier} newItem The identifier of the item.
|
|
7
8
|
*/
|
|
8
|
-
setTooltipItem: (newItem:
|
|
9
|
+
setTooltipItem: (newItem: SeriesItemIdentifier<ChartSeriesType>) => void;
|
|
9
10
|
/**
|
|
10
11
|
* Remove the item the user was pointing at.
|
|
11
12
|
* - If `itemToRemove` is provided, it removes the item only if it matches the current one.
|
|
12
13
|
* Otherwise it assumes the item got already updated and does nothing.
|
|
13
14
|
* - If `itemToRemove` is not provided, it removes the current item unconditionally.
|
|
14
|
-
* @param {
|
|
15
|
+
* @param {SeriesItemIdentifier} itemToRemove The identifier of the item.
|
|
15
16
|
*/
|
|
16
|
-
removeTooltipItem: (itemToRemove?:
|
|
17
|
+
removeTooltipItem: (itemToRemove?: SeriesItemIdentifier<ChartSeriesType>) => void;
|
|
17
18
|
}
|
|
18
19
|
export interface UseChartTooltipState {
|
|
19
20
|
tooltip: {
|
|
20
21
|
/**
|
|
21
22
|
* The item currently under the pointer.
|
|
22
23
|
*/
|
|
23
|
-
item: null |
|
|
24
|
+
item: null | SeriesItemIdentifier<ChartSeriesType>;
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
export type UseChartTooltipSignature = ChartPluginSignature<{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
2
|
+
import type { ChartSeriesDefaultized, ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
|
|
2
3
|
import { type SeriesId } from "../../../../models/seriesType/common.js";
|
|
3
4
|
import { type AxisId, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type PolarAxisDefaultized, type ComputedXAxis, type ComputedYAxis } from "../../../../models/axis.js";
|
|
4
5
|
import { type ChartsLabelMarkProps } from "../../../../ChartsLabel/ChartsLabelMark.js";
|
|
@@ -7,7 +8,7 @@ export interface ItemTooltip<T extends ChartSeriesType> {
|
|
|
7
8
|
/**
|
|
8
9
|
* An object that identifies the item to display.
|
|
9
10
|
*/
|
|
10
|
-
identifier:
|
|
11
|
+
identifier: SeriesItemIdentifier<T>;
|
|
11
12
|
/**
|
|
12
13
|
* The color associated with the item.
|
|
13
14
|
*/
|
|
@@ -59,7 +60,7 @@ export type TooltipGetter<TSeriesType extends ChartSeriesType> = (params: {
|
|
|
59
60
|
series: ChartSeriesDefaultized<TSeriesType>;
|
|
60
61
|
axesConfig: TooltipGetterAxesConfig;
|
|
61
62
|
getColor: ColorGetter<TSeriesType>;
|
|
62
|
-
identifier:
|
|
63
|
+
identifier: SeriesItemIdentifier<TSeriesType> | null;
|
|
63
64
|
}) => (TSeriesType extends 'radar' ? ItemTooltipWithMultipleValues<TSeriesType> : ItemTooltip<TSeriesType>) | null;
|
|
64
65
|
/**
|
|
65
66
|
* If `axisId` is set to undefined, the default axis will be used.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
2
|
+
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
2
3
|
import { type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type ComputedXAxis, type ComputedYAxis } from "../../../../models/axis.js";
|
|
3
4
|
import { type ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
|
|
4
5
|
import { type ProcessedSeries, type SeriesLayout } from "../../corePlugins/useChartSeries/index.js";
|
|
@@ -13,7 +14,7 @@ export type TooltipItemPositionGetter<TSeriesType extends ChartSeriesType> = (pa
|
|
|
13
14
|
series: ProcessedSeries<TSeriesType>;
|
|
14
15
|
axesConfig: TooltipPositionGetterAxesConfig;
|
|
15
16
|
drawingArea: ChartDrawingArea;
|
|
16
|
-
identifier:
|
|
17
|
+
identifier: SeriesItemIdentifier<TSeriesType> | null;
|
|
17
18
|
seriesLayout: SeriesLayout<TSeriesType>;
|
|
18
19
|
/**
|
|
19
20
|
* The preferred placement of the tooltip related to the element.
|
|
@@ -2,7 +2,6 @@ import { warnOnce } from '@mui/x-internals/warning';
|
|
|
2
2
|
import { createSelector, createSelectorMemoized } from '@mui/x-internals/store';
|
|
3
3
|
import { selectorChartSeriesProcessed } from "./plugins/corePlugins/useChartSeries/useChartSeries.selectors.js";
|
|
4
4
|
import { useStore } from "./store/useStore.js";
|
|
5
|
-
import { useSelector } from "./store/useSelector.js";
|
|
6
5
|
export const selectorAllSeriesOfType = createSelector(selectorChartSeriesProcessed, (processedSeries, seriesType) => processedSeries[seriesType]);
|
|
7
6
|
export const selectorSeriesOfType = createSelectorMemoized(selectorChartSeriesProcessed, (processedSeries, seriesType, ids) => {
|
|
8
7
|
if (ids === undefined || Array.isArray(ids) && ids.length === 0) {
|
|
@@ -30,9 +29,9 @@ export const selectorSeriesOfType = createSelectorMemoized(selectorChartSeriesPr
|
|
|
30
29
|
});
|
|
31
30
|
export const useAllSeriesOfType = seriesType => {
|
|
32
31
|
const store = useStore();
|
|
33
|
-
return
|
|
32
|
+
return store.use(selectorAllSeriesOfType, seriesType);
|
|
34
33
|
};
|
|
35
34
|
export const useSeriesOfType = (seriesType, seriesId) => {
|
|
36
35
|
const store = useStore();
|
|
37
|
-
return
|
|
36
|
+
return store.use(selectorSeriesOfType, seriesType, seriesId);
|
|
38
37
|
};
|
|
@@ -90,8 +90,6 @@ export type ChartSeriesDefaultized<T extends ChartSeriesType> = ChartsSeriesConf
|
|
|
90
90
|
stackedData: [number, number][];
|
|
91
91
|
} : ChartsSeriesConfig[T]['series'];
|
|
92
92
|
export type ChartSeriesLayout<T extends ChartSeriesType> = ChartsSeriesConfig[T] extends any ? ChartsSeriesConfig[T]['seriesLayout'] : never;
|
|
93
|
-
export type ChartItemIdentifier<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
94
|
-
export type ChartItemIdentifierWithData<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
|
|
95
93
|
export type DatasetElementType<T> = {
|
|
96
94
|
[key: string]: T;
|
|
97
95
|
};
|
package/hooks/useAxis.js
CHANGED
|
@@ -14,7 +14,6 @@ exports.useYAxes = useYAxes;
|
|
|
14
14
|
exports.useYAxis = useYAxis;
|
|
15
15
|
var _useChartCartesianAxisRendering = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
|
|
16
16
|
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
17
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
18
17
|
var _useStore = require("../internals/store/useStore");
|
|
19
18
|
/**
|
|
20
19
|
* Get all the x-axes.
|
|
@@ -36,7 +35,7 @@ function useXAxes() {
|
|
|
36
35
|
const {
|
|
37
36
|
axis: xAxis,
|
|
38
37
|
axisIds: xAxisIds
|
|
39
|
-
} =
|
|
38
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartXAxis);
|
|
40
39
|
return {
|
|
41
40
|
xAxis,
|
|
42
41
|
xAxisIds
|
|
@@ -63,7 +62,7 @@ function useYAxes() {
|
|
|
63
62
|
const {
|
|
64
63
|
axis: yAxis,
|
|
65
64
|
axisIds: yAxisIds
|
|
66
|
-
} =
|
|
65
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartYAxis);
|
|
67
66
|
return {
|
|
68
67
|
yAxis,
|
|
69
68
|
yAxisIds
|
|
@@ -91,7 +90,7 @@ function useXAxis(axisId) {
|
|
|
91
90
|
const {
|
|
92
91
|
axis: xAxis,
|
|
93
92
|
axisIds: xAxisIds
|
|
94
|
-
} =
|
|
93
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartXAxis);
|
|
95
94
|
const id = axisId ?? xAxisIds[0];
|
|
96
95
|
return xAxis[id];
|
|
97
96
|
}
|
|
@@ -117,7 +116,7 @@ function useYAxis(axisId) {
|
|
|
117
116
|
const {
|
|
118
117
|
axis: yAxis,
|
|
119
118
|
axisIds: yAxisIds
|
|
120
|
-
} =
|
|
119
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartYAxis);
|
|
121
120
|
const id = axisId ?? yAxisIds[0];
|
|
122
121
|
return yAxis[id];
|
|
123
122
|
}
|
|
@@ -142,7 +141,7 @@ function useRotationAxes() {
|
|
|
142
141
|
const {
|
|
143
142
|
axis: rotationAxis,
|
|
144
143
|
axisIds: rotationAxisIds
|
|
145
|
-
} =
|
|
144
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
146
145
|
return {
|
|
147
146
|
rotationAxis,
|
|
148
147
|
rotationAxisIds
|
|
@@ -169,7 +168,7 @@ function useRadiusAxes() {
|
|
|
169
168
|
const {
|
|
170
169
|
axis: radiusAxis,
|
|
171
170
|
axisIds: radiusAxisIds
|
|
172
|
-
} =
|
|
171
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
173
172
|
return {
|
|
174
173
|
radiusAxis,
|
|
175
174
|
radiusAxisIds
|
|
@@ -200,7 +199,7 @@ function useRotationAxis(axisId) {
|
|
|
200
199
|
const {
|
|
201
200
|
axis: rotationAxis,
|
|
202
201
|
axisIds: rotationAxisIds
|
|
203
|
-
} =
|
|
202
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
204
203
|
const id = axisId ?? rotationAxisIds[0];
|
|
205
204
|
return rotationAxis[id];
|
|
206
205
|
}
|
|
@@ -229,7 +228,7 @@ function useRadiusAxis(axisId) {
|
|
|
229
228
|
const {
|
|
230
229
|
axis: radiusAxis,
|
|
231
230
|
axisIds: radiusAxisIds
|
|
232
|
-
} =
|
|
231
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
233
232
|
const id = axisId ?? radiusAxisIds[0];
|
|
234
233
|
return radiusAxis[id];
|
|
235
234
|
}
|
package/hooks/useAxisSystem.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useAxisSystem = useAxisSystem;
|
|
8
8
|
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
9
9
|
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
10
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
11
10
|
var _useStore = require("../internals/store/useStore");
|
|
12
11
|
/**
|
|
13
12
|
* @internals
|
|
@@ -18,8 +17,8 @@ var _useStore = require("../internals/store/useStore");
|
|
|
18
17
|
*/
|
|
19
18
|
function useAxisSystem() {
|
|
20
19
|
const store = (0, _useStore.useStore)();
|
|
21
|
-
const rawRotationAxis =
|
|
22
|
-
const rawXAxis =
|
|
20
|
+
const rawRotationAxis = store.use(_useChartPolarAxis.selectorChartRawRotationAxis);
|
|
21
|
+
const rawXAxis = store.use(_useChartCartesianAxis.selectorChartRawXAxis);
|
|
23
22
|
if (rawRotationAxis !== undefined) {
|
|
24
23
|
return 'polar';
|
|
25
24
|
}
|
package/hooks/useBrush.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useBrush = useBrush;
|
|
7
7
|
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
8
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
9
8
|
var _useStore = require("../internals/store/useStore");
|
|
10
9
|
/**
|
|
11
10
|
* Get the current brush state.
|
|
@@ -17,5 +16,5 @@ var _useStore = require("../internals/store/useStore");
|
|
|
17
16
|
*/
|
|
18
17
|
function useBrush() {
|
|
19
18
|
const store = (0, _useStore.useStore)();
|
|
20
|
-
return
|
|
19
|
+
return store.use(_useChartBrush.selectorBrushState);
|
|
21
20
|
}
|
package/hooks/useChartId.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useChartId = useChartId;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartId = require("../internals/plugins/corePlugins/useChartId/useChartId.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get the unique identifier of the chart.
|
|
@@ -14,5 +13,5 @@ var _useChartId = require("../internals/plugins/corePlugins/useChartId/useChartI
|
|
|
14
13
|
*/
|
|
15
14
|
function useChartId() {
|
|
16
15
|
const store = (0, _useStore.useStore)();
|
|
17
|
-
return
|
|
16
|
+
return store.use(_useChartId.selectorChartId);
|
|
18
17
|
}
|
package/hooks/useDataset.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDataset = useDataset;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get access to the dataset used to populate series and axes data.
|
|
@@ -14,5 +13,5 @@ var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/u
|
|
|
14
13
|
*/
|
|
15
14
|
function useDataset() {
|
|
16
15
|
const store = (0, _useStore.useStore)();
|
|
17
|
-
return
|
|
16
|
+
return store.use(_useChartSeries.selectorChartDataset);
|
|
18
17
|
}
|
package/hooks/useDrawingArea.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDrawingArea = useDrawingArea;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
11
10
|
/**
|
|
12
11
|
* Get the drawing area dimensions and coordinates. The drawing area is the area where the chart is rendered.
|
|
@@ -17,5 +16,5 @@ var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDime
|
|
|
17
16
|
*/
|
|
18
17
|
function useDrawingArea() {
|
|
19
18
|
const store = (0, _useStore.useStore)();
|
|
20
|
-
return
|
|
19
|
+
return store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
21
20
|
}
|
package/hooks/useFocusedItem.js
CHANGED
|
@@ -8,16 +8,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useFocusedItem = useFocusedItem;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useStore = require("../internals/store/useStore");
|
|
11
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
12
11
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
13
12
|
/**
|
|
14
13
|
* Get the focused item from keyboard navigation.
|
|
15
14
|
*/
|
|
16
15
|
function useFocusedItem() {
|
|
17
16
|
const store = (0, _useStore.useStore)();
|
|
18
|
-
const focusedSeriesType =
|
|
19
|
-
const focusedSeriesId =
|
|
20
|
-
const focusedDataIndex =
|
|
17
|
+
const focusedSeriesType = store.use(_useChartKeyboardNavigation.selectorChartsFocusedSeriesType);
|
|
18
|
+
const focusedSeriesId = store.use(_useChartKeyboardNavigation.selectorChartsFocusedSeriesId);
|
|
19
|
+
const focusedDataIndex = store.use(_useChartKeyboardNavigation.selectorChartsFocusedDataIndex);
|
|
21
20
|
return React.useMemo(() => focusedSeriesType === undefined || focusedSeriesId === undefined || focusedDataIndex === undefined ? null : {
|
|
22
21
|
seriesType: focusedSeriesType,
|
|
23
22
|
seriesId: focusedSeriesId,
|