@mui/x-charts-pro 8.0.0-alpha.11 → 8.0.0-alpha.12
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 +227 -221
- 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 +161 -1
- package/ChartContainerPro/ChartContainerPro.d.ts +4 -4
- package/ChartContainerPro/ChartContainerPro.js +178 -172
- package/ChartContainerPro/index.d.ts +2 -1
- package/ChartContainerPro/index.js +17 -1
- package/ChartContainerPro/useChartContainerProProps.d.ts +3 -3
- package/ChartContainerPro/useChartContainerProProps.js +17 -10
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +3 -3
- package/ChartDataProviderPro/ChartDataProviderPro.js +34 -28
- 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 +43 -43
- package/Heatmap/Heatmap.js +210 -204
- 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 +239 -233
- 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 +216 -212
- 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 +455 -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 +33 -0
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/{node → esm}/ChartDataProviderPro/ChartDataProviderPro.js +28 -34
- 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 +56 -0
- package/esm/Heatmap/Heatmap.js +402 -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 +506 -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 +400 -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 +33 -44
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +201 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +4 -0
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +44 -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 +40 -37
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +149 -325
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +11 -10
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +35 -41
- 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 +17 -18
- 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.plugins.d.ts +4 -0
- package/modern/BarChartPro/index.d.ts +1 -0
- package/modern/ChartContainerPro/ChartContainerPro.d.ts +35 -0
- 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/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- 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 +56 -0
- package/modern/Heatmap/Heatmap.js +2 -2
- 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.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 +1 -3
- 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 +4 -8
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +201 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +1 -7
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +44 -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
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.useChartProZoom = void 0;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _internals = require("@mui/x-charts/internals");
|
|
13
|
-
var _creatZoomLookup = require("./creatZoomLookup");
|
|
14
|
-
var _useChartProZoom = require("./useChartProZoom.utils");
|
|
15
|
-
var _useChartProZoom2 = require("./useChartProZoom.selectors");
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useSelector, getSVGPoint, selectorChartDrawingArea, createZoomLookup, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
6
|
+
import { getDiff, getHorizontalCenterRatio, getPinchScaleRatio, getVerticalCenterRatio, getWheelScaleRatio, isSpanValid, preventDefault, zoomAtPoint } from "./useChartProZoom.utils.js";
|
|
7
|
+
|
|
16
8
|
// It is helpful to avoid the need to provide the possibly auto-generated id for each axis.
|
|
17
9
|
function initializeZoomData(options) {
|
|
18
10
|
return Object.values(options).map(({
|
|
@@ -25,14 +17,14 @@ function initializeZoomData(options) {
|
|
|
25
17
|
end
|
|
26
18
|
}));
|
|
27
19
|
}
|
|
28
|
-
const useChartProZoom = ({
|
|
20
|
+
export const useChartProZoom = ({
|
|
29
21
|
store,
|
|
30
22
|
instance,
|
|
31
23
|
svgRef,
|
|
32
24
|
params
|
|
33
25
|
}) => {
|
|
34
|
-
const drawingArea =
|
|
35
|
-
const optionsLookup =
|
|
26
|
+
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
27
|
+
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
36
28
|
const isZoomEnabled = Object.keys(optionsLookup).length > 0;
|
|
37
29
|
|
|
38
30
|
// Add events
|
|
@@ -41,8 +33,8 @@ const useChartProZoom = ({
|
|
|
41
33
|
const eventPrevDiff = React.useRef(0);
|
|
42
34
|
const interactionTimeoutRef = React.useRef(undefined);
|
|
43
35
|
const setIsInteracting = React.useCallback(isInteracting => {
|
|
44
|
-
store.update(prev => (
|
|
45
|
-
zoom: (
|
|
36
|
+
store.update(prev => _extends({}, prev, {
|
|
37
|
+
zoom: _extends({}, prev.zoom, {
|
|
46
38
|
isInteracting
|
|
47
39
|
})
|
|
48
40
|
}));
|
|
@@ -51,8 +43,8 @@ const useChartProZoom = ({
|
|
|
51
43
|
store.update(prevState => {
|
|
52
44
|
const newZoomData = typeof zoomData === 'function' ? zoomData(prevState.zoom.zoomData) : zoomData;
|
|
53
45
|
params.onZoomChange?.(newZoomData);
|
|
54
|
-
return (
|
|
55
|
-
zoom: (
|
|
46
|
+
return _extends({}, prevState, {
|
|
47
|
+
zoom: _extends({}, prevState.zoom, {
|
|
56
48
|
zoomData: newZoomData
|
|
57
49
|
})
|
|
58
50
|
});
|
|
@@ -75,7 +67,7 @@ const useChartProZoom = ({
|
|
|
75
67
|
if (touchStartRef.current == null) {
|
|
76
68
|
return;
|
|
77
69
|
}
|
|
78
|
-
const point =
|
|
70
|
+
const point = getSVGPoint(element, event);
|
|
79
71
|
const movementX = point.x - touchStartRef.current.x;
|
|
80
72
|
const movementY = (point.y - touchStartRef.current.y) * -1;
|
|
81
73
|
const newZoomData = touchStartRef.current.zoomData.map(zoom => {
|
|
@@ -103,7 +95,7 @@ const useChartProZoom = ({
|
|
|
103
95
|
if (newMinPercent < MIN_PERCENT || newMaxPercent > MAX_PERCENT || span < options.minSpan || span > options.maxSpan) {
|
|
104
96
|
return zoom;
|
|
105
97
|
}
|
|
106
|
-
return (
|
|
98
|
+
return _extends({}, zoom, {
|
|
107
99
|
start: newMinPercent,
|
|
108
100
|
end: newMaxPercent
|
|
109
101
|
});
|
|
@@ -112,7 +104,7 @@ const useChartProZoom = ({
|
|
|
112
104
|
};
|
|
113
105
|
const handleDown = event => {
|
|
114
106
|
panningEventCacheRef.current.push(event);
|
|
115
|
-
const point =
|
|
107
|
+
const point = getSVGPoint(element, event);
|
|
116
108
|
if (!instance.isPointInside(point)) {
|
|
117
109
|
return;
|
|
118
110
|
}
|
|
@@ -158,7 +150,7 @@ const useChartProZoom = ({
|
|
|
158
150
|
if (element === null) {
|
|
159
151
|
return;
|
|
160
152
|
}
|
|
161
|
-
const point =
|
|
153
|
+
const point = getSVGPoint(element, event);
|
|
162
154
|
if (!instance.isPointInside(point)) {
|
|
163
155
|
return;
|
|
164
156
|
}
|
|
@@ -178,13 +170,13 @@ const useChartProZoom = ({
|
|
|
178
170
|
if (!option) {
|
|
179
171
|
return zoom;
|
|
180
172
|
}
|
|
181
|
-
const centerRatio = option.axisDirection === 'x' ?
|
|
173
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
182
174
|
const {
|
|
183
175
|
scaleRatio,
|
|
184
176
|
isZoomIn
|
|
185
|
-
} =
|
|
186
|
-
const [newMinRange, newMaxRange] =
|
|
187
|
-
if (!
|
|
177
|
+
} = getWheelScaleRatio(event, option.step);
|
|
178
|
+
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
179
|
+
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
188
180
|
return zoom;
|
|
189
181
|
}
|
|
190
182
|
return {
|
|
@@ -211,7 +203,7 @@ const useChartProZoom = ({
|
|
|
211
203
|
return;
|
|
212
204
|
}
|
|
213
205
|
const firstEvent = zoomEventCacheRef.current[0];
|
|
214
|
-
const curDiff =
|
|
206
|
+
const curDiff = getDiff(zoomEventCacheRef.current);
|
|
215
207
|
setZoomDataCallback(prevZoomData => {
|
|
216
208
|
const newZoomData = prevZoomData.map(zoom => {
|
|
217
209
|
const option = optionsLookup[zoom.axisId];
|
|
@@ -221,16 +213,16 @@ const useChartProZoom = ({
|
|
|
221
213
|
const {
|
|
222
214
|
scaleRatio,
|
|
223
215
|
isZoomIn
|
|
224
|
-
} =
|
|
216
|
+
} = getPinchScaleRatio(curDiff, eventPrevDiff.current, option.step);
|
|
225
217
|
|
|
226
218
|
// If the scale ratio is 0, it means the pinch gesture is not valid.
|
|
227
219
|
if (scaleRatio === 0) {
|
|
228
220
|
return zoom;
|
|
229
221
|
}
|
|
230
|
-
const point =
|
|
231
|
-
const centerRatio = option.axisDirection === 'x' ?
|
|
232
|
-
const [newMinRange, newMaxRange] =
|
|
233
|
-
if (!
|
|
222
|
+
const point = getSVGPoint(element, firstEvent);
|
|
223
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
224
|
+
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
225
|
+
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
234
226
|
return zoom;
|
|
235
227
|
}
|
|
236
228
|
return {
|
|
@@ -261,8 +253,8 @@ const useChartProZoom = ({
|
|
|
261
253
|
element.addEventListener('pointerleave', pointerUpHandler);
|
|
262
254
|
|
|
263
255
|
// Prevent zooming the entire page on touch devices
|
|
264
|
-
element.addEventListener('touchstart',
|
|
265
|
-
element.addEventListener('touchmove',
|
|
256
|
+
element.addEventListener('touchstart', preventDefault);
|
|
257
|
+
element.addEventListener('touchmove', preventDefault);
|
|
266
258
|
return () => {
|
|
267
259
|
element.removeEventListener('wheel', wheelHandler);
|
|
268
260
|
element.removeEventListener('pointerdown', pointerDownHandler);
|
|
@@ -271,8 +263,8 @@ const useChartProZoom = ({
|
|
|
271
263
|
element.removeEventListener('pointercancel', pointerUpHandler);
|
|
272
264
|
element.removeEventListener('pointerout', pointerUpHandler);
|
|
273
265
|
element.removeEventListener('pointerleave', pointerUpHandler);
|
|
274
|
-
element.removeEventListener('touchstart',
|
|
275
|
-
element.removeEventListener('touchmove',
|
|
266
|
+
element.removeEventListener('touchstart', preventDefault);
|
|
267
|
+
element.removeEventListener('touchmove', preventDefault);
|
|
276
268
|
if (interactionTimeoutRef.current) {
|
|
277
269
|
clearTimeout(interactionTimeoutRef.current);
|
|
278
270
|
}
|
|
@@ -287,7 +279,6 @@ const useChartProZoom = ({
|
|
|
287
279
|
}
|
|
288
280
|
};
|
|
289
281
|
};
|
|
290
|
-
exports.useChartProZoom = useChartProZoom;
|
|
291
282
|
useChartProZoom.params = {
|
|
292
283
|
initialZoom: true,
|
|
293
284
|
onZoomChange: true
|
|
@@ -295,15 +286,13 @@ useChartProZoom.params = {
|
|
|
295
286
|
useChartProZoom.getDefaultizedParams = ({
|
|
296
287
|
params
|
|
297
288
|
}) => {
|
|
298
|
-
|
|
299
|
-
return (0, _extends2.default)({}, params, {
|
|
300
|
-
optionsLookup
|
|
301
|
-
});
|
|
289
|
+
return _extends({}, params);
|
|
302
290
|
};
|
|
303
291
|
useChartProZoom.getInitialState = params => {
|
|
292
|
+
const optionsLookup = _extends({}, createZoomLookup('x')(params.defaultizedXAxis), createZoomLookup('y')(params.defaultizedYAxis));
|
|
304
293
|
return {
|
|
305
294
|
zoom: {
|
|
306
|
-
zoomData: params.initialZoom === undefined ? initializeZoomData(
|
|
295
|
+
zoomData: params.initialZoom === undefined ? initializeZoomData(optionsLookup) : params.initialZoom,
|
|
307
296
|
isInteracting: false
|
|
308
297
|
}
|
|
309
298
|
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ChartRootSelector } from '@mui/x-charts/internals';
|
|
2
|
+
import { UseChartProZoomSignature } from "./useChartProZoom.types.js";
|
|
3
|
+
export declare const selectorChartZoomState: ChartRootSelector<UseChartProZoomSignature>;
|
|
4
|
+
export declare const selectorChartZoomIsInteracting: ((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("./useChartProZoom.types").UseChartProZoomState & Partial<{}> & {
|
|
5
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
6
|
+
}) => boolean) & {
|
|
7
|
+
clearCache: () => void;
|
|
8
|
+
resultsCount: () => number;
|
|
9
|
+
resetResultsCount: () => void;
|
|
10
|
+
} & {
|
|
11
|
+
resultFunc: (resultFuncArgs_0: {
|
|
12
|
+
isInteracting: boolean;
|
|
13
|
+
zoomData: import("@mui/x-charts/internals").ZoomData[];
|
|
14
|
+
}) => boolean;
|
|
15
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
16
|
+
isInteracting: boolean;
|
|
17
|
+
zoomData: import("@mui/x-charts/internals").ZoomData[];
|
|
18
|
+
}) => boolean) & {
|
|
19
|
+
clearCache: () => void;
|
|
20
|
+
resultsCount: () => number;
|
|
21
|
+
resetResultsCount: () => void;
|
|
22
|
+
};
|
|
23
|
+
lastResult: () => boolean;
|
|
24
|
+
dependencies: [ChartRootSelector<UseChartProZoomSignature>];
|
|
25
|
+
recomputations: () => number;
|
|
26
|
+
resetRecomputations: () => void;
|
|
27
|
+
dependencyRecomputations: () => number;
|
|
28
|
+
resetDependencyRecomputations: () => void;
|
|
29
|
+
} & {
|
|
30
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
31
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
32
|
+
};
|
|
33
|
+
export declare const selectorChartZoomIsEnabled: ((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals").UseChartCartesianAxisState & Partial<{}> & {
|
|
34
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
35
|
+
}) => boolean) & {
|
|
36
|
+
clearCache: () => void;
|
|
37
|
+
resultsCount: () => number;
|
|
38
|
+
resetResultsCount: () => void;
|
|
39
|
+
} & {
|
|
40
|
+
resultFunc: (resultFuncArgs_0: {
|
|
41
|
+
[x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
42
|
+
[x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
43
|
+
}) => boolean;
|
|
44
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
45
|
+
[x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
46
|
+
[x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
47
|
+
}) => boolean) & {
|
|
48
|
+
clearCache: () => void;
|
|
49
|
+
resultsCount: () => number;
|
|
50
|
+
resetResultsCount: () => void;
|
|
51
|
+
};
|
|
52
|
+
lastResult: () => boolean;
|
|
53
|
+
dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals").UseChartCartesianAxisState & Partial<{}> & {
|
|
54
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
55
|
+
}) => {
|
|
56
|
+
[x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
57
|
+
[x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
58
|
+
}) & {
|
|
59
|
+
clearCache: () => void;
|
|
60
|
+
resultsCount: () => number;
|
|
61
|
+
resetResultsCount: () => void;
|
|
62
|
+
} & {
|
|
63
|
+
resultFunc: (resultFuncArgs_0: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>, resultFuncArgs_1: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) => {
|
|
64
|
+
[x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
65
|
+
[x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
66
|
+
};
|
|
67
|
+
memoizedResultFunc: ((resultFuncArgs_0: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>, resultFuncArgs_1: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) => {
|
|
68
|
+
[x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
69
|
+
[x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
70
|
+
}) & {
|
|
71
|
+
clearCache: () => void;
|
|
72
|
+
resultsCount: () => number;
|
|
73
|
+
resetResultsCount: () => void;
|
|
74
|
+
};
|
|
75
|
+
lastResult: () => {
|
|
76
|
+
[x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
77
|
+
[x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
|
|
78
|
+
};
|
|
79
|
+
dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals").UseChartCartesianAxisState & Partial<{}> & {
|
|
80
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
81
|
+
}) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
|
|
82
|
+
clearCache: () => void;
|
|
83
|
+
resultsCount: () => number;
|
|
84
|
+
resetResultsCount: () => void;
|
|
85
|
+
} & {
|
|
86
|
+
resultFunc: (resultFuncArgs_0: import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsXAxisProps>[]) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
|
|
87
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsXAxisProps>[]) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
|
|
88
|
+
clearCache: () => void;
|
|
89
|
+
resultsCount: () => number;
|
|
90
|
+
resetResultsCount: () => void;
|
|
91
|
+
};
|
|
92
|
+
lastResult: () => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
|
|
93
|
+
dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals").UseChartCartesianAxisState & Partial<{}> & {
|
|
94
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
95
|
+
}) => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsXAxisProps>[]) & {
|
|
96
|
+
clearCache: () => void;
|
|
97
|
+
resultsCount: () => number;
|
|
98
|
+
resetResultsCount: () => void;
|
|
99
|
+
} & {
|
|
100
|
+
resultFunc: (resultFuncArgs_0: {
|
|
101
|
+
x: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
102
|
+
y: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
103
|
+
}) => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
104
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
105
|
+
x: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
106
|
+
y: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
107
|
+
}) => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsXAxisProps>[]) & {
|
|
108
|
+
clearCache: () => void;
|
|
109
|
+
resultsCount: () => number;
|
|
110
|
+
resetResultsCount: () => void;
|
|
111
|
+
};
|
|
112
|
+
lastResult: () => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
113
|
+
dependencies: [(state: import("@mui/x-charts/internals").ChartState<[import("@mui/x-charts/internals").UseChartCartesianAxisSignature]>) => {
|
|
114
|
+
x: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
115
|
+
y: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
116
|
+
}];
|
|
117
|
+
recomputations: () => number;
|
|
118
|
+
resetRecomputations: () => void;
|
|
119
|
+
dependencyRecomputations: () => number;
|
|
120
|
+
resetDependencyRecomputations: () => void;
|
|
121
|
+
} & {
|
|
122
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
123
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
124
|
+
}];
|
|
125
|
+
recomputations: () => number;
|
|
126
|
+
resetRecomputations: () => void;
|
|
127
|
+
dependencyRecomputations: () => number;
|
|
128
|
+
resetDependencyRecomputations: () => void;
|
|
129
|
+
} & {
|
|
130
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
131
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
132
|
+
}, ((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals").UseChartCartesianAxisState & Partial<{}> & {
|
|
133
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
134
|
+
}) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
|
|
135
|
+
clearCache: () => void;
|
|
136
|
+
resultsCount: () => number;
|
|
137
|
+
resetResultsCount: () => void;
|
|
138
|
+
} & {
|
|
139
|
+
resultFunc: (resultFuncArgs_0: import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsYAxisProps>[]) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
|
|
140
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsYAxisProps>[]) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
|
|
141
|
+
clearCache: () => void;
|
|
142
|
+
resultsCount: () => number;
|
|
143
|
+
resetResultsCount: () => void;
|
|
144
|
+
};
|
|
145
|
+
lastResult: () => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
|
|
146
|
+
dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals").UseChartCartesianAxisState & Partial<{}> & {
|
|
147
|
+
cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
|
|
148
|
+
}) => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsYAxisProps>[]) & {
|
|
149
|
+
clearCache: () => void;
|
|
150
|
+
resultsCount: () => number;
|
|
151
|
+
resetResultsCount: () => void;
|
|
152
|
+
} & {
|
|
153
|
+
resultFunc: (resultFuncArgs_0: {
|
|
154
|
+
x: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
155
|
+
y: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
156
|
+
}) => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
157
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
158
|
+
x: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
159
|
+
y: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
160
|
+
}) => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsYAxisProps>[]) & {
|
|
161
|
+
clearCache: () => void;
|
|
162
|
+
resultsCount: () => number;
|
|
163
|
+
resetResultsCount: () => void;
|
|
164
|
+
};
|
|
165
|
+
lastResult: () => import("@mui/x-charts").AxisConfig<keyof import("@mui/x-charts/internals").AxisScaleConfig, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
166
|
+
dependencies: [(state: import("@mui/x-charts/internals").ChartState<[import("@mui/x-charts/internals").UseChartCartesianAxisSignature]>) => {
|
|
167
|
+
x: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsXAxisProps>[];
|
|
168
|
+
y: import("@mui/x-charts").AxisConfig<import("@mui/x-charts").ScaleName, any, import("@mui/x-charts").ChartsYAxisProps>[];
|
|
169
|
+
}];
|
|
170
|
+
recomputations: () => number;
|
|
171
|
+
resetRecomputations: () => void;
|
|
172
|
+
dependencyRecomputations: () => number;
|
|
173
|
+
resetDependencyRecomputations: () => void;
|
|
174
|
+
} & {
|
|
175
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
176
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
177
|
+
}];
|
|
178
|
+
recomputations: () => number;
|
|
179
|
+
resetRecomputations: () => void;
|
|
180
|
+
dependencyRecomputations: () => number;
|
|
181
|
+
resetDependencyRecomputations: () => void;
|
|
182
|
+
} & {
|
|
183
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
184
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
185
|
+
}];
|
|
186
|
+
recomputations: () => number;
|
|
187
|
+
resetRecomputations: () => void;
|
|
188
|
+
dependencyRecomputations: () => number;
|
|
189
|
+
resetDependencyRecomputations: () => void;
|
|
190
|
+
} & {
|
|
191
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
192
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
193
|
+
}];
|
|
194
|
+
recomputations: () => number;
|
|
195
|
+
resetRecomputations: () => void;
|
|
196
|
+
dependencyRecomputations: () => number;
|
|
197
|
+
resetDependencyRecomputations: () => void;
|
|
198
|
+
} & {
|
|
199
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
200
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
201
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createSelector, selectorChartZoomOptionsLookup } from '@mui/x-charts/internals';
|
|
2
|
+
export const selectorChartZoomState = state => state.zoom;
|
|
3
|
+
export const selectorChartZoomIsInteracting = createSelector(selectorChartZoomState, zoom => zoom.isInteracting);
|
|
4
|
+
export const selectorChartZoomIsEnabled = createSelector(selectorChartZoomOptionsLookup, optionsLookup => Object.keys(optionsLookup).length > 0);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData } from '@mui/x-charts/internals';
|
|
2
|
+
export interface UseChartProZoomParameters {
|
|
3
|
+
/**
|
|
4
|
+
* The list of zoom data related to each axis.
|
|
5
|
+
*/
|
|
6
|
+
initialZoom?: ZoomData[];
|
|
7
|
+
/**
|
|
8
|
+
* Callback fired when the zoom has changed.
|
|
9
|
+
*
|
|
10
|
+
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
11
|
+
*/
|
|
12
|
+
onZoomChange?: (zoomData: ZoomData[] | ((zoomData: ZoomData[]) => ZoomData[])) => void;
|
|
13
|
+
}
|
|
14
|
+
export type UseChartProZoomDefaultizedParameters = UseChartProZoomParameters & UseChartCartesianAxisDefaultizedParameters;
|
|
15
|
+
export interface UseChartProZoomState {
|
|
16
|
+
zoom: {
|
|
17
|
+
/**
|
|
18
|
+
* Whether the user is currently interacting with the chart.
|
|
19
|
+
* This is useful to disable animations while the user is interacting.
|
|
20
|
+
*/
|
|
21
|
+
isInteracting: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Mapping of axis id to the zoom data.
|
|
24
|
+
*/
|
|
25
|
+
zoomData: ZoomData[];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface UseChartProZoomPublicApi {
|
|
29
|
+
/**
|
|
30
|
+
* Set the zoom data state.
|
|
31
|
+
* @param {ZoomData[] | ((prev: ZoomData[]) => ZoomData[])} value The new value. Can either be the new zoom data, or an updater function.
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
setZoomData: (value: ZoomData[] | ((prev: ZoomData[]) => ZoomData[])) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {}
|
|
37
|
+
export type UseChartProZoomSignature = ChartPluginSignature<{
|
|
38
|
+
params: UseChartProZoomParameters;
|
|
39
|
+
defaultizedParams: UseChartProZoomDefaultizedParameters;
|
|
40
|
+
state: UseChartProZoomState;
|
|
41
|
+
publicAPI: UseChartProZoomPublicApi;
|
|
42
|
+
instance: UseChartProZoomInstance;
|
|
43
|
+
dependencies: [UseChartSeriesSignature, UseChartCartesianAxisSignature];
|
|
44
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DefaultizedZoomOptions, ZoomData } from '@mui/x-charts/internals';
|
|
2
|
+
/**
|
|
3
|
+
* Helper to get the range (in percents of a reference range) corresponding to a given scale.
|
|
4
|
+
* @param centerRatio {number} The ratio of the point that should not move between the previous and next range.
|
|
5
|
+
* @param scaleRatio {number} The target scale ratio.
|
|
6
|
+
* @returns The range to display.
|
|
7
|
+
*/
|
|
8
|
+
export declare const zoomAtPoint: (centerRatio: number, scaleRatio: number, currentZoomData: ZoomData, options: DefaultizedZoomOptions) => number[];
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the new span is valid.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSpanValid(minRange: number, maxRange: number, isZoomIn: boolean, option: DefaultizedZoomOptions): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Get the scale ratio and if it's a zoom in or out from a wheel event.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getWheelScaleRatio(event: WheelEvent, step: number): {
|
|
17
|
+
scaleRatio: number;
|
|
18
|
+
isZoomIn: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPinchScaleRatio(curDiff: number, prevDiff: number, step: number): {
|
|
24
|
+
scaleRatio: number;
|
|
25
|
+
isZoomIn: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare function getDiff(eventCache: PointerEvent[]): number;
|
|
28
|
+
/**
|
|
29
|
+
* Get the ratio of the point in the horizontal center of the area.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getHorizontalCenterRatio(point: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}, area: {
|
|
35
|
+
left: number;
|
|
36
|
+
width: number;
|
|
37
|
+
}): number;
|
|
38
|
+
export declare function preventDefault(event: TouchEvent): void;
|
|
39
|
+
export declare function getVerticalCenterRatio(point: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}, area: {
|
|
43
|
+
top: number;
|
|
44
|
+
height: number;
|
|
45
|
+
}): number;
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDiff = getDiff;
|
|
7
|
-
exports.getHorizontalCenterRatio = getHorizontalCenterRatio;
|
|
8
|
-
exports.getPinchScaleRatio = getPinchScaleRatio;
|
|
9
|
-
exports.getVerticalCenterRatio = getVerticalCenterRatio;
|
|
10
|
-
exports.getWheelScaleRatio = getWheelScaleRatio;
|
|
11
|
-
exports.isSpanValid = isSpanValid;
|
|
12
|
-
exports.preventDefault = preventDefault;
|
|
13
|
-
exports.zoomAtPoint = void 0;
|
|
14
1
|
/**
|
|
15
2
|
* Helper to get the range (in percents of a reference range) corresponding to a given scale.
|
|
16
3
|
* @param centerRatio {number} The ratio of the point that should not move between the previous and next range.
|
|
17
4
|
* @param scaleRatio {number} The target scale ratio.
|
|
18
5
|
* @returns The range to display.
|
|
19
6
|
*/
|
|
20
|
-
const zoomAtPoint = (centerRatio, scaleRatio, currentZoomData, options) => {
|
|
7
|
+
export const zoomAtPoint = (centerRatio, scaleRatio, currentZoomData, options) => {
|
|
21
8
|
const MIN_RANGE = options.minStart;
|
|
22
9
|
const MAX_RANGE = options.maxEnd;
|
|
23
10
|
const MIN_ALLOWED_SPAN = options.minSpan;
|
|
@@ -49,8 +36,7 @@ const zoomAtPoint = (centerRatio, scaleRatio, currentZoomData, options) => {
|
|
|
49
36
|
/**
|
|
50
37
|
* Checks if the new span is valid.
|
|
51
38
|
*/
|
|
52
|
-
|
|
53
|
-
function isSpanValid(minRange, maxRange, isZoomIn, option) {
|
|
39
|
+
export function isSpanValid(minRange, maxRange, isZoomIn, option) {
|
|
54
40
|
const newSpanPercent = maxRange - minRange;
|
|
55
41
|
if (isZoomIn && newSpanPercent < option.minSpan || !isZoomIn && newSpanPercent > option.maxSpan) {
|
|
56
42
|
return false;
|
|
@@ -77,7 +63,7 @@ function getMultiplier(event) {
|
|
|
77
63
|
/**
|
|
78
64
|
* Get the scale ratio and if it's a zoom in or out from a wheel event.
|
|
79
65
|
*/
|
|
80
|
-
function getWheelScaleRatio(event, step) {
|
|
66
|
+
export function getWheelScaleRatio(event, step) {
|
|
81
67
|
const deltaY = -event.deltaY;
|
|
82
68
|
const multiplier = getMultiplier(event);
|
|
83
69
|
const scaledStep = step * multiplier * deltaY / 1000;
|
|
@@ -93,7 +79,7 @@ function getWheelScaleRatio(event, step) {
|
|
|
93
79
|
/**
|
|
94
80
|
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
95
81
|
*/
|
|
96
|
-
function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
82
|
+
export function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
97
83
|
const scaledStep = step / 1000;
|
|
98
84
|
let scaleRatio = 0;
|
|
99
85
|
let isZoomIn = false;
|
|
@@ -113,7 +99,7 @@ function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
|
113
99
|
isZoomIn
|
|
114
100
|
};
|
|
115
101
|
}
|
|
116
|
-
function getDiff(eventCache) {
|
|
102
|
+
export function getDiff(eventCache) {
|
|
117
103
|
const [firstEvent, secondEvent] = eventCache;
|
|
118
104
|
return Math.hypot(firstEvent.pageX - secondEvent.pageX, firstEvent.pageY - secondEvent.pageY);
|
|
119
105
|
}
|
|
@@ -121,17 +107,17 @@ function getDiff(eventCache) {
|
|
|
121
107
|
/**
|
|
122
108
|
* Get the ratio of the point in the horizontal center of the area.
|
|
123
109
|
*/
|
|
124
|
-
function getHorizontalCenterRatio(point, area) {
|
|
110
|
+
export function getHorizontalCenterRatio(point, area) {
|
|
125
111
|
const {
|
|
126
112
|
left,
|
|
127
113
|
width
|
|
128
114
|
} = area;
|
|
129
115
|
return (point.x - left) / width;
|
|
130
116
|
}
|
|
131
|
-
function preventDefault(event) {
|
|
117
|
+
export function preventDefault(event) {
|
|
132
118
|
event.preventDefault();
|
|
133
119
|
}
|
|
134
|
-
function getVerticalCenterRatio(point, area) {
|
|
120
|
+
export function getVerticalCenterRatio(point, area) {
|
|
135
121
|
const {
|
|
136
122
|
top,
|
|
137
123
|
height
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getReleaseInfo: () => any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
|
|
2
|
+
export const getReleaseInfo = () => {
|
|
3
|
+
const releaseInfo = "MTczOTc0NjgwMDAwMA==";
|
|
4
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5
|
+
// A simple hack to set the value in the test environment (has no build step).
|
|
6
|
+
// eslint-disable-next-line no-useless-concat
|
|
7
|
+
if (releaseInfo === '__RELEASE' + '_INFO__') {
|
|
8
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
9
|
+
return ponyfillGlobal.__MUI_RELEASE_INFO__;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return releaseInfo;
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
2
|
+
import { CommonDefaultizedProps, CommonSeriesType, CartesianSeriesType } from '@mui/x-charts/internals';
|
|
3
|
+
export type HeatmapValueType = [number, number, number];
|
|
4
|
+
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType>, 'color'>, CartesianSeriesType {
|
|
5
|
+
type: 'heatmap';
|
|
6
|
+
/**
|
|
7
|
+
* Data associated to each bar.
|
|
8
|
+
*/
|
|
9
|
+
data?: HeatmapValueType[];
|
|
10
|
+
/**
|
|
11
|
+
* The key used to retrieve data from the dataset.
|
|
12
|
+
*/
|
|
13
|
+
dataKey?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
16
|
+
*/
|
|
17
|
+
label?: string | ((location: 'tooltip' | 'legend') => string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An object that allows to identify a single bar.
|
|
21
|
+
* Used for item interaction
|
|
22
|
+
*/
|
|
23
|
+
export type HeatmapItemIdentifier = {
|
|
24
|
+
type: 'heatmap';
|
|
25
|
+
seriesId: DefaultizedHeatmapSeriesType['id'];
|
|
26
|
+
dataIndex: number;
|
|
27
|
+
};
|
|
28
|
+
export interface DefaultizedHeatmapSeriesType extends DefaultizedProps<HeatmapSeriesType, CommonDefaultizedProps> {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./heatmap.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./heatmap.js";
|
package/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module","sideEffects":false}
|