@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.
Files changed (96) hide show
  1. package/BarChartPro/BarChartPro.d.ts +1 -1
  2. package/BarChartPro/BarChartPro.js +33 -1
  3. package/CHANGELOG.md +199 -24
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +7 -1
  5. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -16
  6. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +4 -0
  7. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +27 -12
  8. package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +18 -0
  9. package/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +102 -0
  10. package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +11 -0
  11. package/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.js +62 -0
  12. package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +14 -0
  13. package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +61 -0
  14. package/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +10 -0
  15. package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +62 -0
  16. package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +14 -0
  17. package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +59 -0
  18. package/ChartZoomSlider/internals/previews/PreviewPlot.types.d.ts +4 -0
  19. package/ChartZoomSlider/internals/previews/PreviewPlot.types.js +5 -0
  20. package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +16 -0
  21. package/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +93 -0
  22. package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -0
  23. package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +3 -1
  24. package/ChartsToolbarPro/ChartsToolbarPro.js +2 -0
  25. package/FunnelChart/FunnelChart.d.ts +4 -3
  26. package/FunnelChart/FunnelChart.js +1 -1
  27. package/FunnelChart/FunnelPlot.js +1 -1
  28. package/FunnelChart/funnel.types.d.ts +14 -9
  29. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +1 -1
  30. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
  31. package/FunnelChart/index.d.ts +1 -1
  32. package/FunnelChart/seriesConfig/seriesProcessor.js +24 -48
  33. package/Heatmap/Heatmap.d.ts +4 -3
  34. package/Heatmap/Heatmap.js +1 -1
  35. package/Heatmap/index.d.ts +1 -0
  36. package/LineChartPro/LineChartPro.js +39 -1
  37. package/PieChartPro/PieChartPro.d.ts +1 -1
  38. package/PieChartPro/PieChartPro.js +1 -1
  39. package/RadarChartPro/RadarChartPro.d.ts +1 -1
  40. package/RadarChartPro/RadarChartPro.js +20 -1
  41. package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
  42. package/ScatterChartPro/ScatterChartPro.js +17 -1
  43. package/esm/BarChartPro/BarChartPro.d.ts +1 -1
  44. package/esm/BarChartPro/BarChartPro.js +33 -1
  45. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +7 -1
  46. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +33 -18
  47. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +4 -0
  48. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +28 -13
  49. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.d.ts +18 -0
  50. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreview.js +94 -0
  51. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.d.ts +11 -0
  52. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderPreviewContent.js +54 -0
  53. package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +14 -0
  54. package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +53 -0
  55. package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.d.ts +10 -0
  56. package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +55 -0
  57. package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +14 -0
  58. package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +51 -0
  59. package/esm/ChartZoomSlider/internals/previews/PreviewPlot.types.d.ts +4 -0
  60. package/esm/ChartZoomSlider/internals/previews/PreviewPlot.types.js +1 -0
  61. package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +16 -0
  62. package/esm/ChartZoomSlider/internals/previews/ScatterPreviewPlot.js +86 -0
  63. package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +2 -0
  64. package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +3 -1
  65. package/esm/ChartsToolbarPro/ChartsToolbarPro.js +2 -0
  66. package/esm/FunnelChart/FunnelChart.d.ts +4 -3
  67. package/esm/FunnelChart/FunnelChart.js +1 -1
  68. package/esm/FunnelChart/FunnelPlot.js +1 -1
  69. package/esm/FunnelChart/funnel.types.d.ts +14 -9
  70. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +1 -1
  71. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
  72. package/esm/FunnelChart/index.d.ts +1 -1
  73. package/esm/FunnelChart/seriesConfig/seriesProcessor.js +24 -48
  74. package/esm/Heatmap/Heatmap.d.ts +4 -3
  75. package/esm/Heatmap/Heatmap.js +1 -1
  76. package/esm/Heatmap/index.d.ts +1 -0
  77. package/esm/LineChartPro/LineChartPro.js +39 -1
  78. package/esm/PieChartPro/PieChartPro.d.ts +1 -1
  79. package/esm/PieChartPro/PieChartPro.js +1 -1
  80. package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
  81. package/esm/RadarChartPro/RadarChartPro.js +20 -1
  82. package/esm/ScatterChartPro/ScatterChartPro.d.ts +1 -1
  83. package/esm/ScatterChartPro/ScatterChartPro.js +17 -1
  84. package/esm/index.js +3 -3
  85. package/esm/internals/plugins/useChartProExport/exportImage.js +9 -3
  86. package/esm/internals/plugins/useChartProExport/print.d.ts +3 -1
  87. package/esm/internals/plugins/useChartProExport/print.js +7 -2
  88. package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +22 -12
  89. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
  90. package/index.js +3 -3
  91. package/internals/plugins/useChartProExport/exportImage.js +9 -3
  92. package/internals/plugins/useChartProExport/print.d.ts +3 -1
  93. package/internals/plugins/useChartProExport/print.js +7 -2
  94. package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +22 -12
  95. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +4 -4
  96. package/package.json +7 -7
