@mui/x-charts-pro 8.0.0-alpha.0 → 8.0.0-alpha.10
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.d.ts +2 -2
- package/BarChartPro/BarChartPro.js +74 -61
- package/CHANGELOG.md +2215 -119
- package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
- package/ChartContainerPro/ChartContainerPro.js +59 -51
- package/ChartContainerPro/useChartContainerProProps.d.ts +7 -43
- package/ChartContainerPro/useChartContainerProProps.js +15 -9
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +71 -80
- package/{context → ChartDataProviderPro}/package.json +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/Heatmap/Heatmap.d.ts +11 -4
- package/Heatmap/Heatmap.js +35 -43
- package/Heatmap/HeatmapItem.js +1 -1
- package/Heatmap/HeatmapTooltip.d.ts +9 -0
- package/Heatmap/HeatmapTooltip.js +274 -0
- package/Heatmap/extremums.d.ts +2 -2
- package/Heatmap/formatter.d.ts +2 -2
- package/Heatmap/formatter.js +2 -1
- package/Heatmap/heatmapClasses.js +2 -1
- package/Heatmap/index.d.ts +1 -1
- package/Heatmap/index.js +1 -1
- package/Heatmap/plugin.d.ts +2 -2
- package/Heatmap/plugin.js +4 -2
- package/Heatmap/tooltip.d.ts +3 -0
- package/Heatmap/tooltip.js +25 -0
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +80 -82
- package/README.md +3 -3
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +51 -64
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useSeries.d.ts +2 -4
- package/hooks/zoom/index.d.ts +1 -0
- package/hooks/zoom/index.js +1 -0
- package/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
- package/hooks/zoom/useIsZoomInteracting.js +14 -0
- package/index.d.ts +3 -1
- package/index.js +5 -5
- package/internals/plugins/allPlugins.d.ts +11 -0
- package/internals/plugins/allPlugins.js +5 -0
- package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +3 -0
- package/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
- package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +2 -0
- package/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
- package/internals/plugins/useChartProZoom/index.d.ts +3 -0
- package/internals/plugins/useChartProZoom/index.js +3 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +377 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +50 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
- package/internals/plugins/useChartProZoom/zoom.types.d.ts +53 -0
- package/internals/utils/releaseInfo.js +2 -2
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/BarChartPro/BarChartPro.js +74 -61
- package/modern/ChartContainerPro/ChartContainerPro.js +59 -51
- package/modern/ChartContainerPro/useChartContainerProProps.js +15 -9
- package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +71 -80
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/modern/Heatmap/Heatmap.js +35 -43
- package/modern/Heatmap/HeatmapItem.js +1 -1
- package/modern/Heatmap/HeatmapTooltip.js +274 -0
- package/modern/Heatmap/formatter.js +2 -1
- package/modern/Heatmap/heatmapClasses.js +2 -1
- package/modern/Heatmap/index.js +1 -1
- package/modern/Heatmap/plugin.js +4 -2
- package/modern/Heatmap/tooltip.js +25 -0
- package/modern/LineChartPro/LineChartPro.js +80 -82
- package/modern/ScatterChartPro/ScatterChartPro.js +51 -64
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/zoom/index.js +1 -0
- package/modern/hooks/zoom/useIsZoomInteracting.js +14 -0
- package/modern/index.js +5 -5
- package/modern/internals/plugins/allPlugins.js +5 -0
- package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
- package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
- package/modern/internals/plugins/useChartProZoom/index.js +3 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +1 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
- package/modern/internals/plugins/useChartProZoom/zoom.types.js +1 -0
- package/modern/internals/utils/releaseInfo.js +2 -2
- package/modern/models/index.js +2 -1
- package/node/BarChartPro/BarChartPro.js +73 -60
- package/node/ChartContainerPro/ChartContainerPro.js +58 -50
- package/node/ChartContainerPro/useChartContainerProProps.js +15 -9
- package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -79
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +21 -0
- package/node/Heatmap/Heatmap.js +35 -43
- package/node/Heatmap/HeatmapItem.js +2 -2
- package/node/Heatmap/HeatmapTooltip.js +280 -0
- package/node/Heatmap/formatter.js +2 -1
- package/node/Heatmap/heatmapClasses.js +5 -4
- package/node/Heatmap/index.js +4 -4
- package/node/Heatmap/plugin.js +4 -2
- package/node/Heatmap/tooltip.js +31 -0
- package/node/LineChartPro/LineChartPro.js +79 -81
- package/node/ScatterChartPro/ScatterChartPro.js +50 -63
- package/node/hooks/index.js +16 -1
- package/node/{context/CartesianProviderPro → hooks/zoom}/index.js +4 -4
- package/node/hooks/zoom/useIsZoomInteracting.js +19 -0
- package/node/index.js +34 -12
- package/node/internals/plugins/allPlugins.js +11 -0
- package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +19 -0
- package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +33 -0
- package/node/internals/plugins/useChartProZoom/index.js +38 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.js +310 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +18 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.utils.js +140 -0
- package/node/internals/plugins/useChartProZoom/zoom.types.js +5 -0
- package/node/internals/utils/releaseInfo.js +4 -3
- package/package.json +8 -8
- package/typeOverloads/modules.d.ts +8 -1
- package/Heatmap/DefaultHeatmapTooltip.d.ts +0 -7
- package/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
- package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
- package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -12
- package/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
- package/context/CartesianProviderPro/index.d.ts +0 -1
- package/context/CartesianProviderPro/index.js +0 -1
- package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -7
- package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -16
- package/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
- package/context/ZoomProvider/Zoom.types.d.ts +0 -144
- package/context/ZoomProvider/ZoomContext.d.ts +0 -4
- package/context/ZoomProvider/ZoomContext.js +0 -16
- package/context/ZoomProvider/ZoomProvider.d.ts +0 -3
- package/context/ZoomProvider/ZoomProvider.js +0 -56
- package/context/ZoomProvider/ZoomSetup.d.ts +0 -9
- package/context/ZoomProvider/ZoomSetup.js +0 -16
- package/context/ZoomProvider/defaultizeZoom.d.ts +0 -2
- package/context/ZoomProvider/defaultizeZoom.js +0 -32
- package/context/ZoomProvider/index.d.ts +0 -3
- package/context/ZoomProvider/index.js +0 -3
- package/context/ZoomProvider/initializeZoomData.d.ts +0 -6
- package/context/ZoomProvider/initializeZoomData.js +0 -13
- package/context/ZoomProvider/useSetupPan.d.ts +0 -1
- package/context/ZoomProvider/useSetupPan.js +0 -106
- package/context/ZoomProvider/useSetupZoom.d.ts +0 -1
- package/context/ZoomProvider/useSetupZoom.js +0 -274
- package/context/ZoomProvider/useZoom.d.ts +0 -7
- package/context/ZoomProvider/useZoom.js +0 -19
- package/context/index.d.ts +0 -3
- package/context/index.js +0 -5
- package/modern/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/modern/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
- package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
- package/modern/context/CartesianProviderPro/index.js +0 -1
- package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
- package/modern/context/ZoomProvider/ZoomContext.js +0 -16
- package/modern/context/ZoomProvider/ZoomProvider.js +0 -56
- package/modern/context/ZoomProvider/ZoomSetup.js +0 -16
- package/modern/context/ZoomProvider/defaultizeZoom.js +0 -32
- package/modern/context/ZoomProvider/index.js +0 -3
- package/modern/context/ZoomProvider/initializeZoomData.js +0 -13
- package/modern/context/ZoomProvider/useSetupPan.js +0 -106
- package/modern/context/ZoomProvider/useSetupZoom.js +0 -274
- package/modern/context/ZoomProvider/useZoom.js +0 -19
- package/modern/context/index.js +0 -5
- package/node/Heatmap/DefaultHeatmapTooltip.js +0 -105
- package/node/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
- package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
- package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -50
- package/node/context/ZoomProvider/ZoomContext.js +0 -23
- package/node/context/ZoomProvider/ZoomProvider.js +0 -63
- package/node/context/ZoomProvider/ZoomSetup.js +0 -20
- package/node/context/ZoomProvider/defaultizeZoom.js +0 -40
- package/node/context/ZoomProvider/index.js +0 -38
- package/node/context/ZoomProvider/initializeZoomData.js +0 -20
- package/node/context/ZoomProvider/useSetupPan.js +0 -114
- package/node/context/ZoomProvider/useSetupZoom.js +0 -281
- package/node/context/ZoomProvider/useZoom.js +0 -25
- package/node/context/index.js +0 -27
- /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.d.ts +0 -0
- /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
- /package/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
- /package/{modern/context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/zoom.types.js} +0 -0
- /package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
- /package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
- /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { isDefined } from '@mui/x-charts/internals';
|
|
3
|
-
const defaultZoomOptions = {
|
|
4
|
-
minStart: 0,
|
|
5
|
-
maxEnd: 100,
|
|
6
|
-
step: 5,
|
|
7
|
-
minSpan: 10,
|
|
8
|
-
maxSpan: 100,
|
|
9
|
-
panning: true,
|
|
10
|
-
filterMode: 'keep'
|
|
11
|
-
};
|
|
12
|
-
export const defaultizeZoom = (axis, axisDirection) => {
|
|
13
|
-
if (!axis) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const defaultized = axis.map(v => {
|
|
17
|
-
if (!v.zoom) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
if (v.zoom === true) {
|
|
21
|
-
return _extends({
|
|
22
|
-
axisId: v.id,
|
|
23
|
-
axisDirection
|
|
24
|
-
}, defaultZoomOptions);
|
|
25
|
-
}
|
|
26
|
-
return _extends({
|
|
27
|
-
axisId: v.id,
|
|
28
|
-
axisDirection
|
|
29
|
-
}, defaultZoomOptions, v.zoom);
|
|
30
|
-
}).filter(isDefined);
|
|
31
|
-
return defaultized;
|
|
32
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// This function is used to initialize the zoom data when it is not provided by the user.
|
|
2
|
-
// It is helpful to avoid the need to provide the possibly auto-generated id for each axis.
|
|
3
|
-
export const initializeZoomData = options => {
|
|
4
|
-
return Object.values(options).map(({
|
|
5
|
-
axisId,
|
|
6
|
-
minStart: start,
|
|
7
|
-
maxEnd: end
|
|
8
|
-
}) => ({
|
|
9
|
-
axisId,
|
|
10
|
-
start,
|
|
11
|
-
end
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useSetupPan: () => void;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useDrawingArea, useSvgRef } from '@mui/x-charts/hooks';
|
|
6
|
-
import { getSVGPoint } from '@mui/x-charts/internals';
|
|
7
|
-
import { useZoom } from "./useZoom.js";
|
|
8
|
-
export const useSetupPan = () => {
|
|
9
|
-
const {
|
|
10
|
-
zoomData,
|
|
11
|
-
setZoomData,
|
|
12
|
-
setIsInteracting,
|
|
13
|
-
isPanEnabled,
|
|
14
|
-
options
|
|
15
|
-
} = useZoom();
|
|
16
|
-
const drawingArea = useDrawingArea();
|
|
17
|
-
const svgRef = useSvgRef();
|
|
18
|
-
const isDraggingRef = React.useRef(false);
|
|
19
|
-
const touchStartRef = React.useRef(null);
|
|
20
|
-
const eventCacheRef = React.useRef([]);
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
const element = svgRef.current;
|
|
23
|
-
if (element === null || !isPanEnabled) {
|
|
24
|
-
return () => {};
|
|
25
|
-
}
|
|
26
|
-
const handlePan = event => {
|
|
27
|
-
if (element === null || !isDraggingRef.current || eventCacheRef.current.length > 1) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (touchStartRef.current == null) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const point = getSVGPoint(element, event);
|
|
34
|
-
const movementX = point.x - touchStartRef.current.x;
|
|
35
|
-
const movementY = (point.y - touchStartRef.current.y) * -1;
|
|
36
|
-
const newZoomData = touchStartRef.current.zoomData.map(zoom => {
|
|
37
|
-
const option = options[zoom.axisId];
|
|
38
|
-
if (!option || !option.panning) {
|
|
39
|
-
return zoom;
|
|
40
|
-
}
|
|
41
|
-
const min = zoom.start;
|
|
42
|
-
const max = zoom.end;
|
|
43
|
-
const span = max - min;
|
|
44
|
-
const MIN_PERCENT = option.minStart;
|
|
45
|
-
const MAX_PERCENT = option.maxEnd;
|
|
46
|
-
const movement = option.axisDirection === 'x' ? movementX : movementY;
|
|
47
|
-
const dimension = option.axisDirection === 'x' ? drawingArea.width : drawingArea.height;
|
|
48
|
-
let newMinPercent = min - movement / dimension * span;
|
|
49
|
-
let newMaxPercent = max - movement / dimension * span;
|
|
50
|
-
if (newMinPercent < MIN_PERCENT) {
|
|
51
|
-
newMinPercent = MIN_PERCENT;
|
|
52
|
-
newMaxPercent = newMinPercent + span;
|
|
53
|
-
}
|
|
54
|
-
if (newMaxPercent > MAX_PERCENT) {
|
|
55
|
-
newMaxPercent = MAX_PERCENT;
|
|
56
|
-
newMinPercent = newMaxPercent - span;
|
|
57
|
-
}
|
|
58
|
-
if (newMinPercent < MIN_PERCENT || newMaxPercent > MAX_PERCENT || span < option.minSpan || span > option.maxSpan) {
|
|
59
|
-
return zoom;
|
|
60
|
-
}
|
|
61
|
-
return _extends({}, zoom, {
|
|
62
|
-
start: newMinPercent,
|
|
63
|
-
end: newMaxPercent
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
setZoomData(newZoomData);
|
|
67
|
-
};
|
|
68
|
-
const handleDown = event => {
|
|
69
|
-
eventCacheRef.current.push(event);
|
|
70
|
-
const point = getSVGPoint(element, event);
|
|
71
|
-
if (!drawingArea.isPointInside(point)) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// If there is only one pointer, prevent selecting text
|
|
76
|
-
if (eventCacheRef.current.length === 1) {
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
}
|
|
79
|
-
isDraggingRef.current = true;
|
|
80
|
-
setIsInteracting(true);
|
|
81
|
-
touchStartRef.current = {
|
|
82
|
-
x: point.x,
|
|
83
|
-
y: point.y,
|
|
84
|
-
zoomData
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
const handleUp = event => {
|
|
88
|
-
eventCacheRef.current.splice(eventCacheRef.current.findIndex(cachedEvent => cachedEvent.pointerId === event.pointerId), 1);
|
|
89
|
-
setIsInteracting(false);
|
|
90
|
-
isDraggingRef.current = false;
|
|
91
|
-
touchStartRef.current = null;
|
|
92
|
-
};
|
|
93
|
-
element.addEventListener('pointerdown', handleDown);
|
|
94
|
-
document.addEventListener('pointermove', handlePan);
|
|
95
|
-
document.addEventListener('pointerup', handleUp);
|
|
96
|
-
document.addEventListener('pointercancel', handleUp);
|
|
97
|
-
document.addEventListener('pointerleave', handleUp);
|
|
98
|
-
return () => {
|
|
99
|
-
element.removeEventListener('pointerdown', handleDown);
|
|
100
|
-
document.removeEventListener('pointermove', handlePan);
|
|
101
|
-
document.removeEventListener('pointerup', handleUp);
|
|
102
|
-
document.removeEventListener('pointercancel', handleUp);
|
|
103
|
-
document.removeEventListener('pointerleave', handleUp);
|
|
104
|
-
};
|
|
105
|
-
}, [drawingArea, svgRef, isDraggingRef, setIsInteracting, zoomData, setZoomData, isPanEnabled, options]);
|
|
106
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useSetupZoom: () => void;
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useDrawingArea, useSvgRef } from '@mui/x-charts/hooks';
|
|
5
|
-
import { getSVGPoint } from '@mui/x-charts/internals';
|
|
6
|
-
import { useZoom } from "./useZoom.js";
|
|
7
|
-
/**
|
|
8
|
-
* Helper to get the range (in percents of a reference range) corresponding to a given scale.
|
|
9
|
-
* @param centerRatio {number} The ratio of the point that should not move between the previous and next range.
|
|
10
|
-
* @param scaleRatio {number} The target scale ratio.
|
|
11
|
-
* @returns The range to display.
|
|
12
|
-
*/
|
|
13
|
-
const zoomAtPoint = (centerRatio, scaleRatio, currentZoomData, options) => {
|
|
14
|
-
const MIN_RANGE = options.minStart;
|
|
15
|
-
const MAX_RANGE = options.maxEnd;
|
|
16
|
-
const MIN_ALLOWED_SPAN = options.minSpan;
|
|
17
|
-
const minRange = currentZoomData.start;
|
|
18
|
-
const maxRange = currentZoomData.end;
|
|
19
|
-
const point = minRange + centerRatio * (maxRange - minRange);
|
|
20
|
-
let newMinRange = (minRange + point * (scaleRatio - 1)) / scaleRatio;
|
|
21
|
-
let newMaxRange = (maxRange + point * (scaleRatio - 1)) / scaleRatio;
|
|
22
|
-
let minSpillover = 0;
|
|
23
|
-
let maxSpillover = 0;
|
|
24
|
-
if (newMinRange < MIN_RANGE) {
|
|
25
|
-
minSpillover = Math.abs(newMinRange);
|
|
26
|
-
newMinRange = MIN_RANGE;
|
|
27
|
-
}
|
|
28
|
-
if (newMaxRange > MAX_RANGE) {
|
|
29
|
-
maxSpillover = Math.abs(newMaxRange - MAX_RANGE);
|
|
30
|
-
newMaxRange = MAX_RANGE;
|
|
31
|
-
}
|
|
32
|
-
if (minSpillover > 0 && maxSpillover > 0) {
|
|
33
|
-
return [MIN_RANGE, MAX_RANGE];
|
|
34
|
-
}
|
|
35
|
-
newMaxRange += minSpillover;
|
|
36
|
-
newMinRange -= maxSpillover;
|
|
37
|
-
newMinRange = Math.min(MAX_RANGE - MIN_ALLOWED_SPAN, Math.max(MIN_RANGE, newMinRange));
|
|
38
|
-
newMaxRange = Math.max(MIN_ALLOWED_SPAN, Math.min(MAX_RANGE, newMaxRange));
|
|
39
|
-
return [newMinRange, newMaxRange];
|
|
40
|
-
};
|
|
41
|
-
export const useSetupZoom = () => {
|
|
42
|
-
const {
|
|
43
|
-
setZoomData,
|
|
44
|
-
isZoomEnabled,
|
|
45
|
-
options,
|
|
46
|
-
setIsInteracting
|
|
47
|
-
} = useZoom();
|
|
48
|
-
const drawingArea = useDrawingArea();
|
|
49
|
-
const svgRef = useSvgRef();
|
|
50
|
-
const eventCacheRef = React.useRef([]);
|
|
51
|
-
const eventPrevDiff = React.useRef(0);
|
|
52
|
-
const interactionTimeoutRef = React.useRef(undefined);
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
const element = svgRef.current;
|
|
55
|
-
if (element === null || !isZoomEnabled) {
|
|
56
|
-
return () => {};
|
|
57
|
-
}
|
|
58
|
-
const wheelHandler = event => {
|
|
59
|
-
if (element === null) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const point = getSVGPoint(element, event);
|
|
63
|
-
if (!drawingArea.isPointInside(point)) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
if (interactionTimeoutRef.current) {
|
|
68
|
-
clearTimeout(interactionTimeoutRef.current);
|
|
69
|
-
}
|
|
70
|
-
setIsInteracting(true);
|
|
71
|
-
// Debounce transition to `isInteractive=false`.
|
|
72
|
-
// Useful because wheel events don't have an "end" event.
|
|
73
|
-
interactionTimeoutRef.current = window.setTimeout(() => {
|
|
74
|
-
setIsInteracting(false);
|
|
75
|
-
}, 166);
|
|
76
|
-
setZoomData(prevZoomData => {
|
|
77
|
-
return prevZoomData.map(zoom => {
|
|
78
|
-
const option = options[zoom.axisId];
|
|
79
|
-
if (!option) {
|
|
80
|
-
return zoom;
|
|
81
|
-
}
|
|
82
|
-
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
83
|
-
const {
|
|
84
|
-
scaleRatio,
|
|
85
|
-
isZoomIn
|
|
86
|
-
} = getWheelScaleRatio(event, option.step);
|
|
87
|
-
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
88
|
-
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
89
|
-
return zoom;
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
axisId: zoom.axisId,
|
|
93
|
-
start: newMinRange,
|
|
94
|
-
end: newMaxRange
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
function pointerDownHandler(event) {
|
|
100
|
-
eventCacheRef.current.push(event);
|
|
101
|
-
setIsInteracting(true);
|
|
102
|
-
}
|
|
103
|
-
function pointerMoveHandler(event) {
|
|
104
|
-
if (element === null) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const index = eventCacheRef.current.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
|
|
108
|
-
eventCacheRef.current[index] = event;
|
|
109
|
-
|
|
110
|
-
// Not a pinch gesture
|
|
111
|
-
if (eventCacheRef.current.length !== 2) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const firstEvent = eventCacheRef.current[0];
|
|
115
|
-
const curDiff = getDiff(eventCacheRef.current);
|
|
116
|
-
setZoomData(prevZoomData => {
|
|
117
|
-
const newZoomData = prevZoomData.map(zoom => {
|
|
118
|
-
const option = options[zoom.axisId];
|
|
119
|
-
if (!option) {
|
|
120
|
-
return zoom;
|
|
121
|
-
}
|
|
122
|
-
const {
|
|
123
|
-
scaleRatio,
|
|
124
|
-
isZoomIn
|
|
125
|
-
} = getPinchScaleRatio(curDiff, eventPrevDiff.current, option.step);
|
|
126
|
-
|
|
127
|
-
// If the scale ratio is 0, it means the pinch gesture is not valid.
|
|
128
|
-
if (scaleRatio === 0) {
|
|
129
|
-
return zoom;
|
|
130
|
-
}
|
|
131
|
-
const point = getSVGPoint(element, firstEvent);
|
|
132
|
-
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
133
|
-
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
134
|
-
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
135
|
-
return zoom;
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
axisId: zoom.axisId,
|
|
139
|
-
start: newMinRange,
|
|
140
|
-
end: newMaxRange
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
eventPrevDiff.current = curDiff;
|
|
144
|
-
return newZoomData;
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function pointerUpHandler(event) {
|
|
148
|
-
eventCacheRef.current.splice(eventCacheRef.current.findIndex(cachedEvent => cachedEvent.pointerId === event.pointerId), 1);
|
|
149
|
-
if (eventCacheRef.current.length < 2) {
|
|
150
|
-
eventPrevDiff.current = 0;
|
|
151
|
-
}
|
|
152
|
-
if (event.type === 'pointerup' || event.type === 'pointercancel') {
|
|
153
|
-
setIsInteracting(false);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
element.addEventListener('wheel', wheelHandler);
|
|
157
|
-
element.addEventListener('pointerdown', pointerDownHandler);
|
|
158
|
-
element.addEventListener('pointermove', pointerMoveHandler);
|
|
159
|
-
element.addEventListener('pointerup', pointerUpHandler);
|
|
160
|
-
element.addEventListener('pointercancel', pointerUpHandler);
|
|
161
|
-
element.addEventListener('pointerout', pointerUpHandler);
|
|
162
|
-
element.addEventListener('pointerleave', pointerUpHandler);
|
|
163
|
-
|
|
164
|
-
// Prevent zooming the entire page on touch devices
|
|
165
|
-
element.addEventListener('touchstart', preventDefault);
|
|
166
|
-
element.addEventListener('touchmove', preventDefault);
|
|
167
|
-
return () => {
|
|
168
|
-
element.removeEventListener('wheel', wheelHandler);
|
|
169
|
-
element.removeEventListener('pointerdown', pointerDownHandler);
|
|
170
|
-
element.removeEventListener('pointermove', pointerMoveHandler);
|
|
171
|
-
element.removeEventListener('pointerup', pointerUpHandler);
|
|
172
|
-
element.removeEventListener('pointercancel', pointerUpHandler);
|
|
173
|
-
element.removeEventListener('pointerout', pointerUpHandler);
|
|
174
|
-
element.removeEventListener('pointerleave', pointerUpHandler);
|
|
175
|
-
element.removeEventListener('touchstart', preventDefault);
|
|
176
|
-
element.removeEventListener('touchmove', preventDefault);
|
|
177
|
-
if (interactionTimeoutRef.current) {
|
|
178
|
-
clearTimeout(interactionTimeoutRef.current);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}, [svgRef, setZoomData, drawingArea, isZoomEnabled, options, setIsInteracting]);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Checks if the new span is valid.
|
|
186
|
-
*/
|
|
187
|
-
function isSpanValid(minRange, maxRange, isZoomIn, option) {
|
|
188
|
-
const newSpanPercent = maxRange - minRange;
|
|
189
|
-
if (isZoomIn && newSpanPercent < option.minSpan || !isZoomIn && newSpanPercent > option.maxSpan) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
if (minRange < option.minStart || maxRange > option.maxEnd) {
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
function getMultiplier(event) {
|
|
198
|
-
const ctrlMultiplier = event.ctrlKey ? 3 : 1;
|
|
199
|
-
|
|
200
|
-
// DeltaMode: 0 is pixel, 1 is line, 2 is page
|
|
201
|
-
// This is defined by the browser.
|
|
202
|
-
if (event.deltaMode === 1) {
|
|
203
|
-
return 1 * ctrlMultiplier;
|
|
204
|
-
}
|
|
205
|
-
if (event.deltaMode) {
|
|
206
|
-
return 10 * ctrlMultiplier;
|
|
207
|
-
}
|
|
208
|
-
return 0.2 * ctrlMultiplier;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Get the scale ratio and if it's a zoom in or out from a wheel event.
|
|
213
|
-
*/
|
|
214
|
-
function getWheelScaleRatio(event, step) {
|
|
215
|
-
const deltaY = -event.deltaY;
|
|
216
|
-
const multiplier = getMultiplier(event);
|
|
217
|
-
const scaledStep = step * multiplier * deltaY / 1000;
|
|
218
|
-
// Clamp the scale ratio between 0.1 and 1.9 so that the zoom is not too big or too small.
|
|
219
|
-
const scaleRatio = Math.min(Math.max(1 + scaledStep, 0.1), 1.9);
|
|
220
|
-
const isZoomIn = deltaY > 0;
|
|
221
|
-
return {
|
|
222
|
-
scaleRatio,
|
|
223
|
-
isZoomIn
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
229
|
-
*/
|
|
230
|
-
function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
231
|
-
const scaledStep = step / 1000;
|
|
232
|
-
let scaleRatio = 0;
|
|
233
|
-
let isZoomIn = false;
|
|
234
|
-
const hasMoved = prevDiff > 0;
|
|
235
|
-
if (hasMoved && curDiff > prevDiff) {
|
|
236
|
-
// The distance between the two pointers has increased
|
|
237
|
-
scaleRatio = 1 + scaledStep;
|
|
238
|
-
isZoomIn = true;
|
|
239
|
-
}
|
|
240
|
-
if (hasMoved && curDiff < prevDiff) {
|
|
241
|
-
// The distance between the two pointers has decreased
|
|
242
|
-
scaleRatio = 1 - scaledStep;
|
|
243
|
-
isZoomIn = false;
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
scaleRatio,
|
|
247
|
-
isZoomIn
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function getDiff(eventCache) {
|
|
251
|
-
const [firstEvent, secondEvent] = eventCache;
|
|
252
|
-
return Math.hypot(firstEvent.pageX - secondEvent.pageX, firstEvent.pageY - secondEvent.pageY);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Get the ratio of the point in the horizontal center of the area.
|
|
257
|
-
*/
|
|
258
|
-
function getHorizontalCenterRatio(point, area) {
|
|
259
|
-
const {
|
|
260
|
-
left,
|
|
261
|
-
width
|
|
262
|
-
} = area;
|
|
263
|
-
return (point.x - left) / width;
|
|
264
|
-
}
|
|
265
|
-
function preventDefault(event) {
|
|
266
|
-
event.preventDefault();
|
|
267
|
-
}
|
|
268
|
-
function getVerticalCenterRatio(point, area) {
|
|
269
|
-
const {
|
|
270
|
-
top,
|
|
271
|
-
height
|
|
272
|
-
} = area;
|
|
273
|
-
return (point.y - top) / height * -1 + 1;
|
|
274
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { ZoomContext } from "./ZoomContext.js";
|
|
5
|
-
/**
|
|
6
|
-
* Get access to the zoom state.
|
|
7
|
-
*
|
|
8
|
-
* @returns {ZoomState} The zoom state.
|
|
9
|
-
*/
|
|
10
|
-
export function useZoom() {
|
|
11
|
-
const {
|
|
12
|
-
data,
|
|
13
|
-
isInitialized
|
|
14
|
-
} = React.useContext(ZoomContext);
|
|
15
|
-
if (!isInitialized) {
|
|
16
|
-
throw new Error(['MUI X: Could not find the zoom context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
17
|
-
}
|
|
18
|
-
return data;
|
|
19
|
-
}
|
package/context/index.d.ts
DELETED
package/context/index.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, ChartsTooltipMark } from '@mui/x-charts/ChartsTooltip';
|
|
7
|
-
import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
|
|
8
|
-
import { getLabel } from '@mui/x-charts/internals';
|
|
9
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
function DefaultHeatmapTooltip(props) {
|
|
11
|
-
const {
|
|
12
|
-
series,
|
|
13
|
-
itemData,
|
|
14
|
-
sx,
|
|
15
|
-
classes,
|
|
16
|
-
getColor
|
|
17
|
-
} = props;
|
|
18
|
-
const xAxis = useXAxis();
|
|
19
|
-
const yAxis = useYAxis();
|
|
20
|
-
if (itemData.dataIndex === undefined || !series.data[itemData.dataIndex]) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
const color = getColor(itemData.dataIndex);
|
|
24
|
-
const valueItem = series.data[itemData.dataIndex];
|
|
25
|
-
const [xIndex, yIndex] = valueItem;
|
|
26
|
-
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
27
|
-
location: 'tooltip'
|
|
28
|
-
}) ?? xAxis.data[xIndex].toLocaleString();
|
|
29
|
-
const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
|
|
30
|
-
location: 'tooltip'
|
|
31
|
-
}) ?? yAxis.data[yIndex].toLocaleString();
|
|
32
|
-
const formattedValue = series.valueFormatter(valueItem, {
|
|
33
|
-
dataIndex: itemData.dataIndex
|
|
34
|
-
});
|
|
35
|
-
const seriesLabel = getLabel(series.label, 'tooltip');
|
|
36
|
-
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
37
|
-
sx: sx,
|
|
38
|
-
className: classes.root,
|
|
39
|
-
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
40
|
-
className: classes.table,
|
|
41
|
-
children: [/*#__PURE__*/_jsx("thead", {
|
|
42
|
-
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
43
|
-
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
44
|
-
children: formattedX
|
|
45
|
-
}), formattedX && formattedY && /*#__PURE__*/_jsx(ChartsTooltipCell, {}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
46
|
-
children: formattedY
|
|
47
|
-
})]
|
|
48
|
-
})
|
|
49
|
-
}), /*#__PURE__*/_jsx("tbody", {
|
|
50
|
-
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
51
|
-
className: classes.row,
|
|
52
|
-
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
53
|
-
className: clsx(classes.markCell, classes.cell),
|
|
54
|
-
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
55
|
-
color: color,
|
|
56
|
-
className: classes.mark
|
|
57
|
-
})
|
|
58
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
59
|
-
className: clsx(classes.labelCell, classes.cell),
|
|
60
|
-
children: seriesLabel
|
|
61
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
62
|
-
className: clsx(classes.valueCell, classes.cell),
|
|
63
|
-
children: formattedValue
|
|
64
|
-
})]
|
|
65
|
-
})
|
|
66
|
-
})]
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltip.propTypes = {
|
|
71
|
-
// ----------------------------- Warning --------------------------------
|
|
72
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
73
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
74
|
-
// ----------------------------------------------------------------------
|
|
75
|
-
/**
|
|
76
|
-
* Override or extend the styles applied to the component.
|
|
77
|
-
*/
|
|
78
|
-
classes: PropTypes.object.isRequired,
|
|
79
|
-
/**
|
|
80
|
-
* Get the color of the item with index `dataIndex`.
|
|
81
|
-
* @param {number} dataIndex The data index of the item.
|
|
82
|
-
* @returns {string} The color to display.
|
|
83
|
-
*/
|
|
84
|
-
getColor: PropTypes.func.isRequired,
|
|
85
|
-
/**
|
|
86
|
-
* The data used to identify the triggered item.
|
|
87
|
-
*/
|
|
88
|
-
itemData: PropTypes.shape({
|
|
89
|
-
dataIndex: PropTypes.number.isRequired,
|
|
90
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
91
|
-
type: PropTypes.oneOf(['heatmap']).isRequired
|
|
92
|
-
}).isRequired,
|
|
93
|
-
/**
|
|
94
|
-
* The series linked to the triggered item.
|
|
95
|
-
*/
|
|
96
|
-
series: PropTypes.object.isRequired,
|
|
97
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
98
|
-
} : void 0;
|
|
99
|
-
export { DefaultHeatmapTooltip };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useDrawingArea, useSeries, CartesianContext, computeAxisValue, useXExtremumGetter, useYExtremumGetter } from '@mui/x-charts/internals';
|
|
6
|
-
import { useZoom } from "../ZoomProvider/useZoom.js";
|
|
7
|
-
import { createAxisFilterMapper, createGetAxisFilters } from "./createAxisFilterMapper.js";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
function CartesianProviderPro(props) {
|
|
10
|
-
const {
|
|
11
|
-
xAxis,
|
|
12
|
-
yAxis,
|
|
13
|
-
children
|
|
14
|
-
} = props;
|
|
15
|
-
const formattedSeries = useSeries();
|
|
16
|
-
const drawingArea = useDrawingArea();
|
|
17
|
-
const {
|
|
18
|
-
zoomData,
|
|
19
|
-
options
|
|
20
|
-
} = useZoom();
|
|
21
|
-
const xExtremumGetters = useXExtremumGetter();
|
|
22
|
-
const yExtremumGetters = useYExtremumGetter();
|
|
23
|
-
const getFilters = React.useMemo(() => {
|
|
24
|
-
const xMapper = createAxisFilterMapper({
|
|
25
|
-
zoomData,
|
|
26
|
-
extremumGetter: xExtremumGetters,
|
|
27
|
-
formattedSeries,
|
|
28
|
-
direction: 'x'
|
|
29
|
-
});
|
|
30
|
-
const yMapper = createAxisFilterMapper({
|
|
31
|
-
zoomData,
|
|
32
|
-
extremumGetter: yExtremumGetters,
|
|
33
|
-
formattedSeries,
|
|
34
|
-
direction: 'y'
|
|
35
|
-
});
|
|
36
|
-
const xFilters = xAxis.reduce((acc, axis, index) => {
|
|
37
|
-
const filter = xMapper(axis, index);
|
|
38
|
-
if (filter !== null) {
|
|
39
|
-
acc[axis.id] = filter;
|
|
40
|
-
}
|
|
41
|
-
return acc;
|
|
42
|
-
}, {});
|
|
43
|
-
const yFilters = yAxis.reduce((acc, axis, index) => {
|
|
44
|
-
const filter = yMapper(axis, index);
|
|
45
|
-
if (filter !== null) {
|
|
46
|
-
acc[axis.id] = filter;
|
|
47
|
-
}
|
|
48
|
-
return acc;
|
|
49
|
-
}, {});
|
|
50
|
-
if (Object.keys(xFilters).length === 0 && Object.keys(yFilters).length === 0) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
return createGetAxisFilters(_extends({}, xFilters, yFilters));
|
|
54
|
-
}, [formattedSeries, xAxis, xExtremumGetters, yAxis, yExtremumGetters, zoomData]);
|
|
55
|
-
const xValues = React.useMemo(() => computeAxisValue({
|
|
56
|
-
drawingArea,
|
|
57
|
-
formattedSeries,
|
|
58
|
-
axis: xAxis,
|
|
59
|
-
extremumGetters: xExtremumGetters,
|
|
60
|
-
axisDirection: 'x',
|
|
61
|
-
zoomData,
|
|
62
|
-
zoomOptions: options,
|
|
63
|
-
getFilters
|
|
64
|
-
}), [drawingArea, formattedSeries, xAxis, xExtremumGetters, zoomData, options, getFilters]);
|
|
65
|
-
const yValues = React.useMemo(() => computeAxisValue({
|
|
66
|
-
drawingArea,
|
|
67
|
-
formattedSeries,
|
|
68
|
-
axis: yAxis,
|
|
69
|
-
extremumGetters: yExtremumGetters,
|
|
70
|
-
axisDirection: 'y',
|
|
71
|
-
zoomData,
|
|
72
|
-
zoomOptions: options,
|
|
73
|
-
getFilters
|
|
74
|
-
}), [drawingArea, formattedSeries, yAxis, yExtremumGetters, zoomData, options, getFilters]);
|
|
75
|
-
const value = React.useMemo(() => ({
|
|
76
|
-
isInitialized: true,
|
|
77
|
-
data: {
|
|
78
|
-
xAxis: xValues.axis,
|
|
79
|
-
yAxis: yValues.axis,
|
|
80
|
-
xAxisIds: xValues.axisIds,
|
|
81
|
-
yAxisIds: yValues.axisIds
|
|
82
|
-
}
|
|
83
|
-
}), [xValues, yValues]);
|
|
84
|
-
return /*#__PURE__*/_jsx(CartesianContext.Provider, {
|
|
85
|
-
value: value,
|
|
86
|
-
children: children
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
export { CartesianProviderPro };
|