@mui/x-charts-pro 8.3.0 → 8.4.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 (92) hide show
  1. package/BarChartPro/BarChartPro.js +37 -20
  2. package/CHANGELOG.md +206 -10
  3. package/ChartContainerPro/ChartContainerPro.js +1 -0
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  5. package/ChartZoomSlider/index.d.ts +1 -1
  6. package/ChartZoomSlider/index.js +4 -4
  7. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +94 -60
  8. package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
  9. package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +92 -0
  10. package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
  11. package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +58 -0
  12. package/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
  13. package/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +6 -6
  14. package/FunnelChart/FunnelChart.js +4 -3
  15. package/FunnelChart/FunnelPlot.js +2 -0
  16. package/FunnelChart/FunnelSection.js +2 -1
  17. package/FunnelChart/curves/curve.types.d.ts +4 -0
  18. package/FunnelChart/curves/pyramid.d.ts +3 -1
  19. package/FunnelChart/curves/pyramid.js +37 -10
  20. package/FunnelChart/curves/step-pyramid.d.ts +10 -2
  21. package/FunnelChart/curves/step-pyramid.js +96 -20
  22. package/FunnelChart/curves/step.d.ts +5 -1
  23. package/FunnelChart/curves/step.js +20 -2
  24. package/FunnelChart/funnel.types.d.ts +7 -0
  25. package/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
  26. package/Heatmap/Heatmap.d.ts +1 -1
  27. package/Heatmap/Heatmap.js +25 -21
  28. package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
  29. package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +27 -0
  30. package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
  31. package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +4 -102
  32. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
  33. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +5 -0
  34. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
  35. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +96 -0
  36. package/Heatmap/HeatmapTooltip/index.d.ts +3 -1
  37. package/Heatmap/HeatmapTooltip/index.js +11 -0
  38. package/LineChartPro/LineChartPro.js +37 -20
  39. package/ScatterChartPro/ScatterChartPro.js +38 -21
  40. package/esm/BarChartPro/BarChartPro.js +35 -18
  41. package/esm/ChartContainerPro/ChartContainerPro.js +1 -0
  42. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  43. package/esm/ChartZoomSlider/index.d.ts +1 -1
  44. package/esm/ChartZoomSlider/index.js +1 -1
  45. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +94 -60
  46. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
  47. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +85 -0
  48. package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
  49. package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +52 -0
  50. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
  51. package/esm/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +4 -4
  52. package/esm/FunnelChart/FunnelChart.js +4 -3
  53. package/esm/FunnelChart/FunnelPlot.js +2 -0
  54. package/esm/FunnelChart/FunnelSection.js +1 -0
  55. package/esm/FunnelChart/curves/curve.types.d.ts +4 -0
  56. package/esm/FunnelChart/curves/pyramid.d.ts +3 -1
  57. package/esm/FunnelChart/curves/pyramid.js +37 -10
  58. package/esm/FunnelChart/curves/step-pyramid.d.ts +10 -2
  59. package/esm/FunnelChart/curves/step-pyramid.js +96 -20
  60. package/esm/FunnelChart/curves/step.d.ts +5 -1
  61. package/esm/FunnelChart/curves/step.js +20 -2
  62. package/esm/FunnelChart/funnel.types.d.ts +7 -0
  63. package/esm/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
  64. package/esm/Heatmap/Heatmap.d.ts +1 -1
  65. package/esm/Heatmap/Heatmap.js +23 -19
  66. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
  67. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +19 -0
  68. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
  69. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +5 -103
  70. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
  71. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +1 -0
  72. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
  73. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +89 -0
  74. package/esm/Heatmap/HeatmapTooltip/index.d.ts +3 -1
  75. package/esm/Heatmap/HeatmapTooltip/index.js +3 -1
  76. package/esm/LineChartPro/LineChartPro.js +35 -18
  77. package/esm/ScatterChartPro/ScatterChartPro.js +36 -19
  78. package/esm/index.d.ts +1 -1
  79. package/esm/index.js +1 -3
  80. package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
  81. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +2 -2
  82. package/index.d.ts +1 -1
  83. package/index.js +1 -68
  84. package/internals/plugins/useChartProExport/exportImage.js +1 -1
  85. package/internals/plugins/useChartProZoom/useChartProZoom.js +2 -2
  86. package/package.json +5 -5
  87. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  88. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
  89. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
  90. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  91. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
  92. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
