@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
|
@@ -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;
|
|
@@ -25,7 +25,13 @@ const useInteractionItemProps = (data, skip) => {
|
|
|
25
25
|
interactionActive.current = true;
|
|
26
26
|
instance.setLastUpdateSource('pointer');
|
|
27
27
|
instance.setTooltipItem(data);
|
|
28
|
-
|
|
28
|
+
// TODO: uniformize sankey and other types to get a single plugin
|
|
29
|
+
instance.setHighlight(
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
data.type === 'sankey' ? data : {
|
|
32
|
+
seriesId: data.seriesId,
|
|
33
|
+
dataIndex: data.dataIndex
|
|
34
|
+
});
|
|
29
35
|
});
|
|
30
36
|
const onPointerLeave = (0, _useEventCallback.default)(() => {
|
|
31
37
|
interactionActive.current = false;
|
|
@@ -54,7 +60,12 @@ function getInteractionItemProps(instance, item) {
|
|
|
54
60
|
}
|
|
55
61
|
instance.setLastUpdateSource('pointer');
|
|
56
62
|
instance.setTooltipItem(item);
|
|
57
|
-
instance.setHighlight(
|
|
63
|
+
instance.setHighlight(
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
item.type === 'sankey' ? item : {
|
|
66
|
+
seriesId: item.seriesId,
|
|
67
|
+
dataIndex: item.dataIndex
|
|
68
|
+
});
|
|
58
69
|
}
|
|
59
70
|
function onPointerLeave() {
|
|
60
71
|
if (!item) {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useIsItemFocused = useIsItemFocused;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
11
10
|
/**
|
|
12
11
|
* A hook to check if an item has the focus.
|
|
@@ -18,5 +17,5 @@ var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/u
|
|
|
18
17
|
*/
|
|
19
18
|
function useIsItemFocused(item) {
|
|
20
19
|
const store = (0, _useStore.useStore)();
|
|
21
|
-
return
|
|
20
|
+
return store.use(_useChartKeyboardNavigation.selectorChartsItemIsFocused, item);
|
|
22
21
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useItemHighlighted = useItemHighlighted;
|
|
8
8
|
var _useStore = require("../internals/store/useStore");
|
|
9
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
10
9
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
11
10
|
/**
|
|
12
11
|
* A hook to check the highlighted state of the item.
|
|
@@ -19,8 +18,8 @@ var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHi
|
|
|
19
18
|
*/
|
|
20
19
|
function useItemHighlighted(item) {
|
|
21
20
|
const store = (0, _useStore.useStore)();
|
|
22
|
-
const isHighlighted =
|
|
23
|
-
const isFaded =
|
|
21
|
+
const isHighlighted = store.use(_useChartHighlight.selectorChartsIsHighlighted, item);
|
|
22
|
+
const isFaded = store.use(_useChartHighlight.selectorChartsIsFaded, item);
|
|
24
23
|
return {
|
|
25
24
|
isHighlighted,
|
|
26
25
|
isFaded: !isHighlighted && isFaded
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useItemHighlightedGetter = useItemHighlightedGetter;
|
|
8
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
9
8
|
var _useStore = require("../internals/store/useStore");
|
|
10
9
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors");
|
|
11
10
|
/**
|
|
@@ -18,8 +17,8 @@ var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHi
|
|
|
18
17
|
*/
|
|
19
18
|
function useItemHighlightedGetter() {
|
|
20
19
|
const store = (0, _useStore.useStore)();
|
|
21
|
-
const isHighlighted =
|
|
22
|
-
const isFaded =
|
|
20
|
+
const isHighlighted = store.use(_useChartHighlight.selectorChartsIsHighlightedCallback);
|
|
21
|
+
const isFaded = store.use(_useChartHighlight.selectorChartsIsFadedCallback);
|
|
23
22
|
return {
|
|
24
23
|
isHighlighted,
|
|
25
24
|
isFaded
|
package/hooks/useLegend.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.useLegend = useLegend;
|
|
|
8
8
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries");
|
|
9
9
|
var _useSeries = require("./useSeries");
|
|
10
10
|
var _useStore = require("../internals/store/useStore");
|
|
11
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
12
11
|
function getSeriesToDisplay(series, seriesConfig) {
|
|
13
12
|
return Object.keys(series).flatMap(seriesType => {
|
|
14
13
|
const getter = seriesConfig[seriesType].legendGetter;
|
|
@@ -28,7 +27,7 @@ function getSeriesToDisplay(series, seriesConfig) {
|
|
|
28
27
|
function useLegend() {
|
|
29
28
|
const series = (0, _useSeries.useSeries)();
|
|
30
29
|
const store = (0, _useStore.useStore)();
|
|
31
|
-
const seriesConfig =
|
|
30
|
+
const seriesConfig = store.use(_useChartSeries.selectorChartSeriesConfig);
|
|
32
31
|
return {
|
|
33
32
|
items: getSeriesToDisplay(series, seriesConfig)
|
|
34
33
|
};
|
package/hooks/usePieSeries.js
CHANGED
|
@@ -10,7 +10,6 @@ exports.usePieSeriesLayout = usePieSeriesLayout;
|
|
|
10
10
|
var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
|
|
11
11
|
var _useStore = require("../internals/store/useStore");
|
|
12
12
|
var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries");
|
|
13
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
14
13
|
/**
|
|
15
14
|
* Get access to the internal state of pie series.
|
|
16
15
|
*
|
|
@@ -54,6 +53,6 @@ function usePieSeriesContext() {
|
|
|
54
53
|
*/
|
|
55
54
|
function usePieSeriesLayout() {
|
|
56
55
|
const store = (0, _useStore.useStore)();
|
|
57
|
-
const seriesLayout =
|
|
56
|
+
const seriesLayout = store.use(_useChartSeries.selectorChartSeriesLayout);
|
|
58
57
|
return seriesLayout.pie ?? {};
|
|
59
58
|
}
|
package/hooks/useSeries.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useSeries = useSeries;
|
|
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 internal state of series.
|
|
@@ -16,5 +15,5 @@ var _useChartSeries = require("../internals/plugins/corePlugins/useChartSeries/u
|
|
|
16
15
|
*/
|
|
17
16
|
function useSeries() {
|
|
18
17
|
const store = (0, _useStore.useStore)();
|
|
19
|
-
return
|
|
18
|
+
return store.use(_useChartSeries.selectorChartSeriesProcessed);
|
|
20
19
|
}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useSkipAnimation = useSkipAnimation;
|
|
8
8
|
var _useChartAnimation = require("../internals/plugins/corePlugins/useChartAnimation");
|
|
9
9
|
var _useStore = require("../internals/store/useStore");
|
|
10
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
11
10
|
/**
|
|
12
11
|
* A hook to get if chart animations should be skipped.
|
|
13
12
|
*
|
|
@@ -15,6 +14,6 @@ var _useSelector = require("../internals/store/useSelector");
|
|
|
15
14
|
*/
|
|
16
15
|
function useSkipAnimation(skipAnimation) {
|
|
17
16
|
const store = (0, _useStore.useStore)();
|
|
18
|
-
const storeSkipAnimation =
|
|
17
|
+
const storeSkipAnimation = store.use(_useChartAnimation.selectorChartSkipAnimation);
|
|
19
18
|
return skipAnimation || storeSkipAnimation;
|
|
20
19
|
}
|
package/hooks/useZAxis.js
CHANGED
|
@@ -8,13 +8,12 @@ exports.useZAxes = useZAxes;
|
|
|
8
8
|
exports.useZAxis = useZAxis;
|
|
9
9
|
var _useStore = require("../internals/store/useStore");
|
|
10
10
|
var _useChartZAxis = require("../internals/plugins/featurePlugins/useChartZAxis");
|
|
11
|
-
var _useSelector = require("../internals/store/useSelector");
|
|
12
11
|
function useZAxes() {
|
|
13
12
|
const store = (0, _useStore.useStore)();
|
|
14
13
|
const {
|
|
15
14
|
axis: zAxis,
|
|
16
15
|
axisIds: zAxisIds
|
|
17
|
-
} =
|
|
16
|
+
} = store.use(_useChartZAxis.selectorChartZAxis) ?? {
|
|
18
17
|
axis: {},
|
|
19
18
|
axisIds: []
|
|
20
19
|
};
|
package/index.js
CHANGED
package/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/internals/index.js
CHANGED
|
@@ -434,18 +434,6 @@ Object.keys(_useStore).forEach(function (key) {
|
|
|
434
434
|
}
|
|
435
435
|
});
|
|
436
436
|
});
|
|
437
|
-
var _useSelector = require("./store/useSelector");
|
|
438
|
-
Object.keys(_useSelector).forEach(function (key) {
|
|
439
|
-
if (key === "default" || key === "__esModule") return;
|
|
440
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
441
|
-
if (key in exports && exports[key] === _useSelector[key]) return;
|
|
442
|
-
Object.defineProperty(exports, key, {
|
|
443
|
-
enumerable: true,
|
|
444
|
-
get: function () {
|
|
445
|
-
return _useSelector[key];
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
437
|
var _BarChart = require("../BarChart/BarChart.plugins");
|
|
450
438
|
Object.keys(_BarChart).forEach(function (key) {
|
|
451
439
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -12,7 +12,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _useEffectAfterFirstRender = require("@mui/x-internals/useEffectAfterFirstRender");
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
14
|
var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
15
|
-
var _useSelector = require("../../../store/useSelector");
|
|
16
15
|
var _constants = require("../../../../constants");
|
|
17
16
|
var _useChartDimensions = require("./useChartDimensions.selectors");
|
|
18
17
|
var _defaultizeMargin = require("../../../defaultizeMargin");
|
|
@@ -143,7 +142,7 @@ const useChartDimensions = ({
|
|
|
143
142
|
stateRef.current.displayError = false;
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
|
-
const drawingArea =
|
|
145
|
+
const drawingArea = store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
147
146
|
const isXInside = React.useCallback(x => x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width, [drawingArea.left, drawingArea.width]);
|
|
148
147
|
const isYInside = React.useCallback(y => y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height, [drawingArea.height, drawingArea.top]);
|
|
149
148
|
const isPointInside = React.useCallback((x, y, targetElement) => {
|
|
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.useColorProcessor = useColorProcessor;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _useSelector = require("../../../store/useSelector");
|
|
11
10
|
var _useStore = require("../../../store/useStore");
|
|
12
11
|
var _useChartSeries = require("./useChartSeries.selectors");
|
|
13
12
|
function useColorProcessor(seriesType) {
|
|
14
13
|
const store = (0, _useStore.useStore)();
|
|
15
|
-
const seriesConfig =
|
|
14
|
+
const seriesConfig = store.use(_useChartSeries.selectorChartSeriesConfig);
|
|
16
15
|
const colorProcessors = React.useMemo(() => {
|
|
17
16
|
const rep = {};
|
|
18
17
|
Object.keys(seriesConfig).forEach(seriesT => {
|
|
@@ -12,7 +12,6 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
14
|
var _getSVGPoint = require("../../../getSVGPoint");
|
|
15
|
-
var _useSelector = require("../../../store/useSelector");
|
|
16
15
|
var _useChartBrush = require("./useChartBrush.selectors");
|
|
17
16
|
const useChartBrush = ({
|
|
18
17
|
store,
|
|
@@ -20,7 +19,7 @@ const useChartBrush = ({
|
|
|
20
19
|
instance,
|
|
21
20
|
params
|
|
22
21
|
}) => {
|
|
23
|
-
const isEnabled =
|
|
22
|
+
const isEnabled = store.use(_useChartBrush.selectorIsBrushEnabled);
|
|
24
23
|
(0, _useEnhancedEffect.default)(() => {
|
|
25
24
|
store.set('brush', (0, _extends2.default)({}, store.state.brush, {
|
|
26
25
|
enabled: params.brushConfig.enabled,
|
|
@@ -14,7 +14,6 @@ var _store = require("@mui/x-internals/store");
|
|
|
14
14
|
var _useAssertModelConsistency = require("@mui/x-internals/useAssertModelConsistency");
|
|
15
15
|
var _warning = require("@mui/x-internals/warning");
|
|
16
16
|
var _colorPalettes = require("../../../../colorPalettes");
|
|
17
|
-
var _useSelector = require("../../../store/useSelector");
|
|
18
17
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
19
18
|
var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
|
|
20
19
|
var _defaultizeAxis = require("./defaultizeAxis");
|
|
@@ -44,17 +43,17 @@ const useChartCartesianAxis = ({
|
|
|
44
43
|
(0, _warning.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');
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
const drawingArea =
|
|
48
|
-
const processedSeries =
|
|
49
|
-
const isInteractionEnabled =
|
|
46
|
+
const drawingArea = store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
47
|
+
const processedSeries = store.use(_useChartSeries.selectorChartSeriesProcessed);
|
|
48
|
+
const isInteractionEnabled = store.use(_useChartInteraction.selectorChartsInteractionIsInitialized);
|
|
50
49
|
const {
|
|
51
50
|
axis: xAxisWithScale,
|
|
52
51
|
axisIds: xAxisIds
|
|
53
|
-
} =
|
|
52
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartXAxis);
|
|
54
53
|
const {
|
|
55
54
|
axis: yAxisWithScale,
|
|
56
55
|
axisIds: yAxisIds
|
|
57
|
-
} =
|
|
56
|
+
} = store.use(_useChartCartesianAxisRendering.selectorChartYAxis);
|
|
58
57
|
(0, _useAssertModelConsistency.useAssertModelConsistency)({
|
|
59
58
|
warningPrefix: 'MUI X Charts',
|
|
60
59
|
componentName: 'Chart',
|
package/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useInternalIsZoomInteracting = useInternalIsZoomInteracting;
|
|
8
|
-
var _useSelector = require("../../../store/useSelector");
|
|
9
8
|
var _useStore = require("../../../store/useStore");
|
|
10
9
|
var _useChartCartesianAxisRendering = require("./useChartCartesianAxisRendering.selectors");
|
|
11
10
|
/**
|
|
@@ -19,6 +18,6 @@ var _useChartCartesianAxisRendering = require("./useChartCartesianAxisRendering.
|
|
|
19
18
|
*/
|
|
20
19
|
function useInternalIsZoomInteracting() {
|
|
21
20
|
const store = (0, _useStore.useStore)();
|
|
22
|
-
const isInteracting =
|
|
21
|
+
const isInteracting = store.use(_useChartCartesianAxisRendering.selectorChartZoomIsInteracting);
|
|
23
22
|
return isInteracting;
|
|
24
23
|
}
|
|
@@ -12,7 +12,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
13
13
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
14
14
|
var _getSVGPoint = require("../../../getSVGPoint");
|
|
15
|
-
var _useSelector = require("../../../store/useSelector");
|
|
16
15
|
var _useChartCartesianAxis = require("../useChartCartesianAxis");
|
|
17
16
|
var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
|
|
18
17
|
var _findClosestPoints = require("./findClosestPoints");
|
|
@@ -30,17 +29,17 @@ const useChartClosestPoint = ({
|
|
|
30
29
|
const {
|
|
31
30
|
axis: xAxis,
|
|
32
31
|
axisIds: xAxisIds
|
|
33
|
-
} =
|
|
32
|
+
} = store.use(_useChartCartesianAxis.selectorChartXAxis);
|
|
34
33
|
const {
|
|
35
34
|
axis: yAxis,
|
|
36
35
|
axisIds: yAxisIds
|
|
37
|
-
} =
|
|
38
|
-
const zoomIsInteracting =
|
|
36
|
+
} = store.use(_useChartCartesianAxis.selectorChartYAxis);
|
|
37
|
+
const zoomIsInteracting = store.use(_useChartCartesianAxis.selectorChartZoomIsInteracting);
|
|
39
38
|
const {
|
|
40
39
|
series,
|
|
41
40
|
seriesOrder
|
|
42
|
-
} =
|
|
43
|
-
const flatbushMap =
|
|
41
|
+
} = store.use(_useChartSeries.selectorChartSeriesProcessed)?.scatter ?? {};
|
|
42
|
+
const flatbushMap = store.use(zoomIsInteracting ? _useChartCartesianAxis.selectorChartSeriesEmptyFlatbushMap : _useChartCartesianAxis.selectorChartSeriesFlatbushMap);
|
|
44
43
|
const defaultXAxisId = xAxisIds[0];
|
|
45
44
|
const defaultYAxisId = yAxisIds[0];
|
|
46
45
|
(0, _useEnhancedEffect.default)(() => {
|
|
@@ -48,10 +48,13 @@ const useChartHighlight = ({
|
|
|
48
48
|
});
|
|
49
49
|
const setHighlight = (0, _useEventCallback.default)(newItem => {
|
|
50
50
|
const prevHighlight = store.state.highlight;
|
|
51
|
-
if (
|
|
51
|
+
if ((0, _fastObjectShallowCompare.fastObjectShallowCompare)(prevHighlight.item, newItem)) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
params.onHighlightChange?.(newItem);
|
|
55
|
+
if (prevHighlight.isControlled) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
55
58
|
store.set('highlight', {
|
|
56
59
|
item: newItem,
|
|
57
60
|
lastUpdate: 'pointer',
|
|
@@ -10,7 +10,6 @@ exports.useChartPolarAxis = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _warning = require("@mui/x-internals/warning");
|
|
13
|
-
var _useSelector = require("../../../store/useSelector");
|
|
14
13
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
15
14
|
var _defaultizeAxis = require("./defaultizeAxis");
|
|
16
15
|
var _useChartInteraction = require("../useChartInteraction");
|
|
@@ -39,18 +38,18 @@ const useChartPolarAxis = ({
|
|
|
39
38
|
(0, _warning.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');
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
const drawingArea =
|
|
43
|
-
const processedSeries =
|
|
44
|
-
const center =
|
|
45
|
-
const isInteractionEnabled =
|
|
41
|
+
const drawingArea = store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
42
|
+
const processedSeries = store.use(_useChartSeries.selectorChartSeriesProcessed);
|
|
43
|
+
const center = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
44
|
+
const isInteractionEnabled = store.use(_useChartInteraction.selectorChartsInteractionIsInitialized);
|
|
46
45
|
const {
|
|
47
46
|
axis: rotationAxisWithScale,
|
|
48
47
|
axisIds: rotationAxisIds
|
|
49
|
-
} =
|
|
48
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
50
49
|
const {
|
|
51
50
|
axis: radiusAxisWithScale,
|
|
52
51
|
axisIds: radiusAxisIds
|
|
53
|
-
} =
|
|
52
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
54
53
|
|
|
55
54
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useChartPolarAxis`
|
|
56
55
|
// 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.
|
|
@@ -8,7 +8,6 @@ var _warning = require("@mui/x-internals/warning");
|
|
|
8
8
|
var _store = require("@mui/x-internals/store");
|
|
9
9
|
var _useChartSeries = require("./plugins/corePlugins/useChartSeries/useChartSeries.selectors");
|
|
10
10
|
var _useStore = require("./store/useStore");
|
|
11
|
-
var _useSelector = require("./store/useSelector");
|
|
12
11
|
const selectorAllSeriesOfType = exports.selectorAllSeriesOfType = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, (processedSeries, seriesType) => processedSeries[seriesType]);
|
|
13
12
|
const selectorSeriesOfType = exports.selectorSeriesOfType = (0, _store.createSelectorMemoized)(_useChartSeries.selectorChartSeriesProcessed, (processedSeries, seriesType, ids) => {
|
|
14
13
|
if (ids === undefined || Array.isArray(ids) && ids.length === 0) {
|
|
@@ -36,11 +35,11 @@ const selectorSeriesOfType = exports.selectorSeriesOfType = (0, _store.createSel
|
|
|
36
35
|
});
|
|
37
36
|
const useAllSeriesOfType = seriesType => {
|
|
38
37
|
const store = (0, _useStore.useStore)();
|
|
39
|
-
return
|
|
38
|
+
return store.use(selectorAllSeriesOfType, seriesType);
|
|
40
39
|
};
|
|
41
40
|
exports.useAllSeriesOfType = useAllSeriesOfType;
|
|
42
41
|
const useSeriesOfType = (seriesType, seriesId) => {
|
|
43
42
|
const store = (0, _useStore.useStore)();
|
|
44
|
-
return
|
|
43
|
+
return store.use(selectorSeriesOfType, seriesType, seriesId);
|
|
45
44
|
};
|
|
46
45
|
exports.useSeriesOfType = useSeriesOfType;
|
|
@@ -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/package.json
CHANGED