@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/Heatmap/Heatmap.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlot
|
|
|
28
28
|
tooltip?: Partial<HeatmapTooltipProps>;
|
|
29
29
|
}
|
|
30
30
|
export type HeatmapSeries = MakeOptional<HeatmapSeriesType, 'type'>;
|
|
31
|
-
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation' | 'slots' | 'slotProps' | 'experimentalFeatures' | 'highlightedAxis' | 'onHighlightedAxisChange' | 'onAxisClick'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
31
|
+
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'axesGap' | 'skipAnimation' | 'slots' | 'slotProps' | 'experimentalFeatures' | 'highlightedAxis' | 'onHighlightedAxisChange' | 'seriesConfig' | 'onAxisClick'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
32
32
|
/**
|
|
33
33
|
* The function called for onClick events.
|
|
34
34
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
@@ -62,7 +62,6 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
62
62
|
tooltip?: ChartsTooltipProps;
|
|
63
63
|
/**
|
|
64
64
|
* If `true`, the legend is not rendered.
|
|
65
|
-
* @default true
|
|
66
65
|
*/
|
|
67
66
|
hideLegend?: boolean;
|
|
68
67
|
/**
|
|
@@ -70,6 +69,10 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
70
69
|
* @default false
|
|
71
70
|
*/
|
|
72
71
|
showToolbar?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The border radius of the heatmap cells in pixels.
|
|
74
|
+
*/
|
|
75
|
+
borderRadius?: number;
|
|
73
76
|
/**
|
|
74
77
|
* Overridable component slots.
|
|
75
78
|
* @default {}
|
|
@@ -81,5 +84,5 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
|
|
|
81
84
|
*/
|
|
82
85
|
slotProps?: HeatmapSlotProps;
|
|
83
86
|
}
|
|
84
|
-
declare const Heatmap: React.ForwardRefExoticComponent<HeatmapProps & React.RefAttributes<
|
|
87
|
+
declare const Heatmap: React.ForwardRefExoticComponent<HeatmapProps & React.RefAttributes<HTMLDivElement>>;
|
|
85
88
|
export { Heatmap };
|
package/Heatmap/Heatmap.js
CHANGED
|
@@ -11,160 +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
|
-
onItemClick,
|
|
72
|
-
enableKeyboardNavigation,
|
|
73
|
-
hideLegend = true,
|
|
38
|
+
hideLegend,
|
|
74
39
|
showToolbar = false
|
|
75
40
|
} = props;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
id: _constants.DEFAULT_Y_AXIS_KEY
|
|
88
|
-
}]).map(axis => (0, _extends2.default)({
|
|
89
|
-
scaleType: 'band',
|
|
90
|
-
categoryGapRatio: 0
|
|
91
|
-
}, axis, {
|
|
92
|
-
data: axis.data ?? getDefaultDataForYAxis(series)
|
|
93
|
-
})), [series, yAxis]);
|
|
94
|
-
const zAxisWithDefault = React.useMemo(() => zAxis ?? [{
|
|
95
|
-
colorMap: {
|
|
96
|
-
type: 'continuous',
|
|
97
|
-
min: 0,
|
|
98
|
-
max: 100,
|
|
99
|
-
color: defaultColorMap
|
|
100
|
-
}
|
|
101
|
-
}], [zAxis]);
|
|
102
|
-
const chartsWrapperProps = {
|
|
103
|
-
sx,
|
|
104
|
-
legendPosition: props.slotProps?.legend?.position,
|
|
105
|
-
legendDirection: props.slotProps?.legend?.direction,
|
|
106
|
-
hideLegend
|
|
107
|
-
};
|
|
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);
|
|
108
52
|
const Tooltip = slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
|
|
109
53
|
const Toolbar = slots?.toolbar ?? _ChartsToolbarPro.ChartsToolbarPro;
|
|
110
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, {
|
|
111
|
-
apiRef: apiRef,
|
|
112
|
-
seriesConfig: seriesConfig,
|
|
113
|
-
series: series.map(s => (0, _extends2.default)({
|
|
114
|
-
type: 'heatmap'
|
|
115
|
-
}, s)),
|
|
116
|
-
width: width,
|
|
117
|
-
height: height,
|
|
118
|
-
margin: margin,
|
|
119
|
-
xAxis: xAxisWithDefault,
|
|
120
|
-
yAxis: yAxisWithDefault,
|
|
121
|
-
zAxis: zAxisWithDefault,
|
|
122
|
-
colors: colors,
|
|
123
|
-
dataset: dataset,
|
|
124
|
-
disableAxisListener: true,
|
|
125
|
-
highlightedItem: highlightedItem,
|
|
126
|
-
onHighlightChange: onHighlightChange,
|
|
127
|
-
enableKeyboardNavigation: enableKeyboardNavigation,
|
|
128
|
-
onAxisClick: onAxisClick,
|
|
129
|
-
onItemClick: onItemClick,
|
|
130
|
-
plugins: _Heatmap2.HEATMAP_PLUGINS,
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
|
|
131
55
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
legend: slots?.legend ?? _ChartsLegend.ContinuousColorLegend
|
|
135
|
-
}),
|
|
136
|
-
slotProps: {
|
|
137
|
-
legend: (0, _extends2.default)({
|
|
138
|
-
labelPosition: 'extremes'
|
|
139
|
-
}, slotProps?.legend)
|
|
140
|
-
},
|
|
141
|
-
sx: slotProps?.legend?.direction === 'vertical' ? {
|
|
142
|
-
height: 150
|
|
143
|
-
} : {
|
|
144
|
-
width: '50%'
|
|
145
|
-
}
|
|
146
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
|
|
147
|
-
ref: ref,
|
|
56
|
+
ref: ref,
|
|
57
|
+
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, {
|
|
148
58
|
sx: sx,
|
|
149
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
slots: slots,
|
|
153
|
-
slotProps: slotProps
|
|
154
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedHeatmapCell.FocusedHeatmapCell, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
155
|
-
loading: loading,
|
|
156
|
-
slots: slots,
|
|
157
|
-
slotProps: slotProps
|
|
158
|
-
})]
|
|
159
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
160
|
-
slots: slots,
|
|
161
|
-
slotProps: slotProps
|
|
162
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
163
|
-
id: clipPathId
|
|
164
|
-
}), /*#__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]
|
|
165
62
|
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip))]
|
|
166
63
|
}))
|
|
167
|
-
});
|
|
64
|
+
}));
|
|
168
65
|
});
|
|
169
66
|
if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
|
|
170
67
|
process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
@@ -180,6 +77,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
180
77
|
setZoomData: _propTypes.default.func.isRequired
|
|
181
78
|
})
|
|
182
79
|
}),
|
|
80
|
+
/**
|
|
81
|
+
* The border radius of the heatmap cells in pixels.
|
|
82
|
+
*/
|
|
83
|
+
borderRadius: _propTypes.default.number,
|
|
183
84
|
/**
|
|
184
85
|
* Configuration for the brush interaction.
|
|
185
86
|
*/
|
|
@@ -212,7 +113,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
212
113
|
height: _propTypes.default.number,
|
|
213
114
|
/**
|
|
214
115
|
* If `true`, the legend is not rendered.
|
|
215
|
-
* @default true
|
|
216
116
|
*/
|
|
217
117
|
hideLegend: _propTypes.default.bool,
|
|
218
118
|
/**
|
|
@@ -221,7 +121,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
221
121
|
*/
|
|
222
122
|
highlightedItem: _propTypes.default.shape({
|
|
223
123
|
dataIndex: _propTypes.default.number,
|
|
224
|
-
seriesId: _propTypes.default.
|
|
124
|
+
seriesId: _propTypes.default.string.isRequired
|
|
225
125
|
}),
|
|
226
126
|
/**
|
|
227
127
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -277,9 +177,17 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
277
177
|
* The callback fired when an item is clicked.
|
|
278
178
|
*
|
|
279
179
|
* @param {React.MouseEvent<SVGSVGElement, MouseEvent>} event The click event.
|
|
280
|
-
* @param {
|
|
180
|
+
* @param {SeriesItemIdentifierWithType<SeriesType>} item The clicked item.
|
|
281
181
|
*/
|
|
282
182
|
onItemClick: _propTypes.default.func,
|
|
183
|
+
/**
|
|
184
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
185
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
186
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
187
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
188
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
189
|
+
*/
|
|
190
|
+
onTooltipAxisChange: _propTypes.default.func,
|
|
283
191
|
/**
|
|
284
192
|
* The callback fired when the tooltip item changes.
|
|
285
193
|
*
|
|
@@ -297,11 +205,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
297
205
|
* An array of [[HeatmapSeries]] objects.
|
|
298
206
|
*/
|
|
299
207
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
300
|
-
/**
|
|
301
|
-
* The configuration helpers used to compute attributes according to the series type.
|
|
302
|
-
* @ignore Unstable props for internal usage.
|
|
303
|
-
*/
|
|
304
|
-
seriesConfig: _propTypes.default.object,
|
|
305
208
|
/**
|
|
306
209
|
* If true, shows the default chart toolbar.
|
|
307
210
|
* @default false
|
|
@@ -325,16 +228,24 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
325
228
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
326
229
|
*/
|
|
327
230
|
tooltip: _propTypes.default.object,
|
|
231
|
+
/**
|
|
232
|
+
* The controlled axis tooltip.
|
|
233
|
+
* Identified by the axis id, and data index.
|
|
234
|
+
*/
|
|
235
|
+
tooltipAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
236
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
237
|
+
dataIndex: _propTypes.default.number.isRequired
|
|
238
|
+
})),
|
|
328
239
|
/**
|
|
329
240
|
* The tooltip item.
|
|
330
241
|
* Used when the tooltip is controlled.
|
|
331
242
|
*/
|
|
332
243
|
tooltipItem: _propTypes.default.shape({
|
|
333
244
|
dataIndex: _propTypes.default.number,
|
|
334
|
-
seriesId: _propTypes.default.
|
|
335
|
-
type: _propTypes.default.oneOf(['heatmap'])
|
|
336
|
-
xIndex: _propTypes.default.number,
|
|
337
|
-
yIndex: _propTypes.default.number
|
|
245
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
246
|
+
type: _propTypes.default.oneOf(['heatmap']),
|
|
247
|
+
xIndex: _propTypes.default.number.isRequired,
|
|
248
|
+
yIndex: _propTypes.default.number.isRequired
|
|
338
249
|
}),
|
|
339
250
|
/**
|
|
340
251
|
* 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
|
+
}
|
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,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/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;
|
|
@@ -30,12 +30,16 @@ function getItemAtPosition(state, point) {
|
|
|
30
30
|
if (dataIndex === -1) {
|
|
31
31
|
return {
|
|
32
32
|
type: 'heatmap',
|
|
33
|
-
seriesId
|
|
33
|
+
seriesId,
|
|
34
|
+
xIndex,
|
|
35
|
+
yIndex
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
38
|
return {
|
|
37
39
|
type: 'heatmap',
|
|
38
40
|
seriesId,
|
|
39
|
-
dataIndex
|
|
41
|
+
dataIndex,
|
|
42
|
+
xIndex,
|
|
43
|
+
yIndex
|
|
40
44
|
};
|
|
41
45
|
}
|
|
@@ -25,6 +25,7 @@ const heatmapSeriesConfig = exports.heatmapSeriesConfig = {
|
|
|
25
25
|
yExtremumGetter: _extremums.getBaseExtremum,
|
|
26
26
|
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
|
|
27
27
|
identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
|
|
28
|
+
identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex,
|
|
28
29
|
getItemAtPosition: _getItemAtPosition.default,
|
|
29
30
|
keyboardFocusHandler: _keyboardFocusHandler.default
|
|
30
31
|
};
|