@mui/x-charts-pro 8.26.0 → 9.0.0-alpha.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 +1 -1
- package/BarChartPro/BarChartPro.js +9 -4
- package/CHANGELOG.md +355 -3
- package/ChartContainerPro/ChartContainerPro.d.ts +17 -31
- package/ChartContainerPro/ChartContainerPro.js +14 -287
- package/ChartContainerPro/useChartContainerProProps.d.ts +9 -5
- package/ChartContainerPro/useChartContainerProProps.js +9 -34
- 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 +187 -0
- package/ChartsContainerPro/index.d.ts +9 -0
- package/ChartsContainerPro/index.js +17 -0
- package/ChartsContainerPro/useChartsContainerProProps.d.ts +9 -0
- package/ChartsContainerPro/useChartsContainerProProps.js +44 -0
- package/FunnelChart/FunnelChart.js +4 -4
- 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/index.d.ts +1 -0
- package/FunnelChart/index.js +12 -0
- package/FunnelChart/seriesConfig/index.js +2 -1
- package/FunnelChart/seriesConfig/legend.js +0 -1
- package/Heatmap/Heatmap.d.ts +14 -2
- package/Heatmap/Heatmap.js +36 -130
- package/Heatmap/Heatmap.plugins.d.ts +2 -2
- package/Heatmap/Heatmap.plugins.js +1 -1
- 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 +5 -1
- package/Heatmap/HeatmapTooltip/index.d.ts +1 -1
- package/Heatmap/index.d.ts +3 -2
- package/Heatmap/seriesConfig/getItemAtPosition.d.ts +6 -0
- package/Heatmap/seriesConfig/getItemAtPosition.js +45 -0
- package/Heatmap/seriesConfig/index.js +3 -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 +9 -4
- package/PieChartPro/PieChartPro.d.ts +1 -1
- package/PieChartPro/PieChartPro.js +4 -4
- package/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/RadarChartPro/RadarChartPro.js +4 -4
- package/RadarChartPro/RadarChartPro.plugins.d.ts +2 -2
- package/RadarChartPro/RadarChartPro.plugins.js +1 -1
- package/SankeyChart/SankeyChart.js +4 -4
- 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/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 +9 -4
- package/esm/BarChartPro/BarChartPro.d.ts +1 -1
- package/esm/BarChartPro/BarChartPro.js +9 -4
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +17 -31
- package/esm/ChartContainerPro/ChartContainerPro.js +15 -286
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +9 -5
- package/esm/ChartContainerPro/useChartContainerProProps.js +10 -33
- 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 +181 -0
- package/esm/ChartsContainerPro/index.d.ts +9 -0
- package/esm/ChartsContainerPro/index.js +6 -0
- package/esm/ChartsContainerPro/useChartsContainerProProps.d.ts +9 -0
- package/esm/ChartsContainerPro/useChartsContainerProProps.js +37 -0
- package/esm/FunnelChart/FunnelChart.js +4 -4
- 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/index.d.ts +1 -0
- package/esm/FunnelChart/index.js +1 -0
- package/esm/FunnelChart/seriesConfig/index.js +3 -2
- package/esm/FunnelChart/seriesConfig/legend.js +0 -1
- package/esm/Heatmap/Heatmap.d.ts +14 -2
- package/esm/Heatmap/Heatmap.js +37 -131
- package/esm/Heatmap/Heatmap.plugins.d.ts +2 -2
- package/esm/Heatmap/Heatmap.plugins.js +2 -2
- 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 +5 -1
- package/esm/Heatmap/HeatmapTooltip/index.d.ts +1 -1
- package/esm/Heatmap/index.d.ts +3 -2
- package/esm/Heatmap/seriesConfig/getItemAtPosition.d.ts +6 -0
- package/esm/Heatmap/seriesConfig/getItemAtPosition.js +39 -0
- package/esm/Heatmap/seriesConfig/index.js +4 -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 +9 -4
- package/esm/PieChartPro/PieChartPro.d.ts +1 -1
- package/esm/PieChartPro/PieChartPro.js +4 -4
- package/esm/RadarChartPro/RadarChartPro.d.ts +1 -1
- package/esm/RadarChartPro/RadarChartPro.js +4 -4
- package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +2 -2
- package/esm/RadarChartPro/RadarChartPro.plugins.js +2 -2
- package/esm/SankeyChart/SankeyChart.js +4 -4
- 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/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 +9 -4
- package/esm/index.d.ts +3 -1
- package/esm/index.js +2 -1
- package/esm/internals/index.d.ts +8 -1
- package/esm/internals/index.js +6 -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 +10 -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 +8 -1
- package/internals/index.js +50 -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 +9 -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 +8 -8
- 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/Heatmap/Heatmap.js
CHANGED
|
@@ -11,158 +11,57 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
|
-
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
15
|
-
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
16
14
|
var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
|
|
17
15
|
var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
|
|
18
16
|
var _ChartsWrapper = require("@mui/x-charts/ChartsWrapper");
|
|
19
17
|
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
20
18
|
var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
|
|
21
|
-
var _constants = require("@mui/x-charts/constants");
|
|
22
19
|
var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
|
|
23
20
|
var _ChartsBrushOverlay = require("@mui/x-charts/ChartsBrushOverlay");
|
|
24
21
|
var _HeatmapPlot = require("./HeatmapPlot");
|
|
25
|
-
var _seriesConfig = require("./seriesConfig");
|
|
26
22
|
var _HeatmapTooltip = require("./HeatmapTooltip");
|
|
27
|
-
var _Heatmap2 = require("./Heatmap.plugins");
|
|
28
23
|
var _ChartDataProviderPro = require("../ChartDataProviderPro");
|
|
29
24
|
var _ChartsToolbarPro = require("../ChartsToolbarPro");
|
|
30
25
|
var _FocusedHeatmapCell = require("./FocusedHeatmapCell");
|
|
26
|
+
var _useHeatmapProps = require("./useHeatmapProps");
|
|
31
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
|
-
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
33
|
-
const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
34
|
-
const seriesConfig = {
|
|
35
|
-
heatmap: _seriesConfig.heatmapSeriesConfig
|
|
36
|
-
};
|
|
37
|
-
function getDefaultDataForAxis(series, dimension) {
|
|
38
|
-
if (series?.[0]?.data === undefined || series[0].data.length === 0) {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
return Array.from({
|
|
42
|
-
length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
|
|
43
|
-
}, (_, index) => index);
|
|
44
|
-
}
|
|
45
|
-
const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
|
|
46
|
-
const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
|
|
47
28
|
const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
48
29
|
const props = (0, _styles.useThemeProps)({
|
|
49
30
|
props: inProps,
|
|
50
31
|
name: 'MuiHeatmap'
|
|
51
32
|
});
|
|
52
33
|
const {
|
|
53
|
-
apiRef,
|
|
54
|
-
xAxis,
|
|
55
|
-
yAxis,
|
|
56
|
-
zAxis,
|
|
57
|
-
series,
|
|
58
|
-
width,
|
|
59
|
-
height,
|
|
60
|
-
margin,
|
|
61
|
-
colors,
|
|
62
|
-
dataset,
|
|
63
34
|
sx,
|
|
64
|
-
onAxisClick,
|
|
65
|
-
children,
|
|
66
35
|
slots,
|
|
67
36
|
slotProps,
|
|
68
37
|
loading,
|
|
69
|
-
|
|
70
|
-
onHighlightChange,
|
|
71
|
-
enableKeyboardNavigation,
|
|
72
|
-
hideLegend = true,
|
|
38
|
+
hideLegend,
|
|
73
39
|
showToolbar = false
|
|
74
40
|
} = props;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
id: _constants.DEFAULT_Y_AXIS_KEY
|
|
87
|
-
}]).map(axis => (0, _extends2.default)({
|
|
88
|
-
scaleType: 'band',
|
|
89
|
-
categoryGapRatio: 0
|
|
90
|
-
}, axis, {
|
|
91
|
-
data: axis.data ?? getDefaultDataForYAxis(series)
|
|
92
|
-
})), [series, yAxis]);
|
|
93
|
-
const zAxisWithDefault = React.useMemo(() => zAxis ?? [{
|
|
94
|
-
colorMap: {
|
|
95
|
-
type: 'continuous',
|
|
96
|
-
min: 0,
|
|
97
|
-
max: 100,
|
|
98
|
-
color: defaultColorMap
|
|
99
|
-
}
|
|
100
|
-
}], [zAxis]);
|
|
101
|
-
const chartsWrapperProps = {
|
|
102
|
-
sx,
|
|
103
|
-
legendPosition: props.slotProps?.legend?.position,
|
|
104
|
-
legendDirection: props.slotProps?.legend?.direction,
|
|
105
|
-
hideLegend
|
|
106
|
-
};
|
|
41
|
+
const {
|
|
42
|
+
chartDataProviderProProps,
|
|
43
|
+
chartsWrapperProps,
|
|
44
|
+
chartsAxisProps,
|
|
45
|
+
clipPathProps,
|
|
46
|
+
clipPathGroupProps,
|
|
47
|
+
legendProps,
|
|
48
|
+
heatmapPlotProps,
|
|
49
|
+
overlayProps,
|
|
50
|
+
children
|
|
51
|
+
} = (0, _useHeatmapProps.useHeatmapProps)(props);
|
|
107
52
|
const Tooltip = slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
|
|
108
53
|
const Toolbar = slots?.toolbar ?? _ChartsToolbarPro.ChartsToolbarPro;
|
|
109
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, {
|
|
110
|
-
apiRef: apiRef,
|
|
111
|
-
seriesConfig: seriesConfig,
|
|
112
|
-
series: series.map(s => (0, _extends2.default)({
|
|
113
|
-
type: 'heatmap'
|
|
114
|
-
}, s)),
|
|
115
|
-
width: width,
|
|
116
|
-
height: height,
|
|
117
|
-
margin: margin,
|
|
118
|
-
xAxis: xAxisWithDefault,
|
|
119
|
-
yAxis: yAxisWithDefault,
|
|
120
|
-
zAxis: zAxisWithDefault,
|
|
121
|
-
colors: colors,
|
|
122
|
-
dataset: dataset,
|
|
123
|
-
disableAxisListener: true,
|
|
124
|
-
highlightedItem: highlightedItem,
|
|
125
|
-
onHighlightChange: onHighlightChange,
|
|
126
|
-
enableKeyboardNavigation: enableKeyboardNavigation,
|
|
127
|
-
onAxisClick: onAxisClick,
|
|
128
|
-
plugins: _Heatmap2.HEATMAP_PLUGINS,
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
129
55
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
130
|
-
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
|
|
131
|
-
slots: (0, _extends2.default)({}, slots, {
|
|
132
|
-
legend: slots?.legend ?? _ChartsLegend.ContinuousColorLegend
|
|
133
|
-
}),
|
|
134
|
-
slotProps: {
|
|
135
|
-
legend: (0, _extends2.default)({
|
|
136
|
-
labelPosition: 'extremes'
|
|
137
|
-
}, slotProps?.legend)
|
|
138
|
-
},
|
|
139
|
-
sx: slotProps?.legend?.direction === 'vertical' ? {
|
|
140
|
-
height: 150
|
|
141
|
-
} : {
|
|
142
|
-
width: '50%'
|
|
143
|
-
}
|
|
144
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
|
|
56
|
+
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
|
|
145
57
|
ref: ref,
|
|
146
58
|
sx: sx,
|
|
147
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
slots: slots,
|
|
151
|
-
slotProps: slotProps
|
|
152
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedHeatmapCell.FocusedHeatmapCell, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
153
|
-
loading: loading,
|
|
154
|
-
slots: slots,
|
|
155
|
-
slotProps: slotProps
|
|
156
|
-
})]
|
|
157
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
158
|
-
slots: slots,
|
|
159
|
-
slotProps: slotProps
|
|
160
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
161
|
-
id: clipPathId
|
|
162
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsBrushOverlay.ChartsBrushOverlay, {}), children]
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, (0, _extends2.default)({}, heatmapPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedHeatmapCell.FocusedHeatmapCell, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps))]
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsBrushOverlay.ChartsBrushOverlay, {}), children]
|
|
163
62
|
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip))]
|
|
164
63
|
}))
|
|
165
|
-
});
|
|
64
|
+
}));
|
|
166
65
|
});
|
|
167
66
|
if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
|
|
168
67
|
process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
@@ -178,6 +77,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
178
77
|
setZoomData: _propTypes.default.func.isRequired
|
|
179
78
|
})
|
|
180
79
|
}),
|
|
80
|
+
/**
|
|
81
|
+
* The border radius of the heatmap cells in pixels.
|
|
82
|
+
*/
|
|
83
|
+
borderRadius: _propTypes.default.number,
|
|
181
84
|
/**
|
|
182
85
|
* Configuration for the brush interaction.
|
|
183
86
|
*/
|
|
@@ -210,7 +113,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
210
113
|
height: _propTypes.default.number,
|
|
211
114
|
/**
|
|
212
115
|
* If `true`, the legend is not rendered.
|
|
213
|
-
* @default true
|
|
214
116
|
*/
|
|
215
117
|
hideLegend: _propTypes.default.bool,
|
|
216
118
|
/**
|
|
@@ -219,7 +121,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
219
121
|
*/
|
|
220
122
|
highlightedItem: _propTypes.default.shape({
|
|
221
123
|
dataIndex: _propTypes.default.number,
|
|
222
|
-
seriesId: _propTypes.default.
|
|
124
|
+
seriesId: _propTypes.default.string.isRequired
|
|
223
125
|
}),
|
|
224
126
|
/**
|
|
225
127
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -261,6 +163,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
261
163
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
262
164
|
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
263
165
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
166
|
+
*
|
|
167
|
+
* @deprecated Use `onItemClick` instead to get access to both x- and y-axis values.
|
|
264
168
|
*/
|
|
265
169
|
onAxisClick: _propTypes.default.func,
|
|
266
170
|
/**
|
|
@@ -269,6 +173,13 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
269
173
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
270
174
|
*/
|
|
271
175
|
onHighlightChange: _propTypes.default.func,
|
|
176
|
+
/**
|
|
177
|
+
* The callback fired when an item is clicked.
|
|
178
|
+
*
|
|
179
|
+
* @param {React.MouseEvent<SVGSVGElement, MouseEvent>} event The click event.
|
|
180
|
+
* @param {SeriesItemIdentifier<SeriesType>} item The clicked item.
|
|
181
|
+
*/
|
|
182
|
+
onItemClick: _propTypes.default.func,
|
|
272
183
|
/**
|
|
273
184
|
* The callback fired when the tooltip item changes.
|
|
274
185
|
*
|
|
@@ -286,11 +197,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
286
197
|
* An array of [[HeatmapSeries]] objects.
|
|
287
198
|
*/
|
|
288
199
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
289
|
-
/**
|
|
290
|
-
* The configuration helpers used to compute attributes according to the series type.
|
|
291
|
-
* @ignore Unstable props for internal usage.
|
|
292
|
-
*/
|
|
293
|
-
seriesConfig: _propTypes.default.object,
|
|
294
200
|
/**
|
|
295
201
|
* If true, shows the default chart toolbar.
|
|
296
202
|
* @default false
|
|
@@ -320,10 +226,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
320
226
|
*/
|
|
321
227
|
tooltipItem: _propTypes.default.shape({
|
|
322
228
|
dataIndex: _propTypes.default.number,
|
|
323
|
-
seriesId: _propTypes.default.
|
|
229
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
324
230
|
type: _propTypes.default.oneOf(['heatmap']).isRequired,
|
|
325
|
-
xIndex: _propTypes.default.number,
|
|
326
|
-
yIndex: _propTypes.default.number
|
|
231
|
+
xIndex: _propTypes.default.number.isRequired,
|
|
232
|
+
yIndex: _propTypes.default.number.isRequired
|
|
327
233
|
}),
|
|
328
234
|
/**
|
|
329
235
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type UseChartZAxisSignature, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartHighlightSignature, type
|
|
1
|
+
import { type UseChartZAxisSignature, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartHighlightSignature, type UseChartBrushSignature, type UseChartItemClickSignature, type UseChartKeyboardNavigationSignature, type ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
3
|
import { type UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.js";
|
|
4
|
-
export type HeatmapPluginSignatures = [UseChartZAxisSignature, UseChartTooltipSignature<'heatmap'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'heatmap'>, UseChartHighlightSignature, UseChartProExportSignature, UseChartBrushSignature, UseChartProZoomSignature, UseChartKeyboardNavigationSignature];
|
|
4
|
+
export type HeatmapPluginSignatures = [UseChartZAxisSignature, UseChartTooltipSignature<'heatmap'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'heatmap'>, UseChartHighlightSignature, UseChartProExportSignature, UseChartBrushSignature, UseChartProZoomSignature, UseChartItemClickSignature<'heatmap'>, UseChartKeyboardNavigationSignature];
|
|
5
5
|
export declare const HEATMAP_PLUGINS: ConvertSignaturesIntoPlugins<HeatmapPluginSignatures>;
|
|
@@ -7,4 +7,4 @@ exports.HEATMAP_PLUGINS = void 0;
|
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
8
|
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
9
|
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
10
|
-
const HEATMAP_PLUGINS = exports.HEATMAP_PLUGINS = [_internals.useChartZAxis, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartHighlight, _useChartProExport.useChartProExport, _internals.useChartBrush, _useChartProZoom.useChartProZoom, _internals.useChartKeyboardNavigation];
|
|
10
|
+
const HEATMAP_PLUGINS = exports.HEATMAP_PLUGINS = [_internals.useChartZAxis, _internals.useChartTooltip, _internals.useChartInteraction, _internals.useChartCartesianAxis, _internals.useChartHighlight, _useChartProExport.useChartProExport, _internals.useChartBrush, _useChartProZoom.useChartProZoom, _internals.useChartItemClick, _internals.useChartKeyboardNavigation];
|
|
@@ -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
|
+
}
|
package/Heatmap/HeatmapItem.d.ts
CHANGED
|
@@ -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 {}
|
package/Heatmap/HeatmapItem.js
CHANGED
|
@@ -17,7 +17,7 @@ var _heatmapClasses = require("./heatmapClasses");
|
|
|
17
17
|
var _HeatmapCell = require("./internals/HeatmapCell");
|
|
18
18
|
var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "slotProps", "slots"];
|
|
20
|
+
const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
|
|
21
21
|
const useUtilityClasses = ownerState => {
|
|
22
22
|
const {
|
|
23
23
|
classes,
|
|
@@ -42,6 +42,9 @@ function HeatmapItem(props) {
|
|
|
42
42
|
value,
|
|
43
43
|
isHighlighted = false,
|
|
44
44
|
isFaded = false,
|
|
45
|
+
borderRadius,
|
|
46
|
+
xIndex,
|
|
47
|
+
yIndex,
|
|
45
48
|
slotProps = {},
|
|
46
49
|
slots = {}
|
|
47
50
|
} = props,
|
|
@@ -53,7 +56,9 @@ function HeatmapItem(props) {
|
|
|
53
56
|
const interactionProps = (0, _internals.useInteractionItemProps)({
|
|
54
57
|
type: 'heatmap',
|
|
55
58
|
seriesId,
|
|
56
|
-
dataIndex
|
|
59
|
+
dataIndex,
|
|
60
|
+
xIndex,
|
|
61
|
+
yIndex
|
|
57
62
|
}, skipInteractionItemProps);
|
|
58
63
|
const ownerState = {
|
|
59
64
|
seriesId,
|
|
@@ -67,7 +72,10 @@ function HeatmapItem(props) {
|
|
|
67
72
|
const Cell = slots?.cell ?? _HeatmapCell.HeatmapCell;
|
|
68
73
|
const cellProps = (0, _useSlotProps.default)({
|
|
69
74
|
elementType: Cell,
|
|
70
|
-
additionalProps: interactionProps,
|
|
75
|
+
additionalProps: (0, _extends2.default)({}, interactionProps, {
|
|
76
|
+
rx: borderRadius,
|
|
77
|
+
ry: borderRadius
|
|
78
|
+
}),
|
|
71
79
|
externalForwardedProps: (0, _extends2.default)({}, other),
|
|
72
80
|
externalSlotProps: slotProps.cell,
|
|
73
81
|
ownerState,
|
package/Heatmap/HeatmapPlot.d.ts
CHANGED
|
@@ -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
|
}
|
package/Heatmap/HeatmapPlot.js
CHANGED
|
@@ -7,69 +7,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.HeatmapPlot = HeatmapPlot;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
12
|
var React = _interopRequireWildcard(require("react"));
|
|
11
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var
|
|
13
|
-
var _internals = require("@mui/x-charts/internals");
|
|
14
|
-
var _useHeatmapSeries = require("../hooks/useHeatmapSeries");
|
|
15
|
-
var _HeatmapItem = require("./HeatmapItem");
|
|
16
|
-
var _useChartHeatmapPosition = require("../plugins/selectors/useChartHeatmapPosition.selectors");
|
|
17
|
-
var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
|
|
14
|
+
var _HeatmapSVGPlot = require("./HeatmapSVGPlot");
|
|
18
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const yDomain = yScale.domain();
|
|
29
|
-
if (!series || series.seriesOrder.length === 0) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
33
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
34
|
-
children: [(0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
35
|
-
children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
|
|
36
|
-
const x = xScale(xDomain[xIndex]);
|
|
37
|
-
const y = yScale(yDomain[yIndex]);
|
|
38
|
-
const color = colorScale?.(value);
|
|
39
|
-
if (x === undefined || y === undefined || !color) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const item = {
|
|
43
|
-
seriesId: seriesToDisplay.id,
|
|
44
|
-
dataIndex
|
|
45
|
-
};
|
|
46
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapItem.HeatmapItem, {
|
|
47
|
-
width: xScale.bandwidth(),
|
|
48
|
-
height: yScale.bandwidth(),
|
|
49
|
-
x: x,
|
|
50
|
-
y: y,
|
|
51
|
-
color: color,
|
|
52
|
-
dataIndex: dataIndex,
|
|
53
|
-
seriesId: series.seriesOrder[0],
|
|
54
|
-
value: value,
|
|
55
|
-
slots: props.slots,
|
|
56
|
-
slotProps: props.slotProps,
|
|
57
|
-
isHighlighted: isHighlighted(item),
|
|
58
|
-
isFaded: isFaded(item)
|
|
59
|
-
}, `${xIndex}_${yIndex}`);
|
|
60
|
-
})
|
|
61
|
-
})]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function RegisterHeatmapPointerInteractions() {
|
|
65
|
-
(0, _internals.useRegisterPointerInteractions)(_useChartHeatmapPosition.selectorHeatmapItemAtPosition);
|
|
66
|
-
return null;
|
|
16
|
+
const _excluded = ["borderRadius"];
|
|
17
|
+
function HeatmapPlot(_ref) {
|
|
18
|
+
let {
|
|
19
|
+
borderRadius
|
|
20
|
+
} = _ref,
|
|
21
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapSVGPlot.HeatmapSVGPlot, (0, _extends2.default)({
|
|
23
|
+
borderRadius: borderRadius
|
|
24
|
+
}, props));
|
|
67
25
|
}
|
|
68
26
|
process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
|
|
69
27
|
// ----------------------------- Warning --------------------------------
|
|
70
28
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
71
29
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
72
30
|
// ----------------------------------------------------------------------
|
|
31
|
+
/**
|
|
32
|
+
* The border radius of the heatmap cells in pixels.
|
|
33
|
+
*/
|
|
34
|
+
borderRadius: _propTypes.default.number,
|
|
73
35
|
/**
|
|
74
36
|
* The props used for each component slot.
|
|
75
37
|
* @default {}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.HeatmapSVGPlot = HeatmapSVGPlot;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
11
|
+
var _internals = require("@mui/x-charts/internals");
|
|
12
|
+
var _hooks2 = require("../hooks");
|
|
13
|
+
var _HeatmapItem = require("./HeatmapItem");
|
|
14
|
+
var _useChartHeatmapPosition = require("../plugins/selectors/useChartHeatmapPosition.selectors");
|
|
15
|
+
var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const MemoHeatmapItem = /*#__PURE__*/React.memo(_HeatmapItem.HeatmapItem);
|
|
18
|
+
if (process.env.NODE_ENV !== "production") MemoHeatmapItem.displayName = "MemoHeatmapItem";
|
|
19
|
+
function HeatmapSVGPlot(props) {
|
|
20
|
+
const store = (0, _internals.useStore)();
|
|
21
|
+
const xScale = (0, _hooks.useXScale)();
|
|
22
|
+
const yScale = (0, _hooks.useYScale)();
|
|
23
|
+
const colorScale = (0, _hooks.useZColorScale)();
|
|
24
|
+
const series = (0, _hooks2.useHeatmapSeriesContext)();
|
|
25
|
+
const isHighlighted = store.use(_internals.selectorChartsIsHighlightedCallback);
|
|
26
|
+
const isFaded = store.use(_internals.selectorChartsIsFadedCallback);
|
|
27
|
+
const xDomain = xScale.domain();
|
|
28
|
+
const yDomain = yScale.domain();
|
|
29
|
+
if (!series || series.seriesOrder.length === 0) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
34
|
+
children: [(0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
35
|
+
children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
|
|
36
|
+
const x = xScale(xDomain[xIndex]);
|
|
37
|
+
const y = yScale(yDomain[yIndex]);
|
|
38
|
+
const color = colorScale?.(value);
|
|
39
|
+
if (x === undefined || y === undefined || !color) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const item = {
|
|
43
|
+
seriesId: seriesToDisplay.id,
|
|
44
|
+
dataIndex
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MemoHeatmapItem, {
|
|
47
|
+
width: xScale.bandwidth(),
|
|
48
|
+
height: yScale.bandwidth(),
|
|
49
|
+
x: x,
|
|
50
|
+
y: y,
|
|
51
|
+
xIndex: xIndex,
|
|
52
|
+
yIndex: yIndex,
|
|
53
|
+
color: color,
|
|
54
|
+
dataIndex: dataIndex,
|
|
55
|
+
seriesId: series.seriesOrder[0],
|
|
56
|
+
value: value,
|
|
57
|
+
slots: props.slots,
|
|
58
|
+
slotProps: props.slotProps,
|
|
59
|
+
isHighlighted: isHighlighted(item),
|
|
60
|
+
isFaded: isFaded(item),
|
|
61
|
+
borderRadius: props.borderRadius
|
|
62
|
+
}, `${xIndex}_${yIndex}`);
|
|
63
|
+
})
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function RegisterHeatmapPointerInteractions() {
|
|
68
|
+
(0, _internals.useRegisterPointerInteractions)(_useChartHeatmapPosition.selectorHeatmapItemAtPosition);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { type ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
|
|
1
|
+
import { type ChartsTooltipContainerProps, type ChartsTooltipClasses, type ChartsTooltipSlots, type ChartsTooltipSlotProps } from '@mui/x-charts/ChartsTooltip';
|
|
2
|
+
export interface HeatmapTooltipSlots extends ChartsTooltipSlots {}
|
|
3
|
+
export interface HeatmapTooltipSlotProps extends ChartsTooltipSlotProps {}
|
|
4
|
+
export interface HeatmapTooltipClasses extends ChartsTooltipClasses {}
|
|
5
|
+
export interface HeatmapTooltipContentClasses extends ChartsTooltipClasses {}
|
|
2
6
|
export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
|
|
3
7
|
/**
|
|
4
8
|
* Select the kind of tooltip to display
|
|
@@ -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/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";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ChartState, UseChartCartesianAxisSignature } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SeriesItemIdentifier } from '@mui/x-charts/models';
|
|
3
|
+
export default function getItemAtPosition(state: ChartState<[UseChartCartesianAxisSignature]>, point: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}): SeriesItemIdentifier<'heatmap'> | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getItemAtPosition;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
function getItemAtPosition(state, point) {
|
|
9
|
+
const {
|
|
10
|
+
axis: xAxis,
|
|
11
|
+
axisIds: xAxisIds
|
|
12
|
+
} = (0, _internals.selectorChartXAxis)(state);
|
|
13
|
+
const {
|
|
14
|
+
axis: yAxis,
|
|
15
|
+
axisIds: yAxisIds
|
|
16
|
+
} = (0, _internals.selectorChartYAxis)(state);
|
|
17
|
+
const series = (0, _internals.selectorAllSeriesOfType)(state, 'heatmap');
|
|
18
|
+
const xAxisWithScale = xAxis[xAxisIds[0]];
|
|
19
|
+
const yAxisWithScale = yAxis[yAxisIds[0]];
|
|
20
|
+
const seriesId = series?.seriesOrder[0];
|
|
21
|
+
if (seriesId === undefined) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const xIndex = (0, _internals.getCartesianAxisIndex)(xAxisWithScale, point.x);
|
|
25
|
+
const yIndex = (0, _internals.getCartesianAxisIndex)(yAxisWithScale, point.y);
|
|
26
|
+
if (xIndex === -1 || yIndex === -1) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const dataIndex = series ? series.series[series.seriesOrder[0]].data.findIndex(d => d[0] === xIndex && d[1] === yIndex) : -1;
|
|
30
|
+
if (dataIndex === -1) {
|
|
31
|
+
return {
|
|
32
|
+
type: 'heatmap',
|
|
33
|
+
seriesId,
|
|
34
|
+
xIndex,
|
|
35
|
+
yIndex
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
type: 'heatmap',
|
|
40
|
+
seriesId,
|
|
41
|
+
dataIndex,
|
|
42
|
+
xIndex,
|
|
43
|
+
yIndex
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -12,6 +12,7 @@ var _getColor = _interopRequireDefault(require("./getColor"));
|
|
|
12
12
|
var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
13
13
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
14
14
|
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
15
|
+
var _getItemAtPosition = _interopRequireDefault(require("./getItemAtPosition"));
|
|
15
16
|
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
16
17
|
_internals.cartesianSeriesTypes.addType('heatmap');
|
|
17
18
|
const heatmapSeriesConfig = exports.heatmapSeriesConfig = {
|
|
@@ -24,5 +25,7 @@ const heatmapSeriesConfig = exports.heatmapSeriesConfig = {
|
|
|
24
25
|
yExtremumGetter: _extremums.getBaseExtremum,
|
|
25
26
|
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
|
|
26
27
|
identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
|
|
28
|
+
identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex,
|
|
29
|
+
getItemAtPosition: _getItemAtPosition.default,
|
|
27
30
|
keyboardFocusHandler: _keyboardFocusHandler.default
|
|
28
31
|
};
|
|
@@ -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
|
+
};
|