@mui/x-charts-pro 8.0.0-alpha.7 → 8.0.0-alpha.9
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 -20
- package/CHANGELOG.md +551 -3
- package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
- package/ChartContainerPro/ChartContainerPro.js +52 -27
- package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
- package/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
- package/{context → ChartDataProviderPro}/package.json +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
- 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 +2 -2
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +58 -37
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +36 -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 +3 -1
- package/index.js +5 -5
- package/internals/plugins/allPlugins.d.ts +10 -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 +1 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/BarChartPro/BarChartPro.js +55 -20
- package/modern/ChartContainerPro/ChartContainerPro.js +52 -27
- package/modern/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
- 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 +2 -2
- package/modern/LineChartPro/LineChartPro.js +58 -37
- package/modern/ScatterChartPro/ScatterChartPro.js +36 -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 +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 +1 -1
- package/modern/models/index.js +2 -1
- package/node/BarChartPro/BarChartPro.js +55 -20
- package/node/ChartContainerPro/ChartContainerPro.js +51 -26
- package/node/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/node/ChartDataProviderPro/ChartDataProviderPro.js +298 -0
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +23 -0
- 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 +2 -2
- package/node/LineChartPro/LineChartPro.js +58 -37
- package/node/ScatterChartPro/ScatterChartPro.js +36 -28
- 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 +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/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/ChartDataProviderPro.js +0 -50
- 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/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
package/Heatmap/formatter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const formatter:
|
|
1
|
+
import { SeriesProcessor } from '@mui/x-charts/internals';
|
|
2
|
+
declare const formatter: SeriesProcessor<'heatmap'>;
|
|
3
3
|
export default formatter;
|
package/Heatmap/formatter.js
CHANGED
package/Heatmap/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const plugin:
|
|
1
|
+
import { ChartSeriesTypeConfig } from '@mui/x-charts/internals';
|
|
2
|
+
export declare const plugin: ChartSeriesTypeConfig<'heatmap'>;
|
package/Heatmap/plugin.js
CHANGED
|
@@ -2,9 +2,9 @@ import { getBaseExtremum } from "./extremums.js";
|
|
|
2
2
|
import formatter from "./formatter.js";
|
|
3
3
|
import getColor from "./getColor.js";
|
|
4
4
|
export const plugin = {
|
|
5
|
-
|
|
6
|
-
seriesFormatter: formatter,
|
|
5
|
+
seriesProcessor: formatter,
|
|
7
6
|
colorProcessor: getColor,
|
|
7
|
+
legendGetter: () => [],
|
|
8
8
|
xExtremumGetter: getBaseExtremum,
|
|
9
9
|
yExtremumGetter: getBaseExtremum
|
|
10
10
|
};
|
|
@@ -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,17 +17,14 @@ 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 { useZoom } from "../context/ZoomProvider/useZoom.js";
|
|
22
|
-
import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
|
|
20
|
+
import { useIsZoomInteracting } from "../hooks/zoom/index.js";
|
|
23
21
|
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
22
|
+
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.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
|
-
skipAnimation: isInteracting ||
|
|
27
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
31
28
|
}));
|
|
32
29
|
}
|
|
33
30
|
process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
|
|
@@ -58,11 +55,9 @@ 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
|
-
skipAnimation: isInteracting ||
|
|
60
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
66
61
|
}));
|
|
67
62
|
}
|
|
68
63
|
process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
|
|
@@ -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
|
}));
|
|
@@ -105,12 +98,6 @@ process.env.NODE_ENV !== "production" ? MarkPlotZoom.propTypes = {
|
|
|
105
98
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
106
99
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
107
100
|
// ----------------------------------------------------------------------
|
|
108
|
-
/**
|
|
109
|
-
* If `true` the mark element will only be able to render circle.
|
|
110
|
-
* Giving fewer customization options, but saving around 40ms per 1.000 marks.
|
|
111
|
-
* @default false
|
|
112
|
-
*/
|
|
113
|
-
experimentalRendering: PropTypes.bool,
|
|
114
101
|
/**
|
|
115
102
|
* Callback fired when a line mark item is clicked.
|
|
116
103
|
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
@@ -149,8 +136,9 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
149
136
|
name: 'MuiLineChartPro'
|
|
150
137
|
});
|
|
151
138
|
const {
|
|
152
|
-
|
|
153
|
-
onZoomChange
|
|
139
|
+
initialZoom,
|
|
140
|
+
onZoomChange,
|
|
141
|
+
apiRef
|
|
154
142
|
} = props,
|
|
155
143
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
156
144
|
const {
|
|
@@ -173,11 +161,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
173
161
|
const {
|
|
174
162
|
chartDataProviderProProps,
|
|
175
163
|
chartsSurfaceProps
|
|
176
|
-
} = useChartContainerProProps(chartContainerProps,
|
|
164
|
+
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
165
|
+
initialZoom,
|
|
166
|
+
onZoomChange,
|
|
167
|
+
apiRef
|
|
168
|
+
}), ref);
|
|
177
169
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
178
170
|
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
179
|
-
zoom: zoom,
|
|
180
|
-
onZoomChange: onZoomChange,
|
|
181
171
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
182
172
|
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
183
173
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
@@ -185,7 +175,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
185
175
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
186
176
|
"data-drawing-container": true,
|
|
187
177
|
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)),
|
|
178
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
189
179
|
}))]
|
|
190
180
|
}))
|
|
191
181
|
}));
|
|
@@ -195,6 +185,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
195
185
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
196
186
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
197
187
|
// ----------------------------------------------------------------------
|
|
188
|
+
apiRef: PropTypes.shape({
|
|
189
|
+
current: PropTypes.shape({
|
|
190
|
+
setZoomData: PropTypes.func.isRequired
|
|
191
|
+
})
|
|
192
|
+
}),
|
|
198
193
|
/**
|
|
199
194
|
* The configuration of axes highlight.
|
|
200
195
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -232,10 +227,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
232
227
|
* If `true`, render the line highlight item.
|
|
233
228
|
*/
|
|
234
229
|
disableLineItemHighlight: PropTypes.bool,
|
|
235
|
-
/**
|
|
236
|
-
* If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
|
|
237
|
-
*/
|
|
238
|
-
experimentalMarkRendering: PropTypes.bool,
|
|
239
230
|
/**
|
|
240
231
|
* Option to display a cartesian grid in the background.
|
|
241
232
|
*/
|
|
@@ -258,6 +249,19 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
258
249
|
dataIndex: PropTypes.number,
|
|
259
250
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
260
251
|
}),
|
|
252
|
+
/**
|
|
253
|
+
* This prop is used to help implement the accessibility logic.
|
|
254
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
255
|
+
*/
|
|
256
|
+
id: PropTypes.string,
|
|
257
|
+
/**
|
|
258
|
+
* The list of zoom data related to each axis.
|
|
259
|
+
*/
|
|
260
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
261
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
262
|
+
end: PropTypes.number.isRequired,
|
|
263
|
+
start: PropTypes.number.isRequired
|
|
264
|
+
})),
|
|
261
265
|
/**
|
|
262
266
|
* Indicate which axis to display the left of the charts.
|
|
263
267
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -273,7 +277,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
273
277
|
* The margin between the SVG and the drawing area.
|
|
274
278
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
275
279
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
276
|
-
* @default object Depends on the charts type.
|
|
277
280
|
*/
|
|
278
281
|
margin: PropTypes.shape({
|
|
279
282
|
bottom: PropTypes.number,
|
|
@@ -339,6 +342,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
339
342
|
*/
|
|
340
343
|
slots: PropTypes.object,
|
|
341
344
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
345
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
342
346
|
title: PropTypes.string,
|
|
343
347
|
/**
|
|
344
348
|
* Indicate which axis to display the top of the charts.
|
|
@@ -473,12 +477,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
473
477
|
}), PropTypes.bool])
|
|
474
478
|
})),
|
|
475
479
|
/**
|
|
476
|
-
* The
|
|
480
|
+
* The configuration of the z-axes.
|
|
477
481
|
*/
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
483
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
484
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
485
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
486
|
+
unknownColor: PropTypes.string,
|
|
487
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
488
|
+
}), PropTypes.shape({
|
|
489
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
490
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
491
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
492
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
493
|
+
}), PropTypes.shape({
|
|
494
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
495
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
496
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
497
|
+
})]),
|
|
498
|
+
data: PropTypes.array,
|
|
499
|
+
dataKey: PropTypes.string,
|
|
500
|
+
id: PropTypes.string,
|
|
501
|
+
max: PropTypes.number,
|
|
502
|
+
min: PropTypes.number
|
|
482
503
|
}))
|
|
483
504
|
} : void 0;
|
|
484
505
|
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,12 @@
|
|
|
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';
|
|
@@ -17,9 +16,8 @@ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
|
17
16
|
import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
|
|
18
17
|
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
19
18
|
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
19
|
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
20
|
+
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
|
|
23
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
22
|
/**
|
|
25
23
|
* Demos:
|
|
@@ -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,21 @@ 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
|
+
initialZoom,
|
|
60
|
+
onZoomChange,
|
|
61
|
+
apiRef
|
|
62
|
+
}), ref);
|
|
61
63
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
62
64
|
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
63
|
-
zoom: zoom,
|
|
64
|
-
onZoomChange: onZoomChange,
|
|
65
65
|
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
|
-
}))
|
|
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]
|
|
75
73
|
}))]
|
|
76
74
|
}))
|
|
77
75
|
}));
|
|
@@ -81,6 +79,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
81
79
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
82
80
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
83
81
|
// ----------------------------------------------------------------------
|
|
82
|
+
apiRef: PropTypes.shape({
|
|
83
|
+
current: PropTypes.shape({
|
|
84
|
+
setZoomData: PropTypes.func.isRequired
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
84
87
|
/**
|
|
85
88
|
* The configuration of axes highlight.
|
|
86
89
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -141,6 +144,19 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
141
144
|
dataIndex: PropTypes.number,
|
|
142
145
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
143
146
|
}),
|
|
147
|
+
/**
|
|
148
|
+
* This prop is used to help implement the accessibility logic.
|
|
149
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
150
|
+
*/
|
|
151
|
+
id: PropTypes.string,
|
|
152
|
+
/**
|
|
153
|
+
* The list of zoom data related to each axis.
|
|
154
|
+
*/
|
|
155
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
156
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
157
|
+
end: PropTypes.number.isRequired,
|
|
158
|
+
start: PropTypes.number.isRequired
|
|
159
|
+
})),
|
|
144
160
|
/**
|
|
145
161
|
* Indicate which axis to display the left of the charts.
|
|
146
162
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -156,7 +172,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
156
172
|
* The margin between the SVG and the drawing area.
|
|
157
173
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
158
174
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
159
|
-
* @default object Depends on the charts type.
|
|
160
175
|
*/
|
|
161
176
|
margin: PropTypes.shape({
|
|
162
177
|
bottom: PropTypes.number,
|
|
@@ -209,6 +224,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
209
224
|
*/
|
|
210
225
|
slots: PropTypes.object,
|
|
211
226
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
227
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
212
228
|
title: PropTypes.string,
|
|
213
229
|
/**
|
|
214
230
|
* Indicate which axis to display the top of the charts.
|
|
@@ -371,14 +387,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
371
387
|
id: PropTypes.string,
|
|
372
388
|
max: PropTypes.number,
|
|
373
389
|
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
390
|
}))
|
|
383
391
|
} : void 0;
|
|
384
392
|
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
|
@@ -22,9 +22,11 @@ export * from '@mui/x-charts/ScatterChart';
|
|
|
22
22
|
export * from '@mui/x-charts/SparkLineChart';
|
|
23
23
|
export * from '@mui/x-charts/Gauge';
|
|
24
24
|
export * from '@mui/x-charts/ChartsSurface';
|
|
25
|
+
export * from '@mui/x-charts/ChartDataProvider';
|
|
26
|
+
export * from '@mui/x-charts/ChartsLabel';
|
|
25
27
|
export * from './Heatmap';
|
|
26
28
|
export * from './ChartContainerPro';
|
|
29
|
+
export * from './ChartDataProviderPro';
|
|
27
30
|
export * from './ScatterChartPro';
|
|
28
31
|
export * from './BarChartPro';
|
|
29
32
|
export * from './LineChartPro';
|
|
30
|
-
export * from './context';
|
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.9
|
|
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,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,3 @@
|
|
|
1
|
+
import { AxisId, DefaultizedZoomOptions } from '@mui/x-charts/internals';
|
|
2
|
+
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '@mui/x-charts/models';
|
|
3
|
+
export declare const creatZoomLookup: (axes: AxisConfig<ScaleName, any, ChartsXAxisProps | ChartsYAxisProps>[]) => Record<AxisId, DefaultizedZoomOptions>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defaultizeZoom } from "./defaultizeZoom.js";
|
|
2
|
+
export const creatZoomLookup = axes => axes.reduce((acc, v) => {
|
|
3
|
+
const {
|
|
4
|
+
zoom,
|
|
5
|
+
id: axisId
|
|
6
|
+
} = v;
|
|
7
|
+
const defaultizedZoom = defaultizeZoom(zoom, axisId, 'x');
|
|
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
|
+
};
|