@mui/x-charts-pro 8.5.2 → 8.6.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/CHANGELOG.md +203 -11
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +1 -1
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +20 -31
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +1 -8
- package/ChartZoomSlider/internals/zoom-utils.d.ts +3 -1
- package/ChartZoomSlider/internals/zoom-utils.js +19 -8
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.d.ts +27 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +77 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.d.ts +33 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +75 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +16 -3
- package/ChartsToolbarPro/ChartsToolbarPro.js +118 -8
- package/ChartsToolbarPro/index.d.ts +3 -1
- package/ChartsToolbarPro/index.js +22 -0
- package/ChartsToolbarPro/internals/ChartsMenu.d.ts +14 -0
- package/ChartsToolbarPro/internals/ChartsMenu.js +73 -0
- package/ChartsToolbarPro/internals/ChartsToolbarDivider.d.ts +5 -0
- package/ChartsToolbarPro/internals/ChartsToolbarDivider.js +47 -0
- package/FunnelChart/FunnelPlot.js +56 -40
- package/FunnelChart/FunnelSection.js +2 -0
- package/FunnelChart/curves/bump.d.ts +3 -3
- package/FunnelChart/curves/bump.js +3 -0
- package/FunnelChart/curves/curve.types.d.ts +14 -1
- package/FunnelChart/curves/getFunnelCurve.d.ts +7 -2
- package/FunnelChart/curves/linear.d.ts +3 -3
- package/FunnelChart/curves/linear.js +23 -18
- package/FunnelChart/curves/pyramid.d.ts +3 -3
- package/FunnelChart/curves/pyramid.js +17 -12
- package/FunnelChart/curves/step-pyramid.d.ts +5 -5
- package/FunnelChart/curves/step-pyramid.js +20 -18
- package/FunnelChart/curves/step.d.ts +3 -3
- package/FunnelChart/curves/step.js +14 -12
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +18 -1444
- package/FunnelChart/labelUtils.d.ts +4 -12
- package/FunnelChart/labelUtils.js +43 -44
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +21 -32
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +1 -8
- package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +3 -1
- package/esm/ChartZoomSlider/internals/zoom-utils.js +19 -9
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.d.ts +27 -0
- package/esm/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +70 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.d.ts +33 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +68 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +16 -3
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +120 -8
- package/esm/ChartsToolbarPro/index.d.ts +3 -1
- package/esm/ChartsToolbarPro/index.js +3 -1
- package/esm/ChartsToolbarPro/internals/ChartsMenu.d.ts +14 -0
- package/esm/ChartsToolbarPro/internals/ChartsMenu.js +67 -0
- package/esm/ChartsToolbarPro/internals/ChartsToolbarDivider.d.ts +5 -0
- package/esm/ChartsToolbarPro/internals/ChartsToolbarDivider.js +40 -0
- package/esm/FunnelChart/FunnelPlot.js +56 -40
- package/esm/FunnelChart/FunnelSection.js +2 -0
- package/esm/FunnelChart/curves/bump.d.ts +3 -3
- package/esm/FunnelChart/curves/bump.js +3 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +14 -1
- package/esm/FunnelChart/curves/getFunnelCurve.d.ts +7 -2
- package/esm/FunnelChart/curves/linear.d.ts +3 -3
- package/esm/FunnelChart/curves/linear.js +23 -18
- package/esm/FunnelChart/curves/pyramid.d.ts +3 -3
- package/esm/FunnelChart/curves/pyramid.js +17 -12
- package/esm/FunnelChart/curves/step-pyramid.d.ts +5 -5
- package/esm/FunnelChart/curves/step-pyramid.js +20 -18
- package/esm/FunnelChart/curves/step.d.ts +3 -3
- package/esm/FunnelChart/curves/step.js +14 -12
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +18 -1444
- package/esm/FunnelChart/labelUtils.d.ts +4 -12
- package/esm/FunnelChart/labelUtils.js +43 -44
- package/esm/index.d.ts +2 -1
- package/esm/index.js +1 -1
- package/esm/internals/material/components/BaseMenuItem.d.ts +3 -0
- package/esm/internals/material/components/BaseMenuItem.js +27 -0
- package/esm/internals/material/components/BasePopper.d.ts +3 -0
- package/esm/internals/material/components/BasePopper.js +122 -0
- package/esm/internals/material/icons.d.ts +2 -1
- package/esm/internals/material/icons.js +4 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/material/index.js +12 -3
- package/esm/internals/plugins/useChartProExport/print.js +1 -1
- package/esm/internals/plugins/useChartProExport/useChartProExport.types.d.ts +7 -6
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +16 -595
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +2 -2
- package/esm/internals/slots/chartBaseSlotProps.d.ts +50 -3
- package/esm/internals/slots/chartsBaseSlots.d.ts +5 -1
- package/esm/internals/slots/chartsIconSlots.d.ts +5 -0
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/internals/material/components/BaseMenuItem.d.ts +3 -0
- package/internals/material/components/BaseMenuItem.js +35 -0
- package/internals/material/components/BasePopper.d.ts +3 -0
- package/internals/material/components/BasePopper.js +130 -0
- package/internals/material/icons.d.ts +2 -1
- package/internals/material/icons.js +5 -2
- package/internals/material/index.d.ts +1 -0
- package/internals/material/index.js +11 -2
- package/internals/plugins/useChartProExport/print.js +1 -1
- package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +7 -6
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +16 -595
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +2 -2
- package/internals/slots/chartBaseSlotProps.d.ts +50 -3
- package/internals/slots/chartsBaseSlots.d.ts +5 -1
- package/internals/slots/chartsIconSlots.d.ts +5 -0
- package/package.json +5 -5
- package/FunnelChart/positionGetter.d.ts +0 -1
- package/FunnelChart/positionGetter.js +0 -5
- package/esm/FunnelChart/positionGetter.d.ts +0 -1
- package/esm/FunnelChart/positionGetter.js +0 -1
|
@@ -88,17 +88,9 @@ export class Pyramid {
|
|
|
88
88
|
}
|
|
89
89
|
return 0;
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
this.points.push({
|
|
93
|
-
x: xIn,
|
|
94
|
-
y: yIn
|
|
95
|
-
});
|
|
96
|
-
if (this.points.length < 4) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
91
|
+
processPoints(points) {
|
|
100
92
|
// Replace funnel points by pyramids ones.
|
|
101
|
-
|
|
93
|
+
const processedPoints = points.map((point, index) => {
|
|
102
94
|
if (this.isHorizontal) {
|
|
103
95
|
const slopeEnd = {
|
|
104
96
|
x: this.max.x,
|
|
@@ -134,10 +126,23 @@ export class Pyramid {
|
|
|
134
126
|
const isLastSection = this.position === this.sections - 1;
|
|
135
127
|
const isFirstSection = this.position === 0;
|
|
136
128
|
if (isFirstSection && this.isIncreasing) {
|
|
137
|
-
|
|
129
|
+
return [processedPoints[0], processedPoints[1], processedPoints[2]];
|
|
138
130
|
}
|
|
139
131
|
if (isLastSection && !this.isIncreasing) {
|
|
140
|
-
|
|
132
|
+
return [processedPoints[0], processedPoints[1], processedPoints[3]];
|
|
133
|
+
}
|
|
134
|
+
return processedPoints;
|
|
135
|
+
}
|
|
136
|
+
point(xIn, yIn) {
|
|
137
|
+
this.points.push({
|
|
138
|
+
x: xIn,
|
|
139
|
+
y: yIn
|
|
140
|
+
});
|
|
141
|
+
const isLastSection = this.position === this.sections - 1;
|
|
142
|
+
const isFirstSection = this.position === 0;
|
|
143
|
+
const isSharpPoint = isLastSection && !this.isIncreasing || isFirstSection && this.isIncreasing;
|
|
144
|
+
if (this.points.length < (isSharpPoint ? 3 : 4)) {
|
|
145
|
+
return;
|
|
141
146
|
}
|
|
142
147
|
borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
|
|
143
148
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CurveOptions, Point } from "./curve.types.js";
|
|
1
|
+
import { FunnelCurveGenerator, CurveOptions, Point } from "./curve.types.js";
|
|
3
2
|
/**
|
|
4
3
|
* This is a custom "step-pyramid" curve generator.
|
|
5
4
|
* It creates a step pyramid, which is a step-like shape with static lengths.
|
|
6
5
|
* It has the option to add a gap between sections while also properly handling the border radius.
|
|
7
6
|
*/
|
|
8
|
-
export declare class StepPyramid implements
|
|
7
|
+
export declare class StepPyramid implements FunnelCurveGenerator {
|
|
9
8
|
private context;
|
|
10
9
|
private position;
|
|
11
10
|
private sections;
|
|
@@ -33,7 +32,8 @@ export declare class StepPyramid implements CurveGenerator {
|
|
|
33
32
|
protected getBorderRadius(): number | number[];
|
|
34
33
|
slopeStart(index: number): Point;
|
|
35
34
|
slopeEnd(index: number): Point;
|
|
36
|
-
initialX(index: number): number;
|
|
37
|
-
initialY(index: number): number;
|
|
35
|
+
initialX(index: number, points: Point[]): number;
|
|
36
|
+
initialY(index: number, points: Point[]): number;
|
|
37
|
+
processPoints(points: Point[]): Point[];
|
|
38
38
|
point(xIn: number, yIn: number): void;
|
|
39
39
|
}
|
|
@@ -130,46 +130,48 @@ export class StepPyramid {
|
|
|
130
130
|
y: this.max.y
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
initialX(index) {
|
|
133
|
+
initialX(index, points) {
|
|
134
134
|
if (this.isIncreasing) {
|
|
135
|
-
return index === 0 || index === 1 ?
|
|
135
|
+
return index === 0 || index === 1 ? points.at(1).x : points.at(2).x;
|
|
136
136
|
}
|
|
137
|
-
return index === 0 || index === 1 ?
|
|
137
|
+
return index === 0 || index === 1 ? points.at(0).x : points.at(3).x;
|
|
138
138
|
}
|
|
139
|
-
initialY(index) {
|
|
139
|
+
initialY(index, points) {
|
|
140
140
|
if (this.isIncreasing) {
|
|
141
|
-
return index === 0 || index === 1 ?
|
|
141
|
+
return index === 0 || index === 1 ? points.at(1).y : points.at(2).y;
|
|
142
142
|
}
|
|
143
|
-
return index === 0 || index === 1 ?
|
|
143
|
+
return index === 0 || index === 1 ? points.at(0).y : points.at(3).y;
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
this.points.push({
|
|
147
|
-
x: xIn,
|
|
148
|
-
y: yIn
|
|
149
|
-
});
|
|
150
|
-
if (this.points.length < 4) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
145
|
+
processPoints(points) {
|
|
154
146
|
// Replace funnel points by pyramids ones.
|
|
155
|
-
|
|
147
|
+
const processedPoints = points.map((point, index) => {
|
|
156
148
|
const slopeStart = this.slopeStart(index);
|
|
157
149
|
const slopeEnd = this.slopeEnd(index);
|
|
158
150
|
if (this.isHorizontal) {
|
|
159
151
|
const yGetter = lerpY(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
160
|
-
const xInitial = this.initialX(index);
|
|
152
|
+
const xInitial = this.initialX(index, points);
|
|
161
153
|
return {
|
|
162
154
|
x: point.x,
|
|
163
155
|
y: yGetter(xInitial)
|
|
164
156
|
};
|
|
165
157
|
}
|
|
166
158
|
const xGetter = lerpX(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
167
|
-
const yInitial = this.initialY(index);
|
|
159
|
+
const yInitial = this.initialY(index, points);
|
|
168
160
|
return {
|
|
169
161
|
x: xGetter(yInitial),
|
|
170
162
|
y: point.y
|
|
171
163
|
};
|
|
172
164
|
});
|
|
165
|
+
return processedPoints;
|
|
166
|
+
}
|
|
167
|
+
point(xIn, yIn) {
|
|
168
|
+
this.points.push({
|
|
169
|
+
x: xIn,
|
|
170
|
+
y: yIn
|
|
171
|
+
});
|
|
172
|
+
if (this.points.length < 4) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
173
175
|
borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
|
|
174
176
|
}
|
|
175
177
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CurveOptions } from "./curve.types.js";
|
|
1
|
+
import { FunnelCurveGenerator, CurveOptions, Point } from "./curve.types.js";
|
|
3
2
|
/**
|
|
4
3
|
* This is a custom "step" curve generator.
|
|
5
4
|
* It is used to draw "rectangles" from 4 points without having to rework the rendering logic,
|
|
@@ -10,7 +9,7 @@ import { CurveOptions } from "./curve.types.js";
|
|
|
10
9
|
* The implementation is based on the d3-shape step curve generator.
|
|
11
10
|
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
|
|
12
11
|
*/
|
|
13
|
-
export declare class Step implements
|
|
12
|
+
export declare class Step implements FunnelCurveGenerator {
|
|
14
13
|
private context;
|
|
15
14
|
private isHorizontal;
|
|
16
15
|
private isIncreasing;
|
|
@@ -32,5 +31,6 @@ export declare class Step implements CurveGenerator {
|
|
|
32
31
|
lineStart(): void;
|
|
33
32
|
lineEnd(): void;
|
|
34
33
|
protected getBorderRadius(): number | number[];
|
|
34
|
+
processPoints(points: Point[]): Point[];
|
|
35
35
|
point(xIn: number, yIn: number): void;
|
|
36
36
|
}
|
|
@@ -57,19 +57,11 @@ export class Step {
|
|
|
57
57
|
}
|
|
58
58
|
return [this.borderRadius, this.borderRadius];
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
this.points.push({
|
|
62
|
-
x: xIn,
|
|
63
|
-
y: yIn
|
|
64
|
-
});
|
|
65
|
-
if (this.points.length < 4) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
60
|
+
processPoints(points) {
|
|
69
61
|
// Ensure we have rectangles instead of trapezoids.
|
|
70
|
-
|
|
71
|
-
const allX =
|
|
72
|
-
const allY =
|
|
62
|
+
const processedPoints = points.map((_, index) => {
|
|
63
|
+
const allX = points.map(p => p.x);
|
|
64
|
+
const allY = points.map(p => p.y);
|
|
73
65
|
if (this.isHorizontal) {
|
|
74
66
|
return {
|
|
75
67
|
x: index === 1 || index === 2 ? max(allX) : min(allX),
|
|
@@ -81,6 +73,16 @@ export class Step {
|
|
|
81
73
|
y: index === 1 || index === 2 ? max(allY) : min(allY)
|
|
82
74
|
};
|
|
83
75
|
});
|
|
76
|
+
return processedPoints;
|
|
77
|
+
}
|
|
78
|
+
point(xIn, yIn) {
|
|
79
|
+
this.points.push({
|
|
80
|
+
x: xIn,
|
|
81
|
+
y: yIn
|
|
82
|
+
});
|
|
83
|
+
if (this.points.length < 4) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
84
86
|
borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
|
|
85
87
|
}
|
|
86
88
|
}
|