@mui/x-charts-pro 8.0.0-alpha.11 → 8.0.0-alpha.13
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 +3 -4
- package/BarChartPro/BarChartPro.js +245 -244
- package/BarChartPro/BarChartPro.plugins.d.ts +3 -9
- package/BarChartPro/BarChartPro.plugins.js +9 -3
- package/BarChartPro/index.d.ts +1 -1
- package/BarChartPro/index.js +16 -1
- package/CHANGELOG.md +460 -1
- package/ChartContainerPro/ChartContainerPro.d.ts +5 -5
- package/ChartContainerPro/ChartContainerPro.js +179 -173
- package/ChartContainerPro/index.d.ts +2 -1
- package/ChartContainerPro/index.js +17 -1
- package/ChartContainerPro/useChartContainerProProps.d.ts +3 -3
- package/ChartContainerPro/useChartContainerProProps.js +20 -11
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +4 -4
- package/ChartDataProviderPro/ChartDataProviderPro.js +37 -30
- package/ChartDataProviderPro/index.d.ts +2 -1
- package/ChartDataProviderPro/index.js +17 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +4 -4
- package/ChartDataProviderPro/useChartDataProviderProProps.js +10 -4
- package/Heatmap/Heatmap.d.ts +45 -44
- package/Heatmap/Heatmap.js +232 -241
- package/Heatmap/Heatmap.plugins.d.ts +2 -7
- package/Heatmap/Heatmap.plugins.js +8 -2
- package/Heatmap/HeatmapItem.d.ts +33 -33
- package/Heatmap/HeatmapItem.js +39 -32
- package/Heatmap/HeatmapPlot.d.ts +4 -5
- package/Heatmap/HeatmapPlot.js +22 -16
- package/Heatmap/HeatmapTooltip.d.ts +3 -4
- package/Heatmap/HeatmapTooltip.js +97 -89
- package/Heatmap/heatmapClasses.d.ts +7 -7
- package/Heatmap/heatmapClasses.js +15 -7
- package/Heatmap/index.d.ts +4 -4
- package/Heatmap/index.js +47 -4
- package/Heatmap/{extremums.d.ts → seriesConfig/extremums.d.ts} +1 -1
- package/Heatmap/{getColor.d.ts → seriesConfig/getColor.d.ts} +1 -1
- package/Heatmap/seriesConfig/index.d.ts +2 -0
- package/{node/Heatmap/plugin.js → Heatmap/seriesConfig/index.js} +4 -4
- package/Heatmap/seriesConfig/seriesProcessor.d.ts +3 -0
- package/{node/Heatmap/formatter.js → Heatmap/seriesConfig/seriesProcessor.js} +2 -2
- package/Heatmap/{tooltip.d.ts → seriesConfig/tooltip.d.ts} +1 -1
- package/LineChartPro/LineChartPro.d.ts +3 -4
- package/LineChartPro/LineChartPro.js +257 -256
- package/LineChartPro/LineChartPro.plugins.d.ts +3 -9
- package/LineChartPro/LineChartPro.plugins.js +9 -3
- package/LineChartPro/index.d.ts +1 -1
- package/LineChartPro/index.js +16 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +4 -4
- package/ScatterChartPro/ScatterChartPro.js +234 -235
- package/ScatterChartPro/ScatterChartPro.plugins.d.ts +4 -10
- package/ScatterChartPro/ScatterChartPro.plugins.js +9 -3
- package/ScatterChartPro/index.d.ts +1 -1
- package/ScatterChartPro/index.js +16 -1
- package/esm/BarChartPro/BarChartPro.d.ts +17 -0
- package/esm/BarChartPro/BarChartPro.js +450 -0
- package/esm/BarChartPro/BarChartPro.plugins.d.ts +4 -0
- package/esm/BarChartPro/BarChartPro.plugins.js +3 -0
- package/esm/BarChartPro/index.d.ts +1 -0
- package/esm/BarChartPro/index.js +1 -0
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +35 -0
- package/esm/ChartContainerPro/ChartContainerPro.js +290 -0
- package/esm/ChartContainerPro/index.d.ts +2 -0
- package/esm/ChartContainerPro/index.js +2 -0
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +9 -0
- package/esm/ChartContainerPro/useChartContainerProProps.js +35 -0
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/{node → esm}/ChartDataProviderPro/ChartDataProviderPro.js +31 -36
- package/esm/ChartDataProviderPro/index.d.ts +2 -0
- package/esm/ChartDataProviderPro/index.js +2 -0
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/esm/Heatmap/Heatmap.d.ts +57 -0
- package/esm/Heatmap/Heatmap.js +387 -0
- package/esm/Heatmap/Heatmap.plugins.d.ts +3 -0
- package/esm/Heatmap/Heatmap.plugins.js +2 -0
- package/esm/Heatmap/HeatmapItem.d.ts +49 -0
- package/esm/Heatmap/HeatmapItem.js +106 -0
- package/esm/Heatmap/HeatmapPlot.d.ts +8 -0
- package/{node → esm}/Heatmap/HeatmapPlot.js +16 -22
- package/esm/Heatmap/HeatmapTooltip.d.ts +8 -0
- package/esm/Heatmap/HeatmapTooltip.js +276 -0
- package/esm/Heatmap/heatmapClasses.d.ts +11 -0
- package/esm/Heatmap/heatmapClasses.js +14 -0
- package/esm/Heatmap/index.d.ts +4 -0
- package/esm/Heatmap/index.js +4 -0
- package/esm/Heatmap/seriesConfig/extremums.d.ts +2 -0
- package/esm/Heatmap/seriesConfig/getColor.d.ts +3 -0
- package/esm/Heatmap/seriesConfig/index.d.ts +2 -0
- package/{Heatmap/plugin.js → esm/Heatmap/seriesConfig/index.js} +3 -3
- package/esm/Heatmap/seriesConfig/seriesProcessor.d.ts +3 -0
- package/{Heatmap/formatter.js → esm/Heatmap/seriesConfig/seriesProcessor.js} +2 -2
- package/esm/Heatmap/seriesConfig/tooltip.d.ts +3 -0
- package/esm/LineChartPro/LineChartPro.d.ts +16 -0
- package/esm/LineChartPro/LineChartPro.js +501 -0
- package/esm/LineChartPro/LineChartPro.plugins.d.ts +4 -0
- package/esm/LineChartPro/LineChartPro.plugins.js +3 -0
- package/esm/LineChartPro/index.d.ts +1 -0
- package/esm/LineChartPro/index.js +1 -0
- package/esm/ScatterChartPro/ScatterChartPro.d.ts +17 -0
- package/esm/ScatterChartPro/ScatterChartPro.js +395 -0
- package/esm/ScatterChartPro/ScatterChartPro.plugins.d.ts +4 -0
- package/esm/ScatterChartPro/ScatterChartPro.plugins.js +3 -0
- package/esm/ScatterChartPro/index.d.ts +1 -0
- package/esm/ScatterChartPro/index.js +1 -0
- package/esm/hooks/index.d.ts +2 -0
- package/esm/hooks/index.js +2 -0
- package/esm/hooks/useHeatmapSeries.d.ts +33 -0
- package/esm/hooks/useHeatmapSeries.js +42 -0
- package/esm/hooks/zoom/index.d.ts +1 -0
- package/esm/hooks/zoom/index.js +1 -0
- package/esm/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
- package/esm/hooks/zoom/useIsZoomInteracting.js +14 -0
- package/esm/index.d.ts +32 -0
- package/esm/index.js +43 -0
- package/esm/internals/plugins/allPlugins.d.ts +5 -0
- package/esm/internals/plugins/allPlugins.js +5 -0
- package/esm/internals/plugins/useChartProZoom/index.d.ts +3 -0
- package/esm/internals/plugins/useChartProZoom/index.js +3 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
- package/{node → esm}/internals/plugins/useChartProZoom/useChartProZoom.js +94 -54
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +203 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +4 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +53 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
- package/{node → esm}/internals/plugins/useChartProZoom/useChartProZoom.utils.js +8 -22
- package/esm/internals/utils/releaseInfo.d.ts +1 -0
- package/esm/internals/utils/releaseInfo.js +13 -0
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/seriesType/heatmap.d.ts +28 -0
- package/esm/models/seriesType/index.d.ts +1 -0
- package/esm/models/seriesType/index.js +1 -0
- package/esm/package.json +1 -0
- package/esm/themeAugmentation/components.d.ts +23 -0
- package/esm/themeAugmentation/index.d.ts +4 -0
- package/esm/themeAugmentation/index.js +0 -0
- package/esm/themeAugmentation/overrides.d.ts +11 -0
- package/esm/themeAugmentation/props.d.ts +20 -0
- package/esm/typeOverloads/index.d.ts +1 -0
- package/esm/typeOverloads/index.js +1 -0
- package/esm/typeOverloads/modules.d.ts +22 -0
- package/esm/typeOverloads/modules.js +1 -0
- package/hooks/index.d.ts +2 -2
- package/hooks/index.js +27 -2
- package/hooks/useHeatmapSeries.d.ts +33 -0
- package/hooks/useHeatmapSeries.js +48 -0
- package/hooks/zoom/index.d.ts +1 -1
- package/hooks/zoom/index.js +16 -1
- package/hooks/zoom/useIsZoomInteracting.d.ts +1 -1
- package/hooks/zoom/useIsZoomInteracting.js +10 -5
- package/index.d.ts +8 -7
- package/index.js +347 -36
- package/internals/plugins/allPlugins.d.ts +3 -9
- package/internals/plugins/allPlugins.js +9 -3
- package/internals/plugins/useChartProZoom/index.d.ts +3 -3
- package/internals/plugins/useChartProZoom/index.js +38 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +2 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.js +101 -47
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +154 -328
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +11 -10
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +42 -39
- package/internals/plugins/useChartProZoom/useChartProZoom.types.js +5 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +13 -13
- package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +22 -8
- package/internals/utils/releaseInfo.d.ts +1 -1
- package/internals/utils/releaseInfo.js +13 -5
- package/models/index.d.ts +1 -1
- package/models/index.js +16 -2
- package/models/seriesType/heatmap.d.ts +18 -19
- package/models/seriesType/heatmap.js +5 -1
- package/models/seriesType/index.d.ts +1 -1
- package/models/seriesType/index.js +16 -1
- package/modern/BarChartPro/BarChartPro.d.ts +17 -0
- package/modern/BarChartPro/BarChartPro.js +25 -30
- package/modern/BarChartPro/BarChartPro.plugins.d.ts +4 -0
- package/modern/BarChartPro/index.d.ts +1 -0
- package/modern/ChartContainerPro/ChartContainerPro.d.ts +35 -0
- package/modern/ChartContainerPro/ChartContainerPro.js +1 -1
- package/modern/ChartContainerPro/index.d.ts +2 -0
- package/modern/ChartContainerPro/index.js +1 -0
- package/modern/ChartContainerPro/useChartContainerProProps.d.ts +9 -0
- package/modern/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/modern/ChartDataProviderPro/index.d.ts +2 -0
- package/modern/ChartDataProviderPro/index.js +1 -0
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/modern/Heatmap/Heatmap.d.ts +57 -0
- package/modern/Heatmap/Heatmap.js +39 -54
- package/modern/Heatmap/Heatmap.plugins.d.ts +3 -0
- package/modern/Heatmap/HeatmapItem.d.ts +49 -0
- package/modern/Heatmap/HeatmapPlot.d.ts +8 -0
- package/modern/Heatmap/HeatmapPlot.js +2 -2
- package/modern/Heatmap/HeatmapTooltip.d.ts +8 -0
- package/modern/Heatmap/HeatmapTooltip.js +6 -4
- package/modern/Heatmap/heatmapClasses.d.ts +11 -0
- package/modern/Heatmap/index.d.ts +4 -0
- package/modern/Heatmap/seriesConfig/extremums.d.ts +2 -0
- package/modern/Heatmap/seriesConfig/getColor.d.ts +3 -0
- package/modern/Heatmap/seriesConfig/index.d.ts +2 -0
- package/modern/Heatmap/{plugin.js → seriesConfig/index.js} +3 -3
- package/modern/Heatmap/seriesConfig/seriesProcessor.d.ts +3 -0
- package/modern/Heatmap/{formatter.js → seriesConfig/seriesProcessor.js} +2 -2
- package/modern/Heatmap/seriesConfig/tooltip.d.ts +3 -0
- package/modern/LineChartPro/LineChartPro.d.ts +16 -0
- package/modern/LineChartPro/LineChartPro.js +25 -30
- package/modern/LineChartPro/LineChartPro.plugins.d.ts +4 -0
- package/modern/LineChartPro/index.d.ts +1 -0
- package/modern/ScatterChartPro/ScatterChartPro.d.ts +17 -0
- package/modern/ScatterChartPro/ScatterChartPro.js +26 -33
- package/modern/ScatterChartPro/ScatterChartPro.plugins.d.ts +4 -0
- package/modern/ScatterChartPro/ScatterChartPro.plugins.js +2 -2
- package/modern/ScatterChartPro/index.d.ts +1 -0
- package/modern/hooks/index.d.ts +2 -0
- package/modern/hooks/index.js +1 -1
- package/modern/hooks/useHeatmapSeries.d.ts +33 -0
- package/modern/hooks/useHeatmapSeries.js +42 -0
- package/modern/hooks/zoom/index.d.ts +1 -0
- package/modern/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
- package/modern/index.d.ts +32 -0
- package/modern/index.js +2 -2
- package/modern/internals/plugins/allPlugins.d.ts +5 -0
- package/modern/internals/plugins/useChartProZoom/index.d.ts +3 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +65 -18
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +203 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +1 -7
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +53 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
- package/modern/internals/utils/releaseInfo.d.ts +1 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/index.d.ts +2 -0
- package/modern/models/seriesType/heatmap.d.ts +28 -0
- package/modern/models/seriesType/index.d.ts +1 -0
- package/modern/package.json +1 -0
- package/modern/themeAugmentation/components.d.ts +23 -0
- package/modern/themeAugmentation/index.d.ts +4 -0
- package/modern/themeAugmentation/overrides.d.ts +11 -0
- package/modern/themeAugmentation/props.d.ts +20 -0
- package/modern/typeOverloads/index.d.ts +1 -0
- package/modern/typeOverloads/modules.d.ts +22 -0
- package/package.json +41 -11
- package/themeAugmentation/components.d.ts +1 -3
- package/themeAugmentation/index.d.ts +1 -1
- package/themeAugmentation/index.js +1 -0
- package/themeAugmentation/overrides.d.ts +2 -4
- package/themeAugmentation/props.d.ts +5 -7
- package/tsconfig.build.tsbuildinfo +1 -0
- package/typeOverloads/index.d.ts +1 -1
- package/typeOverloads/index.js +6 -1
- package/typeOverloads/modules.d.ts +20 -23
- package/typeOverloads/modules.js +5 -1
- package/BarChartPro/package.json +0 -6
- package/ChartContainerPro/package.json +0 -6
- package/ChartDataProviderPro/package.json +0 -6
- package/Heatmap/formatter.d.ts +0 -3
- package/Heatmap/package.json +0 -6
- package/Heatmap/plugin.d.ts +0 -2
- package/LineChartPro/package.json +0 -6
- package/ScatterChartPro/package.json +0 -6
- package/hooks/package.json +0 -6
- package/hooks/useSeries.d.ts +0 -9
- package/hooks/useSeries.js +0 -16
- package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +0 -3
- package/internals/plugins/useChartProZoom/creatZoomLookup.js +0 -12
- package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +0 -2
- package/internals/plugins/useChartProZoom/defaultizeZoom.js +0 -25
- package/internals/plugins/useChartProZoom/zoom.types.d.ts +0 -53
- package/models/package.json +0 -6
- package/modern/hooks/useSeries.js +0 -16
- package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +0 -12
- package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +0 -25
- package/node/BarChartPro/BarChartPro.js +0 -461
- package/node/BarChartPro/BarChartPro.plugins.js +0 -9
- package/node/BarChartPro/index.js +0 -16
- package/node/ChartContainerPro/ChartContainerPro.js +0 -296
- package/node/ChartContainerPro/index.js +0 -16
- package/node/ChartContainerPro/useChartContainerProProps.js +0 -40
- package/node/ChartDataProviderPro/index.js +0 -16
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +0 -21
- package/node/Heatmap/Heatmap.js +0 -408
- package/node/Heatmap/Heatmap.plugins.js +0 -8
- package/node/Heatmap/HeatmapItem.js +0 -113
- package/node/Heatmap/HeatmapTooltip.js +0 -280
- package/node/Heatmap/heatmapClasses.js +0 -22
- package/node/Heatmap/index.js +0 -47
- package/node/LineChartPro/LineChartPro.js +0 -512
- package/node/LineChartPro/LineChartPro.plugins.js +0 -9
- package/node/LineChartPro/index.js +0 -16
- package/node/ScatterChartPro/ScatterChartPro.js +0 -408
- package/node/ScatterChartPro/ScatterChartPro.plugins.js +0 -9
- package/node/ScatterChartPro/index.js +0 -16
- package/node/hooks/index.js +0 -27
- package/node/hooks/useSeries.js +0 -21
- package/node/hooks/zoom/index.js +0 -16
- package/node/hooks/zoom/useIsZoomInteracting.js +0 -19
- package/node/index.js +0 -354
- package/node/internals/plugins/allPlugins.js +0 -11
- package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +0 -19
- package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +0 -33
- package/node/internals/plugins/useChartProZoom/index.js +0 -38
- package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +0 -18
- package/node/internals/plugins/useChartProZoom/useChartProZoom.types.js +0 -5
- package/node/internals/plugins/useChartProZoom/zoom.types.js +0 -5
- package/node/internals/utils/releaseInfo.js +0 -21
- package/node/models/index.js +0 -16
- package/node/models/seriesType/heatmap.js +0 -5
- package/node/models/seriesType/index.js +0 -16
- package/node/themeAugmentation/index.js +0 -1
- package/node/typeOverloads/index.js +0 -6
- package/node/typeOverloads/modules.js +0 -5
- package/themeAugmentation/package.json +0 -6
- package/typeOverloads/package.json +0 -6
- /package/{node/Heatmap → Heatmap/seriesConfig}/extremums.js +0 -0
- /package/{node/Heatmap → Heatmap/seriesConfig}/getColor.js +0 -0
- /package/{node/Heatmap → Heatmap/seriesConfig}/tooltip.js +0 -0
- /package/{Heatmap → esm/Heatmap/seriesConfig}/extremums.js +0 -0
- /package/{Heatmap → esm/Heatmap/seriesConfig}/getColor.js +0 -0
- /package/{Heatmap → esm/Heatmap/seriesConfig}/tooltip.js +0 -0
- /package/{internals/plugins/useChartProZoom/zoom.types.js → esm/internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
- /package/{modern/internals/plugins/useChartProZoom/zoom.types.js → esm/models/seriesType/heatmap.js} +0 -0
- /package/modern/Heatmap/{extremums.js → seriesConfig/extremums.js} +0 -0
- /package/modern/Heatmap/{getColor.js → seriesConfig/getColor.js} +0 -0
- /package/modern/Heatmap/{tooltip.js → seriesConfig/tooltip.js} +0 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
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
|
+
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
10
|
+
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
11
|
+
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
|
|
13
|
+
import { ChartContainerPro } from "../ChartContainerPro/index.js";
|
|
14
|
+
import { HeatmapPlot } from "./HeatmapPlot.js";
|
|
15
|
+
import { seriesConfig as heatmapSeriesConfig } from "./seriesConfig/index.js";
|
|
16
|
+
import { HeatmapTooltip } from "./HeatmapTooltip.js";
|
|
17
|
+
import { HEATMAP_PLUGINS } from "./Heatmap.plugins.js";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
20
|
+
const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
21
|
+
const seriesConfig = {
|
|
22
|
+
heatmap: heatmapSeriesConfig
|
|
23
|
+
};
|
|
24
|
+
function getDefaultDataForAxis(series, dimension) {
|
|
25
|
+
if (series?.[0]?.data === undefined || series[0].data.length === 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return Array.from({
|
|
29
|
+
length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
|
|
30
|
+
}, (_, index) => index);
|
|
31
|
+
}
|
|
32
|
+
const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
|
|
33
|
+
const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
|
|
34
|
+
const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
35
|
+
const props = useThemeProps({
|
|
36
|
+
props: inProps,
|
|
37
|
+
name: 'MuiHeatmap'
|
|
38
|
+
});
|
|
39
|
+
const {
|
|
40
|
+
xAxis,
|
|
41
|
+
yAxis,
|
|
42
|
+
zAxis,
|
|
43
|
+
series,
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
46
|
+
margin,
|
|
47
|
+
colors,
|
|
48
|
+
dataset,
|
|
49
|
+
sx,
|
|
50
|
+
onAxisClick,
|
|
51
|
+
children,
|
|
52
|
+
slots,
|
|
53
|
+
slotProps,
|
|
54
|
+
loading,
|
|
55
|
+
highlightedItem,
|
|
56
|
+
onHighlightChange
|
|
57
|
+
} = props;
|
|
58
|
+
const id = useId();
|
|
59
|
+
const clipPathId = `${id}-clip-path`;
|
|
60
|
+
const defaultizedXAxis = React.useMemo(() => (xAxis && xAxis.length > 0 ? xAxis : [{
|
|
61
|
+
id: DEFAULT_X_AXIS_KEY
|
|
62
|
+
}]).map(axis => _extends({
|
|
63
|
+
scaleType: 'band',
|
|
64
|
+
categoryGapRatio: 0
|
|
65
|
+
}, axis, {
|
|
66
|
+
data: axis.data ?? getDefaultDataForXAxis(series)
|
|
67
|
+
})), [series, xAxis]);
|
|
68
|
+
const defaultizedYAxis = React.useMemo(() => (yAxis && yAxis.length > 0 ? yAxis : [{
|
|
69
|
+
id: DEFAULT_Y_AXIS_KEY
|
|
70
|
+
}]).map(axis => _extends({
|
|
71
|
+
scaleType: 'band',
|
|
72
|
+
categoryGapRatio: 0
|
|
73
|
+
}, axis, {
|
|
74
|
+
data: axis.data ?? getDefaultDataForYAxis(series)
|
|
75
|
+
})), [series, yAxis]);
|
|
76
|
+
const defaultizedZAxis = React.useMemo(() => zAxis ?? [{
|
|
77
|
+
colorMap: {
|
|
78
|
+
type: 'continuous',
|
|
79
|
+
min: 0,
|
|
80
|
+
max: 100,
|
|
81
|
+
color: defaultColorMap
|
|
82
|
+
}
|
|
83
|
+
}], [zAxis]);
|
|
84
|
+
const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
|
|
85
|
+
return /*#__PURE__*/_jsxs(ChartContainerPro, {
|
|
86
|
+
ref: ref,
|
|
87
|
+
seriesConfig: seriesConfig,
|
|
88
|
+
series: series.map(s => _extends({
|
|
89
|
+
type: 'heatmap'
|
|
90
|
+
}, s)),
|
|
91
|
+
width: width,
|
|
92
|
+
height: height,
|
|
93
|
+
margin: margin,
|
|
94
|
+
xAxis: defaultizedXAxis,
|
|
95
|
+
yAxis: defaultizedYAxis,
|
|
96
|
+
zAxis: defaultizedZAxis,
|
|
97
|
+
colors: colors,
|
|
98
|
+
dataset: dataset,
|
|
99
|
+
sx: sx,
|
|
100
|
+
disableAxisListener: true,
|
|
101
|
+
highlightedItem: highlightedItem,
|
|
102
|
+
onHighlightChange: onHighlightChange,
|
|
103
|
+
onAxisClick: onAxisClick,
|
|
104
|
+
plugins: HEATMAP_PLUGINS,
|
|
105
|
+
children: [/*#__PURE__*/_jsxs("g", {
|
|
106
|
+
clipPath: `url(#${clipPathId})`,
|
|
107
|
+
children: [/*#__PURE__*/_jsx(HeatmapPlot, {
|
|
108
|
+
slots: slots,
|
|
109
|
+
slotProps: slotProps
|
|
110
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
111
|
+
loading: loading,
|
|
112
|
+
slots: slots,
|
|
113
|
+
slotProps: slotProps
|
|
114
|
+
})]
|
|
115
|
+
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
116
|
+
slots: slots,
|
|
117
|
+
slotProps: slotProps
|
|
118
|
+
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
119
|
+
id: clipPathId
|
|
120
|
+
}), children]
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
124
|
+
// ----------------------------- Warning --------------------------------
|
|
125
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
126
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
127
|
+
// ----------------------------------------------------------------------
|
|
128
|
+
apiRef: PropTypes.shape({
|
|
129
|
+
current: PropTypes.object
|
|
130
|
+
}),
|
|
131
|
+
children: PropTypes.node,
|
|
132
|
+
className: PropTypes.string,
|
|
133
|
+
/**
|
|
134
|
+
* Color palette used to colorize multiple series.
|
|
135
|
+
* @default rainbowSurgePalette
|
|
136
|
+
*/
|
|
137
|
+
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
138
|
+
/**
|
|
139
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
140
|
+
*/
|
|
141
|
+
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
142
|
+
desc: PropTypes.string,
|
|
143
|
+
/**
|
|
144
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
145
|
+
* It might break interactive features, but will improve performance.
|
|
146
|
+
* @default false
|
|
147
|
+
*/
|
|
148
|
+
disableAxisListener: PropTypes.bool,
|
|
149
|
+
/**
|
|
150
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
151
|
+
*/
|
|
152
|
+
height: PropTypes.number,
|
|
153
|
+
/**
|
|
154
|
+
* The highlighted item.
|
|
155
|
+
* Used when the highlight is controlled.
|
|
156
|
+
*/
|
|
157
|
+
highlightedItem: PropTypes.shape({
|
|
158
|
+
dataIndex: PropTypes.number,
|
|
159
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
160
|
+
}),
|
|
161
|
+
/**
|
|
162
|
+
* This prop is used to help implement the accessibility logic.
|
|
163
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
164
|
+
*/
|
|
165
|
+
id: PropTypes.string,
|
|
166
|
+
/**
|
|
167
|
+
* If `true`, a loading overlay is displayed.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
loading: PropTypes.bool,
|
|
171
|
+
/**
|
|
172
|
+
* The margin between the SVG and the drawing area.
|
|
173
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
174
|
+
*
|
|
175
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
176
|
+
*/
|
|
177
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
178
|
+
bottom: PropTypes.number,
|
|
179
|
+
left: PropTypes.number,
|
|
180
|
+
right: PropTypes.number,
|
|
181
|
+
top: PropTypes.number
|
|
182
|
+
})]),
|
|
183
|
+
/**
|
|
184
|
+
* The function called for onClick events.
|
|
185
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
186
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
187
|
+
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
188
|
+
*/
|
|
189
|
+
onAxisClick: PropTypes.func,
|
|
190
|
+
/**
|
|
191
|
+
* The callback fired when the highlighted item changes.
|
|
192
|
+
*
|
|
193
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
194
|
+
*/
|
|
195
|
+
onHighlightChange: PropTypes.func,
|
|
196
|
+
/**
|
|
197
|
+
* The series to display in the bar chart.
|
|
198
|
+
* An array of [[HeatmapSeriesType]] objects.
|
|
199
|
+
*/
|
|
200
|
+
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
201
|
+
/**
|
|
202
|
+
* The configuration helpers used to compute attributes according to the serries type.
|
|
203
|
+
* @ignore Unstable props for internal usage.
|
|
204
|
+
*/
|
|
205
|
+
seriesConfig: PropTypes.object,
|
|
206
|
+
/**
|
|
207
|
+
* The props used for each component slot.
|
|
208
|
+
* @default {}
|
|
209
|
+
*/
|
|
210
|
+
slotProps: PropTypes.object,
|
|
211
|
+
/**
|
|
212
|
+
* Overridable component slots.
|
|
213
|
+
* @default {}
|
|
214
|
+
*/
|
|
215
|
+
slots: PropTypes.object,
|
|
216
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
217
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
218
|
+
title: PropTypes.string,
|
|
219
|
+
/**
|
|
220
|
+
* The configuration of the tooltip.
|
|
221
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
222
|
+
*/
|
|
223
|
+
tooltip: PropTypes.object,
|
|
224
|
+
/**
|
|
225
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
226
|
+
*/
|
|
227
|
+
width: PropTypes.number,
|
|
228
|
+
/**
|
|
229
|
+
* The configuration of the x-axes.
|
|
230
|
+
* If not provided, a default axis config is used.
|
|
231
|
+
* An array of [[AxisConfig]] objects.
|
|
232
|
+
*/
|
|
233
|
+
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
234
|
+
axis: PropTypes.oneOf(['x']),
|
|
235
|
+
barGapRatio: PropTypes.number,
|
|
236
|
+
categoryGapRatio: PropTypes.number,
|
|
237
|
+
classes: PropTypes.object,
|
|
238
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
239
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
240
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
241
|
+
unknownColor: PropTypes.string,
|
|
242
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
243
|
+
}), PropTypes.shape({
|
|
244
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
245
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
246
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
247
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
248
|
+
}), PropTypes.shape({
|
|
249
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
250
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
251
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
252
|
+
})]),
|
|
253
|
+
data: PropTypes.array,
|
|
254
|
+
dataKey: PropTypes.string,
|
|
255
|
+
disableLine: PropTypes.bool,
|
|
256
|
+
disableTicks: PropTypes.bool,
|
|
257
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
258
|
+
fill: PropTypes.string,
|
|
259
|
+
height: PropTypes.number,
|
|
260
|
+
hideTooltip: PropTypes.bool,
|
|
261
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
262
|
+
label: PropTypes.string,
|
|
263
|
+
labelStyle: PropTypes.object,
|
|
264
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
265
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
266
|
+
offset: PropTypes.number,
|
|
267
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
268
|
+
reverse: PropTypes.bool,
|
|
269
|
+
scaleType: PropTypes.oneOf(['band']),
|
|
270
|
+
slotProps: PropTypes.object,
|
|
271
|
+
slots: PropTypes.object,
|
|
272
|
+
stroke: PropTypes.string,
|
|
273
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
274
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
275
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
276
|
+
tickLabelMinGap: PropTypes.number,
|
|
277
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
278
|
+
tickLabelStyle: PropTypes.object,
|
|
279
|
+
tickMaxStep: PropTypes.number,
|
|
280
|
+
tickMinStep: PropTypes.number,
|
|
281
|
+
tickNumber: PropTypes.number,
|
|
282
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
283
|
+
tickSize: PropTypes.number,
|
|
284
|
+
valueFormatter: PropTypes.func,
|
|
285
|
+
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
286
|
+
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
287
|
+
maxEnd: PropTypes.number,
|
|
288
|
+
maxSpan: PropTypes.number,
|
|
289
|
+
minSpan: PropTypes.number,
|
|
290
|
+
minStart: PropTypes.number,
|
|
291
|
+
panning: PropTypes.bool,
|
|
292
|
+
step: PropTypes.number
|
|
293
|
+
}), PropTypes.bool])
|
|
294
|
+
})).isRequired,
|
|
295
|
+
/**
|
|
296
|
+
* The configuration of the y-axes.
|
|
297
|
+
* If not provided, a default axis config is used.
|
|
298
|
+
* An array of [[AxisConfig]] objects.
|
|
299
|
+
*/
|
|
300
|
+
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
301
|
+
axis: PropTypes.oneOf(['y']),
|
|
302
|
+
barGapRatio: PropTypes.number,
|
|
303
|
+
categoryGapRatio: PropTypes.number,
|
|
304
|
+
classes: PropTypes.object,
|
|
305
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
306
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
307
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
308
|
+
unknownColor: PropTypes.string,
|
|
309
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
310
|
+
}), PropTypes.shape({
|
|
311
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
312
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
313
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
314
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
315
|
+
}), PropTypes.shape({
|
|
316
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
317
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
318
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
319
|
+
})]),
|
|
320
|
+
data: PropTypes.array,
|
|
321
|
+
dataKey: PropTypes.string,
|
|
322
|
+
disableLine: PropTypes.bool,
|
|
323
|
+
disableTicks: PropTypes.bool,
|
|
324
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
325
|
+
fill: PropTypes.string,
|
|
326
|
+
hideTooltip: PropTypes.bool,
|
|
327
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
328
|
+
label: PropTypes.string,
|
|
329
|
+
labelStyle: PropTypes.object,
|
|
330
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
331
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
332
|
+
offset: PropTypes.number,
|
|
333
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
334
|
+
reverse: PropTypes.bool,
|
|
335
|
+
scaleType: PropTypes.oneOf(['band']),
|
|
336
|
+
slotProps: PropTypes.object,
|
|
337
|
+
slots: PropTypes.object,
|
|
338
|
+
stroke: PropTypes.string,
|
|
339
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
340
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
341
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
342
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
343
|
+
tickLabelStyle: PropTypes.object,
|
|
344
|
+
tickMaxStep: PropTypes.number,
|
|
345
|
+
tickMinStep: PropTypes.number,
|
|
346
|
+
tickNumber: PropTypes.number,
|
|
347
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
348
|
+
tickSize: PropTypes.number,
|
|
349
|
+
valueFormatter: PropTypes.func,
|
|
350
|
+
width: PropTypes.number,
|
|
351
|
+
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
352
|
+
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
353
|
+
maxEnd: PropTypes.number,
|
|
354
|
+
maxSpan: PropTypes.number,
|
|
355
|
+
minSpan: PropTypes.number,
|
|
356
|
+
minStart: PropTypes.number,
|
|
357
|
+
panning: PropTypes.bool,
|
|
358
|
+
step: PropTypes.number
|
|
359
|
+
}), PropTypes.bool])
|
|
360
|
+
})).isRequired,
|
|
361
|
+
/**
|
|
362
|
+
* The configuration of the z-axes.
|
|
363
|
+
*/
|
|
364
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
365
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
366
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
367
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
368
|
+
unknownColor: PropTypes.string,
|
|
369
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
370
|
+
}), PropTypes.shape({
|
|
371
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
372
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
373
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
374
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
375
|
+
}), PropTypes.shape({
|
|
376
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
377
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
378
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
379
|
+
})]),
|
|
380
|
+
data: PropTypes.array,
|
|
381
|
+
dataKey: PropTypes.string,
|
|
382
|
+
id: PropTypes.string,
|
|
383
|
+
max: PropTypes.number,
|
|
384
|
+
min: PropTypes.number
|
|
385
|
+
}))
|
|
386
|
+
} : void 0;
|
|
387
|
+
export { Heatmap };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
2
|
+
export type HeatmapPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'heatmap'>, UseChartInteractionSignature, UseChartHighlightSignature];
|
|
3
|
+
export declare const HEATMAP_PLUGINS: ConvertSignaturesIntoPlugins<HeatmapPluginsSignatures>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { HeatmapClasses } from "./heatmapClasses.js";
|
|
4
|
+
export interface HeatmapItemSlots {
|
|
5
|
+
/**
|
|
6
|
+
* The component that renders the heatmap cell.
|
|
7
|
+
* @default HeatmapCell
|
|
8
|
+
*/
|
|
9
|
+
cell?: React.ElementType;
|
|
10
|
+
}
|
|
11
|
+
export interface HeatmapItemSlotProps {
|
|
12
|
+
cell?: Partial<React.ComponentPropsWithRef<'rect'>>;
|
|
13
|
+
}
|
|
14
|
+
export interface HeatmapItemProps {
|
|
15
|
+
dataIndex: number;
|
|
16
|
+
seriesId: SeriesId;
|
|
17
|
+
value: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
color: string;
|
|
23
|
+
/**
|
|
24
|
+
* The props used for each component slot.
|
|
25
|
+
* @default {}
|
|
26
|
+
*/
|
|
27
|
+
slotProps?: HeatmapItemSlotProps;
|
|
28
|
+
/**
|
|
29
|
+
* Overridable component slots.
|
|
30
|
+
* @default {}
|
|
31
|
+
*/
|
|
32
|
+
slots?: HeatmapItemSlots;
|
|
33
|
+
}
|
|
34
|
+
export interface HeatmapItemOwnerState {
|
|
35
|
+
seriesId: SeriesId;
|
|
36
|
+
dataIndex: number;
|
|
37
|
+
color: string;
|
|
38
|
+
isFaded: boolean;
|
|
39
|
+
isHighlighted: boolean;
|
|
40
|
+
classes?: Partial<HeatmapClasses>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @ignore - internal component.
|
|
44
|
+
*/
|
|
45
|
+
declare function HeatmapItem(props: HeatmapItemProps): React.JSX.Element;
|
|
46
|
+
declare namespace HeatmapItem {
|
|
47
|
+
var propTypes: any;
|
|
48
|
+
}
|
|
49
|
+
export { HeatmapItem };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["seriesId", "dataIndex", "color", "value", "slotProps", "slots"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import { useItemHighlighted } from '@mui/x-charts/hooks';
|
|
10
|
+
import { useInteractionItemProps } from '@mui/x-charts/internals';
|
|
11
|
+
import { getHeatmapUtilityClass } from "./heatmapClasses.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const HeatmapCell = styled('rect', {
|
|
14
|
+
name: 'MuiHeatmap',
|
|
15
|
+
slot: 'Cell',
|
|
16
|
+
overridesResolver: (_, styles) => styles.arc
|
|
17
|
+
})(({
|
|
18
|
+
ownerState
|
|
19
|
+
}) => ({
|
|
20
|
+
filter: ownerState.isHighlighted && 'saturate(120%)' || ownerState.isFaded && 'saturate(80%)' || undefined,
|
|
21
|
+
fill: ownerState.color,
|
|
22
|
+
shapeRendering: 'crispEdges'
|
|
23
|
+
}));
|
|
24
|
+
const useUtilityClasses = ownerState => {
|
|
25
|
+
const {
|
|
26
|
+
classes,
|
|
27
|
+
seriesId,
|
|
28
|
+
isFaded,
|
|
29
|
+
isHighlighted
|
|
30
|
+
} = ownerState;
|
|
31
|
+
const slots = {
|
|
32
|
+
cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
|
|
33
|
+
};
|
|
34
|
+
return composeClasses(slots, getHeatmapUtilityClass, classes);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @ignore - internal component.
|
|
39
|
+
*/
|
|
40
|
+
function HeatmapItem(props) {
|
|
41
|
+
const {
|
|
42
|
+
seriesId,
|
|
43
|
+
dataIndex,
|
|
44
|
+
color,
|
|
45
|
+
value,
|
|
46
|
+
slotProps = {},
|
|
47
|
+
slots = {}
|
|
48
|
+
} = props,
|
|
49
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
50
|
+
const getInteractionItemProps = useInteractionItemProps();
|
|
51
|
+
const {
|
|
52
|
+
isFaded,
|
|
53
|
+
isHighlighted
|
|
54
|
+
} = useItemHighlighted({
|
|
55
|
+
seriesId,
|
|
56
|
+
dataIndex
|
|
57
|
+
});
|
|
58
|
+
const ownerState = {
|
|
59
|
+
seriesId,
|
|
60
|
+
dataIndex,
|
|
61
|
+
color,
|
|
62
|
+
value,
|
|
63
|
+
isFaded,
|
|
64
|
+
isHighlighted
|
|
65
|
+
};
|
|
66
|
+
const classes = useUtilityClasses(ownerState);
|
|
67
|
+
const Cell = slots?.cell ?? HeatmapCell;
|
|
68
|
+
const cellProps = useSlotProps({
|
|
69
|
+
elementType: Cell,
|
|
70
|
+
additionalProps: _extends({}, getInteractionItemProps({
|
|
71
|
+
type: 'heatmap',
|
|
72
|
+
seriesId,
|
|
73
|
+
dataIndex
|
|
74
|
+
})),
|
|
75
|
+
externalForwardedProps: _extends({}, other),
|
|
76
|
+
externalSlotProps: slotProps.cell,
|
|
77
|
+
ownerState,
|
|
78
|
+
className: classes.cell
|
|
79
|
+
});
|
|
80
|
+
return /*#__PURE__*/_jsx(Cell, _extends({}, cellProps));
|
|
81
|
+
}
|
|
82
|
+
process.env.NODE_ENV !== "production" ? HeatmapItem.propTypes = {
|
|
83
|
+
// ----------------------------- Warning --------------------------------
|
|
84
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
85
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
86
|
+
// ----------------------------------------------------------------------
|
|
87
|
+
color: PropTypes.string.isRequired,
|
|
88
|
+
dataIndex: PropTypes.number.isRequired,
|
|
89
|
+
height: PropTypes.number.isRequired,
|
|
90
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
91
|
+
/**
|
|
92
|
+
* The props used for each component slot.
|
|
93
|
+
* @default {}
|
|
94
|
+
*/
|
|
95
|
+
slotProps: PropTypes.object,
|
|
96
|
+
/**
|
|
97
|
+
* Overridable component slots.
|
|
98
|
+
* @default {}
|
|
99
|
+
*/
|
|
100
|
+
slots: PropTypes.object,
|
|
101
|
+
value: PropTypes.number.isRequired,
|
|
102
|
+
width: PropTypes.number.isRequired,
|
|
103
|
+
x: PropTypes.number.isRequired,
|
|
104
|
+
y: PropTypes.number.isRequired
|
|
105
|
+
} : void 0;
|
|
106
|
+
export { HeatmapItem };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { HeatmapItemProps } from "./HeatmapItem.js";
|
|
3
|
+
export interface HeatmapPlotProps extends Pick<HeatmapItemProps, 'slots' | 'slotProps'> {}
|
|
4
|
+
declare function HeatmapPlot(props: HeatmapPlotProps): React.JSX.Element | null;
|
|
5
|
+
declare namespace HeatmapPlot {
|
|
6
|
+
var propTypes: any;
|
|
7
|
+
}
|
|
8
|
+
export { HeatmapPlot };
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _hooks = require("@mui/x-charts/hooks");
|
|
13
|
-
var _useSeries = require("../hooks/useSeries");
|
|
14
|
-
var _HeatmapItem = require("./HeatmapItem");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useXScale, useYScale, useZColorScale } from '@mui/x-charts/hooks';
|
|
6
|
+
import { useHeatmapSeriesContext } from "../hooks/useHeatmapSeries.js";
|
|
7
|
+
import { HeatmapItem } from "./HeatmapItem.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
9
|
function HeatmapPlot(props) {
|
|
17
|
-
const xScale =
|
|
18
|
-
const yScale =
|
|
19
|
-
const colorScale =
|
|
20
|
-
const series = (
|
|
10
|
+
const xScale = useXScale();
|
|
11
|
+
const yScale = useYScale();
|
|
12
|
+
const colorScale = useZColorScale();
|
|
13
|
+
const series = useHeatmapSeriesContext();
|
|
21
14
|
const xDomain = xScale.domain();
|
|
22
15
|
const yDomain = yScale.domain();
|
|
23
16
|
if (!series || series.seriesOrder.length === 0) {
|
|
24
17
|
return null;
|
|
25
18
|
}
|
|
26
19
|
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
27
|
-
return /*#__PURE__*/(
|
|
20
|
+
return /*#__PURE__*/_jsx("g", {
|
|
28
21
|
children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
|
|
29
22
|
const x = xScale(xDomain[xIndex]);
|
|
30
23
|
const y = yScale(yDomain[yIndex]);
|
|
@@ -32,7 +25,7 @@ function HeatmapPlot(props) {
|
|
|
32
25
|
if (x === undefined || y === undefined || !color) {
|
|
33
26
|
return null;
|
|
34
27
|
}
|
|
35
|
-
return /*#__PURE__*/(
|
|
28
|
+
return /*#__PURE__*/_jsx(HeatmapItem, {
|
|
36
29
|
width: xScale.bandwidth(),
|
|
37
30
|
height: yScale.bandwidth(),
|
|
38
31
|
x: x,
|
|
@@ -56,10 +49,11 @@ process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
|
|
|
56
49
|
* The props used for each component slot.
|
|
57
50
|
* @default {}
|
|
58
51
|
*/
|
|
59
|
-
slotProps:
|
|
52
|
+
slotProps: PropTypes.object,
|
|
60
53
|
/**
|
|
61
54
|
* Overridable component slots.
|
|
62
55
|
* @default {}
|
|
63
56
|
*/
|
|
64
|
-
slots:
|
|
65
|
-
} : void 0;
|
|
57
|
+
slots: PropTypes.object
|
|
58
|
+
} : void 0;
|
|
59
|
+
export { HeatmapPlot };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
|
|
3
|
+
export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {}
|
|
4
|
+
declare function HeatmapTooltip(props: HeatmapTooltipProps): React.JSX.Element;
|
|
5
|
+
declare namespace HeatmapTooltip {
|
|
6
|
+
var propTypes: any;
|
|
7
|
+
}
|
|
8
|
+
export { HeatmapTooltip };
|