@mui/x-charts-pro 8.15.0 → 8.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.js +12 -2
- package/BarChartPro/BarChartPro.plugins.d.ts +1 -1
- package/BarChartPro/BarChartPro.plugins.js +1 -1
- package/CHANGELOG.md +207 -0
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -2
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -3
- package/ChartZoomSlider/ChartZoomSlider.d.ts +1 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +2 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +1 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +1 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +2 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +1 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +1 -1
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +2 -2
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +1 -2
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +2 -4
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +2 -2
- package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +1 -2
- package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +2 -2
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +1 -2
- package/ChartsToolbarPro/internals/ChartsMenu.d.ts +1 -1
- package/FunnelChart/FunnelChart.js +1 -1
- package/FunnelChart/FunnelPlot.d.ts +1 -1
- package/FunnelChart/FunnelPlot.js +3 -23
- package/FunnelChart/coordinateMapper.d.ts +3 -0
- package/FunnelChart/coordinateMapper.js +18 -0
- package/FunnelChart/funnel.types.d.ts +1 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.js +1 -2
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +7 -7
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +6 -44
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.js +3 -2
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/FunnelChart/seriesConfig/index.d.ts +1 -1
- package/FunnelChart/seriesConfig/index.js +4 -2
- package/FunnelChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/FunnelChart/seriesConfig/tooltipPosition.js +62 -0
- package/Heatmap/Heatmap.js +1 -1
- package/Heatmap/Heatmap.plugins.d.ts +1 -1
- package/Heatmap/Heatmap.plugins.js +1 -1
- package/Heatmap/HeatmapItem.d.ts +1 -1
- package/Heatmap/HeatmapPlot.d.ts +1 -2
- package/Heatmap/HeatmapPlot.js +0 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +9 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +1 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +0 -2
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +3 -2
- package/Heatmap/seriesConfig/index.d.ts +1 -1
- package/Heatmap/seriesConfig/index.js +4 -2
- package/Heatmap/seriesConfig/tooltipPosition.d.ts +3 -0
- package/Heatmap/seriesConfig/tooltipPosition.js +57 -0
- package/LineChartPro/LineChartPro.js +11 -2
- package/LineChartPro/LineChartPro.plugins.d.ts +1 -1
- package/LineChartPro/LineChartPro.plugins.js +1 -1
- package/RadarChartPro/RadarChartPro.plugins.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.plugins.js +1 -1
- package/SankeyChart/SankeyChart.js +1 -1
- package/SankeyChart/SankeyLinkElement.js +2 -2
- package/SankeyChart/SankeyNodeElement.js +2 -2
- package/SankeyChart/SankeyPlot.d.ts +1 -1
- package/SankeyChart/SankeyTooltip/SankeyTooltip.d.ts +1 -2
- package/SankeyChart/SankeyTooltip/SankeyTooltip.js +9 -2
- package/SankeyChart/SankeyTooltip/SankeyTooltipContent.d.ts +1 -2
- package/SankeyChart/SankeyTooltip/SankeyTooltipContent.js +0 -2
- package/SankeyChart/plugins/useSankeyHighlight.js +8 -12
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +19 -23
- package/SankeyChart/plugins/useSankeyHighlight.selectors.js +3 -3
- package/SankeyChart/seriesConfig/index.d.ts +1 -1
- package/SankeyChart/seriesConfig/index.js +2 -2
- package/ScatterChartPro/ScatterChartPro.js +11 -2
- package/ScatterChartPro/ScatterChartPro.plugins.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.plugins.js +1 -1
- package/esm/BarChartPro/BarChartPro.js +12 -2
- package/esm/BarChartPro/BarChartPro.plugins.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.plugins.js +1 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -2
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -2
- package/esm/ChartZoomSlider/ChartZoomSlider.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +2 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +2 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +2 -2
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +2 -3
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +2 -2
- package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +1 -2
- package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +2 -2
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +1 -2
- package/esm/ChartsToolbarPro/internals/ChartsMenu.d.ts +1 -1
- package/esm/FunnelChart/FunnelChart.js +1 -1
- package/esm/FunnelChart/FunnelPlot.d.ts +1 -1
- package/esm/FunnelChart/FunnelPlot.js +4 -24
- package/esm/FunnelChart/coordinateMapper.d.ts +3 -0
- package/esm/FunnelChart/coordinateMapper.js +11 -0
- package/esm/FunnelChart/funnel.types.d.ts +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/computeAxisValue.js +1 -2
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +7 -7
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +6 -44
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.js +3 -2
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/esm/FunnelChart/seriesConfig/index.d.ts +1 -1
- package/esm/FunnelChart/seriesConfig/index.js +3 -1
- package/esm/FunnelChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/tooltipPosition.js +56 -0
- package/esm/Heatmap/Heatmap.js +1 -1
- package/esm/Heatmap/Heatmap.plugins.d.ts +1 -1
- package/esm/Heatmap/Heatmap.plugins.js +1 -1
- package/esm/Heatmap/HeatmapItem.d.ts +1 -1
- package/esm/Heatmap/HeatmapPlot.d.ts +1 -2
- package/esm/Heatmap/HeatmapPlot.js +0 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -2
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +9 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +1 -2
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +0 -1
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +3 -2
- package/esm/Heatmap/seriesConfig/index.d.ts +1 -1
- package/esm/Heatmap/seriesConfig/index.js +3 -1
- package/esm/Heatmap/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/Heatmap/seriesConfig/tooltipPosition.js +51 -0
- package/esm/LineChartPro/LineChartPro.js +11 -2
- package/esm/LineChartPro/LineChartPro.plugins.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.plugins.js +1 -1
- package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.plugins.js +1 -1
- package/esm/SankeyChart/SankeyChart.js +1 -1
- package/esm/SankeyChart/SankeyLinkElement.js +2 -2
- package/esm/SankeyChart/SankeyNodeElement.js +2 -2
- package/esm/SankeyChart/SankeyPlot.d.ts +1 -1
- package/esm/SankeyChart/SankeyTooltip/SankeyTooltip.d.ts +1 -2
- package/esm/SankeyChart/SankeyTooltip/SankeyTooltip.js +9 -1
- package/esm/SankeyChart/SankeyTooltip/SankeyTooltipContent.d.ts +1 -2
- package/esm/SankeyChart/SankeyTooltip/SankeyTooltipContent.js +0 -1
- package/esm/SankeyChart/plugins/useSankeyHighlight.js +8 -12
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +19 -23
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.js +3 -3
- package/esm/SankeyChart/seriesConfig/index.d.ts +1 -1
- package/esm/SankeyChart/seriesConfig/index.js +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +11 -2
- package/esm/ScatterChartPro/ScatterChartPro.plugins.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.plugins.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/material/components/BaseMenuItem.d.ts +1 -2
- package/esm/internals/material/components/BaseMenuItem.js +0 -1
- package/esm/internals/material/components/BasePopper.d.ts +1 -2
- package/esm/internals/plugins/allPlugins.d.ts +5 -5
- package/esm/internals/plugins/allPlugins.js +3 -3
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +19 -4
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.js +4 -3
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +11 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +23 -15
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +27 -15
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.d.ts +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.js +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +100 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +8 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +57 -0
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +2 -2
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +34 -54
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +11 -27
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +2 -2
- package/esm/models/seriesType/heatmap.d.ts +1 -1
- package/index.js +1 -1
- package/internals/material/components/BaseMenuItem.d.ts +1 -2
- package/internals/material/components/BaseMenuItem.js +0 -2
- package/internals/material/components/BasePopper.d.ts +1 -2
- package/internals/plugins/allPlugins.d.ts +5 -5
- package/internals/plugins/allPlugins.js +2 -2
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +19 -4
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.js +4 -3
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +11 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +23 -15
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +27 -15
- package/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.d.ts +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.js +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +107 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +8 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +64 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +2 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.js +34 -54
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +11 -27
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +2 -2
- package/models/seriesType/heatmap.d.ts +1 -1
- package/package.json +4 -4
|
@@ -12,9 +12,8 @@ export const usePanOnDrag = ({
|
|
|
12
12
|
}, setZoomDataCallback) => {
|
|
13
13
|
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const isPanOnDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && Boolean(config) || false, [optionsLookup, config]);
|
|
15
|
+
const config = useSelector(store, selectorPanInteractionConfig, 'drag');
|
|
16
|
+
const isPanOnDragEnabled = Object.values(optionsLookup).some(v => v.panning) && Boolean(config);
|
|
18
17
|
React.useEffect(() => {
|
|
19
18
|
if (!isPanOnDragEnabled) {
|
|
20
19
|
return;
|
|
@@ -32,33 +31,42 @@ export const usePanOnDrag = ({
|
|
|
32
31
|
// Add event for chart panning
|
|
33
32
|
React.useEffect(() => {
|
|
34
33
|
const element = svgRef.current;
|
|
34
|
+
let isInteracting = false;
|
|
35
|
+
const accumulatedChange = {
|
|
36
|
+
x: 0,
|
|
37
|
+
y: 0
|
|
38
|
+
};
|
|
35
39
|
if (element === null || !isPanOnDragEnabled) {
|
|
36
40
|
return () => {};
|
|
37
41
|
}
|
|
38
42
|
const handlePanStart = event => {
|
|
39
43
|
if (!event.detail.target?.closest('[data-charts-zoom-slider]')) {
|
|
40
|
-
|
|
44
|
+
isInteracting = true;
|
|
41
45
|
}
|
|
42
46
|
};
|
|
43
47
|
const handlePanEnd = () => {
|
|
44
|
-
|
|
48
|
+
isInteracting = false;
|
|
45
49
|
};
|
|
46
|
-
const throttledCallback = rafThrottle((
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
const throttledCallback = rafThrottle(() => {
|
|
51
|
+
const x = accumulatedChange.x;
|
|
52
|
+
const y = accumulatedChange.y;
|
|
53
|
+
accumulatedChange.x = 0;
|
|
54
|
+
accumulatedChange.y = 0;
|
|
55
|
+
setZoomDataCallback(prev => translateZoom(prev, {
|
|
56
|
+
x,
|
|
57
|
+
y: -y
|
|
50
58
|
}, {
|
|
51
59
|
width: drawingArea.width,
|
|
52
60
|
height: drawingArea.height
|
|
53
|
-
}, optionsLookup);
|
|
54
|
-
setZoomDataCallback(newZoomData);
|
|
61
|
+
}, optionsLookup));
|
|
55
62
|
});
|
|
56
63
|
const handlePan = event => {
|
|
57
|
-
|
|
58
|
-
if (!zoomData) {
|
|
64
|
+
if (!isInteracting) {
|
|
59
65
|
return;
|
|
60
66
|
}
|
|
61
|
-
|
|
67
|
+
accumulatedChange.x += event.detail.deltaX;
|
|
68
|
+
accumulatedChange.y += event.detail.deltaY;
|
|
69
|
+
throttledCallback();
|
|
62
70
|
};
|
|
63
71
|
const panHandler = instance.addInteractionListener('zoomPan', handlePan);
|
|
64
72
|
const panStartHandler = instance.addInteractionListener('zoomPanStart', handlePanStart);
|
|
@@ -69,5 +77,5 @@ export const usePanOnDrag = ({
|
|
|
69
77
|
panEndHandler.cleanup();
|
|
70
78
|
throttledCallback.clear();
|
|
71
79
|
};
|
|
72
|
-
}, [instance, svgRef, isPanOnDragEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store
|
|
80
|
+
}, [instance, svgRef, isPanOnDragEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store]);
|
|
73
81
|
};
|
|
@@ -12,9 +12,13 @@ export const usePanOnPressAndDrag = ({
|
|
|
12
12
|
}, setZoomDataCallback) => {
|
|
13
13
|
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
15
|
+
const isInteracting = React.useRef(false);
|
|
16
|
+
const accumulatedChange = React.useRef({
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0
|
|
19
|
+
});
|
|
20
|
+
const config = useSelector(store, selectorPanInteractionConfig, 'pressAndDrag');
|
|
21
|
+
const isPanOnPressAndDragEnabled = Object.values(optionsLookup).some(v => v.panning) && Boolean(config);
|
|
18
22
|
React.useEffect(() => {
|
|
19
23
|
if (!isPanOnPressAndDragEnabled) {
|
|
20
24
|
return;
|
|
@@ -37,28 +41,36 @@ export const usePanOnPressAndDrag = ({
|
|
|
37
41
|
}
|
|
38
42
|
const handlePressAndDragStart = event => {
|
|
39
43
|
if (!event.detail.target?.closest('[data-charts-zoom-slider]')) {
|
|
40
|
-
|
|
44
|
+
isInteracting.current = true;
|
|
45
|
+
accumulatedChange.current = {
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0
|
|
48
|
+
};
|
|
41
49
|
}
|
|
42
50
|
};
|
|
43
51
|
const handlePressAndDragEnd = () => {
|
|
44
|
-
|
|
52
|
+
isInteracting.current = false;
|
|
45
53
|
};
|
|
46
|
-
const throttledCallback = rafThrottle((
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
const throttledCallback = rafThrottle(() => {
|
|
55
|
+
const x = accumulatedChange.current.x;
|
|
56
|
+
const y = accumulatedChange.current.y;
|
|
57
|
+
accumulatedChange.current.x = 0;
|
|
58
|
+
accumulatedChange.current.y = 0;
|
|
59
|
+
setZoomDataCallback(prev => translateZoom(prev, {
|
|
60
|
+
x,
|
|
61
|
+
y: -y
|
|
50
62
|
}, {
|
|
51
63
|
width: drawingArea.width,
|
|
52
64
|
height: drawingArea.height
|
|
53
|
-
}, optionsLookup);
|
|
54
|
-
setZoomDataCallback(newZoomData);
|
|
65
|
+
}, optionsLookup));
|
|
55
66
|
});
|
|
56
67
|
const handlePressAndDrag = event => {
|
|
57
|
-
|
|
58
|
-
if (!zoomData) {
|
|
68
|
+
if (!isInteracting.current) {
|
|
59
69
|
return;
|
|
60
70
|
}
|
|
61
|
-
|
|
71
|
+
accumulatedChange.current.x += event.detail.deltaX;
|
|
72
|
+
accumulatedChange.current.y += event.detail.deltaY;
|
|
73
|
+
throttledCallback();
|
|
62
74
|
};
|
|
63
75
|
const pressAndDragHandler = instance.addInteractionListener('zoomPressAndDrag', handlePressAndDrag);
|
|
64
76
|
const pressAndDragStartHandler = instance.addInteractionListener('zoomPressAndDragStart', handlePressAndDragStart);
|
|
@@ -69,5 +81,5 @@ export const usePanOnPressAndDrag = ({
|
|
|
69
81
|
pressAndDragEndHandler.cleanup();
|
|
70
82
|
throttledCallback.clear();
|
|
71
83
|
};
|
|
72
|
-
}, [instance, svgRef, isPanOnPressAndDragEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store,
|
|
84
|
+
}, [instance, svgRef, isPanOnPressAndDragEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store, isInteracting]);
|
|
73
85
|
};
|
|
@@ -26,7 +26,7 @@ export declare function getHorizontalCenterRatio(point: {
|
|
|
26
26
|
}, area: {
|
|
27
27
|
left: number;
|
|
28
28
|
width: number;
|
|
29
|
-
}, reverse
|
|
29
|
+
}, reverse: boolean): number;
|
|
30
30
|
/**
|
|
31
31
|
* Get the ratio of the point in the vertical center of the area.
|
|
32
32
|
*/
|
|
@@ -36,7 +36,7 @@ export declare function getVerticalCenterRatio(point: {
|
|
|
36
36
|
}, area: {
|
|
37
37
|
top: number;
|
|
38
38
|
height: number;
|
|
39
|
-
}, reverse
|
|
39
|
+
}, reverse: boolean): number;
|
|
40
40
|
/**
|
|
41
41
|
* Translate the zoom data by a given movement.
|
|
42
42
|
*/
|
|
@@ -80,7 +80,7 @@ export function getWheelScaleRatio(event, step) {
|
|
|
80
80
|
/**
|
|
81
81
|
* Get the ratio of the point in the horizontal center of the area.
|
|
82
82
|
*/
|
|
83
|
-
export function getHorizontalCenterRatio(point, area, reverse
|
|
83
|
+
export function getHorizontalCenterRatio(point, area, reverse) {
|
|
84
84
|
const {
|
|
85
85
|
left,
|
|
86
86
|
width
|
|
@@ -92,7 +92,7 @@ export function getHorizontalCenterRatio(point, area, reverse = false) {
|
|
|
92
92
|
/**
|
|
93
93
|
* Get the ratio of the point in the vertical center of the area.
|
|
94
94
|
*/
|
|
95
|
-
export function getVerticalCenterRatio(point, area, reverse
|
|
95
|
+
export function getVerticalCenterRatio(point, area, reverse) {
|
|
96
96
|
const {
|
|
97
97
|
top,
|
|
98
98
|
height
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartPlugin, ZoomData } from '@mui/x-charts/internals';
|
|
3
|
+
import { UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
|
+
export declare const useZoomOnBrush: ({
|
|
5
|
+
store,
|
|
6
|
+
instance,
|
|
7
|
+
svgRef
|
|
8
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<(prev: ZoomData[]) => ZoomData[]>) => void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useSelector, getSVGPoint, selectorChartDrawingArea, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
|
+
import { getHorizontalCenterRatio, getVerticalCenterRatio, isSpanValid } from "./useZoom.utils.js";
|
|
6
|
+
import { selectorZoomInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
7
|
+
export const useZoomOnBrush = ({
|
|
8
|
+
store,
|
|
9
|
+
instance,
|
|
10
|
+
svgRef
|
|
11
|
+
}, setZoomDataCallback) => {
|
|
12
|
+
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
13
|
+
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
14
|
+
const config = useSelector(store, selectorZoomInteractionConfig, 'brush');
|
|
15
|
+
const isZoomOnBrushEnabled = Object.keys(optionsLookup).length > 0 && Boolean(config);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
instance.setZoomBrushEnabled(isZoomOnBrushEnabled);
|
|
18
|
+
}, [isZoomOnBrushEnabled, instance]);
|
|
19
|
+
|
|
20
|
+
// Zoom on brush
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
const element = svgRef.current;
|
|
23
|
+
if (element === null || !isZoomOnBrushEnabled) {
|
|
24
|
+
return () => {};
|
|
25
|
+
}
|
|
26
|
+
const handleBrushEnd = event => {
|
|
27
|
+
// Convert the brush rectangle to zoom percentages for each axis
|
|
28
|
+
setZoomDataCallback(prev => {
|
|
29
|
+
const startPoint = getSVGPoint(element, {
|
|
30
|
+
clientX: event.detail.initialCentroid.x,
|
|
31
|
+
clientY: event.detail.initialCentroid.y
|
|
32
|
+
});
|
|
33
|
+
const endPoint = getSVGPoint(element, {
|
|
34
|
+
clientX: event.detail.centroid.x,
|
|
35
|
+
clientY: event.detail.centroid.y
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Calculate the brush rectangle
|
|
39
|
+
const minX = Math.min(startPoint.x, endPoint.x);
|
|
40
|
+
const maxX = Math.max(startPoint.x, endPoint.x);
|
|
41
|
+
const minY = Math.min(startPoint.y, endPoint.y);
|
|
42
|
+
const maxY = Math.max(startPoint.y, endPoint.y);
|
|
43
|
+
return prev.map(zoom => {
|
|
44
|
+
const option = optionsLookup[zoom.axisId];
|
|
45
|
+
if (!option) {
|
|
46
|
+
return zoom;
|
|
47
|
+
}
|
|
48
|
+
let startRatio;
|
|
49
|
+
let endRatio;
|
|
50
|
+
const reverse = option.reverse;
|
|
51
|
+
if (option.axisDirection === 'x') {
|
|
52
|
+
startRatio = getHorizontalCenterRatio({
|
|
53
|
+
x: minX,
|
|
54
|
+
y: 0
|
|
55
|
+
}, drawingArea, reverse);
|
|
56
|
+
endRatio = getHorizontalCenterRatio({
|
|
57
|
+
x: maxX,
|
|
58
|
+
y: 0
|
|
59
|
+
}, drawingArea, reverse);
|
|
60
|
+
} else {
|
|
61
|
+
startRatio = getVerticalCenterRatio({
|
|
62
|
+
x: 0,
|
|
63
|
+
y: maxY
|
|
64
|
+
}, drawingArea, reverse);
|
|
65
|
+
endRatio = getVerticalCenterRatio({
|
|
66
|
+
x: 0,
|
|
67
|
+
y: minY
|
|
68
|
+
}, drawingArea, reverse);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Ensure start < end regardless of reverse
|
|
72
|
+
const minRatio = Math.min(startRatio, endRatio);
|
|
73
|
+
const maxRatio = Math.max(startRatio, endRatio);
|
|
74
|
+
|
|
75
|
+
// Calculate the new zoom range based on the current zoom state
|
|
76
|
+
// This is important: we need to map the brush selection ratios to the current zoom range
|
|
77
|
+
const currentStart = zoom.start;
|
|
78
|
+
const currentEnd = zoom.end;
|
|
79
|
+
const currentSpan = currentEnd - currentStart;
|
|
80
|
+
const newStart = currentStart + minRatio * currentSpan;
|
|
81
|
+
const newEnd = currentStart + maxRatio * currentSpan;
|
|
82
|
+
const clampedStart = Math.max(option.minStart, Math.min(option.maxEnd, newStart));
|
|
83
|
+
const clampedEnd = Math.max(option.minStart, Math.min(option.maxEnd, newEnd));
|
|
84
|
+
if (!isSpanValid(clampedStart, clampedEnd, true, option)) {
|
|
85
|
+
return zoom;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
axisId: zoom.axisId,
|
|
89
|
+
start: clampedStart,
|
|
90
|
+
end: clampedEnd
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const brushEndHandler = instance.addInteractionListener('brushEnd', handleBrushEnd);
|
|
96
|
+
return () => {
|
|
97
|
+
brushEndHandler.cleanup();
|
|
98
|
+
};
|
|
99
|
+
}, [svgRef, drawingArea, isZoomOnBrushEnabled, optionsLookup, instance, setZoomDataCallback, store]);
|
|
100
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartPlugin, ZoomData } from '@mui/x-charts/internals';
|
|
3
|
+
import { UseChartProZoomSignature } from "../useChartProZoom.types.js";
|
|
4
|
+
export declare const useZoomOnDoubleTapReset: ({
|
|
5
|
+
store,
|
|
6
|
+
instance,
|
|
7
|
+
svgRef
|
|
8
|
+
}: Pick<Parameters<ChartPlugin<UseChartProZoomSignature>>[0], "store" | "instance" | "svgRef">, setZoomDataCallback: React.Dispatch<ZoomData[] | ((prev: ZoomData[]) => ZoomData[])>) => void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useSelector, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
5
|
+
import { selectorZoomInteractionConfig } from "../ZoomInteractionConfig.selectors.js";
|
|
6
|
+
export const useZoomOnDoubleTapReset = ({
|
|
7
|
+
store,
|
|
8
|
+
instance,
|
|
9
|
+
svgRef
|
|
10
|
+
}, setZoomDataCallback) => {
|
|
11
|
+
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
12
|
+
const config = useSelector(store, selectorZoomInteractionConfig, 'doubleTapReset');
|
|
13
|
+
const isZoomOnDoubleTapResetEnabled = Object.keys(optionsLookup).length > 0 && Boolean(config);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
if (!isZoomOnDoubleTapResetEnabled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
instance.updateZoomInteractionListeners('zoomDoubleTapReset', {
|
|
19
|
+
requiredKeys: config.requiredKeys,
|
|
20
|
+
pointerMode: config.pointerMode,
|
|
21
|
+
pointerOptions: {
|
|
22
|
+
mouse: config.mouse,
|
|
23
|
+
touch: config.touch
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}, [config, isZoomOnDoubleTapResetEnabled, instance]);
|
|
27
|
+
|
|
28
|
+
// Reset zoom on double tap
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const element = svgRef.current;
|
|
31
|
+
if (element === null || !isZoomOnDoubleTapResetEnabled) {
|
|
32
|
+
return () => {};
|
|
33
|
+
}
|
|
34
|
+
const handleDoubleTapReset = () => {
|
|
35
|
+
// Reset all axes to their default zoom state
|
|
36
|
+
setZoomDataCallback(prev => {
|
|
37
|
+
return prev.map(zoom => {
|
|
38
|
+
const option = optionsLookup[zoom.axisId];
|
|
39
|
+
if (!option) {
|
|
40
|
+
return zoom;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Reset to the full range (minStart to maxEnd)
|
|
44
|
+
return {
|
|
45
|
+
axisId: zoom.axisId,
|
|
46
|
+
start: option.minStart,
|
|
47
|
+
end: option.maxEnd
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const doubleTapResetHandler = instance.addInteractionListener('zoomDoubleTapReset', handleDoubleTapReset);
|
|
53
|
+
return () => {
|
|
54
|
+
doubleTapResetHandler.cleanup();
|
|
55
|
+
};
|
|
56
|
+
}, [svgRef, isZoomOnDoubleTapResetEnabled, optionsLookup, instance, setZoomDataCallback, store]);
|
|
57
|
+
};
|
|
@@ -12,8 +12,8 @@ export const useZoomOnPinch = ({
|
|
|
12
12
|
}, setZoomDataCallback) => {
|
|
13
13
|
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
|
-
const config = useSelector(store, selectorZoomInteractionConfig,
|
|
16
|
-
const isZoomOnPinchEnabled =
|
|
15
|
+
const config = useSelector(store, selectorZoomInteractionConfig, 'pinch');
|
|
16
|
+
const isZoomOnPinchEnabled = Object.keys(optionsLookup).length > 0 && Boolean(config);
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
if (!isZoomOnPinchEnabled) {
|
|
19
19
|
return;
|
|
@@ -12,8 +12,8 @@ export const useZoomOnTapAndDrag = ({
|
|
|
12
12
|
}, setZoomDataCallback) => {
|
|
13
13
|
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
|
-
const config = useSelector(store, selectorZoomInteractionConfig,
|
|
16
|
-
const isZoomOnTapAndDragEnabled =
|
|
15
|
+
const config = useSelector(store, selectorZoomInteractionConfig, 'tapAndDrag');
|
|
16
|
+
const isZoomOnTapAndDragEnabled = Object.keys(optionsLookup).length > 0 && Boolean(config);
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
if (!isZoomOnTapAndDragEnabled) {
|
|
19
19
|
return;
|
|
@@ -14,8 +14,8 @@ export const useZoomOnWheel = ({
|
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
15
|
const startedOutsideRef = React.useRef(false);
|
|
16
16
|
const startedOutsideTimeoutRef = React.useRef(null);
|
|
17
|
-
const config = useSelector(store, selectorZoomInteractionConfig,
|
|
18
|
-
const isZoomOnWheelEnabled =
|
|
17
|
+
const config = useSelector(store, selectorZoomInteractionConfig, 'wheel');
|
|
18
|
+
const isZoomOnWheelEnabled = Object.keys(optionsLookup).length > 0 && Boolean(config);
|
|
19
19
|
React.useEffect(() => {
|
|
20
20
|
if (!isZoomOnWheelEnabled) {
|
|
21
21
|
return;
|
|
@@ -12,6 +12,8 @@ import { useZoomOnPinch } from "./gestureHooks/useZoomOnPinch.js";
|
|
|
12
12
|
import { usePanOnDrag } from "./gestureHooks/usePanOnDrag.js";
|
|
13
13
|
import { useZoomOnTapAndDrag } from "./gestureHooks/useZoomOnTapAndDrag.js";
|
|
14
14
|
import { usePanOnPressAndDrag } from "./gestureHooks/usePanOnPressAndDrag.js";
|
|
15
|
+
import { useZoomOnBrush } from "./gestureHooks/useZoomOnBrush.js";
|
|
16
|
+
import { useZoomOnDoubleTapReset } from "./gestureHooks/useZoomOnDoubleTapReset.js";
|
|
15
17
|
import { initializeZoomInteractionConfig } from "./initializeZoomInteractionConfig.js";
|
|
16
18
|
import { initializeZoomData } from "./initializeZoomData.js";
|
|
17
19
|
export const useChartProZoom = pluginData => {
|
|
@@ -27,68 +29,44 @@ export const useChartProZoom = pluginData => {
|
|
|
27
29
|
const onZoomChange = useEventCallback(onZoomChangeProp ?? (() => {}));
|
|
28
30
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
29
31
|
useEffectAfterFirstRender(() => {
|
|
30
|
-
store.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
zoomInteractionConfig: initializeZoomInteractionConfig(zoomInteractionConfig)
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
});
|
|
32
|
+
store.set('zoom', _extends({}, store.state.zoom, {
|
|
33
|
+
zoomInteractionConfig: initializeZoomInteractionConfig(zoomInteractionConfig)
|
|
34
|
+
}));
|
|
37
35
|
}, [store, zoomInteractionConfig]);
|
|
38
36
|
|
|
37
|
+
// This is debounced. We want to run it only once after the interaction ends.
|
|
38
|
+
const removeIsInteracting = React.useMemo(() => debounce(() => store.set('zoom', _extends({}, store.state.zoom, {
|
|
39
|
+
isInteracting: false
|
|
40
|
+
})), 166), [store]);
|
|
41
|
+
|
|
39
42
|
// Manage controlled state
|
|
40
43
|
React.useEffect(() => {
|
|
41
44
|
if (paramsZoomData === undefined) {
|
|
42
|
-
return
|
|
45
|
+
return;
|
|
43
46
|
}
|
|
44
|
-
store.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
const timeout = setTimeout(() => {
|
|
56
|
-
store.update(prevState => {
|
|
57
|
-
return _extends({}, prevState, {
|
|
58
|
-
zoom: _extends({}, prevState.zoom, {
|
|
59
|
-
isInteracting: false
|
|
60
|
-
})
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}, 166);
|
|
64
|
-
return () => {
|
|
65
|
-
clearTimeout(timeout);
|
|
66
|
-
};
|
|
67
|
-
}, [store, paramsZoomData]);
|
|
68
|
-
|
|
69
|
-
// This is debounced. We want to run it only once after the interaction ends.
|
|
70
|
-
const removeIsInteracting = React.useMemo(() => debounce(() => store.update(prevState => {
|
|
71
|
-
return _extends({}, prevState, {
|
|
72
|
-
zoom: _extends({}, prevState.zoom, {
|
|
73
|
-
isInteracting: false
|
|
74
|
-
})
|
|
75
|
-
});
|
|
76
|
-
}), 166), [store]);
|
|
47
|
+
if (process.env.NODE_ENV !== 'production' && !store.state.zoom.isControlled) {
|
|
48
|
+
console.error([`MUI X Charts: A chart component is changing the \`zoomData\` from uncontrolled to controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', 'Decide between using a controlled or uncontrolled for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
49
|
+
}
|
|
50
|
+
store.set('zoom', _extends({}, store.state.zoom, {
|
|
51
|
+
isInteracting: true,
|
|
52
|
+
zoomData: paramsZoomData
|
|
53
|
+
}));
|
|
54
|
+
removeIsInteracting();
|
|
55
|
+
}, [store, paramsZoomData, removeIsInteracting]);
|
|
77
56
|
const setZoomDataCallback = React.useCallback(zoomData => {
|
|
78
|
-
store.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
57
|
+
const newZoomData = typeof zoomData === 'function' ? zoomData([...store.state.zoom.zoomData]) : zoomData;
|
|
58
|
+
onZoomChange(newZoomData);
|
|
59
|
+
if (store.state.zoom.isControlled) {
|
|
60
|
+
store.set('zoom', _extends({}, store.state.zoom, {
|
|
61
|
+
isInteracting: true
|
|
62
|
+
}));
|
|
63
|
+
} else {
|
|
64
|
+
store.set('zoom', _extends({}, store.state.zoom, {
|
|
65
|
+
isInteracting: true,
|
|
66
|
+
zoomData: newZoomData
|
|
67
|
+
}));
|
|
84
68
|
removeIsInteracting();
|
|
85
|
-
|
|
86
|
-
zoom: _extends({}, prevState.zoom, {
|
|
87
|
-
isInteracting: true,
|
|
88
|
-
zoomData: newZoomData
|
|
89
|
-
})
|
|
90
|
-
});
|
|
91
|
-
});
|
|
69
|
+
}
|
|
92
70
|
}, [onZoomChange, store, removeIsInteracting]);
|
|
93
71
|
const setAxisZoomData = React.useCallback((axisId, zoomData) => {
|
|
94
72
|
setZoomDataCallback(prev => prev.map(prevZoom => {
|
|
@@ -138,6 +116,8 @@ export const useChartProZoom = pluginData => {
|
|
|
138
116
|
useZoomOnWheel(pluginData, setZoomDataCallback);
|
|
139
117
|
useZoomOnPinch(pluginData, setZoomDataCallback);
|
|
140
118
|
useZoomOnTapAndDrag(pluginData, setZoomDataCallback);
|
|
119
|
+
useZoomOnBrush(pluginData, setZoomDataCallback);
|
|
120
|
+
useZoomOnDoubleTapReset(pluginData, setZoomDataCallback);
|
|
141
121
|
const zoom = React.useCallback(step => {
|
|
142
122
|
setZoomDataCallback(prev => prev.map(zoomData => {
|
|
143
123
|
const zoomOptions = selectorChartAxisZoomOptionsLookup(store.getSnapshot(), zoomData.axisId);
|
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
import { AxisId, ChartRootSelector } from '@mui/x-charts/internals';
|
|
2
2
|
import { UseChartProZoomSignature } from "./useChartProZoom.types.js";
|
|
3
|
-
export declare const selectorChartZoomState: ChartRootSelector<UseChartProZoomSignature>;
|
|
4
|
-
export declare const selectorChartZoomIsInteracting:
|
|
3
|
+
export declare const selectorChartZoomState: ChartRootSelector<UseChartProZoomSignature, 'zoom'>;
|
|
4
|
+
export declare const selectorChartZoomIsInteracting: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
5
5
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
6
|
-
}
|
|
6
|
+
}) => boolean;
|
|
7
|
+
export declare const selectorChartZoomIsEnabled: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
|
|
7
8
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
8
|
-
}
|
|
9
|
-
export declare const
|
|
9
|
+
}) => boolean;
|
|
10
|
+
export declare const selectorChartAxisZoomData: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
|
|
10
11
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
11
|
-
}
|
|
12
|
+
}, axisId: AxisId) => import("@mui/x-charts/internals").ZoomData | undefined;
|
|
13
|
+
export declare const selectorChartCanZoomOut: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
12
14
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
13
|
-
}
|
|
15
|
+
}) => boolean;
|
|
16
|
+
export declare const selectorChartCanZoomIn: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
14
17
|
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
15
|
-
}
|
|
16
|
-
export declare const selectorChartAxisZoomData: import("reselect").Selector<any, import("@mui/x-charts/internals").ZoomData | undefined, [axisId: AxisId]>;
|
|
17
|
-
export declare const selectorChartCanZoomOut: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
18
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
19
|
-
} & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
|
|
20
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
21
|
-
} & {
|
|
22
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
23
|
-
} & {
|
|
24
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
25
|
-
}, boolean, any[]>;
|
|
26
|
-
export declare const selectorChartCanZoomIn: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
|
|
27
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
28
|
-
} & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
|
|
29
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
30
|
-
} & {
|
|
31
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
32
|
-
} & {
|
|
33
|
-
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
34
|
-
}, boolean, any[]>;
|
|
18
|
+
}) => boolean;
|
|
@@ -2,7 +2,7 @@ import { createSelector, selectorChartZoomMap, selectorChartZoomOptionsLookup }
|
|
|
2
2
|
export const selectorChartZoomState = state => state.zoom;
|
|
3
3
|
export const selectorChartZoomIsInteracting = createSelector([selectorChartZoomState], zoom => zoom.isInteracting);
|
|
4
4
|
export const selectorChartZoomIsEnabled = createSelector([selectorChartZoomOptionsLookup], optionsLookup => Object.keys(optionsLookup).length > 0);
|
|
5
|
-
export const selectorChartAxisZoomData = createSelector([selectorChartZoomMap
|
|
5
|
+
export const selectorChartAxisZoomData = createSelector([selectorChartZoomMap], (zoomMap, axisId) => zoomMap?.get(axisId));
|
|
6
6
|
export const selectorChartCanZoomOut = createSelector([selectorChartZoomState, selectorChartZoomOptionsLookup], (zoomState, zoomOptions) => {
|
|
7
7
|
return zoomState.zoomData.every(zoomData => {
|
|
8
8
|
const span = zoomData.end - zoomData.start;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData, AxisId } from '@mui/x-charts/internals';
|
|
1
|
+
import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData, AxisId, type UseChartBrushSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { ZoomInteractionConfig, DefaultizedZoomInteractionConfig } from "./ZoomInteractionConfig.types.js";
|
|
3
3
|
export interface UseChartProZoomParameters {
|
|
4
4
|
/**
|
|
@@ -80,5 +80,5 @@ export type UseChartProZoomSignature = ChartPluginSignature<{
|
|
|
80
80
|
state: UseChartProZoomState;
|
|
81
81
|
publicAPI: UseChartProZoomPublicApi;
|
|
82
82
|
instance: UseChartProZoomInstance;
|
|
83
|
-
dependencies: [UseChartSeriesSignature, UseChartCartesianAxisSignature];
|
|
83
|
+
dependencies: [UseChartSeriesSignature, UseChartCartesianAxisSignature, UseChartBrushSignature];
|
|
84
84
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
2
2
|
import { CommonDefaultizedProps, CommonSeriesType, CartesianSeriesType } from '@mui/x-charts/internals';
|
|
3
3
|
export type HeatmapValueType = readonly [number, number, number];
|
|
4
|
-
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType>, 'color'>, CartesianSeriesType {
|
|
4
|
+
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType>, 'color' | 'colorGetter'>, CartesianSeriesType {
|
|
5
5
|
type: 'heatmap';
|
|
6
6
|
/**
|
|
7
7
|
* Data associated to each bar.
|
package/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { ChartBaseMenuItemProps } from "../../slots/chartBaseSlotProps.js";
|
|
3
|
-
export declare function BaseMenuItem(props: ChartBaseMenuItemProps):
|
|
2
|
+
export declare function BaseMenuItem(props: ChartBaseMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.BaseMenuItem = BaseMenuItem;
|
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
-
var React = _interopRequireWildcard(require("react"));
|
|
12
10
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
13
11
|
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
14
12
|
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|