@@ -22,12 +22,14 @@ class Pyramid {
22
22
  sections,
23
23
  borderRadius,
24
24
  min,
25
- max
25
+ max,
26
+ isIncreasing
26
27
  }) {
27
28
  this.context = void 0;
28
29
  this.position = 0;
29
30
  this.sections = 0;
30
31
  this.isHorizontal = false;
32
+ this.isIncreasing = false;
31
33
  this.gap = 0;
32
34
  this.borderRadius = 0;
33
35
  this.min = {
@@ -45,6 +47,7 @@ class Pyramid {
45
47
  this.position = position ?? 0;
46
48
  this.sections = sections ?? 1;
47
49
  this.borderRadius = borderRadius ?? 0;
50
+ this.isIncreasing = isIncreasing ?? false;
48
51
  this.min = min ?? {
49
52
  x: 0,
50
53
  y: 0
@@ -53,6 +56,12 @@ class Pyramid {
53
56
  x: 0,
54
57
  y: 0
55
58
  };
59
+ if (isIncreasing) {
60
+ const currentMin = this.min;
61
+ const currentMax = this.max;
62
+ this.min = currentMax;
63
+ this.max = currentMin;
64
+ }
56
65
  }
57
66
  areaStart() {}
58
67
  areaEnd() {}
@@ -62,14 +71,25 @@ class Pyramid {
62
71
  if (this.gap > 0) {
63
72
  return this.borderRadius;
64
73
  }
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];
74
+ if (this.isIncreasing) {
75
+ // Is largest section
76
+ if (this.position === this.sections - 1) {
77
+ return [this.borderRadius, this.borderRadius];
78
+ }
79
+ // Is smallest section and shaped like a triangle
80
+ if (this.position === 0) {
81
+ return [0, 0, this.borderRadius];
82
+ }
70
83
  }
71
- if (this.position === this.sections - 1) {
72
- return [this.borderRadius, this.borderRadius];
84
+ if (!this.isIncreasing) {
85
+ // Is largest section
86
+ if (this.position === 0) {
87
+ return [0, 0, this.borderRadius, this.borderRadius];
88
+ }
89
+ // Is smallest section and shaped like a triangle
90
+ if (this.position === this.sections - 1) {
91
+ return [this.borderRadius];
92
+ }
73
93
  }
74
94
  return 0;
75
95
  }
@@ -118,8 +138,15 @@ class Pyramid {
118
138
 
119
139
  // In the last section, to form a triangle we need 3 points instead of 4
120
140
  // 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]];
141
+ const isLastSection = this.position === this.sections - 1;
142
+ const isFirstSection = this.position === 0;
143
+ if (this.gap <= 0) {
144
+ if (isFirstSection && this.isIncreasing) {
145
+ this.points = [this.points[0], this.points[1], this.points[2]];
146
+ }
147
+ if (isLastSection && !this.isIncreasing) {
148
+ this.points = [this.points[0], this.points[1], this.points[3]];
149
+ }
123
150
  }
124
151
  (0, _borderRadiusPolygon.borderRadiusPolygon)(this.context, this.points, this.getBorderRadius());
125
152
  }
@@ -1,5 +1,5 @@
1
1
  import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
- import { CurveOptions } from "./curve.types.js";
2
+ import { CurveOptions, Point } from "./curve.types.js";
3
3
  /**
4
4
  * This is a custom "step-pyramid" curve generator.
5
5
  * It creates a step pyramid, which is a step-like shape with static lengths.
@@ -8,7 +8,9 @@ import { CurveOptions } from "./curve.types.js";
8
8
  export declare class StepPyramid implements CurveGenerator {
9
9
  private context;
10
10
  private position;
11
+ private sections;
11
12
  private isHorizontal;
13
+ private isIncreasing;
12
14
  private gap;
13
15
  private borderRadius;
14
16
  private min;
@@ -18,14 +20,20 @@ export declare class StepPyramid implements CurveGenerator {
18
20
  isHorizontal,
19
21
  gap,
20
22
  position,
23
+ sections,
21
24
  borderRadius,
22
25
  min,
23
- max
26
+ max,
27
+ isIncreasing
24
28
  }: CurveOptions);
25
29
  areaStart(): void;
26
30
  areaEnd(): void;
27
31
  lineStart(): void;
28
32
  lineEnd(): void;
29
33
  protected getBorderRadius(): number | number[];
34
+ slopeStart(index: number): Point;
35
+ slopeEnd(index: number): Point;
36
+ initialX(index: number): number;
37
+ initialY(index: number): number;
30
38
  point(xIn: number, yIn: number): void;
31
39
  }
@@ -18,13 +18,17 @@ class StepPyramid {
18
18
  isHorizontal,
19
19
  gap,
20
20
  position,
21
+ sections,
21
22
  borderRadius,
22
23
  min,
23
- max
24
+ max,
25
+ isIncreasing
24
26
  }) {
25
27
  this.context = void 0;
26
28
  this.position = 0;
29
+ this.sections = 0;
27
30
  this.isHorizontal = false;
31
+ this.isIncreasing = false;
28
32
  this.gap = 0;
29
33
  this.borderRadius = 0;
30
34
  this.min = {
@@ -40,7 +44,9 @@ class StepPyramid {
40
44
  this.isHorizontal = isHorizontal ?? false;
41
45
  this.gap = (gap ?? 0) / 2;
42
46
  this.position = position ?? 0;
47
+ this.sections = sections ?? 1;
43
48
  this.borderRadius = borderRadius ?? 0;
49
+ this.isIncreasing = isIncreasing ?? false;
44
50
  this.min = min ?? {
45
51
  x: 0,
46
52
  y: 0
@@ -55,7 +61,91 @@ class StepPyramid {
55
61
  lineStart() {}
56
62
  lineEnd() {}
57
63
  getBorderRadius() {
58
- return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
64
+ if (this.gap > 0) {
65
+ return this.borderRadius;
66
+ }
67
+ if (this.isIncreasing) {
68
+ if (this.position === this.sections - 1) {
69
+ return this.borderRadius;
70
+ }
71
+ return [0, 0, this.borderRadius, this.borderRadius];
72
+ }
73
+ if (this.position === 0) {
74
+ return this.borderRadius;
75
+ }
76
+ return [this.borderRadius, this.borderRadius];
77
+ }
78
+ slopeStart(index) {
79
+ if (this.isIncreasing) {
80
+ if (this.isHorizontal) {
81
+ return {
82
+ x: this.min.x,
83
+ y: (this.min.y + this.max.y) / 2
84
+ };
85
+ }
86
+ return {
87
+ x: (this.min.x + this.max.x) / 2,
88
+ y: this.min.y
89
+ };
90
+ }
91
+ if (this.isHorizontal) {
92
+ if (index <= 1) {
93
+ return this.min;
94
+ }
95
+ return {
96
+ x: this.min.x,
97
+ y: this.max.y
98
+ };
99
+ }
100
+ if (index <= 1) {
101
+ return {
102
+ x: this.max.x,
103
+ y: this.min.y
104
+ };
105
+ }
106
+ return this.min;
107
+ }
108
+ slopeEnd(index) {
109
+ if (this.isIncreasing) {
110
+ if (this.isHorizontal) {
111
+ if (index <= 1) {
112
+ return {
113
+ x: this.max.x,
114
+ y: this.min.y
115
+ };
116
+ }
117
+ return this.max;
118
+ }
119
+ if (index <= 1) {
120
+ return this.max;
121
+ }
122
+ return {
123
+ x: this.min.x,
124
+ y: this.max.y
125
+ };
126
+ }
127
+ if (this.isHorizontal) {
128
+ return {
129
+ x: this.max.x,
130
+ y: (this.max.y + this.min.y) / 2
131
+ };
132
+ }
133
+ return {
134
+ x: (this.max.x + this.min.x) / 2,
135
+ y: this.max.y
136
+ };
137
+ }
138
+ initialX(index) {
139
+ if (this.isIncreasing) {
140
+ return index === 0 || index === 1 ? this.points.at(1).x : this.points.at(2).x;
141
+ }
142
+ return index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
143
+ }
144
+ initialY(index) {
145
+ if (this.isIncreasing) {
146
+ return index === 0 || index === 1 ? this.points.at(1).y : this.points.at(2).y;
147
+ }
148
+ return index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
59
149
  }
60
150
  point(xIn, yIn) {
61
151
  this.points.push({
@@ -68,34 +158,20 @@ class StepPyramid {
68
158
 
69
159
  // Add gaps where they are needed.
70
160
  this.points = this.points.map((point, index) => {
161
+ const slopeStart = this.slopeStart(index);
162
+ const slopeEnd = this.slopeEnd(index);
71
163
  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
164
  const yGetter = (0, _utils.lerpY)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
81
165
  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;
166
+ const xInitial = this.initialX(index);
83
167
  return {
84
168
  x: xGap,
85
169
  y: yGetter(xInitial)
86
170
  };
87
171
  }
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
172
  const xGetter = (0, _utils.lerpX)(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
97
173
  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;
174
+ const yInitial = this.initialY(index);
99
175
  return {
100
176
  x: xGetter(yInitial),
101
177
  y: yGap
@@ -13,15 +13,19 @@ import { CurveOptions } from "./curve.types.js";
13
13
  export declare class Step implements CurveGenerator {
14
14
  private context;
15
15
  private isHorizontal;
16
+ private isIncreasing;
16
17
  private gap;
17
18
  private borderRadius;
18
19
  private position;
20
+ private sections;
19
21
  private points;
20
22
  constructor(context: CanvasRenderingContext2D, {
21
23
  isHorizontal,
22
24
  gap,
23
25
  position,
24
- borderRadius
26
+ borderRadius,
27
+ isIncreasing,
28
+ sections
25
29
  }: CurveOptions);
26
30
  areaStart(): void;
27
31
  areaEnd(): void;
@@ -23,26 +23,44 @@ class Step {
23
23
  isHorizontal,
24
24
  gap,
25
25
  position,
26
- borderRadius
26
+ borderRadius,
27
+ isIncreasing,
28
+ sections
27
29
  }) {
28
30
  this.context = void 0;
29
31
  this.isHorizontal = false;
32
+ this.isIncreasing = false;
30
33
  this.gap = 0;
31
34
  this.borderRadius = 0;
32
35
  this.position = 0;
36
+ this.sections = 0;
33
37
  this.points = [];
34
38
  this.context = context;
35
39
  this.isHorizontal = isHorizontal ?? false;
36
40
  this.gap = (gap ?? 0) / 2;
37
41
  this.position = position ?? 0;
42
+ this.sections = sections ?? 1;
38
43
  this.borderRadius = borderRadius ?? 0;
44
+ this.isIncreasing = isIncreasing ?? false;
39
45
  }
40
46
  areaStart() {}
41
47
  areaEnd() {}
42
48
  lineStart() {}
43
49
  lineEnd() {}
44
50
  getBorderRadius() {
45
- return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
51
+ if (this.gap > 0) {
52
+ return this.borderRadius;
53
+ }
54
+ if (this.isIncreasing) {
55
+ if (this.position === this.sections - 1) {
56
+ return this.borderRadius;
57
+ }
58
+ return [0, 0, this.borderRadius, this.borderRadius];
59
+ }
60
+ if (this.position === 0) {
61
+ return this.borderRadius;
62
+ }
63
+ return [this.borderRadius, this.borderRadius];
46
64
  }
47
65
  point(xIn, yIn) {
48
66
  this.points.push({
@@ -110,6 +110,13 @@ export type FunnelItem = {
110
110
  export interface DefaultizedFunnelSeriesType extends DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'> {
111
111
  dataPoints: FunnelDataPoints[][];
112
112
  data: Readonly<MakeRequired<FunnelValueType, 'id' | 'color'>[]>;
113
+ /**
114
+ * Denotes if the data is increasing, first data point is less than the last data point.
115
+ * While the data is decreasing if the first data point is greater than the last data point.
116
+ *
117
+ * This is used to determine the direction of the funnel.
118
+ */
119
+ dataDirection: 'increasing' | 'decreasing';
113
120
  }
114
121
  export type FunnelDataPoints = Record<'x' | 'y', number> & {
115
122
  useBandWidth: boolean;
@@ -32,6 +32,9 @@ const seriesProcessor = params => {
32
32
  const isHorizontal = seriesOrder.some(seriesId => series[seriesId].layout === 'horizontal');
33
33
  seriesOrder.forEach(seriesId => {
34
34
  const currentSeries = series[seriesId];
35
+ const firstDataPoint = currentSeries.data.at(0);
36
+ const lastDataPoint = currentSeries.data.at(-1);
37
+ const dataDirection = firstDataPoint !== undefined && lastDataPoint !== undefined && firstDataPoint.value < lastDataPoint.value ? 'increasing' : 'decreasing';
35
38
  completedSeries[seriesId] = (0, _extends2.default)({
36
39
  labelMarkType: 'square',
37
40
  layout: isHorizontal ? 'horizontal' : 'vertical',
@@ -40,6 +43,7 @@ const seriesProcessor = params => {
40
43
  data: currentSeries.data.map((v, i) => (0, _extends2.default)({
41
44
  id: `${seriesId}-funnel-item-${v.id ?? i}`
42
45
  }, v)),
46
+ dataDirection,
43
47
  dataPoints: []
44
48
  });
45
49
  const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
@@ -47,12 +51,54 @@ const seriesProcessor = params => {
47
51
  // Main = main axis, Other = other axis
48
52
  // For horizontal layout, main is y, other is x
49
53
  // For vertical layout, main is x, other is y
54
+ const isIncreasing = completedSeries[seriesId].dataDirection === 'increasing';
50
55
  const currentMaxMain = item.value;
51
- const nextDataIndex = dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
56
+ const getNextDataIndex = () => {
57
+ if (isIncreasing) {
58
+ return dataIndex === 0 ? dataIndex : dataIndex - 1;
59
+ }
60
+ return dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
61
+ };
62
+ const nextDataIndex = getNextDataIndex();
52
63
  const nextMaxMain = array[nextDataIndex].value ?? 0;
53
64
  const nextMaxOther = 0;
54
65
  const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
55
66
  const stackOffset = stackOffsets[dataIndex];
67
+ if (isIncreasing) {
68
+ return [
69
+ // Top right (vertical) or Top left (horizontal)
70
+ createPoint({
71
+ main: nextMaxMain,
72
+ other: nextMaxOther,
73
+ inverse: isHorizontal,
74
+ useBandWidth: false,
75
+ stackOffset
76
+ }),
77
+ // Bottom right (vertical) or Top right (horizontal)
78
+ createPoint({
79
+ main: currentMaxMain,
80
+ other: currentMaxOther,
81
+ inverse: isHorizontal,
82
+ useBandWidth: true,
83
+ stackOffset
84
+ }),
85
+ // Bottom left (vertical) or Bottom right (horizontal)
86
+ createPoint({
87
+ main: -currentMaxMain,
88
+ other: currentMaxOther,
89
+ inverse: isHorizontal,
90
+ useBandWidth: true,
91
+ stackOffset
92
+ }),
93
+ // Top left (vertical) or Bottom left (horizontal)
94
+ createPoint({
95
+ main: -nextMaxMain,
96
+ other: nextMaxOther,
97
+ inverse: isHorizontal,
98
+ useBandWidth: false,
99
+ stackOffset
100
+ })];
101
+ }
56
102
  return [
57
103
  // Top right (vertical) or Top left (horizontal)
58
104
  createPoint({
@@ -6,7 +6,7 @@ import { ChartsAxisSlots, ChartsAxisSlotProps, XAxis, YAxis } from '@mui/x-chart
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";
9
- import { HeatmapTooltipProps } from "./HeatmapTooltip/HeatmapTooltip.js";
9
+ import { HeatmapTooltipProps } from "./HeatmapTooltip/index.js";
10
10
  import { HeatmapItemSlotProps, HeatmapItemSlots } from "./HeatmapItem.js";
11
11
  import { HeatmapPluginsSignatures } from "./Heatmap.plugins.js";
12
12
  export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots {
@@ -14,14 +14,15 @@ var _styles = require("@mui/material/styles");
14
14
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
15
15
  var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
16
16
  var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
17
+ var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
17
18
  var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
18
19
  var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
19
20
  var _constants = require("@mui/x-charts/constants");
20
- var _ChartContainerPro = require("../ChartContainerPro");
21
21
  var _HeatmapPlot = require("./HeatmapPlot");
22
22
  var _seriesConfig = require("./seriesConfig");
23
- var _HeatmapTooltip = require("./HeatmapTooltip/HeatmapTooltip");
24
- var _Heatmap = require("./Heatmap.plugins");
23
+ var _HeatmapTooltip = require("./HeatmapTooltip");
24
+ var _Heatmap2 = require("./Heatmap.plugins");
25
+ var _ChartDataProviderPro = require("../ChartDataProviderPro");
25
26
  var _jsxRuntime = require("react/jsx-runtime");
26
27
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
27
28
  const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
@@ -89,8 +90,7 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
89
90
  }
90
91
  }], [zAxis]);
91
92
  const Tooltip = props.slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
92
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainerPro.ChartContainerPro, {
93
- ref: ref,
93
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartDataProviderPro.ChartDataProviderPro, {
94
94
  seriesConfig: seriesConfig,
95
95
  series: series.map(s => (0, _extends2.default)({
96
96
  type: 'heatmap'
@@ -103,30 +103,34 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
103
103
  zAxis: zAxisWithDefault,
104
104
  colors: colors,
105
105
  dataset: dataset,
106
- sx: sx,
107
106
  disableAxisListener: true,
108
107
  highlightedItem: highlightedItem,
109
108
  onHighlightChange: onHighlightChange,
110
109
  onAxisClick: onAxisClick,
111
- plugins: _Heatmap.HEATMAP_PLUGINS,
112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
113
- clipPath: `url(#${clipPathId})`,
114
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
110
+ plugins: _Heatmap2.HEATMAP_PLUGINS,
111
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
112
+ ref: ref,
113
+ sx: sx,
114
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
115
+ clipPath: `url(#${clipPathId})`,
116
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
117
+ slots: slots,
118
+ slotProps: slotProps
119
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
120
+ loading: loading,
121
+ slots: slots,
122
+ slotProps: slotProps
123
+ })]
124
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
115
125
  slots: slots,
116
126
  slotProps: slotProps
117
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
118
- loading: loading,
119
- slots: slots,
120
- slotProps: slotProps
121
- })]
122
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
123
- slots: slots,
124
- slotProps: slotProps
125
- }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
126
- id: clipPathId
127
- }), children]
127
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
128
+ id: clipPathId
129
+ }), children]
130
+ }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip))]
128
131
  });
