@mui/x-charts-pro 8.7.0 → 8.9.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.d.ts +1 -1
- package/BarChartPro/BarChartPro.js +33 -1
- package/CHANGELOG.md +199 -24
- package/ChartDataProviderPro/ChartDataProviderPro.js +7 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -16
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +4 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +27 -12
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +102 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +11 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.js +62 -0
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +14 -0
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +61 -0
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +10 -0
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +62 -0
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +14 -0
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +59 -0
- package/ChartZoomSlider/internals/previews/PreviewPlot.types.d.ts +4 -0
- package/ChartZoomSlider/internals/previews/PreviewPlot.types.js +5 -0
- package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +16 -0
- package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +93 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +3 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +2 -0
- package/FunnelChart/FunnelChart.d.ts +4 -3
- package/FunnelChart/FunnelChart.js +1 -1
- package/FunnelChart/FunnelPlot.js +1 -1
- package/FunnelChart/funnel.types.d.ts +14 -9
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +1 -1
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/FunnelChart/index.d.ts +1 -1
- package/FunnelChart/seriesConfig/seriesProcessor.js +24 -48
- package/Heatmap/Heatmap.d.ts +4 -3
- package/Heatmap/Heatmap.js +1 -1
- package/Heatmap/index.d.ts +1 -0
- package/LineChartPro/LineChartPro.js +39 -1
- package/PieChartPro/PieChartPro.d.ts +1 -1
- package/PieChartPro/PieChartPro.js +1 -1
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.js +20 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.js +17 -1
- package/esm/BarChartPro/BarChartPro.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.js +33 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +7 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +33 -18
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +28 -13
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +94 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +11 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.js +54 -0
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +14 -0
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +53 -0
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +10 -0
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +55 -0
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +14 -0
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +51 -0
- package/esm/ChartZoomSlider/internals/previews/PreviewPlot.types.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/previews/PreviewPlot.types.js +1 -0
- package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +16 -0
- package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +86 -0
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +3 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +2 -0
- package/esm/FunnelChart/FunnelChart.d.ts +4 -3
- package/esm/FunnelChart/FunnelChart.js +1 -1
- package/esm/FunnelChart/FunnelPlot.js +1 -1
- package/esm/FunnelChart/funnel.types.d.ts +14 -9
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/esm/FunnelChart/index.d.ts +1 -1
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +24 -48
- package/esm/Heatmap/Heatmap.d.ts +4 -3
- package/esm/Heatmap/Heatmap.js +1 -1
- package/esm/Heatmap/index.d.ts +1 -0
- package/esm/LineChartPro/LineChartPro.js +39 -1
- package/esm/PieChartPro/PieChartPro.d.ts +1 -1
- package/esm/PieChartPro/PieChartPro.js +1 -1
- package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.js +20 -1
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +17 -1
- package/esm/index.js +3 -3
- package/esm/internals/plugins/useChartProExport/exportImage.js +9 -3
- package/esm/internals/plugins/useChartProExport/print.d.ts +3 -1
- package/esm/internals/plugins/useChartProExport/print.js +7 -2
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +22 -12
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
- package/index.js +3 -3
- package/internals/plugins/useChartProExport/exportImage.js +9 -3
- package/internals/plugins/useChartProExport/print.d.ts +3 -1
- package/internals/plugins/useChartProExport/print.js +7 -2
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +22 -12
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
- package/package.json +7 -7
|
@@ -9,6 +9,7 @@ exports.ChartAxisZoomSlider = ChartAxisZoomSlider;
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _internals = require("@mui/x-charts/internals");
|
|
11
11
|
var _hooks = require("@mui/x-charts/hooks");
|
|
12
|
+
var _ChartAxisZoomSliderPreview = require("./ChartAxisZoomSliderPreview");
|
|
12
13
|
var _constants = require("./constants");
|
|
13
14
|
var _useChartProZoom = require("../../internals/plugins/useChartProZoom");
|
|
14
15
|
var _ChartAxisZoomSliderTrack = require("./ChartAxisZoomSliderTrack");
|
|
@@ -25,6 +26,7 @@ function ChartAxisZoomSlider({
|
|
|
25
26
|
const store = (0, _internals.useStore)();
|
|
26
27
|
const drawingArea = (0, _internals.useDrawingArea)();
|
|
27
28
|
const zoomData = (0, _internals.useSelector)(store, _useChartProZoom.selectorChartAxisZoomData, [axisId]);
|
|
29
|
+
const zoomOptions = (0, _internals.useSelector)(store, _internals.selectorChartAxisZoomOptionsLookup, [axisId]);
|
|
28
30
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
29
31
|
const {
|
|
30
32
|
xAxis
|
|
@@ -32,6 +34,7 @@ function ChartAxisZoomSlider({
|
|
|
32
34
|
const {
|
|
33
35
|
yAxis
|
|
34
36
|
} = (0, _hooks.useYAxes)();
|
|
37
|
+
const showPreview = zoomOptions.slider.preview;
|
|
35
38
|
if (!zoomData) {
|
|
36
39
|
return null;
|
|
37
40
|
}
|
|
@@ -40,6 +43,7 @@ function ChartAxisZoomSlider({
|
|
|
40
43
|
let reverse;
|
|
41
44
|
let axisPosition;
|
|
42
45
|
let tooltipConditions;
|
|
46
|
+
const sliderSize = showPreview ? _internals.ZOOM_SLIDER_PREVIEW_SIZE : _constants.ZOOM_SLIDER_SIZE;
|
|
43
47
|
if (axisDirection === 'x') {
|
|
44
48
|
const axis = xAxis[axisId];
|
|
45
49
|
if (!axis || axis.position === 'none') {
|
|
@@ -47,7 +51,7 @@ function ChartAxisZoomSlider({
|
|
|
47
51
|
}
|
|
48
52
|
const axisSize = axis.height;
|
|
49
53
|
x = drawingArea.left;
|
|
50
|
-
y = axis.position === 'bottom' ? drawingArea.top + drawingArea.height + axis.offset + axisSize + _internals.ZOOM_SLIDER_MARGIN : drawingArea.top - axis.offset - axisSize -
|
|
54
|
+
y = axis.position === 'bottom' ? drawingArea.top + drawingArea.height + axis.offset + axisSize + _internals.ZOOM_SLIDER_MARGIN : drawingArea.top - axis.offset - axisSize - sliderSize - _internals.ZOOM_SLIDER_MARGIN;
|
|
51
55
|
reverse = axis.reverse ?? false;
|
|
52
56
|
axisPosition = axis.position ?? 'bottom';
|
|
53
57
|
tooltipConditions = axis.zoom?.slider?.showTooltip ?? _internals.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP;
|
|
@@ -57,38 +61,49 @@ function ChartAxisZoomSlider({
|
|
|
57
61
|
return null;
|
|
58
62
|
}
|
|
59
63
|
const axisSize = axis.width;
|
|
60
|
-
x = axis.position === 'right' ? drawingArea.left + drawingArea.width + axis.offset + axisSize + _internals.ZOOM_SLIDER_MARGIN : drawingArea.left - axis.offset - axisSize -
|
|
64
|
+
x = axis.position === 'right' ? drawingArea.left + drawingArea.width + axis.offset + axisSize + _internals.ZOOM_SLIDER_MARGIN : drawingArea.left - axis.offset - axisSize - sliderSize - _internals.ZOOM_SLIDER_MARGIN;
|
|
61
65
|
y = drawingArea.top;
|
|
62
66
|
reverse = axis.reverse ?? false;
|
|
63
67
|
axisPosition = axis.position ?? 'left';
|
|
64
68
|
tooltipConditions = axis.zoom?.slider?.showTooltip ?? _internals.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP;
|
|
65
69
|
}
|
|
66
|
-
const backgroundRectOffset = (
|
|
70
|
+
const backgroundRectOffset = (sliderSize - _constants.ZOOM_SLIDER_TRACK_SIZE) / 2;
|
|
71
|
+
const track = showPreview ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderPreview.ChartAxisZoomSliderPreview, {
|
|
72
|
+
axisId: axisId,
|
|
73
|
+
axisDirection: axisDirection,
|
|
74
|
+
reverse: reverse,
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0,
|
|
77
|
+
height: axisDirection === 'x' ? _internals.ZOOM_SLIDER_PREVIEW_SIZE : drawingArea.height,
|
|
78
|
+
width: axisDirection === 'x' ? drawingArea.width : _internals.ZOOM_SLIDER_PREVIEW_SIZE
|
|
79
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderTrack.ChartAxisZoomSliderTrack, {
|
|
80
|
+
x: axisDirection === 'x' ? 0 : backgroundRectOffset,
|
|
81
|
+
y: axisDirection === 'x' ? backgroundRectOffset : 0,
|
|
82
|
+
height: axisDirection === 'x' ? _constants.ZOOM_SLIDER_TRACK_SIZE : drawingArea.height,
|
|
83
|
+
width: axisDirection === 'x' ? drawingArea.width : _constants.ZOOM_SLIDER_TRACK_SIZE,
|
|
84
|
+
rx: _constants.ZOOM_SLIDER_TRACK_SIZE / 2,
|
|
85
|
+
ry: _constants.ZOOM_SLIDER_TRACK_SIZE / 2,
|
|
86
|
+
axisId: axisId,
|
|
87
|
+
axisDirection: axisDirection,
|
|
88
|
+
reverse: reverse,
|
|
89
|
+
onSelectStart: tooltipConditions === 'hover' ? () => setShowTooltip(true) : undefined,
|
|
90
|
+
onSelectEnd: tooltipConditions === 'hover' ? () => setShowTooltip(false) : undefined
|
|
91
|
+
});
|
|
67
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
68
93
|
"data-charts-zoom-slider": true,
|
|
69
94
|
transform: `translate(${x} ${y})`,
|
|
70
95
|
style: {
|
|
71
96
|
touchAction: 'none'
|
|
72
97
|
},
|
|
73
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
74
|
-
x: axisDirection === 'x' ? 0 : backgroundRectOffset,
|
|
75
|
-
y: axisDirection === 'x' ? backgroundRectOffset : 0,
|
|
76
|
-
height: axisDirection === 'x' ? _constants.ZOOM_SLIDER_TRACK_SIZE : drawingArea.height,
|
|
77
|
-
width: axisDirection === 'x' ? drawingArea.width : _constants.ZOOM_SLIDER_TRACK_SIZE,
|
|
78
|
-
rx: _constants.ZOOM_SLIDER_TRACK_SIZE / 2,
|
|
79
|
-
ry: _constants.ZOOM_SLIDER_TRACK_SIZE / 2,
|
|
80
|
-
axisId: axisId,
|
|
81
|
-
axisDirection: axisDirection,
|
|
82
|
-
reverse: reverse,
|
|
83
|
-
onSelectStart: tooltipConditions === 'hover' ? () => setShowTooltip(true) : undefined,
|
|
84
|
-
onSelectEnd: tooltipConditions === 'hover' ? () => setShowTooltip(false) : undefined
|
|
85
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderActiveTrack.ChartAxisZoomSliderActiveTrack, {
|
|
98
|
+
children: [track, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderActiveTrack.ChartAxisZoomSliderActiveTrack, {
|
|
86
99
|
zoomData: zoomData,
|
|
87
100
|
axisId: axisId,
|
|
88
101
|
axisPosition: axisPosition,
|
|
89
102
|
axisDirection: axisDirection,
|
|
90
103
|
reverse: reverse,
|
|
91
104
|
showTooltip: showTooltip && tooltipConditions !== 'never' || tooltipConditions === 'always',
|
|
105
|
+
size: showPreview ? _internals.ZOOM_SLIDER_PREVIEW_SIZE : _constants.ZOOM_SLIDER_ACTIVE_TRACK_SIZE,
|
|
106
|
+
preview: showPreview,
|
|
92
107
|
onPointerEnter: tooltipConditions === 'hover' ? () => setShowTooltip(true) : undefined,
|
|
93
108
|
onPointerLeave: tooltipConditions === 'hover' ? () => setShowTooltip(false) : undefined
|
|
94
109
|
})]
|
|
@@ -4,6 +4,8 @@ export interface ChartAxisZoomSliderActiveTrackProps {
|
|
|
4
4
|
axisId: AxisId;
|
|
5
5
|
axisDirection: 'x' | 'y';
|
|
6
6
|
axisPosition: 'top' | 'bottom' | 'left' | 'right';
|
|
7
|
+
size: number;
|
|
8
|
+
preview: boolean;
|
|
7
9
|
zoomData: ZoomData;
|
|
8
10
|
reverse?: boolean;
|
|
9
11
|
showTooltip: boolean;
|
|
@@ -14,6 +16,8 @@ export declare function ChartAxisZoomSliderActiveTrack({
|
|
|
14
16
|
axisId,
|
|
15
17
|
axisDirection,
|
|
16
18
|
axisPosition,
|
|
19
|
+
size,
|
|
20
|
+
preview,
|
|
17
21
|
zoomData,
|
|
18
22
|
reverse,
|
|
19
23
|
showTooltip,
|
|
@@ -12,6 +12,7 @@ var _styles = require("@mui/material/styles");
|
|
|
12
12
|
var _internals = require("@mui/x-charts/internals");
|
|
13
13
|
var React = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _rafThrottle = require("@mui/x-internals/rafThrottle");
|
|
15
|
+
var _system = require("@mui/system");
|
|
15
16
|
var _useChartProZoom = require("../../internals/plugins/useChartProZoom");
|
|
16
17
|
var _ChartAxisZoomSliderThumb = require("./ChartAxisZoomSliderThumb");
|
|
17
18
|
var _ChartsTooltipZoomSliderValue = require("./ChartsTooltipZoomSliderValue");
|
|
@@ -19,18 +20,31 @@ var _zoomUtils = require("./zoom-utils");
|
|
|
19
20
|
var _constants = require("./constants");
|
|
20
21
|
var _chartAxisZoomSliderTrackClasses = require("./chartAxisZoomSliderTrackClasses");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const ZoomSliderActiveTrackRect = (0, _styles.styled)('rect'
|
|
23
|
+
const ZoomSliderActiveTrackRect = (0, _styles.styled)('rect', {
|
|
24
|
+
shouldForwardProp: prop => (0, _system.shouldForwardProp)(prop) && prop !== 'preview'
|
|
25
|
+
})(({
|
|
23
26
|
theme
|
|
24
27
|
}) => ({
|
|
25
|
-
'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
fill: theme.palette.mode === 'dark' ? (theme.vars || theme).palette.grey[500] : (theme.vars || theme).palette.grey[600],
|
|
29
|
+
cursor: 'grab',
|
|
30
|
+
variants: [{
|
|
31
|
+
props: {
|
|
32
|
+
preview: true
|
|
33
|
+
},
|
|
34
|
+
style: {
|
|
35
|
+
fill: 'transparent',
|
|
36
|
+
rx: 4,
|
|
37
|
+
ry: 4,
|
|
38
|
+
stroke: theme.palette.grey[500]
|
|
39
|
+
}
|
|
40
|
+
}]
|
|
29
41
|
}));
|
|
30
42
|
function ChartAxisZoomSliderActiveTrack({
|
|
31
43
|
axisId,
|
|
32
44
|
axisDirection,
|
|
33
45
|
axisPosition,
|
|
46
|
+
size,
|
|
47
|
+
preview,
|
|
34
48
|
zoomData,
|
|
35
49
|
reverse,
|
|
36
50
|
showTooltip,
|
|
@@ -169,11 +183,11 @@ function ChartAxisZoomSliderActiveTrack({
|
|
|
169
183
|
previewX = (zoomStart - minStart) / range * drawingArea.width;
|
|
170
184
|
previewY = 0;
|
|
171
185
|
previewWidth = drawingArea.width * (zoomEnd - zoomStart) / range;
|
|
172
|
-
previewHeight =
|
|
186
|
+
previewHeight = size;
|
|
173
187
|
startThumbX = (zoomStart - minStart) / range * drawingArea.width;
|
|
174
|
-
startThumbY = 0;
|
|
188
|
+
startThumbY = _constants.ZOOM_SLIDER_THUMB_HEIGHT < size ? (size - _constants.ZOOM_SLIDER_THUMB_HEIGHT) / 2 : 0;
|
|
175
189
|
endThumbX = (zoomEnd - minStart) / range * drawingArea.width;
|
|
176
|
-
endThumbY = 0;
|
|
190
|
+
endThumbY = _constants.ZOOM_SLIDER_THUMB_HEIGHT < size ? (size - _constants.ZOOM_SLIDER_THUMB_HEIGHT) / 2 : 0;
|
|
177
191
|
if (reverse) {
|
|
178
192
|
previewX = drawingArea.width - previewX - previewWidth;
|
|
179
193
|
startThumbX = drawingArea.width - startThumbX;
|
|
@@ -184,11 +198,11 @@ function ChartAxisZoomSliderActiveTrack({
|
|
|
184
198
|
} else {
|
|
185
199
|
previewX = 0;
|
|
186
200
|
previewY = drawingArea.height - (zoomEnd - minStart) / range * drawingArea.height;
|
|
187
|
-
previewWidth =
|
|
201
|
+
previewWidth = size;
|
|
188
202
|
previewHeight = drawingArea.height * (zoomEnd - zoomStart) / range;
|
|
189
|
-
startThumbX = 0;
|
|
203
|
+
startThumbX = _constants.ZOOM_SLIDER_THUMB_HEIGHT < size ? (size - _constants.ZOOM_SLIDER_THUMB_HEIGHT) / 2 : 0;
|
|
190
204
|
startThumbY = drawingArea.height - (zoomStart - minStart) / range * drawingArea.height;
|
|
191
|
-
endThumbX = 0;
|
|
205
|
+
endThumbX = _constants.ZOOM_SLIDER_THUMB_HEIGHT < size ? (size - _constants.ZOOM_SLIDER_THUMB_HEIGHT) / 2 : 0;
|
|
192
206
|
endThumbY = drawingArea.height - (zoomEnd - minStart) / range * drawingArea.height;
|
|
193
207
|
if (reverse) {
|
|
194
208
|
previewY = drawingArea.height - previewY - previewHeight;
|
|
@@ -198,12 +212,13 @@ function ChartAxisZoomSliderActiveTrack({
|
|
|
198
212
|
startThumbY -= previewThumbHeight / 2;
|
|
199
213
|
endThumbY -= previewThumbHeight / 2;
|
|
200
214
|
}
|
|
201
|
-
const previewOffset = (_constants.ZOOM_SLIDER_THUMB_HEIGHT -
|
|
215
|
+
const previewOffset = _constants.ZOOM_SLIDER_THUMB_HEIGHT > size ? (_constants.ZOOM_SLIDER_THUMB_HEIGHT - size) / 2 : 0;
|
|
202
216
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
203
217
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ZoomSliderActiveTrackRect, {
|
|
204
218
|
ref: activePreviewRectRef,
|
|
205
219
|
x: previewX + (axisDirection === 'x' ? 0 : previewOffset),
|
|
206
220
|
y: previewY + (axisDirection === 'x' ? previewOffset : 0),
|
|
221
|
+
preview: preview,
|
|
207
222
|
width: previewWidth,
|
|
208
223
|
height: previewHeight,
|
|
209
224
|
onPointerEnter: onPointerEnter,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
interface ChartAxisZoomSliderPreviewProps {
|
|
4
|
+
axisId: AxisId;
|
|
5
|
+
axisDirection: 'x' | 'y';
|
|
6
|
+
reverse: boolean;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function ChartAxisZoomSliderPreview({
|
|
13
|
+
axisId,
|
|
14
|
+
axisDirection,
|
|
15
|
+
reverse,
|
|
16
|
+
...props
|
|
17
|
+
}: ChartAxisZoomSliderPreviewProps): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ChartAxisZoomSliderPreview = ChartAxisZoomSliderPreview;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _internals = require("@mui/x-charts/internals");
|
|
14
|
+
var _system = require("@mui/system");
|
|
15
|
+
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
16
|
+
var _useChartProZoom = require("../../internals/plugins/useChartProZoom");
|
|
17
|
+
var _ChartAxisZoomSliderPreviewContent = require("./ChartAxisZoomSliderPreviewContent");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["axisId", "axisDirection", "reverse"];
|
|
20
|
+
const PreviewBackgroundRect = (0, _styles.styled)('rect')(({
|
|
21
|
+
theme
|
|
22
|
+
}) => ({
|
|
23
|
+
rx: 4,
|
|
24
|
+
ry: 4,
|
|
25
|
+
stroke: theme.palette.grey[700],
|
|
26
|
+
fill: (0, _system.alpha)(theme.palette.grey[700], 0.4)
|
|
27
|
+
}));
|
|
28
|
+
function ChartAxisZoomSliderPreview(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
axisId,
|
|
31
|
+
axisDirection
|
|
32
|
+
} = _ref,
|
|
33
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, props, {
|
|
35
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewRectangles, (0, _extends2.default)({}, props, {
|
|
36
|
+
axisId: axisId,
|
|
37
|
+
axisDirection: axisDirection
|
|
38
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", (0, _extends2.default)({}, props, {
|
|
39
|
+
fill: "transparent",
|
|
40
|
+
rx: 4,
|
|
41
|
+
ry: 4
|
|
42
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartAxisZoomSliderPreviewContent.ChartAxisZoomSliderPreviewContent, (0, _extends2.default)({
|
|
43
|
+
axisId: axisId
|
|
44
|
+
}, props))]
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
function PreviewRectangles(props) {
|
|
48
|
+
const {
|
|
49
|
+
axisId,
|
|
50
|
+
axisDirection
|
|
51
|
+
} = props;
|
|
52
|
+
const store = (0, _internals.useStore)();
|
|
53
|
+
const zoomData = (0, _internals.useSelector)(store, _useChartProZoom.selectorChartAxisZoomData, [axisId]);
|
|
54
|
+
const zoomOptions = (0, _internals.useSelector)(store, _internals.selectorChartAxisZoomOptionsLookup, [axisId]);
|
|
55
|
+
const id = (0, _useId.default)();
|
|
56
|
+
if (!zoomData) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const maskId = `zoom-preview-mask-${axisId}-${id}`;
|
|
60
|
+
let x;
|
|
61
|
+
let y;
|
|
62
|
+
let width;
|
|
63
|
+
let height;
|
|
64
|
+
const range = zoomOptions.maxEnd - zoomOptions.minStart;
|
|
65
|
+
if (axisDirection === 'x') {
|
|
66
|
+
x = props.x + (zoomData.start - zoomOptions.minStart) / range * props.width;
|
|
67
|
+
y = props.y;
|
|
68
|
+
width = (zoomData.end - zoomData.start) / range * props.width;
|
|
69
|
+
height = props.height;
|
|
70
|
+
} else {
|
|
71
|
+
x = props.x;
|
|
72
|
+
y = props.y + (1 - zoomData.end / range) * props.height;
|
|
73
|
+
width = props.width;
|
|
74
|
+
height = (zoomData.end - zoomData.start) / range * props.height;
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
77
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("mask", {
|
|
78
|
+
id: maskId,
|
|
79
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
80
|
+
x: props.x,
|
|
81
|
+
y: props.y,
|
|
82
|
+
width: props.width,
|
|
83
|
+
height: props.height,
|
|
84
|
+
fill: "white"
|
|
85
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
86
|
+
x: x,
|
|
87
|
+
y: y,
|
|
88
|
+
width: width,
|
|
89
|
+
height: height,
|
|
90
|
+
fill: "black",
|
|
91
|
+
rx: 4,
|
|
92
|
+
ry: 4
|
|
93
|
+
})]
|
|
94
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewBackgroundRect, {
|
|
95
|
+
x: props.x,
|
|
96
|
+
y: props.y,
|
|
97
|
+
width: props.width,
|
|
98
|
+
height: props.height,
|
|
99
|
+
mask: `url(#${maskId})`
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
interface ChartAxisZoomSliderPreviewContentProps {
|
|
4
|
+
axisId: AxisId;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function ChartAxisZoomSliderPreviewContent(props: ChartAxisZoomSliderPreviewContentProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ChartAxisZoomSliderPreviewContent = ChartAxisZoomSliderPreviewContent;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _internals = require("@mui/x-charts/internals");
|
|
12
|
+
var _LinePreviewPlot = require("./previews/LinePreviewPlot");
|
|
13
|
+
var _AreaPreviewPlot = require("./previews/AreaPreviewPlot");
|
|
14
|
+
var _BarPreviewPlot = require("./previews/BarPreviewPlot");
|
|
15
|
+
var _ScatterPreviewPlot = require("./previews/ScatterPreviewPlot");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function ChartAxisZoomSliderPreviewContent(props) {
|
|
18
|
+
const {
|
|
19
|
+
axisId,
|
|
20
|
+
x,
|
|
21
|
+
y,
|
|
22
|
+
width,
|
|
23
|
+
height
|
|
24
|
+
} = props;
|
|
25
|
+
const store = (0, _internals.useStore)();
|
|
26
|
+
const processedSeries = (0, _internals.useSelector)(store, _internals.selectorChartSeriesProcessed);
|
|
27
|
+
const children = [];
|
|
28
|
+
const clipId = `zoom-preview-mask-${axisId}`;
|
|
29
|
+
const hasLineSeries = (processedSeries.line?.seriesOrder?.length ?? 0) > 0;
|
|
30
|
+
const hasBarSeries = (processedSeries.bar?.seriesOrder?.length ?? 0) > 0;
|
|
31
|
+
const hasScatterSeries = (processedSeries.scatter?.seriesOrder?.length ?? 0) > 0;
|
|
32
|
+
if (hasLineSeries) {
|
|
33
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPreviewPlot.AreaPreviewPlot, {
|
|
34
|
+
axisId: axisId
|
|
35
|
+
}, "area"));
|
|
36
|
+
}
|
|
37
|
+
if (hasBarSeries) {
|
|
38
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPreviewPlot.BarPreviewPlot, (0, _extends2.default)({}, props), "bar"));
|
|
39
|
+
}
|
|
40
|
+
if (hasLineSeries) {
|
|
41
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePreviewPlot.LinePreviewPlot, {
|
|
42
|
+
axisId: axisId
|
|
43
|
+
}, "line"));
|
|
44
|
+
}
|
|
45
|
+
if (hasScatterSeries) {
|
|
46
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPreviewPlot.ScatterPreviewPlot, (0, _extends2.default)({}, props), "scatter"));
|
|
47
|
+
}
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
49
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
50
|
+
id: clipId,
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
52
|
+
x: x,
|
|
53
|
+
y: y,
|
|
54
|
+
width: width,
|
|
55
|
+
height: height
|
|
56
|
+
})
|
|
57
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
58
|
+
clipPath: `url(#${clipId})`,
|
|
59
|
+
children: children
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { PreviewPlotProps } from "./PreviewPlot.types.js";
|
|
4
|
+
interface AreaPreviewPlotProps extends PreviewPlotProps {}
|
|
5
|
+
export declare function AreaPreviewPlot({
|
|
6
|
+
axisId
|
|
7
|
+
}: AreaPreviewPlotProps): React.JSX.Element;
|
|
8
|
+
export interface PreviewAreaElementProps extends Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
|
|
9
|
+
id: SeriesId;
|
|
10
|
+
gradientId?: string;
|
|
11
|
+
color: string;
|
|
12
|
+
d: string;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AreaPreviewPlot = AreaPreviewPlot;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _internals = require("@mui/x-charts/internals");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const _excluded = ["id", "color", "gradientId", "onClick"];
|
|
16
|
+
const AreaPlotRoot = (0, _styles.styled)('g', {
|
|
17
|
+
name: 'MuiAreaPlot',
|
|
18
|
+
slot: 'Root'
|
|
19
|
+
})();
|
|
20
|
+
function AreaPreviewPlot({
|
|
21
|
+
axisId
|
|
22
|
+
}) {
|
|
23
|
+
const completedData = useAreaPreviewData(axisId);
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AreaPlotRoot, {
|
|
25
|
+
children: completedData.map(({
|
|
26
|
+
d,
|
|
27
|
+
seriesId,
|
|
28
|
+
color,
|
|
29
|
+
area,
|
|
30
|
+
gradientId
|
|
31
|
+
}) => !!area && /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewAreaElement, {
|
|
32
|
+
id: seriesId,
|
|
33
|
+
d: d,
|
|
34
|
+
color: color,
|
|
35
|
+
gradientId: gradientId
|
|
36
|
+
}, seriesId))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Preview of the area element for the zoom preview.
|
|
41
|
+
* Based on AreaElement and AnimatedArea.
|
|
42
|
+
*/
|
|
43
|
+
function PreviewAreaElement(_ref) {
|
|
44
|
+
let {
|
|
45
|
+
id,
|
|
46
|
+
color,
|
|
47
|
+
gradientId
|
|
48
|
+
} = _ref,
|
|
49
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
51
|
+
fill: gradientId ? `url(#${gradientId})` : color,
|
|
52
|
+
stroke: "none",
|
|
53
|
+
"data-series": id
|
|
54
|
+
}, other));
|
|
55
|
+
}
|
|
56
|
+
function useAreaPreviewData(axisId) {
|
|
57
|
+
const store = (0, _internals.useStore)();
|
|
58
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
59
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
60
|
+
return (0, _internals.useAreaPlotData)(xAxes, yAxes);
|
|
61
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PreviewPlotProps } from "./PreviewPlot.types.js";
|
|
3
|
+
interface BarPreviewPlotProps extends PreviewPlotProps {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
height: number;
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function BarPreviewPlot(props: BarPreviewPlotProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.BarPreviewPlot = BarPreviewPlot;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _internals = require("@mui/x-charts/internals");
|
|
10
|
+
var _BarChart = require("@mui/x-charts/BarChart");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function BarPreviewPlot(props) {
|
|
13
|
+
const drawingArea = {
|
|
14
|
+
left: props.x,
|
|
15
|
+
top: props.y,
|
|
16
|
+
width: props.width,
|
|
17
|
+
height: props.height,
|
|
18
|
+
right: props.x + props.width,
|
|
19
|
+
bottom: props.y + props.height
|
|
20
|
+
};
|
|
21
|
+
const {
|
|
22
|
+
completedData
|
|
23
|
+
} = useBarPreviewData(props.axisId, drawingArea);
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
25
|
+
children: completedData.map(({
|
|
26
|
+
seriesId,
|
|
27
|
+
data
|
|
28
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
29
|
+
children: data.map(({
|
|
30
|
+
dataIndex,
|
|
31
|
+
color,
|
|
32
|
+
layout,
|
|
33
|
+
x,
|
|
34
|
+
xOrigin,
|
|
35
|
+
y,
|
|
36
|
+
yOrigin,
|
|
37
|
+
width,
|
|
38
|
+
height
|
|
39
|
+
}) => {
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarElement, {
|
|
41
|
+
id: seriesId,
|
|
42
|
+
dataIndex: dataIndex,
|
|
43
|
+
color: color,
|
|
44
|
+
skipAnimation: true,
|
|
45
|
+
layout: layout ?? 'vertical',
|
|
46
|
+
x: x,
|
|
47
|
+
xOrigin: xOrigin,
|
|
48
|
+
y: y,
|
|
49
|
+
yOrigin: yOrigin,
|
|
50
|
+
width: width,
|
|
51
|
+
height: height
|
|
52
|
+
}, dataIndex);
|
|
53
|
+
})
|
|
54
|
+
}, seriesId))
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function useBarPreviewData(axisId, drawingArea) {
|
|
58
|
+
const store = (0, _internals.useStore)();
|
|
59
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
60
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
61
|
+
return (0, _internals.useBarPlotData)(drawingArea, xAxes, yAxes);
|
|
62
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { PreviewPlotProps } from "./PreviewPlot.types.js";
|
|
4
|
+
interface LinePreviewPlotProps extends PreviewPlotProps {}
|
|
5
|
+
export declare function LinePreviewPlot({
|
|
6
|
+
axisId
|
|
7
|
+
}: LinePreviewPlotProps): React.JSX.Element;
|
|
8
|
+
export interface PreviewLineElementProps extends Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
|
|
9
|
+
id: SeriesId;
|
|
10
|
+
gradientId?: string;
|
|
11
|
+
color: string;
|
|
12
|
+
d: string;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.LinePreviewPlot = LinePreviewPlot;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _internals = require("@mui/x-charts/internals");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
const _excluded = ["id", "color", "gradientId", "onClick"];
|
|
15
|
+
function LinePreviewPlot({
|
|
16
|
+
axisId
|
|
17
|
+
}) {
|
|
18
|
+
const completedData = useLinePreviewData(axisId);
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
20
|
+
children: completedData.map(({
|
|
21
|
+
d,
|
|
22
|
+
seriesId,
|
|
23
|
+
color,
|
|
24
|
+
gradientId
|
|
25
|
+
}) => {
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewLineElement, {
|
|
27
|
+
id: seriesId,
|
|
28
|
+
d: d,
|
|
29
|
+
color: color,
|
|
30
|
+
gradientId: gradientId
|
|
31
|
+
}, seriesId);
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Preview of the line element for the zoom preview.
|
|
37
|
+
* Based on LineElement and AnimatedLine.
|
|
38
|
+
*/
|
|
39
|
+
function PreviewLineElement(_ref) {
|
|
40
|
+
let {
|
|
41
|
+
id,
|
|
42
|
+
color,
|
|
43
|
+
gradientId
|
|
44
|
+
} = _ref,
|
|
45
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
47
|
+
stroke: gradientId ? `url(#${gradientId})` : color,
|
|
48
|
+
strokeWidth: 2,
|
|
49
|
+
strokeLinejoin: "round",
|
|
50
|
+
fill: "none",
|
|
51
|
+
"data-series": id
|
|
52
|
+
}, other));
|
|
53
|
+
}
|
|
54
|
+
function useLinePreviewData(axisId) {
|
|
55
|
+
const store = (0, _internals.useStore)();
|
|
56
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
57
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
58
|
+
return (0, _internals.useLinePlotData)(xAxes, yAxes);
|
|
59
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PreviewPlotProps } from "./PreviewPlot.types.js";
|
|
3
|
+
interface ScatterPreviewPlotProps extends PreviewPlotProps {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
height: number;
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function ScatterPreviewPlot({
|
|
10
|
+
axisId,
|
|
11
|
+
x,
|
|
12
|
+
y,
|
|
13
|
+
height,
|
|
14
|
+
width
|
|
15
|
+
}: ScatterPreviewPlotProps): React.JSX.Element | null;
|
|
16
|
+
export {};
|