@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
|
@@ -97,7 +97,7 @@ class Linear {
|
|
|
97
97
|
}
|
|
98
98
|
// Is smallest section and shaped like a triangle
|
|
99
99
|
if (this.position === this.sections - 1 && this.pointShape === 'sharp') {
|
|
100
|
-
return [this.borderRadius];
|
|
100
|
+
return [0, 0, this.borderRadius];
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// Is smallest section
|
|
@@ -107,19 +107,11 @@ class Linear {
|
|
|
107
107
|
}
|
|
108
108
|
return 0;
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
this.points.push({
|
|
112
|
-
x: xIn,
|
|
113
|
-
y: yIn
|
|
114
|
-
});
|
|
115
|
-
if (this.points.length < 4) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
110
|
+
processPoints(points) {
|
|
119
111
|
// Add gaps where they are needed.
|
|
120
|
-
|
|
121
|
-
const slopeStart =
|
|
122
|
-
const slopeEnd =
|
|
112
|
+
const processedPoints = points.map((point, index) => {
|
|
113
|
+
const slopeStart = points.at(index <= 1 ? 0 : 3);
|
|
114
|
+
const slopeEnd = points.at(index <= 1 ? 1 : 2);
|
|
123
115
|
if (this.isHorizontal) {
|
|
124
116
|
const yGetter = (0, _utils.lerpY)(slopeStart.x - this.gap, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
125
117
|
return {
|
|
@@ -141,15 +133,15 @@ class Linear {
|
|
|
141
133
|
let firstPoint = null;
|
|
142
134
|
let secondPoint = null;
|
|
143
135
|
if (isFirstSection && this.isIncreasing) {
|
|
144
|
-
firstPoint =
|
|
145
|
-
secondPoint =
|
|
136
|
+
firstPoint = processedPoints[1];
|
|
137
|
+
secondPoint = processedPoints[2];
|
|
146
138
|
}
|
|
147
139
|
if (isLastSection && !this.isIncreasing) {
|
|
148
|
-
firstPoint =
|
|
149
|
-
secondPoint =
|
|
140
|
+
firstPoint = processedPoints[3];
|
|
141
|
+
secondPoint = processedPoints[0];
|
|
150
142
|
}
|
|
151
143
|
if (firstPoint && secondPoint) {
|
|
152
|
-
|
|
144
|
+
return [
|
|
153
145
|
// Sharp point at the start
|
|
154
146
|
this.isHorizontal ? {
|
|
155
147
|
x: this.max.x,
|
|
@@ -162,6 +154,19 @@ class Linear {
|
|
|
162
154
|
firstPoint, secondPoint];
|
|
163
155
|
}
|
|
164
156
|
}
|
|
157
|
+
return processedPoints;
|
|
158
|
+
}
|
|
159
|
+
point(xIn, yIn) {
|
|
160
|
+
this.points.push({
|
|
161
|
+
x: xIn,
|
|
162
|
+
y: yIn
|
|
163
|
+
});
|
|
164
|
+
const isLastSection = this.position === this.sections - 1;
|
|
165
|
+
const isFirstSection = this.position === 0;
|
|
166
|
+
const isSharpPoint = this.pointShape === 'sharp' && (isLastSection && !this.isIncreasing || isFirstSection && this.isIncreasing);
|
|
167
|
+
if (this.points.length < (isSharpPoint ? 3 : 4)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
165
170
|
(0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
|
|
166
171
|
}
|
|
167
172
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
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 "pyramid" curve generator.
|
|
5
4
|
* It draws straight lines for the 4 provided points. The slopes are calculated
|
|
6
5
|
* based on the min and max values of the x and y axes.
|
|
7
6
|
* with the option to add a gap between sections while also properly handling the border radius.
|
|
8
7
|
*/
|
|
9
|
-
export declare class Pyramid implements
|
|
8
|
+
export declare class Pyramid implements FunnelCurveGenerator {
|
|
10
9
|
private context;
|
|
11
10
|
private position;
|
|
12
11
|
private sections;
|
|
@@ -32,5 +31,6 @@ export declare class Pyramid 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
|
}
|
|
@@ -93,17 +93,9 @@ class Pyramid {
|
|
|
93
93
|
}
|
|
94
94
|
return 0;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
this.points.push({
|
|
98
|
-
x: xIn,
|
|
99
|
-
y: yIn
|
|
100
|
-
});
|
|
101
|
-
if (this.points.length < 4) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
96
|
+
processPoints(points) {
|
|
105
97
|
// Replace funnel points by pyramids ones.
|
|
106
|
-
|
|
98
|
+
const processedPoints = points.map((point, index) => {
|
|
107
99
|
if (this.isHorizontal) {
|
|
108
100
|
const slopeEnd = {
|
|
109
101
|
x: this.max.x,
|
|
@@ -139,10 +131,23 @@ class Pyramid {
|
|
|
139
131
|
const isLastSection = this.position === this.sections - 1;
|
|
140
132
|
const isFirstSection = this.position === 0;
|
|
141
133
|
if (isFirstSection && this.isIncreasing) {
|
|
142
|
-
|
|
134
|
+
return [processedPoints[0], processedPoints[1], processedPoints[2]];
|
|
143
135
|
}
|
|
144
136
|
if (isLastSection && !this.isIncreasing) {
|
|
145
|
-
|
|
137
|
+
return [processedPoints[0], processedPoints[1], processedPoints[3]];
|
|
138
|
+
}
|
|
139
|
+
return processedPoints;
|
|
140
|
+
}
|
|
141
|
+
point(xIn, yIn) {
|
|
142
|
+
this.points.push({
|
|
143
|
+
x: xIn,
|
|
144
|
+
y: yIn
|
|
145
|
+
});
|
|
146
|
+
const isLastSection = this.position === this.sections - 1;
|
|
147
|
+
const isFirstSection = this.position === 0;
|
|
148
|
+
const isSharpPoint = isLastSection && !this.isIncreasing || isFirstSection && this.isIncreasing;
|
|
149
|
+
if (this.points.length < (isSharpPoint ? 3 : 4)) {
|
|
150
|
+
return;
|
|
146
151
|
}
|
|
147
152
|
(0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
|
|
148
153
|
}
|
|
@@ -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
|
}
|
|
@@ -135,46 +135,48 @@ class StepPyramid {
|
|
|
135
135
|
y: this.max.y
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
initialX(index) {
|
|
138
|
+
initialX(index, points) {
|
|
139
139
|
if (this.isIncreasing) {
|
|
140
|
-
return index === 0 || index === 1 ?
|
|
140
|
+
return index === 0 || index === 1 ? points.at(1).x : points.at(2).x;
|
|
141
141
|
}
|
|
142
|
-
return index === 0 || index === 1 ?
|
|
142
|
+
return index === 0 || index === 1 ? points.at(0).x : points.at(3).x;
|
|
143
143
|
}
|
|
144
|
-
initialY(index) {
|
|
144
|
+
initialY(index, points) {
|
|
145
145
|
if (this.isIncreasing) {
|
|
146
|
-
return index === 0 || index === 1 ?
|
|
146
|
+
return index === 0 || index === 1 ? points.at(1).y : points.at(2).y;
|
|
147
147
|
}
|
|
148
|
-
return index === 0 || index === 1 ?
|
|
148
|
+
return index === 0 || index === 1 ? points.at(0).y : points.at(3).y;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
this.points.push({
|
|
152
|
-
x: xIn,
|
|
153
|
-
y: yIn
|
|
154
|
-
});
|
|
155
|
-
if (this.points.length < 4) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
150
|
+
processPoints(points) {
|
|
159
151
|
// Replace funnel points by pyramids ones.
|
|
160
|
-
|
|
152
|
+
const processedPoints = points.map((point, index) => {
|
|
161
153
|
const slopeStart = this.slopeStart(index);
|
|
162
154
|
const slopeEnd = this.slopeEnd(index);
|
|
163
155
|
if (this.isHorizontal) {
|
|
164
156
|
const yGetter = (0, _utils.lerpY)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
165
|
-
const xInitial = this.initialX(index);
|
|
157
|
+
const xInitial = this.initialX(index, points);
|
|
166
158
|
return {
|
|
167
159
|
x: point.x,
|
|
168
160
|
y: yGetter(xInitial)
|
|
169
161
|
};
|
|
170
162
|
}
|
|
171
163
|
const xGetter = (0, _utils.lerpX)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
|
|
172
|
-
const yInitial = this.initialY(index);
|
|
164
|
+
const yInitial = this.initialY(index, points);
|
|
173
165
|
return {
|
|
174
166
|
x: xGetter(yInitial),
|
|
175
167
|
y: point.y
|
|
176
168
|
};
|
|
177
169
|
});
|
|
170
|
+
return processedPoints;
|
|
171
|
+
}
|
|
172
|
+
point(xIn, yIn) {
|
|
173
|
+
this.points.push({
|
|
174
|
+
x: xIn,
|
|
175
|
+
y: yIn
|
|
176
|
+
});
|
|
177
|
+
if (this.points.length < 4) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
178
180
|
(0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -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
|
}
|
|
@@ -62,19 +62,11 @@ class Step {
|
|
|
62
62
|
}
|
|
63
63
|
return [this.borderRadius, this.borderRadius];
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
this.points.push({
|
|
67
|
-
x: xIn,
|
|
68
|
-
y: yIn
|
|
69
|
-
});
|
|
70
|
-
if (this.points.length < 4) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
65
|
+
processPoints(points) {
|
|
74
66
|
// Ensure we have rectangles instead of trapezoids.
|
|
75
|
-
|
|
76
|
-
const allX =
|
|
77
|
-
const allY =
|
|
67
|
+
const processedPoints = points.map((_, index) => {
|
|
68
|
+
const allX = points.map(p => p.x);
|
|
69
|
+
const allY = points.map(p => p.y);
|
|
78
70
|
if (this.isHorizontal) {
|
|
79
71
|
return {
|
|
80
72
|
x: index === 1 || index === 2 ? (0, _utils.max)(allX) : (0, _utils.min)(allX),
|
|
@@ -86,6 +78,16 @@ class Step {
|
|
|
86
78
|
y: index === 1 || index === 2 ? (0, _utils.max)(allY) : (0, _utils.min)(allY)
|
|
87
79
|
};
|
|
88
80
|
});
|
|
81
|
+
return processedPoints;
|
|
82
|
+
}
|
|
83
|
+
point(xIn, yIn) {
|
|
84
|
+
this.points.push({
|
|
85
|
+
x: xIn,
|
|
86
|
+
y: yIn
|
|
87
|
+
});
|
|
88
|
+
if (this.points.length < 4) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
89
91
|
(0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
|
|
90
92
|
}
|
|
91
93
|
}
|