@mui/x-charts-pro 8.7.0 → 8.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.d.ts +1 -1
- package/BarChartPro/BarChartPro.js +33 -1
- package/CHANGELOG.md +199 -24
- package/ChartDataProviderPro/ChartDataProviderPro.js +7 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -16
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +4 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +27 -12
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +102 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +11 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.js +62 -0
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +14 -0
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +61 -0
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +10 -0
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +62 -0
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +14 -0
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +59 -0
- package/ChartZoomSlider/internals/previews/PreviewPlot.types.d.ts +4 -0
- package/ChartZoomSlider/internals/previews/PreviewPlot.types.js +5 -0
- package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +16 -0
- package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +93 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +3 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +2 -0
- package/FunnelChart/FunnelChart.d.ts +4 -3
- package/FunnelChart/FunnelChart.js +1 -1
- package/FunnelChart/FunnelPlot.js +1 -1
- package/FunnelChart/funnel.types.d.ts +14 -9
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +1 -1
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/FunnelChart/index.d.ts +1 -1
- package/FunnelChart/seriesConfig/seriesProcessor.js +24 -48
- package/Heatmap/Heatmap.d.ts +4 -3
- package/Heatmap/Heatmap.js +1 -1
- package/Heatmap/index.d.ts +1 -0
- package/LineChartPro/LineChartPro.js +39 -1
- package/PieChartPro/PieChartPro.d.ts +1 -1
- package/PieChartPro/PieChartPro.js +1 -1
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.js +20 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.js +17 -1
- package/esm/BarChartPro/BarChartPro.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.js +33 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +7 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +33 -18
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +28 -13
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +94 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +11 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.js +54 -0
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +14 -0
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +53 -0
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +10 -0
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +55 -0
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +14 -0
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +51 -0
- package/esm/ChartZoomSlider/internals/previews/PreviewPlot.types.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/previews/PreviewPlot.types.js +1 -0
- package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +16 -0
- package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +86 -0
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +3 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +2 -0
- package/esm/FunnelChart/FunnelChart.d.ts +4 -3
- package/esm/FunnelChart/FunnelChart.js +1 -1
- package/esm/FunnelChart/FunnelPlot.js +1 -1
- package/esm/FunnelChart/funnel.types.d.ts +14 -9
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/esm/FunnelChart/index.d.ts +1 -1
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +24 -48
- package/esm/Heatmap/Heatmap.d.ts +4 -3
- package/esm/Heatmap/Heatmap.js +1 -1
- package/esm/Heatmap/index.d.ts +1 -0
- package/esm/LineChartPro/LineChartPro.js +39 -1
- package/esm/PieChartPro/PieChartPro.d.ts +1 -1
- package/esm/PieChartPro/PieChartPro.js +1 -1
- package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.js +20 -1
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +17 -1
- package/esm/index.js +3 -3
- package/esm/internals/plugins/useChartProExport/exportImage.js +9 -3
- package/esm/internals/plugins/useChartProExport/print.d.ts +3 -1
- package/esm/internals/plugins/useChartProExport/print.js +7 -2
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +22 -12
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
- package/index.js +3 -3
- package/internals/plugins/useChartProExport/exportImage.js +9 -3
- package/internals/plugins/useChartProExport/print.d.ts +3 -1
- package/internals/plugins/useChartProExport/print.js +7 -2
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +22 -12
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
- package/package.json +7 -7
|
@@ -16,6 +16,14 @@ const createPoint = ({
|
|
|
16
16
|
useBandWidth,
|
|
17
17
|
stackOffset
|
|
18
18
|
};
|
|
19
|
+
const getFunnelDirection = (funnelDirection, curve, firstValue, lastValue) => {
|
|
20
|
+
if (curve !== 'step' && curve !== 'linear-sharp' && (funnelDirection === 'increasing' || funnelDirection === 'decreasing')) {
|
|
21
|
+
return funnelDirection;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Implicit check for null or undefined values
|
|
25
|
+
return firstValue != null && lastValue != null && firstValue < lastValue ? 'increasing' : 'decreasing';
|
|
26
|
+
};
|
|
19
27
|
const seriesProcessor = params => {
|
|
20
28
|
const {
|
|
21
29
|
seriesOrder,
|
|
@@ -27,7 +35,7 @@ const seriesProcessor = params => {
|
|
|
27
35
|
const currentSeries = series[seriesId];
|
|
28
36
|
const firstDataPoint = currentSeries.data.at(0);
|
|
29
37
|
const lastDataPoint = currentSeries.data.at(-1);
|
|
30
|
-
const
|
|
38
|
+
const funnelDirection = getFunnelDirection(currentSeries.funnelDirection, currentSeries.curve, firstDataPoint?.value, lastDataPoint?.value);
|
|
31
39
|
completedSeries[seriesId] = _extends({
|
|
32
40
|
labelMarkType: 'square',
|
|
33
41
|
layout: isHorizontal ? 'horizontal' : 'vertical',
|
|
@@ -36,7 +44,7 @@ const seriesProcessor = params => {
|
|
|
36
44
|
data: currentSeries.data.map((v, i) => _extends({
|
|
37
45
|
id: `${seriesId}-funnel-item-${v.id ?? i}`
|
|
38
46
|
}, v)),
|
|
39
|
-
|
|
47
|
+
funnelDirection,
|
|
40
48
|
dataPoints: []
|
|
41
49
|
});
|
|
42
50
|
const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
|
|
@@ -44,54 +52,22 @@ const seriesProcessor = params => {
|
|
|
44
52
|
// Main = main axis, Other = other axis
|
|
45
53
|
// For horizontal layout, main is y, other is x
|
|
46
54
|
// For vertical layout, main is x, other is y
|
|
47
|
-
const isIncreasing = completedSeries[seriesId].
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return dataIndex === 0 ? dataIndex : dataIndex - 1;
|
|
52
|
-
}
|
|
53
|
-
return dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
|
|
54
|
-
};
|
|
55
|
-
const nextDataIndex = getNextDataIndex();
|
|
56
|
-
const nextMaxMain = array[nextDataIndex].value ?? 0;
|
|
57
|
-
const nextMaxOther = 0;
|
|
58
|
-
const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
|
|
59
|
-
const stackOffset = stackOffsets[dataIndex];
|
|
55
|
+
const isIncreasing = completedSeries[seriesId].funnelDirection === 'increasing';
|
|
56
|
+
let currentMaxMain = 0;
|
|
57
|
+
let nextMaxMain = 0;
|
|
58
|
+
let nextDataIndex = 0;
|
|
60
59
|
if (isIncreasing) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
stackOffset
|
|
69
|
-
}),
|
|
70
|
-
// Bottom right (vertical) or Top right (horizontal)
|
|
71
|
-
createPoint({
|
|
72
|
-
main: currentMaxMain,
|
|
73
|
-
other: currentMaxOther,
|
|
74
|
-
inverse: isHorizontal,
|
|
75
|
-
useBandWidth: true,
|
|
76
|
-
stackOffset
|
|
77
|
-
}),
|
|
78
|
-
// Bottom left (vertical) or Bottom right (horizontal)
|
|
79
|
-
createPoint({
|
|
80
|
-
main: -currentMaxMain,
|
|
81
|
-
other: currentMaxOther,
|
|
82
|
-
inverse: isHorizontal,
|
|
83
|
-
useBandWidth: true,
|
|
84
|
-
stackOffset
|
|
85
|
-
}),
|
|
86
|
-
// Top left (vertical) or Bottom left (horizontal)
|
|
87
|
-
createPoint({
|
|
88
|
-
main: -nextMaxMain,
|
|
89
|
-
other: nextMaxOther,
|
|
90
|
-
inverse: isHorizontal,
|
|
91
|
-
useBandWidth: false,
|
|
92
|
-
stackOffset
|
|
93
|
-
})];
|
|
60
|
+
nextDataIndex = dataIndex === 0 ? dataIndex : dataIndex - 1;
|
|
61
|
+
currentMaxMain = array[nextDataIndex].value ?? 0;
|
|
62
|
+
nextMaxMain = item.value;
|
|
63
|
+
} else {
|
|
64
|
+
nextDataIndex = dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
|
|
65
|
+
currentMaxMain = item.value;
|
|
66
|
+
nextMaxMain = array[nextDataIndex].value ?? 0;
|
|
94
67
|
}
|
|
68
|
+
const stackOffset = stackOffsets[dataIndex];
|
|
69
|
+
const nextMaxOther = 0;
|
|
70
|
+
const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
|
|
95
71
|
return [
|
|
96
72
|
// Top right (vertical) or Top left (horizontal)
|
|
97
73
|
createPoint({
|
package/esm/Heatmap/Heatmap.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, Heatm
|
|
|
27
27
|
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps, ChartsLegendSlotProps, ChartsToolbarProSlotProps, Partial<ChartsSlotPropsPro> {
|
|
28
28
|
tooltip?: Partial<HeatmapTooltipProps>;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
30
|
+
export type HeatmapSeries = MakeOptional<HeatmapSeriesType, 'type'>;
|
|
31
|
+
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation' | 'slots' | 'slotProps' | 'experimentalFeatures' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
31
32
|
/**
|
|
32
33
|
* The configuration of the x-axes.
|
|
33
34
|
* If not provided, a default axis config is used.
|
|
@@ -42,9 +43,9 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
42
43
|
yAxis: Readonly<Omit<MakeOptional<YAxis<'band'>, 'scaleType'>, 'zoom'>[]>;
|
|
43
44
|
/**
|
|
44
45
|
* The series to display in the bar chart.
|
|
45
|
-
* An array of [[
|
|
46
|
+
* An array of [[HeatmapSeries]] objects.
|
|
46
47
|
*/
|
|
47
|
-
series: Readonly<
|
|
48
|
+
series: Readonly<HeatmapSeries[]>;
|
|
48
49
|
/**
|
|
49
50
|
* The configuration of the tooltip.
|
|
50
51
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
package/esm/Heatmap/Heatmap.js
CHANGED
|
@@ -239,7 +239,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
239
239
|
onHighlightChange: PropTypes.func,
|
|
240
240
|
/**
|
|
241
241
|
* The series to display in the bar chart.
|
|
242
|
-
* An array of [[
|
|
242
|
+
* An array of [[HeatmapSeries]] objects.
|
|
243
243
|
*/
|
|
244
244
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
245
245
|
/**
|
package/esm/Heatmap/index.d.ts
CHANGED
|
@@ -131,6 +131,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
131
131
|
* If `true`, render the line highlight item.
|
|
132
132
|
*/
|
|
133
133
|
disableLineItemHighlight: PropTypes.bool,
|
|
134
|
+
/**
|
|
135
|
+
* Options to enable features planned for the next major.
|
|
136
|
+
*/
|
|
137
|
+
experimentalFeatures: PropTypes.shape({
|
|
138
|
+
preferStrictDomainInLineCharts: PropTypes.bool
|
|
139
|
+
}),
|
|
134
140
|
/**
|
|
135
141
|
* Option to display a cartesian grid in the background.
|
|
136
142
|
*/
|
|
@@ -146,6 +152,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
146
152
|
* If `true`, the legend is not rendered.
|
|
147
153
|
*/
|
|
148
154
|
hideLegend: PropTypes.bool,
|
|
155
|
+
/**
|
|
156
|
+
* The controlled axis highlight.
|
|
157
|
+
* Identified by the axis id, and data index.
|
|
158
|
+
*/
|
|
159
|
+
highlightedAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
160
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
161
|
+
dataIndex: PropTypes.number.isRequired
|
|
162
|
+
})),
|
|
149
163
|
/**
|
|
150
164
|
* The highlighted item.
|
|
151
165
|
* Used when the highlight is controlled.
|
|
@@ -206,6 +220,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
206
220
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
207
221
|
*/
|
|
208
222
|
onHighlightChange: PropTypes.func,
|
|
223
|
+
/**
|
|
224
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
225
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
226
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
227
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
228
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
229
|
+
*/
|
|
230
|
+
onHighlightedAxisChange: PropTypes.func,
|
|
209
231
|
/**
|
|
210
232
|
* Callback fired when a line element is clicked.
|
|
211
233
|
*/
|
|
@@ -222,7 +244,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
222
244
|
onZoomChange: PropTypes.func,
|
|
223
245
|
/**
|
|
224
246
|
* The series to display in the line chart.
|
|
225
|
-
* An array of [[
|
|
247
|
+
* An array of [[LineSeries]] objects.
|
|
226
248
|
*/
|
|
227
249
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
228
250
|
/**
|
|
@@ -319,6 +341,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
319
341
|
panning: PropTypes.bool,
|
|
320
342
|
slider: PropTypes.shape({
|
|
321
343
|
enabled: PropTypes.bool,
|
|
344
|
+
preview: PropTypes.bool,
|
|
322
345
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
323
346
|
size: PropTypes.number
|
|
324
347
|
}),
|
|
@@ -384,6 +407,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
384
407
|
panning: PropTypes.bool,
|
|
385
408
|
slider: PropTypes.shape({
|
|
386
409
|
enabled: PropTypes.bool,
|
|
410
|
+
preview: PropTypes.bool,
|
|
387
411
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
388
412
|
size: PropTypes.number
|
|
389
413
|
}),
|
|
@@ -444,6 +468,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
444
468
|
panning: PropTypes.bool,
|
|
445
469
|
slider: PropTypes.shape({
|
|
446
470
|
enabled: PropTypes.bool,
|
|
471
|
+
preview: PropTypes.bool,
|
|
447
472
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
448
473
|
size: PropTypes.number
|
|
449
474
|
}),
|
|
@@ -504,6 +529,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
504
529
|
panning: PropTypes.bool,
|
|
505
530
|
slider: PropTypes.shape({
|
|
506
531
|
enabled: PropTypes.bool,
|
|
532
|
+
preview: PropTypes.bool,
|
|
507
533
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
508
534
|
size: PropTypes.number
|
|
509
535
|
}),
|
|
@@ -564,6 +590,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
564
590
|
panning: PropTypes.bool,
|
|
565
591
|
slider: PropTypes.shape({
|
|
566
592
|
enabled: PropTypes.bool,
|
|
593
|
+
preview: PropTypes.bool,
|
|
567
594
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
568
595
|
size: PropTypes.number
|
|
569
596
|
}),
|
|
@@ -624,6 +651,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
624
651
|
panning: PropTypes.bool,
|
|
625
652
|
slider: PropTypes.shape({
|
|
626
653
|
enabled: PropTypes.bool,
|
|
654
|
+
preview: PropTypes.bool,
|
|
627
655
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
628
656
|
size: PropTypes.number
|
|
629
657
|
}),
|
|
@@ -684,6 +712,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
684
712
|
panning: PropTypes.bool,
|
|
685
713
|
slider: PropTypes.shape({
|
|
686
714
|
enabled: PropTypes.bool,
|
|
715
|
+
preview: PropTypes.bool,
|
|
687
716
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
688
717
|
size: PropTypes.number
|
|
689
718
|
}),
|
|
@@ -744,6 +773,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
744
773
|
panning: PropTypes.bool,
|
|
745
774
|
slider: PropTypes.shape({
|
|
746
775
|
enabled: PropTypes.bool,
|
|
776
|
+
preview: PropTypes.bool,
|
|
747
777
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
748
778
|
size: PropTypes.number
|
|
749
779
|
}),
|
|
@@ -816,6 +846,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
816
846
|
panning: PropTypes.bool,
|
|
817
847
|
slider: PropTypes.shape({
|
|
818
848
|
enabled: PropTypes.bool,
|
|
849
|
+
preview: PropTypes.bool,
|
|
819
850
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
820
851
|
size: PropTypes.number
|
|
821
852
|
}),
|
|
@@ -880,6 +911,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
880
911
|
panning: PropTypes.bool,
|
|
881
912
|
slider: PropTypes.shape({
|
|
882
913
|
enabled: PropTypes.bool,
|
|
914
|
+
preview: PropTypes.bool,
|
|
883
915
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
884
916
|
size: PropTypes.number
|
|
885
917
|
}),
|
|
@@ -939,6 +971,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
939
971
|
panning: PropTypes.bool,
|
|
940
972
|
slider: PropTypes.shape({
|
|
941
973
|
enabled: PropTypes.bool,
|
|
974
|
+
preview: PropTypes.bool,
|
|
942
975
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
943
976
|
size: PropTypes.number
|
|
944
977
|
}),
|
|
@@ -998,6 +1031,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
998
1031
|
panning: PropTypes.bool,
|
|
999
1032
|
slider: PropTypes.shape({
|
|
1000
1033
|
enabled: PropTypes.bool,
|
|
1034
|
+
preview: PropTypes.bool,
|
|
1001
1035
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1002
1036
|
size: PropTypes.number
|
|
1003
1037
|
}),
|
|
@@ -1057,6 +1091,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1057
1091
|
panning: PropTypes.bool,
|
|
1058
1092
|
slider: PropTypes.shape({
|
|
1059
1093
|
enabled: PropTypes.bool,
|
|
1094
|
+
preview: PropTypes.bool,
|
|
1060
1095
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1061
1096
|
size: PropTypes.number
|
|
1062
1097
|
}),
|
|
@@ -1116,6 +1151,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1116
1151
|
panning: PropTypes.bool,
|
|
1117
1152
|
slider: PropTypes.shape({
|
|
1118
1153
|
enabled: PropTypes.bool,
|
|
1154
|
+
preview: PropTypes.bool,
|
|
1119
1155
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1120
1156
|
size: PropTypes.number
|
|
1121
1157
|
}),
|
|
@@ -1175,6 +1211,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1175
1211
|
panning: PropTypes.bool,
|
|
1176
1212
|
slider: PropTypes.shape({
|
|
1177
1213
|
enabled: PropTypes.bool,
|
|
1214
|
+
preview: PropTypes.bool,
|
|
1178
1215
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1179
1216
|
size: PropTypes.number
|
|
1180
1217
|
}),
|
|
@@ -1234,6 +1271,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
1234
1271
|
panning: PropTypes.bool,
|
|
1235
1272
|
slider: PropTypes.shape({
|
|
1236
1273
|
enabled: PropTypes.bool,
|
|
1274
|
+
preview: PropTypes.bool,
|
|
1237
1275
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1238
1276
|
size: PropTypes.number
|
|
1239
1277
|
}),
|
|
@@ -6,7 +6,7 @@ import { PieChartProPluginSignatures } from "./PieChartPro.plugins.js";
|
|
|
6
6
|
import { ChartsToolbarProSlotProps, ChartsToolbarProSlots } from "../ChartsToolbarPro/Toolbar.types.js";
|
|
7
7
|
export interface PieChartProSlots extends Omit<PieChartSlots, 'toolbar'>, ChartsToolbarProSlots, Partial<ChartsSlotsPro> {}
|
|
8
8
|
export interface PieChartProSlotProps extends Omit<PieChartSlotProps, 'toolbar'>, ChartsToolbarProSlotProps, Partial<ChartsSlotPropsPro> {}
|
|
9
|
-
export interface PieChartProProps extends Omit<PieChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<ChartContainerProProps<'pie', PieChartProPluginSignatures>, 'series' | 'plugins' | 'seriesConfig' | 'slots' | 'slotProps'> {
|
|
9
|
+
export interface PieChartProProps extends Omit<PieChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<ChartContainerProProps<'pie', PieChartProPluginSignatures>, 'series' | 'plugins' | 'seriesConfig' | 'slots' | 'slotProps' | 'experimentalFeatures'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
@@ -163,7 +163,7 @@ process.env.NODE_ENV !== "production" ? PieChartPro.propTypes = {
|
|
|
163
163
|
onItemClick: PropTypes.func,
|
|
164
164
|
/**
|
|
165
165
|
* The series to display in the pie chart.
|
|
166
|
-
* An array of [[
|
|
166
|
+
* An array of [[PieSeries]] objects.
|
|
167
167
|
*/
|
|
168
168
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
169
169
|
/**
|
|
@@ -5,7 +5,7 @@ import { ChartsToolbarProSlotProps, ChartsToolbarProSlots } from "../ChartsToolb
|
|
|
5
5
|
import { ChartsSlotPropsPro, ChartsSlotsPro } from "../internals/material/index.js";
|
|
6
6
|
export interface RadarChartProSlots extends Omit<RadarChartSlots, 'toolbar'>, ChartsToolbarProSlots, Partial<ChartsSlotsPro> {}
|
|
7
7
|
export interface RadarChartProSlotProps extends Omit<RadarChartSlotProps, 'toolbar'>, ChartsToolbarProSlotProps, Partial<ChartsSlotPropsPro> {}
|
|
8
|
-
export interface RadarChartProProps extends Omit<RadarChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<RadarDataProviderProps<RadarChartProPluginsSignatures>, 'plugins' | 'seriesConfig' | 'slots' | 'slotProps'> {
|
|
8
|
+
export interface RadarChartProProps extends Omit<RadarChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<RadarDataProviderProps<RadarChartProPluginsSignatures>, 'plugins' | 'seriesConfig' | 'slots' | 'slotProps' | 'experimentalFeatures'> {
|
|
9
9
|
/**
|
|
10
10
|
* Overridable component slots.
|
|
11
11
|
* @default {}
|
|
@@ -127,12 +127,31 @@ process.env.NODE_ENV !== "production" ? RadarChartPro.propTypes = {
|
|
|
127
127
|
right: PropTypes.number,
|
|
128
128
|
top: PropTypes.number
|
|
129
129
|
})]),
|
|
130
|
+
/**
|
|
131
|
+
* Callback fired when an area is clicked.
|
|
132
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
133
|
+
* @param {RadarItemIdentifier} radarItemIdentifier The radar item identifier.
|
|
134
|
+
*/
|
|
135
|
+
onAreaClick: PropTypes.func,
|
|
136
|
+
/**
|
|
137
|
+
* The function called for onClick events.
|
|
138
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
139
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
140
|
+
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
141
|
+
*/
|
|
142
|
+
onAxisClick: PropTypes.func,
|
|
130
143
|
/**
|
|
131
144
|
* The callback fired when the highlighted item changes.
|
|
132
145
|
*
|
|
133
146
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
134
147
|
*/
|
|
135
148
|
onHighlightChange: PropTypes.func,
|
|
149
|
+
/**
|
|
150
|
+
* Callback fired when a mark is clicked.
|
|
151
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
152
|
+
* @param {RadarItemIdentifier} radarItemIdentifier The radar item identifier.
|
|
153
|
+
*/
|
|
154
|
+
onMarkClick: PropTypes.func,
|
|
136
155
|
/**
|
|
137
156
|
* The configuration of the radar scales.
|
|
138
157
|
*/
|
|
@@ -149,7 +168,7 @@ process.env.NODE_ENV !== "production" ? RadarChartPro.propTypes = {
|
|
|
149
168
|
}).isRequired,
|
|
150
169
|
/**
|
|
151
170
|
* The series to display in the bar chart.
|
|
152
|
-
* An array of [[
|
|
171
|
+
* An array of [[RadarSeries]] objects.
|
|
153
172
|
*/
|
|
154
173
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
155
174
|
/**
|
|
@@ -6,7 +6,7 @@ import { ScatterChartProPluginsSignatures } from "./ScatterChartPro.plugins.js";
|
|
|
6
6
|
import { ChartsToolbarProSlots, ChartsToolbarProSlotProps } from "../ChartsToolbarPro/Toolbar.types.js";
|
|
7
7
|
export interface ScatterChartProSlots extends Omit<ScatterChartSlots, 'toolbar'>, ChartsToolbarProSlots, Partial<ChartsSlotsPro> {}
|
|
8
8
|
export interface ScatterChartProSlotProps extends Omit<ScatterChartSlotProps, 'toolbar'>, ChartsToolbarProSlotProps, Partial<ChartsSlotPropsPro> {}
|
|
9
|
-
export interface ScatterChartProProps extends Omit<ScatterChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<ChartContainerProProps<'scatter', ScatterChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig' | 'onItemClick' | 'slots' | 'slotProps'> {
|
|
9
|
+
export interface ScatterChartProProps extends Omit<ScatterChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<ChartContainerProProps<'scatter', ScatterChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig' | 'onItemClick' | 'slots' | 'slotProps' | 'experimentalFeatures' | 'highlightedAxis' | 'onHighlightedAxisChange'> {
|
|
10
10
|
/**
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
@@ -211,7 +211,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
211
211
|
onZoomChange: PropTypes.func,
|
|
212
212
|
/**
|
|
213
213
|
* The series to display in the scatter chart.
|
|
214
|
-
* An array of [[
|
|
214
|
+
* An array of [[ScatterSeries]] objects.
|
|
215
215
|
*/
|
|
216
216
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
217
217
|
/**
|
|
@@ -313,6 +313,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
313
313
|
panning: PropTypes.bool,
|
|
314
314
|
slider: PropTypes.shape({
|
|
315
315
|
enabled: PropTypes.bool,
|
|
316
|
+
preview: PropTypes.bool,
|
|
316
317
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
317
318
|
size: PropTypes.number
|
|
318
319
|
}),
|
|
@@ -378,6 +379,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
378
379
|
panning: PropTypes.bool,
|
|
379
380
|
slider: PropTypes.shape({
|
|
380
381
|
enabled: PropTypes.bool,
|
|
382
|
+
preview: PropTypes.bool,
|
|
381
383
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
382
384
|
size: PropTypes.number
|
|
383
385
|
}),
|
|
@@ -438,6 +440,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
438
440
|
panning: PropTypes.bool,
|
|
439
441
|
slider: PropTypes.shape({
|
|
440
442
|
enabled: PropTypes.bool,
|
|
443
|
+
preview: PropTypes.bool,
|
|
441
444
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
442
445
|
size: PropTypes.number
|
|
443
446
|
}),
|
|
@@ -498,6 +501,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
498
501
|
panning: PropTypes.bool,
|
|
499
502
|
slider: PropTypes.shape({
|
|
500
503
|
enabled: PropTypes.bool,
|
|
504
|
+
preview: PropTypes.bool,
|
|
501
505
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
502
506
|
size: PropTypes.number
|
|
503
507
|
}),
|
|
@@ -558,6 +562,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
558
562
|
panning: PropTypes.bool,
|
|
559
563
|
slider: PropTypes.shape({
|
|
560
564
|
enabled: PropTypes.bool,
|
|
565
|
+
preview: PropTypes.bool,
|
|
561
566
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
562
567
|
size: PropTypes.number
|
|
563
568
|
}),
|
|
@@ -618,6 +623,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
618
623
|
panning: PropTypes.bool,
|
|
619
624
|
slider: PropTypes.shape({
|
|
620
625
|
enabled: PropTypes.bool,
|
|
626
|
+
preview: PropTypes.bool,
|
|
621
627
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
622
628
|
size: PropTypes.number
|
|
623
629
|
}),
|
|
@@ -678,6 +684,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
678
684
|
panning: PropTypes.bool,
|
|
679
685
|
slider: PropTypes.shape({
|
|
680
686
|
enabled: PropTypes.bool,
|
|
687
|
+
preview: PropTypes.bool,
|
|
681
688
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
682
689
|
size: PropTypes.number
|
|
683
690
|
}),
|
|
@@ -738,6 +745,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
738
745
|
panning: PropTypes.bool,
|
|
739
746
|
slider: PropTypes.shape({
|
|
740
747
|
enabled: PropTypes.bool,
|
|
748
|
+
preview: PropTypes.bool,
|
|
741
749
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
742
750
|
size: PropTypes.number
|
|
743
751
|
}),
|
|
@@ -810,6 +818,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
810
818
|
panning: PropTypes.bool,
|
|
811
819
|
slider: PropTypes.shape({
|
|
812
820
|
enabled: PropTypes.bool,
|
|
821
|
+
preview: PropTypes.bool,
|
|
813
822
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
814
823
|
size: PropTypes.number
|
|
815
824
|
}),
|
|
@@ -874,6 +883,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
874
883
|
panning: PropTypes.bool,
|
|
875
884
|
slider: PropTypes.shape({
|
|
876
885
|
enabled: PropTypes.bool,
|
|
886
|
+
preview: PropTypes.bool,
|
|
877
887
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
878
888
|
size: PropTypes.number
|
|
879
889
|
}),
|
|
@@ -933,6 +943,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
933
943
|
panning: PropTypes.bool,
|
|
934
944
|
slider: PropTypes.shape({
|
|
935
945
|
enabled: PropTypes.bool,
|
|
946
|
+
preview: PropTypes.bool,
|
|
936
947
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
937
948
|
size: PropTypes.number
|
|
938
949
|
}),
|
|
@@ -992,6 +1003,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
992
1003
|
panning: PropTypes.bool,
|
|
993
1004
|
slider: PropTypes.shape({
|
|
994
1005
|
enabled: PropTypes.bool,
|
|
1006
|
+
preview: PropTypes.bool,
|
|
995
1007
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
996
1008
|
size: PropTypes.number
|
|
997
1009
|
}),
|
|
@@ -1051,6 +1063,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1051
1063
|
panning: PropTypes.bool,
|
|
1052
1064
|
slider: PropTypes.shape({
|
|
1053
1065
|
enabled: PropTypes.bool,
|
|
1066
|
+
preview: PropTypes.bool,
|
|
1054
1067
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1055
1068
|
size: PropTypes.number
|
|
1056
1069
|
}),
|
|
@@ -1110,6 +1123,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1110
1123
|
panning: PropTypes.bool,
|
|
1111
1124
|
slider: PropTypes.shape({
|
|
1112
1125
|
enabled: PropTypes.bool,
|
|
1126
|
+
preview: PropTypes.bool,
|
|
1113
1127
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1114
1128
|
size: PropTypes.number
|
|
1115
1129
|
}),
|
|
@@ -1169,6 +1183,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1169
1183
|
panning: PropTypes.bool,
|
|
1170
1184
|
slider: PropTypes.shape({
|
|
1171
1185
|
enabled: PropTypes.bool,
|
|
1186
|
+
preview: PropTypes.bool,
|
|
1172
1187
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1173
1188
|
size: PropTypes.number
|
|
1174
1189
|
}),
|
|
@@ -1228,6 +1243,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
1228
1243
|
panning: PropTypes.bool,
|
|
1229
1244
|
slider: PropTypes.shape({
|
|
1230
1245
|
enabled: PropTypes.bool,
|
|
1246
|
+
preview: PropTypes.bool,
|
|
1231
1247
|
showTooltip: PropTypes.oneOf(['always', 'hover', 'never']),
|
|
1232
1248
|
size: PropTypes.number
|
|
1233
1249
|
}),
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-pro v8.
|
|
2
|
+
* @mui/x-charts-pro v8.9.0
|
|
3
3
|
*
|
|
4
|
-
* @license
|
|
5
|
-
* This source code is licensed under the
|
|
4
|
+
* @license SEE LICENSE IN LICENSE
|
|
5
|
+
* This source code is licensed under the SEE LICENSE IN LICENSE license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import "./typeOverloads/modules.js";
|
|
@@ -15,7 +15,9 @@ export async function exportImage(element, params) {
|
|
|
15
15
|
const {
|
|
16
16
|
fileName,
|
|
17
17
|
type = 'image/png',
|
|
18
|
-
quality = 0.9
|
|
18
|
+
quality = 0.9,
|
|
19
|
+
onBeforeExport,
|
|
20
|
+
copyStyles = true
|
|
19
21
|
} = params ?? {};
|
|
20
22
|
const drawDocumentPromise = getDrawDocument();
|
|
21
23
|
const {
|
|
@@ -43,11 +45,15 @@ export async function exportImage(element, params) {
|
|
|
43
45
|
exportDoc.body.style.margin = '0px';
|
|
44
46
|
const rootCandidate = element.getRootNode();
|
|
45
47
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
46
|
-
|
|
48
|
+
if (copyStyles) {
|
|
49
|
+
await Promise.all(loadStyleSheets(exportDoc, root));
|
|
50
|
+
}
|
|
47
51
|
resolve();
|
|
48
52
|
};
|
|
49
53
|
doc.body.appendChild(iframe);
|
|
50
|
-
|
|
54
|
+
await iframeLoadPromise;
|
|
55
|
+
await onBeforeExport?.(iframe);
|
|
56
|
+
const drawDocument = await drawDocumentPromise;
|
|
51
57
|
try {
|
|
52
58
|
await drawDocument(iframe.contentDocument, canvas, {
|
|
53
59
|
// Handle retina displays: https://github.com/cburgmer/rasterizeHTML.js/blob/262b3404d1c469ce4a7750a2976dec09b8ae2d6c/examples/retina.html#L71
|
|
@@ -2,7 +2,9 @@ import ownerDocument from '@mui/utils/ownerDocument';
|
|
|
2
2
|
import { loadStyleSheets } from '@mui/x-internals/export';
|
|
3
3
|
import { createExportIframe } from "./common.js";
|
|
4
4
|
export function printChart(element, {
|
|
5
|
-
fileName
|
|
5
|
+
fileName,
|
|
6
|
+
onBeforeExport,
|
|
7
|
+
copyStyles = true
|
|
6
8
|
} = {}) {
|
|
7
9
|
const printWindow = createExportIframe(fileName);
|
|
8
10
|
const doc = ownerDocument(element);
|
|
@@ -14,7 +16,9 @@ export function printChart(element, {
|
|
|
14
16
|
printDoc.body.innerHTML = container.innerHTML;
|
|
15
17
|
const rootCandidate = element.getRootNode();
|
|
16
18
|
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc;
|
|
17
|
-
|
|
19
|
+
if (copyStyles) {
|
|
20
|
+
await Promise.all(loadStyleSheets(printDoc, root));
|
|
21
|
+
}
|
|
18
22
|
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
19
23
|
mediaQueryList.addEventListener('change', mql => {
|
|
20
24
|
const isAfterPrint = mql.matches === false;
|
|
@@ -22,6 +26,7 @@ export function printChart(element, {
|
|
|
22
26
|
doc.body.removeChild(printWindow);
|
|
23
27
|
}
|
|
24
28
|
});
|
|
29
|
+
await onBeforeExport?.(printWindow);
|
|
25
30
|
printWindow.contentWindow.print();
|
|
26
31
|
};
|
|
27
32
|
doc.body.appendChild(printWindow);
|
|
@@ -4,29 +4,39 @@ export type UseChartProExportDefaultizedParameters = UseChartProExportParameters
|
|
|
4
4
|
export interface UseChartProExportState {
|
|
5
5
|
export: {};
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
* The options to apply on the Print export.
|
|
9
|
-
* @demos
|
|
10
|
-
* - [Print export](https://mui.com/x/react-charts/export/#print-export-as-pdf)
|
|
11
|
-
*/
|
|
12
|
-
export interface ChartPrintExportOptions {
|
|
7
|
+
export interface ChartExportOptions {
|
|
13
8
|
/**
|
|
14
9
|
* The name of the file without the extension.
|
|
15
10
|
* @default The title of the document the chart belongs to
|
|
16
11
|
*/
|
|
17
12
|
fileName?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Callback function that is called before the export is triggered.
|
|
15
|
+
* It can be used to modify the iframe or perform any other actions before the export, such as updating styles,
|
|
16
|
+
* removing elements, etc.
|
|
17
|
+
* @param {HTMLIFrameElement} iframe containing the chart to be exported.
|
|
18
|
+
* @returns {Promise<void> | void} A promise or void. If a promise is returned, the export will wait for it to resolve before proceeding.
|
|
19
|
+
*/
|
|
20
|
+
onBeforeExport?: (iframe: HTMLIFrameElement) => Promise<void> | void;
|
|
21
|
+
/**
|
|
22
|
+
* If `true`, the styles of the page the chart belongs to will be copied to the export iframe.
|
|
23
|
+
* Copying styles is useful to ensure that the exported chart looks the same as it does on the page.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
copyStyles?: boolean;
|
|
18
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The options to apply on the Print export.
|
|
30
|
+
* @demos
|
|
31
|
+
* - [Print export](https://mui.com/x/react-charts/export/#print-export-as-pdf)
|
|
32
|
+
*/
|
|
33
|
+
export interface ChartPrintExportOptions extends ChartExportOptions {}
|
|
19
34
|
/**
|
|
20
35
|
* The options to apply on the image export.
|
|
21
36
|
* @demos
|
|
22
37
|
* - [Image export](https://mui.com/x/react-charts/export/#export-as-image)
|
|
23
38
|
*/
|
|
24
|
-
export interface ChartImageExportOptions {
|
|
25
|
-
/**
|
|
26
|
-
* The name of the file without the extension.
|
|
27
|
-
* @default The title of the document the chart belongs to
|
|
28
|
-
*/
|
|
29
|
-
fileName?: string;
|
|
39
|
+
export interface ChartImageExportOptions extends ChartExportOptions {
|
|
30
40
|
/**
|
|
31
41
|
* The format of the image to be exported.
|
|
32
42
|
* Browsers are required to support 'image/png'. Some browsers also support 'image/jpeg' and 'image/webp'.
|