@mui/x-charts 8.11.3 → 8.12.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.d.ts +2 -2
- package/BarChart/BarChart.js +1 -0
- package/BarChart/BarChart.plugins.d.ts +3 -2
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/BarElement.js +10 -2
- package/BarChart/index.d.ts +1 -0
- package/BarChart/index.js +12 -0
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/CHANGELOG.md +151 -6
- package/ChartContainer/ChartContainer.js +4 -2
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/ChartsSurface/ChartsSurface.js +21 -2
- package/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/ChartsWrapper/ChartsWrapper.js +49 -46
- package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/LineChart/FocusedMark.d.ts +2 -0
- package/LineChart/FocusedMark.js +44 -0
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +3 -1
- package/LineChart/LineChart.plugins.d.ts +3 -2
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/index.d.ts +1 -0
- package/LineChart/index.js +12 -0
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/PieChart/PieArc.d.ts +1 -0
- package/PieChart/PieArc.js +7 -3
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.js +1 -0
- package/PieChart/PieChart.plugins.d.ts +2 -1
- package/PieChart/PieChart.plugins.js +2 -1
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +9 -1
- package/PieChart/index.d.ts +1 -0
- package/PieChart/index.js +12 -0
- package/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/RadarChart/index.d.ts +2 -1
- package/RadarChart/index.js +12 -0
- package/RadarChart/useRadarChartProps.d.ts +2 -2
- package/ScatterChart/BatchScatter.d.ts +32 -0
- package/ScatterChart/BatchScatter.js +171 -0
- package/ScatterChart/Scatter.js +13 -5
- package/ScatterChart/ScatterChart.d.ts +4 -4
- package/ScatterChart/ScatterChart.js +13 -2
- package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/ScatterChart/ScatterChart.plugins.js +3 -2
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +14 -2
- package/ScatterChart/index.d.ts +1 -0
- package/ScatterChart/index.js +12 -0
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +8 -5
- package/SparkLineChart/SparkLineChart.js +10 -5
- package/Toolbar/Toolbar.js +1 -2
- package/colorPalettes/types.d.ts +1 -1
- package/context/ChartApi.d.ts +6 -6
- package/esm/BarChart/BarChart.d.ts +2 -2
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarChart.plugins.d.ts +3 -2
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/BarElement.js +10 -2
- package/esm/BarChart/index.d.ts +1 -0
- package/esm/BarChart/index.js +1 -0
- package/esm/BarChart/useBarChartProps.d.ts +2 -2
- package/esm/ChartContainer/ChartContainer.js +4 -2
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/esm/ChartsSurface/ChartsSurface.js +21 -2
- package/esm/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/esm/ChartsWrapper/ChartsWrapper.js +49 -46
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/LineChart/FocusedMark.d.ts +2 -0
- package/esm/LineChart/FocusedMark.js +38 -0
- package/esm/LineChart/LineChart.d.ts +2 -2
- package/esm/LineChart/LineChart.js +3 -1
- package/esm/LineChart/LineChart.plugins.d.ts +3 -2
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/index.d.ts +1 -0
- package/esm/LineChart/index.js +1 -0
- package/esm/LineChart/useLineChartProps.d.ts +2 -2
- package/esm/PieChart/PieArc.d.ts +1 -0
- package/esm/PieChart/PieArc.js +7 -3
- package/esm/PieChart/PieArcPlot.js +1 -0
- package/esm/PieChart/PieChart.js +1 -0
- package/esm/PieChart/PieChart.plugins.d.ts +2 -1
- package/esm/PieChart/PieChart.plugins.js +2 -1
- package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/esm/PieChart/dataTransform/useTransformData.js +9 -1
- package/esm/PieChart/index.d.ts +1 -0
- package/esm/PieChart/index.js +1 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/esm/RadarChart/index.d.ts +2 -1
- package/esm/RadarChart/index.js +2 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
- package/esm/ScatterChart/BatchScatter.d.ts +32 -0
- package/esm/ScatterChart/BatchScatter.js +165 -0
- package/esm/ScatterChart/Scatter.js +13 -5
- package/esm/ScatterChart/ScatterChart.d.ts +4 -4
- package/esm/ScatterChart/ScatterChart.js +13 -2
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
- package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
- package/esm/ScatterChart/ScatterPlot.js +14 -2
- package/esm/ScatterChart/index.d.ts +1 -0
- package/esm/ScatterChart/index.js +1 -0
- package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +8 -5
- package/esm/SparkLineChart/SparkLineChart.js +10 -5
- package/esm/Toolbar/Toolbar.js +1 -2
- package/esm/colorPalettes/types.d.ts +1 -1
- package/esm/context/ChartApi.d.ts +6 -6
- package/esm/hooks/useAxis.d.ts +5 -5
- package/esm/hooks/useDrawingArea.d.ts +20 -2
- package/esm/hooks/useFocusedItem.d.ts +15 -0
- package/esm/hooks/useFocusedItem.js +20 -0
- package/esm/hooks/useIsItemFocused.d.ts +12 -0
- package/esm/hooks/useIsItemFocused.js +15 -0
- package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/esm/hooks/useIsItemFocusedGetter.js +14 -0
- package/esm/hooks/useScale.js +6 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/internals/animation/Transition.js +1 -3
- package/esm/internals/index.d.ts +3 -2
- package/esm/internals/index.js +3 -2
- package/esm/internals/plugins/allPlugins.d.ts +5 -4
- package/esm/internals/plugins/allPlugins.js +3 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +123 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +46 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +32 -21
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +9 -7
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +3 -0
- package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
- package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +32 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +88 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +210 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +7 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/esm/internals/scaleGuards.d.ts +7 -0
- package/esm/internals/scaleGuards.js +6 -0
- package/esm/locales/elGR.d.ts +96 -0
- package/esm/locales/elGR.js +100 -0
- package/esm/locales/enUS.d.ts +96 -0
- package/esm/locales/enUS.js +99 -1
- package/esm/locales/frFR.d.ts +96 -0
- package/esm/locales/frFR.js +100 -2
- package/esm/locales/ptBR.d.ts +96 -0
- package/esm/locales/ptBR.js +100 -0
- package/esm/locales/ptPT.d.ts +96 -0
- package/esm/locales/ptPT.js +100 -0
- package/esm/locales/svSE.d.ts +97 -1
- package/esm/locales/svSE.js +100 -0
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
- package/esm/plugins/index.d.ts +6 -0
- package/esm/plugins/index.js +12 -0
- package/hooks/useAxis.d.ts +5 -5
- package/hooks/useDrawingArea.d.ts +20 -2
- package/hooks/useFocusedItem.d.ts +15 -0
- package/hooks/useFocusedItem.js +26 -0
- package/hooks/useIsItemFocused.d.ts +12 -0
- package/hooks/useIsItemFocused.js +20 -0
- package/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/hooks/useIsItemFocusedGetter.js +18 -0
- package/hooks/useScale.js +6 -0
- package/index.d.ts +1 -0
- package/index.js +13 -1
- package/internals/animation/Transition.js +0 -2
- package/internals/index.d.ts +3 -2
- package/internals/index.js +20 -8
- package/internals/plugins/allPlugins.d.ts +5 -4
- package/internals/plugins/allPlugins.js +3 -2
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +134 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +47 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +33 -22
- package/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/index.js +27 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
- package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +11 -9
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +9 -0
- package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
- package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
- package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +41 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +6 -1
- package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +9 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +27 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +96 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +218 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/internals/scaleGuards.d.ts +7 -0
- package/internals/scaleGuards.js +8 -0
- package/locales/elGR.d.ts +96 -0
- package/locales/elGR.js +100 -0
- package/locales/enUS.d.ts +96 -0
- package/locales/enUS.js +99 -1
- package/locales/frFR.d.ts +96 -0
- package/locales/frFR.js +100 -2
- package/locales/ptBR.d.ts +96 -0
- package/locales/ptBR.js +100 -0
- package/locales/ptPT.d.ts +96 -0
- package/locales/ptPT.js +100 -0
- package/locales/svSE.d.ts +97 -1
- package/locales/svSE.js +100 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/locales/utils/getChartsLocalization.d.ts +96 -0
- package/package.json +4 -4
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
- package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
- /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
- /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.applyDomainLimit = applyDomainLimit;
|
|
8
|
+
exports.getActualAxisExtrema = getActualAxisExtrema;
|
|
9
|
+
exports.getDomainLimit = getDomainLimit;
|
|
10
|
+
exports.getXAxesScales = getXAxesScales;
|
|
11
|
+
exports.getYAxesScales = getYAxesScales;
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
14
|
+
var _axis = require("../../../../models/axis");
|
|
15
|
+
var _zoom = require("./zoom");
|
|
16
|
+
var _getAxisDomainLimit = require("./getAxisDomainLimit");
|
|
17
|
+
var _ticks = require("../../../ticks");
|
|
18
|
+
var _getScale = require("../../../getScale");
|
|
19
|
+
var _getAxisExtrema = require("./getAxisExtrema");
|
|
20
|
+
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
21
|
+
function getRange(drawingArea, axisDirection, axis) {
|
|
22
|
+
const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
23
|
+
return axis.reverse ? [range[1], range[0]] : range;
|
|
24
|
+
}
|
|
25
|
+
function getXAxesScales({
|
|
26
|
+
drawingArea,
|
|
27
|
+
formattedSeries,
|
|
28
|
+
axis: axes = [],
|
|
29
|
+
seriesConfig,
|
|
30
|
+
zoomMap,
|
|
31
|
+
preferStrictDomainInLineCharts
|
|
32
|
+
}) {
|
|
33
|
+
const scales = {};
|
|
34
|
+
axes.forEach((eachAxis, axisIndex) => {
|
|
35
|
+
const axis = eachAxis;
|
|
36
|
+
const zoom = zoomMap?.get(axis.id);
|
|
37
|
+
scales[axis.id] = getAxisScale(axis, 'x', zoom, drawingArea, seriesConfig, axisIndex, formattedSeries, preferStrictDomainInLineCharts);
|
|
38
|
+
});
|
|
39
|
+
return scales;
|
|
40
|
+
}
|
|
41
|
+
function getYAxesScales({
|
|
42
|
+
drawingArea,
|
|
43
|
+
formattedSeries,
|
|
44
|
+
axis: axes = [],
|
|
45
|
+
seriesConfig,
|
|
46
|
+
zoomMap,
|
|
47
|
+
preferStrictDomainInLineCharts
|
|
48
|
+
}) {
|
|
49
|
+
const scales = {};
|
|
50
|
+
axes.forEach((eachAxis, axisIndex) => {
|
|
51
|
+
const axis = eachAxis;
|
|
52
|
+
const zoom = zoomMap?.get(axis.id);
|
|
53
|
+
scales[axis.id] = getAxisScale(axis, 'y', zoom, drawingArea, seriesConfig, axisIndex, formattedSeries, preferStrictDomainInLineCharts);
|
|
54
|
+
});
|
|
55
|
+
return scales;
|
|
56
|
+
}
|
|
57
|
+
function getAxisScale(axis, axisDirection, zoom, drawingArea, seriesConfig, axisIndex, formattedSeries,
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated To remove in v9. This is an experimental feature to avoid breaking change.
|
|
60
|
+
*/
|
|
61
|
+
preferStrictDomainInLineCharts) {
|
|
62
|
+
const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
|
|
63
|
+
const range = getRange(drawingArea, axisDirection, axis);
|
|
64
|
+
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
65
|
+
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
66
|
+
// Reverse range because ordinal scales are presented from top to bottom on y-axis
|
|
67
|
+
const scaleRange = axisDirection === 'y' ? [range[1], range[0]] : range;
|
|
68
|
+
const zoomedRange = (0, _zoom.zoomScaleRange)(scaleRange, zoomRange);
|
|
69
|
+
return {
|
|
70
|
+
scale: (0, _d3Scale.scaleBand)(axis.data, zoomedRange).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
74
|
+
const scaleRange = axisDirection === 'y' ? [...range].reverse() : range;
|
|
75
|
+
const zoomedRange = (0, _zoom.zoomScaleRange)(scaleRange, zoomRange);
|
|
76
|
+
return {
|
|
77
|
+
scale: (0, _d3Scale.scalePoint)(axis.data, zoomedRange)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const scaleType = axis.scaleType ?? 'linear';
|
|
81
|
+
const domainLimit = getDomainLimit(axis, axisDirection, axisIndex, formattedSeries, preferStrictDomainInLineCharts);
|
|
82
|
+
const [minData, maxData] = (0, _getAxisExtrema.getAxisExtrema)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
|
|
83
|
+
const axisExtrema = getActualAxisExtrema(axis, minData, maxData);
|
|
84
|
+
if (typeof domainLimit === 'function') {
|
|
85
|
+
const {
|
|
86
|
+
min,
|
|
87
|
+
max
|
|
88
|
+
} = domainLimit(minData, maxData);
|
|
89
|
+
axisExtrema[0] = min;
|
|
90
|
+
axisExtrema[1] = max;
|
|
91
|
+
}
|
|
92
|
+
const rawTickNumber = (0, _ticks.getTickNumber)((0, _extends2.default)({}, axis, {
|
|
93
|
+
range,
|
|
94
|
+
domain: axisExtrema
|
|
95
|
+
}));
|
|
96
|
+
const zoomedRange = (0, _zoom.zoomScaleRange)(range, zoomRange);
|
|
97
|
+
const scale = (0, _getScale.getScale)(scaleType, axisExtrema, zoomedRange);
|
|
98
|
+
if ((0, _axis.isSymlogScaleConfig)(axis) && axis.constant != null) {
|
|
99
|
+
scale.constant(axis.constant);
|
|
100
|
+
}
|
|
101
|
+
applyDomainLimit(scale, axis, domainLimit, rawTickNumber);
|
|
102
|
+
return {
|
|
103
|
+
scale,
|
|
104
|
+
tickNumber: rawTickNumber
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function getDomainLimit(axis, axisDirection, axisIndex, formattedSeries, preferStrictDomainInLineCharts) {
|
|
108
|
+
return preferStrictDomainInLineCharts ? (0, _getAxisDomainLimit.getAxisDomainLimit)(axis, axisDirection, axisIndex, formattedSeries) : axis.domainLimit ?? 'nice';
|
|
109
|
+
}
|
|
110
|
+
function applyDomainLimit(scale, axis, domainLimit, rawTickNumber) {
|
|
111
|
+
if (domainLimit === 'nice') {
|
|
112
|
+
scale.nice(rawTickNumber);
|
|
113
|
+
}
|
|
114
|
+
const [minDomain, maxDomain] = scale.domain();
|
|
115
|
+
scale.domain([axis.min ?? minDomain, axis.max ?? maxDomain]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get the actual axis extrema considering the user defined min and max values.
|
|
120
|
+
* @param axisExtrema User defined axis extrema.
|
|
121
|
+
* @param minData Minimum value from the data.
|
|
122
|
+
* @param maxData Maximum value from the data.
|
|
123
|
+
*/
|
|
124
|
+
function getActualAxisExtrema(axisExtrema, minData, maxData) {
|
|
125
|
+
let min = minData;
|
|
126
|
+
let max = maxData;
|
|
127
|
+
if (axisExtrema.max != null && axisExtrema.max.valueOf() < minData) {
|
|
128
|
+
min = axisExtrema.max;
|
|
129
|
+
}
|
|
130
|
+
if (axisExtrema.min != null && axisExtrema.min.valueOf() > minData) {
|
|
131
|
+
max = axisExtrema.min;
|
|
132
|
+
}
|
|
133
|
+
return [axisExtrema.min ?? min, axisExtrema.max ?? max];
|
|
134
|
+
}
|
|
@@ -23,6 +23,7 @@ var _getSVGPoint = require("../../../getSVGPoint");
|
|
|
23
23
|
var _useChartInteraction = require("../useChartInteraction");
|
|
24
24
|
var _useChartCartesianInteraction = require("./useChartCartesianInteraction.selectors");
|
|
25
25
|
var _useLazySelectorEffect = require("../../utils/useLazySelectorEffect");
|
|
26
|
+
var _checkHasInteractionPlugin = require("../useChartInteraction/checkHasInteractionPlugin");
|
|
26
27
|
const useChartCartesianAxis = ({
|
|
27
28
|
params,
|
|
28
29
|
store,
|
|
@@ -106,26 +107,27 @@ const useChartCartesianAxis = ({
|
|
|
106
107
|
onHighlightedAxisChange(nextAxisInteraction);
|
|
107
108
|
}
|
|
108
109
|
}, !onHighlightedAxisChange);
|
|
110
|
+
const hasInteractionPlugin = (0, _checkHasInteractionPlugin.checkHasInteractionPlugin)(instance);
|
|
109
111
|
React.useEffect(() => {
|
|
110
112
|
const element = svgRef.current;
|
|
111
|
-
if (!isInteractionEnabled || !element || params.disableAxisListener) {
|
|
113
|
+
if (!isInteractionEnabled || !hasInteractionPlugin || !element || params.disableAxisListener) {
|
|
112
114
|
return () => {};
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
// Clean the interaction when the mouse leaves the chart.
|
|
116
118
|
const moveEndHandler = instance.addInteractionListener('moveEnd', event => {
|
|
117
119
|
if (!event.detail.activeGestures.pan) {
|
|
118
|
-
instance.cleanInteraction
|
|
120
|
+
instance.cleanInteraction();
|
|
119
121
|
}
|
|
120
122
|
});
|
|
121
123
|
const panEndHandler = instance.addInteractionListener('panEnd', event => {
|
|
122
124
|
if (!event.detail.activeGestures.move) {
|
|
123
|
-
instance.cleanInteraction
|
|
125
|
+
instance.cleanInteraction();
|
|
124
126
|
}
|
|
125
127
|
});
|
|
126
128
|
const pressEndHandler = instance.addInteractionListener('quickPressEnd', event => {
|
|
127
129
|
if (!event.detail.activeGestures.move && !event.detail.activeGestures.pan) {
|
|
128
|
-
instance.cleanInteraction
|
|
130
|
+
instance.cleanInteraction();
|
|
129
131
|
}
|
|
130
132
|
});
|
|
131
133
|
const gestureHandler = event => {
|
|
@@ -142,7 +144,7 @@ const useChartCartesianAxis = ({
|
|
|
142
144
|
instance.cleanInteraction?.();
|
|
143
145
|
return;
|
|
144
146
|
}
|
|
145
|
-
instance.setPointerCoordinate
|
|
147
|
+
instance.setPointerCoordinate(svgPoint);
|
|
146
148
|
};
|
|
147
149
|
const moveHandler = instance.addInteractionListener('move', gestureHandler);
|
|
148
150
|
const panHandler = instance.addInteractionListener('pan', gestureHandler);
|
|
@@ -155,7 +157,7 @@ const useChartCartesianAxis = ({
|
|
|
155
157
|
pressHandler.cleanup();
|
|
156
158
|
pressEndHandler.cleanup();
|
|
157
159
|
};
|
|
158
|
-
}, [svgRef, store, xAxisWithScale, usedXAxis, yAxisWithScale, usedYAxis, instance, params.disableAxisListener, isInteractionEnabled]);
|
|
160
|
+
}, [svgRef, store, xAxisWithScale, usedXAxis, yAxisWithScale, usedYAxis, instance, params.disableAxisListener, isInteractionEnabled, hasInteractionPlugin]);
|
|
159
161
|
React.useEffect(() => {
|
|
160
162
|
const element = svgRef.current;
|
|
161
163
|
const onAxisClick = params.onAxisClick;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AxisId } from "../../../../models/axis.js";
|
|
2
|
+
export declare const selectorChartPreviewXScales: import("reselect").Selector<any, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, [axisId: AxisId]>;
|
|
2
3
|
export declare const selectorChartPreviewComputedXAxis: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").ComputedAxisConfig<import("../../../index.js").ChartsXAxisProps>, [axisId: AxisId]>;
|
|
4
|
+
export declare const selectorChartPreviewYScales: import("reselect").Selector<any, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, [axisId: AxisId]>;
|
|
3
5
|
export declare const selectorChartPreviewComputedYAxis: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").ComputedAxisConfig<import("../../../index.js").ChartsYAxisProps>, [axisId: AxisId]>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedXAxis = void 0;
|
|
6
|
+
exports.selectorChartPreviewYScales = exports.selectorChartPreviewXScales = exports.selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedXAxis = void 0;
|
|
7
7
|
var _selectors = require("../../utils/selectors");
|
|
8
8
|
var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
|
|
9
9
|
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
@@ -11,6 +11,8 @@ var _computeAxisValue = require("./computeAxisValue");
|
|
|
11
11
|
var _useChartCartesianAxisRendering = require("./useChartCartesianAxisRendering.selectors");
|
|
12
12
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
13
13
|
var _constants = require("../../../constants");
|
|
14
|
+
var _useChartExperimentalFeature = require("../../corePlugins/useChartExperimentalFeature");
|
|
15
|
+
var _getAxisScale = require("./getAxisScale");
|
|
14
16
|
function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
|
|
15
17
|
return axisDirection === 'x' ? {
|
|
16
18
|
left: 0,
|
|
@@ -28,7 +30,25 @@ function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
|
|
|
28
30
|
bottom: mainChartDrawingArea.height
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
|
-
const
|
|
33
|
+
const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewXScales(xAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
|
|
34
|
+
const hasAxis = xAxes?.some(axis => axis.id === axisId);
|
|
35
|
+
const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
|
|
36
|
+
const options = zoomOptions[axisId];
|
|
37
|
+
const zoomMap = new Map([[axisId, {
|
|
38
|
+
axisId,
|
|
39
|
+
start: options.minStart,
|
|
40
|
+
end: options.maxEnd
|
|
41
|
+
}]]);
|
|
42
|
+
return (0, _getAxisScale.getXAxesScales)({
|
|
43
|
+
drawingArea,
|
|
44
|
+
formattedSeries,
|
|
45
|
+
axis: xAxes,
|
|
46
|
+
seriesConfig,
|
|
47
|
+
zoomMap,
|
|
48
|
+
preferStrictDomainInLineCharts
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartCartesianAxisRendering.selectorChartZoomAxisFilters, _useChartDimensions.selectorChartDrawingArea, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartPreviewXScales, (_, axisId) => axisId], (xAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
|
|
32
52
|
const hasAxis = xAxes?.some(axis => axis.id === axisId);
|
|
33
53
|
const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
|
|
34
54
|
const options = zoomOptions[axisId];
|
|
@@ -38,6 +58,7 @@ const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXA
|
|
|
38
58
|
end: options.maxEnd
|
|
39
59
|
}]]);
|
|
40
60
|
const computedAxes = (0, _computeAxisValue.computeAxisValue)({
|
|
61
|
+
scales,
|
|
41
62
|
drawingArea,
|
|
42
63
|
formattedSeries,
|
|
43
64
|
axis: xAxes,
|
|
@@ -45,7 +66,8 @@ const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXA
|
|
|
45
66
|
axisDirection: 'x',
|
|
46
67
|
zoomMap,
|
|
47
68
|
zoomOptions,
|
|
48
|
-
getFilters
|
|
69
|
+
getFilters,
|
|
70
|
+
preferStrictDomainInLineCharts
|
|
49
71
|
});
|
|
50
72
|
if (computedAxes.axis[axisId]) {
|
|
51
73
|
return {
|
|
@@ -54,7 +76,25 @@ const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXA
|
|
|
54
76
|
}
|
|
55
77
|
return computedAxes.axis;
|
|
56
78
|
});
|
|
57
|
-
const
|
|
79
|
+
const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewYScales(yAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
|
|
80
|
+
const hasAxis = yAxes?.some(axis => axis.id === axisId);
|
|
81
|
+
const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
|
|
82
|
+
const options = zoomOptions[axisId];
|
|
83
|
+
const zoomMap = new Map([[axisId, {
|
|
84
|
+
axisId,
|
|
85
|
+
start: options.minStart,
|
|
86
|
+
end: options.maxEnd
|
|
87
|
+
}]]);
|
|
88
|
+
return (0, _getAxisScale.getYAxesScales)({
|
|
89
|
+
drawingArea,
|
|
90
|
+
formattedSeries,
|
|
91
|
+
axis: yAxes,
|
|
92
|
+
seriesConfig,
|
|
93
|
+
zoomMap,
|
|
94
|
+
preferStrictDomainInLineCharts
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
const selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartCartesianAxisRendering.selectorChartZoomAxisFilters, _useChartDimensions.selectorChartDrawingArea, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartPreviewYScales, (_, axisId) => axisId], (yAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
|
|
58
98
|
const hasAxis = yAxes?.some(axis => axis.id === axisId);
|
|
59
99
|
const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
|
|
60
100
|
const options = zoomOptions[axisId];
|
|
@@ -64,6 +104,7 @@ const selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedYA
|
|
|
64
104
|
end: options.maxEnd
|
|
65
105
|
}]]);
|
|
66
106
|
const computedAxes = (0, _computeAxisValue.computeAxisValue)({
|
|
107
|
+
scales,
|
|
67
108
|
drawingArea,
|
|
68
109
|
formattedSeries,
|
|
69
110
|
axis: yAxes,
|
|
@@ -71,7 +112,8 @@ const selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedYA
|
|
|
71
112
|
axisDirection: 'y',
|
|
72
113
|
zoomMap,
|
|
73
114
|
zoomOptions,
|
|
74
|
-
getFilters
|
|
115
|
+
getFilters,
|
|
116
|
+
preferStrictDomainInLineCharts
|
|
75
117
|
});
|
|
76
118
|
if (computedAxes.axis[axisId]) {
|
|
77
119
|
return {
|
|
@@ -23,6 +23,16 @@ export declare const selectorChartZoomOptionsLookup: import("reselect").Selector
|
|
|
23
23
|
[x: number]: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions;
|
|
24
24
|
}, []>;
|
|
25
25
|
export declare const selectorChartAxisZoomOptionsLookup: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions, [axisId: AxisId]>;
|
|
26
|
+
export declare const selectorChartXScales: 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.types.js").UseChartCartesianAxisState> & {
|
|
27
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
|
+
} & Partial<{}> & {
|
|
29
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
30
|
+
}, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, []>;
|
|
31
|
+
export declare const selectorChartYScales: 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.types.js").UseChartCartesianAxisState> & {
|
|
32
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
33
|
+
} & Partial<{}> & {
|
|
34
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
35
|
+
}, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, []>;
|
|
26
36
|
export declare const selectorChartZoomAxisFilters: 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.types.js").UseChartCartesianAxisState> & {
|
|
27
37
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
38
|
} & {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomAxisFilters = exports.selectorChartYAxis = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxis = exports.createZoomMap = void 0;
|
|
7
|
+
exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomAxisFilters = exports.selectorChartYScales = exports.selectorChartYAxis = exports.selectorChartXScales = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxis = exports.createZoomMap = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
10
10
|
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
@@ -14,6 +14,7 @@ var _createAxisFilterMapper = require("./createAxisFilterMapper");
|
|
|
14
14
|
var _createZoomLookup = require("./createZoomLookup");
|
|
15
15
|
var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
|
|
16
16
|
var _useChartExperimentalFeature = require("../../corePlugins/useChartExperimentalFeature");
|
|
17
|
+
var _getAxisScale = require("./getAxisScale");
|
|
17
18
|
const createZoomMap = zoom => {
|
|
18
19
|
const zoomItemMap = new Map();
|
|
19
20
|
zoom.forEach(zoomItem => {
|
|
@@ -32,34 +33,42 @@ const selectorChartZoomIsInteracting = exports.selectorChartZoomIsInteracting =
|
|
|
32
33
|
const selectorChartZoomMap = exports.selectorChartZoomMap = (0, _selectors.createSelector)([selectorChartZoomState], zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
|
|
33
34
|
const selectorChartZoomOptionsLookup = exports.selectorChartZoomOptionsLookup = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis], (xAxis, yAxis) => (0, _extends2.default)({}, (0, _createZoomLookup.createZoomLookup)('x')(xAxis), (0, _createZoomLookup.createZoomLookup)('y')(yAxis)));
|
|
34
35
|
const selectorChartAxisZoomOptionsLookup = exports.selectorChartAxisZoomOptionsLookup = (0, _selectors.createSelector)([selectorChartZoomOptionsLookup, (_, axisId) => axisId], (axisLookup, axisId) => axisLookup[axisId]);
|
|
35
|
-
const selectorChartXFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
const selectorChartXFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)(zoomMap, zoomOptions, 'x'));
|
|
37
|
+
const selectorChartYFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)(zoomMap, zoomOptions, 'y'));
|
|
38
|
+
const selectorChartXScales = exports.selectorChartXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts], function selectorChartXScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
|
|
39
|
+
return (0, _getAxisScale.getXAxesScales)({
|
|
40
|
+
drawingArea,
|
|
41
|
+
formattedSeries,
|
|
42
|
+
axis,
|
|
43
|
+
seriesConfig,
|
|
44
|
+
zoomMap,
|
|
45
|
+
preferStrictDomainInLineCharts
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
const selectorChartYScales = exports.selectorChartYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts], function selectorChartYScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
|
|
49
|
+
return (0, _getAxisScale.getYAxesScales)({
|
|
50
|
+
drawingArea,
|
|
51
|
+
formattedSeries,
|
|
52
|
+
axis,
|
|
53
|
+
seriesConfig,
|
|
54
|
+
zoomMap,
|
|
55
|
+
preferStrictDomainInLineCharts
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0, _selectors.createSelector)([selectorChartXFilter, selectorChartYFilter, _useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartXScales, selectorChartYScales], (xMapper, yMapper, xAxis, yAxis, xScales, yScales) => {
|
|
50
59
|
if (xMapper === undefined || yMapper === undefined) {
|
|
51
60
|
// Early return if there is no zoom.
|
|
52
61
|
return undefined;
|
|
53
62
|
}
|
|
54
|
-
const xFilters = xAxis?.reduce((acc, axis
|
|
55
|
-
const filter = xMapper(axis,
|
|
63
|
+
const xFilters = xAxis?.reduce((acc, axis) => {
|
|
64
|
+
const filter = xMapper(axis.id, axis.data, xScales[axis.id].scale);
|
|
56
65
|
if (filter !== null) {
|
|
57
66
|
acc[axis.id] = filter;
|
|
58
67
|
}
|
|
59
68
|
return acc;
|
|
60
69
|
}, {});
|
|
61
|
-
const yFilters = yAxis?.reduce((acc, axis
|
|
62
|
-
const filter = yMapper(axis,
|
|
70
|
+
const yFilters = yAxis?.reduce((acc, axis) => {
|
|
71
|
+
const filter = yMapper(axis.id, axis.data, yScales[axis.id].scale);
|
|
63
72
|
if (filter !== null) {
|
|
64
73
|
acc[axis.id] = filter;
|
|
65
74
|
}
|
|
@@ -75,7 +84,8 @@ const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0,
|
|
|
75
84
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
76
85
|
*/
|
|
77
86
|
|
|
78
|
-
const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts) => (0, _computeAxisValue.computeAxisValue)({
|
|
87
|
+
const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartXScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => (0, _computeAxisValue.computeAxisValue)({
|
|
88
|
+
scales,
|
|
79
89
|
drawingArea,
|
|
80
90
|
formattedSeries,
|
|
81
91
|
axis,
|
|
@@ -86,7 +96,8 @@ const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSel
|
|
|
86
96
|
getFilters,
|
|
87
97
|
preferStrictDomainInLineCharts
|
|
88
98
|
}));
|
|
89
|
-
const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts) => (0, _computeAxisValue.computeAxisValue)({
|
|
99
|
+
const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartYScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => (0, _computeAxisValue.computeAxisValue)({
|
|
100
|
+
scales,
|
|
90
101
|
drawingArea,
|
|
91
102
|
formattedSeries,
|
|
92
103
|
axis,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useChartClosestPoint: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "useChartClosestPoint", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _useChartClosestPoint.useChartClosestPoint;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _useChartClosestPoint = require("./useChartClosestPoint");
|
|
16
|
+
var _useChartClosestPoint2 = require("./useChartClosestPoint.selectors");
|
|
17
|
+
Object.keys(_useChartClosestPoint2).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _useChartClosestPoint2[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useChartClosestPoint2[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -6,7 +6,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.
|
|
9
|
+
exports.useChartClosestPoint = void 0;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
@@ -18,7 +18,7 @@ var _useSelector = require("../../../store/useSelector");
|
|
|
18
18
|
var _useChartCartesianAxis = require("../useChartCartesianAxis");
|
|
19
19
|
var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
|
|
20
20
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
21
|
-
const
|
|
21
|
+
const useChartClosestPoint = ({
|
|
22
22
|
svgRef,
|
|
23
23
|
params,
|
|
24
24
|
store,
|
|
@@ -93,7 +93,8 @@ const useChartVoronoi = ({
|
|
|
93
93
|
seriesId,
|
|
94
94
|
seriesIndexes,
|
|
95
95
|
startIndex: points.length,
|
|
96
|
-
endIndex: points.length + seriesPoints.length
|
|
96
|
+
endIndex: points.length + seriesPoints.length,
|
|
97
|
+
markerSize: series[seriesId].markerSize
|
|
97
98
|
};
|
|
98
99
|
points = points.concat(seriesPoints);
|
|
99
100
|
});
|
|
@@ -130,11 +131,12 @@ const useChartVoronoi = ({
|
|
|
130
131
|
// The point index in the series with id=closestSeries.seriesId.
|
|
131
132
|
const seriesPointIndex = (2 * closestPointIndex - voronoiRef.current[closestSeries.seriesId].startIndex) / 2;
|
|
132
133
|
const dataIndex = voronoiRef.current[closestSeries.seriesId].seriesIndexes[seriesPointIndex];
|
|
133
|
-
|
|
134
|
+
const maxRadius = voronoiMaxRadius === 'item' ? closestSeries.markerSize : voronoiMaxRadius;
|
|
135
|
+
if (maxRadius !== undefined) {
|
|
134
136
|
const pointX = delauneyRef.current.points[2 * closestPointIndex];
|
|
135
137
|
const pointY = delauneyRef.current.points[2 * closestPointIndex + 1];
|
|
136
138
|
const dist2 = (pointX - svgPoint.x) ** 2 + (pointY - svgPoint.y) ** 2;
|
|
137
|
-
if (dist2 >
|
|
139
|
+
if (dist2 > maxRadius ** 2) {
|
|
138
140
|
// The closest point is too far to be considered.
|
|
139
141
|
return 'outside-voronoi-max-radius';
|
|
140
142
|
}
|
|
@@ -240,18 +242,18 @@ const useChartVoronoi = ({
|
|
|
240
242
|
}
|
|
241
243
|
};
|
|
242
244
|
};
|
|
243
|
-
exports.
|
|
244
|
-
|
|
245
|
+
exports.useChartClosestPoint = useChartClosestPoint;
|
|
246
|
+
useChartClosestPoint.getDefaultizedParams = ({
|
|
245
247
|
params
|
|
246
248
|
}) => (0, _extends2.default)({}, params, {
|
|
247
249
|
disableVoronoi: params.disableVoronoi ?? !params.series.some(item => item.type === 'scatter')
|
|
248
250
|
});
|
|
249
|
-
|
|
251
|
+
useChartClosestPoint.getInitialState = params => ({
|
|
250
252
|
voronoi: {
|
|
251
253
|
isVoronoiEnabled: !params.disableVoronoi
|
|
252
254
|
}
|
|
253
255
|
});
|
|
254
|
-
|
|
256
|
+
useChartClosestPoint.params = {
|
|
255
257
|
disableVoronoi: true,
|
|
256
258
|
voronoiMaxRadius: true,
|
|
257
259
|
onItemClick: true
|
package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const selectorChartsIsVoronoiEnabled: 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 & import("./useChartClosestPoint.types.js").UseChartVoronoiState & Partial<{}> & {
|
|
2
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3
|
+
} & {
|
|
4
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
+
}, boolean | undefined, any[]>;
|
package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorChartsIsVoronoiEnabled = void 0;
|
|
7
|
+
var _selectors = require("../../utils/selectors");
|
|
8
|
+
const selectVoronoi = state => state.voronoi;
|
|
9
|
+
const selectorChartsIsVoronoiEnabled = exports.selectorChartsIsVoronoiEnabled = (0, _selectors.createSelector)([selectVoronoi], voronoi => voronoi?.isVoronoiEnabled);
|
|
@@ -29,10 +29,11 @@ export interface UseChartVoronoiParameters {
|
|
|
29
29
|
*/
|
|
30
30
|
disableVoronoi?: boolean;
|
|
31
31
|
/**
|
|
32
|
-
* Defines the
|
|
32
|
+
* Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
|
|
33
|
+
* If set to `'item'`, the radius is the `markerSize`.
|
|
33
34
|
* If `undefined`, the radius is assumed to be infinite.
|
|
34
35
|
*/
|
|
35
|
-
voronoiMaxRadius?: number | undefined;
|
|
36
|
+
voronoiMaxRadius?: 'item' | number | undefined;
|
|
36
37
|
/**
|
|
37
38
|
* Callback fired when clicking close to an item.
|
|
38
39
|
* This is only available for scatter plot for now.
|
|
@@ -41,10 +42,13 @@ export interface UseChartVoronoiParameters {
|
|
|
41
42
|
*/
|
|
42
43
|
onItemClick?: (event: MouseEvent, scatterItemIdentifier: ScatterItemIdentifier) => void;
|
|
43
44
|
}
|
|
44
|
-
export type UseChartVoronoiDefaultizedParameters = UseChartVoronoiParameters & {
|
|
45
|
+
export type UseChartVoronoiDefaultizedParameters = Pick<UseChartVoronoiParameters, 'voronoiMaxRadius' | 'onItemClick'> & {
|
|
46
|
+
/**
|
|
47
|
+
* If true, the voronoi plugin is disabled.
|
|
48
|
+
*/
|
|
45
49
|
disableVoronoi: boolean;
|
|
46
50
|
};
|
|
47
|
-
export type
|
|
51
|
+
export type UseChartClosestPointSignature = ChartPluginSignature<{
|
|
48
52
|
instance: UseChartVoronoiInstance;
|
|
49
53
|
state: UseChartVoronoiState;
|
|
50
54
|
params: UseChartVoronoiParameters;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HighlightItemData } from "./useChartHighlight.types.js";
|
|
2
|
+
import { HighlightScope } from "./highlightConfig.types.js";
|
|
3
|
+
import { SeriesId } from "../../../../models/seriesType/common.js";
|
|
4
|
+
export declare function isSeriesHighlighted(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): boolean;
|
|
5
|
+
export declare function isSeriesFaded(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the data index of the highlighted item for a specific series.
|
|
8
|
+
* If the item is not highlighted, it returns `null`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSeriesHighlightedItem(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): number | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the data index of the "unfaded item" for a specific series.
|
|
13
|
+
* An "unfaded item" is the only item of a faded series that shouldn't be faded.
|
|
14
|
+
* If the series is not faded or if there is no highlighted item, it returns `null`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSeriesUnfadedItem(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): number | null | undefined;
|