@mui/x-charts-pro 8.2.0 → 8.3.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.
Files changed (154) hide show
  1. package/BarChartPro/BarChartPro.d.ts +7 -1
  2. package/BarChartPro/BarChartPro.js +60 -4
  3. package/CHANGELOG.md +199 -6
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  5. package/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
  6. package/ChartZoomSlider/ChartZoomSlider.js +47 -0
  7. package/ChartZoomSlider/index.d.ts +2 -0
  8. package/ChartZoomSlider/index.js +27 -0
  9. package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
  10. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +348 -0
  11. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
  12. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +92 -0
  13. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
  14. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +27 -0
  15. package/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
  16. package/ChartsToolbarPro/ChartsToolbarPro.js +31 -0
  17. package/ChartsToolbarPro/index.d.ts +1 -0
  18. package/ChartsToolbarPro/index.js +16 -0
  19. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
  20. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +36 -0
  21. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
  22. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +36 -0
  23. package/FunnelChart/FunnelChart.js +2 -7
  24. package/FunnelChart/FunnelPlot.js +24 -3
  25. package/FunnelChart/FunnelSection.d.ts +1 -0
  26. package/FunnelChart/FunnelSection.js +12 -7
  27. package/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
  28. package/FunnelChart/curves/borderRadiusPolygon.js +42 -0
  29. package/FunnelChart/curves/bump.d.ts +8 -5
  30. package/FunnelChart/curves/bump.js +21 -22
  31. package/FunnelChart/curves/curve.types.d.ts +33 -3
  32. package/FunnelChart/curves/getFunnelCurve.d.ts +2 -2
  33. package/FunnelChart/curves/getFunnelCurve.js +12 -4
  34. package/FunnelChart/curves/linear.d.ts +17 -9
  35. package/FunnelChart/curves/linear.js +62 -87
  36. package/FunnelChart/curves/pyramid.d.ts +34 -0
  37. package/FunnelChart/curves/pyramid.js +127 -0
  38. package/FunnelChart/curves/step-pyramid.d.ts +31 -0
  39. package/FunnelChart/curves/step-pyramid.js +107 -0
  40. package/FunnelChart/curves/step.d.ts +32 -0
  41. package/FunnelChart/curves/step.js +88 -0
  42. package/FunnelChart/curves/utils.d.ts +4 -0
  43. package/FunnelChart/curves/utils.js +29 -0
  44. package/FunnelChart/funnel.types.d.ts +23 -2
  45. package/FunnelChart/funnelSectionClasses.d.ts +5 -1
  46. package/FunnelChart/funnelSectionClasses.js +5 -2
  47. package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
  48. package/FunnelChart/useFunnelChartProps.d.ts +0 -5
  49. package/FunnelChart/useFunnelChartProps.js +0 -11
  50. package/Heatmap/Heatmap.d.ts +3 -3
  51. package/Heatmap/Heatmap.js +2 -20
  52. package/LineChartPro/LineChartPro.d.ts +7 -1
  53. package/LineChartPro/LineChartPro.js +60 -4
  54. package/ScatterChartPro/ScatterChartPro.d.ts +7 -1
  55. package/ScatterChartPro/ScatterChartPro.js +60 -4
  56. package/esm/BarChartPro/BarChartPro.d.ts +7 -1
  57. package/esm/BarChartPro/BarChartPro.js +60 -4
  58. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  59. package/esm/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
  60. package/esm/ChartZoomSlider/ChartZoomSlider.js +41 -0
  61. package/esm/ChartZoomSlider/index.d.ts +2 -0
  62. package/esm/ChartZoomSlider/index.js +2 -0
  63. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
  64. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +339 -0
  65. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
  66. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +85 -0
  67. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
  68. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +17 -0
  69. package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
  70. package/esm/ChartsToolbarPro/ChartsToolbarPro.js +24 -0
  71. package/esm/ChartsToolbarPro/index.d.ts +1 -0
  72. package/esm/ChartsToolbarPro/index.js +1 -0
  73. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
  74. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +29 -0
  75. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
  76. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +29 -0
  77. package/esm/FunnelChart/FunnelChart.js +2 -7
  78. package/esm/FunnelChart/FunnelPlot.js +24 -3
  79. package/esm/FunnelChart/FunnelSection.d.ts +1 -0
  80. package/esm/FunnelChart/FunnelSection.js +12 -7
  81. package/esm/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
  82. package/esm/FunnelChart/curves/borderRadiusPolygon.js +36 -0
  83. package/esm/FunnelChart/curves/bump.d.ts +8 -5
  84. package/esm/FunnelChart/curves/bump.js +21 -22
  85. package/esm/FunnelChart/curves/curve.types.d.ts +33 -3
  86. package/esm/FunnelChart/curves/getFunnelCurve.d.ts +2 -2
  87. package/esm/FunnelChart/curves/getFunnelCurve.js +12 -4
  88. package/esm/FunnelChart/curves/linear.d.ts +17 -9
  89. package/esm/FunnelChart/curves/linear.js +62 -86
  90. package/esm/FunnelChart/curves/pyramid.d.ts +34 -0
  91. package/esm/FunnelChart/curves/pyramid.js +121 -0
  92. package/esm/FunnelChart/curves/step-pyramid.d.ts +31 -0
  93. package/esm/FunnelChart/curves/step-pyramid.js +101 -0
  94. package/esm/FunnelChart/curves/step.d.ts +32 -0
  95. package/esm/FunnelChart/curves/step.js +82 -0
  96. package/esm/FunnelChart/curves/utils.d.ts +4 -0
  97. package/esm/FunnelChart/curves/utils.js +19 -0
  98. package/esm/FunnelChart/funnel.types.d.ts +23 -2
  99. package/esm/FunnelChart/funnelSectionClasses.d.ts +5 -1
  100. package/esm/FunnelChart/funnelSectionClasses.js +5 -2
  101. package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
  102. package/esm/FunnelChart/useFunnelChartProps.d.ts +0 -5
  103. package/esm/FunnelChart/useFunnelChartProps.js +0 -11
  104. package/esm/Heatmap/Heatmap.d.ts +3 -3
  105. package/esm/Heatmap/Heatmap.js +2 -20
  106. package/esm/LineChartPro/LineChartPro.d.ts +7 -1
  107. package/esm/LineChartPro/LineChartPro.js +60 -4
  108. package/esm/ScatterChartPro/ScatterChartPro.d.ts +7 -1
  109. package/esm/ScatterChartPro/ScatterChartPro.js +60 -4
  110. package/esm/index.d.ts +4 -1
  111. package/esm/index.js +4 -3
  112. package/esm/internals/material/icons.d.ts +3 -0
  113. package/esm/internals/material/icons.js +13 -0
  114. package/esm/internals/material/index.d.ts +4 -0
  115. package/esm/internals/material/index.js +12 -0
  116. package/esm/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
  117. package/esm/internals/plugins/useChartProZoom/calculateZoom.js +32 -0
  118. package/esm/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
  119. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +45 -3
  120. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +63 -11
  121. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
  122. package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
  123. package/esm/internals/slots/chartBaseSlotProps.d.ts +10 -0
  124. package/esm/internals/slots/chartBaseSlotProps.js +1 -0
  125. package/esm/internals/slots/chartsBaseSlots.d.ts +6 -0
  126. package/esm/internals/slots/chartsBaseSlots.js +1 -0
  127. package/esm/internals/slots/chartsIconSlots.d.ts +14 -0
  128. package/esm/internals/slots/chartsIconSlots.js +1 -0
  129. package/esm/typeOverloads/modules.d.ts +1 -1
  130. package/index.d.ts +4 -1
  131. package/index.js +23 -1
  132. package/internals/material/icons.d.ts +3 -0
  133. package/internals/material/icons.js +20 -0
  134. package/internals/material/index.d.ts +4 -0
  135. package/internals/material/index.js +19 -0
  136. package/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
  137. package/internals/plugins/useChartProZoom/calculateZoom.js +39 -0
  138. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
  139. package/internals/plugins/useChartProZoom/useChartProZoom.js +44 -2
  140. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +63 -11
  141. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
  142. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
  143. package/internals/slots/chartBaseSlotProps.d.ts +10 -0
  144. package/internals/slots/chartBaseSlotProps.js +5 -0
  145. package/internals/slots/chartsBaseSlots.d.ts +6 -0
  146. package/internals/slots/chartsBaseSlots.js +5 -0
  147. package/internals/slots/chartsIconSlots.d.ts +14 -0
  148. package/internals/slots/chartsIconSlots.js +5 -0
  149. package/package.json +7 -7
  150. package/typeOverloads/modules.d.ts +1 -1
  151. package/FunnelChart/curves/funnelStep.d.ts +0 -25
  152. package/FunnelChart/curves/funnelStep.js +0 -87
  153. package/esm/FunnelChart/curves/funnelStep.d.ts +0 -25
  154. package/esm/FunnelChart/curves/funnelStep.js +0 -80
