@mui/x-charts-pro 8.0.0-alpha.0 → 8.0.0-alpha.1
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 +3 -31
- package/CHANGELOG.md +429 -5
- package/ChartContainerPro/ChartContainerPro.js +13 -23
- package/ChartContainerPro/useChartContainerProProps.d.ts +2 -39
- package/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/Heatmap/Heatmap.d.ts +11 -4
- package/Heatmap/Heatmap.js +4 -35
- package/Heatmap/HeatmapTooltip.d.ts +9 -0
- package/Heatmap/HeatmapTooltip.js +294 -0
- package/Heatmap/index.d.ts +1 -1
- package/Heatmap/index.js +1 -1
- package/LineChartPro/LineChartPro.js +3 -32
- package/README.md +2 -2
- package/ScatterChartPro/ScatterChartPro.js +3 -32
- package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +4 -1
- package/context/ChartDataProviderPro/ChartDataProviderPro.js +22 -21
- package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -5
- package/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/index.js +1 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/BarChartPro/BarChartPro.js +3 -31
- package/modern/ChartContainerPro/ChartContainerPro.js +13 -23
- package/modern/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/modern/Heatmap/Heatmap.js +4 -35
- package/modern/Heatmap/HeatmapTooltip.js +294 -0
- package/modern/Heatmap/index.js +1 -1
- package/modern/LineChartPro/LineChartPro.js +3 -32
- package/modern/ScatterChartPro/ScatterChartPro.js +3 -32
- package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +22 -21
- package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/BarChartPro/BarChartPro.js +3 -31
- package/node/ChartContainerPro/ChartContainerPro.js +13 -23
- package/node/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/node/Heatmap/Heatmap.js +4 -35
- package/node/Heatmap/HeatmapTooltip.js +300 -0
- package/node/Heatmap/index.js +4 -4
- package/node/LineChartPro/LineChartPro.js +3 -32
- package/node/ScatterChartPro/ScatterChartPro.js +3 -32
- package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +21 -20
- package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/node/index.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +7 -7
- package/Heatmap/DefaultHeatmapTooltip.d.ts +0 -7
- package/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/modern/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/node/Heatmap/DefaultHeatmapTooltip.js +0 -105
|
@@ -0,0 +1,294 @@
|
|
|
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 clsx from 'clsx';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, ChartsTooltipMark, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
|
|
9
|
+
import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
|
|
10
|
+
import { getLabel } from '@mui/x-charts/internals';
|
|
11
|
+
import { useHeatmapSeries } from "../hooks/useSeries.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const useUtilityClasses = ownerState => {
|
|
14
|
+
const {
|
|
15
|
+
classes
|
|
16
|
+
} = ownerState;
|
|
17
|
+
const slots = {
|
|
18
|
+
root: ['root'],
|
|
19
|
+
paper: ['paper'],
|
|
20
|
+
table: ['table'],
|
|
21
|
+
row: ['row'],
|
|
22
|
+
cell: ['cell'],
|
|
23
|
+
mark: ['mark'],
|
|
24
|
+
markCell: ['markCell'],
|
|
25
|
+
labelCell: ['labelCell'],
|
|
26
|
+
valueCell: ['valueCell']
|
|
27
|
+
};
|
|
28
|
+
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @ignore - internal component.
|
|
33
|
+
*/
|
|
34
|
+
function DefaultHeatmapTooltipContent(props) {
|
|
35
|
+
const {
|
|
36
|
+
classes
|
|
37
|
+
} = props;
|
|
38
|
+
const xAxis = useXAxis();
|
|
39
|
+
const yAxis = useYAxis();
|
|
40
|
+
const heatmapSeries = useHeatmapSeries();
|
|
41
|
+
const tooltipData = useItemTooltip();
|
|
42
|
+
if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const {
|
|
46
|
+
series,
|
|
47
|
+
seriesOrder
|
|
48
|
+
} = heatmapSeries;
|
|
49
|
+
const seriesId = seriesOrder[0];
|
|
50
|
+
const {
|
|
51
|
+
color,
|
|
52
|
+
value,
|
|
53
|
+
identifier
|
|
54
|
+
} = tooltipData;
|
|
55
|
+
const [xIndex, yIndex] = value;
|
|
56
|
+
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
57
|
+
location: 'tooltip'
|
|
58
|
+
}) ?? xAxis.data[xIndex].toLocaleString();
|
|
59
|
+
const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
|
|
60
|
+
location: 'tooltip'
|
|
61
|
+
}) ?? yAxis.data[yIndex].toLocaleString();
|
|
62
|
+
const formattedValue = series[seriesId].valueFormatter(value, {
|
|
63
|
+
dataIndex: identifier.dataIndex
|
|
64
|
+
});
|
|
65
|
+
const seriesLabel = getLabel(series[seriesId].label, 'tooltip');
|
|
66
|
+
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
67
|
+
className: classes?.paper,
|
|
68
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
69
|
+
className: classes?.table,
|
|
70
|
+
children: [/*#__PURE__*/_jsx("thead", {
|
|
71
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
72
|
+
className: classes?.row,
|
|
73
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
74
|
+
className: classes?.cell,
|
|
75
|
+
children: formattedX
|
|
76
|
+
}), formattedX && formattedY && /*#__PURE__*/_jsx(ChartsTooltipCell, {}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
77
|
+
className: classes?.cell,
|
|
78
|
+
children: formattedY
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
81
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
82
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
83
|
+
className: classes?.row,
|
|
84
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
85
|
+
className: clsx(classes?.markCell, classes?.cell),
|
|
86
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
87
|
+
color: color,
|
|
88
|
+
className: classes?.mark
|
|
89
|
+
})
|
|
90
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
91
|
+
className: clsx(classes?.labelCell, classes?.cell),
|
|
92
|
+
children: seriesLabel
|
|
93
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
94
|
+
className: clsx(classes?.valueCell, classes?.cell),
|
|
95
|
+
children: formattedValue
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltipContent.propTypes = {
|
|
103
|
+
// ----------------------------- Warning --------------------------------
|
|
104
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
105
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
106
|
+
// ----------------------------------------------------------------------
|
|
107
|
+
/**
|
|
108
|
+
* Override or extend the styles applied to the component.
|
|
109
|
+
*/
|
|
110
|
+
classes: PropTypes.object
|
|
111
|
+
} : void 0;
|
|
112
|
+
function HeatmapTooltip(props) {
|
|
113
|
+
const classes = useUtilityClasses({
|
|
114
|
+
classes: props.classes
|
|
115
|
+
});
|
|
116
|
+
return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
|
|
117
|
+
classes: classes,
|
|
118
|
+
trigger: "item",
|
|
119
|
+
children: /*#__PURE__*/_jsx(DefaultHeatmapTooltipContent, {
|
|
120
|
+
classes: classes
|
|
121
|
+
})
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
process.env.NODE_ENV !== "production" ? HeatmapTooltip.propTypes = {
|
|
125
|
+
// ----------------------------- Warning --------------------------------
|
|
126
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
127
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
128
|
+
// ----------------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
131
|
+
* or a function that returns either.
|
|
132
|
+
* It's used to set the position of the popper.
|
|
133
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
134
|
+
*/
|
|
135
|
+
anchorEl: PropTypes.oneOfType([(props, propName) => {
|
|
136
|
+
if (props[propName] == null) {
|
|
137
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
138
|
+
}
|
|
139
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
140
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}, PropTypes.func, PropTypes.shape({
|
|
144
|
+
contextElement: (props, propName) => {
|
|
145
|
+
if (props[propName] == null) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
149
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
},
|
|
153
|
+
getBoundingClientRect: PropTypes.func.isRequired
|
|
154
|
+
})]),
|
|
155
|
+
/**
|
|
156
|
+
* Override or extend the styles applied to the component.
|
|
157
|
+
*/
|
|
158
|
+
classes: PropTypes.object,
|
|
159
|
+
/**
|
|
160
|
+
* The component used for the root node.
|
|
161
|
+
* Either a string to use a HTML element or a component.
|
|
162
|
+
*/
|
|
163
|
+
component: PropTypes.elementType,
|
|
164
|
+
/**
|
|
165
|
+
* The components used for each slot inside the Popper.
|
|
166
|
+
* Either a string to use a HTML element or a component.
|
|
167
|
+
* @default {}
|
|
168
|
+
*/
|
|
169
|
+
components: PropTypes.shape({
|
|
170
|
+
Root: PropTypes.elementType
|
|
171
|
+
}),
|
|
172
|
+
/**
|
|
173
|
+
* The props used for each slot inside the Popper.
|
|
174
|
+
* @default {}
|
|
175
|
+
*/
|
|
176
|
+
componentsProps: PropTypes.shape({
|
|
177
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
178
|
+
}),
|
|
179
|
+
/**
|
|
180
|
+
* An HTML element or function that returns one.
|
|
181
|
+
* The `container` will have the portal children appended to it.
|
|
182
|
+
*
|
|
183
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
184
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
185
|
+
*
|
|
186
|
+
* By default, it uses the body of the top-level document object,
|
|
187
|
+
* so it's simply `document.body` most of the time.
|
|
188
|
+
*/
|
|
189
|
+
container: PropTypes.oneOfType([(props, propName) => {
|
|
190
|
+
if (props[propName] == null) {
|
|
191
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
192
|
+
}
|
|
193
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
194
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}, PropTypes.func]),
|
|
198
|
+
/**
|
|
199
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
200
|
+
* @default false
|
|
201
|
+
*/
|
|
202
|
+
disablePortal: PropTypes.bool,
|
|
203
|
+
/**
|
|
204
|
+
* Always keep the children in the DOM.
|
|
205
|
+
* This prop can be useful in SEO situation or
|
|
206
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
keepMounted: PropTypes.bool,
|
|
210
|
+
/**
|
|
211
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
212
|
+
* most of its features are fully encapsulated "modifiers".
|
|
213
|
+
*
|
|
214
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
215
|
+
* compute the position of the popper.
|
|
216
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
217
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
218
|
+
*/
|
|
219
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
220
|
+
data: PropTypes.object,
|
|
221
|
+
effect: PropTypes.func,
|
|
222
|
+
enabled: PropTypes.bool,
|
|
223
|
+
fn: PropTypes.func,
|
|
224
|
+
name: PropTypes.any,
|
|
225
|
+
options: PropTypes.object,
|
|
226
|
+
phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
227
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
228
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
229
|
+
})),
|
|
230
|
+
/**
|
|
231
|
+
* If `true`, the component is shown.
|
|
232
|
+
*/
|
|
233
|
+
open: PropTypes.bool,
|
|
234
|
+
/**
|
|
235
|
+
* Popper placement.
|
|
236
|
+
* @default 'bottom'
|
|
237
|
+
*/
|
|
238
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
239
|
+
/**
|
|
240
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
241
|
+
* @default {}
|
|
242
|
+
*/
|
|
243
|
+
popperOptions: PropTypes.shape({
|
|
244
|
+
modifiers: PropTypes.array,
|
|
245
|
+
onFirstUpdate: PropTypes.func,
|
|
246
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
247
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
|
248
|
+
}),
|
|
249
|
+
/**
|
|
250
|
+
* A ref that points to the used popper instance.
|
|
251
|
+
*/
|
|
252
|
+
popperRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
253
|
+
current: PropTypes.shape({
|
|
254
|
+
destroy: PropTypes.func.isRequired,
|
|
255
|
+
forceUpdate: PropTypes.func.isRequired,
|
|
256
|
+
setOptions: PropTypes.func.isRequired,
|
|
257
|
+
state: PropTypes.shape({
|
|
258
|
+
attributes: PropTypes.object.isRequired,
|
|
259
|
+
elements: PropTypes.object.isRequired,
|
|
260
|
+
modifiersData: PropTypes.object.isRequired,
|
|
261
|
+
options: PropTypes.object.isRequired,
|
|
262
|
+
orderedModifiers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
263
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']).isRequired,
|
|
264
|
+
rects: PropTypes.object.isRequired,
|
|
265
|
+
reset: PropTypes.bool.isRequired,
|
|
266
|
+
scrollParents: PropTypes.object.isRequired,
|
|
267
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed']).isRequired,
|
|
268
|
+
styles: PropTypes.object.isRequired
|
|
269
|
+
}).isRequired,
|
|
270
|
+
update: PropTypes.func.isRequired
|
|
271
|
+
})
|
|
272
|
+
})]),
|
|
273
|
+
/**
|
|
274
|
+
* The props used for each slot inside the Popper.
|
|
275
|
+
* @default {}
|
|
276
|
+
*/
|
|
277
|
+
slotProps: PropTypes.object,
|
|
278
|
+
/**
|
|
279
|
+
* The components used for each slot inside the Popper.
|
|
280
|
+
* Either a string to use a HTML element or a component.
|
|
281
|
+
* @default {}
|
|
282
|
+
*/
|
|
283
|
+
slots: PropTypes.object,
|
|
284
|
+
/**
|
|
285
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
286
|
+
*/
|
|
287
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
288
|
+
/**
|
|
289
|
+
* Help supporting a react-transition-group/Transition component.
|
|
290
|
+
* @default false
|
|
291
|
+
*/
|
|
292
|
+
transition: PropTypes.bool
|
|
293
|
+
} : void 0;
|
|
294
|
+
export { HeatmapTooltip };
|
package/modern/Heatmap/index.js
CHANGED
|
@@ -165,9 +165,9 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
165
165
|
axisHighlightProps,
|
|
166
166
|
lineHighlightPlotProps,
|
|
167
167
|
legendProps,
|
|
168
|
-
tooltipProps,
|
|
169
168
|
children
|
|
170
169
|
} = useLineChartProps(other);
|
|
170
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
171
171
|
return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
|
|
172
172
|
ref: ref
|
|
173
173
|
}, chartContainerProps, {
|
|
@@ -178,7 +178,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
178
178
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
179
179
|
"data-drawing-container": true,
|
|
180
180
|
children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
|
|
181
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
181
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
|
|
182
182
|
}));
|
|
183
183
|
});
|
|
184
184
|
process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
@@ -188,7 +188,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
188
188
|
// ----------------------------------------------------------------------
|
|
189
189
|
/**
|
|
190
190
|
* The configuration of axes highlight.
|
|
191
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
191
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
192
192
|
* @default { x: 'line' }
|
|
193
193
|
*/
|
|
194
194
|
axisHighlight: PropTypes.shape({
|
|
@@ -303,16 +303,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
303
303
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
304
304
|
*/
|
|
305
305
|
onZoomChange: PropTypes.func,
|
|
306
|
-
/**
|
|
307
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
308
|
-
* before it renders for the first time.
|
|
309
|
-
*
|
|
310
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
311
|
-
* the first render, like when used inside a grid.
|
|
312
|
-
*
|
|
313
|
-
* @default false
|
|
314
|
-
*/
|
|
315
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
316
306
|
/**
|
|
317
307
|
* Indicate which axis to display the right of the charts.
|
|
318
308
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -341,31 +331,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
341
331
|
slots: PropTypes.object,
|
|
342
332
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
343
333
|
title: PropTypes.string,
|
|
344
|
-
/**
|
|
345
|
-
* The configuration of the tooltip.
|
|
346
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
347
|
-
* @default { trigger: 'item' }
|
|
348
|
-
*/
|
|
349
|
-
tooltip: PropTypes.shape({
|
|
350
|
-
axisContent: PropTypes.elementType,
|
|
351
|
-
classes: PropTypes.object,
|
|
352
|
-
itemContent: PropTypes.elementType,
|
|
353
|
-
slotProps: PropTypes.object,
|
|
354
|
-
slots: PropTypes.object,
|
|
355
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
356
|
-
}),
|
|
357
334
|
/**
|
|
358
335
|
* Indicate which axis to display the top of the charts.
|
|
359
336
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
360
337
|
* @default null
|
|
361
338
|
*/
|
|
362
339
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
363
|
-
viewBox: PropTypes.shape({
|
|
364
|
-
height: PropTypes.number,
|
|
365
|
-
width: PropTypes.number,
|
|
366
|
-
x: PropTypes.number,
|
|
367
|
-
y: PropTypes.number
|
|
368
|
-
}),
|
|
369
340
|
/**
|
|
370
341
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
371
342
|
*/
|
|
@@ -49,9 +49,9 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
49
49
|
overlayProps,
|
|
50
50
|
legendProps,
|
|
51
51
|
axisHighlightProps,
|
|
52
|
-
tooltipProps,
|
|
53
52
|
children
|
|
54
53
|
} = useScatterChartProps(other);
|
|
54
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
55
55
|
return /*#__PURE__*/_jsx(ChartContainerPro, _extends({
|
|
56
56
|
ref: ref
|
|
57
57
|
}, chartContainerProps, {
|
|
@@ -61,7 +61,7 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
61
61
|
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
62
62
|
"data-drawing-container": true,
|
|
63
63
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
64
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
64
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props?.slotProps?.tooltip)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
|
|
65
65
|
}))
|
|
66
66
|
}));
|
|
67
67
|
});
|
|
@@ -72,7 +72,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
72
72
|
// ----------------------------------------------------------------------
|
|
73
73
|
/**
|
|
74
74
|
* The configuration of axes highlight.
|
|
75
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
75
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
76
76
|
* @default { x: 'none', y: 'none' }
|
|
77
77
|
*/
|
|
78
78
|
axisHighlight: PropTypes.shape({
|
|
@@ -171,16 +171,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
171
171
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
172
172
|
*/
|
|
173
173
|
onZoomChange: PropTypes.func,
|
|
174
|
-
/**
|
|
175
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
176
|
-
* before it renders for the first time.
|
|
177
|
-
*
|
|
178
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
179
|
-
* the first render, like when used inside a grid.
|
|
180
|
-
*
|
|
181
|
-
* @default false
|
|
182
|
-
*/
|
|
183
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
184
174
|
/**
|
|
185
175
|
* Indicate which axis to display the right of the charts.
|
|
186
176
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -209,31 +199,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
209
199
|
slots: PropTypes.object,
|
|
210
200
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
211
201
|
title: PropTypes.string,
|
|
212
|
-
/**
|
|
213
|
-
* The configuration of the tooltip.
|
|
214
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
215
|
-
* @default { trigger: 'item' }
|
|
216
|
-
*/
|
|
217
|
-
tooltip: PropTypes.shape({
|
|
218
|
-
axisContent: PropTypes.elementType,
|
|
219
|
-
classes: PropTypes.object,
|
|
220
|
-
itemContent: PropTypes.elementType,
|
|
221
|
-
slotProps: PropTypes.object,
|
|
222
|
-
slots: PropTypes.object,
|
|
223
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
224
|
-
}),
|
|
225
202
|
/**
|
|
226
203
|
* Indicate which axis to display the top of the charts.
|
|
227
204
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
228
205
|
* @default null
|
|
229
206
|
*/
|
|
230
207
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
231
|
-
viewBox: PropTypes.shape({
|
|
232
|
-
height: PropTypes.number,
|
|
233
|
-
width: PropTypes.number,
|
|
234
|
-
x: PropTypes.number,
|
|
235
|
-
y: PropTypes.number
|
|
236
|
-
}),
|
|
237
208
|
/**
|
|
238
209
|
* Defines the maximal distance between a scatter point and the pointer that triggers the interaction.
|
|
239
210
|
* If `undefined`, the radius is assumed to be infinite.
|
|
@@ -3,44 +3,45 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
6
|
+
import { DrawingAreaProvider, InteractionProvider, PluginProvider, SeriesProvider, AnimationProvider, SvgRefProvider, SizeProvider } from '@mui/x-charts/internals';
|
|
8
7
|
import { HighlightedProvider, ZAxisContextProvider } from '@mui/x-charts/context';
|
|
9
8
|
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
|
|
10
9
|
import { getReleaseInfo } from "../../internals/utils/releaseInfo.js";
|
|
11
10
|
import { CartesianProviderPro } from "../CartesianProviderPro/index.js";
|
|
12
11
|
import { ZoomProvider } from "../ZoomProvider/index.js";
|
|
13
12
|
import { useChartContainerProProps } from "./useChartDataProviderProProps.js";
|
|
14
|
-
import { jsx as _jsx
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
const releaseInfo = getReleaseInfo();
|
|
16
|
-
|
|
15
|
+
function ChartDataProviderPro(props) {
|
|
17
16
|
const {
|
|
18
17
|
zoomProviderProps,
|
|
19
|
-
|
|
18
|
+
drawingAreaProviderProps,
|
|
20
19
|
seriesProviderProps,
|
|
21
20
|
zAxisContextProps,
|
|
22
21
|
highlightedProviderProps,
|
|
23
22
|
cartesianProviderProps,
|
|
24
|
-
|
|
23
|
+
sizeProviderProps,
|
|
25
24
|
pluginProviderProps,
|
|
26
25
|
animationProviderProps,
|
|
27
26
|
children
|
|
28
|
-
} = useChartContainerProProps(props
|
|
27
|
+
} = useChartContainerProProps(props);
|
|
29
28
|
useLicenseVerifier('x-charts-pro', releaseInfo);
|
|
30
|
-
return /*#__PURE__*/_jsx(
|
|
31
|
-
children: /*#__PURE__*/_jsx(
|
|
32
|
-
children: /*#__PURE__*/_jsx(
|
|
33
|
-
children: /*#__PURE__*/_jsx(
|
|
34
|
-
children: /*#__PURE__*/_jsx(
|
|
35
|
-
children: /*#__PURE__*/_jsx(
|
|
36
|
-
children: /*#__PURE__*/_jsx(
|
|
37
|
-
children: /*#__PURE__*/_jsx(
|
|
38
|
-
children: /*#__PURE__*/_jsx(
|
|
39
|
-
children: /*#__PURE__*/
|
|
40
|
-
children:
|
|
29
|
+
return /*#__PURE__*/_jsx(SizeProvider, _extends({}, sizeProviderProps, {
|
|
30
|
+
children: /*#__PURE__*/_jsx(DrawingAreaProvider, _extends({}, drawingAreaProviderProps, {
|
|
31
|
+
children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
|
|
32
|
+
children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
|
|
33
|
+
children: /*#__PURE__*/_jsx(ZoomProvider, _extends({}, zoomProviderProps, {
|
|
34
|
+
children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
|
|
35
|
+
children: /*#__PURE__*/_jsx(CartesianProviderPro, _extends({}, cartesianProviderProps, {
|
|
36
|
+
children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
|
|
37
|
+
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
38
|
+
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
39
|
+
children: /*#__PURE__*/_jsx(SvgRefProvider, {
|
|
40
|
+
children: children
|
|
41
|
+
})
|
|
41
42
|
}))
|
|
42
|
-
})
|
|
43
|
-
})
|
|
43
|
+
})
|
|
44
|
+
}))
|
|
44
45
|
}))
|
|
45
46
|
}))
|
|
46
47
|
}))
|
|
@@ -48,7 +49,7 @@ const ChartDataProviderPro = /*#__PURE__*/React.forwardRef(function ChartDataPro
|
|
|
48
49
|
}))
|
|
49
50
|
}))
|
|
50
51
|
}));
|
|
51
|
-
}
|
|
52
|
+
}
|
|
52
53
|
process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
53
54
|
// ----------------------------- Warning --------------------------------
|
|
54
55
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
const _excluded = ["zoom", "onZoomChange"];
|
|
5
5
|
import { useChartDataProviderProps } from '@mui/x-charts/internals';
|
|
6
|
-
export const useChartContainerProProps =
|
|
6
|
+
export const useChartContainerProProps = props => {
|
|
7
7
|
const {
|
|
8
8
|
zoom,
|
|
9
9
|
onZoomChange
|
|
@@ -11,17 +11,17 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
11
11
|
baseProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
12
12
|
const {
|
|
13
13
|
children,
|
|
14
|
-
|
|
14
|
+
drawingAreaProviderProps,
|
|
15
15
|
seriesProviderProps,
|
|
16
16
|
cartesianProviderProps,
|
|
17
17
|
zAxisContextProps,
|
|
18
18
|
highlightedProviderProps,
|
|
19
|
-
|
|
19
|
+
sizeProviderProps,
|
|
20
20
|
pluginProviderProps,
|
|
21
21
|
animationProviderProps,
|
|
22
22
|
xAxis,
|
|
23
23
|
yAxis
|
|
24
|
-
} = useChartDataProviderProps(baseProps
|
|
24
|
+
} = useChartDataProviderProps(baseProps);
|
|
25
25
|
const zoomProviderProps = {
|
|
26
26
|
zoom,
|
|
27
27
|
onZoomChange,
|
|
@@ -31,13 +31,13 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
31
31
|
return {
|
|
32
32
|
zoomProviderProps,
|
|
33
33
|
children,
|
|
34
|
-
|
|
34
|
+
drawingAreaProviderProps,
|
|
35
35
|
pluginProviderProps,
|
|
36
36
|
seriesProviderProps,
|
|
37
37
|
cartesianProviderProps,
|
|
38
38
|
zAxisContextProps,
|
|
39
39
|
highlightedProviderProps,
|
|
40
|
-
|
|
40
|
+
sizeProviderProps,
|
|
41
41
|
animationProviderProps
|
|
42
42
|
};
|
|
43
43
|
};
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMjIzMDAwMDAwMA==";
|
|
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
|