@mui/x-charts-pro 8.2.0 → 8.3.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.
Files changed (154) hide show
  1. package/BarChartPro/BarChartPro.d.ts +7 -1
  2. package/BarChartPro/BarChartPro.js +60 -4
  3. package/CHANGELOG.md +107 -0
  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 +5 -2
  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 +90 -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,127 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Pyramid = void 0;
7
+ var _borderRadiusPolygon = require("./borderRadiusPolygon");
8
+ var _utils = require("./utils");
9
+ /* eslint-disable class-methods-use-this */
10
+
11
+ /**
12
+ * This is a custom "pyramid" curve generator.
13
+ * It draws straight lines for the 4 provided points. The slopes are calculated
14
+ * based on the min and max values of the x and y axes.
15
+ * with the option to add a gap between sections while also properly handling the border radius.
16
+ */
17
+ class Pyramid {
18
+ constructor(context, {
19
+ isHorizontal,
20
+ gap,
21
+ position,
22
+ sections,
23
+ borderRadius,
24
+ min,
25
+ max
26
+ }) {
27
+ this.context = void 0;
28
+ this.position = 0;
29
+ this.sections = 0;
30
+ this.isHorizontal = false;
31
+ this.gap = 0;
32
+ this.borderRadius = 0;
33
+ this.min = {
34
+ x: 0,
35
+ y: 0
36
+ };
37
+ this.max = {
38
+ x: 0,
39
+ y: 0
40
+ };
41
+ this.points = [];
42
+ this.context = context;
43
+ this.isHorizontal = isHorizontal ?? false;
44
+ this.gap = (gap ?? 0) / 2;
45
+ this.position = position ?? 0;
46
+ this.sections = sections ?? 1;
47
+ this.borderRadius = borderRadius ?? 0;
48
+ this.min = min ?? {
49
+ x: 0,
50
+ y: 0
51
+ };
52
+ this.max = max ?? {
53
+ x: 0,
54
+ y: 0
55
+ };
56
+ }
57
+ areaStart() {}
58
+ areaEnd() {}
59
+ lineStart() {}
60
+ lineEnd() {}
61
+ getBorderRadius() {
62
+ if (this.gap > 0) {
63
+ return this.borderRadius;
64
+ }
65
+ if (this.position === 0) {
66
+ return [0, 0, this.borderRadius, this.borderRadius];
67
+ }
68
+ if (this.position === this.sections - 1 && this.gap <= 0) {
69
+ return [this.borderRadius];
70
+ }
71
+ if (this.position === this.sections - 1) {
72
+ return [this.borderRadius, this.borderRadius];
73
+ }
74
+ return 0;
75
+ }
76
+ point(xIn, yIn) {
77
+ this.points.push({
78
+ x: xIn,
79
+ y: yIn
80
+ });
81
+ if (this.points.length < 4) {
82
+ return;
83
+ }
84
+
85
+ // Add gaps where they are needed.
86
+ this.points = this.points.map((point, index) => {
87
+ if (this.isHorizontal) {
88
+ const slopeEnd = {
89
+ x: this.max.x,
90
+ y: (this.max.y + this.min.y) / 2
91
+ };
92
+ const slopeStart = index <= 1 ? this.min : {
93
+ x: this.min.x,
94
+ y: this.max.y
95
+ };
96
+ const yGetter = (0, _utils.lerpY)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
97
+ const xGap = point.x + (index === 0 || index === 3 ? this.gap : -this.gap);
98
+ return {
99
+ x: xGap,
100
+ y: yGetter(xGap)
101
+ };
102
+ }
103
+ const slopeEnd = {
104
+ x: (this.max.x + this.min.x) / 2,
105
+ y: this.max.y
106
+ };
107
+ const slopeStart = index <= 1 ? {
108
+ x: this.max.x,
109
+ y: this.min.y
110
+ } : this.min;
111
+ const xGetter = (0, _utils.lerpX)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
112
+ const yGap = point.y + (index === 0 || index === 3 ? this.gap : -this.gap);
113
+ return {
114
+ x: xGetter(yGap),
115
+ y: yGap
116
+ };
117
+ });
118
+
119
+ // In the last section, to form a triangle we need 3 points instead of 4
120
+ // Else the algorithm will break.
121
+ if (this.position === this.sections - 1 && this.gap <= 0) {
122
+ this.points = [this.points[0], this.points[1], this.points[3]];
123
+ }
124
+ (0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
125
+ }
126
+ }
127
+ exports.Pyramid = Pyramid;
@@ -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,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StepPyramid = void 0;
7
+ var _borderRadiusPolygon = require("./borderRadiusPolygon");
8
+ var _utils = require("./utils");
9
+ /* eslint-disable class-methods-use-this */
10
+
11
+ /**
12
+ * This is a custom "step-pyramid" curve generator.
13
+ * It creates a step pyramid, which is a step-like shape with static lengths.
14
+ * It has the option to add a gap between sections while also properly handling the border radius.
15
+ */
16
+ class StepPyramid {
17
+ constructor(context, {
18
+ isHorizontal,
19
+ gap,
20
+ position,
21
+ borderRadius,
22
+ min,
23
+ max
24
+ }) {
25
+ this.context = void 0;
26
+ this.position = 0;
27
+ this.isHorizontal = false;
28
+ this.gap = 0;
29
+ this.borderRadius = 0;
30
+ this.min = {
31
+ x: 0,
32
+ y: 0
33
+ };
34
+ this.max = {
35
+ x: 0,
36
+ y: 0
37
+ };
38
+ this.points = [];
39
+ this.context = context;
40
+ this.isHorizontal = isHorizontal ?? false;
41
+ this.gap = (gap ?? 0) / 2;
42
+ this.position = position ?? 0;
43
+ this.borderRadius = borderRadius ?? 0;
44
+ this.min = min ?? {
45
+ x: 0,
46
+ y: 0
47
+ };
48
+ this.max = max ?? {
49
+ x: 0,
50
+ y: 0
51
+ };
52
+ }
53
+ areaStart() {}
54
+ areaEnd() {}
55
+ lineStart() {}
56
+ lineEnd() {}
57
+ getBorderRadius() {
58
+ return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
59
+ }
60
+ point(xIn, yIn) {
61
+ this.points.push({
62
+ x: xIn,
63
+ y: yIn
64
+ });
65
+ if (this.points.length < 4) {
66
+ return;
67
+ }
68
+
69
+ // Add gaps where they are needed.
70
+ this.points = this.points.map((point, index) => {
71
+ if (this.isHorizontal) {
72
+ const slopeEnd = {
73
+ x: this.max.x,
74
+ y: (this.max.y + this.min.y) / 2
75
+ };
76
+ const slopeStart = index <= 1 ? this.min : {
77
+ x: this.min.x,
78
+ y: this.max.y
79
+ };
80
+ const yGetter = (0, _utils.lerpY)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
81
+ const xGap = point.x + (index === 0 || index === 3 ? this.gap : -this.gap);
82
+ const xInitial = index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
83
+ return {
84
+ x: xGap,
85
+ y: yGetter(xInitial)
86
+ };
87
+ }
88
+ const slopeEnd = {
89
+ x: (this.max.x + this.min.x) / 2,
90
+ y: this.max.y
91
+ };
92
+ const slopeStart = index <= 1 ? {
93
+ x: this.max.x,
94
+ y: this.min.y
95
+ } : this.min;
96
+ const xGetter = (0, _utils.lerpX)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
97
+ const yGap = point.y + (index === 0 || index === 3 ? this.gap : -this.gap);
98
+ const yInitial = index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
99
+ return {
100
+ x: xGetter(yInitial),
101
+ y: yGap
102
+ };
103
+ });
104
+ (0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
105
+ }
106
+ }
107
+ exports.StepPyramid = StepPyramid;
@@ -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,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Step = void 0;
7
+ var _borderRadiusPolygon = require("./borderRadiusPolygon");
8
+ var _utils = require("./utils");
9
+ /* eslint-disable class-methods-use-this */
10
+
11
+ /**
12
+ * This is a custom "step" curve generator.
13
+ * It is used to draw "rectangles" from 4 points without having to rework the rendering logic,
14
+ * with the option to add a gap between sections while also properly handling the border radius.
15
+ *
16
+ * It takes the min and max of the x and y coordinates of the points to create a rectangle.
17
+ *
18
+ * The implementation is based on the d3-shape step curve generator.
19
+ * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
20
+ */
21
+ class Step {
22
+ constructor(context, {
23
+ isHorizontal,
24
+ gap,
25
+ position,
26
+ borderRadius
27
+ }) {
28
+ this.context = void 0;
29
+ this.isHorizontal = false;
30
+ this.gap = 0;
31
+ this.borderRadius = 0;
32
+ this.position = 0;
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
+ }
40
+ areaStart() {}
41
+ areaEnd() {}
42
+ lineStart() {}
43
+ lineEnd() {}
44
+ getBorderRadius() {
45
+ return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
46
+ }
47
+ point(xIn, yIn) {
48
+ this.points.push({
49
+ x: xIn,
50
+ y: yIn
51
+ });
52
+ if (this.points.length < 4) {
53
+ return;
54
+ }
55
+
56
+ // Ensure we have rectangles instead of trapezoids.
57
+ this.points = this.points.map((_, index) => {
58
+ const allX = this.points.map(p => p.x);
59
+ const allY = this.points.map(p => p.y);
60
+ if (this.isHorizontal) {
61
+ return {
62
+ x: index === 1 || index === 2 ? (0, _utils.max)(allX) : (0, _utils.min)(allX),
63
+ y: index <= 1 ? (0, _utils.max)(allY) : (0, _utils.min)(allY)
64
+ };
65
+ }
66
+ return {
67
+ x: index <= 1 ? (0, _utils.min)(allX) : (0, _utils.max)(allX),
68
+ y: index === 1 || index === 2 ? (0, _utils.max)(allY) : (0, _utils.min)(allY)
69
+ };
70
+ });
71
+
72
+ // Add gaps where they are needed.
73
+ this.points = this.points.map((point, index) => {
74
+ if (this.isHorizontal) {
75
+ return {
76
+ x: point.x + (index === 0 || index === 3 ? this.gap : -this.gap),
77
+ y: point.y
78
+ };
79
+ }
80
+ return {
81
+ x: point.x,
82
+ y: point.y + (index === 0 || index === 3 ? this.gap : -this.gap)
83
+ };
84
+ });
85
+ (0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
86
+ }
87
+ }
88
+ exports.Step = Step;
@@ -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,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.min = exports.max = exports.lerpY = exports.lerpX = void 0;
7
+ const max = numbers => Math.max(...numbers, -Infinity);
8
+ exports.max = max;
9
+ const min = numbers => Math.min(...numbers, Infinity);
10
+ // From point1 to point2, get the x value from y
11
+ exports.min = min;
12
+ const lerpX = (x1, y1, x2, y2) => y => {
13
+ if (y1 === y2) {
14
+ return x1;
15
+ }
16
+ const result = (x2 - x1) * (y - y1) / (y2 - y1) + x1;
17
+ return Number.isNaN(result) ? 0 : result;
18
+ };
19
+
20
+ // From point1 to point2, get the y value from x
21
+ exports.lerpX = lerpX;
22
+ const lerpY = (x1, y1, x2, y2) => x => {
23
+ if (x1 === x2) {
24
+ return y1;
25
+ }
26
+ const result = (y2 - y1) * (x - x1) / (x2 - x1) + y1;
27
+ return Number.isNaN(result) ? 0 : result;
28
+ };
29
+ exports.lerpY = lerpY;
@@ -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;
@@ -14,15 +14,18 @@ function getFunnelSectionUtilityClass(slot) {
14
14
  const useUtilityClasses = props => {
15
15
  const {
16
16
  classes,
17
- seriesId
17
+ seriesId,
18
+ variant
18
19
  } = props;
19
20
  const slots = {
20
21
  root: ['root', `series-${seriesId}`],
21
22
  highlighted: ['highlighted'],
22
23
  faded: ['faded'],
24
+ outlined: variant === 'outlined' ? ['outlined'] : [],
25
+ filled: variant === 'filled' ? ['filled'] : [],
23
26
  label: ['label']
24
27
  };
25
28
  return (0, _composeClasses.default)(slots, getFunnelSectionUtilityClass, classes);
26
29
  };
27
30
  exports.useUtilityClasses = useUtilityClasses;
28
- const funnelSectionClasses = exports.funnelSectionClasses = (0, _generateUtilityClasses.default)('MuiFunnelSection', ['root', 'highlighted', 'faded', 'label', 'series']);
31
+ const funnelSectionClasses = exports.funnelSectionClasses = (0, _generateUtilityClasses.default)('MuiFunnelSection', ['root', 'highlighted', 'faded', 'filled', 'outlined', 'label', 'series']);
@@ -10,6 +10,7 @@ const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
10
10
  return (0, _extends2.default)({
11
11
  id: seriesData.id ?? `auto-generated-id-${seriesIndex}`
12
12
  }, seriesData, {
13
+ borderRadius: seriesData.borderRadius ?? 8,
13
14
  data: seriesData.data.map((d, index) => (0, _extends2.default)({
14
15
  color: colors[index % colors.length]
15
16
  }, 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;
@@ -9,7 +9,6 @@ exports.useFunnelChartProps = void 0;
9
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _constants = require("@mui/x-charts/constants");
12
- var _useId = _interopRequireDefault(require("@mui/utils/useId"));
13
12
  var _internals = require("@mui/x-charts/internals");
14
13
  var _warning = require("@mui/x-internals/warning");
15
14
  var _colorPalettes = require("@mui/x-charts/colorPalettes");
@@ -96,8 +95,6 @@ const useFunnelChartProps = props => {
96
95
  } = props,
97
96
  rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
98
97
  const margin = (0, _internals.defaultizeMargin)(marginProps, _constants.DEFAULT_MARGINS);
99
- const id = (0, _useId.default)();
100
- const clipPathId = `${id}-clip-path`;
101
98
  const isHorizontal = series.some(s => s.layout === 'horizontal');
102
99
  const valueAxisConfig = {
103
100
  id: isHorizontal ? _constants.DEFAULT_Y_AXIS_KEY : _constants.DEFAULT_X_AXIS_KEY,
@@ -143,12 +140,6 @@ const useFunnelChartProps = props => {
143
140
  slots,
144
141
  slotProps
145
142
  };
146
- const clipPathGroupProps = {
147
- clipPath: `url(#${clipPathId})`
148
- };
149
- const clipPathProps = {
150
- id: clipPathId
151
- };
152
143
  const chartsWrapperProps = {
153
144
  sx,
154
145
  legendPosition: props.slotProps?.legend?.position,
@@ -161,8 +152,6 @@ const useFunnelChartProps = props => {
161
152
  overlayProps,
162
153
  chartsAxisProps,
163
154
  legendProps,
164
- clipPathGroupProps,
165
- clipPathProps,
166
155
  chartsWrapperProps,
167
156
  axisHighlightProps,
168
157
  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.
@@ -292,16 +292,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
292
292
  tickNumber: _propTypes.default.number,
293
293
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
294
294
  tickSize: _propTypes.default.number,
295
- valueFormatter: _propTypes.default.func,
296
- zoom: _propTypes.default.oneOfType([_propTypes.default.shape({
297
- filterMode: _propTypes.default.oneOf(['discard', 'keep']),
298
- maxEnd: _propTypes.default.number,
299
- maxSpan: _propTypes.default.number,
300
- minSpan: _propTypes.default.number,
301
- minStart: _propTypes.default.number,
302
- panning: _propTypes.default.bool,
303
- step: _propTypes.default.number
304
- }), _propTypes.default.bool])
295
+ valueFormatter: _propTypes.default.func
305
296
  })).isRequired,
306
297
  /**
307
298
  * The configuration of the y-axes.
@@ -359,16 +350,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
359
350
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
360
351
  tickSize: _propTypes.default.number,
361
352
  valueFormatter: _propTypes.default.func,
362
- width: _propTypes.default.number,
363
- zoom: _propTypes.default.oneOfType([_propTypes.default.shape({
364
- filterMode: _propTypes.default.oneOf(['discard', 'keep']),
365
- maxEnd: _propTypes.default.number,
366
- maxSpan: _propTypes.default.number,
367
- minSpan: _propTypes.default.number,
368
- minStart: _propTypes.default.number,
369
- panning: _propTypes.default.bool,
370
- step: _propTypes.default.number
371
- }), _propTypes.default.bool])
353
+ width: _propTypes.default.number
372
354
  })).isRequired,
373
355
  /**
374
356
  * 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
  *