@@ -0,0 +1,121 @@
1
+ /* eslint-disable class-methods-use-this */
2
+
3
+ import { borderRadiusPolygon } from "./borderRadiusPolygon.js";
4
+ import { lerpX, lerpY } from "./utils.js";
5
+
6
+ /**
7
+ * This is a custom "pyramid" curve generator.
8
+ * It draws straight lines for the 4 provided points. The slopes are calculated
9
+ * based on the min and max values of the x and y axes.
10
+ * with the option to add a gap between sections while also properly handling the border radius.
11
+ */
12
+ export class Pyramid {
13
+ constructor(context, {
14
+ isHorizontal,
15
+ gap,
16
+ position,
17
+ sections,
18
+ borderRadius,
19
+ min,
20
+ max
21
+ }) {
22
+ this.context = void 0;
23
+ this.position = 0;
24
+ this.sections = 0;
25
+ this.isHorizontal = false;
26
+ this.gap = 0;
27
+ this.borderRadius = 0;
28
+ this.min = {
29
+ x: 0,
30
+ y: 0
31
+ };
32
+ this.max = {
33
+ x: 0,
34
+ y: 0
35
+ };
36
+ this.points = [];
37
+ this.context = context;
38
+ this.isHorizontal = isHorizontal ?? false;
39
+ this.gap = (gap ?? 0) / 2;
40
+ this.position = position ?? 0;
41
+ this.sections = sections ?? 1;
42
+ this.borderRadius = borderRadius ?? 0;
43
+ this.min = min ?? {
44
+ x: 0,
45
+ y: 0
46
+ };
47
+ this.max = max ?? {
48
+ x: 0,
49
+ y: 0
50
+ };
51
+ }
52
+ areaStart() {}
53
+ areaEnd() {}
54
+ lineStart() {}
55
+ lineEnd() {}
56
+ getBorderRadius() {
57
+ if (this.gap > 0) {
58
+ return this.borderRadius;
59
+ }
60
+ if (this.position === 0) {
61
+ return [0, 0, this.borderRadius, this.borderRadius];
62
+ }
63
+ if (this.position === this.sections - 1 && this.gap <= 0) {
64
+ return [this.borderRadius];
65
+ }
66
+ if (this.position === this.sections - 1) {
67
+ return [this.borderRadius, this.borderRadius];
68
+ }
69
+ return 0;
70
+ }
71
+ point(xIn, yIn) {
72
+ this.points.push({
73
+ x: xIn,
74
+ y: yIn
75
+ });
76
+ if (this.points.length < 4) {
77
+ return;
78
+ }
79
+
80
+ // Add gaps where they are needed.
81
+ this.points = this.points.map((point, index) => {
82
+ if (this.isHorizontal) {
83
+ const slopeEnd = {
84
+ x: this.max.x,
85
+ y: (this.max.y + this.min.y) / 2
86
+ };
87
+ const slopeStart = index <= 1 ? this.min : {
88
+ x: this.min.x,
89
+ y: this.max.y
90
+ };
91
+ const yGetter = lerpY(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
92
+ const xGap = point.x + (index === 0 || index === 3 ? this.gap : -this.gap);
93
+ return {
94
+ x: xGap,
95
+ y: yGetter(xGap)
96
+ };
97
+ }
98
+ const slopeEnd = {
99
+ x: (this.max.x + this.min.x) / 2,
100
+ y: this.max.y
101
+ };
102
+ const slopeStart = index <= 1 ? {
103
+ x: this.max.x,
104
+ y: this.min.y
105
+ } : this.min;
106
+ const xGetter = lerpX(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
107
+ const yGap = point.y + (index === 0 || index === 3 ? this.gap : -this.gap);
108
+ return {
109
+ x: xGetter(yGap),
110
+ y: yGap
111
+ };
112
+ });
113
+
114
+ // In the last section, to form a triangle we need 3 points instead of 4
115
+ // Else the algorithm will break.
116
+ if (this.position === this.sections - 1 && this.gap <= 0) {
117
+ this.points = [this.points[0], this.points[1], this.points[3]];
118
+ }
119
+ borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
120
+ }
121
+ }
@@ -0,0 +1,31 @@
1
+ import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
+ import { CurveOptions } from "./curve.types.js";
3
+ /**
4
+ * This is a custom "step-pyramid" curve generator.
5
+ * It creates a step pyramid, which is a step-like shape with static lengths.
6
+ * It has the option to add a gap between sections while also properly handling the border radius.
7
+ */
8
+ export declare class StepPyramid implements CurveGenerator {
9
+ private context;
10
+ private position;
11
+ private isHorizontal;
12
+ private gap;
13
+ private borderRadius;
14
+ private min;
15
+ private max;
16
+ private points;
17
+ constructor(context: CanvasRenderingContext2D, {
18
+ isHorizontal,
19
+ gap,
20
+ position,
21
+ borderRadius,
22
+ min,
23
+ max
24
+ }: CurveOptions);
25
+ areaStart(): void;
26
+ areaEnd(): void;
27
+ lineStart(): void;
28
+ lineEnd(): void;
29
+ protected getBorderRadius(): number | number[];
30
+ point(xIn: number, yIn: number): void;
31
+ }
@@ -0,0 +1,101 @@
1
+ /* eslint-disable class-methods-use-this */
2
+
3
+ import { borderRadiusPolygon } from "./borderRadiusPolygon.js";
4
+ import { lerpX, lerpY } from "./utils.js";
5
+
6
+ /**
7
+ * This is a custom "step-pyramid" curve generator.
8
+ * It creates a step pyramid, which is a step-like shape with static lengths.
9
+ * It has the option to add a gap between sections while also properly handling the border radius.
10
+ */
11
+ export class StepPyramid {
12
+ constructor(context, {
13
+ isHorizontal,
14
+ gap,
15
+ position,
16
+ borderRadius,
17
+ min,
18
+ max
19
+ }) {
20
+ this.context = void 0;
21
+ this.position = 0;
22
+ this.isHorizontal = false;
23
+ this.gap = 0;
24
+ this.borderRadius = 0;
25
+ this.min = {
26
+ x: 0,
27
+ y: 0
28
+ };
29
+ this.max = {
30
+ x: 0,
31
+ y: 0
32
+ };
33
+ this.points = [];
34
+ this.context = context;
35
+ this.isHorizontal = isHorizontal ?? false;
36
+ this.gap = (gap ?? 0) / 2;
37
+ this.position = position ?? 0;
38
+ this.borderRadius = borderRadius ?? 0;
39
+ this.min = min ?? {
40
+ x: 0,
41
+ y: 0
42
+ };
43
+ this.max = max ?? {
44
+ x: 0,
45
+ y: 0
46
+ };
47
+ }
48
+ areaStart() {}
49
+ areaEnd() {}
50
+ lineStart() {}
51
+ lineEnd() {}
52
+ getBorderRadius() {
53
+ return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
54
+ }
55
+ point(xIn, yIn) {
56
+ this.points.push({
57
+ x: xIn,
58
+ y: yIn
59
+ });
60
+ if (this.points.length < 4) {
61
+ return;
62
+ }
63
+
64
+ // Add gaps where they are needed.
65
+ this.points = this.points.map((point, index) => {
66
+ if (this.isHorizontal) {
67
+ const slopeEnd = {
68
+ x: this.max.x,
69
+ y: (this.max.y + this.min.y) / 2
70
+ };
71
+ const slopeStart = index <= 1 ? this.min : {
72
+ x: this.min.x,
73
+ y: this.max.y
74
+ };
75
+ const yGetter = lerpY(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
76
+ const xGap = point.x + (index === 0 || index === 3 ? this.gap : -this.gap);
77
+ const xInitial = index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
78
+ return {
79
+ x: xGap,
80
+ y: yGetter(xInitial)
81
+ };
82
+ }
83
+ const slopeEnd = {
84
+ x: (this.max.x + this.min.x) / 2,
85
+ y: this.max.y
86
+ };
87
+ const slopeStart = index <= 1 ? {
88
+ x: this.max.x,
89
+ y: this.min.y
90
+ } : this.min;
91
+ const xGetter = lerpX(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
92
+ const yGap = point.y + (index === 0 || index === 3 ? this.gap : -this.gap);
93
+ const yInitial = index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
94
+ return {
95
+ x: xGetter(yInitial),
96
+ y: yGap
97
+ };
98
+ });
99
+ borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
100
+ }
101
+ }
@@ -0,0 +1,32 @@
1
+ import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
+ import { CurveOptions } from "./curve.types.js";
3
+ /**
4
+ * This is a custom "step" curve generator.
5
+ * It is used to draw "rectangles" from 4 points without having to rework the rendering logic,
6
+ * with the option to add a gap between sections while also properly handling the border radius.
7
+ *
8
+ * It takes the min and max of the x and y coordinates of the points to create a rectangle.
9
+ *
10
+ * The implementation is based on the d3-shape step curve generator.
11
+ * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
12
+ */
13
+ export declare class Step implements CurveGenerator {
14
+ private context;
15
+ private isHorizontal;
16
+ private gap;
17
+ private borderRadius;
18
+ private position;
19
+ private points;
20
+ constructor(context: CanvasRenderingContext2D, {
21
+ isHorizontal,
22
+ gap,
23
+ position,
24
+ borderRadius
25
+ }: CurveOptions);
26
+ areaStart(): void;
27
+ areaEnd(): void;
28
+ lineStart(): void;
29
+ lineEnd(): void;
30
+ protected getBorderRadius(): number | number[];
31
+ point(xIn: number, yIn: number): void;
32
+ }
@@ -0,0 +1,82 @@
1
+ /* eslint-disable class-methods-use-this */
2
+
3
+ import { borderRadiusPolygon } from "./borderRadiusPolygon.js";
4
+ import { max, min } from "./utils.js";
5
+
6
+ /**
7
+ * This is a custom "step" curve generator.
8
+ * It is used to draw "rectangles" from 4 points without having to rework the rendering logic,
9
+ * with the option to add a gap between sections while also properly handling the border radius.
10
+ *
11
+ * It takes the min and max of the x and y coordinates of the points to create a rectangle.
12
+ *
13
+ * The implementation is based on the d3-shape step curve generator.
14
+ * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
15
+ */
16
+ export class Step {
17
+ constructor(context, {
18
+ isHorizontal,
19
+ gap,
20
+ position,
21
+ borderRadius
22
+ }) {
23
+ this.context = void 0;
24
+ this.isHorizontal = false;
25
+ this.gap = 0;
26
+ this.borderRadius = 0;
27
+ this.position = 0;
28
+ this.points = [];
29
+ this.context = context;
30
+ this.isHorizontal = isHorizontal ?? false;
31
+ this.gap = (gap ?? 0) / 2;
32
+ this.position = position ?? 0;
33
+ this.borderRadius = borderRadius ?? 0;
34
+ }
35
+ areaStart() {}
36
+ areaEnd() {}
37
+ lineStart() {}
38
+ lineEnd() {}
39
+ getBorderRadius() {
40
+ return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
41
+ }
42
+ point(xIn, yIn) {
43
+ this.points.push({
44
+ x: xIn,
45
+ y: yIn
46
+ });
47
+ if (this.points.length < 4) {
48
+ return;
49
+ }
50
+
51
+ // Ensure we have rectangles instead of trapezoids.
52
+ this.points = this.points.map((_, index) => {
53
+ const allX = this.points.map(p => p.x);
54
+ const allY = this.points.map(p => p.y);
55
+ if (this.isHorizontal) {
56
+ return {
57
+ x: index === 1 || index === 2 ? max(allX) : min(allX),
58
+ y: index <= 1 ? max(allY) : min(allY)
59
+ };
60
+ }
61
+ return {
62
+ x: index <= 1 ? min(allX) : max(allX),
63
+ y: index === 1 || index === 2 ? max(allY) : min(allY)
64
+ };
65
+ });
66
+
67
+ // Add gaps where they are needed.
68
+ this.points = this.points.map((point, index) => {
69
+ if (this.isHorizontal) {
70
+ return {
71
+ x: point.x + (index === 0 || index === 3 ? this.gap : -this.gap),
72
+ y: point.y
73
+ };
74
+ }
75
+ return {
76
+ x: point.x,
77
+ y: point.y + (index === 0 || index === 3 ? this.gap : -this.gap)
78
+ };
79
+ });
80
+ borderRadiusPolygon(this.context, this.points, this.getBorderRadius());
81
+ }
82
+ }
@@ -0,0 +1,4 @@
1
+ export declare const max: (numbers: number[]) => number;
2
+ export declare const min: (numbers: number[]) => number;
3
+ export declare const lerpX: (x1: number, y1: number, x2: number, y2: number) => (y: number) => number;
4
+ export declare const lerpY: (x1: number, y1: number, x2: number, y2: number) => (x: number) => number;
@@ -0,0 +1,19 @@
1
+ export const max = numbers => Math.max(...numbers, -Infinity);
2
+ export const min = numbers => Math.min(...numbers, Infinity);
3
+ // From point1 to point2, get the x value from y
4
+ export const lerpX = (x1, y1, x2, y2) => y => {
5
+ if (y1 === y2) {
6
+ return x1;
7
+ }
8
+ const result = (x2 - x1) * (y - y1) / (y2 - y1) + x1;
9
+ return Number.isNaN(result) ? 0 : result;
10
+ };
11
+
12
+ // From point1 to point2, get the y value from x
13
+ export const lerpY = (x1, y1, x2, y2) => x => {
14
+ if (x1 === x2) {
15
+ return y1;
16
+ }
17
+ const result = (y2 - y1) * (x - x1) / (x2 - x1) + y1;
18
+ return Number.isNaN(result) ? 0 : result;
19
+ };
@@ -43,11 +43,23 @@ export interface FunnelSeriesType extends Omit<CommonSeriesType<FunnelValueType>
43
43
  */
44
44
  layout?: 'horizontal' | 'vertical';
45
45
  /**
46
- * The type of curve to use for the line. Read more about curves at
47
- * [line interpolation](https://mui.com/x/react-charts/lines/#interpolation).
46
+ * The type of curve to use for the line.
47
+ *
48
+ * - `bump`: A curve that creates a smooth transition between points, with a bump in the middle.
49
+ * - `linear`: A straight line between points.
50
+ * - `step`: A step line that creates a staircase effect.
51
+ * - `pyramid`: A pyramid shape that connects the points.
52
+ * - `step-pyramid`: A step line that creates a staircase effect, with a pyramid shape.
53
+ *
54
+ * Read more about curves at [curve interpolation](https://mui.com/x/react-charts/funnel/#curve-interpolation).
48
55
  * @default 'linear'
49
56
  */
50
57
  curve?: FunnelCurveType;
58
+ /**
59
+ * The radius, in pixels, of the corners of the funnel sections.
60
+ * @default 8
61
+ */
62
+ borderRadius?: number;
51
63
  /**
52
64
  * The label configuration for the funnel plot.
53
65
  * Allows to customize the position and margin of the label that is displayed on the funnel sections.
@@ -56,6 +68,15 @@ export interface FunnelSeriesType extends Omit<CommonSeriesType<FunnelValueType>
56
68
  * @default { vertical: 'middle', horizontal: 'center' }
57
69
  */
58
70
  sectionLabel?: FunnelLabelOptions | ((item: FunnelItem) => FunnelLabelOptions | false) | false;
71
+ /**
72
+ * Defines if the funnel sections are filled or outlined.
73
+ *
74
+ * An `outlined` funnel will have a stroke around the sections and a translucent fill.
75
+ * A `filled` funnel will have a solid fill and no stroke.
76
+ *
77
+ * @default 'filled'
78
+ */
79
+ variant?: 'filled' | 'outlined';
59
80
  }
60
81
  /**
61
82
  * An object that allows to identify a funnel item.
@@ -6,6 +6,10 @@ export interface FunnelSectionClasses {
6
6
  highlighted: string;
7
7
  /** Styles applied to the root element if `faded={true}`. */
8
8
  faded: string;
9
+ /** Styles applied to the root element if `variant="filled"`. */
10
+ filled: string;
11
+ /** Styles applied to the root element if `variant="outlined"`. */
12
+ outlined: string;
9
13
  /** Styles applied to the label element. */
10
14
  label: string;
11
15
  /**
@@ -14,5 +18,5 @@ export interface FunnelSectionClasses {
14
18
  */
15
19
  series: string;
16
20
  }
17
- export declare const useUtilityClasses: (props: FunnelSectionProps) => Record<"label" | "highlighted" | "faded" | "root", string>;
21
+ export declare const useUtilityClasses: (props: FunnelSectionProps) => Record<"label" | "filled" | "outlined" | "highlighted" | "faded" | "root", string>;
18
22
  export declare const funnelSectionClasses: FunnelSectionClasses;
@@ -7,14 +7,17 @@ function getFunnelSectionUtilityClass(slot) {
7
7
  export const useUtilityClasses = props => {
8
8
  const {
9
9
  classes,
10
- seriesId
10
+ seriesId,
11
+ variant
11
12
  } = props;
12
13
  const slots = {
13
14
  root: ['root', `series-${seriesId}`],
14
15
  highlighted: ['highlighted'],
15
16
  faded: ['faded'],
17
+ outlined: variant === 'outlined' ? ['outlined'] : [],
18
+ filled: variant === 'filled' ? ['filled'] : [],
16
19
  label: ['label']
17
20
  };
18
21
  return composeClasses(slots, getFunnelSectionUtilityClass, classes);
19
22
  };
20
- export const funnelSectionClasses = generateUtilityClasses('MuiFunnelSection', ['root', 'highlighted', 'faded', 'label', 'series']);
23
+ export const funnelSectionClasses = generateUtilityClasses('MuiFunnelSection', ['root', 'highlighted', 'faded', 'filled', 'outlined', 'label', 'series']);
@@ -3,6 +3,7 @@ const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
3
3
  return _extends({
4
4
  id: seriesData.id ?? `auto-generated-id-${seriesIndex}`
5
5
  }, seriesData, {
6
+ borderRadius: seriesData.borderRadius ?? 8,
6
7
  data: seriesData.data.map((d, index) => _extends({
7
8
  color: colors[index % colors.length]
8
9
  }, d))
@@ -1,7 +1,6 @@
1
1
  import { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
2
2
  import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
3
3
  import { ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
4
- import { ChartsClipPathProps } from '@mui/x-charts/ChartsClipPath';
5
4
  import { ChartsWrapperProps } from '@mui/x-charts/internals';
6
5
  import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
7
6
  import { FunnelPlotProps } from "./FunnelPlot.js";
@@ -20,10 +19,6 @@ export declare const useFunnelChartProps: (props: FunnelChartProps) => {
20
19
  overlayProps: ChartsOverlayProps;
21
20
  chartsAxisProps: ChartsAxisProps;
22
21
  legendProps: ChartsLegendSlotExtension;
23
- clipPathGroupProps: {
24
- clipPath: string;
25
- };
26
- clipPathProps: ChartsClipPathProps;
27
22
  chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
28
23
  axisHighlightProps: ChartsAxisHighlightProps;
29
24
  children: import("react").ReactNode;
@@ -4,7 +4,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef", "gap"];
6
6
  import { DEFAULT_MARGINS, DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
7
- import useId from '@mui/utils/useId';
8
7
  import { defaultizeMargin } from '@mui/x-charts/internals';
9
8
  import { warnOnce } from '@mui/x-internals/warning';
10
9
  import { strawberrySkyPalette } from '@mui/x-charts/colorPalettes';
@@ -90,8 +89,6 @@ export const useFunnelChartProps = props => {
90
89
  } = props,
91
90
  rest = _objectWithoutPropertiesLoose(props, _excluded);
92
91
  const margin = defaultizeMargin(marginProps, DEFAULT_MARGINS);
93
- const id = useId();
94
- const clipPathId = `${id}-clip-path`;
95
92
  const isHorizontal = series.some(s => s.layout === 'horizontal');
96
93
  const valueAxisConfig = {
97
94
  id: isHorizontal ? DEFAULT_Y_AXIS_KEY : DEFAULT_X_AXIS_KEY,
@@ -137,12 +134,6 @@ export const useFunnelChartProps = props => {
137
134
  slots,
138
135
  slotProps
139
136
  };
140
- const clipPathGroupProps = {
141
- clipPath: `url(#${clipPathId})`
142
- };
143
- const clipPathProps = {
144
- id: clipPathId
145
- };
146
137
  const chartsWrapperProps = {
147
138
  sx,
148
139
  legendPosition: props.slotProps?.legend?.position,
@@ -155,8 +146,6 @@ export const useFunnelChartProps = props => {
155
146
  overlayProps,
156
147
  chartsAxisProps,
157
148
  legendProps,
158
- clipPathGroupProps,
159
- clipPathProps,
160
149
  chartsWrapperProps,
161
150
  axisHighlightProps,
162
151
  children
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
3
  import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
4
4
  import { ChartsTooltipProps } from '@mui/x-charts/ChartsTooltip';
5
- import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps, AxisConfig } from '@mui/x-charts/internals';
5
+ import { ChartsAxisSlots, ChartsAxisSlotProps, XAxis, YAxis } from '@mui/x-charts/internals';
6
6
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
7
7
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
8
8
  import { HeatmapSeriesType } from "../models/seriesType/heatmap.js";
@@ -25,13 +25,13 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
25
25
  * If not provided, a default axis config is used.
26
26
  * An array of [[AxisConfig]] objects.
27
27
  */
28
- xAxis: Readonly<MakeOptional<AxisConfig<'band', any, ChartsXAxisProps>, 'id' | 'scaleType'>[]>;
28
+ xAxis: Readonly<Omit<MakeOptional<XAxis<'band'>, 'scaleType'>, 'zoom'>[]>;
29
29
  /**
30
30
  * The configuration of the y-axes.
31
31
  * If not provided, a default axis config is used.
32
32
  * An array of [[AxisConfig]] objects.
33
33
  */
34
- yAxis: Readonly<MakeOptional<AxisConfig<'band', any, ChartsYAxisProps>, 'id' | 'scaleType'>[]>;
34
+ yAxis: Readonly<Omit<MakeOptional<YAxis<'band'>, 'scaleType'>, 'zoom'>[]>;
35
35
  /**
36
36
  * The series to display in the bar chart.
37
37
  * An array of [[HeatmapSeriesType]] objects.
@@ -285,16 +285,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
285
285
  tickNumber: PropTypes.number,
286
286
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
287
287
  tickSize: PropTypes.number,
288
- valueFormatter: PropTypes.func,
289
- zoom: PropTypes.oneOfType([PropTypes.shape({
290
- filterMode: PropTypes.oneOf(['discard', 'keep']),
291
- maxEnd: PropTypes.number,
292
- maxSpan: PropTypes.number,
293
- minSpan: PropTypes.number,
294
- minStart: PropTypes.number,
295
- panning: PropTypes.bool,
296
- step: PropTypes.number
297
- }), PropTypes.bool])
288
+ valueFormatter: PropTypes.func
298
289
  })).isRequired,
299
290
  /**
300
291
  * The configuration of the y-axes.
@@ -352,16 +343,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
352
343
  tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
353
344
  tickSize: PropTypes.number,
354
345
  valueFormatter: PropTypes.func,
355
- width: PropTypes.number,
356
- zoom: PropTypes.oneOfType([PropTypes.shape({
357
- filterMode: PropTypes.oneOf(['discard', 'keep']),
358
- maxEnd: PropTypes.number,
359
- maxSpan: PropTypes.number,
360
- minSpan: PropTypes.number,
361
- minStart: PropTypes.number,
362
- panning: PropTypes.bool,
363
- step: PropTypes.number
364
- }), PropTypes.bool])
346
+ width: PropTypes.number
365
347
  })).isRequired,
366
348
  /**
367
349
  * The configuration of the z-axes.
@@ -2,7 +2,13 @@ import * as React from 'react';
2
2
  import { LineChartProps } from '@mui/x-charts/LineChart';
3
3
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
4
4
  import { LineChartProPluginsSignatures } from "./LineChartPro.plugins.js";
5
- export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line', LineChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig'> {}
5
+ export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line', LineChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig'> {
6
+ /**
7
+ * If true, shows the default chart toolbar.
8
+ * @default false
9
+ */
10
+ showToolbar?: boolean;
11
+ }
6
12
  /**
7
13
  * Demos:
8
14
  *