@mui/x-charts 8.14.1 → 8.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +8 -0
- package/BarChart/BarChart.plugins.d.ts +2 -1
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/BarChart/seriesConfig/index.js +2 -0
- package/BarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/BarChart/seriesConfig/tooltipPosition.js +67 -0
- package/BarChart/useBarChartProps.js +4 -2
- package/BarChart/useBarPlotData.d.ts +17 -2
- package/BarChart/useBarPlotData.js +59 -34
- package/CHANGELOG.md +207 -0
- package/ChartContainer/ChartContainer.js +8 -0
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +9 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +102 -0
- package/ChartsBrushOverlay/index.d.ts +4 -0
- package/ChartsBrushOverlay/index.js +19 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +13 -8
- package/ChartsReferenceLine/ChartsYReferenceLine.js +13 -8
- package/ChartsReferenceLine/common.d.ts +3 -1
- package/ChartsReferenceLine/common.js +3 -1
- package/ChartsTooltip/ChartsTooltip.js +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +67 -23
- package/ChartsTooltip/useItemTooltip.js +7 -14
- package/ChartsWrapper/ChartsWrapper.js +2 -1
- package/ChartsXAxis/getVisibleLabels.js +45 -25
- package/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/LineChart/LineChart.js +8 -0
- package/LineChart/LineChart.plugins.d.ts +2 -1
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/LineChart/seriesConfig/index.js +2 -0
- package/LineChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/LineChart/seriesConfig/tooltipPosition.js +33 -0
- package/LineChart/useLineChartProps.js +4 -2
- package/PieChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/PieChart/seriesConfig/index.js +2 -0
- package/PieChart/seriesConfig/seriesProcessor.js +2 -1
- package/PieChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/PieChart/seriesConfig/tooltipPosition.js +75 -0
- package/RadarChart/RadarChart.plugins.d.ts +2 -2
- package/RadarChart/RadarChart.plugins.js +1 -1
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +1 -1
- package/RadarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/ScatterChart/ScatterChart.js +8 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/ScatterChart/seriesConfig/index.js +2 -0
- package/ScatterChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/ScatterChart/seriesConfig/tooltipPosition.js +33 -0
- package/ScatterChart/useScatterChartProps.js +5 -3
- package/SparkLineChart/SparkLineChart.js +8 -0
- package/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/BarChart/BarChart.js +8 -0
- package/esm/BarChart/BarChart.plugins.d.ts +2 -1
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/BarChart/seriesConfig/index.js +2 -0
- package/esm/BarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/BarChart/seriesConfig/tooltipPosition.js +61 -0
- package/esm/BarChart/useBarChartProps.js +4 -2
- package/esm/BarChart/useBarPlotData.d.ts +17 -2
- package/esm/BarChart/useBarPlotData.js +58 -34
- package/esm/ChartContainer/ChartContainer.js +8 -0
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -2
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -2
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +2 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +95 -0
- package/esm/ChartsBrushOverlay/index.d.ts +4 -0
- package/esm/ChartsBrushOverlay/index.js +2 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/common.d.ts +3 -1
- package/esm/ChartsReferenceLine/common.js +2 -0
- package/esm/ChartsTooltip/ChartsTooltip.js +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +68 -24
- package/esm/ChartsTooltip/useItemTooltip.js +9 -16
- package/esm/ChartsWrapper/ChartsWrapper.js +2 -1
- package/esm/ChartsXAxis/getVisibleLabels.js +45 -25
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/LineChart/LineChart.js +8 -0
- package/esm/LineChart/LineChart.plugins.d.ts +2 -1
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/LineChart/seriesConfig/index.js +2 -0
- package/esm/LineChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/LineChart/seriesConfig/tooltipPosition.js +27 -0
- package/esm/LineChart/useLineChartProps.js +4 -2
- package/esm/PieChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/esm/PieChart/seriesConfig/index.js +2 -0
- package/esm/PieChart/seriesConfig/seriesProcessor.js +2 -1
- package/esm/PieChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/PieChart/seriesConfig/tooltipPosition.js +69 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +2 -2
- package/esm/RadarChart/RadarChart.plugins.js +1 -1
- package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +1 -1
- package/esm/RadarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/ScatterChart/ScatterChart.js +8 -0
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
- package/esm/ScatterChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/ScatterChart/seriesConfig/index.js +2 -0
- package/esm/ScatterChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/tooltipPosition.js +27 -0
- package/esm/ScatterChart/useScatterChartProps.js +5 -3
- package/esm/SparkLineChart/SparkLineChart.js +8 -0
- package/esm/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useBrush.d.ts +18 -0
- package/esm/hooks/useBrush.js +16 -0
- package/esm/hooks/useFocusedItem.d.ts +1 -1
- package/esm/hooks/useInteractionItemProps.js +6 -2
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/configInit.d.ts +1 -1
- package/esm/internals/domUtils.d.ts +9 -4
- package/esm/internals/domUtils.js +115 -52
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.d.ts +3 -1
- package/esm/internals/index.js +3 -1
- package/esm/internals/isCartesian.d.ts +3 -2
- package/esm/internals/isCartesian.js +3 -0
- package/esm/internals/plugins/allPlugins.d.ts +4 -3
- package/esm/internals/plugins/allPlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +19 -10
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +6 -4
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +126 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +75 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +81 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +5 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +40 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +4 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +5 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +8 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +21 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -6
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +4 -3
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -1
- package/esm/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/esm/internals/plugins/models/seriesConfig/index.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +24 -0
- package/esm/internals/plugins/utils/selectors.d.ts +1 -1
- package/esm/internals/scales/index.d.ts +3 -0
- package/esm/internals/scales/index.js +3 -0
- package/esm/internals/scales/scaleBand.d.ts +25 -0
- package/esm/internals/scales/scaleBand.js +159 -0
- package/esm/internals/scales/scalePoint.d.ts +25 -0
- package/esm/internals/scales/scalePoint.js +41 -0
- package/esm/internals/scales/scaleSymlog.d.ts +38 -0
- package/esm/internals/{symlogScale.js → scales/scaleSymlog.js} +40 -2
- package/esm/locales/elGR.js +97 -99
- package/esm/models/seriesType/common.d.ts +3 -2
- package/esm/tests/constants.js +1 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +12 -0
- package/hooks/useBrush.d.ts +18 -0
- package/hooks/useBrush.js +21 -0
- package/hooks/useFocusedItem.d.ts +1 -1
- package/hooks/useInteractionItemProps.js +6 -2
- package/index.d.ts +2 -1
- package/index.js +13 -1
- package/internals/configInit.d.ts +1 -1
- package/internals/domUtils.d.ts +9 -4
- package/internals/domUtils.js +119 -54
- package/internals/getScale.js +2 -2
- package/internals/index.d.ts +3 -1
- package/internals/index.js +24 -0
- package/internals/isCartesian.d.ts +3 -2
- package/internals/isCartesian.js +4 -0
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +19 -10
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +6 -4
- package/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/index.js +38 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +134 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +81 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +2 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +46 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +10 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +5 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +7 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +21 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +14 -7
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +4 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +3 -3
- package/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/internals/plugins/models/seriesConfig/index.js +11 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +24 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.js +5 -0
- package/internals/plugins/utils/selectors.d.ts +1 -1
- package/internals/scales/index.d.ts +3 -0
- package/internals/scales/index.js +38 -0
- package/internals/scales/scaleBand.d.ts +25 -0
- package/internals/scales/scaleBand.js +167 -0
- package/internals/scales/scalePoint.d.ts +25 -0
- package/internals/scales/scalePoint.js +46 -0
- package/internals/scales/scaleSymlog.d.ts +38 -0
- package/internals/{symlogScale.js → scales/scaleSymlog.js} +39 -2
- package/locales/elGR.js +97 -99
- package/models/seriesType/common.d.ts +3 -2
- package/package.json +4 -4
- package/tests/constants.js +7 -0
- package/esm/internals/Flatbush.bench.js +0 -42
- package/esm/internals/symlogScale.d.ts +0 -2
- package/internals/Flatbush.bench.js +0 -44
- package/internals/symlogScale.d.ts +0 -2
- /package/esm/internals/{Flatbush.bench.d.ts → plugins/featurePlugins/useChartBrush/useChartBrush.types.js} +0 -0
- /package/{internals/Flatbush.bench.d.ts → esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.js} +0 -0
package/internals/getScale.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getScale = getScale;
|
|
7
7
|
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
8
|
-
var
|
|
8
|
+
var _scales = require("./scales");
|
|
9
9
|
function getScale(scaleType, domain, range) {
|
|
10
10
|
switch (scaleType) {
|
|
11
11
|
case 'log':
|
|
@@ -19,7 +19,7 @@ function getScale(scaleType, domain, range) {
|
|
|
19
19
|
case 'utc':
|
|
20
20
|
return (0, _d3Scale.scaleUtc)(domain, range);
|
|
21
21
|
case 'symlog':
|
|
22
|
-
return (0,
|
|
22
|
+
return (0, _scales.scaleSymlog)(domain, range);
|
|
23
23
|
default:
|
|
24
24
|
return (0, _d3Scale.scaleLinear)(domain, range);
|
|
25
25
|
}
|
package/internals/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./plugins/featurePlugins/useChartInteraction/index.js";
|
|
|
27
27
|
export * from "./plugins/featurePlugins/useChartHighlight/index.js";
|
|
28
28
|
export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
29
29
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
30
|
+
export * from "./plugins/featurePlugins/useChartBrush/index.js";
|
|
30
31
|
export * from "./plugins/utils/selectors.js";
|
|
31
32
|
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
|
|
32
33
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
|
@@ -65,4 +66,5 @@ export * from "../models/axis.js";
|
|
|
65
66
|
export * from "./plugins/models/index.js";
|
|
66
67
|
export * from "./material/index.js";
|
|
67
68
|
export * from "./createSvgIcon.js";
|
|
68
|
-
export * from "./constants.js";
|
|
69
|
+
export * from "./constants.js";
|
|
70
|
+
export * from "./scales/index.js";
|
package/internals/index.js
CHANGED
|
@@ -326,6 +326,18 @@ Object.keys(_useChartClosestPoint).forEach(function (key) {
|
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
|
+
var _useChartBrush = require("./plugins/featurePlugins/useChartBrush");
|
|
330
|
+
Object.keys(_useChartBrush).forEach(function (key) {
|
|
331
|
+
if (key === "default" || key === "__esModule") return;
|
|
332
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
333
|
+
if (key in exports && exports[key] === _useChartBrush[key]) return;
|
|
334
|
+
Object.defineProperty(exports, key, {
|
|
335
|
+
enumerable: true,
|
|
336
|
+
get: function () {
|
|
337
|
+
return _useChartBrush[key];
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
});
|
|
329
341
|
var _selectors = require("./plugins/utils/selectors");
|
|
330
342
|
Object.keys(_selectors).forEach(function (key) {
|
|
331
343
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -760,4 +772,16 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
760
772
|
return _constants[key];
|
|
761
773
|
}
|
|
762
774
|
});
|
|
775
|
+
});
|
|
776
|
+
var _scales = require("./scales");
|
|
777
|
+
Object.keys(_scales).forEach(function (key) {
|
|
778
|
+
if (key === "default" || key === "__esModule") return;
|
|
779
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
780
|
+
if (key in exports && exports[key] === _scales[key]) return;
|
|
781
|
+
Object.defineProperty(exports, key, {
|
|
782
|
+
enumerable: true,
|
|
783
|
+
get: function () {
|
|
784
|
+
return _scales[key];
|
|
785
|
+
}
|
|
786
|
+
});
|
|
763
787
|
});
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { CartesianChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
-
export declare function isCartesianSeriesType(seriesType: string): seriesType is CartesianChartSeriesType;
|
|
1
|
+
import { CartesianChartSeriesType, ChartSeriesDefaultized, ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
+
export declare function isCartesianSeriesType(seriesType: string): seriesType is CartesianChartSeriesType;
|
|
3
|
+
export declare function isCartesianSeries(series: ChartSeriesDefaultized<ChartSeriesType>): series is ChartSeriesDefaultized<CartesianChartSeriesType>;
|
package/internals/isCartesian.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.isCartesianSeries = isCartesianSeries;
|
|
6
7
|
exports.isCartesianSeriesType = isCartesianSeriesType;
|
|
7
8
|
var _configInit = require("./configInit");
|
|
8
9
|
function isCartesianSeriesType(seriesType) {
|
|
9
10
|
return _configInit.cartesianSeriesTypes.getTypes().has(seriesType);
|
|
11
|
+
}
|
|
12
|
+
function isCartesianSeries(series) {
|
|
13
|
+
return isCartesianSeriesType(series.type);
|
|
10
14
|
}
|
|
@@ -6,6 +6,7 @@ import { UseChartKeyboardNavigationSignature } from "./featurePlugins/useChartKe
|
|
|
6
6
|
import { UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarAxis/index.js";
|
|
7
7
|
import { UseChartClosestPointSignature } from "./featurePlugins/useChartClosestPoint/index.js";
|
|
8
8
|
import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
|
|
9
|
-
|
|
10
|
-
export type
|
|
11
|
-
export
|
|
9
|
+
import { UseChartBrushSignature } from "./featurePlugins/useChartBrush/index.js";
|
|
10
|
+
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
11
|
+
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<TSeries>, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
12
|
+
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
|
|
@@ -10,6 +10,7 @@ var _useChartInteraction = require("./featurePlugins/useChartInteraction");
|
|
|
10
10
|
var _useChartKeyboardNavigation = require("./featurePlugins/useChartKeyboardNavigation");
|
|
11
11
|
var _useChartClosestPoint = require("./featurePlugins/useChartClosestPoint");
|
|
12
12
|
var _useChartZAxis = require("./featurePlugins/useChartZAxis");
|
|
13
|
+
var _useChartBrush = require("./featurePlugins/useChartBrush");
|
|
13
14
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
14
15
|
|
|
15
|
-
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis,
|
|
16
|
+
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js
CHANGED
|
@@ -24,14 +24,26 @@ const useChartInteractionListener = ({
|
|
|
24
24
|
name: 'pan',
|
|
25
25
|
threshold: 0,
|
|
26
26
|
maxPointers: 1
|
|
27
|
+
}), new _core.MoveGesture({
|
|
28
|
+
name: 'move',
|
|
29
|
+
preventIf: ['pan', 'zoomPinch', 'zoomPan']
|
|
30
|
+
}), new _core.TapGesture({
|
|
31
|
+
name: 'tap',
|
|
32
|
+
preventIf: ['pan', 'zoomPinch', 'zoomPan']
|
|
33
|
+
}), new _core.PressGesture({
|
|
34
|
+
name: 'quickPress',
|
|
35
|
+
duration: 50
|
|
27
36
|
}), new _core.PanGesture({
|
|
37
|
+
name: 'brush',
|
|
38
|
+
threshold: 0,
|
|
39
|
+
maxPointers: 1
|
|
40
|
+
}),
|
|
41
|
+
// Zoom gestures
|
|
42
|
+
new _core.PanGesture({
|
|
28
43
|
name: 'zoomPan',
|
|
29
44
|
threshold: 0,
|
|
30
45
|
maxPointers: 1,
|
|
31
46
|
preventIf: ['zoomTapAndDrag', 'zoomPressAndDrag']
|
|
32
|
-
}), new _core.MoveGesture({
|
|
33
|
-
name: 'move',
|
|
34
|
-
preventIf: ['pan', 'zoomPinch', 'zoomPan'] // Prevent move gesture when pan is active
|
|
35
47
|
}), new _core.PinchGesture({
|
|
36
48
|
name: 'zoomPinch',
|
|
37
49
|
threshold: 5,
|
|
@@ -40,12 +52,6 @@ const useChartInteractionListener = ({
|
|
|
40
52
|
name: 'zoomTurnWheel',
|
|
41
53
|
sensitivity: 0.01,
|
|
42
54
|
initialDelta: 1
|
|
43
|
-
}), new _core.TapGesture({
|
|
44
|
-
name: 'tap',
|
|
45
|
-
preventIf: ['pan', 'zoomPan', 'zoomPinch']
|
|
46
|
-
}), new _core.PressGesture({
|
|
47
|
-
name: 'quickPress',
|
|
48
|
-
duration: 50
|
|
49
55
|
}), new _core.TapAndDragGesture({
|
|
50
56
|
name: 'zoomTapAndDrag',
|
|
51
57
|
dragThreshold: 10
|
|
@@ -53,6 +59,9 @@ const useChartInteractionListener = ({
|
|
|
53
59
|
name: 'zoomPressAndDrag',
|
|
54
60
|
dragThreshold: 10,
|
|
55
61
|
preventIf: ['zoomPinch']
|
|
62
|
+
}), new _core.TapGesture({
|
|
63
|
+
name: 'zoomDoubleTapReset',
|
|
64
|
+
taps: 2
|
|
56
65
|
})]
|
|
57
66
|
});
|
|
58
67
|
}
|
|
@@ -62,7 +71,7 @@ const useChartInteractionListener = ({
|
|
|
62
71
|
if (!svg || !gestureManager) {
|
|
63
72
|
return undefined;
|
|
64
73
|
}
|
|
65
|
-
gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag'], svg);
|
|
74
|
+
gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'zoomDoubleTapReset', 'brush'], svg);
|
|
66
75
|
return () => {
|
|
67
76
|
// Cleanup gesture manager
|
|
68
77
|
gestureManager.unregisterAllGestures(svg);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type PressAndDragEvent, type PressAndDragGestureOptions, type TapAndDragEvent, type TapAndDragGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
|
|
1
|
+
import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type PressAndDragEvent, type PressAndDragGestureOptions, type TapAndDragEvent, type TapAndDragGestureOptions, type TapGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
|
|
2
2
|
import { ChartPluginSignature } from "../../models/index.js";
|
|
3
|
-
export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd';
|
|
3
|
+
export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'zoomDoubleTapReset' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
|
|
4
4
|
export type InteractionListenerResult = {
|
|
5
5
|
cleanup: () => void;
|
|
6
6
|
};
|
|
7
7
|
export type AddInteractionListener = {
|
|
8
|
-
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd', callback: (event: PanEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
8
|
+
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd', callback: (event: PanEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
9
9
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd', callback: (event: PinchEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
10
10
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
11
11
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'move' | 'moveStart' | 'moveEnd', callback: (event: MoveEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
12
|
-
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
12
|
+
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap' | 'zoomDoubleTapReset', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
13
13
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'quickPress' | 'quickPressEnd', callback: (event: PressEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
14
14
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd', callback: (event: TapAndDragEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
15
15
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd', callback: (event: PressAndDragEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
@@ -20,6 +20,8 @@ export type UpdateZoomInteractionListeners = {
|
|
|
20
20
|
(interaction: 'zoomTurnWheel', options?: Omit<TurnWheelGestureOptions<'zoomTurnWheel'>, 'name'>): void;
|
|
21
21
|
(interaction: 'zoomTapAndDrag', options?: Omit<TapAndDragGestureOptions<'zoomTapAndDrag'>, 'name'>): void;
|
|
22
22
|
(interaction: 'zoomPressAndDrag', options?: Omit<PressAndDragGestureOptions<'zoomPressAndDrag'>, 'name'>): void;
|
|
23
|
+
(interaction: 'zoomDoubleTapReset', options?: Omit<TapGestureOptions<'zoomDoubleTapReset'>, 'name'>): void;
|
|
24
|
+
(interaction: 'brush', options?: Omit<PanGestureOptions<'brush'>, 'name'>): void;
|
|
23
25
|
};
|
|
24
26
|
export interface UseChartInteractionListenerParameters {}
|
|
25
27
|
export interface UseChartInteractionListenerState {}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useChartBrush = require("./useChartBrush");
|
|
7
|
+
Object.keys(_useChartBrush).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useChartBrush[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useChartBrush[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _useChartBrush2 = require("./useChartBrush.types");
|
|
18
|
+
Object.keys(_useChartBrush2).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useChartBrush2[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useChartBrush2[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _useChartBrush3 = require("./useChartBrush.selectors");
|
|
29
|
+
Object.keys(_useChartBrush3).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _useChartBrush3[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _useChartBrush3[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.useChartBrush = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
|
+
var _getSVGPoint = require("../../../getSVGPoint");
|
|
15
|
+
var _useSelector = require("../../../store/useSelector");
|
|
16
|
+
var _useChartBrush = require("./useChartBrush.selectors");
|
|
17
|
+
const useChartBrush = ({
|
|
18
|
+
store,
|
|
19
|
+
svgRef,
|
|
20
|
+
instance,
|
|
21
|
+
params
|
|
22
|
+
}) => {
|
|
23
|
+
const isEnabled = (0, _useSelector.useSelector)(store, _useChartBrush.selectorIsBrushEnabled);
|
|
24
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
25
|
+
store.update(prev => {
|
|
26
|
+
return (0, _extends2.default)({}, prev, {
|
|
27
|
+
brush: (0, _extends2.default)({}, prev.brush, {
|
|
28
|
+
enabled: params.brushConfig.enabled,
|
|
29
|
+
preventTooltip: params.brushConfig.preventTooltip,
|
|
30
|
+
preventHighlight: params.brushConfig.preventHighlight
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}, [store, params.brushConfig.enabled, params.brushConfig.preventTooltip, params.brushConfig.preventHighlight]);
|
|
35
|
+
const setBrushCoordinates = (0, _useEventCallback.default)(function setBrushCoordinates(point) {
|
|
36
|
+
store.update(prev => {
|
|
37
|
+
return (0, _extends2.default)({}, prev, {
|
|
38
|
+
brush: (0, _extends2.default)({}, prev.brush, {
|
|
39
|
+
start: prev.brush.start ?? point,
|
|
40
|
+
current: point
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
const clearBrush = (0, _useEventCallback.default)(function clearBrush() {
|
|
46
|
+
store.update(prev => {
|
|
47
|
+
return (0, _extends2.default)({}, prev, {
|
|
48
|
+
brush: (0, _extends2.default)({}, prev.brush, {
|
|
49
|
+
start: null,
|
|
50
|
+
current: null
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const setZoomBrushEnabled = (0, _useEventCallback.default)(function setZoomBrushEnabled(enabled) {
|
|
56
|
+
store.update(prev => {
|
|
57
|
+
if (prev.brush.isZoomBrushEnabled === enabled) {
|
|
58
|
+
return prev;
|
|
59
|
+
}
|
|
60
|
+
return (0, _extends2.default)({}, prev, {
|
|
61
|
+
brush: (0, _extends2.default)({}, prev.brush, {
|
|
62
|
+
isZoomBrushEnabled: enabled
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
const element = svgRef.current;
|
|
69
|
+
if (element === null || !isEnabled) {
|
|
70
|
+
return () => {};
|
|
71
|
+
}
|
|
72
|
+
const handleBrushStart = event => {
|
|
73
|
+
if (event.detail.target?.closest('[data-charts-zoom-slider]')) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const point = (0, _getSVGPoint.getSVGPoint)(element, {
|
|
77
|
+
clientX: event.detail.initialCentroid.x,
|
|
78
|
+
clientY: event.detail.initialCentroid.y
|
|
79
|
+
});
|
|
80
|
+
setBrushCoordinates(point);
|
|
81
|
+
};
|
|
82
|
+
const handleBrush = event => {
|
|
83
|
+
const currentPoint = (0, _getSVGPoint.getSVGPoint)(element, {
|
|
84
|
+
clientX: event.detail.centroid.x,
|
|
85
|
+
clientY: event.detail.centroid.y
|
|
86
|
+
});
|
|
87
|
+
setBrushCoordinates(currentPoint);
|
|
88
|
+
};
|
|
89
|
+
const brushStartHandler = instance.addInteractionListener('brushStart', handleBrushStart);
|
|
90
|
+
const brushHandler = instance.addInteractionListener('brush', handleBrush);
|
|
91
|
+
const brushCancelHandler = instance.addInteractionListener('brushCancel', clearBrush);
|
|
92
|
+
const brushEndHandler = instance.addInteractionListener('brushEnd', clearBrush);
|
|
93
|
+
return () => {
|
|
94
|
+
brushStartHandler.cleanup();
|
|
95
|
+
brushHandler.cleanup();
|
|
96
|
+
brushEndHandler.cleanup();
|
|
97
|
+
brushCancelHandler.cleanup();
|
|
98
|
+
};
|
|
99
|
+
}, [svgRef, instance, store, clearBrush, setBrushCoordinates, isEnabled]);
|
|
100
|
+
return {
|
|
101
|
+
instance: {
|
|
102
|
+
setBrushCoordinates,
|
|
103
|
+
clearBrush,
|
|
104
|
+
setZoomBrushEnabled
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
exports.useChartBrush = useChartBrush;
|
|
109
|
+
useChartBrush.params = {
|
|
110
|
+
brushConfig: true
|
|
111
|
+
};
|
|
112
|
+
useChartBrush.getDefaultizedParams = ({
|
|
113
|
+
params
|
|
114
|
+
}) => {
|
|
115
|
+
return (0, _extends2.default)({}, params, {
|
|
116
|
+
brushConfig: {
|
|
117
|
+
enabled: params?.brushConfig?.enabled ?? false,
|
|
118
|
+
preventTooltip: params?.brushConfig?.preventTooltip ?? true,
|
|
119
|
+
preventHighlight: params?.brushConfig?.preventHighlight ?? true
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
useChartBrush.getInitialState = params => {
|
|
124
|
+
return {
|
|
125
|
+
brush: {
|
|
126
|
+
enabled: params.brushConfig.enabled,
|
|
127
|
+
isZoomBrushEnabled: false,
|
|
128
|
+
preventTooltip: params.brushConfig.preventTooltip,
|
|
129
|
+
preventHighlight: params.brushConfig.preventHighlight,
|
|
130
|
+
start: null,
|
|
131
|
+
current: null
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type ChartOptionalRootSelector } from "../../utils/selectors.js";
|
|
2
|
+
import type { UseChartBrushSignature } from "./useChartBrush.types.js";
|
|
3
|
+
export declare const selectorBrush: ChartOptionalRootSelector<UseChartBrushSignature>;
|
|
4
|
+
export declare const selectorBrushStart: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
5
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
6
|
+
} & {
|
|
7
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
|
+
}, import("./useChartBrush.types.js").Point | null | undefined, any[]>;
|
|
9
|
+
export declare const selectorBrushCurrent: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
10
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
11
|
+
} & {
|
|
12
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
13
|
+
}, import("./useChartBrush.types.js").Point | null | undefined, any[]>;
|
|
14
|
+
export declare const selectorBrushStartX: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
15
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
16
|
+
} & {
|
|
17
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
18
|
+
}, number | null, any[]>;
|
|
19
|
+
export declare const selectorBrushStartY: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
20
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
21
|
+
} & {
|
|
22
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
23
|
+
}, number | null, any[]>;
|
|
24
|
+
export declare const selectorBrushCurrentX: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
25
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
26
|
+
} & {
|
|
27
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
|
+
}, number | null, any[]>;
|
|
29
|
+
export declare const selectorBrushCurrentY: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
30
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
31
|
+
} & {
|
|
32
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
33
|
+
}, number | null, any[]>;
|
|
34
|
+
export declare const selectorBrushState: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
35
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
36
|
+
} & {
|
|
37
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
38
|
+
}, {
|
|
39
|
+
start: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|
|
43
|
+
current: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
};
|
|
47
|
+
} | null, any[]>;
|
|
48
|
+
export declare const selectorBrushConfigNoZoom: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
49
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
50
|
+
} & {
|
|
51
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
52
|
+
}, "x" | "y" | "xy", any[]>;
|
|
53
|
+
export declare const selectorBrushConfigZoom: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("../useChartCartesianAxis/index.js").UseChartCartesianAxisState> & {
|
|
54
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
55
|
+
} & {
|
|
56
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
57
|
+
}, "x" | "y" | "xy" | null, []>;
|
|
58
|
+
export declare const selectorBrushConfig: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
59
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
60
|
+
} & {
|
|
61
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
62
|
+
} & Partial<import("../useChartCartesianAxis/index.js").UseChartCartesianAxisState>, "x" | "y" | "xy", any[]>;
|
|
63
|
+
export declare const selectorIsBrushEnabled: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
64
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
65
|
+
} & {
|
|
66
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
67
|
+
}, boolean | undefined, any[]>;
|
|
68
|
+
export declare const selectorIsBrushSelectionActive: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
69
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
70
|
+
} & {
|
|
71
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
72
|
+
}, boolean | undefined, any[]>;
|
|
73
|
+
export declare const selectorBrushShouldPreventAxisHighlight: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
74
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
75
|
+
} & {
|
|
76
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
77
|
+
}, boolean | undefined, any[]>;
|
|
78
|
+
export declare const selectorBrushShouldPreventTooltip: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartBrush.types.js").UseChartBrushState> & {
|
|
79
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
80
|
+
} & {
|
|
81
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
82
|
+
}, boolean | undefined, any[]>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorIsBrushSelectionActive = exports.selectorIsBrushEnabled = exports.selectorBrushState = exports.selectorBrushStartY = exports.selectorBrushStartX = exports.selectorBrushStart = exports.selectorBrushShouldPreventTooltip = exports.selectorBrushShouldPreventAxisHighlight = exports.selectorBrushCurrentY = exports.selectorBrushCurrentX = exports.selectorBrushCurrent = exports.selectorBrushConfigZoom = exports.selectorBrushConfigNoZoom = exports.selectorBrushConfig = exports.selectorBrush = void 0;
|
|
7
|
+
var _selectors = require("../../utils/selectors");
|
|
8
|
+
var _useChartCartesianAxis = require("../useChartCartesianAxis");
|
|
9
|
+
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
10
|
+
const selectorBrush = state => state.brush;
|
|
11
|
+
exports.selectorBrush = selectorBrush;
|
|
12
|
+
const selectorBrushStart = exports.selectorBrushStart = (0, _selectors.createSelector)([selectorBrush], brush => brush?.start);
|
|
13
|
+
const selectorBrushCurrent = exports.selectorBrushCurrent = (0, _selectors.createSelector)([selectorBrush], brush => brush?.current);
|
|
14
|
+
const selectorBrushStartX = exports.selectorBrushStartX = (0, _selectors.createSelector)([selectorBrush], brush => brush?.start?.x ?? null);
|
|
15
|
+
const selectorBrushStartY = exports.selectorBrushStartY = (0, _selectors.createSelector)([selectorBrush], brush => brush?.start?.y ?? null);
|
|
16
|
+
const selectorBrushCurrentX = exports.selectorBrushCurrentX = (0, _selectors.createSelector)([selectorBrush], brush => brush?.current?.x ?? null);
|
|
17
|
+
const selectorBrushCurrentY = exports.selectorBrushCurrentY = (0, _selectors.createSelector)([selectorBrush], brush => brush?.current?.y ?? null);
|
|
18
|
+
const selectorBrushState = exports.selectorBrushState = (0, _selectors.createSelector)([selectorBrushStartX, selectorBrushStartY, selectorBrushCurrentX, selectorBrushCurrentY], (startX, startY, currentX, currentY) => {
|
|
19
|
+
if (startX === null || startY === null || currentX === null || currentY === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
start: {
|
|
24
|
+
x: startX,
|
|
25
|
+
y: startY
|
|
26
|
+
},
|
|
27
|
+
current: {
|
|
28
|
+
x: currentX,
|
|
29
|
+
y: currentY
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const selectorBrushConfigNoZoom = exports.selectorBrushConfigNoZoom = (0, _selectors.createSelector)([_useChartSeries.selectorChartSeriesProcessed], series => {
|
|
34
|
+
let hasHorizontal = false;
|
|
35
|
+
let isBothDirections = false;
|
|
36
|
+
if (series) {
|
|
37
|
+
Object.entries(series).forEach(([seriesType, seriesData]) => {
|
|
38
|
+
if (Object.values(seriesData.series).some(s => s.layout === 'horizontal')) {
|
|
39
|
+
hasHorizontal = true;
|
|
40
|
+
}
|
|
41
|
+
if (seriesType === 'scatter' && seriesData.seriesOrder.length > 0) {
|
|
42
|
+
isBothDirections = true;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (isBothDirections) {
|
|
47
|
+
return 'xy';
|
|
48
|
+
}
|
|
49
|
+
if (hasHorizontal) {
|
|
50
|
+
return 'y';
|
|
51
|
+
}
|
|
52
|
+
return 'x';
|
|
53
|
+
});
|
|
54
|
+
const selectorBrushConfigZoom = exports.selectorBrushConfigZoom = (0, _selectors.createSelector)([_useChartCartesianAxis.selectorChartZoomOptionsLookup], optionsLookup => {
|
|
55
|
+
let hasX = false;
|
|
56
|
+
let hasY = false;
|
|
57
|
+
Object.values(optionsLookup).forEach(options => {
|
|
58
|
+
if (options.axisDirection === 'y') {
|
|
59
|
+
hasY = true;
|
|
60
|
+
}
|
|
61
|
+
if (options.axisDirection === 'x') {
|
|
62
|
+
hasX = true;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (hasX && hasY) {
|
|
66
|
+
return 'xy';
|
|
67
|
+
}
|
|
68
|
+
if (hasY) {
|
|
69
|
+
return 'y';
|
|
70
|
+
}
|
|
71
|
+
if (hasX) {
|
|
72
|
+
return 'x';
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
});
|
|
76
|
+
const selectorBrushConfig = exports.selectorBrushConfig = (0, _selectors.createSelector)([selectorBrushConfigNoZoom, selectorBrushConfigZoom], (configNoZoom, configZoom) => configZoom ?? configNoZoom);
|
|
77
|
+
const selectorIsBrushEnabled = exports.selectorIsBrushEnabled = (0, _selectors.createSelector)([selectorBrush], brush => brush?.enabled || brush?.isZoomBrushEnabled);
|
|
78
|
+
const selectorIsBrushSelectionActive = exports.selectorIsBrushSelectionActive = (0, _selectors.createSelector)([selectorIsBrushEnabled, selectorBrush], (isBrushEnabled, brush) => {
|
|
79
|
+
return isBrushEnabled && brush?.start !== null && brush?.current !== null;
|
|
80
|
+
});
|
|
81
|
+
const selectorBrushShouldPreventAxisHighlight = exports.selectorBrushShouldPreventAxisHighlight = (0, _selectors.createSelector)([selectorBrush, selectorIsBrushSelectionActive], (brush, isBrushSelectionActive) => isBrushSelectionActive && brush?.preventHighlight);
|
|
82
|
+
const selectorBrushShouldPreventTooltip = exports.selectorBrushShouldPreventTooltip = (0, _selectors.createSelector)([selectorBrush, selectorIsBrushSelectionActive], (brush, isBrushSelectionActive) => isBrushSelectionActive && brush?.preventTooltip);
|