@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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
|
6
|
+
import { useFocusedItem } from "../hooks/useFocusedItem.js";
|
|
7
|
+
import { usePieSeriesContext, usePieSeriesLayout } from "../hooks/usePieSeries.js";
|
|
8
|
+
import { PieArc, pieArcClasses } from "./PieArc.js";
|
|
9
|
+
import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
|
|
10
|
+
import { getModifiedArcProperties } from "./dataTransform/getModifiedArcProperties.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export function FocusedPieArc(props) {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const focusedItem = useFocusedItem();
|
|
15
|
+
const pieSeriesLayout = usePieSeriesLayout();
|
|
16
|
+
const {
|
|
17
|
+
isHighlighted,
|
|
18
|
+
isFaded
|
|
19
|
+
} = useItemHighlighted(focusedItem);
|
|
20
|
+
const pieSeries = usePieSeriesContext();
|
|
21
|
+
if (focusedItem === null || focusedItem.seriesType !== 'pie' || !pieSeries) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const series = pieSeries?.series[focusedItem.seriesId];
|
|
25
|
+
const {
|
|
26
|
+
center,
|
|
27
|
+
radius
|
|
28
|
+
} = pieSeriesLayout[focusedItem.seriesId];
|
|
29
|
+
if (!series || !center || !radius) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const item = series.data[focusedItem.dataIndex];
|
|
33
|
+
const arcSizes = getModifiedArcProperties(series, pieSeriesLayout[focusedItem.seriesId], isHighlighted, isFaded);
|
|
34
|
+
return /*#__PURE__*/_jsx(PieArc, _extends({
|
|
35
|
+
transform: `translate(${pieSeriesLayout[series.id].center.x}, ${pieSeriesLayout[series.id].center.y})`,
|
|
36
|
+
startAngle: item.startAngle,
|
|
37
|
+
endAngle: item.endAngle,
|
|
38
|
+
color: "transparent",
|
|
39
|
+
pointerEvents: "none",
|
|
40
|
+
skipInteraction: true,
|
|
41
|
+
skipAnimation: true,
|
|
42
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
43
|
+
id: series.id,
|
|
44
|
+
className: pieArcClasses.focusIndicator,
|
|
45
|
+
dataIndex: focusedItem.dataIndex,
|
|
46
|
+
isFaded: false,
|
|
47
|
+
isHighlighted: false,
|
|
48
|
+
isFocused: false,
|
|
49
|
+
strokeWidth: 3
|
|
50
|
+
}, arcSizes, props));
|
|
51
|
+
}
|
|
@@ -5,11 +5,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlighted", "faded", "data", "onItemClick", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import {
|
|
9
|
-
import { useFocusedItem } from "../hooks/useFocusedItem.js";
|
|
10
|
-
import { PieArc, pieArcClasses } from "./PieArc.js";
|
|
8
|
+
import { PieArc } from "./PieArc.js";
|
|
11
9
|
import { useTransformData } from "./dataTransform/useTransformData.js";
|
|
12
|
-
import { jsx as _jsx
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
11
|
function PieArcPlot(props) {
|
|
14
12
|
const {
|
|
15
13
|
slots,
|
|
@@ -28,7 +26,6 @@ function PieArcPlot(props) {
|
|
|
28
26
|
skipAnimation
|
|
29
27
|
} = props,
|
|
30
28
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
-
const theme = useTheme();
|
|
32
29
|
const transformedData = useTransformData({
|
|
33
30
|
innerRadius,
|
|
34
31
|
outerRadius,
|
|
@@ -39,18 +36,12 @@ function PieArcPlot(props) {
|
|
|
39
36
|
faded,
|
|
40
37
|
data
|
|
41
38
|
});
|
|
42
|
-
const {
|
|
43
|
-
dataIndex,
|
|
44
|
-
seriesId,
|
|
45
|
-
seriesType
|
|
46
|
-
} = useFocusedItem() ?? {};
|
|
47
|
-
const focusedItem = dataIndex !== undefined && seriesId === id && seriesType === 'pie' ? transformedData[dataIndex] : null;
|
|
48
39
|
if (data.length === 0) {
|
|
49
40
|
return null;
|
|
50
41
|
}
|
|
51
42
|
const Arc = slots?.pieArc ?? PieArc;
|
|
52
|
-
return /*#__PURE__*/
|
|
53
|
-
children:
|
|
43
|
+
return /*#__PURE__*/_jsx("g", _extends({}, other, {
|
|
44
|
+
children: transformedData.map((item, index) => /*#__PURE__*/_jsx(Arc, _extends({
|
|
54
45
|
startAngle: item.startAngle,
|
|
55
46
|
endAngle: item.endAngle,
|
|
56
47
|
paddingAngle: item.paddingAngle,
|
|
@@ -71,26 +62,7 @@ function PieArcPlot(props) {
|
|
|
71
62
|
dataIndex: index
|
|
72
63
|
}, item);
|
|
73
64
|
})
|
|
74
|
-
}, slotProps?.pieArc), item.dataIndex))
|
|
75
|
-
startAngle: focusedItem.startAngle,
|
|
76
|
-
endAngle: focusedItem.endAngle,
|
|
77
|
-
paddingAngle: focusedItem.paddingAngle,
|
|
78
|
-
innerRadius: focusedItem.innerRadius,
|
|
79
|
-
color: "transparent",
|
|
80
|
-
pointerEvents: "none",
|
|
81
|
-
skipInteraction: true,
|
|
82
|
-
outerRadius: focusedItem.outerRadius,
|
|
83
|
-
cornerRadius: focusedItem.cornerRadius,
|
|
84
|
-
skipAnimation: true,
|
|
85
|
-
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
86
|
-
id: id,
|
|
87
|
-
className: pieArcClasses.focusIndicator,
|
|
88
|
-
dataIndex: focusedItem.dataIndex,
|
|
89
|
-
isFaded: false,
|
|
90
|
-
isHighlighted: false,
|
|
91
|
-
isFocused: false,
|
|
92
|
-
strokeWidth: 3
|
|
93
|
-
})]
|
|
65
|
+
}, slotProps?.pieArc), item.dataIndex))
|
|
94
66
|
}));
|
|
95
67
|
}
|
|
96
68
|
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -17,6 +17,7 @@ import { useChartContainerProps } from "../ChartContainer/useChartContainerProps
|
|
|
17
17
|
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
18
18
|
import { PIE_CHART_PLUGINS } from "./PieChart.plugins.js";
|
|
19
19
|
import { defaultizeMargin } from "../internals/defaultizeMargin.js";
|
|
20
|
+
import { FocusedPieArc } from "./FocusedPieArc.js";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
/**
|
|
22
23
|
* Demos:
|
|
@@ -88,7 +89,7 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
88
89
|
slots: slots,
|
|
89
90
|
slotProps: slotProps,
|
|
90
91
|
onItemClick: onItemClick
|
|
91
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
92
|
+
}), /*#__PURE__*/_jsx(FocusedPieArc, {}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
92
93
|
loading: loading,
|
|
93
94
|
slots: slots,
|
|
94
95
|
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,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { deg2rad } from "../../internals/angleConversion.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Function that returns arc properties after applying transformation from highlight/fade states.
|
|
6
|
+
*/
|
|
7
|
+
export function getModifiedArcProperties(seriesDef, seriesLayout, isHighlighted, isFaded) {
|
|
8
|
+
const {
|
|
9
|
+
faded,
|
|
10
|
+
highlighted,
|
|
11
|
+
paddingAngle: basePaddingAngle = 0,
|
|
12
|
+
cornerRadius: baseCornerRadius = 0
|
|
13
|
+
} = seriesDef;
|
|
14
|
+
const {
|
|
15
|
+
radius: {
|
|
16
|
+
inner: baseInnerRadius = 0,
|
|
17
|
+
label: baseArcLabelRadius,
|
|
18
|
+
outer: baseOuterRadius
|
|
19
|
+
}
|
|
20
|
+
} = seriesLayout;
|
|
21
|
+
const attributesOverride = _extends({
|
|
22
|
+
additionalRadius: 0
|
|
23
|
+
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
24
|
+
const paddingAngle = Math.max(0, deg2rad(attributesOverride.paddingAngle ?? basePaddingAngle));
|
|
25
|
+
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
26
|
+
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
27
|
+
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
28
|
+
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
29
|
+
return {
|
|
30
|
+
paddingAngle,
|
|
31
|
+
innerRadius,
|
|
32
|
+
outerRadius,
|
|
33
|
+
cornerRadius,
|
|
34
|
+
arcLabelRadius
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -4,18 +4,13 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useItemHighlightedGetter } from "../../hooks/useItemHighlightedGetter.js";
|
|
6
6
|
import { useIsItemFocusedGetter } from "../../hooks/useIsItemFocusedGetter.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getModifiedArcProperties } from "./getModifiedArcProperties.js";
|
|
8
8
|
export function useTransformData(series) {
|
|
9
9
|
const {
|
|
10
10
|
id: seriesId,
|
|
11
11
|
data,
|
|
12
12
|
faded,
|
|
13
|
-
highlighted
|
|
14
|
-
paddingAngle: basePaddingAngle = 0,
|
|
15
|
-
innerRadius: baseInnerRadius = 0,
|
|
16
|
-
arcLabelRadius: baseArcLabelRadius,
|
|
17
|
-
outerRadius: baseOuterRadius,
|
|
18
|
-
cornerRadius: baseCornerRadius = 0
|
|
13
|
+
highlighted
|
|
19
14
|
} = series;
|
|
20
15
|
const {
|
|
21
16
|
isFaded: isItemFaded,
|
|
@@ -34,25 +29,25 @@ export function useTransformData(series) {
|
|
|
34
29
|
seriesId,
|
|
35
30
|
dataIndex: itemIndex
|
|
36
31
|
});
|
|
32
|
+
|
|
33
|
+
// TODO v9: Replace the second argument with the result of useSeriesLayout
|
|
34
|
+
const arcSizes = getModifiedArcProperties(series, {
|
|
35
|
+
radius: {
|
|
36
|
+
inner: series.innerRadius ?? 0,
|
|
37
|
+
outer: series.outerRadius,
|
|
38
|
+
label: series.arcLabelRadius ?? 0,
|
|
39
|
+
available: 0
|
|
40
|
+
}
|
|
41
|
+
}, isHighlighted, isFaded);
|
|
37
42
|
const attributesOverride = _extends({
|
|
38
43
|
additionalRadius: 0
|
|
39
44
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
40
|
-
const paddingAngle = Math.max(0, deg2rad(attributesOverride.paddingAngle ?? basePaddingAngle));
|
|
41
|
-
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
42
|
-
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
43
|
-
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
44
|
-
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
45
45
|
return _extends({}, item, attributesOverride, {
|
|
46
46
|
dataIndex: itemIndex,
|
|
47
47
|
isFaded,
|
|
48
48
|
isHighlighted,
|
|
49
|
-
isFocused
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
outerRadius,
|
|
53
|
-
cornerRadius,
|
|
54
|
-
arcLabelRadius
|
|
55
|
-
});
|
|
56
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, isItemFocused, seriesId]);
|
|
49
|
+
isFocused
|
|
50
|
+
}, arcSizes);
|
|
51
|
+
}), [data, seriesId, isItemHighlighted, isItemFaded, isItemFocused, series, faded, highlighted]);
|
|
57
52
|
return dataWithHighlight;
|
|
58
53
|
}
|
|
@@ -1,44 +1,35 @@
|
|
|
1
1
|
import { findMinMax } from "../../internals/findMinMax.js";
|
|
2
|
-
import { getPercentageValue } from "../../internals/getPercentageValue.js";
|
|
3
|
-
import { getPieCoordinates } from "../getPieCoordinates.js";
|
|
4
2
|
const tooltipItemPositionGetter = params => {
|
|
5
3
|
const {
|
|
6
4
|
series,
|
|
7
|
-
drawingArea,
|
|
8
5
|
identifier,
|
|
9
|
-
placement
|
|
6
|
+
placement,
|
|
7
|
+
seriesLayout
|
|
10
8
|
} = params;
|
|
11
9
|
if (!identifier || identifier.dataIndex === undefined) {
|
|
12
10
|
return null;
|
|
13
11
|
}
|
|
14
12
|
const itemSeries = series.pie?.series[identifier.seriesId];
|
|
15
|
-
|
|
13
|
+
const layout = seriesLayout.pie?.[identifier.seriesId];
|
|
14
|
+
if (itemSeries == null || layout == null) {
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
18
17
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = getPieCoordinates({
|
|
23
|
-
cx: itemSeries.cx,
|
|
24
|
-
cy: itemSeries.cy
|
|
25
|
-
}, drawingArea);
|
|
18
|
+
center,
|
|
19
|
+
radius
|
|
20
|
+
} = layout;
|
|
26
21
|
const {
|
|
27
|
-
data
|
|
28
|
-
innerRadius: baseInnerRadius = 0,
|
|
29
|
-
outerRadius: baseOuterRadius
|
|
22
|
+
data
|
|
30
23
|
} = itemSeries;
|
|
31
|
-
const innerRadius = Math.max(0, getPercentageValue(baseInnerRadius ?? 0, availableRadius));
|
|
32
|
-
const outerRadius = Math.max(0, getPercentageValue(baseOuterRadius ?? availableRadius, availableRadius));
|
|
33
24
|
const dataItem = data[identifier.dataIndex];
|
|
34
25
|
if (!dataItem) {
|
|
35
26
|
return null;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
29
|
// Compute the 4 corner points of the arc to get the bounding box.
|
|
39
|
-
const points = [[
|
|
40
|
-
x:
|
|
41
|
-
y:
|
|
30
|
+
const points = [[radius.inner, dataItem.startAngle], [radius.inner, dataItem.endAngle], [radius.outer, dataItem.startAngle], [radius.outer, dataItem.endAngle]].map(([r, angle]) => ({
|
|
31
|
+
x: center.x + r * Math.sin(angle),
|
|
32
|
+
y: center.y - r * Math.cos(angle)
|
|
42
33
|
}));
|
|
43
34
|
const [x0, x1] = findMinMax(points.map(p => p.x));
|
|
44
35
|
const [y0, y1] = findMinMax(points.map(p => p.y));
|
|
@@ -6,7 +6,6 @@ import { selectorChartPolarCenter } from "../../internals/plugins/featurePlugins
|
|
|
6
6
|
import { isOrdinalScale } from "../../internals/scaleGuards.js";
|
|
7
7
|
import { degToRad } from "../../internals/degToRad.js";
|
|
8
8
|
import { clampAngle } from "../../internals/clampAngle.js";
|
|
9
|
-
import { useSelector } from "../../internals/store/useSelector.js";
|
|
10
9
|
import { rad2deg } from "../../internals/angleConversion.js";
|
|
11
10
|
/**
|
|
12
11
|
* Returns an array with on item par metrics with the different point to label.
|
|
@@ -28,7 +27,7 @@ export function useRadarAxis(params) {
|
|
|
28
27
|
const {
|
|
29
28
|
cx,
|
|
30
29
|
cy
|
|
31
|
-
} =
|
|
30
|
+
} = store.use(selectorChartPolarCenter);
|
|
32
31
|
if (metric === undefined || !rotationScale || rotationScale.domain().length === 0) {
|
|
33
32
|
return null;
|
|
34
33
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useRadiusAxes } from "../../hooks/useAxis.js";
|
|
2
2
|
import { useRadarSeries } from "../../hooks/useRadarSeries.js";
|
|
3
3
|
import { useRotationScale } from "../../hooks/useScale.js";
|
|
4
|
-
import { useSelector } from "../../internals/store/useSelector.js";
|
|
5
4
|
import { useStore } from "../../internals/store/useStore.js";
|
|
6
5
|
import { useChartContext } from "../../context/ChartProvider/useChartContext.js";
|
|
7
6
|
import { selectorChartPolarCenter } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
@@ -17,9 +16,9 @@ export function useRadarAxisHighlight() {
|
|
|
17
16
|
instance
|
|
18
17
|
} = useChartContext();
|
|
19
18
|
const store = useStore();
|
|
20
|
-
const rotationAxisIndex =
|
|
21
|
-
const rotationAxisValue =
|
|
22
|
-
const center =
|
|
19
|
+
const rotationAxisIndex = store.use(selectorChartsInteractionRotationAxisIndex);
|
|
20
|
+
const rotationAxisValue = store.use(selectorChartsInteractionRotationAxisValue);
|
|
21
|
+
const center = store.use(selectorChartPolarCenter);
|
|
23
22
|
const highlightedIndex = rotationAxisIndex;
|
|
24
23
|
if (!rotationScale) {
|
|
25
24
|
return null;
|
|
@@ -2,7 +2,6 @@ import { useRotationScale } from "../../hooks/useScale.js";
|
|
|
2
2
|
import { useRadiusAxes } from "../../hooks/index.js";
|
|
3
3
|
import { selectorChartPolarCenter } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
4
4
|
import { useChartContext } from "../../context/ChartProvider/useChartContext.js";
|
|
5
|
-
import { useSelector } from "../../internals/store/useSelector.js";
|
|
6
5
|
export function useRadarGridData() {
|
|
7
6
|
const {
|
|
8
7
|
instance,
|
|
@@ -15,7 +14,7 @@ export function useRadarGridData() {
|
|
|
15
14
|
const {
|
|
16
15
|
cx,
|
|
17
16
|
cy
|
|
18
|
-
} =
|
|
17
|
+
} = store.use(selectorChartPolarCenter);
|
|
19
18
|
if (!rotationScale || rotationScale.domain().length === 0) {
|
|
20
19
|
return null;
|
|
21
20
|
}
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { selectorChartPolarCenter } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
3
3
|
import { getSVGPoint } from "../../internals/getSVGPoint.js";
|
|
4
4
|
import { generateSvg2rotation } from "../../internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js";
|
|
5
|
-
import { useSelector } from "../../internals/store/useSelector.js";
|
|
6
5
|
import { getAxisIndex } from "../../internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js";
|
|
7
6
|
import { useStore } from "../../internals/store/useStore.js";
|
|
8
7
|
import { useSvgRef } from "../../hooks/useSvgRef.js";
|
|
@@ -16,7 +15,7 @@ export function useRadarRotationIndex() {
|
|
|
16
15
|
const svgRef = useSvgRef();
|
|
17
16
|
const store = useStore();
|
|
18
17
|
const rotationAxis = useRotationAxis();
|
|
19
|
-
const center =
|
|
18
|
+
const center = store.use(selectorChartPolarCenter);
|
|
20
19
|
const rotationIndexGetter = React.useCallback(function rotationIndexGetter(event) {
|
|
21
20
|
const element = svgRef.current;
|
|
22
21
|
if (!element || !rotationAxis) {
|
|
@@ -5,7 +5,6 @@ import { styled } from '@mui/material/styles';
|
|
|
5
5
|
import { useUtilityClasses } from "./scatterClasses.js";
|
|
6
6
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
7
7
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
8
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
9
8
|
import { selectorChartIsSeriesFaded, selectorChartIsSeriesHighlighted, selectorChartSeriesUnfadedItem, selectorChartSeriesHighlightedItem } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
10
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
10
|
const MAX_POINTS_PER_PATH = 1000;
|
|
@@ -119,10 +118,10 @@ export function BatchScatter(props) {
|
|
|
119
118
|
const {
|
|
120
119
|
store
|
|
121
120
|
} = useChartContext();
|
|
122
|
-
const isSeriesHighlighted =
|
|
123
|
-
const isSeriesFaded =
|
|
124
|
-
const seriesHighlightedItem =
|
|
125
|
-
const seriesUnfadedItem =
|
|
121
|
+
const isSeriesHighlighted = store.use(selectorChartIsSeriesHighlighted, series.id);
|
|
122
|
+
const isSeriesFaded = store.use(selectorChartIsSeriesFaded, series.id);
|
|
123
|
+
const seriesHighlightedItem = store.use(selectorChartSeriesHighlightedItem, series.id);
|
|
124
|
+
const seriesUnfadedItem = store.use(selectorChartSeriesUnfadedItem, series.id);
|
|
126
125
|
const highlightedModifier = 1.2;
|
|
127
126
|
const markerSize = series.markerSize * (isSeriesHighlighted ? highlightedModifier : 1);
|
|
128
127
|
const classes = useUtilityClasses(inClasses);
|
|
@@ -8,7 +8,6 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
9
9
|
import { getInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
10
10
|
import { useStore } from "../internals/store/useStore.js";
|
|
11
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
12
11
|
import { useItemHighlightedGetter } from "../hooks/useItemHighlightedGetter.js";
|
|
13
12
|
import { selectorChartsIsVoronoiEnabled } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
14
13
|
import { ScatterMarker } from "./ScatterMarker.js";
|
|
@@ -41,7 +40,7 @@ function Scatter(props) {
|
|
|
41
40
|
instance
|
|
42
41
|
} = useChartContext();
|
|
43
42
|
const store = useStore();
|
|
44
|
-
const isVoronoiEnabled =
|
|
43
|
+
const isVoronoiEnabled = store.use(selectorChartsIsVoronoiEnabled);
|
|
45
44
|
const skipInteractionHandlers = isVoronoiEnabled || series.disableHover;
|
|
46
45
|
const {
|
|
47
46
|
isFaded,
|
package/esm/hooks/useAxis.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { selectorChartXAxis, selectorChartYAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js";
|
|
4
4
|
import { selectorChartRadiusAxis, selectorChartRotationAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
5
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
6
5
|
import { useStore } from "../internals/store/useStore.js";
|
|
7
6
|
/**
|
|
8
7
|
* Get all the x-axes.
|
|
@@ -24,7 +23,7 @@ export function useXAxes() {
|
|
|
24
23
|
const {
|
|
25
24
|
axis: xAxis,
|
|
26
25
|
axisIds: xAxisIds
|
|
27
|
-
} =
|
|
26
|
+
} = store.use(selectorChartXAxis);
|
|
28
27
|
return {
|
|
29
28
|
xAxis,
|
|
30
29
|
xAxisIds
|
|
@@ -51,7 +50,7 @@ export function useYAxes() {
|
|
|
51
50
|
const {
|
|
52
51
|
axis: yAxis,
|
|
53
52
|
axisIds: yAxisIds
|
|
54
|
-
} =
|
|
53
|
+
} = store.use(selectorChartYAxis);
|
|
55
54
|
return {
|
|
56
55
|
yAxis,
|
|
57
56
|
yAxisIds
|
|
@@ -79,7 +78,7 @@ export function useXAxis(axisId) {
|
|
|
79
78
|
const {
|
|
80
79
|
axis: xAxis,
|
|
81
80
|
axisIds: xAxisIds
|
|
82
|
-
} =
|
|
81
|
+
} = store.use(selectorChartXAxis);
|
|
83
82
|
const id = axisId ?? xAxisIds[0];
|
|
84
83
|
return xAxis[id];
|
|
85
84
|
}
|
|
@@ -105,7 +104,7 @@ export function useYAxis(axisId) {
|
|
|
105
104
|
const {
|
|
106
105
|
axis: yAxis,
|
|
107
106
|
axisIds: yAxisIds
|
|
108
|
-
} =
|
|
107
|
+
} = store.use(selectorChartYAxis);
|
|
109
108
|
const id = axisId ?? yAxisIds[0];
|
|
110
109
|
return yAxis[id];
|
|
111
110
|
}
|
|
@@ -130,7 +129,7 @@ export function useRotationAxes() {
|
|
|
130
129
|
const {
|
|
131
130
|
axis: rotationAxis,
|
|
132
131
|
axisIds: rotationAxisIds
|
|
133
|
-
} =
|
|
132
|
+
} = store.use(selectorChartRotationAxis);
|
|
134
133
|
return {
|
|
135
134
|
rotationAxis,
|
|
136
135
|
rotationAxisIds
|
|
@@ -157,7 +156,7 @@ export function useRadiusAxes() {
|
|
|
157
156
|
const {
|
|
158
157
|
axis: radiusAxis,
|
|
159
158
|
axisIds: radiusAxisIds
|
|
160
|
-
} =
|
|
159
|
+
} = store.use(selectorChartRadiusAxis);
|
|
161
160
|
return {
|
|
162
161
|
radiusAxis,
|
|
163
162
|
radiusAxisIds
|
|
@@ -188,7 +187,7 @@ export function useRotationAxis(axisId) {
|
|
|
188
187
|
const {
|
|
189
188
|
axis: rotationAxis,
|
|
190
189
|
axisIds: rotationAxisIds
|
|
191
|
-
} =
|
|
190
|
+
} = store.use(selectorChartRotationAxis);
|
|
192
191
|
const id = axisId ?? rotationAxisIds[0];
|
|
193
192
|
return rotationAxis[id];
|
|
194
193
|
}
|
|
@@ -217,7 +216,7 @@ export function useRadiusAxis(axisId) {
|
|
|
217
216
|
const {
|
|
218
217
|
axis: radiusAxis,
|
|
219
218
|
axisIds: radiusAxisIds
|
|
220
|
-
} =
|
|
219
|
+
} = store.use(selectorChartRadiusAxis);
|
|
221
220
|
const id = axisId ?? radiusAxisIds[0];
|
|
222
221
|
return radiusAxis[id];
|
|
223
222
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { selectorChartRawXAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
4
4
|
import { selectorChartRawRotationAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
5
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
6
5
|
import { useStore } from "../internals/store/useStore.js";
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -14,8 +13,8 @@ import { useStore } from "../internals/store/useStore.js";
|
|
|
14
13
|
*/
|
|
15
14
|
export function useAxisSystem() {
|
|
16
15
|
const store = useStore();
|
|
17
|
-
const rawRotationAxis =
|
|
18
|
-
const rawXAxis =
|
|
16
|
+
const rawRotationAxis = store.use(selectorChartRawRotationAxis);
|
|
17
|
+
const rawXAxis = store.use(selectorChartRawXAxis);
|
|
19
18
|
if (rawRotationAxis !== undefined) {
|
|
20
19
|
return 'polar';
|
|
21
20
|
}
|
package/esm/hooks/useBrush.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { selectorBrushState } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
2
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
3
2
|
import { useStore } from "../internals/store/useStore.js";
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -12,5 +11,5 @@ import { useStore } from "../internals/store/useStore.js";
|
|
|
12
11
|
*/
|
|
13
12
|
export function useBrush() {
|
|
14
13
|
const store = useStore();
|
|
15
|
-
return
|
|
14
|
+
return store.use(selectorBrushState);
|
|
16
15
|
}
|
package/esm/hooks/useChartId.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 { selectorChartId } from "../internals/plugins/corePlugins/useChartId/useChartId.selectors.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -10,5 +9,5 @@ import { selectorChartId } from "../internals/plugins/corePlugins/useChartId/use
|
|
|
10
9
|
*/
|
|
11
10
|
export function useChartId() {
|
|
12
11
|
const store = useStore();
|
|
13
|
-
return
|
|
12
|
+
return store.use(selectorChartId);
|
|
14
13
|
}
|
package/esm/hooks/useDataset.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 { selectorChartDataset } from "../internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js";
|
|
6
5
|
/**
|
|
7
6
|
* Get access to the dataset used to populate series and axes data.
|
|
@@ -9,5 +8,5 @@ import { selectorChartDataset } from "../internals/plugins/corePlugins/useChartS
|
|
|
9
8
|
*/
|
|
10
9
|
export function useDataset() {
|
|
11
10
|
const store = useStore();
|
|
12
|
-
return
|
|
11
|
+
return store.use(selectorChartDataset);
|
|
13
12
|
}
|
|
@@ -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 { selectorChartDrawingArea } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js";
|
|
6
5
|
/**
|
|
7
6
|
* Get the drawing area dimensions and coordinates. The drawing area is the area where the chart is rendered.
|
|
@@ -12,5 +11,5 @@ import { selectorChartDrawingArea } from "../internals/plugins/corePlugins/useCh
|
|
|
12
11
|
*/
|
|
13
12
|
export function useDrawingArea() {
|
|
14
13
|
const store = useStore();
|
|
15
|
-
return
|
|
14
|
+
return store.use(selectorChartDrawingArea);
|
|
16
15
|
}
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useStore } from "../internals/store/useStore.js";
|
|
5
|
-
import { useSelector } from "../internals/store/useSelector.js";
|
|
6
5
|
import { selectorChartsFocusedSeriesType, selectorChartsFocusedSeriesId, selectorChartsFocusedDataIndex } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
7
6
|
/**
|
|
8
7
|
* Get the focused item from keyboard navigation.
|
|
9
8
|
*/
|
|
10
9
|
export function useFocusedItem() {
|
|
11
10
|
const store = useStore();
|
|
12
|
-
const focusedSeriesType =
|
|
13
|
-
const focusedSeriesId =
|
|
14
|
-
const focusedDataIndex =
|
|
11
|
+
const focusedSeriesType = store.use(selectorChartsFocusedSeriesType);
|
|
12
|
+
const focusedSeriesId = store.use(selectorChartsFocusedSeriesId);
|
|
13
|
+
const focusedDataIndex = store.use(selectorChartsFocusedDataIndex);
|
|
15
14
|
return React.useMemo(() => focusedSeriesType === undefined || focusedSeriesId === undefined || focusedDataIndex === undefined ? null : {
|
|
16
15
|
seriesType: focusedSeriesType,
|
|
17
16
|
seriesId: focusedSeriesId,
|
|
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { type SeriesItemIdentifierWithData } from "../models/index.js";
|
|
3
3
|
import type { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
4
|
import type { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
5
|
-
import type { ChartSeriesType
|
|
5
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
6
|
+
import type { SeriesItemIdentifier } from "../models/seriesType/index.js";
|
|
6
7
|
import type { ChartInstance } from "../internals/plugins/models/index.js";
|
|
7
8
|
import type { UseChartTooltipSignature } from "../internals/plugins/featurePlugins/useChartTooltip/index.js";
|
|
8
9
|
export declare const useInteractionItemProps: (data: SeriesItemIdentifierWithData, skip?: boolean) => {
|
|
@@ -10,7 +11,7 @@ export declare const useInteractionItemProps: (data: SeriesItemIdentifierWithDat
|
|
|
10
11
|
onPointerLeave?: () => void;
|
|
11
12
|
onPointerDown?: (event: React.PointerEvent) => void;
|
|
12
13
|
};
|
|
13
|
-
export declare function getInteractionItemProps(instance: ChartInstance<[UseChartInteractionSignature, UseChartHighlightSignature, UseChartTooltipSignature]>, item:
|
|
14
|
+
export declare function getInteractionItemProps(instance: ChartInstance<[UseChartInteractionSignature, UseChartHighlightSignature, UseChartTooltipSignature]>, item: SeriesItemIdentifier<ChartSeriesType>): {
|
|
14
15
|
onPointerEnter?: () => void;
|
|
15
16
|
onPointerLeave?: () => void;
|
|
16
17
|
onPointerDown?: (event: React.PointerEvent) => void;
|
|
@@ -17,7 +17,13 @@ export const useInteractionItemProps = (data, skip) => {
|
|
|
17
17
|
interactionActive.current = true;
|
|
18
18
|
instance.setLastUpdateSource('pointer');
|
|
19
19
|
instance.setTooltipItem(data);
|
|
20
|
-
|
|
20
|
+
// TODO: uniformize sankey and other types to get a single plugin
|
|
21
|
+
instance.setHighlight(
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
data.type === 'sankey' ? data : {
|
|
24
|
+
seriesId: data.seriesId,
|
|
25
|
+
dataIndex: data.dataIndex
|
|
26
|
+
});
|
|
21
27
|
});
|
|
22
28
|
const onPointerLeave = useEventCallback(() => {
|
|
23
29
|
interactionActive.current = false;
|
|
@@ -45,7 +51,12 @@ export function getInteractionItemProps(instance, item) {
|
|
|
45
51
|
}
|
|
46
52
|
instance.setLastUpdateSource('pointer');
|
|
47
53
|
instance.setTooltipItem(item);
|
|
48
|
-
instance.setHighlight(
|
|
54
|
+
instance.setHighlight(
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
item.type === 'sankey' ? item : {
|
|
57
|
+
seriesId: item.seriesId,
|
|
58
|
+
dataIndex: item.dataIndex
|
|
59
|
+
});
|
|
49
60
|
}
|
|
50
61
|
function onPointerLeave() {
|
|
51
62
|
if (!item) {
|