@mui/x-charts-pro 8.0.0-alpha.7 → 8.0.0-alpha.8
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 +55 -19
- package/CHANGELOG.md +115 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +32 -4
- package/ChartContainerPro/ChartContainerPro.js +53 -18
- package/ChartContainerPro/useChartContainerProProps.d.ts +5 -5
- package/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/Heatmap/Heatmap.js +28 -2
- package/Heatmap/HeatmapTooltip.js +6 -4
- package/Heatmap/extremums.d.ts +2 -2
- package/Heatmap/formatter.d.ts +2 -2
- package/Heatmap/formatter.js +2 -1
- package/Heatmap/plugin.d.ts +2 -2
- package/Heatmap/plugin.js +1 -2
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +57 -25
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +37 -28
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- 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 +0 -1
- package/index.js +2 -5
- package/internals/plugins/allPlugins.d.ts +10 -0
- package/internals/plugins/allPlugins.js +5 -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 +324 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +149 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +54 -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 +1 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/BarChartPro/BarChartPro.js +55 -19
- package/modern/ChartContainerPro/ChartContainerPro.js +53 -18
- package/modern/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/modern/Heatmap/Heatmap.js +28 -2
- package/modern/Heatmap/HeatmapTooltip.js +6 -4
- package/modern/Heatmap/formatter.js +2 -1
- package/modern/Heatmap/plugin.js +1 -2
- package/modern/LineChartPro/LineChartPro.js +57 -25
- package/modern/ScatterChartPro/ScatterChartPro.js +37 -28
- 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 +2 -5
- package/modern/internals/plugins/allPlugins.js +5 -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 +324 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -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 +1 -1
- package/modern/models/index.js +2 -1
- package/node/BarChartPro/BarChartPro.js +55 -19
- package/node/ChartContainerPro/ChartContainerPro.js +53 -18
- package/node/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/node/Heatmap/Heatmap.js +28 -2
- package/node/Heatmap/HeatmapTooltip.js +4 -2
- package/node/Heatmap/formatter.js +2 -1
- package/node/Heatmap/plugin.js +1 -2
- package/node/LineChartPro/LineChartPro.js +57 -25
- package/node/ScatterChartPro/ScatterChartPro.js +36 -27
- 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 +1 -12
- package/node/internals/plugins/allPlugins.js +11 -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 +331 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +13 -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 +1 -1
- package/package.json +5 -5
- package/typeOverloads/modules.d.ts +8 -1
- package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
- package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
- package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -13
- 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/ChartDataProviderPro.js +0 -50
- package/context/ChartDataProviderPro/index.d.ts +0 -1
- package/context/ChartDataProviderPro/index.js +0 -1
- package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -14
- 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/context/package.json +0 -6
- 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/ChartDataProviderPro.js +0 -50
- package/modern/context/ChartDataProviderPro/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/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
- package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
- package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -56
- package/node/context/ChartDataProviderPro/index.js +0 -16
- 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/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/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useSelector, getSVGPoint, selectorChartDrawingArea } from '@mui/x-charts/internals';
|
|
6
|
+
import { defaultizeZoom } from "./defaultizeZoom.js";
|
|
7
|
+
import { getDiff, getHorizontalCenterRatio, getPinchScaleRatio, getVerticalCenterRatio, getWheelScaleRatio, isSpanValid, preventDefault, zoomAtPoint } from "./useChartProZoom.utils.js";
|
|
8
|
+
import { selectorChartZoomOptionsLookup } from "./useChartProZoom.selectors.js";
|
|
9
|
+
|
|
10
|
+
// It is helpful to avoid the need to provide the possibly auto-generated id for each axis.
|
|
11
|
+
function initializeZoomData(options) {
|
|
12
|
+
return Object.values(options).map(({
|
|
13
|
+
axisId,
|
|
14
|
+
minStart: start,
|
|
15
|
+
maxEnd: end
|
|
16
|
+
}) => ({
|
|
17
|
+
axisId,
|
|
18
|
+
start,
|
|
19
|
+
end
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export const useChartProZoom = ({
|
|
23
|
+
store,
|
|
24
|
+
instance,
|
|
25
|
+
svgRef,
|
|
26
|
+
params
|
|
27
|
+
}) => {
|
|
28
|
+
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
29
|
+
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
30
|
+
const isZoomEnabled = Object.keys(optionsLookup).length > 0;
|
|
31
|
+
|
|
32
|
+
// Add events
|
|
33
|
+
const panningEventCacheRef = React.useRef([]);
|
|
34
|
+
const zoomEventCacheRef = React.useRef([]);
|
|
35
|
+
const eventPrevDiff = React.useRef(0);
|
|
36
|
+
const interactionTimeoutRef = React.useRef(undefined);
|
|
37
|
+
const setIsInteracting = React.useCallback(isInteracting => {
|
|
38
|
+
store.update(prev => _extends({}, prev, {
|
|
39
|
+
zoom: _extends({}, prev.zoom, {
|
|
40
|
+
isInteracting
|
|
41
|
+
})
|
|
42
|
+
}));
|
|
43
|
+
}, [store]);
|
|
44
|
+
const setZoomDataCallback = React.useCallback(zoomData => {
|
|
45
|
+
store.update(prevState => {
|
|
46
|
+
const newZoomData = typeof zoomData === 'function' ? zoomData(prevState.zoom.zoomData) : zoomData;
|
|
47
|
+
params.onZoomChange?.(newZoomData);
|
|
48
|
+
return _extends({}, prevState, {
|
|
49
|
+
zoom: _extends({}, prevState.zoom, {
|
|
50
|
+
zoomData: newZoomData
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}, [params, store]);
|
|
55
|
+
|
|
56
|
+
// Add event for chart panning
|
|
57
|
+
const isPanEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) || false, [optionsLookup]);
|
|
58
|
+
const isDraggingRef = React.useRef(false);
|
|
59
|
+
const touchStartRef = React.useRef(null);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
const element = svgRef.current;
|
|
62
|
+
if (element === null || !isPanEnabled) {
|
|
63
|
+
return () => {};
|
|
64
|
+
}
|
|
65
|
+
const handlePan = event => {
|
|
66
|
+
if (element === null || !isDraggingRef.current || panningEventCacheRef.current.length > 1) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (touchStartRef.current == null) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const point = getSVGPoint(element, event);
|
|
73
|
+
const movementX = point.x - touchStartRef.current.x;
|
|
74
|
+
const movementY = (point.y - touchStartRef.current.y) * -1;
|
|
75
|
+
const newZoomData = touchStartRef.current.zoomData.map(zoom => {
|
|
76
|
+
const options = optionsLookup[zoom.axisId];
|
|
77
|
+
if (!options || !options.panning) {
|
|
78
|
+
return zoom;
|
|
79
|
+
}
|
|
80
|
+
const min = zoom.start;
|
|
81
|
+
const max = zoom.end;
|
|
82
|
+
const span = max - min;
|
|
83
|
+
const MIN_PERCENT = options.minStart;
|
|
84
|
+
const MAX_PERCENT = options.maxEnd;
|
|
85
|
+
const movement = options.axisDirection === 'x' ? movementX : movementY;
|
|
86
|
+
const dimension = options.axisDirection === 'x' ? drawingArea.width : drawingArea.height;
|
|
87
|
+
let newMinPercent = min - movement / dimension * span;
|
|
88
|
+
let newMaxPercent = max - movement / dimension * span;
|
|
89
|
+
if (newMinPercent < MIN_PERCENT) {
|
|
90
|
+
newMinPercent = MIN_PERCENT;
|
|
91
|
+
newMaxPercent = newMinPercent + span;
|
|
92
|
+
}
|
|
93
|
+
if (newMaxPercent > MAX_PERCENT) {
|
|
94
|
+
newMaxPercent = MAX_PERCENT;
|
|
95
|
+
newMinPercent = newMaxPercent - span;
|
|
96
|
+
}
|
|
97
|
+
if (newMinPercent < MIN_PERCENT || newMaxPercent > MAX_PERCENT || span < options.minSpan || span > options.maxSpan) {
|
|
98
|
+
return zoom;
|
|
99
|
+
}
|
|
100
|
+
return _extends({}, zoom, {
|
|
101
|
+
start: newMinPercent,
|
|
102
|
+
end: newMaxPercent
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
setZoomDataCallback(newZoomData);
|
|
106
|
+
};
|
|
107
|
+
const handleDown = event => {
|
|
108
|
+
panningEventCacheRef.current.push(event);
|
|
109
|
+
const point = getSVGPoint(element, event);
|
|
110
|
+
if (!instance.isPointInside(point)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// If there is only one pointer, prevent selecting text
|
|
114
|
+
if (panningEventCacheRef.current.length === 1) {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
}
|
|
117
|
+
isDraggingRef.current = true;
|
|
118
|
+
setIsInteracting(true);
|
|
119
|
+
touchStartRef.current = {
|
|
120
|
+
x: point.x,
|
|
121
|
+
y: point.y,
|
|
122
|
+
zoomData: store.getSnapshot().zoom.zoomData
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const handleUp = event => {
|
|
126
|
+
panningEventCacheRef.current.splice(panningEventCacheRef.current.findIndex(cachedEvent => cachedEvent.pointerId === event.pointerId), 1);
|
|
127
|
+
setIsInteracting(false);
|
|
128
|
+
isDraggingRef.current = false;
|
|
129
|
+
touchStartRef.current = null;
|
|
130
|
+
};
|
|
131
|
+
element.addEventListener('pointerdown', handleDown);
|
|
132
|
+
document.addEventListener('pointermove', handlePan);
|
|
133
|
+
document.addEventListener('pointerup', handleUp);
|
|
134
|
+
document.addEventListener('pointercancel', handleUp);
|
|
135
|
+
document.addEventListener('pointerleave', handleUp);
|
|
136
|
+
return () => {
|
|
137
|
+
element.removeEventListener('pointerdown', handleDown);
|
|
138
|
+
document.removeEventListener('pointermove', handlePan);
|
|
139
|
+
document.removeEventListener('pointerup', handleUp);
|
|
140
|
+
document.removeEventListener('pointercancel', handleUp);
|
|
141
|
+
document.removeEventListener('pointerleave', handleUp);
|
|
142
|
+
};
|
|
143
|
+
}, [instance, svgRef, isDraggingRef, setIsInteracting, isPanEnabled, optionsLookup, drawingArea.width, drawingArea.height, setZoomDataCallback, store]);
|
|
144
|
+
|
|
145
|
+
// Add event for chart zoom in/out
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
const element = svgRef.current;
|
|
148
|
+
if (element === null || !isZoomEnabled) {
|
|
149
|
+
return () => {};
|
|
150
|
+
}
|
|
151
|
+
const wheelHandler = event => {
|
|
152
|
+
if (element === null) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const point = getSVGPoint(element, event);
|
|
156
|
+
if (!instance.isPointInside(point)) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
if (interactionTimeoutRef.current) {
|
|
161
|
+
clearTimeout(interactionTimeoutRef.current);
|
|
162
|
+
}
|
|
163
|
+
setIsInteracting(true);
|
|
164
|
+
// Debounce transition to `isInteractive=false`.
|
|
165
|
+
// Useful because wheel events don't have an "end" event.
|
|
166
|
+
interactionTimeoutRef.current = window.setTimeout(() => {
|
|
167
|
+
setIsInteracting(false);
|
|
168
|
+
}, 166);
|
|
169
|
+
setZoomDataCallback(prevZoomData => {
|
|
170
|
+
return prevZoomData.map(zoom => {
|
|
171
|
+
const option = optionsLookup[zoom.axisId];
|
|
172
|
+
if (!option) {
|
|
173
|
+
return zoom;
|
|
174
|
+
}
|
|
175
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
176
|
+
const {
|
|
177
|
+
scaleRatio,
|
|
178
|
+
isZoomIn
|
|
179
|
+
} = getWheelScaleRatio(event, option.step);
|
|
180
|
+
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
181
|
+
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
182
|
+
return zoom;
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
axisId: zoom.axisId,
|
|
186
|
+
start: newMinRange,
|
|
187
|
+
end: newMaxRange
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
function pointerDownHandler(event) {
|
|
193
|
+
zoomEventCacheRef.current.push(event);
|
|
194
|
+
setIsInteracting(true);
|
|
195
|
+
}
|
|
196
|
+
function pointerMoveHandler(event) {
|
|
197
|
+
if (element === null) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const index = zoomEventCacheRef.current.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
|
|
201
|
+
zoomEventCacheRef.current[index] = event;
|
|
202
|
+
|
|
203
|
+
// Not a pinch gesture
|
|
204
|
+
if (zoomEventCacheRef.current.length !== 2) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const firstEvent = zoomEventCacheRef.current[0];
|
|
208
|
+
const curDiff = getDiff(zoomEventCacheRef.current);
|
|
209
|
+
setZoomDataCallback(prevZoomData => {
|
|
210
|
+
const newZoomData = prevZoomData.map(zoom => {
|
|
211
|
+
const option = optionsLookup[zoom.axisId];
|
|
212
|
+
if (!option) {
|
|
213
|
+
return zoom;
|
|
214
|
+
}
|
|
215
|
+
const {
|
|
216
|
+
scaleRatio,
|
|
217
|
+
isZoomIn
|
|
218
|
+
} = getPinchScaleRatio(curDiff, eventPrevDiff.current, option.step);
|
|
219
|
+
|
|
220
|
+
// If the scale ratio is 0, it means the pinch gesture is not valid.
|
|
221
|
+
if (scaleRatio === 0) {
|
|
222
|
+
return zoom;
|
|
223
|
+
}
|
|
224
|
+
const point = getSVGPoint(element, firstEvent);
|
|
225
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
226
|
+
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
227
|
+
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
228
|
+
return zoom;
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
axisId: zoom.axisId,
|
|
232
|
+
start: newMinRange,
|
|
233
|
+
end: newMaxRange
|
|
234
|
+
};
|
|
235
|
+
});
|
|
236
|
+
eventPrevDiff.current = curDiff;
|
|
237
|
+
return newZoomData;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function pointerUpHandler(event) {
|
|
241
|
+
zoomEventCacheRef.current.splice(zoomEventCacheRef.current.findIndex(cachedEvent => cachedEvent.pointerId === event.pointerId), 1);
|
|
242
|
+
if (zoomEventCacheRef.current.length < 2) {
|
|
243
|
+
eventPrevDiff.current = 0;
|
|
244
|
+
}
|
|
245
|
+
if (event.type === 'pointerup' || event.type === 'pointercancel') {
|
|
246
|
+
setIsInteracting(false);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
element.addEventListener('wheel', wheelHandler);
|
|
250
|
+
element.addEventListener('pointerdown', pointerDownHandler);
|
|
251
|
+
element.addEventListener('pointermove', pointerMoveHandler);
|
|
252
|
+
element.addEventListener('pointerup', pointerUpHandler);
|
|
253
|
+
element.addEventListener('pointercancel', pointerUpHandler);
|
|
254
|
+
element.addEventListener('pointerout', pointerUpHandler);
|
|
255
|
+
element.addEventListener('pointerleave', pointerUpHandler);
|
|
256
|
+
|
|
257
|
+
// Prevent zooming the entire page on touch devices
|
|
258
|
+
element.addEventListener('touchstart', preventDefault);
|
|
259
|
+
element.addEventListener('touchmove', preventDefault);
|
|
260
|
+
return () => {
|
|
261
|
+
element.removeEventListener('wheel', wheelHandler);
|
|
262
|
+
element.removeEventListener('pointerdown', pointerDownHandler);
|
|
263
|
+
element.removeEventListener('pointermove', pointerMoveHandler);
|
|
264
|
+
element.removeEventListener('pointerup', pointerUpHandler);
|
|
265
|
+
element.removeEventListener('pointercancel', pointerUpHandler);
|
|
266
|
+
element.removeEventListener('pointerout', pointerUpHandler);
|
|
267
|
+
element.removeEventListener('pointerleave', pointerUpHandler);
|
|
268
|
+
element.removeEventListener('touchstart', preventDefault);
|
|
269
|
+
element.removeEventListener('touchmove', preventDefault);
|
|
270
|
+
if (interactionTimeoutRef.current) {
|
|
271
|
+
clearTimeout(interactionTimeoutRef.current);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}, [svgRef, drawingArea, isZoomEnabled, optionsLookup, setIsInteracting, instance, setZoomDataCallback]);
|
|
275
|
+
return {
|
|
276
|
+
publicAPI: {
|
|
277
|
+
setZoomData: setZoomDataCallback
|
|
278
|
+
},
|
|
279
|
+
instance: {
|
|
280
|
+
setZoomData: setZoomDataCallback
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
useChartProZoom.params = {
|
|
285
|
+
initialZoom: true,
|
|
286
|
+
onZoomChange: true
|
|
287
|
+
};
|
|
288
|
+
useChartProZoom.getDefaultizedParams = ({
|
|
289
|
+
params
|
|
290
|
+
}) => {
|
|
291
|
+
const optionsLookup = _extends({}, params.defaultizedXAxis.reduce((acc, v) => {
|
|
292
|
+
const {
|
|
293
|
+
zoom,
|
|
294
|
+
id: axisId
|
|
295
|
+
} = v;
|
|
296
|
+
const defaultizedZoom = defaultizeZoom(zoom, axisId, 'x');
|
|
297
|
+
if (defaultizedZoom) {
|
|
298
|
+
acc[axisId] = defaultizedZoom;
|
|
299
|
+
}
|
|
300
|
+
return acc;
|
|
301
|
+
}, {}), params.defaultizedYAxis.reduce((acc, v) => {
|
|
302
|
+
const {
|
|
303
|
+
zoom,
|
|
304
|
+
id: axisId
|
|
305
|
+
} = v;
|
|
306
|
+
const defaultizedZoom = defaultizeZoom(zoom, axisId, 'y');
|
|
307
|
+
if (defaultizedZoom) {
|
|
308
|
+
acc[axisId] = defaultizedZoom;
|
|
309
|
+
}
|
|
310
|
+
return acc;
|
|
311
|
+
}, {}));
|
|
312
|
+
return _extends({}, params, {
|
|
313
|
+
optionsLookup
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
useChartProZoom.getInitialState = params => {
|
|
317
|
+
return {
|
|
318
|
+
zoom: {
|
|
319
|
+
optionsLookup: params.optionsLookup,
|
|
320
|
+
zoomData: params.initialZoom === undefined ? initializeZoomData(params.optionsLookup) : params.initialZoom,
|
|
321
|
+
isInteracting: false
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createSelector } from '@mui/x-charts/internals';
|
|
2
|
+
export const selectorChartZoomState = state => state.zoom;
|
|
3
|
+
export const selectorChartZoomOptionsLookup = createSelector(selectorChartZoomState, zoom => zoom.optionsLookup);
|
|
4
|
+
export const selectorChartZoomData = createSelector(selectorChartZoomState, zoom => zoom.zoomData);
|
|
5
|
+
export const selectorChartZoomIsInteracting = createSelector(selectorChartZoomState, zoom => zoom.isInteracting);
|
|
6
|
+
export const selectorChartZoomIsEnabled = createSelector(selectorChartZoomOptionsLookup, optionsLookup => Object.keys(optionsLookup).length > 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper to get the range (in percents of a reference range) corresponding to a given scale.
|
|
3
|
+
* @param centerRatio {number} The ratio of the point that should not move between the previous and next range.
|
|
4
|
+
* @param scaleRatio {number} The target scale ratio.
|
|
5
|
+
* @returns The range to display.
|
|
6
|
+
*/
|
|
7
|
+
export const zoomAtPoint = (centerRatio, scaleRatio, currentZoomData, options) => {
|
|
8
|
+
const MIN_RANGE = options.minStart;
|
|
9
|
+
const MAX_RANGE = options.maxEnd;
|
|
10
|
+
const MIN_ALLOWED_SPAN = options.minSpan;
|
|
11
|
+
const minRange = currentZoomData.start;
|
|
12
|
+
const maxRange = currentZoomData.end;
|
|
13
|
+
const point = minRange + centerRatio * (maxRange - minRange);
|
|
14
|
+
let newMinRange = (minRange + point * (scaleRatio - 1)) / scaleRatio;
|
|
15
|
+
let newMaxRange = (maxRange + point * (scaleRatio - 1)) / scaleRatio;
|
|
16
|
+
let minSpillover = 0;
|
|
17
|
+
let maxSpillover = 0;
|
|
18
|
+
if (newMinRange < MIN_RANGE) {
|
|
19
|
+
minSpillover = Math.abs(newMinRange);
|
|
20
|
+
newMinRange = MIN_RANGE;
|
|
21
|
+
}
|
|
22
|
+
if (newMaxRange > MAX_RANGE) {
|
|
23
|
+
maxSpillover = Math.abs(newMaxRange - MAX_RANGE);
|
|
24
|
+
newMaxRange = MAX_RANGE;
|
|
25
|
+
}
|
|
26
|
+
if (minSpillover > 0 && maxSpillover > 0) {
|
|
27
|
+
return [MIN_RANGE, MAX_RANGE];
|
|
28
|
+
}
|
|
29
|
+
newMaxRange += minSpillover;
|
|
30
|
+
newMinRange -= maxSpillover;
|
|
31
|
+
newMinRange = Math.min(MAX_RANGE - MIN_ALLOWED_SPAN, Math.max(MIN_RANGE, newMinRange));
|
|
32
|
+
newMaxRange = Math.max(MIN_ALLOWED_SPAN, Math.min(MAX_RANGE, newMaxRange));
|
|
33
|
+
return [newMinRange, newMaxRange];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the new span is valid.
|
|
38
|
+
*/
|
|
39
|
+
export function isSpanValid(minRange, maxRange, isZoomIn, option) {
|
|
40
|
+
const newSpanPercent = maxRange - minRange;
|
|
41
|
+
if (isZoomIn && newSpanPercent < option.minSpan || !isZoomIn && newSpanPercent > option.maxSpan) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (minRange < option.minStart || maxRange > option.maxEnd) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
function getMultiplier(event) {
|
|
50
|
+
const ctrlMultiplier = event.ctrlKey ? 3 : 1;
|
|
51
|
+
|
|
52
|
+
// DeltaMode: 0 is pixel, 1 is line, 2 is page
|
|
53
|
+
// This is defined by the browser.
|
|
54
|
+
if (event.deltaMode === 1) {
|
|
55
|
+
return 1 * ctrlMultiplier;
|
|
56
|
+
}
|
|
57
|
+
if (event.deltaMode) {
|
|
58
|
+
return 10 * ctrlMultiplier;
|
|
59
|
+
}
|
|
60
|
+
return 0.2 * ctrlMultiplier;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get the scale ratio and if it's a zoom in or out from a wheel event.
|
|
65
|
+
*/
|
|
66
|
+
export function getWheelScaleRatio(event, step) {
|
|
67
|
+
const deltaY = -event.deltaY;
|
|
68
|
+
const multiplier = getMultiplier(event);
|
|
69
|
+
const scaledStep = step * multiplier * deltaY / 1000;
|
|
70
|
+
// Clamp the scale ratio between 0.1 and 1.9 so that the zoom is not too big or too small.
|
|
71
|
+
const scaleRatio = Math.min(Math.max(1 + scaledStep, 0.1), 1.9);
|
|
72
|
+
const isZoomIn = deltaY > 0;
|
|
73
|
+
return {
|
|
74
|
+
scaleRatio,
|
|
75
|
+
isZoomIn
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
81
|
+
*/
|
|
82
|
+
export function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
83
|
+
const scaledStep = step / 1000;
|
|
84
|
+
let scaleRatio = 0;
|
|
85
|
+
let isZoomIn = false;
|
|
86
|
+
const hasMoved = prevDiff > 0;
|
|
87
|
+
if (hasMoved && curDiff > prevDiff) {
|
|
88
|
+
// The distance between the two pointers has increased
|
|
89
|
+
scaleRatio = 1 + scaledStep;
|
|
90
|
+
isZoomIn = true;
|
|
91
|
+
}
|
|
92
|
+
if (hasMoved && curDiff < prevDiff) {
|
|
93
|
+
// The distance between the two pointers has decreased
|
|
94
|
+
scaleRatio = 1 - scaledStep;
|
|
95
|
+
isZoomIn = false;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
scaleRatio,
|
|
99
|
+
isZoomIn
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function getDiff(eventCache) {
|
|
103
|
+
const [firstEvent, secondEvent] = eventCache;
|
|
104
|
+
return Math.hypot(firstEvent.pageX - secondEvent.pageX, firstEvent.pageY - secondEvent.pageY);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get the ratio of the point in the horizontal center of the area.
|
|
109
|
+
*/
|
|
110
|
+
export function getHorizontalCenterRatio(point, area) {
|
|
111
|
+
const {
|
|
112
|
+
left,
|
|
113
|
+
width
|
|
114
|
+
} = area;
|
|
115
|
+
return (point.x - left) / width;
|
|
116
|
+
}
|
|
117
|
+
export function preventDefault(event) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
}
|
|
120
|
+
export function getVerticalCenterRatio(point, area) {
|
|
121
|
+
const {
|
|
122
|
+
top,
|
|
123
|
+
height
|
|
124
|
+
} = area;
|
|
125
|
+
return (point.y - top) / height * -1 + 1;
|
|
126
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczNjk4MjAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
package/modern/models/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./seriesType/index.js";
|
|
1
|
+
export * from "./seriesType/index.js";
|
|
2
|
+
export {};
|
|
@@ -22,17 +22,14 @@ var _ChartsAxisHighlight = require("@mui/x-charts/ChartsAxisHighlight");
|
|
|
22
22
|
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
23
23
|
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
24
24
|
var _internals = require("@mui/x-charts/internals");
|
|
25
|
+
var _context = require("@mui/x-charts/context");
|
|
25
26
|
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
26
|
-
var
|
|
27
|
-
var _useZoom = require("../context/ZoomProvider/useZoom");
|
|
27
|
+
var _zoom = require("../hooks/zoom");
|
|
28
28
|
var _useChartContainerProProps = require("../ChartContainerPro/useChartContainerProProps");
|
|
29
|
-
var _ChartDataProviderPro = require("../context/ChartDataProviderPro");
|
|
30
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
-
const _excluded = ["
|
|
30
|
+
const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
|
|
32
31
|
function BarChartPlotZoom(props) {
|
|
33
|
-
const
|
|
34
|
-
isInteracting
|
|
35
|
-
} = (0, _useZoom.useZoom)();
|
|
32
|
+
const isInteracting = (0, _zoom.useIsZoomInteracting)();
|
|
36
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, (0, _extends2.default)({}, props, {
|
|
37
34
|
skipAnimation: isInteracting || undefined
|
|
38
35
|
}));
|
|
@@ -93,8 +90,9 @@ const BarChartPro = exports.BarChartPro = /*#__PURE__*/React.forwardRef(function
|
|
|
93
90
|
name: 'MuiBarChartPro'
|
|
94
91
|
});
|
|
95
92
|
const {
|
|
96
|
-
|
|
97
|
-
onZoomChange
|
|
93
|
+
initialZoom,
|
|
94
|
+
onZoomChange,
|
|
95
|
+
apiRef
|
|
98
96
|
} = props,
|
|
99
97
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
100
98
|
const {
|
|
@@ -114,16 +112,19 @@ const BarChartPro = exports.BarChartPro = /*#__PURE__*/React.forwardRef(function
|
|
|
114
112
|
const {
|
|
115
113
|
chartDataProviderProProps,
|
|
116
114
|
chartsSurfaceProps
|
|
117
|
-
} = (0, _useChartContainerProProps.useChartContainerProProps)(chartContainerProps,
|
|
115
|
+
} = (0, _useChartContainerProProps.useChartContainerProProps)((0, _extends2.default)({}, chartContainerProps, {
|
|
116
|
+
apiRef
|
|
117
|
+
}), ref);
|
|
118
118
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
119
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
120
|
-
|
|
119
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
120
|
+
apiRef: apiRef,
|
|
121
|
+
initialZoom: initialZoom,
|
|
121
122
|
onZoomChange: onZoomChange,
|
|
122
123
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
123
124
|
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
124
125
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
125
126
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BarChartPlotZoom, (0, _extends2.default)({}, barPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
126
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)),
|
|
127
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
127
128
|
}))]
|
|
128
129
|
}))
|
|
129
130
|
}));
|
|
@@ -133,6 +134,11 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
133
134
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
134
135
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
135
136
|
// ----------------------------------------------------------------------
|
|
137
|
+
apiRef: _propTypes.default.shape({
|
|
138
|
+
current: _propTypes.default.shape({
|
|
139
|
+
setZoomData: _propTypes.default.func.isRequired
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
136
142
|
/**
|
|
137
143
|
* The configuration of axes highlight.
|
|
138
144
|
* Default is set to 'band' in the bar direction.
|
|
@@ -201,6 +207,19 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
201
207
|
dataIndex: _propTypes.default.number,
|
|
202
208
|
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
203
209
|
}),
|
|
210
|
+
/**
|
|
211
|
+
* This prop is used to help implement the accessibility logic.
|
|
212
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
213
|
+
*/
|
|
214
|
+
id: _propTypes.default.string,
|
|
215
|
+
/**
|
|
216
|
+
* The list of zoom data related to each axis.
|
|
217
|
+
*/
|
|
218
|
+
initialZoom: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
219
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
220
|
+
end: _propTypes.default.number.isRequired,
|
|
221
|
+
start: _propTypes.default.number.isRequired
|
|
222
|
+
})),
|
|
204
223
|
/**
|
|
205
224
|
* The direction of the bar elements.
|
|
206
225
|
* @default 'vertical'
|
|
@@ -221,7 +240,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
221
240
|
* The margin between the SVG and the drawing area.
|
|
222
241
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
223
242
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
224
|
-
* @default object Depends on the charts type.
|
|
225
243
|
*/
|
|
226
244
|
margin: _propTypes.default.shape({
|
|
227
245
|
bottom: _propTypes.default.number,
|
|
@@ -281,6 +299,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
281
299
|
*/
|
|
282
300
|
slots: _propTypes.default.object,
|
|
283
301
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
302
|
+
theme: _propTypes.default.oneOf(['dark', 'light']),
|
|
284
303
|
title: _propTypes.default.string,
|
|
285
304
|
/**
|
|
286
305
|
* Indicate which axis to display the top of the charts.
|
|
@@ -415,11 +434,28 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
415
434
|
}), _propTypes.default.bool])
|
|
416
435
|
})),
|
|
417
436
|
/**
|
|
418
|
-
* The
|
|
437
|
+
* The configuration of the z-axes.
|
|
419
438
|
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
439
|
+
zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
440
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
441
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
442
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
443
|
+
unknownColor: _propTypes.default.string,
|
|
444
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
445
|
+
}), _propTypes.default.shape({
|
|
446
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
447
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
448
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
449
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
450
|
+
}), _propTypes.default.shape({
|
|
451
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
452
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
453
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
454
|
+
})]),
|
|
455
|
+
data: _propTypes.default.array,
|
|
456
|
+
dataKey: _propTypes.default.string,
|
|
457
|
+
id: _propTypes.default.string,
|
|
458
|
+
max: _propTypes.default.number,
|
|
459
|
+
min: _propTypes.default.number
|
|
424
460
|
}))
|
|
425
461
|
} : void 0;
|