@mui/x-charts-pro 8.5.0 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.js +1 -1
- package/CHANGELOG.md +112 -0
- package/ChartContainerPro/ChartProApi.d.ts +2 -0
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +0 -2
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +41 -9
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +0 -22
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +1 -4
- package/ChartsToolbarPro/ChartsToolbarPro.js +7 -13
- package/ChartsToolbarPro/{ChartsToolbarZoomInButton.d.ts → ChartsToolbarZoomInTrigger.d.ts} +6 -5
- package/ChartsToolbarPro/{ChartsToolbarZoomInButton.js → ChartsToolbarZoomInTrigger.js} +7 -6
- package/ChartsToolbarPro/{ChartsToolbarZoomOutButton.d.ts → ChartsToolbarZoomOutTrigger.d.ts} +6 -5
- package/ChartsToolbarPro/{ChartsToolbarZoomOutButton.js → ChartsToolbarZoomOutTrigger.js} +7 -6
- package/ChartsToolbarPro/index.d.ts +2 -2
- package/ChartsToolbarPro/index.js +8 -8
- package/FunnelChart/FunnelPlot.js +10 -22
- package/FunnelChart/FunnelSection.d.ts +1 -1
- package/FunnelChart/FunnelSectionLabel.d.ts +21 -0
- package/FunnelChart/FunnelSectionLabel.js +52 -0
- package/FunnelChart/curves/bump.d.ts +10 -4
- package/FunnelChart/curves/bump.js +73 -41
- package/FunnelChart/curves/curve.types.d.ts +6 -1
- package/FunnelChart/curves/getFunnelCurve.js +3 -0
- package/FunnelChart/curves/linear.d.ts +9 -1
- package/FunnelChart/curves/linear.js +82 -5
- package/FunnelChart/funnel.types.d.ts +1 -0
- package/FunnelChart/funnelPlotSlots.types.d.ts +11 -0
- package/FunnelChart/funnelSectionClasses.d.ts +2 -0
- package/FunnelChart/funnelSectionClasses.js +17 -4
- package/FunnelChart/index.d.ts +3 -1
- package/FunnelChart/index.js +18 -2
- package/Heatmap/Heatmap.d.ts +5 -0
- package/Heatmap/Heatmap.js +10 -2
- package/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +1 -1
- package/LineChartPro/LineChartPro.js +1 -1
- package/PieChartPro/PieChartPro.d.ts +21 -0
- package/PieChartPro/PieChartPro.js +204 -0
- package/PieChartPro/PieChartPro.plugins.d.ts +4 -0
- package/PieChartPro/PieChartPro.plugins.js +9 -0
- package/PieChartPro/index.d.ts +1 -0
- package/PieChartPro/index.js +16 -0
- package/RadarChartPro/RadarChartPro.js +1 -1
- package/ScatterChartPro/ScatterChartPro.js +1 -1
- package/esm/BarChartPro/BarChartPro.js +1 -1
- package/esm/ChartContainerPro/ChartProApi.d.ts +2 -0
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +0 -2
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +42 -10
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +0 -22
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +1 -4
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +8 -14
- package/esm/ChartsToolbarPro/{ChartsToolbarZoomInButton.d.ts → ChartsToolbarZoomInTrigger.d.ts} +6 -5
- package/esm/ChartsToolbarPro/{ChartsToolbarZoomInButton.js → ChartsToolbarZoomInTrigger.js} +8 -7
- package/esm/ChartsToolbarPro/{ChartsToolbarZoomOutButton.d.ts → ChartsToolbarZoomOutTrigger.d.ts} +6 -5
- package/esm/ChartsToolbarPro/{ChartsToolbarZoomOutButton.js → ChartsToolbarZoomOutTrigger.js} +8 -7
- package/esm/ChartsToolbarPro/index.d.ts +2 -2
- package/esm/ChartsToolbarPro/index.js +2 -2
- package/esm/FunnelChart/FunnelPlot.js +10 -22
- package/esm/FunnelChart/FunnelSection.d.ts +1 -1
- package/esm/FunnelChart/FunnelSectionLabel.d.ts +21 -0
- package/esm/FunnelChart/FunnelSectionLabel.js +46 -0
- package/esm/FunnelChart/curves/bump.d.ts +10 -4
- package/esm/FunnelChart/curves/bump.js +73 -41
- package/esm/FunnelChart/curves/curve.types.d.ts +6 -1
- package/esm/FunnelChart/curves/getFunnelCurve.js +3 -0
- package/esm/FunnelChart/curves/linear.d.ts +9 -1
- package/esm/FunnelChart/curves/linear.js +82 -5
- package/esm/FunnelChart/funnel.types.d.ts +1 -0
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +11 -0
- package/esm/FunnelChart/funnelSectionClasses.d.ts +2 -0
- package/esm/FunnelChart/funnelSectionClasses.js +15 -3
- package/esm/FunnelChart/index.d.ts +3 -1
- package/esm/FunnelChart/index.js +3 -1
- package/esm/Heatmap/Heatmap.d.ts +5 -0
- package/esm/Heatmap/Heatmap.js +10 -2
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.js +1 -1
- package/esm/PieChartPro/PieChartPro.d.ts +21 -0
- package/esm/PieChartPro/PieChartPro.js +197 -0
- package/esm/PieChartPro/PieChartPro.plugins.d.ts +4 -0
- package/esm/PieChartPro/PieChartPro.plugins.js +3 -0
- package/esm/PieChartPro/index.d.ts +1 -0
- package/esm/PieChartPro/index.js +1 -0
- package/esm/RadarChartPro/RadarChartPro.js +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/package.json +7 -7
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.FunnelSectionLabel = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _internals = require("@mui/x-charts/internals");
|
|
15
|
+
var _funnelSectionClasses = require("./funnelSectionClasses");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const _excluded = ["classes", "color", "onClick", "className", "label", "seriesId", "dataIndex"];
|
|
18
|
+
/**
|
|
19
|
+
* @ignore - internal component.
|
|
20
|
+
*/
|
|
21
|
+
const FunnelSectionLabel = exports.FunnelSectionLabel = (0, _internals.consumeSlots)('MuiFunnelSectionLabel', 'funnelSectionLabel', {
|
|
22
|
+
classesResolver: _funnelSectionClasses.useLabelUtilityClasses
|
|
23
|
+
}, /*#__PURE__*/React.forwardRef(function FunnelSectionLabel(props, ref) {
|
|
24
|
+
const {
|
|
25
|
+
classes,
|
|
26
|
+
label
|
|
27
|
+
} = props,
|
|
28
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
29
|
+
const theme = (0, _styles.useTheme)();
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("text", (0, _extends2.default)({
|
|
31
|
+
stroke: "none",
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
fontFamily: theme.typography.body2.fontFamily,
|
|
34
|
+
fontSize: theme.typography.body2.fontSize,
|
|
35
|
+
fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
|
|
36
|
+
fontWeight: theme.typography.body2.fontWeight,
|
|
37
|
+
letterSpacing: theme.typography.body2.letterSpacing,
|
|
38
|
+
fontStretch: theme.typography.body2.fontStretch,
|
|
39
|
+
fontStyle: theme.typography.body2.fontStyle,
|
|
40
|
+
fontVariant: theme.typography.body2.fontVariant,
|
|
41
|
+
fill: (theme.vars || theme)?.palette?.text?.primary,
|
|
42
|
+
className: classes?.label,
|
|
43
|
+
x: label.x,
|
|
44
|
+
y: label.y,
|
|
45
|
+
textAnchor: label.textAnchor ?? 'middle',
|
|
46
|
+
dominantBaseline: label.dominantBaseline ?? 'central'
|
|
47
|
+
}, other, {
|
|
48
|
+
ref: ref,
|
|
49
|
+
children: label.value
|
|
50
|
+
}));
|
|
51
|
+
}));
|
|
52
|
+
if (process.env.NODE_ENV !== "production") FunnelSectionLabel.displayName = "FunnelSectionLabel";
|
|
@@ -10,18 +10,24 @@ import { CurveOptions } from "./curve.types.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class Bump implements CurveGenerator {
|
|
12
12
|
private context;
|
|
13
|
-
private x;
|
|
14
|
-
private y;
|
|
15
|
-
private currentPoint;
|
|
16
13
|
private isHorizontal;
|
|
17
14
|
private gap;
|
|
15
|
+
private min;
|
|
16
|
+
private max;
|
|
17
|
+
private points;
|
|
18
18
|
constructor(context: CanvasRenderingContext2D, {
|
|
19
19
|
isHorizontal,
|
|
20
|
-
gap
|
|
20
|
+
gap,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
isIncreasing
|
|
21
24
|
}: CurveOptions);
|
|
22
25
|
areaStart(): void;
|
|
23
26
|
areaEnd(): void;
|
|
24
27
|
lineStart(): void;
|
|
25
28
|
lineEnd(): void;
|
|
26
29
|
point(x: number, y: number): void;
|
|
30
|
+
private drawPath;
|
|
31
|
+
private drawHorizontalPath;
|
|
32
|
+
private drawVerticalPath;
|
|
27
33
|
}
|
|
@@ -17,65 +17,97 @@ exports.Bump = void 0;
|
|
|
17
17
|
class Bump {
|
|
18
18
|
constructor(context, {
|
|
19
19
|
isHorizontal,
|
|
20
|
-
gap
|
|
20
|
+
gap,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
isIncreasing
|
|
21
24
|
}) {
|
|
22
25
|
this.context = void 0;
|
|
23
|
-
this.x = NaN;
|
|
24
|
-
this.y = NaN;
|
|
25
|
-
this.currentPoint = 0;
|
|
26
26
|
this.isHorizontal = false;
|
|
27
27
|
this.gap = 0;
|
|
28
|
+
this.min = {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0
|
|
31
|
+
};
|
|
32
|
+
this.max = {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0
|
|
35
|
+
};
|
|
36
|
+
this.points = [];
|
|
28
37
|
this.context = context;
|
|
29
38
|
this.isHorizontal = isHorizontal ?? false;
|
|
30
39
|
this.gap = (gap ?? 0) / 2;
|
|
40
|
+
this.min = min ?? {
|
|
41
|
+
x: 0,
|
|
42
|
+
y: 0
|
|
43
|
+
};
|
|
44
|
+
this.max = max ?? {
|
|
45
|
+
x: 0,
|
|
46
|
+
y: 0
|
|
47
|
+
};
|
|
48
|
+
if (isIncreasing) {
|
|
49
|
+
const currentMin = this.min;
|
|
50
|
+
const currentMax = this.max;
|
|
51
|
+
this.min = currentMax;
|
|
52
|
+
this.max = currentMin;
|
|
53
|
+
}
|
|
31
54
|
}
|
|
32
55
|
areaStart() {}
|
|
33
56
|
areaEnd() {}
|
|
34
57
|
lineStart() {}
|
|
35
58
|
lineEnd() {}
|
|
36
59
|
point(x, y) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (this.
|
|
42
|
-
if (this.currentPoint === 0) {
|
|
43
|
-
this.context.moveTo(x + this.gap, y);
|
|
44
|
-
this.context.lineTo(x + this.gap, y);
|
|
45
|
-
} else if (this.currentPoint === 1) {
|
|
46
|
-
this.context.bezierCurveTo((this.x + x) / 2, this.y, (this.x + x) / 2, y, x - this.gap, y);
|
|
47
|
-
} else if (this.currentPoint === 2) {
|
|
48
|
-
this.context.lineTo(x - this.gap, y);
|
|
49
|
-
} else {
|
|
50
|
-
this.context.bezierCurveTo((this.x + x) / 2, this.y, (this.x + x) / 2, y, x + this.gap, y);
|
|
51
|
-
}
|
|
52
|
-
if (this.currentPoint === 3) {
|
|
53
|
-
this.context.closePath();
|
|
54
|
-
}
|
|
55
|
-
this.currentPoint += 1;
|
|
56
|
-
this.x = x;
|
|
57
|
-
this.y = y;
|
|
60
|
+
this.points.push({
|
|
61
|
+
x,
|
|
62
|
+
y
|
|
63
|
+
});
|
|
64
|
+
if (this.points.length < 4) {
|
|
58
65
|
return;
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.context.bezierCurveTo(this.x, (this.y + y) / 2, x, (this.y + y) / 2, x, y - this.gap);
|
|
68
|
-
} else if (this.currentPoint === 2) {
|
|
69
|
-
this.context.lineTo(x, y - this.gap);
|
|
68
|
+
// Draw the path using bezier curves
|
|
69
|
+
this.drawPath();
|
|
70
|
+
}
|
|
71
|
+
drawPath() {
|
|
72
|
+
if (this.isHorizontal) {
|
|
73
|
+
this.drawHorizontalPath();
|
|
70
74
|
} else {
|
|
71
|
-
this.
|
|
72
|
-
}
|
|
73
|
-
if (this.currentPoint === 3) {
|
|
74
|
-
this.context.closePath();
|
|
75
|
+
this.drawVerticalPath();
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
}
|
|
78
|
+
drawHorizontalPath() {
|
|
79
|
+
const [p0, p1, p2, p3] = this.points;
|
|
80
|
+
|
|
81
|
+
// 0 is the top-left corner
|
|
82
|
+
this.context.moveTo(p0.x + this.gap, p0.y);
|
|
83
|
+
this.context.lineTo(p0.x + this.gap, p0.y);
|
|
84
|
+
|
|
85
|
+
// Bezier curve to point 1
|
|
86
|
+
this.context.bezierCurveTo((p0.x + p1.x) / 2, p0.y, (p0.x + p1.x) / 2, p1.y, p1.x - this.gap, p1.y);
|
|
87
|
+
|
|
88
|
+
// Line to point 2
|
|
89
|
+
this.context.lineTo(p2.x - this.gap, p2.y);
|
|
90
|
+
|
|
91
|
+
// Bezier curve back to point 3
|
|
92
|
+
this.context.bezierCurveTo((p2.x + p3.x) / 2, p2.y, (p2.x + p3.x) / 2, p3.y, p3.x + this.gap, p3.y);
|
|
93
|
+
this.context.closePath();
|
|
94
|
+
}
|
|
95
|
+
drawVerticalPath() {
|
|
96
|
+
const [p0, p1, p2, p3] = this.points;
|
|
97
|
+
|
|
98
|
+
// 0 is the top-right corner
|
|
99
|
+
this.context.moveTo(p0.x, p0.y + this.gap);
|
|
100
|
+
this.context.lineTo(p0.x, p0.y + this.gap);
|
|
101
|
+
|
|
102
|
+
// Bezier curve to point 1
|
|
103
|
+
this.context.bezierCurveTo(p0.x, (p0.y + p1.y) / 2, p1.x, (p0.y + p1.y) / 2, p1.x, p1.y - this.gap);
|
|
104
|
+
|
|
105
|
+
// Line to point 2
|
|
106
|
+
this.context.lineTo(p2.x, p2.y - this.gap);
|
|
107
|
+
|
|
108
|
+
// Bezier curve back to point 3
|
|
109
|
+
this.context.bezierCurveTo(p2.x, (p2.y + p3.y) / 2, p3.x, (p2.y + p3.y) / 2, p3.x, p3.y + this.gap);
|
|
110
|
+
this.context.closePath();
|
|
79
111
|
}
|
|
80
112
|
}
|
|
81
113
|
exports.Bump = Bump;
|
|
@@ -34,8 +34,13 @@ export type CurveOptions = {
|
|
|
34
34
|
* The maximum point for all the segments.
|
|
35
35
|
*/
|
|
36
36
|
max?: Point;
|
|
37
|
+
/**
|
|
38
|
+
* The shape of the point of the funnel for the curves that support it.
|
|
39
|
+
*/
|
|
40
|
+
pointShape?: FunnelPointShape;
|
|
37
41
|
};
|
|
38
|
-
export type FunnelCurveType = 'linear' | 'step' | 'bump' | 'pyramid' | 'step-pyramid';
|
|
42
|
+
export type FunnelCurveType = 'linear' | 'linear-sharp' | 'step' | 'bump' | 'pyramid' | 'step-pyramid';
|
|
43
|
+
export type FunnelPointShape = 'square' | 'sharp';
|
|
39
44
|
export type Point = {
|
|
40
45
|
x: number;
|
|
41
46
|
y: number;
|
|
@@ -25,6 +25,9 @@ const curveConstructor = curve => {
|
|
|
25
25
|
return _linear.Linear;
|
|
26
26
|
};
|
|
27
27
|
const getFunnelCurve = (curve, options) => {
|
|
28
|
+
if (curve === 'linear-sharp') {
|
|
29
|
+
options.pointShape = 'sharp';
|
|
30
|
+
}
|
|
28
31
|
return context => new (curveConstructor(curve))(context, options);
|
|
29
32
|
};
|
|
30
33
|
exports.getFunnelCurve = getFunnelCurve;
|
|
@@ -13,15 +13,23 @@ export declare class Linear implements CurveGenerator {
|
|
|
13
13
|
private position;
|
|
14
14
|
private sections;
|
|
15
15
|
private isHorizontal;
|
|
16
|
+
private isIncreasing;
|
|
16
17
|
private gap;
|
|
17
18
|
private borderRadius;
|
|
19
|
+
private min;
|
|
20
|
+
private max;
|
|
18
21
|
private points;
|
|
22
|
+
private pointShape;
|
|
19
23
|
constructor(context: CanvasRenderingContext2D, {
|
|
20
24
|
isHorizontal,
|
|
21
25
|
gap,
|
|
22
26
|
position,
|
|
23
27
|
sections,
|
|
24
|
-
borderRadius
|
|
28
|
+
borderRadius,
|
|
29
|
+
min,
|
|
30
|
+
max,
|
|
31
|
+
isIncreasing,
|
|
32
|
+
pointShape
|
|
25
33
|
}: CurveOptions);
|
|
26
34
|
areaStart(): void;
|
|
27
35
|
areaEnd(): void;
|
|
@@ -22,21 +22,51 @@ class Linear {
|
|
|
22
22
|
gap,
|
|
23
23
|
position,
|
|
24
24
|
sections,
|
|
25
|
-
borderRadius
|
|
25
|
+
borderRadius,
|
|
26
|
+
min,
|
|
27
|
+
max,
|
|
28
|
+
isIncreasing,
|
|
29
|
+
pointShape
|
|
26
30
|
}) {
|
|
27
31
|
this.context = void 0;
|
|
28
32
|
this.position = 0;
|
|
29
33
|
this.sections = 0;
|
|
30
34
|
this.isHorizontal = false;
|
|
35
|
+
this.isIncreasing = false;
|
|
31
36
|
this.gap = 0;
|
|
32
37
|
this.borderRadius = 0;
|
|
38
|
+
this.min = {
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0
|
|
41
|
+
};
|
|
42
|
+
this.max = {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
};
|
|
33
46
|
this.points = [];
|
|
47
|
+
this.pointShape = 'square';
|
|
34
48
|
this.context = context;
|
|
35
49
|
this.isHorizontal = isHorizontal ?? false;
|
|
36
50
|
this.gap = (gap ?? 0) / 2;
|
|
37
51
|
this.position = position ?? 0;
|
|
38
52
|
this.sections = sections ?? 1;
|
|
39
53
|
this.borderRadius = borderRadius ?? 0;
|
|
54
|
+
this.isIncreasing = isIncreasing ?? false;
|
|
55
|
+
this.min = min ?? {
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
};
|
|
59
|
+
this.max = max ?? {
|
|
60
|
+
x: 0,
|
|
61
|
+
y: 0
|
|
62
|
+
};
|
|
63
|
+
this.pointShape = pointShape ?? 'square';
|
|
64
|
+
if (isIncreasing) {
|
|
65
|
+
const currentMin = this.min;
|
|
66
|
+
const currentMax = this.max;
|
|
67
|
+
this.min = currentMax;
|
|
68
|
+
this.max = currentMin;
|
|
69
|
+
}
|
|
40
70
|
}
|
|
41
71
|
areaStart() {}
|
|
42
72
|
areaEnd() {}
|
|
@@ -46,11 +76,34 @@ class Linear {
|
|
|
46
76
|
if (this.gap > 0) {
|
|
47
77
|
return this.borderRadius;
|
|
48
78
|
}
|
|
49
|
-
if (this.
|
|
50
|
-
|
|
79
|
+
if (this.isIncreasing) {
|
|
80
|
+
// Is largest section
|
|
81
|
+
if (this.position === this.sections - 1) {
|
|
82
|
+
return [this.borderRadius, this.borderRadius];
|
|
83
|
+
}
|
|
84
|
+
// Is smallest section and shaped like a triangle
|
|
85
|
+
if (this.position === 0 && this.pointShape === 'sharp') {
|
|
86
|
+
return [0, 0, this.borderRadius];
|
|
87
|
+
}
|
|
88
|
+
// Is smallest section
|
|
89
|
+
if (this.position === 0) {
|
|
90
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
91
|
+
}
|
|
51
92
|
}
|
|
52
|
-
if (this.
|
|
53
|
-
|
|
93
|
+
if (!this.isIncreasing) {
|
|
94
|
+
// Is largest section
|
|
95
|
+
if (this.position === 0) {
|
|
96
|
+
return [0, 0, this.borderRadius, this.borderRadius];
|
|
97
|
+
}
|
|
98
|
+
// Is smallest section and shaped like a triangle
|
|
99
|
+
if (this.position === this.sections - 1 && this.pointShape === 'sharp') {
|
|
100
|
+
return [this.borderRadius];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Is smallest section
|
|
104
|
+
if (this.position === this.sections - 1) {
|
|
105
|
+
return [this.borderRadius, this.borderRadius];
|
|
106
|
+
}
|
|
54
107
|
}
|
|
55
108
|
return 0;
|
|
56
109
|
}
|
|
@@ -82,6 +135,30 @@ class Linear {
|
|
|
82
135
|
y: yGap
|
|
83
136
|
};
|
|
84
137
|
});
|
|
138
|
+
if (this.pointShape === 'sharp') {
|
|
139
|
+
// In the last section, to form a triangle we need 3 points instead of 4
|
|
140
|
+
// Else the algorithm will break.
|
|
141
|
+
const isLastSection = this.position === this.sections - 1;
|
|
142
|
+
const isFirstSection = this.position === 0;
|
|
143
|
+
if (isFirstSection && this.isIncreasing) {
|
|
144
|
+
this.points = [this.isHorizontal ? {
|
|
145
|
+
x: this.max.x + this.gap,
|
|
146
|
+
y: (this.max.y + this.min.y) / 2
|
|
147
|
+
} : {
|
|
148
|
+
x: (this.max.x + this.min.x) / 2,
|
|
149
|
+
y: this.max.y + this.gap
|
|
150
|
+
}, this.points[1], this.points[2]];
|
|
151
|
+
}
|
|
152
|
+
if (isLastSection && !this.isIncreasing) {
|
|
153
|
+
this.points = [this.points[0], this.isHorizontal ? {
|
|
154
|
+
x: this.max.x - this.gap,
|
|
155
|
+
y: (this.max.y + this.min.y) / 2
|
|
156
|
+
} : {
|
|
157
|
+
x: (this.max.x + this.min.x) / 2,
|
|
158
|
+
y: this.max.y - this.gap
|
|
159
|
+
}, this.points[3]];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
85
162
|
(0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
|
|
86
163
|
}
|
|
87
164
|
}
|
|
@@ -47,6 +47,7 @@ export interface FunnelSeriesType extends Omit<CommonSeriesType<FunnelValueType>
|
|
|
47
47
|
*
|
|
48
48
|
* - `bump`: A curve that creates a smooth transition between points, with a bump in the middle.
|
|
49
49
|
* - `linear`: A straight line between points.
|
|
50
|
+
* - `linear-sharp`: A straight line between points, the smaller end of the funnel is a triangle.
|
|
50
51
|
* - `step`: A step line that creates a staircase effect.
|
|
51
52
|
* - `pyramid`: A pyramid shape that connects the points.
|
|
52
53
|
* - `step-pyramid`: A step line that creates a staircase effect, with a pyramid shape.
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { FunnelSectionProps } from "./FunnelSection.js";
|
|
3
|
+
import { FunnelSectionLabelProps } from "./FunnelSectionLabel.js";
|
|
3
4
|
export interface FunnelPlotSlots {
|
|
5
|
+
/**
|
|
6
|
+
* Custom component for funnel section.
|
|
7
|
+
* @default FunnelSection
|
|
8
|
+
*/
|
|
4
9
|
funnelSection?: React.ElementType<FunnelSectionProps>;
|
|
10
|
+
/**
|
|
11
|
+
* Custom component for funnel section label.
|
|
12
|
+
* @default FunnelSectionLabel
|
|
13
|
+
*/
|
|
14
|
+
funnelSectionLabel?: React.ElementType<FunnelSectionLabelProps>;
|
|
5
15
|
}
|
|
6
16
|
export interface FunnelPlotSlotProps {
|
|
7
17
|
funnelSection?: FunnelSectionProps;
|
|
18
|
+
funnelSectionLabel?: FunnelSectionLabelProps;
|
|
8
19
|
}
|
|
9
20
|
export interface FunnelPlotSlotExtension {
|
|
10
21
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FunnelSectionProps } from "./FunnelSection.js";
|
|
2
|
+
import type { FunnelSectionLabelProps } from "./FunnelSectionLabel.js";
|
|
2
3
|
export interface FunnelSectionClasses {
|
|
3
4
|
/** Styles applied to the root element. */
|
|
4
5
|
root: string;
|
|
@@ -19,4 +20,5 @@ export interface FunnelSectionClasses {
|
|
|
19
20
|
series: string;
|
|
20
21
|
}
|
|
21
22
|
export declare const useUtilityClasses: (props: FunnelSectionProps) => Record<"label" | "filled" | "outlined" | "highlighted" | "faded" | "root", string>;
|
|
23
|
+
export declare const useLabelUtilityClasses: (props: FunnelSectionLabelProps) => Record<"label", string>;
|
|
22
24
|
export declare const funnelSectionClasses: FunnelSectionClasses;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useUtilityClasses = exports.funnelSectionClasses = void 0;
|
|
7
|
+
exports.useUtilityClasses = exports.useLabelUtilityClasses = exports.funnelSectionClasses = void 0;
|
|
8
8
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
9
9
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
10
10
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
@@ -15,10 +15,11 @@ const useUtilityClasses = props => {
|
|
|
15
15
|
const {
|
|
16
16
|
classes,
|
|
17
17
|
seriesId,
|
|
18
|
-
variant
|
|
18
|
+
variant,
|
|
19
|
+
dataIndex
|
|
19
20
|
} = props;
|
|
20
21
|
const slots = {
|
|
21
|
-
root: ['root', `series-${seriesId}`],
|
|
22
|
+
root: ['root', `series-${seriesId}`, `data-index-${dataIndex}`],
|
|
22
23
|
highlighted: ['highlighted'],
|
|
23
24
|
faded: ['faded'],
|
|
24
25
|
outlined: variant === 'outlined' ? ['outlined'] : [],
|
|
@@ -28,4 +29,16 @@ const useUtilityClasses = props => {
|
|
|
28
29
|
return (0, _composeClasses.default)(slots, getFunnelSectionUtilityClass, classes);
|
|
29
30
|
};
|
|
30
31
|
exports.useUtilityClasses = useUtilityClasses;
|
|
31
|
-
const
|
|
32
|
+
const useLabelUtilityClasses = props => {
|
|
33
|
+
const {
|
|
34
|
+
classes,
|
|
35
|
+
seriesId,
|
|
36
|
+
dataIndex
|
|
37
|
+
} = props;
|
|
38
|
+
const slots = {
|
|
39
|
+
label: ['label', `series-${seriesId}`, `data-index-${dataIndex}`]
|
|
40
|
+
};
|
|
41
|
+
return (0, _composeClasses.default)(slots, getFunnelSectionUtilityClass, classes);
|
|
42
|
+
};
|
|
43
|
+
exports.useLabelUtilityClasses = useLabelUtilityClasses;
|
|
44
|
+
const funnelSectionClasses = exports.funnelSectionClasses = (0, _generateUtilityClasses.default)('MuiFunnelSection', ['root', 'highlighted', 'faded', 'filled', 'outlined', 'label', 'series', 'data-index']);
|
package/FunnelChart/index.d.ts
CHANGED
|
@@ -6,4 +6,6 @@ export * from "./categoryAxis.types.js";
|
|
|
6
6
|
export * from "./funnelSlots.types.js";
|
|
7
7
|
export type { FunnelCurveType } from "./curves/index.js";
|
|
8
8
|
export { funnelSectionClasses } from "./funnelSectionClasses.js";
|
|
9
|
-
export type { FunnelSectionClasses } from "./funnelSectionClasses.js";
|
|
9
|
+
export type { FunnelSectionClasses } from "./funnelSectionClasses.js";
|
|
10
|
+
export { FunnelSection } from "./FunnelSection.js";
|
|
11
|
+
export { FunnelSectionLabel } from "./FunnelSectionLabel.js";
|
package/FunnelChart/index.js
CHANGED
|
@@ -5,8 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Unstable_FunnelChart: true,
|
|
8
|
-
funnelSectionClasses: true
|
|
8
|
+
funnelSectionClasses: true,
|
|
9
|
+
FunnelSection: true,
|
|
10
|
+
FunnelSectionLabel: true
|
|
9
11
|
};
|
|
12
|
+
Object.defineProperty(exports, "FunnelSection", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _FunnelSection.FunnelSection;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "FunnelSectionLabel", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _FunnelSectionLabel.FunnelSectionLabel;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
10
24
|
Object.defineProperty(exports, "Unstable_FunnelChart", {
|
|
11
25
|
enumerable: true,
|
|
12
26
|
get: function () {
|
|
@@ -68,4 +82,6 @@ Object.keys(_funnelSlots).forEach(function (key) {
|
|
|
68
82
|
}
|
|
69
83
|
});
|
|
70
84
|
});
|
|
71
|
-
var _funnelSectionClasses = require("./funnelSectionClasses");
|
|
85
|
+
var _funnelSectionClasses = require("./funnelSectionClasses");
|
|
86
|
+
var _FunnelSection = require("./FunnelSection");
|
|
87
|
+
var _FunnelSectionLabel = require("./FunnelSectionLabel");
|
package/Heatmap/Heatmap.d.ts
CHANGED
|
@@ -55,6 +55,11 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
55
55
|
* @default true
|
|
56
56
|
*/
|
|
57
57
|
hideLegend?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* If true, shows the default chart toolbar.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
showToolbar?: boolean;
|
|
58
63
|
/**
|
|
59
64
|
* Overridable component slots.
|
|
60
65
|
* @default {}
|
package/Heatmap/Heatmap.js
CHANGED
|
@@ -25,6 +25,7 @@ var _seriesConfig = require("./seriesConfig");
|
|
|
25
25
|
var _HeatmapTooltip = require("./HeatmapTooltip");
|
|
26
26
|
var _Heatmap2 = require("./Heatmap.plugins");
|
|
27
27
|
var _ChartDataProviderPro = require("../ChartDataProviderPro");
|
|
28
|
+
var _ChartsToolbarPro = require("../ChartsToolbarPro");
|
|
28
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
30
|
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
30
31
|
const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
@@ -65,7 +66,8 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
65
66
|
loading,
|
|
66
67
|
highlightedItem,
|
|
67
68
|
onHighlightChange,
|
|
68
|
-
hideLegend = true
|
|
69
|
+
hideLegend = true,
|
|
70
|
+
showToolbar = false
|
|
69
71
|
} = props;
|
|
70
72
|
const id = (0, _useId.default)();
|
|
71
73
|
const clipPathId = `${id}-clip-path`;
|
|
@@ -99,6 +101,7 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
99
101
|
legendDirection: props.slotProps?.legend?.direction
|
|
100
102
|
};
|
|
101
103
|
const Tooltip = slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
|
|
104
|
+
const Toolbar = slots?.toolbar ?? _ChartsToolbarPro.ChartsToolbarPro;
|
|
102
105
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, {
|
|
103
106
|
apiRef: apiRef,
|
|
104
107
|
seriesConfig: seriesConfig,
|
|
@@ -119,7 +122,7 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
119
122
|
onAxisClick: onAxisClick,
|
|
120
123
|
plugins: _Heatmap2.HEATMAP_PLUGINS,
|
|
121
124
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
122
|
-
children: [!hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
|
|
125
|
+
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
|
|
123
126
|
slots: (0, _extends2.default)({}, slots, {
|
|
124
127
|
legend: slots?.legend ?? _ChartsLegend.ContinuousColorLegend
|
|
125
128
|
}),
|
|
@@ -251,6 +254,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
251
254
|
* @ignore Unstable props for internal usage.
|
|
252
255
|
*/
|
|
253
256
|
seriesConfig: _propTypes.default.object,
|
|
257
|
+
/**
|
|
258
|
+
* If true, shows the default chart toolbar.
|
|
259
|
+
* @default false
|
|
260
|
+
*/
|
|
261
|
+
showToolbar: _propTypes.default.bool,
|
|
254
262
|
/**
|
|
255
263
|
* The props used for each component slot.
|
|
256
264
|
* @default {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @ignore - internal component.
|
|
3
3
|
*/
|
|
4
|
-
export declare const HeatmapTooltipAxesValue: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, keyof import("react").ClassAttributes<HTMLElement> | keyof import("react").HTMLAttributes<HTMLElement>>, {}>;
|
|
4
|
+
export declare const HeatmapTooltipAxesValue: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, keyof import("react").ClassAttributes<HTMLElement> | keyof import("react").HTMLAttributes<HTMLElement>>, {}>;
|
|
@@ -82,7 +82,7 @@ const LineChartPro = exports.LineChartPro = /*#__PURE__*/React.forwardRef(functi
|
|
|
82
82
|
const Toolbar = props.slots?.toolbar ?? _ChartsToolbarPro.ChartsToolbarPro;
|
|
83
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
84
84
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
85
|
-
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
85
|
+
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
86
86
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
87
87
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
88
88
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartZoomSlider.ChartZoomSlider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PieChartProps, PieChartSlotProps, PieChartSlots } from '@mui/x-charts/PieChart';
|
|
3
|
+
import { ChartsSlotsPro, ChartsSlotPropsPro } from "../internals/material/index.js";
|
|
4
|
+
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
5
|
+
import { PieChartProPluginSignatures } from "./PieChartPro.plugins.js";
|
|
6
|
+
export interface PieChartProSlots extends PieChartSlots, Partial<ChartsSlotsPro> {}
|
|
7
|
+
export interface PieChartProSlotProps extends PieChartSlotProps, Partial<ChartsSlotPropsPro> {}
|
|
8
|
+
export interface PieChartProProps extends Omit<PieChartProps, 'apiRef' | 'slots' | 'slotProps'>, Omit<ChartContainerProProps<'pie', PieChartProPluginSignatures>, 'series' | 'plugins' | 'seriesConfig' | 'slots' | 'slotProps'> {
|
|
9
|
+
/**
|
|
10
|
+
* Overridable component slots.
|
|
11
|
+
* @default {}
|
|
12
|
+
*/
|
|
13
|
+
slots?: PieChartProSlots;
|
|
14
|
+
/**
|
|
15
|
+
* The props used for each component slot.
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
slotProps?: PieChartProSlotProps;
|
|
19
|
+
}
|
|
20
|
+
declare const PieChartPro: React.ForwardRefExoticComponent<PieChartProProps & React.RefAttributes<SVGSVGElement>>;
|
|
21
|
+
export { PieChartPro };
|