@@ -0,0 +1,94 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["axisId", "axisDirection", "reverse"];
4
+ import * as React from 'react';
5
+ import { styled } from '@mui/material/styles';
6
+ import { selectorChartAxisZoomOptionsLookup, useSelector, useStore } from '@mui/x-charts/internals';
7
+ import { alpha } from '@mui/system';
8
+ import useId from '@mui/utils/useId';
9
+ import { selectorChartAxisZoomData } from "../../internals/plugins/useChartProZoom/index.js";
10
+ import { ChartAxisZoomSliderPreviewContent } from "./ChartAxisZoomSliderPreviewContent.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const PreviewBackgroundRect = styled('rect')(({
13
+ theme
14
+ }) => ({
15
+ rx: 4,
16
+ ry: 4,
17
+ stroke: theme.palette.grey[700],
18
+ fill: alpha(theme.palette.grey[700], 0.4)
19
+ }));
20
+ export function ChartAxisZoomSliderPreview(_ref) {
21
+ let {
22
+ axisId,
23
+ axisDirection
24
+ } = _ref,
25
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
26
+ return /*#__PURE__*/_jsxs("g", _extends({}, props, {
27
+ children: [/*#__PURE__*/_jsx(PreviewRectangles, _extends({}, props, {
28
+ axisId: axisId,
29
+ axisDirection: axisDirection
30
+ })), /*#__PURE__*/_jsx("rect", _extends({}, props, {
31
+ fill: "transparent",
32
+ rx: 4,
33
+ ry: 4
34
+ })), /*#__PURE__*/_jsx(ChartAxisZoomSliderPreviewContent, _extends({
35
+ axisId: axisId
36
+ }, props))]
37
+ }));
38
+ }
39
+ function PreviewRectangles(props) {
40
+ const {
41
+ axisId,
42
+ axisDirection
43
+ } = props;
44
+ const store = useStore();
45
+ const zoomData = useSelector(store, selectorChartAxisZoomData, [axisId]);
46
+ const zoomOptions = useSelector(store, selectorChartAxisZoomOptionsLookup, [axisId]);
47
+ const id = useId();
48
+ if (!zoomData) {
49
+ return null;
50
+ }
51
+ const maskId = `zoom-preview-mask-${axisId}-${id}`;
52
+ let x;
53
+ let y;
54
+ let width;
55
+ let height;
56
+ const range = zoomOptions.maxEnd - zoomOptions.minStart;
57
+ if (axisDirection === 'x') {
58
+ x = props.x + (zoomData.start - zoomOptions.minStart) / range * props.width;
59
+ y = props.y;
60
+ width = (zoomData.end - zoomData.start) / range * props.width;
61
+ height = props.height;
62
+ } else {
63
+ x = props.x;
64
+ y = props.y + (1 - zoomData.end / range) * props.height;
65
+ width = props.width;
66
+ height = (zoomData.end - zoomData.start) / range * props.height;
67
+ }
68
+ return /*#__PURE__*/_jsxs(React.Fragment, {
69
+ children: [/*#__PURE__*/_jsxs("mask", {
70
+ id: maskId,
71
+ children: [/*#__PURE__*/_jsx("rect", {
72
+ x: props.x,
73
+ y: props.y,
74
+ width: props.width,
75
+ height: props.height,
76
+ fill: "white"
77
+ }), /*#__PURE__*/_jsx("rect", {
78
+ x: x,
79
+ y: y,
80
+ width: width,
81
+ height: height,
82
+ fill: "black",
83
+ rx: 4,
84
+ ry: 4
85
+ })]
86
+ }), /*#__PURE__*/_jsx(PreviewBackgroundRect, {
87
+ x: props.x,
88
+ y: props.y,
89
+ width: props.width,
90
+ height: props.height,
91
+ mask: `url(#${maskId})`
92
+ })]
93
+ });
94
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { AxisId } from '@mui/x-charts/internals';
3
+ interface ChartAxisZoomSliderPreviewContentProps {
4
+ axisId: AxisId;
5
+ x: number;
6
+ y: number;
7
+ height: number;
8
+ width: number;
9
+ }
10
+ export declare function ChartAxisZoomSliderPreviewContent(props: ChartAxisZoomSliderPreviewContentProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,54 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { selectorChartSeriesProcessed, useSelector, useStore } from '@mui/x-charts/internals';
4
+ import { LinePreviewPlot } from "./previews/LinePreviewPlot.js";
5
+ import { AreaPreviewPlot } from "./previews/AreaPreviewPlot.js";
6
+ import { BarPreviewPlot } from "./previews/BarPreviewPlot.js";
7
+ import { ScatterPreviewPlot } from "./previews/ScatterPreviewPlot.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export function ChartAxisZoomSliderPreviewContent(props) {
10
+ const {
11
+ axisId,
12
+ x,
13
+ y,
14
+ width,
15
+ height
16
+ } = props;
17
+ const store = useStore();
18
+ const processedSeries = useSelector(store, selectorChartSeriesProcessed);
19
+ const children = [];
20
+ const clipId = `zoom-preview-mask-${axisId}`;
21
+ const hasLineSeries = (processedSeries.line?.seriesOrder?.length ?? 0) > 0;
22
+ const hasBarSeries = (processedSeries.bar?.seriesOrder?.length ?? 0) > 0;
23
+ const hasScatterSeries = (processedSeries.scatter?.seriesOrder?.length ?? 0) > 0;
24
+ if (hasLineSeries) {
25
+ children.push(/*#__PURE__*/_jsx(AreaPreviewPlot, {
26
+ axisId: axisId
27
+ }, "area"));
28
+ }
29
+ if (hasBarSeries) {
30
+ children.push(/*#__PURE__*/_jsx(BarPreviewPlot, _extends({}, props), "bar"));
31
+ }
32
+ if (hasLineSeries) {
33
+ children.push(/*#__PURE__*/_jsx(LinePreviewPlot, {
34
+ axisId: axisId
35
+ }, "line"));
36
+ }
37
+ if (hasScatterSeries) {
38
+ children.push(/*#__PURE__*/_jsx(ScatterPreviewPlot, _extends({}, props), "scatter"));
39
+ }
40
+ return /*#__PURE__*/_jsxs(React.Fragment, {
41
+ children: [/*#__PURE__*/_jsx("clipPath", {
42
+ id: clipId,
43
+ children: /*#__PURE__*/_jsx("rect", {
44
+ x: x,
45
+ y: y,
46
+ width: width,
47
+ height: height
48
+ })
49
+ }), /*#__PURE__*/_jsx("g", {
50
+ clipPath: `url(#${clipId})`,
51
+ children: children
52
+ })]
53
+ });
54
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import { SeriesId } from '@mui/x-charts/internals';
3
+ import { PreviewPlotProps } from "./PreviewPlot.types.js";
4
+ interface AreaPreviewPlotProps extends PreviewPlotProps {}
5
+ export declare function AreaPreviewPlot({
6
+ axisId
7
+ }: AreaPreviewPlotProps): React.JSX.Element;
8
+ export interface PreviewAreaElementProps extends Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
9
+ id: SeriesId;
10
+ gradientId?: string;
11
+ color: string;
12
+ d: string;
13
+ }
14
+ export {};
@@ -0,0 +1,53 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["id", "color", "gradientId", "onClick"];
4
+ import * as React from 'react';
5
+ import { styled } from '@mui/material/styles';
6
+ import { useSelector, useStore, useAreaPlotData, selectorChartPreviewComputedXAxis, selectorChartPreviewComputedYAxis } from '@mui/x-charts/internals';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const AreaPlotRoot = styled('g', {
9
+ name: 'MuiAreaPlot',
10
+ slot: 'Root'
11
+ })();
12
+ export function AreaPreviewPlot({
13
+ axisId
14
+ }) {
15
+ const completedData = useAreaPreviewData(axisId);
16
+ return /*#__PURE__*/_jsx(AreaPlotRoot, {
17
+ children: completedData.map(({
18
+ d,
19
+ seriesId,
20
+ color,
21
+ area,
22
+ gradientId
23
+ }) => !!area && /*#__PURE__*/_jsx(PreviewAreaElement, {
24
+ id: seriesId,
25
+ d: d,
26
+ color: color,
27
+ gradientId: gradientId
28
+ }, seriesId))
29
+ });
30
+ }
31
+ /**
32
+ * Preview of the area element for the zoom preview.
33
+ * Based on AreaElement and AnimatedArea.
34
+ */
35
+ function PreviewAreaElement(_ref) {
36
+ let {
37
+ id,
38
+ color,
39
+ gradientId
40
+ } = _ref,
41
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
42
+ return /*#__PURE__*/_jsx("path", _extends({
43
+ fill: gradientId ? `url(#${gradientId})` : color,
44
+ stroke: "none",
45
+ "data-series": id
46
+ }, other));
47
+ }
48
+ function useAreaPreviewData(axisId) {
49
+ const store = useStore();
50
+ const xAxes = useSelector(store, selectorChartPreviewComputedXAxis, [axisId]);
51
+ const yAxes = useSelector(store, selectorChartPreviewComputedYAxis, [axisId]);
52
+ return useAreaPlotData(xAxes, yAxes);
53
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { PreviewPlotProps } from "./PreviewPlot.types.js";
3
+ interface BarPreviewPlotProps extends PreviewPlotProps {
4
+ x: number;
5
+ y: number;
6
+ height: number;
7
+ width: number;
8
+ }
9
+ export declare function BarPreviewPlot(props: BarPreviewPlotProps): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,55 @@
1
+ import * as React from 'react';
2
+ import { selectorChartPreviewComputedXAxis, selectorChartPreviewComputedYAxis, useBarPlotData, useSelector, useStore } from '@mui/x-charts/internals';
3
+ import { BarElement } from '@mui/x-charts/BarChart';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export function BarPreviewPlot(props) {
6
+ const drawingArea = {
7
+ left: props.x,
8
+ top: props.y,
9
+ width: props.width,
10
+ height: props.height,
11
+ right: props.x + props.width,
12
+ bottom: props.y + props.height
13
+ };
14
+ const {
15
+ completedData
16
+ } = useBarPreviewData(props.axisId, drawingArea);
17
+ return /*#__PURE__*/_jsx("g", {
18
+ children: completedData.map(({
19
+ seriesId,
20
+ data
21
+ }) => /*#__PURE__*/_jsx("g", {
22
+ children: data.map(({
23
+ dataIndex,
24
+ color,
25
+ layout,
26
+ x,
27
+ xOrigin,
28
+ y,
29
+ yOrigin,
30
+ width,
31
+ height
32
+ }) => {
33
+ return /*#__PURE__*/_jsx(BarElement, {
34
+ id: seriesId,
35
+ dataIndex: dataIndex,
36
+ color: color,
37
+ skipAnimation: true,
38
+ layout: layout ?? 'vertical',
39
+ x: x,
40
+ xOrigin: xOrigin,
41
+ y: y,
42
+ yOrigin: yOrigin,
43
+ width: width,
44
+ height: height
45
+ }, dataIndex);
46
+ })
47
+ }, seriesId))
48
+ });
49
+ }
50
+ function useBarPreviewData(axisId, drawingArea) {
51
+ const store = useStore();
52
+ const xAxes = useSelector(store, selectorChartPreviewComputedXAxis, [axisId]);
53
+ const yAxes = useSelector(store, selectorChartPreviewComputedYAxis, [axisId]);
54
+ return useBarPlotData(drawingArea, xAxes, yAxes);
55
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import { SeriesId } from '@mui/x-charts/internals';
3
+ import { PreviewPlotProps } from "./PreviewPlot.types.js";
4
+ interface LinePreviewPlotProps extends PreviewPlotProps {}
5
+ export declare function LinePreviewPlot({
6
+ axisId
7
+ }: LinePreviewPlotProps): React.JSX.Element;
8
+ export interface PreviewLineElementProps extends Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
9
+ id: SeriesId;
10
+ gradientId?: string;
11
+ color: string;
12
+ d: string;
13
+ }
14
+ export {};
@@ -0,0 +1,51 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["id", "color", "gradientId", "onClick"];
4
+ import * as React from 'react';
5
+ import { useSelector, useStore, useLinePlotData, selectorChartPreviewComputedXAxis, selectorChartPreviewComputedYAxis } from '@mui/x-charts/internals';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export function LinePreviewPlot({
8
+ axisId
9
+ }) {
10
+ const completedData = useLinePreviewData(axisId);
11
+ return /*#__PURE__*/_jsx("g", {
12
+ children: completedData.map(({
13
+ d,
14
+ seriesId,
15
+ color,
16
+ gradientId
17
+ }) => {
18
+ return /*#__PURE__*/_jsx(PreviewLineElement, {
19
+ id: seriesId,
20
+ d: d,
21
+ color: color,
22
+ gradientId: gradientId
23
+ }, seriesId);
24
+ })
25
+ });
26
+ }
27
+ /**
28
+ * Preview of the line element for the zoom preview.
29
+ * Based on LineElement and AnimatedLine.
30
+ */
31
+ function PreviewLineElement(_ref) {
32
+ let {
33
+ id,
34
+ color,
35
+ gradientId
36
+ } = _ref,
37
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
38
+ return /*#__PURE__*/_jsx("path", _extends({
39
+ stroke: gradientId ? `url(#${gradientId})` : color,
40
+ strokeWidth: 2,
41
+ strokeLinejoin: "round",
42
+ fill: "none",
43
+ "data-series": id
44
+ }, other));
45
+ }
46
+ function useLinePreviewData(axisId) {
47
+ const store = useStore();
48
+ const xAxes = useSelector(store, selectorChartPreviewComputedXAxis, [axisId]);
49
+ const yAxes = useSelector(store, selectorChartPreviewComputedYAxis, [axisId]);
50
+ return useLinePlotData(xAxes, yAxes);
51
+ }
@@ -0,0 +1,4 @@
1
+ import { AxisId } from '@mui/x-charts/internals';
2
+ export interface PreviewPlotProps {
3
+ axisId: AxisId;
4
+ }
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { PreviewPlotProps } from "./PreviewPlot.types.js";
3
+ interface ScatterPreviewPlotProps extends PreviewPlotProps {
4
+ x: number;
5
+ y: number;
6
+ height: number;
7
+ width: number;
8
+ }
9
+ export declare function ScatterPreviewPlot({
10
+ axisId,
11
+ x,
12
+ y,
13
+ height,
14
+ width
15
+ }: ScatterPreviewPlotProps): React.JSX.Element | null;
16
+ export {};
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ import { useSelector, useStore, useScatterPlotData, scatterSeriesConfig, selectorChartPreviewComputedXAxis, selectorChartPreviewComputedYAxis } from '@mui/x-charts/internals';
3
+ import { useScatterSeriesContext, useXAxes, useYAxes, useZAxes } from '@mui/x-charts/hooks';
4
+ import { ScatterMarker } from '@mui/x-charts/ScatterChart';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export function ScatterPreviewPlot({
7
+ axisId,
8
+ x,
9
+ y,
10
+ height,
11
+ width
12
+ }) {
13
+ const store = useStore();
14
+ const seriesData = useScatterSeriesContext();
15
+ const xAxes = useSelector(store, selectorChartPreviewComputedXAxis, [axisId]);
16
+ const yAxes = useSelector(store, selectorChartPreviewComputedYAxis, [axisId]);
17
+ const defaultXAxisId = useXAxes().xAxisIds[0];
18
+ const defaultYAxisId = useYAxes().yAxisIds[0];
19
+ const {
20
+ zAxis: zAxes,
21
+ zAxisIds
22
+ } = useZAxes();
23
+ const defaultZAxisId = zAxisIds[0];
24
+ if (seriesData === undefined) {
25
+ return null;
26
+ }
27
+ const {
28
+ series,
29
+ seriesOrder
30
+ } = seriesData;
31
+ return /*#__PURE__*/_jsx(React.Fragment, {
32
+ children: seriesOrder.map(seriesId => {
33
+ const {
34
+ id,
35
+ xAxisId,
36
+ yAxisId,
37
+ zAxisId,
38
+ color
39
+ } = series[seriesId];
40
+ const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxes[xAxisId ?? defaultXAxisId], yAxes[yAxisId ?? defaultYAxisId], zAxes[zAxisId ?? defaultZAxisId]);
41
+ const xScale = xAxes[xAxisId ?? defaultXAxisId].scale;
42
+ const yScale = yAxes[yAxisId ?? defaultYAxisId].scale;
43
+ return /*#__PURE__*/_jsx(ScatterPreviewItems, {
44
+ xScale: xScale,
45
+ yScale: yScale,
46
+ color: color,
47
+ colorGetter: colorGetter,
48
+ series: series[seriesId],
49
+ x: x,
50
+ y: y,
51
+ height: height,
52
+ width: width
53
+ }, id);
54
+ })
55
+ });
56
+ }
57
+ function ScatterPreviewItems(props) {
58
+ const {
59
+ series,
60
+ xScale,
61
+ yScale,
62
+ color,
63
+ colorGetter,
64
+ x,
65
+ y,
66
+ width,
67
+ height
68
+ } = props;
69
+ const isPointInside = React.useCallback((px, py) => px >= x && px <= x + width && py >= y && py <= y + height, [height, width, x, y]);
70
+ const scatterPlotData = useScatterPlotData(series, xScale, yScale, isPointInside);
71
+ return /*#__PURE__*/_jsx("g", {
72
+ "data-series": series.id,
73
+ children: scatterPlotData.map((dataPoint, i) => {
74
+ return /*#__PURE__*/_jsx(ScatterMarker, {
75
+ dataIndex: dataPoint.dataIndex,
76
+ color: colorGetter ? colorGetter(i) : color,
77
+ x: dataPoint.x,
78
+ y: dataPoint.y,
79
+ seriesId: series.id,
80
+ size: series.preview.markerSize,
81
+ isHighlighted: false,
82
+ isFaded: false
83
+ }, dataPoint.id ?? dataPoint.dataIndex);
84
+ })
85
+ });
86
+ }
@@ -56,7 +56,9 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarImageExportTrigger.propType
56
56
  * - [Export as Image](https://mui.com/x/react-charts/export/#export-as-image)
57
57
  */
58
58
  options: PropTypes.shape({
59
+ copyStyles: PropTypes.bool,
59
60
  fileName: PropTypes.string,
61
+ onBeforeExport: PropTypes.func,
60
62
  quality: PropTypes.number,
61
63
  type: PropTypes.string.isRequired
62
64
  }),
@@ -56,7 +56,9 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPrintExportTrigger.propType
56
56
  * - [Print/Export as PDF](https://mui.com/x/react-charts/export/#print-export-as-pdf)
57
57
  */
58
58
  options: PropTypes.shape({
59
- fileName: PropTypes.string
59
+ copyStyles: PropTypes.bool,
60
+ fileName: PropTypes.string,
61
+ onBeforeExport: PropTypes.func
60
62
  }),
61
63
  /**
62
64
  * A function to customize the rendering of the component.
@@ -151,7 +151,9 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
151
151
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
152
152
  // ----------------------------------------------------------------------
153
153
  imageExportOptions: PropTypes.arrayOf(PropTypes.shape({
154
+ copyStyles: PropTypes.bool,
154
155
  fileName: PropTypes.string,
156
+ onBeforeExport: PropTypes.func,
155
157
  quality: PropTypes.number,
156
158
  type: PropTypes.string.isRequired
157
159
  })),
@@ -8,12 +8,13 @@ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
8
8
  import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
9
9
  import { CategoryAxis } from "./categoryAxis.types.js";
10
10
  import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
11
- export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel', FunnelChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis' | 'slots' | 'slotProps'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
11
+ export type FunnelSeries = MakeOptional<FunnelSeriesType, 'type'>;
12
+ export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel', FunnelChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis' | 'slots' | 'slotProps' | 'experimentalFeatures'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
12
13
  /**
13
14
  * The series to display in the funnel chart.
14
- * An array of [[FunnelSeriesType]] objects.
15
+ * An array of [[FunnelSeries]] objects.
15
16
  */
16
- series: Readonly<MakeOptional<FunnelSeriesType, 'type'>[]>;
17
+ series: Readonly<FunnelSeries[]>;
17
18
  /**
18
19
  * The configuration of the category axis.
19
20
  *
@@ -234,7 +234,7 @@ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
234
234
  onItemClick: PropTypes.func,
235
235
  /**
236
236
  * The series to display in the funnel chart.
237
- * An array of [[FunnelSeriesType]] objects.
237
+ * An array of [[FunnelSeries]] objects.
238
238
  */
239
239
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
240
240
  /**
@@ -86,7 +86,7 @@ const useAggregatedData = () => {
86
86
  seriesId,
87
87
  value: currentSeries.data[dataIndex].value
88
88
  }) : currentSeries.sectionLabel;
89
- const isIncreasing = currentSeries.dataDirection === 'increasing';
89
+ const isIncreasing = currentSeries.funnelDirection === 'increasing';
90
90
  const curve = getFunnelCurve(currentSeries.curve, {
91
91
  isHorizontal,
92
92
  gap,
@@ -16,7 +16,7 @@ export type FunnelValueType = {
16
16
  /**
17
17
  * The label to display on the tooltip, funnel section, or the legend. It can be a string or a function.
18
18
  */
19
- label?: string | ((location: 'tooltip' | 'legend' | 'section') => string);
19
+ label?: string | ((location: 'tooltip' | 'legend' | 'section') => string | undefined);
20
20
  /**
21
21
  * The color of the funnel section
22
22
  */
@@ -78,6 +78,17 @@ export interface FunnelSeriesType extends Omit<CommonSeriesType<FunnelValueType>
78
78
  * @default 'filled'
79
79
  */
80
80
  variant?: 'filled' | 'outlined';
81
+ /**
82
+ * Controls how the funnel is drawn.
83
+ * Ignored on `step` and `linear-sharp` curves.
84
+ *
85
+ * This affects different curves in different ways:
86
+ * - `bump` & `linear`: Controls which section is the "starting" point of the funnel. This section has straight edges.
87
+ * - `pyramid` & `step-pyramid`: Fully changes the direction of the shape.
88
+ *
89
+ * @default 'auto'
90
+ */
91
+ funnelDirection?: 'increasing' | 'decreasing' | 'auto';
81
92
  }
82
93
  /**
83
94
  * An object that allows to identify a funnel item.
@@ -108,16 +119,10 @@ export type FunnelItem = {
108
119
  */
109
120
  value: number;
110
121
  };
111
- export interface DefaultizedFunnelSeriesType extends DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'> {
122
+ export interface DefaultizedFunnelSeriesType extends Omit<DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'>, 'funnelDirection'> {
112
123
  dataPoints: FunnelDataPoints[][];
113
124
  data: Readonly<MakeRequired<FunnelValueType, 'id' | 'color'>[]>;
114
- /**
115
- * Denotes if the data is increasing, first data point is less than the last data point.
116
- * While the data is decreasing if the first data point is greater than the last data point.
117
- *
118
- * This is used to determine the direction of the funnel.
119
- */
120
- dataDirection: 'increasing' | 'decreasing';
125
+ funnelDirection: 'increasing' | 'decreasing';
121
126
  }
