@mui/x-charts-pro 8.3.1 → 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 (90) hide show
  1. package/BarChartPro/BarChartPro.js +37 -20
  2. package/CHANGELOG.md +110 -0
  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.js +1 -1
  79. package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
  80. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +2 -2
  81. package/index.js +1 -1
  82. package/internals/plugins/useChartProExport/exportImage.js +1 -1
  83. package/internals/plugins/useChartProZoom/useChartProZoom.js +2 -2
  84. package/package.json +5 -5
  85. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  86. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
  87. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
  88. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  89. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
  90. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
@@ -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
  }
@@ -13,13 +13,17 @@ export class StepPyramid {
13
13
  isHorizontal,
14
14
  gap,
15
15
  position,
16
+ sections,
16
17
  borderRadius,
17
18
  min,
18
- max
19
+ max,
20
+ isIncreasing
19
21
  }) {
20
22
  this.context = void 0;
21
23
  this.position = 0;
24
+ this.sections = 0;
22
25
  this.isHorizontal = false;
26
+ this.isIncreasing = false;
23
27
  this.gap = 0;
24
28
  this.borderRadius = 0;
25
29
  this.min = {
@@ -35,7 +39,9 @@ export class StepPyramid {
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
  this.min = min ?? {
40
46
  x: 0,
41
47
  y: 0
@@ -50,7 +56,91 @@ export class StepPyramid {
50
56
  lineStart() {}
51
57
  lineEnd() {}
52
58
  getBorderRadius() {
53
- return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
59
+ if (this.gap > 0) {
60
+ return this.borderRadius;
61
+ }
62
+ if (this.isIncreasing) {
63
+ if (this.position === this.sections - 1) {
64
+ return this.borderRadius;
65
+ }
66
+ return [0, 0, this.borderRadius, this.borderRadius];
67
+ }
68
+ if (this.position === 0) {
69
+ return this.borderRadius;
70
+ }
71
+ return [this.borderRadius, this.borderRadius];
72
+ }
73
+ slopeStart(index) {
74
+ if (this.isIncreasing) {
75
+ if (this.isHorizontal) {
76
+ return {
77
+ x: this.min.x,
78
+ y: (this.min.y + this.max.y) / 2
79
+ };
80
+ }
81
+ return {
82
+ x: (this.min.x + this.max.x) / 2,
83
+ y: this.min.y
84
+ };
85
+ }
86
+ if (this.isHorizontal) {
87
+ if (index <= 1) {
88
+ return this.min;
89
+ }
90
+ return {
91
+ x: this.min.x,
92
+ y: this.max.y
93
+ };
94
+ }
95
+ if (index <= 1) {
96
+ return {
97
+ x: this.max.x,
98
+ y: this.min.y
99
+ };
100
+ }
101
+ return this.min;
102
+ }
103
+ slopeEnd(index) {
104
+ if (this.isIncreasing) {
105
+ if (this.isHorizontal) {
106
+ if (index <= 1) {
107
+ return {
108
+ x: this.max.x,
109
+ y: this.min.y
110
+ };
111
+ }
112
+ return this.max;
113
+ }
114
+ if (index <= 1) {
115
+ return this.max;
116
+ }
117
+ return {
118
+ x: this.min.x,
119
+ y: this.max.y
120
+ };
121
+ }
122
+ if (this.isHorizontal) {
123
+ return {
124
+ x: this.max.x,
125
+ y: (this.max.y + this.min.y) / 2
126
+ };
127
+ }
128
+ return {
129
+ x: (this.max.x + this.min.x) / 2,
130
+ y: this.max.y
131
+ };
132
+ }
133
+ initialX(index) {
134
+ if (this.isIncreasing) {
135
+ return index === 0 || index === 1 ? this.points.at(1).x : this.points.at(2).x;
136
+ }
137
+ return index === 0 || index === 1 ? this.points.at(0).x : this.points.at(3).x;
138
+ }
139
+ initialY(index) {
140
+ if (this.isIncreasing) {
141
+ return index === 0 || index === 1 ? this.points.at(1).y : this.points.at(2).y;
142
+ }
143
+ return index === 0 || index === 1 ? this.points.at(0).y : this.points.at(3).y;
54
144
  }
55
145
  point(xIn, yIn) {
56
146
  this.points.push({
@@ -63,34 +153,20 @@ export class StepPyramid {
63
153
 
64
154
  // Add gaps where they are needed.
65
155
  this.points = this.points.map((point, index) => {
156
+ const slopeStart = this.slopeStart(index);
157
+ const slopeEnd = this.slopeEnd(index);
66
158
  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
159
  const yGetter = lerpY(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
76
160
  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;
161
+ const xInitial = this.initialX(index);
78
162
  return {
79
163
  x: xGap,
80
164
  y: yGetter(xInitial)
81
165
  };
82
166
  }
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
167
  const xGetter = lerpX(slopeStart.x, slopeStart.y, slopeEnd.x, slopeEnd.y);
92
168
  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;
169
+ const yInitial = this.initialY(index);
94
170
  return {
95
171
  x: xGetter(yInitial),
96
172
  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;
@@ -18,26 +18,44 @@ export class Step {
18
18
  isHorizontal,
19
19
  gap,
20
20
  position,
21
- borderRadius
21
+ borderRadius,
22
+ isIncreasing,
23
+ sections
22
24
  }) {
23
25
  this.context = void 0;
24
26
  this.isHorizontal = false;
27
+ this.isIncreasing = false;
25
28
  this.gap = 0;
26
29
  this.borderRadius = 0;
27
30
  this.position = 0;
31
+ this.sections = 0;
28
32
  this.points = [];
29
33
  this.context = context;
30
34
  this.isHorizontal = isHorizontal ?? false;
31
35
  this.gap = (gap ?? 0) / 2;
32
36
  this.position = position ?? 0;
37
+ this.sections = sections ?? 1;
33
38
  this.borderRadius = borderRadius ?? 0;
39
+ this.isIncreasing = isIncreasing ?? false;
34
40
  }
35
41
  areaStart() {}
36
42
  areaEnd() {}
37
43
  lineStart() {}
38
44
  lineEnd() {}
39
45
  getBorderRadius() {
40
- return this.gap > 0 || this.position === 0 ? this.borderRadius : [this.borderRadius, this.borderRadius];
46
+ if (this.gap > 0) {
47
+ return this.borderRadius;
48
+ }
49
+ if (this.isIncreasing) {
50
+ if (this.position === this.sections - 1) {
51
+ return this.borderRadius;
52
+ }
53
+ return [0, 0, this.borderRadius, this.borderRadius];
54
+ }
55
+ if (this.position === 0) {
56
+ return this.borderRadius;
57
+ }
58
+ return [this.borderRadius, this.borderRadius];
41
59
  }
42
60
  point(xIn, yIn) {
43
61
  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;
@@ -25,6 +25,9 @@ const seriesProcessor = params => {
25
25
  const isHorizontal = seriesOrder.some(seriesId => series[seriesId].layout === 'horizontal');
26
26
  seriesOrder.forEach(seriesId => {
27
27
  const currentSeries = series[seriesId];
28
+ const firstDataPoint = currentSeries.data.at(0);
29
+ const lastDataPoint = currentSeries.data.at(-1);
30
+ const dataDirection = firstDataPoint !== undefined && lastDataPoint !== undefined && firstDataPoint.value < lastDataPoint.value ? 'increasing' : 'decreasing';
28
31
  completedSeries[seriesId] = _extends({
29
32
  labelMarkType: 'square',
30
33
  layout: isHorizontal ? 'horizontal' : 'vertical',
@@ -33,6 +36,7 @@ const seriesProcessor = params => {
33
36
  data: currentSeries.data.map((v, i) => _extends({
34
37
  id: `${seriesId}-funnel-item-${v.id ?? i}`
35
38
  }, v)),
39
+ dataDirection,
36
40
  dataPoints: []
37
41
  });
38
42
  const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
@@ -40,12 +44,54 @@ const seriesProcessor = params => {
40
44
  // Main = main axis, Other = other axis
41
45
  // For horizontal layout, main is y, other is x
42
46
  // For vertical layout, main is x, other is y
47
+ const isIncreasing = completedSeries[seriesId].dataDirection === 'increasing';
43
48
  const currentMaxMain = item.value;
44
- const nextDataIndex = dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
49
+ const getNextDataIndex = () => {
50
+ if (isIncreasing) {
51
+ return dataIndex === 0 ? dataIndex : dataIndex - 1;
52
+ }
53
+ return dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
54
+ };
55
+ const nextDataIndex = getNextDataIndex();
45
56
  const nextMaxMain = array[nextDataIndex].value ?? 0;
46
57
  const nextMaxOther = 0;
47
58
  const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
48
59
  const stackOffset = stackOffsets[dataIndex];
60
+ if (isIncreasing) {
61
+ return [
62
+ // Top right (vertical) or Top left (horizontal)
63
+ createPoint({
64
+ main: nextMaxMain,
65
+ other: nextMaxOther,
66
+ inverse: isHorizontal,
67
+ useBandWidth: false,
68
+ stackOffset
69
+ }),
70
+ // Bottom right (vertical) or Top right (horizontal)
71
+ createPoint({
72
+ main: currentMaxMain,
73
+ other: currentMaxOther,
74
+ inverse: isHorizontal,
75
+ useBandWidth: true,
76
+ stackOffset
77
+ }),
78
+ // Bottom left (vertical) or Bottom right (horizontal)
79
+ createPoint({
80
+ main: -currentMaxMain,
81
+ other: currentMaxOther,
82
+ inverse: isHorizontal,
83
+ useBandWidth: true,
84
+ stackOffset
85
+ }),
86
+ // Top left (vertical) or Bottom left (horizontal)
87
+ createPoint({
88
+ main: -nextMaxMain,
89
+ other: nextMaxOther,
90
+ inverse: isHorizontal,
91
+ useBandWidth: false,
92
+ stackOffset
93
+ })];
94
+ }
49
95
  return [
50
96
  // Top right (vertical) or Top left (horizontal)
51
97
  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 {
@@ -7,14 +7,15 @@ import { useThemeProps } from '@mui/material/styles';
7
7
  import useId from '@mui/utils/useId';
8
8
  import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
9
9
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
10
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
10
11
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
11
12
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
12
13
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
13
- import { ChartContainerPro } from "../ChartContainerPro/index.js";
14
14
  import { HeatmapPlot } from "./HeatmapPlot.js";
15
15
  import { seriesConfig as heatmapSeriesConfig } from "./seriesConfig/index.js";
16
- import { HeatmapTooltip } from "./HeatmapTooltip/HeatmapTooltip.js";
16
+ import { HeatmapTooltip } from "./HeatmapTooltip/index.js";
17
17
  import { HEATMAP_PLUGINS } from "./Heatmap.plugins.js";
18
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
20
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
20
21
  const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
@@ -82,8 +83,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
82
83
  }
83
84
  }], [zAxis]);
84
85
  const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
85
- return /*#__PURE__*/_jsxs(ChartContainerPro, {
86
- ref: ref,
86
+ return /*#__PURE__*/_jsxs(ChartDataProviderPro, {
87
87
  seriesConfig: seriesConfig,
88
88
  series: series.map(s => _extends({
89
89
  type: 'heatmap'
@@ -96,30 +96,34 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
96
96
  zAxis: zAxisWithDefault,
97
97
  colors: colors,
98
98
  dataset: dataset,
99
- sx: sx,
100
99
  disableAxisListener: true,
101
100
  highlightedItem: highlightedItem,
102
101
  onHighlightChange: onHighlightChange,
103
102
  onAxisClick: onAxisClick,
104
103
  plugins: HEATMAP_PLUGINS,
105
- children: [/*#__PURE__*/_jsxs("g", {
106
- clipPath: `url(#${clipPathId})`,
107
- children: [/*#__PURE__*/_jsx(HeatmapPlot, {
104
+ children: [/*#__PURE__*/_jsxs(ChartsSurface, {
105
+ ref: ref,
106
+ sx: sx,
107
+ children: [/*#__PURE__*/_jsxs("g", {
108
+ clipPath: `url(#${clipPathId})`,
109
+ children: [/*#__PURE__*/_jsx(HeatmapPlot, {
110
+ slots: slots,
111
+ slotProps: slotProps
112
+ }), /*#__PURE__*/_jsx(ChartsOverlay, {
113
+ loading: loading,
114
+ slots: slots,
115
+ slotProps: slotProps
116
+ })]
117
+ }), /*#__PURE__*/_jsx(ChartsAxis, {
108
118
  slots: slots,
109
119
  slotProps: slotProps
110
- }), /*#__PURE__*/_jsx(ChartsOverlay, {
111
- loading: loading,
112
- slots: slots,
113
- slotProps: slotProps
114
- })]
115
- }), /*#__PURE__*/_jsx(ChartsAxis, {
116
- slots: slots,
117
- slotProps: slotProps
118
- }), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
119
- id: clipPathId
120
- }), children]
120
+ }), /*#__PURE__*/_jsx(ChartsClipPath, {
121
+ id: clipPathId
122
+ }), children]
123
+ }), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip))]
121
124
  });
122
125
  });
126
+ if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
123
127
  process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
124
128
  // ----------------------------- Warning --------------------------------
125
129
  // | 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,19 @@
1
+ import composeClasses from '@mui/utils/composeClasses';
2
+ import { getChartsTooltipUtilityClass } from '@mui/x-charts/ChartsTooltip';
3
+ export const useUtilityClasses = props => {
4
+ const {
5
+ classes
6
+ } = props;
7
+ const slots = {
8
+ root: ['root'],
9
+ paper: ['paper'],
10
+ table: ['table'],
11
+ row: ['row'],
12
+ cell: ['cell'],
13
+ mark: ['mark'],
14
+ markContainer: ['markContainer'],
15
+ labelCell: ['labelCell'],
16
+ valueCell: ['valueCell']
17
+ };
18
+ return composeClasses(slots, getChartsTooltipUtilityClass, classes);
19
+ };
@@ -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;
@@ -3,109 +3,11 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import clsx from 'clsx';
7
6
  import HTMLElementType from '@mui/utils/HTMLElementType';
8
- import composeClasses from '@mui/utils/composeClasses';
9
- import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
10
- import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
11
- import { getLabel, ChartsLabelMark } from '@mui/x-charts/internals';
12
- import { useHeatmapSeriesContext } from "../../hooks/useHeatmapSeries.js";
13
- import { HeatmapTooltipAxesValue } from "./HeatmapTooltipAxesValue.js";
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- const useUtilityClasses = props => {
16
- const {
17
- classes
18
- } = props;
19
- const slots = {
20
- root: ['root'],
21
- paper: ['paper'],
22
- table: ['table'],
23
- row: ['row'],
24
- cell: ['cell'],
25
- mark: ['mark'],
26
- markContainer: ['markContainer'],
27
- labelCell: ['labelCell'],
28
- valueCell: ['valueCell']
29
- };
30
- return composeClasses(slots, getChartsTooltipUtilityClass, classes);
31
- };
32
- function DefaultHeatmapTooltipContent(props) {
33
- const classes = useUtilityClasses(props);
34
- const xAxis = useXAxis();
35
- const yAxis = useYAxis();
36
- const heatmapSeries = useHeatmapSeriesContext();
37
- const tooltipData = useItemTooltip();
38
- if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
39
- return null;
40
- }
41
- const {
42
- series,
43
- seriesOrder
44
- } = heatmapSeries;
45
- const seriesId = seriesOrder[0];
46
- const {
47
- color,
48
- value,
49
- identifier,
50
- markType
51
- } = tooltipData;
52
- const [xIndex, yIndex] = value;
53
- const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
54
- location: 'tooltip',
55
- scale: xAxis.scale
56
- }) ?? xAxis.data[xIndex].toLocaleString();
57
- const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
58
- location: 'tooltip',
59
- scale: yAxis.scale
60
- }) ?? yAxis.data[yIndex].toLocaleString();
61
- const formattedValue = series[seriesId].valueFormatter(value, {
62
- dataIndex: identifier.dataIndex
63
- });
64
- const seriesLabel = getLabel(series[seriesId].label, 'tooltip');
65
- return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
66
- className: classes.paper,
67
- children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
68
- className: classes.table,
69
- children: [/*#__PURE__*/_jsxs(HeatmapTooltipAxesValue, {
70
- children: [/*#__PURE__*/_jsx("span", {
71
- children: formattedX
72
- }), /*#__PURE__*/_jsx("span", {
73
- children: formattedY
74
- })]
75
- }), /*#__PURE__*/_jsx("tbody", {
76
- children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
77
- className: classes.row,
78
- children: [/*#__PURE__*/_jsxs(ChartsTooltipCell, {
79
- className: clsx(classes.labelCell, classes.cell),
80
- component: "th",
81
- children: [/*#__PURE__*/_jsx("div", {
82
- className: classes.markContainer,
83
- children: /*#__PURE__*/_jsx(ChartsLabelMark, {
84
- type: markType,
85
- color: color,
86
- className: classes.mark
87
- })
88
- }), seriesLabel]
89
- }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
90
- className: clsx(classes.valueCell, classes.cell),
91
- component: "td",
92
- children: formattedValue
93
- })]
94
- })
95
- })]
96
- })
97
- });
98
- }
99
- process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltipContent.propTypes = {
100
- // ----------------------------- Warning --------------------------------
101
- // | These PropTypes are generated from the TypeScript type definitions |
102
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
103
- // ----------------------------------------------------------------------
104
- /**
105
- * Override or extend the styles applied to the component.
106
- */
107
- classes: PropTypes.object
108
- } : void 0;
7
+ import { ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
8
+ import { HeatmapTooltipContent } from "./HeatmapTooltipContent.js";
9
+ import { useUtilityClasses } from "./HeatmapTooltip.classes.js";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
109
11
  function HeatmapTooltip(props) {
110
12
  const classes = useUtilityClasses({
111
13
  classes: props.classes
@@ -114,7 +16,7 @@ function HeatmapTooltip(props) {
114
16
  trigger: "item"
115
17
  }, props, {
116
18
  classes: classes,
117
- children: /*#__PURE__*/_jsx(DefaultHeatmapTooltipContent, {
19
+ children: /*#__PURE__*/_jsx(HeatmapTooltipContent, {
118
20
  classes: classes
119
21
  })
120
22
  }));
@@ -0,0 +1,10 @@
1
+ import { ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
2
+ export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
3
+ /**
4
+ * Select the kind of tooltip to display
5
+ * - 'item': Shows data about the item below the mouse.
6
+ * - 'none': Does not display tooltip
7
+ * @default 'item'
8
+ */
9
+ trigger?: 'item' | 'none';
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
3
+ export interface HeatmapTooltipContentProps extends Pick<HeatmapTooltipProps, 'classes'> {}
4
+ export declare function HeatmapTooltipContent(props: HeatmapTooltipContentProps): React.JSX.Element | null;
5
+ export declare namespace HeatmapTooltipContent {
6
+ var propTypes: any;
7
+ }