@mui/x-charts-pro 8.0.0-alpha.8 → 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.js +5 -6
- package/CHANGELOG.md +436 -3
- package/ChartContainerPro/ChartContainerPro.d.ts +8 -7
- package/ChartContainerPro/ChartContainerPro.js +8 -18
- package/ChartContainerPro/useChartContainerProProps.d.ts +2 -1
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
- package/ChartDataProviderPro/index.d.ts +1 -0
- package/ChartDataProviderPro/index.js +1 -0
- package/ChartDataProviderPro/package.json +6 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
- package/Heatmap/plugin.js +1 -0
- package/LineChartPro/LineChartPro.js +6 -17
- package/ScatterChartPro/ScatterChartPro.js +4 -5
- package/index.d.ts +3 -0
- package/index.js +4 -1
- package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +3 -0
- package/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +2 -23
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +263 -35
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +0 -4
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/BarChartPro/BarChartPro.js +5 -6
- package/modern/ChartContainerPro/ChartContainerPro.js +8 -18
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
- package/modern/ChartDataProviderPro/index.js +1 -0
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
- package/modern/Heatmap/plugin.js +1 -0
- package/modern/LineChartPro/LineChartPro.js +6 -17
- package/modern/ScatterChartPro/ScatterChartPro.js +4 -5
- package/modern/index.js +4 -1
- package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +2 -23
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -2
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/BarChartPro/BarChartPro.js +5 -6
- package/node/ChartContainerPro/ChartContainerPro.js +7 -17
- package/node/ChartDataProviderPro/ChartDataProviderPro.js +298 -0
- package/node/ChartDataProviderPro/index.js +16 -0
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +23 -0
- package/node/Heatmap/plugin.js +1 -0
- package/node/LineChartPro/LineChartPro.js +6 -17
- package/node/ScatterChartPro/ScatterChartPro.js +4 -5
- package/node/index.js +34 -1
- package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +19 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.js +2 -23
- package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { Watermark } from '@mui/x-license/Watermark';
|
|
7
|
+
import { ChartProvider, AnimationProvider } from '@mui/x-charts/internals';
|
|
8
|
+
import { HighlightedProvider } from '@mui/x-charts/context';
|
|
9
|
+
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
|
|
10
|
+
import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
|
|
11
|
+
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const releaseInfo = getReleaseInfo();
|
|
14
|
+
const packageIdentifier = 'x-charts-pro';
|
|
15
|
+
/**
|
|
16
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
17
|
+
*
|
|
18
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
19
|
+
*
|
|
20
|
+
* Demos:
|
|
21
|
+
*
|
|
22
|
+
* - [Composition](https://mui.com/x/api/charts/composition/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [ChartDataProviderPro API](https://mui.com/x/api/charts/chart-data-provider/)
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```jsx
|
|
30
|
+
* <ChartDataProviderPro
|
|
31
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
32
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
33
|
+
* >
|
|
34
|
+
* <ChartsSurface>
|
|
35
|
+
* <BarPlot />
|
|
36
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
37
|
+
* </ChartsSurface>
|
|
38
|
+
* {'Custom Legend Component'}
|
|
39
|
+
* </ChartDataProviderPro>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function ChartDataProviderPro(props) {
|
|
43
|
+
const {
|
|
44
|
+
children,
|
|
45
|
+
highlightedProviderProps,
|
|
46
|
+
animationProviderProps,
|
|
47
|
+
chartProviderProps
|
|
48
|
+
} = useChartDataProviderProProps(props);
|
|
49
|
+
useLicenseVerifier(packageIdentifier, releaseInfo);
|
|
50
|
+
return /*#__PURE__*/_jsx(ChartProvider, _extends({}, chartProviderProps, {
|
|
51
|
+
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
52
|
+
children: /*#__PURE__*/_jsxs(AnimationProvider, _extends({}, animationProviderProps, {
|
|
53
|
+
children: [children, /*#__PURE__*/_jsx(Watermark, {
|
|
54
|
+
packageName: packageIdentifier,
|
|
55
|
+
releaseInfo: releaseInfo
|
|
56
|
+
})]
|
|
57
|
+
}))
|
|
58
|
+
}))
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
62
|
+
// ----------------------------- Warning --------------------------------
|
|
63
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
65
|
+
// ----------------------------------------------------------------------
|
|
66
|
+
apiRef: PropTypes.shape({
|
|
67
|
+
current: PropTypes.shape({
|
|
68
|
+
setZoomData: PropTypes.func.isRequired
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
children: PropTypes.node,
|
|
72
|
+
/**
|
|
73
|
+
* Color palette used to colorize multiple series.
|
|
74
|
+
* @default blueberryTwilightPalette
|
|
75
|
+
*/
|
|
76
|
+
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
77
|
+
/**
|
|
78
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
79
|
+
*/
|
|
80
|
+
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
81
|
+
/**
|
|
82
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
83
|
+
*/
|
|
84
|
+
height: PropTypes.number,
|
|
85
|
+
/**
|
|
86
|
+
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
87
|
+
*/
|
|
88
|
+
highlightedItem: PropTypes.shape({
|
|
89
|
+
dataIndex: PropTypes.number,
|
|
90
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
91
|
+
}),
|
|
92
|
+
/**
|
|
93
|
+
* This prop is used to help implement the accessibility logic.
|
|
94
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
95
|
+
*/
|
|
96
|
+
id: PropTypes.string,
|
|
97
|
+
/**
|
|
98
|
+
* The list of zoom data related to each axis.
|
|
99
|
+
*/
|
|
100
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
101
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
102
|
+
end: PropTypes.number.isRequired,
|
|
103
|
+
start: PropTypes.number.isRequired
|
|
104
|
+
})),
|
|
105
|
+
/**
|
|
106
|
+
* The margin between the SVG and the drawing area.
|
|
107
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
108
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
109
|
+
*/
|
|
110
|
+
margin: PropTypes.shape({
|
|
111
|
+
bottom: PropTypes.number,
|
|
112
|
+
left: PropTypes.number,
|
|
113
|
+
right: PropTypes.number,
|
|
114
|
+
top: PropTypes.number
|
|
115
|
+
}),
|
|
116
|
+
/**
|
|
117
|
+
* The callback fired when the highlighted item changes.
|
|
118
|
+
*
|
|
119
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
120
|
+
*/
|
|
121
|
+
onHighlightChange: PropTypes.func,
|
|
122
|
+
/**
|
|
123
|
+
* Callback fired when the zoom has changed.
|
|
124
|
+
*
|
|
125
|
+
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
126
|
+
*/
|
|
127
|
+
onZoomChange: PropTypes.func,
|
|
128
|
+
/**
|
|
129
|
+
* The array of series to display.
|
|
130
|
+
* Each type of series has its own specificity.
|
|
131
|
+
* Please refer to the appropriate docs page to learn more about it.
|
|
132
|
+
*/
|
|
133
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
134
|
+
/**
|
|
135
|
+
* If `true`, animations are skipped.
|
|
136
|
+
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
137
|
+
*/
|
|
138
|
+
skipAnimation: PropTypes.bool,
|
|
139
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
140
|
+
/**
|
|
141
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
142
|
+
*/
|
|
143
|
+
width: PropTypes.number,
|
|
144
|
+
/**
|
|
145
|
+
* The configuration of the x-axes.
|
|
146
|
+
* If not provided, a default axis config is used.
|
|
147
|
+
* An array of [[AxisConfig]] objects.
|
|
148
|
+
*/
|
|
149
|
+
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
150
|
+
classes: PropTypes.object,
|
|
151
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
152
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
153
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
154
|
+
unknownColor: PropTypes.string,
|
|
155
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
156
|
+
}), PropTypes.shape({
|
|
157
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
158
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
159
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
160
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
161
|
+
}), PropTypes.shape({
|
|
162
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
163
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
164
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
165
|
+
})]),
|
|
166
|
+
data: PropTypes.array,
|
|
167
|
+
dataKey: PropTypes.string,
|
|
168
|
+
disableLine: PropTypes.bool,
|
|
169
|
+
disableTicks: PropTypes.bool,
|
|
170
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
171
|
+
fill: PropTypes.string,
|
|
172
|
+
hideTooltip: PropTypes.bool,
|
|
173
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
174
|
+
label: PropTypes.string,
|
|
175
|
+
labelStyle: PropTypes.object,
|
|
176
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
177
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
178
|
+
position: PropTypes.oneOf(['bottom', 'top']),
|
|
179
|
+
reverse: PropTypes.bool,
|
|
180
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
181
|
+
slotProps: PropTypes.object,
|
|
182
|
+
slots: PropTypes.object,
|
|
183
|
+
stroke: PropTypes.string,
|
|
184
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
185
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
186
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
187
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
188
|
+
tickLabelStyle: PropTypes.object,
|
|
189
|
+
tickMaxStep: PropTypes.number,
|
|
190
|
+
tickMinStep: PropTypes.number,
|
|
191
|
+
tickNumber: PropTypes.number,
|
|
192
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
193
|
+
tickSize: PropTypes.number,
|
|
194
|
+
valueFormatter: PropTypes.func,
|
|
195
|
+
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
196
|
+
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
197
|
+
maxEnd: PropTypes.number,
|
|
198
|
+
maxSpan: PropTypes.number,
|
|
199
|
+
minSpan: PropTypes.number,
|
|
200
|
+
minStart: PropTypes.number,
|
|
201
|
+
panning: PropTypes.bool,
|
|
202
|
+
step: PropTypes.number
|
|
203
|
+
}), PropTypes.bool])
|
|
204
|
+
})),
|
|
205
|
+
/**
|
|
206
|
+
* The configuration of the y-axes.
|
|
207
|
+
* If not provided, a default axis config is used.
|
|
208
|
+
* An array of [[AxisConfig]] objects.
|
|
209
|
+
*/
|
|
210
|
+
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
211
|
+
classes: PropTypes.object,
|
|
212
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
213
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
214
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
215
|
+
unknownColor: PropTypes.string,
|
|
216
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
217
|
+
}), PropTypes.shape({
|
|
218
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
219
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
220
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
221
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
222
|
+
}), PropTypes.shape({
|
|
223
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
224
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
225
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
226
|
+
})]),
|
|
227
|
+
data: PropTypes.array,
|
|
228
|
+
dataKey: PropTypes.string,
|
|
229
|
+
disableLine: PropTypes.bool,
|
|
230
|
+
disableTicks: PropTypes.bool,
|
|
231
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
232
|
+
fill: PropTypes.string,
|
|
233
|
+
hideTooltip: PropTypes.bool,
|
|
234
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
235
|
+
label: PropTypes.string,
|
|
236
|
+
labelStyle: PropTypes.object,
|
|
237
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
238
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
239
|
+
position: PropTypes.oneOf(['left', 'right']),
|
|
240
|
+
reverse: PropTypes.bool,
|
|
241
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
242
|
+
slotProps: PropTypes.object,
|
|
243
|
+
slots: PropTypes.object,
|
|
244
|
+
stroke: PropTypes.string,
|
|
245
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
246
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
247
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
248
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
249
|
+
tickLabelStyle: PropTypes.object,
|
|
250
|
+
tickMaxStep: PropTypes.number,
|
|
251
|
+
tickMinStep: PropTypes.number,
|
|
252
|
+
tickNumber: PropTypes.number,
|
|
253
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
254
|
+
tickSize: PropTypes.number,
|
|
255
|
+
valueFormatter: PropTypes.func,
|
|
256
|
+
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
257
|
+
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
258
|
+
maxEnd: PropTypes.number,
|
|
259
|
+
maxSpan: PropTypes.number,
|
|
260
|
+
minSpan: PropTypes.number,
|
|
261
|
+
minStart: PropTypes.number,
|
|
262
|
+
panning: PropTypes.bool,
|
|
263
|
+
step: PropTypes.number
|
|
264
|
+
}), PropTypes.bool])
|
|
265
|
+
})),
|
|
266
|
+
/**
|
|
267
|
+
* The configuration of the z-axes.
|
|
268
|
+
*/
|
|
269
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
270
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
271
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
272
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
273
|
+
unknownColor: PropTypes.string,
|
|
274
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
275
|
+
}), PropTypes.shape({
|
|
276
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
277
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
278
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
279
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
280
|
+
}), PropTypes.shape({
|
|
281
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
282
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
283
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
284
|
+
})]),
|
|
285
|
+
data: PropTypes.array,
|
|
286
|
+
dataKey: PropTypes.string,
|
|
287
|
+
id: PropTypes.string,
|
|
288
|
+
max: PropTypes.number,
|
|
289
|
+
min: PropTypes.number
|
|
290
|
+
}))
|
|
291
|
+
} : void 0;
|
|
292
|
+
export { ChartDataProviderPro };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartDataProviderPro.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useChartDataProviderProps } from '@mui/x-charts/internals';
|
|
4
|
+
export const useChartDataProviderProProps = props => {
|
|
5
|
+
const {
|
|
6
|
+
animationProviderProps,
|
|
7
|
+
chartProviderProps,
|
|
8
|
+
highlightedProviderProps,
|
|
9
|
+
children
|
|
10
|
+
} = useChartDataProviderProps(props);
|
|
11
|
+
return {
|
|
12
|
+
children,
|
|
13
|
+
highlightedProviderProps,
|
|
14
|
+
animationProviderProps,
|
|
15
|
+
chartProviderProps
|
|
16
|
+
};
|
|
17
|
+
};
|
package/modern/Heatmap/plugin.js
CHANGED
|
@@ -17,14 +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 { ChartDataProvider } from '@mui/x-charts/context';
|
|
21
20
|
import { useIsZoomInteracting } from "../hooks/zoom/index.js";
|
|
22
21
|
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
22
|
+
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
function AreaPlotZoom(props) {
|
|
25
25
|
const isInteracting = useIsZoomInteracting();
|
|
26
26
|
return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
|
|
27
|
-
skipAnimation: isInteracting ||
|
|
27
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
28
28
|
}));
|
|
29
29
|
}
|
|
30
30
|
process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
|
|
@@ -57,7 +57,7 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
|
|
|
57
57
|
function LinePlotZoom(props) {
|
|
58
58
|
const isInteracting = useIsZoomInteracting();
|
|
59
59
|
return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
|
|
60
|
-
skipAnimation: isInteracting ||
|
|
60
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
|
|
@@ -98,12 +98,6 @@ process.env.NODE_ENV !== "production" ? MarkPlotZoom.propTypes = {
|
|
|
98
98
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
99
99
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
100
100
|
// ----------------------------------------------------------------------
|
|
101
|
-
/**
|
|
102
|
-
* If `true` the mark element will only be able to render circle.
|
|
103
|
-
* Giving fewer customization options, but saving around 40ms per 1.000 marks.
|
|
104
|
-
* @default false
|
|
105
|
-
*/
|
|
106
|
-
experimentalRendering: PropTypes.bool,
|
|
107
101
|
/**
|
|
108
102
|
* Callback fired when a line mark item is clicked.
|
|
109
103
|
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
@@ -168,13 +162,12 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
168
162
|
chartDataProviderProProps,
|
|
169
163
|
chartsSurfaceProps
|
|
170
164
|
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
165
|
+
initialZoom,
|
|
166
|
+
onZoomChange,
|
|
171
167
|
apiRef
|
|
172
168
|
}), ref);
|
|
173
169
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
174
|
-
return /*#__PURE__*/_jsx(
|
|
175
|
-
apiRef: apiRef,
|
|
176
|
-
initialZoom: initialZoom,
|
|
177
|
-
onZoomChange: onZoomChange,
|
|
170
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
178
171
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
179
172
|
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
180
173
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
@@ -234,10 +227,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
234
227
|
* If `true`, render the line highlight item.
|
|
235
228
|
*/
|
|
236
229
|
disableLineItemHighlight: PropTypes.bool,
|
|
237
|
-
/**
|
|
238
|
-
* If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
|
|
239
|
-
*/
|
|
240
|
-
experimentalMarkRendering: PropTypes.bool,
|
|
241
230
|
/**
|
|
242
231
|
* Option to display a cartesian grid in the background.
|
|
243
232
|
*/
|
|
@@ -8,7 +8,6 @@ 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 { ChartDataProvider } 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';
|
|
@@ -18,6 +17,7 @@ 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
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:
|
|
@@ -56,13 +56,12 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
56
56
|
chartDataProviderProProps,
|
|
57
57
|
chartsSurfaceProps
|
|
58
58
|
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
59
|
+
initialZoom,
|
|
60
|
+
onZoomChange,
|
|
59
61
|
apiRef
|
|
60
62
|
}), ref);
|
|
61
63
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
62
|
-
return /*#__PURE__*/_jsx(
|
|
63
|
-
apiRef: apiRef,
|
|
64
|
-
initialZoom: initialZoom,
|
|
65
|
-
onZoomChange: onZoomChange,
|
|
64
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
66
65
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
67
66
|
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
68
67
|
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
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.9
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -32,10 +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
44
|
export * from "./LineChartPro/index.js";
|
|
@@ -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
|
+
}, {});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useSelector, getSVGPoint, selectorChartDrawingArea } from '@mui/x-charts/internals';
|
|
6
|
-
import {
|
|
6
|
+
import { creatZoomLookup } from "./creatZoomLookup.js";
|
|
7
7
|
import { getDiff, getHorizontalCenterRatio, getPinchScaleRatio, getVerticalCenterRatio, getWheelScaleRatio, isSpanValid, preventDefault, zoomAtPoint } from "./useChartProZoom.utils.js";
|
|
8
8
|
import { selectorChartZoomOptionsLookup } from "./useChartProZoom.selectors.js";
|
|
9
9
|
|
|
@@ -288,27 +288,7 @@ useChartProZoom.params = {
|
|
|
288
288
|
useChartProZoom.getDefaultizedParams = ({
|
|
289
289
|
params
|
|
290
290
|
}) => {
|
|
291
|
-
const optionsLookup = _extends({}, params.defaultizedXAxis
|
|
292
|
-
const {
|
|
293
|
-
zoom,
|
|
294
|
-
id: axisId
|
|
295
|
-
} = v;
|
|
296
|
-
const defaultizedZoom = defaultizeZoom(zoom, axisId, 'x');
|
|
297
|
-
if (defaultizedZoom) {
|
|
298
|
-
acc[axisId] = defaultizedZoom;
|
|
299
|
-
}
|
|
300
|
-
return acc;
|
|
301
|
-
}, {}), params.defaultizedYAxis.reduce((acc, v) => {
|
|
302
|
-
const {
|
|
303
|
-
zoom,
|
|
304
|
-
id: axisId
|
|
305
|
-
} = v;
|
|
306
|
-
const defaultizedZoom = defaultizeZoom(zoom, axisId, 'y');
|
|
307
|
-
if (defaultizedZoom) {
|
|
308
|
-
acc[axisId] = defaultizedZoom;
|
|
309
|
-
}
|
|
310
|
-
return acc;
|
|
311
|
-
}, {}));
|
|
291
|
+
const optionsLookup = _extends({}, creatZoomLookup(params.defaultizedXAxis), creatZoomLookup(params.defaultizedYAxis));
|
|
312
292
|
return _extends({}, params, {
|
|
313
293
|
optionsLookup
|
|
314
294
|
});
|
|
@@ -316,7 +296,6 @@ useChartProZoom.getDefaultizedParams = ({
|
|
|
316
296
|
useChartProZoom.getInitialState = params => {
|
|
317
297
|
return {
|
|
318
298
|
zoom: {
|
|
319
|
-
optionsLookup: params.optionsLookup,
|
|
320
299
|
zoomData: params.initialZoom === undefined ? initializeZoomData(params.optionsLookup) : params.initialZoom,
|
|
321
300
|
isInteracting: false
|
|
322
301
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createSelector, selectorChartRawXAxis, selectorChartRawYAxis } from '@mui/x-charts/internals';
|
|
3
|
+
import { creatZoomLookup } from "./creatZoomLookup.js";
|
|
2
4
|
export const selectorChartZoomState = state => state.zoom;
|
|
3
|
-
|
|
5
|
+
const selectorChartXZoomOptionsLookup = createSelector(selectorChartRawXAxis, creatZoomLookup);
|
|
6
|
+
const selectorChartYZoomOptionsLookup = createSelector(selectorChartRawYAxis, creatZoomLookup);
|
|
7
|
+
export const selectorChartZoomOptionsLookup = createSelector([selectorChartXZoomOptionsLookup, selectorChartYZoomOptionsLookup], (xLookup, yLookup) => _extends({}, xLookup, yLookup));
|
|
4
8
|
export const selectorChartZoomData = createSelector(selectorChartZoomState, zoom => zoom.zoomData);
|
|
5
9
|
export const selectorChartZoomIsInteracting = createSelector(selectorChartZoomState, zoom => zoom.isInteracting);
|
|
6
10
|
export const selectorChartZoomIsEnabled = createSelector(selectorChartZoomOptionsLookup, optionsLookup => Object.keys(optionsLookup).length > 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczNzY1ODgwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -22,16 +22,16 @@ var _ChartsAxisHighlight = require("@mui/x-charts/ChartsAxisHighlight");
|
|
|
22
22
|
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
23
23
|
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
24
24
|
var _internals = require("@mui/x-charts/internals");
|
|
25
|
-
var _context = require("@mui/x-charts/context");
|
|
26
25
|
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
27
26
|
var _zoom = require("../hooks/zoom");
|
|
28
27
|
var _useChartContainerProProps = require("../ChartContainerPro/useChartContainerProProps");
|
|
28
|
+
var _ChartDataProviderPro = require("../ChartDataProviderPro");
|
|
29
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
30
30
|
const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
|
|
31
31
|
function BarChartPlotZoom(props) {
|
|
32
32
|
const isInteracting = (0, _zoom.useIsZoomInteracting)();
|
|
33
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, (0, _extends2.default)({}, props, {
|
|
34
|
-
skipAnimation: isInteracting ||
|
|
34
|
+
skipAnimation: isInteracting || props.skipAnimation
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
37
|
process.env.NODE_ENV !== "production" ? BarChartPlotZoom.propTypes = {
|
|
@@ -113,13 +113,12 @@ const BarChartPro = exports.BarChartPro = /*#__PURE__*/React.forwardRef(function
|
|
|
113
113
|
chartDataProviderProProps,
|
|
114
114
|
chartsSurfaceProps
|
|
115
115
|
} = (0, _useChartContainerProProps.useChartContainerProProps)((0, _extends2.default)({}, chartContainerProps, {
|
|
116
|
+
initialZoom,
|
|
117
|
+
onZoomChange,
|
|
116
118
|
apiRef
|
|
117
119
|
}), ref);
|
|
118
120
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
119
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
120
|
-
apiRef: apiRef,
|
|
121
|
-
initialZoom: initialZoom,
|
|
122
|
-
onZoomChange: onZoomChange,
|
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
123
122
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
124
123
|
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
125
124
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
@@ -10,23 +10,18 @@ exports.ChartContainerPro = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var _Watermark = require("@mui/x-license/Watermark");
|
|
14
|
-
var _useLicenseVerifier = require("@mui/x-license/useLicenseVerifier");
|
|
15
13
|
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
16
|
-
var _context = require("@mui/x-charts/context");
|
|
17
|
-
var _releaseInfo = require("../internals/utils/releaseInfo");
|
|
18
14
|
var _useChartContainerProProps = require("./useChartContainerProProps");
|
|
15
|
+
var _ChartDataProviderPro = require("../ChartDataProviderPro");
|
|
19
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
|
|
21
|
-
|
|
22
17
|
/**
|
|
23
18
|
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
24
19
|
*
|
|
25
|
-
* This is a combination of both the `
|
|
20
|
+
* This is a combination of both the `ChartDataProviderPro` and `ChartsSurface` components.
|
|
26
21
|
*
|
|
27
22
|
* Demos:
|
|
28
23
|
*
|
|
29
|
-
* - [Composition](
|
|
24
|
+
* - [Composition](https://mui.com/x/api/charts/composition/)
|
|
30
25
|
*
|
|
31
26
|
* API:
|
|
32
27
|
*
|
|
@@ -49,19 +44,14 @@ const ChartContainerPro = exports.ChartContainerPro = /*#__PURE__*/React.forward
|
|
|
49
44
|
children,
|
|
50
45
|
chartsSurfaceProps
|
|
51
46
|
} = (0, _useChartContainerProProps.useChartContainerProProps)(props, ref);
|
|
52
|
-
(0,
|
|
53
|
-
|
|
54
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
48
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
55
49
|
children: children
|
|
56
|
-
}))
|
|
57
|
-
packageName: "x-charts-pro",
|
|
58
|
-
releaseInfo: releaseInfo
|
|
59
|
-
})]
|
|
50
|
+
}))
|
|
60
51
|
}));
|
|
61
52
|
});
|
|
62
53
|
|
|
63
|
-
// @ts-
|
|
64
|
-
|
|
54
|
+
// @ts-expect-error the type coercion breaks the prop types
|
|
65
55
|
process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
66
56
|
// ----------------------------- Warning --------------------------------
|
|
67
57
|
// | These PropTypes are generated from the TypeScript type definitions |
|