122
127
  export type FunnelDataPoints = Record<'x' | 'y', number> & {
123
128
  useBandWidth: boolean;
@@ -1,6 +1,6 @@
1
1
  import { ChartPluginSignature, UseChartCartesianAxisDefaultizedParameters, UseChartCartesianAxisParameters, UseChartCartesianAxisState, UseChartInteractionSignature, UseChartSeriesSignature, ChartsAxisData } from '@mui/x-charts/internals';
2
2
  export type UseChartFunnelAxisSignature = ChartPluginSignature<{
3
- params: Omit<UseChartCartesianAxisParameters, 'onAxisClick'> & {
3
+ params: Omit<UseChartCartesianAxisParameters, 'onAxisClick' | 'onHighlightedAxisChange' | 'highlightedAxis'> & {
4
4
  /**
5
5
  * The gap, in pixels, between funnel sections.
6
6
  * @default 0
@@ -3,7 +3,7 @@ import { UseChartFunnelAxisSignature } from "./useChartFunnelAxis.types.js";
3
3
  export declare const selectorFunnel: (state: ChartState<[], [UseChartFunnelAxisSignature]>) => {
4
4
  gap: number;
5
5
  } | undefined;
6
- export declare const selectorFunnelGap: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<Pick<import("@mui/x-charts/internals").UseChartCartesianAxisState, "cartesianAxis"> & {
6
+ export declare const selectorFunnelGap: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<Pick<import("@mui/x-charts/internals").UseChartCartesianAxisState, "cartesianAxis"> & {
7
7
  funnel: {
8
8
  gap: number;
9
9
  };
@@ -12,7 +12,7 @@ export declare const selectorFunnelGap: import("reselect").Selector<import("@mui
12
12
  } & {
13
13
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
14
14
  }, number, []>;
15
- export declare const selectorChartXAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
15
+ export declare const selectorChartXAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
16
16
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
17
17
  } & Partial<{}> & {
18
18
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
@@ -33,7 +33,7 @@ export declare const selectorChartXAxis: import("reselect").Selector<import("@mu
33
33
  }> & {
34
34
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
35
35
  }, import("./computeAxisValue.js").ComputeResult<import("@mui/x-charts").ChartsXAxisProps>, []>;
36
- export declare const selectorChartYAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
36
+ export declare const selectorChartYAxis: import("reselect").Selector<import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
37
37
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
38
38
  } & Partial<{}> & {
39
39
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
@@ -1,5 +1,5 @@
1
1
  export { FunnelChart as Unstable_FunnelChart } from "./FunnelChart.js";
2
- export type { FunnelChartProps } from "./FunnelChart.js";
2
+ export type { FunnelChartProps, FunnelSeries } from "./FunnelChart.js";
3
3
  export * from "./FunnelPlot.js";
4
4
  export * from "./funnel.types.js";
5
5
  export * from "./categoryAxis.types.js";