@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LineChartProps } from '@mui/x-charts/LineChart';
|
|
3
|
-
import {
|
|
4
|
-
export interface LineChartProProps extends LineChartProps,
|
|
3
|
+
import { ChartContainerProProps } from '../ChartContainerPro';
|
|
4
|
+
export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line'>, 'series' | 'plugins' | 'seriesConfig'> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Demos:
|
|
@@ -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';
|
|
@@ -17,15 +17,12 @@ import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
|
17
17
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
18
18
|
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
19
19
|
import { useLineChartProps, ChartsWrapper } from '@mui/x-charts/internals';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
|
|
20
|
+
import { ChartDataProvider } from '@mui/x-charts/context';
|
|
21
|
+
import { useIsZoomInteracting } from "../hooks/zoom/index.js";
|
|
23
22
|
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
24
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
24
|
function AreaPlotZoom(props) {
|
|
26
|
-
const
|
|
27
|
-
isInteracting
|
|
28
|
-
} = useZoom();
|
|
25
|
+
const isInteracting = useIsZoomInteracting();
|
|
29
26
|
return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
|
|
30
27
|
skipAnimation: isInteracting || undefined
|
|
31
28
|
}));
|
|
@@ -58,9 +55,7 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
|
|
|
58
55
|
slots: PropTypes.object
|
|
59
56
|
} : void 0;
|
|
60
57
|
function LinePlotZoom(props) {
|
|
61
|
-
const
|
|
62
|
-
isInteracting
|
|
63
|
-
} = useZoom();
|
|
58
|
+
const isInteracting = useIsZoomInteracting();
|
|
64
59
|
return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
|
|
65
60
|
skipAnimation: isInteracting || undefined
|
|
66
61
|
}));
|
|
@@ -93,9 +88,7 @@ process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
|
|
|
93
88
|
slots: PropTypes.object
|
|
94
89
|
} : void 0;
|
|
95
90
|
function MarkPlotZoom(props) {
|
|
96
|
-
const
|
|
97
|
-
isInteracting
|
|
98
|
-
} = useZoom();
|
|
91
|
+
const isInteracting = useIsZoomInteracting();
|
|
99
92
|
return /*#__PURE__*/_jsx(MarkPlot, _extends({}, props, {
|
|
100
93
|
skipAnimation: isInteracting || undefined
|
|
101
94
|
}));
|
|
@@ -149,8 +142,9 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
149
142
|
name: 'MuiLineChartPro'
|
|
150
143
|
});
|
|
151
144
|
const {
|
|
152
|
-
|
|
153
|
-
onZoomChange
|
|
145
|
+
initialZoom,
|
|
146
|
+
onZoomChange,
|
|
147
|
+
apiRef
|
|
154
148
|
} = props,
|
|
155
149
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
156
150
|
const {
|
|
@@ -173,10 +167,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
173
167
|
const {
|
|
174
168
|
chartDataProviderProProps,
|
|
175
169
|
chartsSurfaceProps
|
|
176
|
-
} = useChartContainerProProps(chartContainerProps,
|
|
170
|
+
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
171
|
+
apiRef
|
|
172
|
+
}), ref);
|
|
177
173
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
178
|
-
return /*#__PURE__*/_jsx(
|
|
179
|
-
|
|
174
|
+
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
|
|
175
|
+
apiRef: apiRef,
|
|
176
|
+
initialZoom: initialZoom,
|
|
180
177
|
onZoomChange: onZoomChange,
|
|
181
178
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
182
179
|
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
@@ -185,7 +182,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
185
182
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
186
183
|
"data-drawing-container": true,
|
|
187
184
|
children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
|
|
188
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)),
|
|
185
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
189
186
|
}))]
|
|
190
187
|
}))
|
|
191
188
|
}));
|
|
@@ -195,6 +192,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
195
192
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
196
193
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
197
194
|
// ----------------------------------------------------------------------
|
|
195
|
+
apiRef: PropTypes.shape({
|
|
196
|
+
current: PropTypes.shape({
|
|
197
|
+
setZoomData: PropTypes.func.isRequired
|
|
198
|
+
})
|
|
199
|
+
}),
|
|
198
200
|
/**
|
|
199
201
|
* The configuration of axes highlight.
|
|
200
202
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -258,6 +260,19 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
258
260
|
dataIndex: PropTypes.number,
|
|
259
261
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
260
262
|
}),
|
|
263
|
+
/**
|
|
264
|
+
* This prop is used to help implement the accessibility logic.
|
|
265
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
266
|
+
*/
|
|
267
|
+
id: PropTypes.string,
|
|
268
|
+
/**
|
|
269
|
+
* The list of zoom data related to each axis.
|
|
270
|
+
*/
|
|
271
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
272
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
273
|
+
end: PropTypes.number.isRequired,
|
|
274
|
+
start: PropTypes.number.isRequired
|
|
275
|
+
})),
|
|
261
276
|
/**
|
|
262
277
|
* Indicate which axis to display the left of the charts.
|
|
263
278
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -273,7 +288,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
273
288
|
* The margin between the SVG and the drawing area.
|
|
274
289
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
275
290
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
276
|
-
* @default object Depends on the charts type.
|
|
277
291
|
*/
|
|
278
292
|
margin: PropTypes.shape({
|
|
279
293
|
bottom: PropTypes.number,
|
|
@@ -339,6 +353,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
339
353
|
*/
|
|
340
354
|
slots: PropTypes.object,
|
|
341
355
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
356
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
342
357
|
title: PropTypes.string,
|
|
343
358
|
/**
|
|
344
359
|
* Indicate which axis to display the top of the charts.
|
|
@@ -473,12 +488,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
473
488
|
}), PropTypes.bool])
|
|
474
489
|
})),
|
|
475
490
|
/**
|
|
476
|
-
* The
|
|
491
|
+
* The configuration of the z-axes.
|
|
477
492
|
*/
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
493
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
494
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
495
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
496
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
497
|
+
unknownColor: PropTypes.string,
|
|
498
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
499
|
+
}), PropTypes.shape({
|
|
500
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
501
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
502
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
503
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
504
|
+
}), PropTypes.shape({
|
|
505
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
506
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
507
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
508
|
+
})]),
|
|
509
|
+
data: PropTypes.array,
|
|
510
|
+
dataKey: PropTypes.string,
|
|
511
|
+
id: PropTypes.string,
|
|
512
|
+
max: PropTypes.number,
|
|
513
|
+
min: PropTypes.number
|
|
482
514
|
}))
|
|
483
515
|
} : void 0;
|
|
484
516
|
export { LineChartPro };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ScatterChartProps } from '@mui/x-charts/ScatterChart';
|
|
3
|
-
import {
|
|
4
|
-
export interface ScatterChartProProps extends ScatterChartProps,
|
|
3
|
+
import { ChartContainerProProps } from '../ChartContainerPro/ChartContainerPro';
|
|
4
|
+
export interface ScatterChartProProps extends Omit<ScatterChartProps, 'apiRef'>, Omit<ChartContainerProProps<'scatter'>, 'series' | 'plugins' | 'seriesConfig'> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Demos:
|
|
@@ -2,13 +2,13 @@
|
|
|
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 {
|
|
11
|
+
import { ChartDataProvider } from '@mui/x-charts/context';
|
|
12
12
|
import { ChartsVoronoiHandler } from '@mui/x-charts/ChartsVoronoiHandler';
|
|
13
13
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
14
14
|
import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
|
|
@@ -17,8 +17,6 @@ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
|
17
17
|
import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
|
|
18
18
|
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
19
19
|
import { useScatterChartProps, ChartsWrapper } from '@mui/x-charts/internals';
|
|
20
|
-
import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
|
|
21
|
-
import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
|
|
22
20
|
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
23
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
22
|
/**
|
|
@@ -37,14 +35,14 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
37
35
|
name: 'MuiScatterChartPro'
|
|
38
36
|
});
|
|
39
37
|
const {
|
|
40
|
-
|
|
41
|
-
onZoomChange
|
|
38
|
+
initialZoom,
|
|
39
|
+
onZoomChange,
|
|
40
|
+
apiRef
|
|
42
41
|
} = props,
|
|
43
42
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
44
43
|
const {
|
|
45
44
|
chartsWrapperProps,
|
|
46
45
|
chartContainerProps,
|
|
47
|
-
zAxisProps,
|
|
48
46
|
voronoiHandlerProps,
|
|
49
47
|
chartsAxisProps,
|
|
50
48
|
gridProps,
|
|
@@ -57,21 +55,22 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
57
55
|
const {
|
|
58
56
|
chartDataProviderProProps,
|
|
59
57
|
chartsSurfaceProps
|
|
60
|
-
} = useChartContainerProProps(chartContainerProps,
|
|
58
|
+
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
59
|
+
apiRef
|
|
60
|
+
}), ref);
|
|
61
61
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
62
|
-
return /*#__PURE__*/_jsx(
|
|
63
|
-
|
|
62
|
+
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
|
|
63
|
+
apiRef: apiRef,
|
|
64
|
+
initialZoom: initialZoom,
|
|
64
65
|
onZoomChange: onZoomChange,
|
|
65
66
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
66
|
-
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/
|
|
67
|
-
children: /*#__PURE__*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
})), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
|
|
74
|
-
}))
|
|
67
|
+
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
68
|
+
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
69
|
+
"data-drawing-container": true,
|
|
70
|
+
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
71
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props?.slotProps?.tooltip, {
|
|
72
|
+
trigger: "item"
|
|
73
|
+
})), children]
|
|
75
74
|
}))]
|
|
76
75
|
}))
|
|
77
76
|
}));
|
|
@@ -81,6 +80,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
81
80
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
82
81
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
83
82
|
// ----------------------------------------------------------------------
|
|
83
|
+
apiRef: PropTypes.shape({
|
|
84
|
+
current: PropTypes.shape({
|
|
85
|
+
setZoomData: PropTypes.func.isRequired
|
|
86
|
+
})
|
|
87
|
+
}),
|
|
84
88
|
/**
|
|
85
89
|
* The configuration of axes highlight.
|
|
86
90
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -141,6 +145,19 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
141
145
|
dataIndex: PropTypes.number,
|
|
142
146
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
143
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
|
+
})),
|
|
144
161
|
/**
|
|
145
162
|
* Indicate which axis to display the left of the charts.
|
|
146
163
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -156,7 +173,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
156
173
|
* The margin between the SVG and the drawing area.
|
|
157
174
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
158
175
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
159
|
-
* @default object Depends on the charts type.
|
|
160
176
|
*/
|
|
161
177
|
margin: PropTypes.shape({
|
|
162
178
|
bottom: PropTypes.number,
|
|
@@ -209,6 +225,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
209
225
|
*/
|
|
210
226
|
slots: PropTypes.object,
|
|
211
227
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
228
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
212
229
|
title: PropTypes.string,
|
|
213
230
|
/**
|
|
214
231
|
* Indicate which axis to display the top of the charts.
|
|
@@ -371,14 +388,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
371
388
|
id: PropTypes.string,
|
|
372
389
|
max: PropTypes.number,
|
|
373
390
|
min: PropTypes.number
|
|
374
|
-
})),
|
|
375
|
-
/**
|
|
376
|
-
* The list of zoom data related to each axis.
|
|
377
|
-
*/
|
|
378
|
-
zoom: PropTypes.arrayOf(PropTypes.shape({
|
|
379
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
380
|
-
end: PropTypes.number.isRequired,
|
|
381
|
-
start: PropTypes.number.isRequired
|
|
382
391
|
}))
|
|
383
392
|
} : void 0;
|
|
384
393
|
export { ScatterChartPro };
|
package/hooks/index.d.ts
CHANGED
package/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';
|
|
@@ -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/index.d.ts
CHANGED
package/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.8
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -38,7 +38,4 @@ export * from "./Heatmap/index.js";
|
|
|
38
38
|
export * from "./ChartContainerPro/index.js";
|
|
39
39
|
export * from "./ScatterChartPro/index.js";
|
|
40
40
|
export * from "./BarChartPro/index.js";
|
|
41
|
-
export * from "./LineChartPro/index.js";
|
|
42
|
-
|
|
43
|
-
// Pro context
|
|
44
|
-
export * from "./context/index.js";
|
|
41
|
+
export * from "./LineChartPro/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChartSeriesType, ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartZAxisSignature } from '@mui/x-charts/internals';
|
|
2
|
+
import { UseChartProZoomSignature } from './useChartProZoom';
|
|
3
|
+
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [
|
|
4
|
+
UseChartZAxisSignature,
|
|
5
|
+
UseChartCartesianAxisSignature<TSeries>,
|
|
6
|
+
UseChartInteractionSignature,
|
|
7
|
+
UseChartProZoomSignature
|
|
8
|
+
];
|
|
9
|
+
export type AllPluginsType<TSeries extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<TSeries>>;
|
|
10
|
+
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<keyof import("@mui/x-charts/internals").ChartsSeriesConfig>>)[];
|
|
@@ -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 } from '@mui/x-charts/internals';
|
|
4
|
+
import { useChartProZoom } from "./useChartProZoom/index.js";
|
|
5
|
+
export const ALL_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartProZoom];
|
|
@@ -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
|
+
};
|