@mui/x-charts-pro 8.0.0-alpha.12 → 8.0.0-alpha.13
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 +25 -30
- package/CHANGELOG.md +299 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/ChartContainerPro/ChartContainerPro.js +1 -1
- package/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/Heatmap/Heatmap.d.ts +5 -4
- package/Heatmap/Heatmap.js +37 -52
- package/LineChartPro/LineChartPro.js +25 -30
- package/ScatterChartPro/ScatterChartPro.js +25 -30
- package/esm/BarChartPro/BarChartPro.js +25 -30
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/esm/ChartContainerPro/ChartContainerPro.js +1 -1
- package/esm/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/esm/Heatmap/Heatmap.d.ts +5 -4
- package/esm/Heatmap/Heatmap.js +37 -52
- package/esm/LineChartPro/LineChartPro.js +25 -30
- package/esm/ScatterChartPro/ScatterChartPro.js +25 -30
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/models/seriesType/heatmap.d.ts +2 -2
- package/index.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/internals/utils/releaseInfo.js +1 -1
- package/models/seriesType/heatmap.d.ts +2 -2
- package/modern/BarChartPro/BarChartPro.js +25 -30
- package/modern/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/modern/ChartContainerPro/ChartContainerPro.js +1 -1
- package/modern/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/modern/Heatmap/Heatmap.d.ts +5 -4
- package/modern/Heatmap/Heatmap.js +37 -52
- package/modern/LineChartPro/LineChartPro.js +25 -30
- package/modern/ScatterChartPro/ScatterChartPro.js +25 -30
- package/modern/index.js +1 -1
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/seriesType/heatmap.d.ts +2 -2
- package/package.json +5 -5
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -9,6 +9,7 @@ import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
|
|
|
9
9
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
10
10
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
11
11
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
|
|
12
13
|
import { ChartContainerPro } from "../ChartContainerPro/index.js";
|
|
13
14
|
import { HeatmapPlot } from "./HeatmapPlot.js";
|
|
14
15
|
import { seriesConfig as heatmapSeriesConfig } from "./seriesConfig/index.js";
|
|
@@ -20,6 +21,16 @@ const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#
|
|
|
20
21
|
const seriesConfig = {
|
|
21
22
|
heatmap: heatmapSeriesConfig
|
|
22
23
|
};
|
|
24
|
+
function getDefaultDataForAxis(series, dimension) {
|
|
25
|
+
if (series?.[0]?.data === undefined || series[0].data.length === 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return Array.from({
|
|
29
|
+
length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
|
|
30
|
+
}, (_, index) => index);
|
|
31
|
+
}
|
|
32
|
+
const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
|
|
33
|
+
const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
|
|
23
34
|
const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
24
35
|
const props = useThemeProps({
|
|
25
36
|
props: inProps,
|
|
@@ -36,10 +47,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
36
47
|
colors,
|
|
37
48
|
dataset,
|
|
38
49
|
sx,
|
|
39
|
-
topAxis,
|
|
40
|
-
leftAxis,
|
|
41
|
-
rightAxis,
|
|
42
|
-
bottomAxis,
|
|
43
50
|
onAxisClick,
|
|
44
51
|
children,
|
|
45
52
|
slots,
|
|
@@ -50,14 +57,22 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
50
57
|
} = props;
|
|
51
58
|
const id = useId();
|
|
52
59
|
const clipPathId = `${id}-clip-path`;
|
|
53
|
-
const defaultizedXAxis = React.useMemo(() => xAxis.
|
|
60
|
+
const defaultizedXAxis = React.useMemo(() => (xAxis && xAxis.length > 0 ? xAxis : [{
|
|
61
|
+
id: DEFAULT_X_AXIS_KEY
|
|
62
|
+
}]).map(axis => _extends({
|
|
54
63
|
scaleType: 'band',
|
|
55
64
|
categoryGapRatio: 0
|
|
56
|
-
}, axis
|
|
57
|
-
|
|
65
|
+
}, axis, {
|
|
66
|
+
data: axis.data ?? getDefaultDataForXAxis(series)
|
|
67
|
+
})), [series, xAxis]);
|
|
68
|
+
const defaultizedYAxis = React.useMemo(() => (yAxis && yAxis.length > 0 ? yAxis : [{
|
|
69
|
+
id: DEFAULT_Y_AXIS_KEY
|
|
70
|
+
}]).map(axis => _extends({
|
|
58
71
|
scaleType: 'band',
|
|
59
72
|
categoryGapRatio: 0
|
|
60
|
-
}, axis
|
|
73
|
+
}, axis, {
|
|
74
|
+
data: axis.data ?? getDefaultDataForYAxis(series)
|
|
75
|
+
})), [series, yAxis]);
|
|
61
76
|
const defaultizedZAxis = React.useMemo(() => zAxis ?? [{
|
|
62
77
|
colorMap: {
|
|
63
78
|
type: 'continuous',
|
|
@@ -98,10 +113,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
98
113
|
slotProps: slotProps
|
|
99
114
|
})]
|
|
100
115
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
101
|
-
topAxis: topAxis,
|
|
102
|
-
leftAxis: leftAxis,
|
|
103
|
-
rightAxis: rightAxis,
|
|
104
|
-
bottomAxis: bottomAxis,
|
|
105
116
|
slots: slots,
|
|
106
117
|
slotProps: slotProps
|
|
107
118
|
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
@@ -115,16 +126,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
115
126
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
116
127
|
// ----------------------------------------------------------------------
|
|
117
128
|
apiRef: PropTypes.shape({
|
|
118
|
-
current: PropTypes.
|
|
119
|
-
setZoomData: PropTypes.func.isRequired
|
|
120
|
-
})
|
|
129
|
+
current: PropTypes.object
|
|
121
130
|
}),
|
|
122
|
-
/**
|
|
123
|
-
* Indicate which axis to display the bottom of the charts.
|
|
124
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
125
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
126
|
-
*/
|
|
127
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
128
131
|
children: PropTypes.node,
|
|
129
132
|
className: PropTypes.string,
|
|
130
133
|
/**
|
|
@@ -160,20 +163,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
160
163
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
161
164
|
*/
|
|
162
165
|
id: PropTypes.string,
|
|
163
|
-
/**
|
|
164
|
-
* The list of zoom data related to each axis.
|
|
165
|
-
*/
|
|
166
|
-
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
167
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
168
|
-
end: PropTypes.number.isRequired,
|
|
169
|
-
start: PropTypes.number.isRequired
|
|
170
|
-
})),
|
|
171
|
-
/**
|
|
172
|
-
* Indicate which axis to display the left of the charts.
|
|
173
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
174
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
175
|
-
*/
|
|
176
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
177
166
|
/**
|
|
178
167
|
* If `true`, a loading overlay is displayed.
|
|
179
168
|
* @default false
|
|
@@ -182,14 +171,15 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
182
171
|
/**
|
|
183
172
|
* The margin between the SVG and the drawing area.
|
|
184
173
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
185
|
-
*
|
|
174
|
+
*
|
|
175
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
186
176
|
*/
|
|
187
|
-
margin: PropTypes.shape({
|
|
177
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
188
178
|
bottom: PropTypes.number,
|
|
189
179
|
left: PropTypes.number,
|
|
190
180
|
right: PropTypes.number,
|
|
191
181
|
top: PropTypes.number
|
|
192
|
-
}),
|
|
182
|
+
})]),
|
|
193
183
|
/**
|
|
194
184
|
* The function called for onClick events.
|
|
195
185
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
@@ -203,12 +193,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
203
193
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
204
194
|
*/
|
|
205
195
|
onHighlightChange: PropTypes.func,
|
|
206
|
-
/**
|
|
207
|
-
* Indicate which axis to display the right of the charts.
|
|
208
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
209
|
-
* @default null
|
|
210
|
-
*/
|
|
211
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
212
196
|
/**
|
|
213
197
|
* The series to display in the bar chart.
|
|
214
198
|
* An array of [[HeatmapSeriesType]] objects.
|
|
@@ -237,12 +221,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
237
221
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
238
222
|
*/
|
|
239
223
|
tooltip: PropTypes.object,
|
|
240
|
-
/**
|
|
241
|
-
* Indicate which axis to display the top of the charts.
|
|
242
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
243
|
-
* @default null
|
|
244
|
-
*/
|
|
245
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
246
224
|
/**
|
|
247
225
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
248
226
|
*/
|
|
@@ -253,6 +231,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
253
231
|
* An array of [[AxisConfig]] objects.
|
|
254
232
|
*/
|
|
255
233
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
234
|
+
axis: PropTypes.oneOf(['x']),
|
|
256
235
|
barGapRatio: PropTypes.number,
|
|
257
236
|
categoryGapRatio: PropTypes.number,
|
|
258
237
|
classes: PropTypes.object,
|
|
@@ -277,13 +256,15 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
277
256
|
disableTicks: PropTypes.bool,
|
|
278
257
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
279
258
|
fill: PropTypes.string,
|
|
259
|
+
height: PropTypes.number,
|
|
280
260
|
hideTooltip: PropTypes.bool,
|
|
281
261
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
282
262
|
label: PropTypes.string,
|
|
283
263
|
labelStyle: PropTypes.object,
|
|
284
264
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
285
265
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
286
|
-
|
|
266
|
+
offset: PropTypes.number,
|
|
267
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
287
268
|
reverse: PropTypes.bool,
|
|
288
269
|
scaleType: PropTypes.oneOf(['band']),
|
|
289
270
|
slotProps: PropTypes.object,
|
|
@@ -292,6 +273,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
292
273
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
293
274
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
294
275
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
276
|
+
tickLabelMinGap: PropTypes.number,
|
|
295
277
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
296
278
|
tickLabelStyle: PropTypes.object,
|
|
297
279
|
tickMaxStep: PropTypes.number,
|
|
@@ -316,6 +298,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
316
298
|
* An array of [[AxisConfig]] objects.
|
|
317
299
|
*/
|
|
318
300
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
301
|
+
axis: PropTypes.oneOf(['y']),
|
|
319
302
|
barGapRatio: PropTypes.number,
|
|
320
303
|
categoryGapRatio: PropTypes.number,
|
|
321
304
|
classes: PropTypes.object,
|
|
@@ -346,7 +329,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
346
329
|
labelStyle: PropTypes.object,
|
|
347
330
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
348
331
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
349
|
-
|
|
332
|
+
offset: PropTypes.number,
|
|
333
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
350
334
|
reverse: PropTypes.bool,
|
|
351
335
|
scaleType: PropTypes.oneOf(['band']),
|
|
352
336
|
slotProps: PropTypes.object,
|
|
@@ -363,6 +347,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
363
347
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
364
348
|
tickSize: PropTypes.number,
|
|
365
349
|
valueFormatter: PropTypes.func,
|
|
350
|
+
width: PropTypes.number,
|
|
366
351
|
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
367
352
|
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
368
353
|
maxEnd: PropTypes.number,
|
|
@@ -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 = ["initialZoom", "onZoomChange", "apiRef"];
|
|
5
|
+
const _excluded = ["initialZoom", "zoomData", "onZoomChange", "apiRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -137,6 +137,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
137
137
|
});
|
|
138
138
|
const {
|
|
139
139
|
initialZoom,
|
|
140
|
+
zoomData,
|
|
140
141
|
onZoomChange,
|
|
141
142
|
apiRef
|
|
142
143
|
} = props,
|
|
@@ -162,6 +163,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
162
163
|
chartsSurfaceProps
|
|
163
164
|
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
164
165
|
initialZoom,
|
|
166
|
+
zoomData,
|
|
165
167
|
onZoomChange,
|
|
166
168
|
apiRef,
|
|
167
169
|
plugins: LINE_CHART_PRO_PLUGINS
|
|
@@ -199,12 +201,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
199
201
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
200
202
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
201
203
|
}),
|
|
202
|
-
/**
|
|
203
|
-
* Indicate which axis to display the bottom of the charts.
|
|
204
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
205
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
206
|
-
*/
|
|
207
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
208
204
|
children: PropTypes.node,
|
|
209
205
|
className: PropTypes.string,
|
|
210
206
|
/**
|
|
@@ -257,18 +253,13 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
257
253
|
id: PropTypes.string,
|
|
258
254
|
/**
|
|
259
255
|
* The list of zoom data related to each axis.
|
|
256
|
+
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
260
257
|
*/
|
|
261
258
|
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
262
259
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
263
260
|
end: PropTypes.number.isRequired,
|
|
264
261
|
start: PropTypes.number.isRequired
|
|
265
262
|
})),
|
|
266
|
-
/**
|
|
267
|
-
* Indicate which axis to display the left of the charts.
|
|
268
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
269
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
270
|
-
*/
|
|
271
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
272
263
|
/**
|
|
273
264
|
* If `true`, a loading overlay is displayed.
|
|
274
265
|
* @default false
|
|
@@ -277,14 +268,15 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
277
268
|
/**
|
|
278
269
|
* The margin between the SVG and the drawing area.
|
|
279
270
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
280
|
-
*
|
|
271
|
+
*
|
|
272
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
281
273
|
*/
|
|
282
|
-
margin: PropTypes.shape({
|
|
274
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
283
275
|
bottom: PropTypes.number,
|
|
284
276
|
left: PropTypes.number,
|
|
285
277
|
right: PropTypes.number,
|
|
286
278
|
top: PropTypes.number
|
|
287
|
-
}),
|
|
279
|
+
})]),
|
|
288
280
|
/**
|
|
289
281
|
* Callback fired when an area element is clicked.
|
|
290
282
|
*/
|
|
@@ -316,12 +308,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
316
308
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
317
309
|
*/
|
|
318
310
|
onZoomChange: PropTypes.func,
|
|
319
|
-
/**
|
|
320
|
-
* Indicate which axis to display the right of the charts.
|
|
321
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
322
|
-
* @default null
|
|
323
|
-
*/
|
|
324
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
325
311
|
/**
|
|
326
312
|
* The series to display in the line chart.
|
|
327
313
|
* An array of [[LineSeriesType]] objects.
|
|
@@ -345,12 +331,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
345
331
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
346
332
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
347
333
|
title: PropTypes.string,
|
|
348
|
-
/**
|
|
349
|
-
* Indicate which axis to display the top of the charts.
|
|
350
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
351
|
-
* @default null
|
|
352
|
-
*/
|
|
353
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
354
334
|
/**
|
|
355
335
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
356
336
|
*/
|
|
@@ -361,6 +341,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
361
341
|
* An array of [[AxisConfig]] objects.
|
|
362
342
|
*/
|
|
363
343
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
344
|
+
axis: PropTypes.oneOf(['x']),
|
|
364
345
|
classes: PropTypes.object,
|
|
365
346
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
366
347
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -383,13 +364,15 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
383
364
|
disableTicks: PropTypes.bool,
|
|
384
365
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
385
366
|
fill: PropTypes.string,
|
|
367
|
+
height: PropTypes.number,
|
|
386
368
|
hideTooltip: PropTypes.bool,
|
|
387
369
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
388
370
|
label: PropTypes.string,
|
|
389
371
|
labelStyle: PropTypes.object,
|
|
390
372
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
391
373
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
392
|
-
|
|
374
|
+
offset: PropTypes.number,
|
|
375
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
393
376
|
reverse: PropTypes.bool,
|
|
394
377
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
395
378
|
slotProps: PropTypes.object,
|
|
@@ -398,6 +381,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
398
381
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
399
382
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
400
383
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
384
|
+
tickLabelMinGap: PropTypes.number,
|
|
401
385
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
402
386
|
tickLabelStyle: PropTypes.object,
|
|
403
387
|
tickMaxStep: PropTypes.number,
|
|
@@ -422,6 +406,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
422
406
|
* An array of [[AxisConfig]] objects.
|
|
423
407
|
*/
|
|
424
408
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
409
|
+
axis: PropTypes.oneOf(['y']),
|
|
425
410
|
classes: PropTypes.object,
|
|
426
411
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
427
412
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -450,7 +435,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
450
435
|
labelStyle: PropTypes.object,
|
|
451
436
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
452
437
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
453
|
-
|
|
438
|
+
offset: PropTypes.number,
|
|
439
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
454
440
|
reverse: PropTypes.bool,
|
|
455
441
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
456
442
|
slotProps: PropTypes.object,
|
|
@@ -467,6 +453,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
467
453
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
468
454
|
tickSize: PropTypes.number,
|
|
469
455
|
valueFormatter: PropTypes.func,
|
|
456
|
+
width: PropTypes.number,
|
|
470
457
|
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
471
458
|
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
472
459
|
maxEnd: PropTypes.number,
|
|
@@ -501,6 +488,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
501
488
|
id: PropTypes.string,
|
|
502
489
|
max: PropTypes.number,
|
|
503
490
|
min: PropTypes.number
|
|
491
|
+
})),
|
|
492
|
+
/**
|
|
493
|
+
* The list of zoom data related to each axis.
|
|
494
|
+
*/
|
|
495
|
+
zoomData: PropTypes.arrayOf(PropTypes.shape({
|
|
496
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
497
|
+
end: PropTypes.number.isRequired,
|
|
498
|
+
start: PropTypes.number.isRequired
|
|
504
499
|
}))
|
|
505
500
|
} : void 0;
|
|
506
501
|
export { LineChartPro };
|
|
@@ -2,7 +2,7 @@
|
|
|
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 = ["initialZoom", "onZoomChange", "apiRef"];
|
|
5
|
+
const _excluded = ["initialZoom", "zoomData", "onZoomChange", "apiRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -36,6 +36,7 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
36
36
|
});
|
|
37
37
|
const {
|
|
38
38
|
initialZoom,
|
|
39
|
+
zoomData,
|
|
39
40
|
onZoomChange,
|
|
40
41
|
apiRef
|
|
41
42
|
} = props,
|
|
@@ -56,6 +57,7 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
56
57
|
chartsSurfaceProps
|
|
57
58
|
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
58
59
|
initialZoom,
|
|
60
|
+
zoomData,
|
|
59
61
|
onZoomChange,
|
|
60
62
|
apiRef,
|
|
61
63
|
plugins: SCATTER_CHART_PRO_PLUGINS
|
|
@@ -93,12 +95,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
93
95
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
94
96
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
95
97
|
}),
|
|
96
|
-
/**
|
|
97
|
-
* Indicate which axis to display the bottom of the charts.
|
|
98
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
99
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
100
|
-
*/
|
|
101
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
102
98
|
children: PropTypes.node,
|
|
103
99
|
className: PropTypes.string,
|
|
104
100
|
/**
|
|
@@ -152,18 +148,13 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
152
148
|
id: PropTypes.string,
|
|
153
149
|
/**
|
|
154
150
|
* The list of zoom data related to each axis.
|
|
151
|
+
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
155
152
|
*/
|
|
156
153
|
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
157
154
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
158
155
|
end: PropTypes.number.isRequired,
|
|
159
156
|
start: PropTypes.number.isRequired
|
|
160
157
|
})),
|
|
161
|
-
/**
|
|
162
|
-
* Indicate which axis to display the left of the charts.
|
|
163
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
164
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
165
|
-
*/
|
|
166
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
167
158
|
/**
|
|
168
159
|
* If `true`, a loading overlay is displayed.
|
|
169
160
|
* @default false
|
|
@@ -172,14 +163,15 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
172
163
|
/**
|
|
173
164
|
* The margin between the SVG and the drawing area.
|
|
174
165
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
175
|
-
*
|
|
166
|
+
*
|
|
167
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
176
168
|
*/
|
|
177
|
-
margin: PropTypes.shape({
|
|
169
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
178
170
|
bottom: PropTypes.number,
|
|
179
171
|
left: PropTypes.number,
|
|
180
172
|
right: PropTypes.number,
|
|
181
173
|
top: PropTypes.number
|
|
182
|
-
}),
|
|
174
|
+
})]),
|
|
183
175
|
/**
|
|
184
176
|
* The function called for onClick events.
|
|
185
177
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
@@ -205,12 +197,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
205
197
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
206
198
|
*/
|
|
207
199
|
onZoomChange: PropTypes.func,
|
|
208
|
-
/**
|
|
209
|
-
* Indicate which axis to display the right of the charts.
|
|
210
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
211
|
-
* @default null
|
|
212
|
-
*/
|
|
213
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
214
200
|
/**
|
|
215
201
|
* The series to display in the scatter chart.
|
|
216
202
|
* An array of [[ScatterSeriesType]] objects.
|
|
@@ -234,12 +220,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
234
220
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
235
221
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
236
222
|
title: PropTypes.string,
|
|
237
|
-
/**
|
|
238
|
-
* Indicate which axis to display the top of the charts.
|
|
239
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
240
|
-
* @default null
|
|
241
|
-
*/
|
|
242
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
243
223
|
/**
|
|
244
224
|
* Defines the maximal distance between a scatter point and the pointer that triggers the interaction.
|
|
245
225
|
* If `undefined`, the radius is assumed to be infinite.
|
|
@@ -255,6 +235,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
255
235
|
* An array of [[AxisConfig]] objects.
|
|
256
236
|
*/
|
|
257
237
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
238
|
+
axis: PropTypes.oneOf(['x']),
|
|
258
239
|
classes: PropTypes.object,
|
|
259
240
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
260
241
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -277,13 +258,15 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
277
258
|
disableTicks: PropTypes.bool,
|
|
278
259
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
279
260
|
fill: PropTypes.string,
|
|
261
|
+
height: PropTypes.number,
|
|
280
262
|
hideTooltip: PropTypes.bool,
|
|
281
263
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
282
264
|
label: PropTypes.string,
|
|
283
265
|
labelStyle: PropTypes.object,
|
|
284
266
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
285
267
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
286
|
-
|
|
268
|
+
offset: PropTypes.number,
|
|
269
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
287
270
|
reverse: PropTypes.bool,
|
|
288
271
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
289
272
|
slotProps: PropTypes.object,
|
|
@@ -292,6 +275,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
292
275
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
293
276
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
294
277
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
278
|
+
tickLabelMinGap: PropTypes.number,
|
|
295
279
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
296
280
|
tickLabelStyle: PropTypes.object,
|
|
297
281
|
tickMaxStep: PropTypes.number,
|
|
@@ -316,6 +300,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
316
300
|
* An array of [[AxisConfig]] objects.
|
|
317
301
|
*/
|
|
318
302
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
303
|
+
axis: PropTypes.oneOf(['y']),
|
|
319
304
|
classes: PropTypes.object,
|
|
320
305
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
321
306
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -344,7 +329,8 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
344
329
|
labelStyle: PropTypes.object,
|
|
345
330
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
346
331
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
347
|
-
|
|
332
|
+
offset: PropTypes.number,
|
|
333
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
348
334
|
reverse: PropTypes.bool,
|
|
349
335
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
350
336
|
slotProps: PropTypes.object,
|
|
@@ -361,6 +347,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
361
347
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
362
348
|
tickSize: PropTypes.number,
|
|
363
349
|
valueFormatter: PropTypes.func,
|
|
350
|
+
width: PropTypes.number,
|
|
364
351
|
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
365
352
|
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
366
353
|
maxEnd: PropTypes.number,
|
|
@@ -395,6 +382,14 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
395
382
|
id: PropTypes.string,
|
|
396
383
|
max: PropTypes.number,
|
|
397
384
|
min: PropTypes.number
|
|
385
|
+
})),
|
|
386
|
+
/**
|
|
387
|
+
* The list of zoom data related to each axis.
|
|
388
|
+
*/
|
|
389
|
+
zoomData: PropTypes.arrayOf(PropTypes.shape({
|
|
390
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
391
|
+
end: PropTypes.number.isRequired,
|
|
392
|
+
start: PropTypes.number.isRequired
|
|
398
393
|
}))
|
|
399
394
|
} : void 0;
|
|
400
395
|
export { ScatterChartPro };
|
package/modern/index.js
CHANGED