@mui/x-charts-pro 8.7.0 → 8.8.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 +32 -0
- package/CHANGELOG.md +98 -0
- 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 +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/seriesConfig/seriesProcessor.js +24 -48
- package/Heatmap/Heatmap.d.ts +1 -1
- package/LineChartPro/LineChartPro.js +38 -0
- package/PieChartPro/PieChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.js +16 -0
- package/esm/BarChartPro/BarChartPro.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.js +32 -0
- 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 +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/seriesConfig/seriesProcessor.js +24 -48
- package/esm/Heatmap/Heatmap.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.js +38 -0
- package/esm/PieChartPro/PieChartPro.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +16 -0
- package/esm/index.js +1 -1
- 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 +1 -1
- 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 +6 -6
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ChartAxisZoomSliderPreviewContent = ChartAxisZoomSliderPreviewContent;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _internals = require("@mui/x-charts/internals");
|
|
12
|
+
var _LinePreviewPlot = require("./previews/LinePreviewPlot");
|
|
13
|
+
var _AreaPreviewPlot = require("./previews/AreaPreviewPlot");
|
|
14
|
+
var _BarPreviewPlot = require("./previews/BarPreviewPlot");
|
|
15
|
+
var _ScatterPreviewPlot = require("./previews/ScatterPreviewPlot");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function ChartAxisZoomSliderPreviewContent(props) {
|
|
18
|
+
const {
|
|
19
|
+
axisId,
|
|
20
|
+
x,
|
|
21
|
+
y,
|
|
22
|
+
width,
|
|
23
|
+
height
|
|
24
|
+
} = props;
|
|
25
|
+
const store = (0, _internals.useStore)();
|
|
26
|
+
const processedSeries = (0, _internals.useSelector)(store, _internals.selectorChartSeriesProcessed);
|
|
27
|
+
const children = [];
|
|
28
|
+
const clipId = `zoom-preview-mask-${axisId}`;
|
|
29
|
+
const hasLineSeries = (processedSeries.line?.seriesOrder?.length ?? 0) > 0;
|
|
30
|
+
const hasBarSeries = (processedSeries.bar?.seriesOrder?.length ?? 0) > 0;
|
|
31
|
+
const hasScatterSeries = (processedSeries.scatter?.seriesOrder?.length ?? 0) > 0;
|
|
32
|
+
if (hasLineSeries) {
|
|
33
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPreviewPlot.AreaPreviewPlot, {
|
|
34
|
+
axisId: axisId
|
|
35
|
+
}, "area"));
|
|
36
|
+
}
|
|
37
|
+
if (hasBarSeries) {
|
|
38
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPreviewPlot.BarPreviewPlot, (0, _extends2.default)({}, props), "bar"));
|
|
39
|
+
}
|
|
40
|
+
if (hasLineSeries) {
|
|
41
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePreviewPlot.LinePreviewPlot, {
|
|
42
|
+
axisId: axisId
|
|
43
|
+
}, "line"));
|
|
44
|
+
}
|
|
45
|
+
if (hasScatterSeries) {
|
|
46
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPreviewPlot.ScatterPreviewPlot, (0, _extends2.default)({}, props), "scatter"));
|
|
47
|
+
}
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
49
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
50
|
+
id: clipId,
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
52
|
+
x: x,
|
|
53
|
+
y: y,
|
|
54
|
+
width: width,
|
|
55
|
+
height: height
|
|
56
|
+
})
|
|
57
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
58
|
+
clipPath: `url(#${clipId})`,
|
|
59
|
+
children: children
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AreaPreviewPlot = AreaPreviewPlot;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _internals = require("@mui/x-charts/internals");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const _excluded = ["id", "color", "gradientId", "onClick"];
|
|
16
|
+
const AreaPlotRoot = (0, _styles.styled)('g', {
|
|
17
|
+
name: 'MuiAreaPlot',
|
|
18
|
+
slot: 'Root'
|
|
19
|
+
})();
|
|
20
|
+
function AreaPreviewPlot({
|
|
21
|
+
axisId
|
|
22
|
+
}) {
|
|
23
|
+
const completedData = useAreaPreviewData(axisId);
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AreaPlotRoot, {
|
|
25
|
+
children: completedData.map(({
|
|
26
|
+
d,
|
|
27
|
+
seriesId,
|
|
28
|
+
color,
|
|
29
|
+
area,
|
|
30
|
+
gradientId
|
|
31
|
+
}) => !!area && /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewAreaElement, {
|
|
32
|
+
id: seriesId,
|
|
33
|
+
d: d,
|
|
34
|
+
color: color,
|
|
35
|
+
gradientId: gradientId
|
|
36
|
+
}, seriesId))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Preview of the area element for the zoom preview.
|
|
41
|
+
* Based on AreaElement and AnimatedArea.
|
|
42
|
+
*/
|
|
43
|
+
function PreviewAreaElement(_ref) {
|
|
44
|
+
let {
|
|
45
|
+
id,
|
|
46
|
+
color,
|
|
47
|
+
gradientId
|
|
48
|
+
} = _ref,
|
|
49
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
51
|
+
fill: gradientId ? `url(#${gradientId})` : color,
|
|
52
|
+
stroke: "none",
|
|
53
|
+
"data-series": id
|
|
54
|
+
}, other));
|
|
55
|
+
}
|
|
56
|
+
function useAreaPreviewData(axisId) {
|
|
57
|
+
const store = (0, _internals.useStore)();
|
|
58
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
59
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
60
|
+
return (0, _internals.useAreaPlotData)(xAxes, yAxes);
|
|
61
|
+
}
|
|
@@ -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,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.BarPreviewPlot = BarPreviewPlot;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _internals = require("@mui/x-charts/internals");
|
|
10
|
+
var _BarChart = require("@mui/x-charts/BarChart");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function BarPreviewPlot(props) {
|
|
13
|
+
const drawingArea = {
|
|
14
|
+
left: props.x,
|
|
15
|
+
top: props.y,
|
|
16
|
+
width: props.width,
|
|
17
|
+
height: props.height,
|
|
18
|
+
right: props.x + props.width,
|
|
19
|
+
bottom: props.y + props.height
|
|
20
|
+
};
|
|
21
|
+
const {
|
|
22
|
+
completedData
|
|
23
|
+
} = useBarPreviewData(props.axisId, drawingArea);
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
25
|
+
children: completedData.map(({
|
|
26
|
+
seriesId,
|
|
27
|
+
data
|
|
28
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
29
|
+
children: data.map(({
|
|
30
|
+
dataIndex,
|
|
31
|
+
color,
|
|
32
|
+
layout,
|
|
33
|
+
x,
|
|
34
|
+
xOrigin,
|
|
35
|
+
y,
|
|
36
|
+
yOrigin,
|
|
37
|
+
width,
|
|
38
|
+
height
|
|
39
|
+
}) => {
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarElement, {
|
|
41
|
+
id: seriesId,
|
|
42
|
+
dataIndex: dataIndex,
|
|
43
|
+
color: color,
|
|
44
|
+
skipAnimation: true,
|
|
45
|
+
layout: layout ?? 'vertical',
|
|
46
|
+
x: x,
|
|
47
|
+
xOrigin: xOrigin,
|
|
48
|
+
y: y,
|
|
49
|
+
yOrigin: yOrigin,
|
|
50
|
+
width: width,
|
|
51
|
+
height: height
|
|
52
|
+
}, dataIndex);
|
|
53
|
+
})
|
|
54
|
+
}, seriesId))
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function useBarPreviewData(axisId, drawingArea) {
|
|
58
|
+
const store = (0, _internals.useStore)();
|
|
59
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
60
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
61
|
+
return (0, _internals.useBarPlotData)(drawingArea, xAxes, yAxes);
|
|
62
|
+
}
|
|
@@ -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,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.LinePreviewPlot = LinePreviewPlot;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _internals = require("@mui/x-charts/internals");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
const _excluded = ["id", "color", "gradientId", "onClick"];
|
|
15
|
+
function LinePreviewPlot({
|
|
16
|
+
axisId
|
|
17
|
+
}) {
|
|
18
|
+
const completedData = useLinePreviewData(axisId);
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
20
|
+
children: completedData.map(({
|
|
21
|
+
d,
|
|
22
|
+
seriesId,
|
|
23
|
+
color,
|
|
24
|
+
gradientId
|
|
25
|
+
}) => {
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewLineElement, {
|
|
27
|
+
id: seriesId,
|
|
28
|
+
d: d,
|
|
29
|
+
color: color,
|
|
30
|
+
gradientId: gradientId
|
|
31
|
+
}, seriesId);
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Preview of the line element for the zoom preview.
|
|
37
|
+
* Based on LineElement and AnimatedLine.
|
|
38
|
+
*/
|
|
39
|
+
function PreviewLineElement(_ref) {
|
|
40
|
+
let {
|
|
41
|
+
id,
|
|
42
|
+
color,
|
|
43
|
+
gradientId
|
|
44
|
+
} = _ref,
|
|
45
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
47
|
+
stroke: gradientId ? `url(#${gradientId})` : color,
|
|
48
|
+
strokeWidth: 2,
|
|
49
|
+
strokeLinejoin: "round",
|
|
50
|
+
fill: "none",
|
|
51
|
+
"data-series": id
|
|
52
|
+
}, other));
|
|
53
|
+
}
|
|
54
|
+
function useLinePreviewData(axisId) {
|
|
55
|
+
const store = (0, _internals.useStore)();
|
|
56
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
57
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
58
|
+
return (0, _internals.useLinePlotData)(xAxes, yAxes);
|
|
59
|
+
}
|
|
@@ -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,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ScatterPreviewPlot = ScatterPreviewPlot;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _internals = require("@mui/x-charts/internals");
|
|
10
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
11
|
+
var _ScatterChart = require("@mui/x-charts/ScatterChart");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function ScatterPreviewPlot({
|
|
14
|
+
axisId,
|
|
15
|
+
x,
|
|
16
|
+
y,
|
|
17
|
+
height,
|
|
18
|
+
width
|
|
19
|
+
}) {
|
|
20
|
+
const store = (0, _internals.useStore)();
|
|
21
|
+
const seriesData = (0, _hooks.useScatterSeriesContext)();
|
|
22
|
+
const xAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedXAxis, [axisId]);
|
|
23
|
+
const yAxes = (0, _internals.useSelector)(store, _internals.selectorChartPreviewComputedYAxis, [axisId]);
|
|
24
|
+
const defaultXAxisId = (0, _hooks.useXAxes)().xAxisIds[0];
|
|
25
|
+
const defaultYAxisId = (0, _hooks.useYAxes)().yAxisIds[0];
|
|
26
|
+
const {
|
|
27
|
+
zAxis: zAxes,
|
|
28
|
+
zAxisIds
|
|
29
|
+
} = (0, _hooks.useZAxes)();
|
|
30
|
+
const defaultZAxisId = zAxisIds[0];
|
|
31
|
+
if (seriesData === undefined) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const {
|
|
35
|
+
series,
|
|
36
|
+
seriesOrder
|
|
37
|
+
} = seriesData;
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
39
|
+
children: seriesOrder.map(seriesId => {
|
|
40
|
+
const {
|
|
41
|
+
id,
|
|
42
|
+
xAxisId,
|
|
43
|
+
yAxisId,
|
|
44
|
+
zAxisId,
|
|
45
|
+
color
|
|
46
|
+
} = series[seriesId];
|
|
47
|
+
const colorGetter = _internals.scatterSeriesConfig.colorProcessor(series[seriesId], xAxes[xAxisId ?? defaultXAxisId], yAxes[yAxisId ?? defaultYAxisId], zAxes[zAxisId ?? defaultZAxisId]);
|
|
48
|
+
const xScale = xAxes[xAxisId ?? defaultXAxisId].scale;
|
|
49
|
+
const yScale = yAxes[yAxisId ?? defaultYAxisId].scale;
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterPreviewItems, {
|
|
51
|
+
xScale: xScale,
|
|
52
|
+
yScale: yScale,
|
|
53
|
+
color: color,
|
|
54
|
+
colorGetter: colorGetter,
|
|
55
|
+
series: series[seriesId],
|
|
56
|
+
x: x,
|
|
57
|
+
y: y,
|
|
58
|
+
height: height,
|
|
59
|
+
width: width
|
|
60
|
+
}, id);
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function ScatterPreviewItems(props) {
|
|
65
|
+
const {
|
|
66
|
+
series,
|
|
67
|
+
xScale,
|
|
68
|
+
yScale,
|
|
69
|
+
color,
|
|
70
|
+
colorGetter,
|
|
71
|
+
x,
|
|
72
|
+
y,
|
|
73
|
+
width,
|
|
74
|
+
height
|
|
75
|
+
} = props;
|
|
76
|
+
const isPointInside = React.useCallback((px, py) => px >= x && px <= x + width && py >= y && py <= y + height, [height, width, x, y]);
|
|
77
|
+
const scatterPlotData = (0, _internals.useScatterPlotData)(series, xScale, yScale, isPointInside);
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
79
|
+
"data-series": series.id,
|
|
80
|
+
children: scatterPlotData.map((dataPoint, i) => {
|
|
81
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterChart.ScatterMarker, {
|
|
82
|
+
dataIndex: dataPoint.dataIndex,
|
|
83
|
+
color: colorGetter ? colorGetter(i) : color,
|
|
84
|
+
x: dataPoint.x,
|
|
85
|
+
y: dataPoint.y,
|
|
86
|
+
seriesId: series.id,
|
|
87
|
+
size: series.preview.markerSize,
|
|
88
|
+
isHighlighted: false,
|
|
89
|
+
isFaded: false
|
|
90
|
+
}, dataPoint.id ?? dataPoint.dataIndex);
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -64,7 +64,9 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarImageExportTrigger.propType
|
|
|
64
64
|
* - [Export as Image](https://mui.com/x/react-charts/export/#export-as-image)
|
|
65
65
|
*/
|
|
66
66
|
options: _propTypes.default.shape({
|
|
67
|
+
copyStyles: _propTypes.default.bool,
|
|
67
68
|
fileName: _propTypes.default.string,
|
|
69
|
+
onBeforeExport: _propTypes.default.func,
|
|
68
70
|
quality: _propTypes.default.number,
|
|
69
71
|
type: _propTypes.default.string.isRequired
|
|
70
72
|
}),
|
|
@@ -64,7 +64,9 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPrintExportTrigger.propType
|
|
|
64
64
|
* - [Print/Export as PDF](https://mui.com/x/react-charts/export/#print-export-as-pdf)
|
|
65
65
|
*/
|
|
66
66
|
options: _propTypes.default.shape({
|
|
67
|
-
|
|
67
|
+
copyStyles: _propTypes.default.bool,
|
|
68
|
+
fileName: _propTypes.default.string,
|
|
69
|
+
onBeforeExport: _propTypes.default.func
|
|
68
70
|
}),
|
|
69
71
|
/**
|
|
70
72
|
* A function to customize the rendering of the component.
|
|
@@ -158,7 +158,9 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
|
|
|
158
158
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
159
159
|
// ----------------------------------------------------------------------
|
|
160
160
|
imageExportOptions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
161
|
+
copyStyles: _propTypes.default.bool,
|
|
161
162
|
fileName: _propTypes.default.string,
|
|
163
|
+
onBeforeExport: _propTypes.default.func,
|
|
162
164
|
quality: _propTypes.default.number,
|
|
163
165
|
type: _propTypes.default.string.isRequired
|
|
164
166
|
})),
|
|
@@ -8,7 +8,7 @@ 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 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
12
|
/**
|
|
13
13
|
* The series to display in the funnel chart.
|
|
14
14
|
* An array of [[FunnelSeriesType]] objects.
|
|
@@ -94,7 +94,7 @@ const useAggregatedData = () => {
|
|
|
94
94
|
seriesId,
|
|
95
95
|
value: currentSeries.data[dataIndex].value
|
|
96
96
|
}) : currentSeries.sectionLabel;
|
|
97
|
-
const isIncreasing = currentSeries.
|
|
97
|
+
const isIncreasing = currentSeries.funnelDirection === 'increasing';
|
|
98
98
|
const curve = (0, _curves.getFunnelCurve)(currentSeries.curve, {
|
|
99
99
|
isHorizontal,
|
|
100
100
|
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;
|