@mui/x-charts-pro 8.0.0-alpha.1 → 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 +72 -31
- package/CHANGELOG.md +1903 -231
- package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
- package/ChartContainerPro/ChartContainerPro.js +55 -37
- package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
- package/ChartContainerPro/useChartContainerProProps.js +11 -7
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -80
- package/{context → ChartDataProviderPro}/package.json +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/Heatmap/Heatmap.js +31 -8
- package/Heatmap/HeatmapItem.js +1 -1
- package/Heatmap/HeatmapTooltip.js +8 -28
- 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/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 +78 -51
- package/README.md +1 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +49 -33
- 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 +72 -31
- package/modern/ChartContainerPro/ChartContainerPro.js +55 -37
- package/modern/ChartContainerPro/useChartContainerProProps.js +11 -7
- package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -80
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/modern/Heatmap/Heatmap.js +31 -8
- package/modern/Heatmap/HeatmapItem.js +1 -1
- package/modern/Heatmap/HeatmapTooltip.js +8 -28
- package/modern/Heatmap/formatter.js +2 -1
- package/modern/Heatmap/heatmapClasses.js +2 -1
- package/modern/Heatmap/plugin.js +4 -2
- package/modern/Heatmap/tooltip.js +25 -0
- package/modern/LineChartPro/LineChartPro.js +78 -51
- package/modern/ScatterChartPro/ScatterChartPro.js +49 -33
- 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 +71 -30
- package/node/ChartContainerPro/ChartContainerPro.js +54 -36
- package/node/ChartContainerPro/useChartContainerProProps.js +11 -7
- package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +67 -77
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +21 -0
- package/node/Heatmap/Heatmap.js +31 -8
- package/node/Heatmap/HeatmapItem.js +2 -2
- package/node/Heatmap/HeatmapTooltip.js +6 -26
- package/node/Heatmap/formatter.js +2 -1
- package/node/Heatmap/heatmapClasses.js +5 -4
- package/node/Heatmap/plugin.js +4 -2
- package/node/Heatmap/tooltip.js +31 -0
- package/node/LineChartPro/LineChartPro.js +77 -50
- package/node/ScatterChartPro/ScatterChartPro.js +48 -32
- 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 +6 -6
- 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 -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 -10
- 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/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/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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -15,17 +15,16 @@ import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
|
|
|
15
15
|
import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
|
|
16
16
|
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
17
17
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
18
|
+
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
19
|
+
import { useLineChartProps, ChartsWrapper } from '@mui/x-charts/internals';
|
|
20
|
+
import { useIsZoomInteracting } from "../hooks/zoom/index.js";
|
|
21
|
+
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
22
|
+
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
|
|
22
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
function AreaPlotZoom(props) {
|
|
24
|
-
const
|
|
25
|
-
isInteracting
|
|
26
|
-
} = useZoom();
|
|
25
|
+
const isInteracting = useIsZoomInteracting();
|
|
27
26
|
return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
|
|
28
|
-
skipAnimation: isInteracting ||
|
|
27
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
29
28
|
}));
|
|
30
29
|
}
|
|
31
30
|
process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
|
|
@@ -56,11 +55,9 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
|
|
|
56
55
|
slots: PropTypes.object
|
|
57
56
|
} : void 0;
|
|
58
57
|
function LinePlotZoom(props) {
|
|
59
|
-
const
|
|
60
|
-
isInteracting
|
|
61
|
-
} = useZoom();
|
|
58
|
+
const isInteracting = useIsZoomInteracting();
|
|
62
59
|
return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
|
|
63
|
-
skipAnimation: isInteracting ||
|
|
60
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
64
61
|
}));
|
|
65
62
|
}
|
|
66
63
|
process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
|
|
@@ -91,9 +88,7 @@ process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
|
|
|
91
88
|
slots: PropTypes.object
|
|
92
89
|
} : void 0;
|
|
93
90
|
function MarkPlotZoom(props) {
|
|
94
|
-
const
|
|
95
|
-
isInteracting
|
|
96
|
-
} = useZoom();
|
|
91
|
+
const isInteracting = useIsZoomInteracting();
|
|
97
92
|
return /*#__PURE__*/_jsx(MarkPlot, _extends({}, props, {
|
|
98
93
|
skipAnimation: isInteracting || undefined
|
|
99
94
|
}));
|
|
@@ -103,12 +98,6 @@ process.env.NODE_ENV !== "production" ? MarkPlotZoom.propTypes = {
|
|
|
103
98
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
104
99
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
105
100
|
// ----------------------------------------------------------------------
|
|
106
|
-
/**
|
|
107
|
-
* If `true` the mark element will only be able to render circle.
|
|
108
|
-
* Giving fewer customization options, but saving around 40ms per 1.000 marks.
|
|
109
|
-
* @default false
|
|
110
|
-
*/
|
|
111
|
-
experimentalRendering: PropTypes.bool,
|
|
112
101
|
/**
|
|
113
102
|
* Callback fired when a line mark item is clicked.
|
|
114
103
|
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
@@ -147,11 +136,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
147
136
|
name: 'MuiLineChartPro'
|
|
148
137
|
});
|
|
149
138
|
const {
|
|
150
|
-
|
|
151
|
-
onZoomChange
|
|
139
|
+
initialZoom,
|
|
140
|
+
onZoomChange,
|
|
141
|
+
apiRef
|
|
152
142
|
} = props,
|
|
153
143
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
154
144
|
const {
|
|
145
|
+
chartsWrapperProps,
|
|
155
146
|
chartContainerProps,
|
|
156
147
|
axisClickHandlerProps,
|
|
157
148
|
gridProps,
|
|
@@ -167,18 +158,26 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
167
158
|
legendProps,
|
|
168
159
|
children
|
|
169
160
|
} = useLineChartProps(other);
|
|
161
|
+
const {
|
|
162
|
+
chartDataProviderProProps,
|
|
163
|
+
chartsSurfaceProps
|
|
164
|
+
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
165
|
+
initialZoom,
|
|
166
|
+
onZoomChange,
|
|
167
|
+
apiRef
|
|
168
|
+
}), ref);
|
|
170
169
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
171
|
-
return /*#__PURE__*/
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
})
|
|
170
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
171
|
+
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
172
|
+
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
173
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
174
|
+
children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
175
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
176
|
+
"data-drawing-container": true,
|
|
177
|
+
children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
|
|
178
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
179
|
+
}))]
|
|
180
|
+
}))
|
|
182
181
|
}));
|
|
183
182
|
});
|
|
184
183
|
process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
@@ -186,6 +185,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
186
185
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
187
186
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
188
187
|
// ----------------------------------------------------------------------
|
|
188
|
+
apiRef: PropTypes.shape({
|
|
189
|
+
current: PropTypes.shape({
|
|
190
|
+
setZoomData: PropTypes.func.isRequired
|
|
191
|
+
})
|
|
192
|
+
}),
|
|
189
193
|
/**
|
|
190
194
|
* The configuration of axes highlight.
|
|
191
195
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -223,10 +227,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
223
227
|
* If `true`, render the line highlight item.
|
|
224
228
|
*/
|
|
225
229
|
disableLineItemHighlight: PropTypes.bool,
|
|
226
|
-
/**
|
|
227
|
-
* If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
|
|
228
|
-
*/
|
|
229
|
-
experimentalMarkRendering: PropTypes.bool,
|
|
230
230
|
/**
|
|
231
231
|
* Option to display a cartesian grid in the background.
|
|
232
232
|
*/
|
|
@@ -243,12 +243,26 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
243
243
|
*/
|
|
244
244
|
hideLegend: PropTypes.bool,
|
|
245
245
|
/**
|
|
246
|
-
* The
|
|
246
|
+
* The highlighted item.
|
|
247
|
+
* Used when the highlight is controlled.
|
|
247
248
|
*/
|
|
248
249
|
highlightedItem: PropTypes.shape({
|
|
249
250
|
dataIndex: PropTypes.number,
|
|
250
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
251
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
251
252
|
}),
|
|
253
|
+
/**
|
|
254
|
+
* This prop is used to help implement the accessibility logic.
|
|
255
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
256
|
+
*/
|
|
257
|
+
id: PropTypes.string,
|
|
258
|
+
/**
|
|
259
|
+
* The list of zoom data related to each axis.
|
|
260
|
+
*/
|
|
261
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
262
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
263
|
+
end: PropTypes.number.isRequired,
|
|
264
|
+
start: PropTypes.number.isRequired
|
|
265
|
+
})),
|
|
252
266
|
/**
|
|
253
267
|
* Indicate which axis to display the left of the charts.
|
|
254
268
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -264,7 +278,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
264
278
|
* The margin between the SVG and the drawing area.
|
|
265
279
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
266
280
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
267
|
-
* @default object Depends on the charts type.
|
|
268
281
|
*/
|
|
269
282
|
margin: PropTypes.shape({
|
|
270
283
|
bottom: PropTypes.number,
|
|
@@ -330,6 +343,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
330
343
|
*/
|
|
331
344
|
slots: PropTypes.object,
|
|
332
345
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
346
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
333
347
|
title: PropTypes.string,
|
|
334
348
|
/**
|
|
335
349
|
* Indicate which axis to display the top of the charts.
|
|
@@ -372,7 +386,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
372
386
|
hideTooltip: PropTypes.bool,
|
|
373
387
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
374
388
|
label: PropTypes.string,
|
|
375
|
-
labelFontSize: PropTypes.number,
|
|
376
389
|
labelStyle: PropTypes.object,
|
|
377
390
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
378
391
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -383,7 +396,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
383
396
|
slots: PropTypes.object,
|
|
384
397
|
stroke: PropTypes.string,
|
|
385
398
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
386
|
-
tickFontSize: PropTypes.number,
|
|
387
399
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
388
400
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
389
401
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -435,7 +447,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
435
447
|
hideTooltip: PropTypes.bool,
|
|
436
448
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
437
449
|
label: PropTypes.string,
|
|
438
|
-
labelFontSize: PropTypes.number,
|
|
439
450
|
labelStyle: PropTypes.object,
|
|
440
451
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
441
452
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -446,7 +457,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
446
457
|
slots: PropTypes.object,
|
|
447
458
|
stroke: PropTypes.string,
|
|
448
459
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
449
|
-
tickFontSize: PropTypes.number,
|
|
450
460
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
451
461
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
452
462
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -468,12 +478,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
468
478
|
}), PropTypes.bool])
|
|
469
479
|
})),
|
|
470
480
|
/**
|
|
471
|
-
* The
|
|
481
|
+
* The configuration of the z-axes.
|
|
472
482
|
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
483
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
484
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
485
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
486
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
487
|
+
unknownColor: PropTypes.string,
|
|
488
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
489
|
+
}), PropTypes.shape({
|
|
490
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
491
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
492
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
493
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
494
|
+
}), PropTypes.shape({
|
|
495
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
496
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
497
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
498
|
+
})]),
|
|
499
|
+
data: PropTypes.array,
|
|
500
|
+
dataKey: PropTypes.string,
|
|
501
|
+
id: PropTypes.string,
|
|
502
|
+
max: PropTypes.number,
|
|
503
|
+
min: PropTypes.number
|
|
477
504
|
}))
|
|
478
505
|
} : void 0;
|
|
479
506
|
export { LineChartPro };
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
10
10
|
import { ScatterPlot } from '@mui/x-charts/ScatterChart';
|
|
11
|
-
import { ZAxisContextProvider } from '@mui/x-charts/context';
|
|
12
11
|
import { ChartsVoronoiHandler } from '@mui/x-charts/ChartsVoronoiHandler';
|
|
13
12
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
14
13
|
import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
|
|
15
14
|
import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
|
|
15
|
+
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
16
16
|
import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
|
|
17
17
|
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
18
|
-
import { useScatterChartProps } from '@mui/x-charts/internals';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { useScatterChartProps, ChartsWrapper } from '@mui/x-charts/internals';
|
|
19
|
+
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
20
|
+
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
/**
|
|
23
23
|
* Demos:
|
|
@@ -35,13 +35,14 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
35
35
|
name: 'MuiScatterChartPro'
|
|
36
36
|
});
|
|
37
37
|
const {
|
|
38
|
-
|
|
39
|
-
onZoomChange
|
|
38
|
+
initialZoom,
|
|
39
|
+
onZoomChange,
|
|
40
|
+
apiRef
|
|
40
41
|
} = props,
|
|
41
42
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
42
43
|
const {
|
|
44
|
+
chartsWrapperProps,
|
|
43
45
|
chartContainerProps,
|
|
44
|
-
zAxisProps,
|
|
45
46
|
voronoiHandlerProps,
|
|
46
47
|
chartsAxisProps,
|
|
47
48
|
gridProps,
|
|
@@ -51,17 +52,25 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
51
52
|
axisHighlightProps,
|
|
52
53
|
children
|
|
53
54
|
} = useScatterChartProps(other);
|
|
55
|
+
const {
|
|
56
|
+
chartDataProviderProProps,
|
|
57
|
+
chartsSurfaceProps
|
|
58
|
+
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
59
|
+
initialZoom,
|
|
60
|
+
onZoomChange,
|
|
61
|
+
apiRef
|
|
62
|
+
}), ref);
|
|
54
63
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
55
|
-
return /*#__PURE__*/_jsx(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})
|
|
64
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
65
|
+
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
66
|
+
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
67
|
+
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
68
|
+
"data-drawing-container": true,
|
|
69
|
+
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
70
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props?.slotProps?.tooltip, {
|
|
71
|
+
trigger: "item"
|
|
72
|
+
})), children]
|
|
73
|
+
}))]
|
|
65
74
|
}))
|
|
66
75
|
}));
|
|
67
76
|
});
|
|
@@ -70,6 +79,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
70
79
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
71
80
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
72
81
|
// ----------------------------------------------------------------------
|
|
82
|
+
apiRef: PropTypes.shape({
|
|
83
|
+
current: PropTypes.shape({
|
|
84
|
+
setZoomData: PropTypes.func.isRequired
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
73
87
|
/**
|
|
74
88
|
* The configuration of axes highlight.
|
|
75
89
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -124,12 +138,26 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
124
138
|
*/
|
|
125
139
|
hideLegend: PropTypes.bool,
|
|
126
140
|
/**
|
|
127
|
-
* The
|
|
141
|
+
* The highlighted item.
|
|
142
|
+
* Used when the highlight is controlled.
|
|
128
143
|
*/
|
|
129
144
|
highlightedItem: PropTypes.shape({
|
|
130
145
|
dataIndex: PropTypes.number,
|
|
131
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
146
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
132
147
|
}),
|
|
148
|
+
/**
|
|
149
|
+
* This prop is used to help implement the accessibility logic.
|
|
150
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
151
|
+
*/
|
|
152
|
+
id: PropTypes.string,
|
|
153
|
+
/**
|
|
154
|
+
* The list of zoom data related to each axis.
|
|
155
|
+
*/
|
|
156
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
157
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
158
|
+
end: PropTypes.number.isRequired,
|
|
159
|
+
start: PropTypes.number.isRequired
|
|
160
|
+
})),
|
|
133
161
|
/**
|
|
134
162
|
* Indicate which axis to display the left of the charts.
|
|
135
163
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -145,7 +173,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
145
173
|
* The margin between the SVG and the drawing area.
|
|
146
174
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
147
175
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
148
|
-
* @default object Depends on the charts type.
|
|
149
176
|
*/
|
|
150
177
|
margin: PropTypes.shape({
|
|
151
178
|
bottom: PropTypes.number,
|
|
@@ -198,6 +225,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
198
225
|
*/
|
|
199
226
|
slots: PropTypes.object,
|
|
200
227
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
228
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
201
229
|
title: PropTypes.string,
|
|
202
230
|
/**
|
|
203
231
|
* Indicate which axis to display the top of the charts.
|
|
@@ -245,7 +273,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
245
273
|
hideTooltip: PropTypes.bool,
|
|
246
274
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
247
275
|
label: PropTypes.string,
|
|
248
|
-
labelFontSize: PropTypes.number,
|
|
249
276
|
labelStyle: PropTypes.object,
|
|
250
277
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
251
278
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -256,7 +283,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
256
283
|
slots: PropTypes.object,
|
|
257
284
|
stroke: PropTypes.string,
|
|
258
285
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
259
|
-
tickFontSize: PropTypes.number,
|
|
260
286
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
261
287
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
262
288
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -308,7 +334,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
308
334
|
hideTooltip: PropTypes.bool,
|
|
309
335
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
310
336
|
label: PropTypes.string,
|
|
311
|
-
labelFontSize: PropTypes.number,
|
|
312
337
|
labelStyle: PropTypes.object,
|
|
313
338
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
314
339
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -319,7 +344,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
319
344
|
slots: PropTypes.object,
|
|
320
345
|
stroke: PropTypes.string,
|
|
321
346
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
322
|
-
tickFontSize: PropTypes.number,
|
|
323
347
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
324
348
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
325
349
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -364,14 +388,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
364
388
|
id: PropTypes.string,
|
|
365
389
|
max: PropTypes.number,
|
|
366
390
|
min: PropTypes.number
|
|
367
|
-
})),
|
|
368
|
-
/**
|
|
369
|
-
* The list of zoom data related to each axis.
|
|
370
|
-
*/
|
|
371
|
-
zoom: PropTypes.arrayOf(PropTypes.shape({
|
|
372
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
373
|
-
end: PropTypes.number.isRequired,
|
|
374
|
-
start: PropTypes.number.isRequired
|
|
375
391
|
}))
|
|
376
392
|
} : void 0;
|
|
377
393
|
export { ScatterChartPro };
|
package/modern/hooks/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { useHeatmapSeries as unstable_useHeatmapSeries } from "./useSeries.js";
|
|
1
|
+
export { useHeatmapSeries as unstable_useHeatmapSeries } from "./useSeries.js";
|
|
2
|
+
export * from "./zoom/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useIsZoomInteracting.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useSelector, useStore } from '@mui/x-charts/internals';
|
|
4
|
+
import { selectorChartZoomIsInteracting } from "../../internals/plugins/useChartProZoom/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get access to the zoom state.
|
|
7
|
+
*
|
|
8
|
+
* @returns {boolean} Inform the zoom is interacting.
|
|
9
|
+
*/
|
|
10
|
+
export function useIsZoomInteracting() {
|
|
11
|
+
const store = useStore();
|
|
12
|
+
const isInteracting = useSelector(store, selectorChartZoomIsInteracting);
|
|
13
|
+
return isInteracting;
|
|
14
|
+
}
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-pro v8.0.0-alpha.
|
|
2
|
+
* @mui/x-charts-pro v8.0.0-alpha.10
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -32,13 +32,13 @@ export * from '@mui/x-charts/ScatterChart';
|
|
|
32
32
|
export * from '@mui/x-charts/SparkLineChart';
|
|
33
33
|
export * from '@mui/x-charts/Gauge';
|
|
34
34
|
export * from '@mui/x-charts/ChartsSurface';
|
|
35
|
+
export * from '@mui/x-charts/ChartDataProvider';
|
|
36
|
+
export * from '@mui/x-charts/ChartsLabel';
|
|
35
37
|
|
|
36
38
|
// Pro components
|
|
37
39
|
export * from "./Heatmap/index.js";
|
|
38
40
|
export * from "./ChartContainerPro/index.js";
|
|
41
|
+
export * from "./ChartDataProviderPro/index.js";
|
|
39
42
|
export * from "./ScatterChartPro/index.js";
|
|
40
43
|
export * from "./BarChartPro/index.js";
|
|
41
|
-
export * from "./LineChartPro/index.js";
|
|
42
|
-
|
|
43
|
-
// Pro context
|
|
44
|
-
export * from "./context/index.js";
|
|
44
|
+
export * from "./LineChartPro/index.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
2
|
+
|
|
3
|
+
import { useChartCartesianAxis, useChartInteraction, useChartZAxis, useChartHighlight } from '@mui/x-charts/internals';
|
|
4
|
+
import { useChartProZoom } from "./useChartProZoom/index.js";
|
|
5
|
+
export const ALL_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartProZoom];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defaultizeZoom } from "./defaultizeZoom.js";
|
|
2
|
+
export const creatZoomLookup = axisDirection => axes => axes.reduce((acc, v) => {
|
|
3
|
+
const {
|
|
4
|
+
zoom,
|
|
5
|
+
id: axisId
|
|
6
|
+
} = v;
|
|
7
|
+
const defaultizedZoom = defaultizeZoom(zoom, axisId, axisDirection);
|
|
8
|
+
if (defaultizedZoom) {
|
|
9
|
+
acc[axisId] = defaultizedZoom;
|
|
10
|
+
}
|
|
11
|
+
return acc;
|
|
12
|
+
}, {});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
const defaultZoomOptions = {
|
|
3
|
+
minStart: 0,
|
|
4
|
+
maxEnd: 100,
|
|
5
|
+
step: 5,
|
|
6
|
+
minSpan: 10,
|
|
7
|
+
maxSpan: 100,
|
|
8
|
+
panning: true,
|
|
9
|
+
filterMode: 'keep'
|
|
10
|
+
};
|
|
11
|
+
export const defaultizeZoom = (zoom, axisId, axisDirection) => {
|
|
12
|
+
if (!zoom) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
if (zoom === true) {
|
|
16
|
+
return _extends({
|
|
17
|
+
axisId,
|
|
18
|
+
axisDirection
|
|
19
|
+
}, defaultZoomOptions);
|
|
20
|
+
}
|
|
21
|
+
return _extends({
|
|
22
|
+
axisId,
|
|
23
|
+
axisDirection
|
|
24
|
+
}, defaultZoomOptions, zoom);
|
|
25
|
+
};
|