@mui/x-charts-pro 8.3.1 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.d.ts +13 -5
- package/BarChartPro/BarChartPro.js +56 -21
- package/CHANGELOG.md +213 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/ChartContainerPro/ChartContainerPro.js +1 -0
- package/ChartContainerPro/ChartProApi.d.ts +26 -0
- package/ChartContainerPro/ChartProApi.js +5 -0
- package/ChartContainerPro/index.d.ts +2 -1
- package/ChartContainerPro/index.js +11 -0
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +19 -3
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/ChartZoomSlider/index.d.ts +1 -1
- package/ChartZoomSlider/index.js +4 -4
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -287
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +251 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +92 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +160 -0
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
- package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +58 -0
- package/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
- package/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +6 -6
- package/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/ChartZoomSlider/internals/constants.js +11 -0
- package/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/ChartZoomSlider/internals/zoom-utils.js +48 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
- package/ChartsToolbarPro/ChartsToolbarPro.js +42 -8
- package/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
- package/ChartsToolbarPro/ChartsToolbarZoomInButton.js +56 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
- package/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +56 -0
- package/ChartsToolbarPro/index.d.ts +3 -1
- package/ChartsToolbarPro/index.js +22 -0
- package/FunnelChart/FunnelChart.d.ts +2 -1
- package/FunnelChart/FunnelChart.js +6 -23
- package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/FunnelChart/FunnelChart.plugins.js +9 -0
- package/FunnelChart/FunnelPlot.js +2 -0
- package/FunnelChart/FunnelSection.js +2 -1
- package/FunnelChart/curves/curve.types.d.ts +4 -0
- package/FunnelChart/curves/pyramid.d.ts +3 -1
- package/FunnelChart/curves/pyramid.js +37 -10
- package/FunnelChart/curves/step-pyramid.d.ts +10 -2
- package/FunnelChart/curves/step-pyramid.js +96 -20
- package/FunnelChart/curves/step.d.ts +5 -1
- package/FunnelChart/curves/step.js +20 -2
- package/FunnelChart/funnel.types.d.ts +7 -0
- package/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
- package/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/FunnelChart/useFunnelChartProps.js +3 -1
- package/Heatmap/Heatmap.d.ts +18 -5
- package/Heatmap/Heatmap.js +64 -26
- package/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/Heatmap/Heatmap.plugins.js +2 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +27 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +4 -102
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +5 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +96 -0
- package/Heatmap/HeatmapTooltip/index.d.ts +3 -1
- package/Heatmap/HeatmapTooltip/index.js +11 -0
- package/LineChartPro/LineChartPro.d.ts +13 -5
- package/LineChartPro/LineChartPro.js +56 -21
- package/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/RadarChartPro/RadarChartPro.js +202 -0
- package/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/RadarChartPro/RadarChartPro.plugins.js +9 -0
- package/RadarChartPro/index.d.ts +1 -0
- package/RadarChartPro/index.js +16 -0
- package/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/ScatterChartPro/ScatterChartPro.js +57 -22
- package/context/index.d.ts +1 -0
- package/context/index.js +16 -0
- package/context/useChartApiContext.d.ts +9 -0
- package/context/useChartApiContext.js +17 -0
- package/esm/BarChartPro/BarChartPro.d.ts +13 -5
- package/esm/BarChartPro/BarChartPro.js +54 -19
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
- package/esm/ChartContainerPro/ChartContainerPro.js +1 -0
- package/esm/ChartContainerPro/ChartProApi.d.ts +26 -0
- package/esm/ChartContainerPro/ChartProApi.js +1 -0
- package/esm/ChartContainerPro/index.d.ts +2 -1
- package/esm/ChartContainerPro/index.js +2 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +20 -4
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
- package/esm/ChartZoomSlider/index.d.ts +1 -1
- package/esm/ChartZoomSlider/index.js +1 -1
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +30 -283
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +243 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +85 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +152 -0
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
- package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +52 -0
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
- package/esm/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +4 -4
- package/esm/ChartZoomSlider/internals/constants.d.ts +5 -0
- package/esm/ChartZoomSlider/internals/constants.js +5 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
- package/esm/ChartZoomSlider/internals/zoom-utils.js +40 -0
- package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
- package/esm/ChartsToolbarPro/ChartsToolbarPro.js +42 -9
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.js +50 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
- package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +50 -0
- package/esm/ChartsToolbarPro/index.d.ts +3 -1
- package/esm/ChartsToolbarPro/index.js +3 -1
- package/esm/FunnelChart/FunnelChart.d.ts +2 -1
- package/esm/FunnelChart/FunnelChart.js +6 -23
- package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
- package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
- package/esm/FunnelChart/FunnelPlot.js +2 -0
- package/esm/FunnelChart/FunnelSection.js +1 -0
- package/esm/FunnelChart/curves/curve.types.d.ts +4 -0
- package/esm/FunnelChart/curves/pyramid.d.ts +3 -1
- package/esm/FunnelChart/curves/pyramid.js +37 -10
- package/esm/FunnelChart/curves/step-pyramid.d.ts +10 -2
- package/esm/FunnelChart/curves/step-pyramid.js +96 -20
- package/esm/FunnelChart/curves/step.d.ts +5 -1
- package/esm/FunnelChart/curves/step.js +20 -2
- package/esm/FunnelChart/funnel.types.d.ts +7 -0
- package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
- package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
- package/esm/FunnelChart/useFunnelChartProps.js +3 -1
- package/esm/Heatmap/Heatmap.d.ts +18 -5
- package/esm/Heatmap/Heatmap.js +62 -24
- package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
- package/esm/Heatmap/Heatmap.plugins.js +2 -1
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +19 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +5 -103
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +1 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +89 -0
- package/esm/Heatmap/HeatmapTooltip/index.d.ts +3 -1
- package/esm/Heatmap/HeatmapTooltip/index.js +3 -1
- package/esm/LineChartPro/LineChartPro.d.ts +13 -5
- package/esm/LineChartPro/LineChartPro.js +54 -19
- package/esm/RadarChartPro/RadarChartPro.d.ts +15 -0
- package/esm/RadarChartPro/RadarChartPro.js +195 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
- package/esm/RadarChartPro/RadarChartPro.plugins.js +3 -0
- package/esm/RadarChartPro/index.d.ts +1 -0
- package/esm/RadarChartPro/index.js +1 -0
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +13 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +55 -20
- package/esm/context/index.d.ts +1 -0
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +9 -0
- package/esm/context/useChartApiContext.js +11 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/material/index.d.ts +1 -0
- package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +15 -1
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/esm/models/index.d.ts +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +21 -10
- package/index.d.ts +2 -1
- package/index.js +12 -1
- package/internals/material/index.d.ts +1 -0
- package/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +16 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
- package/models/index.d.ts +1 -1
- package/package.json +5 -5
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
- package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
- package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -36
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -36
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
- package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -29
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
- package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -29
|
@@ -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
|
|
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({
|
|
@@ -3,6 +3,7 @@ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
|
3
3
|
import { ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
|
|
4
4
|
import { ChartsWrapperProps } from '@mui/x-charts/internals';
|
|
5
5
|
import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
|
|
6
|
+
import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
|
|
6
7
|
import { FunnelPlotProps } from "./FunnelPlot.js";
|
|
7
8
|
import type { FunnelChartProps } from "./FunnelChart.js";
|
|
8
9
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
@@ -14,7 +15,7 @@ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
|
14
15
|
* @returns An object with props for the children components of FunnelChart
|
|
15
16
|
*/
|
|
16
17
|
export declare const useFunnelChartProps: (props: FunnelChartProps) => {
|
|
17
|
-
chartContainerProps: ChartContainerProProps<"funnel">;
|
|
18
|
+
chartContainerProps: ChartContainerProProps<"funnel", FunnelChartPluginsSignatures>;
|
|
18
19
|
funnelPlotProps: FunnelPlotProps;
|
|
19
20
|
overlayProps: ChartsOverlayProps;
|
|
20
21
|
chartsAxisProps: ChartsAxisProps;
|
|
@@ -12,6 +12,7 @@ var _constants = require("@mui/x-charts/constants");
|
|
|
12
12
|
var _internals = require("@mui/x-charts/internals");
|
|
13
13
|
var _warning = require("@mui/x-internals/warning");
|
|
14
14
|
var _colorPalettes = require("@mui/x-charts/colorPalettes");
|
|
15
|
+
var _FunnelChart = require("./FunnelChart.plugins");
|
|
15
16
|
const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef", "gap"];
|
|
16
17
|
function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
|
|
17
18
|
const maxSeriesLength = Math.max(...series.map(s => (s.data ?? []).length), 0);
|
|
@@ -119,7 +120,8 @@ const useFunnelChartProps = props => {
|
|
|
119
120
|
highlightedItem,
|
|
120
121
|
onHighlightChange,
|
|
121
122
|
className,
|
|
122
|
-
apiRef
|
|
123
|
+
apiRef,
|
|
124
|
+
plugins: _FunnelChart.FUNNEL_CHART_PLUGINS
|
|
123
125
|
});
|
|
124
126
|
const funnelPlotProps = {
|
|
125
127
|
gap,
|
package/Heatmap/Heatmap.d.ts
CHANGED
|
@@ -4,22 +4,30 @@ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
|
4
4
|
import { ChartsTooltipProps } from '@mui/x-charts/ChartsTooltip';
|
|
5
5
|
import { ChartsAxisSlots, ChartsAxisSlotProps, XAxis, YAxis } from '@mui/x-charts/internals';
|
|
6
6
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
|
|
7
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
|
|
8
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from '@mui/x-charts/Toolbar';
|
|
9
|
+
import { ChartsSlotPropsPro, ChartsSlotsPro } from "../internals/material/index.js";
|
|
7
10
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
8
11
|
import { HeatmapSeriesType } from "../models/seriesType/heatmap.js";
|
|
9
|
-
import { HeatmapTooltipProps } from "./HeatmapTooltip/
|
|
12
|
+
import { HeatmapTooltipProps } from "./HeatmapTooltip/index.js";
|
|
10
13
|
import { HeatmapItemSlotProps, HeatmapItemSlots } from "./HeatmapItem.js";
|
|
11
14
|
import { HeatmapPluginsSignatures } from "./Heatmap.plugins.js";
|
|
12
|
-
export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots {
|
|
15
|
+
export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots, ChartsToolbarSlots, Partial<ChartsSlotsPro> {
|
|
13
16
|
/**
|
|
14
|
-
* Custom component for the tooltip
|
|
17
|
+
* Custom component for the tooltip.
|
|
15
18
|
* @default ChartsTooltipRoot
|
|
16
19
|
*/
|
|
17
20
|
tooltip?: React.ElementType<HeatmapTooltipProps>;
|
|
21
|
+
/**
|
|
22
|
+
* Custom component for the legend.
|
|
23
|
+
* @default ContinuousColorLegendProps
|
|
24
|
+
*/
|
|
25
|
+
legend?: ChartsLegendSlots['legend'];
|
|
18
26
|
}
|
|
19
|
-
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps {
|
|
27
|
+
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotPropsPro> {
|
|
20
28
|
tooltip?: Partial<HeatmapTooltipProps>;
|
|
21
29
|
}
|
|
22
|
-
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
30
|
+
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation' | 'slots' | 'slotProps'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
23
31
|
/**
|
|
24
32
|
* The configuration of the x-axes.
|
|
25
33
|
* If not provided, a default axis config is used.
|
|
@@ -42,6 +50,11 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
42
50
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
43
51
|
*/
|
|
44
52
|
tooltip?: ChartsTooltipProps;
|
|
53
|
+
/**
|
|
54
|
+
* If `true`, the legend is not rendered.
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
hideLegend?: boolean;
|
|
45
58
|
/**
|
|
46
59
|
* Overridable component slots.
|
|
47
60
|
* @default {}
|
package/Heatmap/Heatmap.js
CHANGED
|
@@ -14,14 +14,17 @@ 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");
|
|
18
|
+
var _internals = require("@mui/x-charts/internals");
|
|
17
19
|
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
18
20
|
var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
|
|
19
21
|
var _constants = require("@mui/x-charts/constants");
|
|
20
|
-
var
|
|
22
|
+
var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
|
|
21
23
|
var _HeatmapPlot = require("./HeatmapPlot");
|
|
22
24
|
var _seriesConfig = require("./seriesConfig");
|
|
23
|
-
var _HeatmapTooltip = require("./HeatmapTooltip
|
|
24
|
-
var
|
|
25
|
+
var _HeatmapTooltip = require("./HeatmapTooltip");
|
|
26
|
+
var _Heatmap2 = require("./Heatmap.plugins");
|
|
27
|
+
var _ChartDataProviderPro = require("../ChartDataProviderPro");
|
|
25
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
29
|
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
27
30
|
const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
@@ -44,6 +47,7 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
44
47
|
name: 'MuiHeatmap'
|
|
45
48
|
});
|
|
46
49
|
const {
|
|
50
|
+
apiRef,
|
|
47
51
|
xAxis,
|
|
48
52
|
yAxis,
|
|
49
53
|
zAxis,
|
|
@@ -60,7 +64,8 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
60
64
|
slotProps,
|
|
61
65
|
loading,
|
|
62
66
|
highlightedItem,
|
|
63
|
-
onHighlightChange
|
|
67
|
+
onHighlightChange,
|
|
68
|
+
hideLegend = true
|
|
64
69
|
} = props;
|
|
65
70
|
const id = (0, _useId.default)();
|
|
66
71
|
const clipPathId = `${id}-clip-path`;
|
|
@@ -88,9 +93,14 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
88
93
|
color: defaultColorMap
|
|
89
94
|
}
|
|
90
95
|
}], [zAxis]);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
const chartsWrapperProps = {
|
|
97
|
+
sx,
|
|
98
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
99
|
+
legendDirection: props.slotProps?.legend?.direction
|
|
100
|
+
};
|
|
101
|
+
const Tooltip = slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, {
|
|
103
|
+
apiRef: apiRef,
|
|
94
104
|
seriesConfig: seriesConfig,
|
|
95
105
|
series: series.map(s => (0, _extends2.default)({
|
|
96
106
|
type: 'heatmap'
|
|
@@ -103,37 +113,60 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
|
|
|
103
113
|
zAxis: zAxisWithDefault,
|
|
104
114
|
colors: colors,
|
|
105
115
|
dataset: dataset,
|
|
106
|
-
sx: sx,
|
|
107
116
|
disableAxisListener: true,
|
|
108
117
|
highlightedItem: highlightedItem,
|
|
109
118
|
onHighlightChange: onHighlightChange,
|
|
110
119
|
onAxisClick: onAxisClick,
|
|
111
|
-
plugins:
|
|
112
|
-
children:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
plugins: _Heatmap2.HEATMAP_PLUGINS,
|
|
121
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
122
|
+
children: [!hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
|
|
123
|
+
slots: (0, _extends2.default)({}, slots, {
|
|
124
|
+
legend: slots?.legend ?? _ChartsLegend.ContinuousColorLegend
|
|
125
|
+
}),
|
|
126
|
+
slotProps: {
|
|
127
|
+
legend: (0, _extends2.default)({
|
|
128
|
+
labelPosition: 'extremes'
|
|
129
|
+
}, slotProps?.legend)
|
|
130
|
+
},
|
|
131
|
+
sx: slotProps?.legend?.direction === 'vertical' ? {
|
|
132
|
+
height: 150
|
|
133
|
+
} : {
|
|
134
|
+
width: '50%'
|
|
135
|
+
}
|
|
136
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
|
|
137
|
+
ref: ref,
|
|
138
|
+
sx: sx,
|
|
139
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
140
|
+
clipPath: `url(#${clipPathId})`,
|
|
141
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
|
|
142
|
+
slots: slots,
|
|
143
|
+
slotProps: slotProps
|
|
144
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
145
|
+
loading: loading,
|
|
146
|
+
slots: slots,
|
|
147
|
+
slotProps: slotProps
|
|
148
|
+
})]
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
150
|
+
slots: slots,
|
|
151
|
+
slotProps: slotProps
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
153
|
+
id: clipPathId
|
|
154
|
+
}), children]
|
|
155
|
+
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip))]
|
|
156
|
+
}))
|
|
128
157
|
});
|
|
129
158
|
});
|
|
159
|
+
if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
|
|
130
160
|
process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
131
161
|
// ----------------------------- Warning --------------------------------
|
|
132
162
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
133
163
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
134
164
|
// ----------------------------------------------------------------------
|
|
135
165
|
apiRef: _propTypes.default.shape({
|
|
136
|
-
current: _propTypes.default.
|
|
166
|
+
current: _propTypes.default.shape({
|
|
167
|
+
exportAsImage: _propTypes.default.func.isRequired,
|
|
168
|
+
exportAsPrint: _propTypes.default.func.isRequired
|
|
169
|
+
})
|
|
137
170
|
}),
|
|
138
171
|
className: _propTypes.default.string,
|
|
139
172
|
/**
|
|
@@ -156,6 +189,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
156
189
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
157
190
|
*/
|
|
158
191
|
height: _propTypes.default.number,
|
|
192
|
+
/**
|
|
193
|
+
* If `true`, the legend is not rendered.
|
|
194
|
+
* @default true
|
|
195
|
+
*/
|
|
196
|
+
hideLegend: _propTypes.default.bool,
|
|
159
197
|
/**
|
|
160
198
|
* The highlighted item.
|
|
161
199
|
* Used when the highlight is controlled.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
2
|
-
|
|
2
|
+
import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
|
+
export type HeatmapPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'heatmap'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProExportSignature];
|
|
3
4
|
export declare const HEATMAP_PLUGINS: ConvertSignaturesIntoPlugins<HeatmapPluginsSignatures>;
|
|
@@ -5,4 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.HEATMAP_PLUGINS = void 0;
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
|
-
|
|
8
|
+
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
|
+
const HEATMAP_PLUGINS = exports.HEATMAP_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProExport.useChartProExport];
|
|
@@ -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 {
|
|
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;
|
|
@@ -10,118 +10,20 @@ exports.HeatmapTooltip = HeatmapTooltip;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
13
|
var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
|
|
15
|
-
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
14
|
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _useHeatmapSeries = require("../../hooks/useHeatmapSeries");
|
|
20
|
-
var _HeatmapTooltipAxesValue = require("./HeatmapTooltipAxesValue");
|
|
15
|
+
var _HeatmapTooltipContent = require("./HeatmapTooltipContent");
|
|
16
|
+
var _HeatmapTooltip = require("./HeatmapTooltip.classes");
|
|
21
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const useUtilityClasses = props => {
|
|
23
|
-
const {
|
|
24
|
-
classes
|
|
25
|
-
} = props;
|
|
26
|
-
const slots = {
|
|
27
|
-
root: ['root'],
|
|
28
|
-
paper: ['paper'],
|
|
29
|
-
table: ['table'],
|
|
30
|
-
row: ['row'],
|
|
31
|
-
cell: ['cell'],
|
|
32
|
-
mark: ['mark'],
|
|
33
|
-
markContainer: ['markContainer'],
|
|
34
|
-
labelCell: ['labelCell'],
|
|
35
|
-
valueCell: ['valueCell']
|
|
36
|
-
};
|
|
37
|
-
return (0, _composeClasses.default)(slots, _ChartsTooltip.getChartsTooltipUtilityClass, classes);
|
|
38
|
-
};
|
|
39
|
-
function DefaultHeatmapTooltipContent(props) {
|
|
40
|
-
const classes = useUtilityClasses(props);
|
|
41
|
-
const xAxis = (0, _hooks.useXAxis)();
|
|
42
|
-
const yAxis = (0, _hooks.useYAxis)();
|
|
43
|
-
const heatmapSeries = (0, _useHeatmapSeries.useHeatmapSeriesContext)();
|
|
44
|
-
const tooltipData = (0, _ChartsTooltip.useItemTooltip)();
|
|
45
|
-
if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
const {
|
|
49
|
-
series,
|
|
50
|
-
seriesOrder
|
|
51
|
-
} = heatmapSeries;
|
|
52
|
-
const seriesId = seriesOrder[0];
|
|
53
|
-
const {
|
|
54
|
-
color,
|
|
55
|
-
value,
|
|
56
|
-
identifier,
|
|
57
|
-
markType
|
|
58
|
-
} = tooltipData;
|
|
59
|
-
const [xIndex, yIndex] = value;
|
|
60
|
-
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
61
|
-
location: 'tooltip',
|
|
62
|
-
scale: xAxis.scale
|
|
63
|
-
}) ?? xAxis.data[xIndex].toLocaleString();
|
|
64
|
-
const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
|
|
65
|
-
location: 'tooltip',
|
|
66
|
-
scale: yAxis.scale
|
|
67
|
-
}) ?? yAxis.data[yIndex].toLocaleString();
|
|
68
|
-
const formattedValue = series[seriesId].valueFormatter(value, {
|
|
69
|
-
dataIndex: identifier.dataIndex
|
|
70
|
-
});
|
|
71
|
-
const seriesLabel = (0, _internals.getLabel)(series[seriesId].label, 'tooltip');
|
|
72
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipPaper, {
|
|
73
|
-
className: classes.paper,
|
|
74
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipTable, {
|
|
75
|
-
className: classes.table,
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_HeatmapTooltipAxesValue.HeatmapTooltipAxesValue, {
|
|
77
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
78
|
-
children: formattedX
|
|
79
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
80
|
-
children: formattedY
|
|
81
|
-
})]
|
|
82
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
83
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipRow, {
|
|
84
|
-
className: classes.row,
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipCell, {
|
|
86
|
-
className: (0, _clsx.default)(classes.labelCell, classes.cell),
|
|
87
|
-
component: "th",
|
|
88
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
89
|
-
className: classes.markContainer,
|
|
90
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.ChartsLabelMark, {
|
|
91
|
-
type: markType,
|
|
92
|
-
color: color,
|
|
93
|
-
className: classes.mark
|
|
94
|
-
})
|
|
95
|
-
}), seriesLabel]
|
|
96
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipCell, {
|
|
97
|
-
className: (0, _clsx.default)(classes.valueCell, classes.cell),
|
|
98
|
-
component: "td",
|
|
99
|
-
children: formattedValue
|
|
100
|
-
})]
|
|
101
|
-
})
|
|
102
|
-
})]
|
|
103
|
-
})
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltipContent.propTypes = {
|
|
107
|
-
// ----------------------------- Warning --------------------------------
|
|
108
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
109
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
110
|
-
// ----------------------------------------------------------------------
|
|
111
|
-
/**
|
|
112
|
-
* Override or extend the styles applied to the component.
|
|
113
|
-
*/
|
|
114
|
-
classes: _propTypes.default.object
|
|
115
|
-
} : void 0;
|
|
116
18
|
function HeatmapTooltip(props) {
|
|
117
|
-
const classes = useUtilityClasses({
|
|
19
|
+
const classes = (0, _HeatmapTooltip.useUtilityClasses)({
|
|
118
20
|
classes: props.classes
|
|
119
21
|
});
|
|
120
22
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipContainer, (0, _extends2.default)({
|
|
121
23
|
trigger: "item"
|
|
122
24
|
}, props, {
|
|
123
25
|
classes: classes,
|
|
124
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapTooltipContent.HeatmapTooltipContent, {
|
|
125
27
|
classes: classes
|
|
126
28
|
})
|
|
127
29
|
}));
|
|
@@ -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,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
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.HeatmapTooltipContent = HeatmapTooltipContent;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
+
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
14
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
15
|
+
var _internals = require("@mui/x-charts/internals");
|
|
16
|
+
var _useHeatmapSeries = require("../../hooks/useHeatmapSeries");
|
|
17
|
+
var _HeatmapTooltipAxesValue = require("./HeatmapTooltipAxesValue");
|
|
18
|
+
var _HeatmapTooltip = require("./HeatmapTooltip.classes");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function HeatmapTooltipContent(props) {
|
|
21
|
+
const classes = (0, _HeatmapTooltip.useUtilityClasses)(props);
|
|
22
|
+
const xAxis = (0, _hooks.useXAxis)();
|
|
23
|
+
const yAxis = (0, _hooks.useYAxis)();
|
|
24
|
+
const heatmapSeries = (0, _useHeatmapSeries.useHeatmapSeriesContext)();
|
|
25
|
+
const tooltipData = (0, _ChartsTooltip.useItemTooltip)();
|
|
26
|
+
if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const {
|
|
30
|
+
series,
|
|
31
|
+
seriesOrder
|
|
32
|
+
} = heatmapSeries;
|
|
33
|
+
const seriesId = seriesOrder[0];
|
|
34
|
+
const {
|
|
35
|
+
color,
|
|
36
|
+
value,
|
|
37
|
+
identifier,
|
|
38
|
+
markType
|
|
39
|
+
} = tooltipData;
|
|
40
|
+
const [xIndex, yIndex] = value;
|
|
41
|
+
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
42
|
+
location: 'tooltip',
|
|
43
|
+
scale: xAxis.scale
|
|
44
|
+
}) ?? xAxis.data[xIndex].toLocaleString();
|
|
45
|
+
const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
|
|
46
|
+
location: 'tooltip',
|
|
47
|
+
scale: yAxis.scale
|
|
48
|
+
}) ?? yAxis.data[yIndex].toLocaleString();
|
|
49
|
+
const formattedValue = series[seriesId].valueFormatter(value, {
|
|
50
|
+
dataIndex: identifier.dataIndex
|
|
51
|
+
});
|
|
52
|
+
const seriesLabel = (0, _internals.getLabel)(series[seriesId].label, 'tooltip');
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipPaper, {
|
|
54
|
+
className: classes.paper,
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipTable, {
|
|
56
|
+
className: classes.table,
|
|
57
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_HeatmapTooltipAxesValue.HeatmapTooltipAxesValue, {
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
59
|
+
children: formattedX
|
|
60
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
61
|
+
children: formattedY
|
|
62
|
+
})]
|
|
63
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipRow, {
|
|
65
|
+
className: classes.row,
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipCell, {
|
|
67
|
+
className: (0, _clsx.default)(classes.labelCell, classes.cell),
|
|
68
|
+
component: "th",
|
|
69
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
70
|
+
className: classes.markContainer,
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.ChartsLabelMark, {
|
|
72
|
+
type: markType,
|
|
73
|
+
color: color,
|
|
74
|
+
className: classes.mark
|
|
75
|
+
})
|
|
76
|
+
}), seriesLabel]
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipCell, {
|
|
78
|
+
className: (0, _clsx.default)(classes.valueCell, classes.cell),
|
|
79
|
+
component: "td",
|
|
80
|
+
children: formattedValue
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
process.env.NODE_ENV !== "production" ? HeatmapTooltipContent.propTypes = {
|
|
88
|
+
// ----------------------------- Warning --------------------------------
|
|
89
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
/**
|
|
93
|
+
* Override or extend the styles applied to the component.
|
|
94
|
+
*/
|
|
95
|
+
classes: _propTypes.default.object
|
|
96
|
+
} : void 0;
|
|
@@ -13,4 +13,15 @@ Object.keys(_HeatmapTooltip).forEach(function (key) {
|
|
|
13
13
|
return _HeatmapTooltip[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
});
|
|
17
|
+
var _HeatmapTooltipContent = require("./HeatmapTooltipContent");
|
|
18
|
+
Object.keys(_HeatmapTooltipContent).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _HeatmapTooltipContent[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _HeatmapTooltipContent[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
});
|