129
132
  });
133
+ if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
130
134
  process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
131
135
  // ----------------------------- Warning --------------------------------
132
136
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -0,0 +1,2 @@
1
+ import { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
2
+ export declare const useUtilityClasses: (props: Pick<HeatmapTooltipProps, "classes">) => Record<"mark" | "table" | "cell" | "row" | "root" | "paper" | "markContainer" | "labelCell" | "valueCell", string>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useUtilityClasses = void 0;
8
+ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
9
+ var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
10
+ const useUtilityClasses = props => {
11
+ const {
12
+ classes
13
+ } = props;
14
+ const slots = {
15
+ root: ['root'],
16
+ paper: ['paper'],
17
+ table: ['table'],
18
+ row: ['row'],
19
+ cell: ['cell'],
20
+ mark: ['mark'],
21
+ markContainer: ['markContainer'],
22
+ labelCell: ['labelCell'],
23
+ valueCell: ['valueCell']
24
+ };
25
+ return (0, _composeClasses.default)(slots, _ChartsTooltip.getChartsTooltipUtilityClass, classes);
26
+ };
27
+ exports.useUtilityClasses = useUtilityClasses;
@@ -1,14 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
3
- export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
4
- /**
5
- * Select the kind of tooltip to display
6
- * - 'item': Shows data about the item below the mouse.
7
- * - 'none': Does not display tooltip
8
- * @default 'item'
9
- */
10
- trigger?: 'item' | 'none';
11
- }
2
+ import { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
12
3
  declare function HeatmapTooltip(props: HeatmapTooltipProps): React.JSX.Element;
13
4
  declare namespace HeatmapTooltip {
14
5
  var propTypes: any;