@mui/x-charts-pro 8.27.2 → 9.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.d.ts +1 -1
- package/BarChartPro/BarChartPro.js +30 -8
- package/CHANGELOG.md +279 -34
- package/ChartContainerPro/ChartContainerPro.d.ts +17 -31
- package/ChartContainerPro/ChartContainerPro.js +14 -287
- package/ChartContainerPro/useChartContainerProProps.d.ts +10 -7
- package/ChartContainerPro/useChartContainerProProps.js +10 -35
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +5 -3
- package/ChartDataProviderPro/ChartDataProviderPro.js +2 -2
- package/ChartDataProviderPro/index.d.ts +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -3
- package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +8 -6
- package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +6 -4
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +4 -4
- package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +1 -1
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +4 -4
- package/ChartsContainer/index.d.ts +1 -0
- package/ChartsContainer/index.js +16 -0
- package/ChartsContainerPro/ChartsContainerPro.d.ts +37 -0
- package/ChartsContainerPro/ChartsContainerPro.js +188 -0
- package/ChartsContainerPro/index.d.ts +9 -0
- package/ChartsContainerPro/index.js +17 -0
- package/ChartsContainerPro/useChartsContainerProProps.d.ts +8 -0
- package/ChartsContainerPro/useChartsContainerProProps.js +44 -0
- package/FunnelChart/FunnelChart.d.ts +1 -1
- package/FunnelChart/FunnelChart.js +9 -8
- package/FunnelChart/FunnelSection.d.ts +1 -1
- package/FunnelChart/funnel.types.d.ts +1 -1
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +12 -9
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +3 -2
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/FunnelChart/funnelSlots.types.d.ts +3 -9
- package/FunnelChart/index.d.ts +2 -1
- package/FunnelChart/index.js +12 -0
- package/FunnelChart/seriesConfig/index.js +2 -1
- package/FunnelChart/seriesConfig/keyboardFocusHandler.js +1 -14
- package/FunnelChart/seriesConfig/legend.js +0 -1
- package/Heatmap/Heatmap.d.ts +6 -3
- package/Heatmap/Heatmap.js +46 -135
- package/Heatmap/Heatmap.types.d.ts +19 -0
- package/Heatmap/Heatmap.types.js +5 -0
- package/Heatmap/HeatmapItem.d.ts +6 -0
- package/Heatmap/HeatmapItem.js +11 -3
- package/Heatmap/HeatmapPlot.d.ts +7 -3
- package/Heatmap/HeatmapPlot.js +16 -54
- package/Heatmap/HeatmapSVGPlot.d.ts +2 -0
- package/Heatmap/HeatmapSVGPlot.js +70 -0
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +18 -2
- package/Heatmap/HeatmapTooltip/index.d.ts +1 -1
- package/Heatmap/index.d.ts +3 -2
- package/Heatmap/seriesConfig/getItemAtPosition.d.ts +2 -2
- package/Heatmap/seriesConfig/getItemAtPosition.js +6 -2
- package/Heatmap/seriesConfig/index.js +1 -0
- package/Heatmap/useHeatmapProps.d.ts +24 -0
- package/Heatmap/useHeatmapProps.js +159 -0
- package/LineChartPro/LineChartPro.d.ts +1 -1
- package/LineChartPro/LineChartPro.js +30 -8
- package/PieChartPro/PieChartPro.d.ts +1 -1
- package/PieChartPro/PieChartPro.js +9 -8
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.js +8 -8
- package/SankeyChart/SankeyChart.d.ts +1 -1
- package/SankeyChart/SankeyChart.js +9 -23
- package/SankeyChart/SankeyTooltip/SankeyTooltip.types.d.ts +5 -1
- package/SankeyChart/SankeyTooltip/index.d.ts +1 -1
- package/SankeyChart/index.d.ts +1 -1
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +7 -7
- package/SankeyChart/sankey.highlight.types.d.ts +4 -0
- package/SankeyChart/sankey.types.d.ts +6 -3
- package/SankeyChart/sankeySlots.types.d.ts +3 -9
- package/SankeyChart/seriesConfig/getSeriesWithDefaultValues.js +13 -1
- package/SankeyChart/seriesConfig/identifierCleaner.d.ts +3 -0
- package/SankeyChart/seriesConfig/identifierCleaner.js +24 -0
- package/SankeyChart/seriesConfig/index.js +3 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/ScatterChartPro/ScatterChartPro.js +30 -8
- package/esm/BarChartPro/BarChartPro.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.js +30 -8
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +17 -31
- package/esm/ChartContainerPro/ChartContainerPro.js +15 -286
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +10 -7
- package/esm/ChartContainerPro/useChartContainerProProps.js +11 -34
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +5 -3
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +2 -2
- package/esm/ChartDataProviderPro/index.d.ts +1 -1
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -3
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +9 -7
- package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +7 -5
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +4 -4
- package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +1 -1
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +4 -4
- package/esm/ChartsContainer/index.d.ts +1 -0
- package/esm/ChartsContainer/index.js +2 -0
- package/esm/ChartsContainerPro/ChartsContainerPro.d.ts +37 -0
- package/esm/ChartsContainerPro/ChartsContainerPro.js +182 -0
- package/esm/ChartsContainerPro/index.d.ts +9 -0
- package/esm/ChartsContainerPro/index.js +6 -0
- package/esm/ChartsContainerPro/useChartsContainerProProps.d.ts +8 -0
- package/esm/ChartsContainerPro/useChartsContainerProProps.js +37 -0
- package/esm/FunnelChart/FunnelChart.d.ts +1 -1
- package/esm/FunnelChart/FunnelChart.js +9 -8
- package/esm/FunnelChart/FunnelSection.d.ts +1 -1
- package/esm/FunnelChart/funnel.types.d.ts +1 -1
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +13 -10
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +3 -2
- package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
- package/esm/FunnelChart/funnelSlots.types.d.ts +3 -9
- package/esm/FunnelChart/index.d.ts +2 -1
- package/esm/FunnelChart/index.js +1 -0
- package/esm/FunnelChart/seriesConfig/index.js +3 -2
- package/esm/FunnelChart/seriesConfig/keyboardFocusHandler.js +2 -15
- package/esm/FunnelChart/seriesConfig/legend.js +0 -1
- package/esm/Heatmap/Heatmap.d.ts +6 -3
- package/esm/Heatmap/Heatmap.js +47 -136
- package/esm/Heatmap/Heatmap.types.d.ts +19 -0
- package/esm/Heatmap/Heatmap.types.js +1 -0
- package/esm/Heatmap/HeatmapItem.d.ts +6 -0
- package/esm/Heatmap/HeatmapItem.js +11 -3
- package/esm/Heatmap/HeatmapPlot.d.ts +7 -3
- package/esm/Heatmap/HeatmapPlot.js +17 -56
- package/esm/Heatmap/HeatmapSVGPlot.d.ts +2 -0
- package/esm/Heatmap/HeatmapSVGPlot.js +64 -0
- package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +18 -2
- package/esm/Heatmap/HeatmapTooltip/index.d.ts +1 -1
- package/esm/Heatmap/index.d.ts +3 -2
- package/esm/Heatmap/seriesConfig/getItemAtPosition.d.ts +2 -2
- package/esm/Heatmap/seriesConfig/getItemAtPosition.js +6 -2
- package/esm/Heatmap/seriesConfig/index.js +2 -1
- package/esm/Heatmap/useHeatmapProps.d.ts +24 -0
- package/esm/Heatmap/useHeatmapProps.js +151 -0
- package/esm/LineChartPro/LineChartPro.d.ts +1 -1
- package/esm/LineChartPro/LineChartPro.js +30 -8
- package/esm/PieChartPro/PieChartPro.d.ts +1 -1
- package/esm/PieChartPro/PieChartPro.js +9 -8
- package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.js +8 -8
- package/esm/SankeyChart/SankeyChart.d.ts +1 -1
- package/esm/SankeyChart/SankeyChart.js +9 -23
- package/esm/SankeyChart/SankeyTooltip/SankeyTooltip.types.d.ts +5 -1
- package/esm/SankeyChart/SankeyTooltip/index.d.ts +1 -1
- package/esm/SankeyChart/index.d.ts +1 -1
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +7 -7
- package/esm/SankeyChart/sankey.highlight.types.d.ts +4 -0
- package/esm/SankeyChart/sankey.types.d.ts +6 -3
- package/esm/SankeyChart/sankeySlots.types.d.ts +3 -9
- package/esm/SankeyChart/seriesConfig/getSeriesWithDefaultValues.js +13 -1
- package/esm/SankeyChart/seriesConfig/identifierCleaner.d.ts +3 -0
- package/esm/SankeyChart/seriesConfig/identifierCleaner.js +18 -0
- package/esm/SankeyChart/seriesConfig/index.js +3 -1
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +1 -1
- package/esm/ScatterChartPro/ScatterChartPro.js +30 -8
- package/esm/index.d.ts +3 -1
- package/esm/index.js +2 -1
- package/esm/internals/index.d.ts +7 -1
- package/esm/internals/index.js +5 -1
- package/esm/internals/plugins/useChartProExport/common.d.ts +5 -1
- package/esm/internals/plugins/useChartProExport/common.js +36 -0
- package/esm/internals/plugins/useChartProExport/exportImage.d.ts +1 -1
- package/esm/internals/plugins/useChartProExport/exportImage.js +2 -1
- package/esm/internals/plugins/useChartProExport/print.d.ts +1 -1
- package/esm/internals/plugins/useChartProExport/print.js +2 -1
- package/esm/internals/plugins/useChartProExport/useChartProExport.js +4 -2
- package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +4 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +4 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +6 -4
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +7 -5
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +4 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +6 -4
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +6 -4
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +2 -3
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +6 -4
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +5 -5
- package/esm/models/seriesType/heatmap.d.ts +3 -3
- package/esm/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +1 -1
- package/esm/plugins/selectors/useChartHeatmapPosition.selectors.js +3 -1
- package/esm/typeOverloads/modules.d.ts +9 -5
- package/index.d.ts +3 -1
- package/index.js +9 -1
- package/internals/index.d.ts +7 -1
- package/internals/index.js +43 -1
- package/internals/plugins/useChartProExport/common.d.ts +5 -1
- package/internals/plugins/useChartProExport/common.js +37 -0
- package/internals/plugins/useChartProExport/exportImage.d.ts +1 -1
- package/internals/plugins/useChartProExport/exportImage.js +1 -0
- package/internals/plugins/useChartProExport/print.d.ts +1 -1
- package/internals/plugins/useChartProExport/print.js +1 -0
- package/internals/plugins/useChartProExport/useChartProExport.js +4 -2
- package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +4 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +4 -2
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +5 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +6 -4
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +4 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +5 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +5 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +2 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +5 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +5 -5
- package/models/seriesType/heatmap.d.ts +3 -3
- package/package.json +19 -11
- package/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +1 -1
- package/plugins/selectors/useChartHeatmapPosition.selectors.js +3 -1
- package/typeOverloads/modules.d.ts +9 -5
package/esm/Heatmap/Heatmap.js
CHANGED
|
@@ -4,160 +4,57 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
|
-
import useId from '@mui/utils/useId';
|
|
8
|
-
import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
|
|
9
7
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
10
8
|
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
11
9
|
import { ChartsWrapper } from '@mui/x-charts/ChartsWrapper';
|
|
12
10
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
13
11
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
14
|
-
import {
|
|
15
|
-
import { ChartsLegend, ContinuousColorLegend } from '@mui/x-charts/ChartsLegend';
|
|
12
|
+
import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
|
|
16
13
|
import { ChartsBrushOverlay } from '@mui/x-charts/ChartsBrushOverlay';
|
|
17
14
|
import { HeatmapPlot } from "./HeatmapPlot.js";
|
|
18
|
-
import { heatmapSeriesConfig } from "./seriesConfig/index.js";
|
|
19
15
|
import { HeatmapTooltip } from "./HeatmapTooltip/index.js";
|
|
20
|
-
import { HEATMAP_PLUGINS } from "./Heatmap.plugins.js";
|
|
21
16
|
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
|
|
22
17
|
import { ChartsToolbarPro } from "../ChartsToolbarPro/index.js";
|
|
23
18
|
import { FocusedHeatmapCell } from "./FocusedHeatmapCell.js";
|
|
19
|
+
import { useHeatmapProps } from "./useHeatmapProps.js";
|
|
24
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
26
|
-
const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
27
|
-
const seriesConfig = {
|
|
28
|
-
heatmap: heatmapSeriesConfig
|
|
29
|
-
};
|
|
30
|
-
function getDefaultDataForAxis(series, dimension) {
|
|
31
|
-
if (series?.[0]?.data === undefined || series[0].data.length === 0) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
return Array.from({
|
|
35
|
-
length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
|
|
36
|
-
}, (_, index) => index);
|
|
37
|
-
}
|
|
38
|
-
const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
|
|
39
|
-
const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
|
|
40
21
|
const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
41
22
|
const props = useThemeProps({
|
|
42
23
|
props: inProps,
|
|
43
24
|
name: 'MuiHeatmap'
|
|
44
25
|
});
|
|
45
26
|
const {
|
|
46
|
-
apiRef,
|
|
47
|
-
xAxis,
|
|
48
|
-
yAxis,
|
|
49
|
-
zAxis,
|
|
50
|
-
series,
|
|
51
|
-
width,
|
|
52
|
-
height,
|
|
53
|
-
margin,
|
|
54
|
-
colors,
|
|
55
|
-
dataset,
|
|
56
27
|
sx,
|
|
57
|
-
onAxisClick,
|
|
58
|
-
children,
|
|
59
28
|
slots,
|
|
60
29
|
slotProps,
|
|
61
30
|
loading,
|
|
62
|
-
|
|
63
|
-
onHighlightChange,
|
|
64
|
-
onItemClick,
|
|
65
|
-
enableKeyboardNavigation,
|
|
66
|
-
hideLegend = true,
|
|
31
|
+
hideLegend,
|
|
67
32
|
showToolbar = false
|
|
68
33
|
} = props;
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
id: DEFAULT_Y_AXIS_KEY
|
|
81
|
-
}]).map(axis => _extends({
|
|
82
|
-
scaleType: 'band',
|
|
83
|
-
categoryGapRatio: 0
|
|
84
|
-
}, axis, {
|
|
85
|
-
data: axis.data ?? getDefaultDataForYAxis(series)
|
|
86
|
-
})), [series, yAxis]);
|
|
87
|
-
const zAxisWithDefault = React.useMemo(() => zAxis ?? [{
|
|
88
|
-
colorMap: {
|
|
89
|
-
type: 'continuous',
|
|
90
|
-
min: 0,
|
|
91
|
-
max: 100,
|
|
92
|
-
color: defaultColorMap
|
|
93
|
-
}
|
|
94
|
-
}], [zAxis]);
|
|
95
|
-
const chartsWrapperProps = {
|
|
96
|
-
sx,
|
|
97
|
-
legendPosition: props.slotProps?.legend?.position,
|
|
98
|
-
legendDirection: props.slotProps?.legend?.direction,
|
|
99
|
-
hideLegend
|
|
100
|
-
};
|
|
34
|
+
const {
|
|
35
|
+
chartDataProviderProProps,
|
|
36
|
+
chartsWrapperProps,
|
|
37
|
+
chartsAxisProps,
|
|
38
|
+
clipPathProps,
|
|
39
|
+
clipPathGroupProps,
|
|
40
|
+
legendProps,
|
|
41
|
+
heatmapPlotProps,
|
|
42
|
+
overlayProps,
|
|
43
|
+
children
|
|
44
|
+
} = useHeatmapProps(props);
|
|
101
45
|
const Tooltip = slots?.tooltip ?? HeatmapTooltip;
|
|
102
46
|
const Toolbar = slots?.toolbar ?? ChartsToolbarPro;
|
|
103
|
-
return /*#__PURE__*/_jsx(ChartDataProviderPro, {
|
|
104
|
-
apiRef: apiRef,
|
|
105
|
-
seriesConfig: seriesConfig,
|
|
106
|
-
series: series.map(s => _extends({
|
|
107
|
-
type: 'heatmap'
|
|
108
|
-
}, s)),
|
|
109
|
-
width: width,
|
|
110
|
-
height: height,
|
|
111
|
-
margin: margin,
|
|
112
|
-
xAxis: xAxisWithDefault,
|
|
113
|
-
yAxis: yAxisWithDefault,
|
|
114
|
-
zAxis: zAxisWithDefault,
|
|
115
|
-
colors: colors,
|
|
116
|
-
dataset: dataset,
|
|
117
|
-
disableAxisListener: true,
|
|
118
|
-
highlightedItem: highlightedItem,
|
|
119
|
-
onHighlightChange: onHighlightChange,
|
|
120
|
-
enableKeyboardNavigation: enableKeyboardNavigation,
|
|
121
|
-
onAxisClick: onAxisClick,
|
|
122
|
-
onItemClick: onItemClick,
|
|
123
|
-
plugins: HEATMAP_PLUGINS,
|
|
47
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
124
48
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
legend: slots?.legend ?? ContinuousColorLegend
|
|
128
|
-
}),
|
|
129
|
-
slotProps: {
|
|
130
|
-
legend: _extends({
|
|
131
|
-
labelPosition: 'extremes'
|
|
132
|
-
}, slotProps?.legend)
|
|
133
|
-
},
|
|
134
|
-
sx: slotProps?.legend?.direction === 'vertical' ? {
|
|
135
|
-
height: 150
|
|
136
|
-
} : {
|
|
137
|
-
width: '50%'
|
|
138
|
-
}
|
|
139
|
-
}), /*#__PURE__*/_jsxs(ChartsSurface, {
|
|
140
|
-
ref: ref,
|
|
49
|
+
ref: ref,
|
|
50
|
+
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, {
|
|
141
51
|
sx: sx,
|
|
142
|
-
children: [/*#__PURE__*/_jsxs("g", {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
slots: slots,
|
|
146
|
-
slotProps: slotProps
|
|
147
|
-
}), /*#__PURE__*/_jsx(FocusedHeatmapCell, {}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
148
|
-
loading: loading,
|
|
149
|
-
slots: slots,
|
|
150
|
-
slotProps: slotProps
|
|
151
|
-
})]
|
|
152
|
-
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
153
|
-
slots: slots,
|
|
154
|
-
slotProps: slotProps
|
|
155
|
-
}), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
156
|
-
id: clipPathId
|
|
157
|
-
}), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), children]
|
|
52
|
+
children: [/*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
53
|
+
children: [/*#__PURE__*/_jsx(HeatmapPlot, _extends({}, heatmapPlotProps)), /*#__PURE__*/_jsx(FocusedHeatmapCell, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps))]
|
|
54
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), children]
|
|
158
55
|
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip))]
|
|
159
56
|
}))
|
|
160
|
-
});
|
|
57
|
+
}));
|
|
161
58
|
});
|
|
162
59
|
if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
|
|
163
60
|
process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
@@ -173,6 +70,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
173
70
|
setZoomData: PropTypes.func.isRequired
|
|
174
71
|
})
|
|
175
72
|
}),
|
|
73
|
+
/**
|
|
74
|
+
* The border radius of the heatmap cells in pixels.
|
|
75
|
+
*/
|
|
76
|
+
borderRadius: PropTypes.number,
|
|
176
77
|
/**
|
|
177
78
|
* Configuration for the brush interaction.
|
|
178
79
|
*/
|
|
@@ -205,7 +106,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
205
106
|
height: PropTypes.number,
|
|
206
107
|
/**
|
|
207
108
|
* If `true`, the legend is not rendered.
|
|
208
|
-
* @default true
|
|
209
109
|
*/
|
|
210
110
|
hideLegend: PropTypes.bool,
|
|
211
111
|
/**
|
|
@@ -214,7 +114,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
214
114
|
*/
|
|
215
115
|
highlightedItem: PropTypes.shape({
|
|
216
116
|
dataIndex: PropTypes.number,
|
|
217
|
-
seriesId: PropTypes.
|
|
117
|
+
seriesId: PropTypes.string.isRequired
|
|
218
118
|
}),
|
|
219
119
|
/**
|
|
220
120
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -270,9 +170,17 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
270
170
|
* The callback fired when an item is clicked.
|
|
271
171
|
*
|
|
272
172
|
* @param {React.MouseEvent<SVGSVGElement, MouseEvent>} event The click event.
|
|
273
|
-
* @param {
|
|
173
|
+
* @param {SeriesItemIdentifierWithType<SeriesType>} item The clicked item.
|
|
274
174
|
*/
|
|
275
175
|
onItemClick: PropTypes.func,
|
|
176
|
+
/**
|
|
177
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
178
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
179
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
180
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
181
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
182
|
+
*/
|
|
183
|
+
onTooltipAxisChange: PropTypes.func,
|
|
276
184
|
/**
|
|
277
185
|
* The callback fired when the tooltip item changes.
|
|
278
186
|
*
|
|
@@ -290,11 +198,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
290
198
|
* An array of [[HeatmapSeries]] objects.
|
|
291
199
|
*/
|
|
292
200
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
293
|
-
/**
|
|
294
|
-
* The configuration helpers used to compute attributes according to the series type.
|
|
295
|
-
* @ignore Unstable props for internal usage.
|
|
296
|
-
*/
|
|
297
|
-
seriesConfig: PropTypes.object,
|
|
298
201
|
/**
|
|
299
202
|
* If true, shows the default chart toolbar.
|
|
300
203
|
* @default false
|
|
@@ -318,16 +221,24 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
318
221
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
319
222
|
*/
|
|
320
223
|
tooltip: PropTypes.object,
|
|
224
|
+
/**
|
|
225
|
+
* The controlled axis tooltip.
|
|
226
|
+
* Identified by the axis id, and data index.
|
|
227
|
+
*/
|
|
228
|
+
tooltipAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
229
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
230
|
+
dataIndex: PropTypes.number.isRequired
|
|
231
|
+
})),
|
|
321
232
|
/**
|
|
322
233
|
* The tooltip item.
|
|
323
234
|
* Used when the tooltip is controlled.
|
|
324
235
|
*/
|
|
325
236
|
tooltipItem: PropTypes.shape({
|
|
326
237
|
dataIndex: PropTypes.number,
|
|
327
|
-
seriesId: PropTypes.
|
|
328
|
-
type: PropTypes.oneOf(['heatmap'])
|
|
329
|
-
xIndex: PropTypes.number,
|
|
330
|
-
yIndex: PropTypes.number
|
|
238
|
+
seriesId: PropTypes.string.isRequired,
|
|
239
|
+
type: PropTypes.oneOf(['heatmap']),
|
|
240
|
+
xIndex: PropTypes.number.isRequired,
|
|
241
|
+
yIndex: PropTypes.number.isRequired
|
|
331
242
|
}),
|
|
332
243
|
/**
|
|
333
244
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HeatmapItemProps, type HeatmapItemSlotProps, type HeatmapItemSlots } from "./HeatmapItem.js";
|
|
2
|
+
export interface HeatmapPlotSlots extends HeatmapItemSlots {}
|
|
3
|
+
export interface HeatmapPlotSlotProps extends HeatmapItemSlotProps {}
|
|
4
|
+
export interface HeatmapRendererPlotProps extends Pick<HeatmapItemProps, 'slots' | 'slotProps'> {
|
|
5
|
+
/**
|
|
6
|
+
* The border radius of the heatmap cells in pixels.
|
|
7
|
+
*/
|
|
8
|
+
borderRadius?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Overridable component slots.
|
|
11
|
+
* @default {}
|
|
12
|
+
*/
|
|
13
|
+
slots?: HeatmapPlotSlots;
|
|
14
|
+
/**
|
|
15
|
+
* The props used for each component slot.
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
slotProps?: HeatmapPlotSlotProps;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -19,9 +19,15 @@ export interface HeatmapItemProps {
|
|
|
19
19
|
height: number;
|
|
20
20
|
x: number;
|
|
21
21
|
y: number;
|
|
22
|
+
xIndex: number;
|
|
23
|
+
yIndex: number;
|
|
22
24
|
color: string;
|
|
23
25
|
isHighlighted?: boolean;
|
|
24
26
|
isFaded?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The border radius of the heatmap cell in pixels.
|
|
29
|
+
*/
|
|
30
|
+
borderRadius?: number;
|
|
25
31
|
/**
|
|
26
32
|
* The props used for each component slot.
|
|
27
33
|
* @default {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "slotProps", "slots"];
|
|
3
|
+
const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
@@ -34,6 +34,9 @@ function HeatmapItem(props) {
|
|
|
34
34
|
value,
|
|
35
35
|
isHighlighted = false,
|
|
36
36
|
isFaded = false,
|
|
37
|
+
borderRadius,
|
|
38
|
+
xIndex,
|
|
39
|
+
yIndex,
|
|
37
40
|
slotProps = {},
|
|
38
41
|
slots = {}
|
|
39
42
|
} = props,
|
|
@@ -45,7 +48,9 @@ function HeatmapItem(props) {
|
|
|
45
48
|
const interactionProps = useInteractionItemProps({
|
|
46
49
|
type: 'heatmap',
|
|
47
50
|
seriesId,
|
|
48
|
-
dataIndex
|
|
51
|
+
dataIndex,
|
|
52
|
+
xIndex,
|
|
53
|
+
yIndex
|
|
49
54
|
}, skipInteractionItemProps);
|
|
50
55
|
const ownerState = {
|
|
51
56
|
seriesId,
|
|
@@ -59,7 +64,10 @@ function HeatmapItem(props) {
|
|
|
59
64
|
const Cell = slots?.cell ?? HeatmapCell;
|
|
60
65
|
const cellProps = useSlotProps({
|
|
61
66
|
elementType: Cell,
|
|
62
|
-
additionalProps: interactionProps,
|
|
67
|
+
additionalProps: _extends({}, interactionProps, {
|
|
68
|
+
rx: borderRadius,
|
|
69
|
+
ry: borderRadius
|
|
70
|
+
}),
|
|
63
71
|
externalForwardedProps: _extends({}, other),
|
|
64
72
|
externalSlotProps: slotProps.cell,
|
|
65
73
|
ownerState,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type HeatmapRendererPlotProps } from "./Heatmap.types.js";
|
|
3
|
+
export interface HeatmapPlotProps extends HeatmapRendererPlotProps {}
|
|
4
|
+
declare function HeatmapPlot({
|
|
5
|
+
borderRadius,
|
|
6
|
+
...props
|
|
7
|
+
}: HeatmapPlotProps): React.ReactNode;
|
|
4
8
|
declare namespace HeatmapPlot {
|
|
5
9
|
var propTypes: any;
|
|
6
10
|
}
|
|
@@ -1,69 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["borderRadius"];
|
|
3
6
|
import * as React from 'react';
|
|
4
7
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const xScale = useXScale();
|
|
16
|
-
const yScale = useYScale();
|
|
17
|
-
const colorScale = useZColorScale();
|
|
18
|
-
const series = useHeatmapSeriesContext();
|
|
19
|
-
const isHighlighted = store.use(selectorChartsIsHighlightedCallback);
|
|
20
|
-
const isFaded = store.use(selectorChartsIsFadedCallback);
|
|
21
|
-
const xDomain = xScale.domain();
|
|
22
|
-
const yDomain = yScale.domain();
|
|
23
|
-
if (!series || series.seriesOrder.length === 0) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
27
|
-
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
28
|
-
children: [shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps) ? /*#__PURE__*/_jsx(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/_jsx("g", {
|
|
29
|
-
children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
|
|
30
|
-
const x = xScale(xDomain[xIndex]);
|
|
31
|
-
const y = yScale(yDomain[yIndex]);
|
|
32
|
-
const color = colorScale?.(value);
|
|
33
|
-
if (x === undefined || y === undefined || !color) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const item = {
|
|
37
|
-
seriesId: seriesToDisplay.id,
|
|
38
|
-
dataIndex
|
|
39
|
-
};
|
|
40
|
-
return /*#__PURE__*/_jsx(HeatmapItem, {
|
|
41
|
-
width: xScale.bandwidth(),
|
|
42
|
-
height: yScale.bandwidth(),
|
|
43
|
-
x: x,
|
|
44
|
-
y: y,
|
|
45
|
-
color: color,
|
|
46
|
-
dataIndex: dataIndex,
|
|
47
|
-
seriesId: series.seriesOrder[0],
|
|
48
|
-
value: value,
|
|
49
|
-
slots: props.slots,
|
|
50
|
-
slotProps: props.slotProps,
|
|
51
|
-
isHighlighted: isHighlighted(item),
|
|
52
|
-
isFaded: isFaded(item)
|
|
53
|
-
}, `${xIndex}_${yIndex}`);
|
|
54
|
-
})
|
|
55
|
-
})]
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function RegisterHeatmapPointerInteractions() {
|
|
59
|
-
useRegisterPointerInteractions(selectorHeatmapItemAtPosition);
|
|
60
|
-
return null;
|
|
8
|
+
import { HeatmapSVGPlot } from "./HeatmapSVGPlot.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
function HeatmapPlot(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
borderRadius
|
|
13
|
+
} = _ref,
|
|
14
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
15
|
+
return /*#__PURE__*/_jsx(HeatmapSVGPlot, _extends({
|
|
16
|
+
borderRadius: borderRadius
|
|
17
|
+
}, props));
|
|
61
18
|
}
|
|
62
19
|
process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
|
|
63
20
|
// ----------------------------- Warning --------------------------------
|
|
64
21
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
22
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
66
23
|
// ----------------------------------------------------------------------
|
|
24
|
+
/**
|
|
25
|
+
* The border radius of the heatmap cells in pixels.
|
|
26
|
+
*/
|
|
27
|
+
borderRadius: PropTypes.number,
|
|
67
28
|
/**
|
|
68
29
|
* The props used for each component slot.
|
|
69
30
|
* @default {}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useXScale, useYScale, useZColorScale } from '@mui/x-charts/hooks';
|
|
5
|
+
import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback, useStore, useRegisterPointerInteractions } from '@mui/x-charts/internals';
|
|
6
|
+
import { useHeatmapSeriesContext } from "../hooks/index.js";
|
|
7
|
+
import { HeatmapItem } from "./HeatmapItem.js";
|
|
8
|
+
import { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.js";
|
|
9
|
+
import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const MemoHeatmapItem = /*#__PURE__*/React.memo(HeatmapItem);
|
|
12
|
+
if (process.env.NODE_ENV !== "production") MemoHeatmapItem.displayName = "MemoHeatmapItem";
|
|
13
|
+
export function HeatmapSVGPlot(props) {
|
|
14
|
+
const store = useStore();
|
|
15
|
+
const xScale = useXScale();
|
|
16
|
+
const yScale = useYScale();
|
|
17
|
+
const colorScale = useZColorScale();
|
|
18
|
+
const series = useHeatmapSeriesContext();
|
|
19
|
+
const isHighlighted = store.use(selectorChartsIsHighlightedCallback);
|
|
20
|
+
const isFaded = store.use(selectorChartsIsFadedCallback);
|
|
21
|
+
const xDomain = xScale.domain();
|
|
22
|
+
const yDomain = yScale.domain();
|
|
23
|
+
if (!series || series.seriesOrder.length === 0) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
27
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
28
|
+
children: [shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps) ? /*#__PURE__*/_jsx(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/_jsx("g", {
|
|
29
|
+
children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
|
|
30
|
+
const x = xScale(xDomain[xIndex]);
|
|
31
|
+
const y = yScale(yDomain[yIndex]);
|
|
32
|
+
const color = colorScale?.(value);
|
|
33
|
+
if (x === undefined || y === undefined || !color) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const item = {
|
|
37
|
+
seriesId: seriesToDisplay.id,
|
|
38
|
+
dataIndex
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/_jsx(MemoHeatmapItem, {
|
|
41
|
+
width: xScale.bandwidth(),
|
|
42
|
+
height: yScale.bandwidth(),
|
|
43
|
+
x: x,
|
|
44
|
+
y: y,
|
|
45
|
+
xIndex: xIndex,
|
|
46
|
+
yIndex: yIndex,
|
|
47
|
+
color: color,
|
|
48
|
+
dataIndex: dataIndex,
|
|
49
|
+
seriesId: series.seriesOrder[0],
|
|
50
|
+
value: value,
|
|
51
|
+
slots: props.slots,
|
|
52
|
+
slotProps: props.slotProps,
|
|
53
|
+
isHighlighted: isHighlighted(item),
|
|
54
|
+
isFaded: isFaded(item),
|
|
55
|
+
borderRadius: props.borderRadius
|
|
56
|
+
}, `${xIndex}_${yIndex}`);
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function RegisterHeatmapPointerInteractions() {
|
|
62
|
+
useRegisterPointerInteractions(selectorHeatmapItemAtPosition);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
import { type ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
|
|
2
|
-
export interface
|
|
1
|
+
import { type ChartsTooltipContainerProps, type ChartsTooltipClasses } from '@mui/x-charts/ChartsTooltip';
|
|
2
|
+
export interface HeatmapTooltipSlots {
|
|
3
|
+
/**
|
|
4
|
+
* Custom component for the tooltip popper.
|
|
5
|
+
* @default ChartsTooltipRoot
|
|
6
|
+
*/
|
|
7
|
+
tooltip?: React.ElementType<HeatmapTooltipProps>;
|
|
8
|
+
}
|
|
9
|
+
export interface HeatmapTooltipSlotProps {
|
|
10
|
+
/**
|
|
11
|
+
* Custom component for the tooltip popper.
|
|
12
|
+
* @default ChartsTooltipRoot
|
|
13
|
+
*/
|
|
14
|
+
tooltip?: Partial<HeatmapTooltipProps>;
|
|
15
|
+
}
|
|
16
|
+
export interface HeatmapTooltipClasses extends ChartsTooltipClasses {}
|
|
17
|
+
export interface HeatmapTooltipContentClasses extends ChartsTooltipClasses {}
|
|
18
|
+
export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps<'item' | 'none'>, 'trigger' | 'children'> {
|
|
3
19
|
/**
|
|
4
20
|
* Select the kind of tooltip to display
|
|
5
21
|
* - 'item': Shows data about the item below the mouse.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "./HeatmapTooltip.js";
|
|
2
2
|
export * from "./HeatmapTooltipContent.js";
|
|
3
|
-
export type { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
|
|
3
|
+
export type { HeatmapTooltipProps, HeatmapTooltipClasses, HeatmapTooltipContentClasses, HeatmapTooltipSlots, HeatmapTooltipSlotProps } from "./HeatmapTooltip.types.js";
|
package/esm/Heatmap/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Heatmap } from "./Heatmap.js";
|
|
2
|
-
export type { HeatmapSeries, HeatmapProps } from "./Heatmap.js";
|
|
3
|
-
export { HeatmapPlot } from "./HeatmapPlot.js";
|
|
2
|
+
export type { HeatmapSeries, HeatmapProps, HeatmapSlots, HeatmapSlotProps } from "./Heatmap.js";
|
|
3
|
+
export { HeatmapPlot, type HeatmapPlotProps } from "./HeatmapPlot.js";
|
|
4
|
+
export type { HeatmapPlotSlots, HeatmapPlotSlotProps } from "./Heatmap.types.js";
|
|
4
5
|
export * from "./FocusedHeatmapCell.js";
|
|
5
6
|
export type { HeatmapCellProps } from "./internals/HeatmapCell.js";
|
|
6
7
|
export * from "./HeatmapTooltip/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChartState, UseChartCartesianAxisSignature } from '@mui/x-charts/internals';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SeriesItemIdentifierWithType } from '@mui/x-charts/models';
|
|
3
3
|
export default function getItemAtPosition(state: ChartState<[UseChartCartesianAxisSignature]>, point: {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
|
-
}):
|
|
6
|
+
}): SeriesItemIdentifierWithType<'heatmap'> | undefined;
|
|
@@ -24,12 +24,16 @@ export default function getItemAtPosition(state, point) {
|
|
|
24
24
|
if (dataIndex === -1) {
|
|
25
25
|
return {
|
|
26
26
|
type: 'heatmap',
|
|
27
|
-
seriesId
|
|
27
|
+
seriesId,
|
|
28
|
+
xIndex,
|
|
29
|
+
yIndex
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
return {
|
|
31
33
|
type: 'heatmap',
|
|
32
34
|
seriesId,
|
|
33
|
-
dataIndex
|
|
35
|
+
dataIndex,
|
|
36
|
+
xIndex,
|
|
37
|
+
yIndex
|
|
34
38
|
};
|
|
35
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cartesianSeriesTypes, identifierSerializerSeriesIdDataIndex } from '@mui/x-charts/internals';
|
|
1
|
+
import { cartesianSeriesTypes, identifierSerializerSeriesIdDataIndex, identifierCleanerSeriesIdDataIndex } from '@mui/x-charts/internals';
|
|
2
2
|
import { getBaseExtremum } from "./extremums.js";
|
|
3
3
|
import seriesProcessor from "./seriesProcessor.js";
|
|
4
4
|
import getColor from "./getColor.js";
|
|
@@ -18,6 +18,7 @@ export const heatmapSeriesConfig = {
|
|
|
18
18
|
yExtremumGetter: getBaseExtremum,
|
|
19
19
|
getSeriesWithDefaultValues,
|
|
20
20
|
identifierSerializer: identifierSerializerSeriesIdDataIndex,
|
|
21
|
+
identifierCleaner: identifierCleanerSeriesIdDataIndex,
|
|
21
22
|
getItemAtPosition,
|
|
22
23
|
keyboardFocusHandler
|
|
23
24
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ChartsWrapperProps } from '@mui/x-charts/ChartsWrapper';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type ChartsLegendProps, type ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
|
|
4
|
+
import type { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
|
|
5
|
+
import { type ChartsClipPathProps } from '@mui/x-charts/ChartsClipPath';
|
|
6
|
+
import type { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
7
|
+
import { type HeatmapPluginSignatures } from "./Heatmap.plugins.js";
|
|
8
|
+
import { type HeatmapProps } from "./Heatmap.js";
|
|
9
|
+
import { type ChartDataProviderProProps } from "../ChartDataProviderPro/index.js";
|
|
10
|
+
import { type HeatmapPlotProps } from "./HeatmapPlot.js";
|
|
11
|
+
export type UseHeatmapProps = HeatmapProps;
|
|
12
|
+
export declare function useHeatmapProps(props: UseHeatmapProps): {
|
|
13
|
+
chartDataProviderProProps: ChartDataProviderProProps<"heatmap", HeatmapPluginSignatures>;
|
|
14
|
+
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
15
|
+
heatmapPlotProps: HeatmapPlotProps;
|
|
16
|
+
clipPathProps: ChartsClipPathProps;
|
|
17
|
+
clipPathGroupProps: {
|
|
18
|
+
clipPath: string;
|
|
19
|
+
};
|
|
20
|
+
overlayProps: ChartsOverlayProps;
|
|
21
|
+
chartsAxisProps: ChartsAxisProps;
|
|
22
|
+
legendProps: ChartsLegendProps | ChartsLegendSlotExtension;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
};
|