@mui/x-charts 8.11.2 → 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 +2 -0
- package/BarChart/index.js +12 -0
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +4 -3
- package/CHANGELOG.md +231 -0
- package/ChartContainer/ChartContainer.js +4 -2
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
- package/ChartsLegend/ChartsLegend.js +2 -1
- package/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
- package/ChartsLegend/PiecewiseColorLegend.js +33 -22
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
- package/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
- package/ChartsSurface/ChartsSurface.js +22 -2
- package/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/ChartsWrapper/ChartsWrapper.js +87 -36
- package/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
- package/ChartsXAxis/ChartsXAxisImpl.js +3 -3
- package/ChartsXAxis/getVisibleLabels.js +5 -1
- package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
- package/ChartsYAxis/ChartsYAxisImpl.js +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/useAreaPlotData.js +2 -2
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +2 -1
- package/LineChart/useLinePlotData.js +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 +2 -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/RadarAxis/useRadarAxis.js +2 -2
- 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/RadarChart/useRadarChartProps.js +2 -1
- 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 +10 -6
- package/SparkLineChart/SparkLineChart.js +10 -5
- 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 +2 -0
- package/esm/BarChart/index.js +1 -0
- package/esm/BarChart/useBarChartProps.d.ts +2 -2
- package/esm/BarChart/useBarChartProps.js +4 -3
- package/esm/ChartContainer/ChartContainer.js +4 -2
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -1
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
- package/esm/ChartsLegend/PiecewiseColorLegend.js +33 -22
- package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
- package/esm/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
- package/esm/ChartsSurface/ChartsSurface.js +22 -2
- package/esm/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/esm/ChartsWrapper/ChartsWrapper.js +87 -36
- package/esm/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxisImpl.js +3 -3
- package/esm/ChartsXAxis/getVisibleLabels.js +5 -1
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxisImpl.js +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/useAreaPlotData.js +2 -2
- package/esm/LineChart/useLineChartProps.d.ts +2 -2
- package/esm/LineChart/useLineChartProps.js +2 -1
- package/esm/LineChart/useLinePlotData.js +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 +2 -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/RadarAxis/useRadarAxis.js +2 -2
- 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/RadarChart/useRadarChartProps.js +2 -1
- 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 +10 -6
- package/esm/SparkLineChart/SparkLineChart.js +10 -5
- 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 +8 -2
- package/esm/hooks/useTicks.js +2 -2
- package/esm/hooks/useTicksGrouped.js +2 -2
- 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 +4 -3
- package/esm/internals/index.js +4 -3
- package/esm/internals/invertScale.js +2 -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/{internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts → esm/internals/plugins/featurePlugins/useChartCartesianAxis/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/getAxisValue.js +3 -3
- 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/getAxisIndex.js +2 -2
- 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 +11 -0
- package/esm/internals/scaleGuards.js +9 -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/models/axis.d.ts +3 -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 +8 -2
- package/hooks/useTicks.js +2 -2
- package/hooks/useTicksGrouped.js +2 -2
- package/index.d.ts +1 -0
- package/index.js +13 -1
- package/internals/animation/Transition.js +0 -2
- package/internals/index.d.ts +4 -3
- package/internals/index.js +24 -12
- package/internals/invertScale.js +2 -2
- 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/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts → internals/plugins/featurePlugins/useChartCartesianAxis/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/getAxisValue.js +3 -3
- 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/getAxisIndex.js +2 -2
- 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 +11 -0
- package/internals/scaleGuards.js +17 -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/models/axis.d.ts +3 -0
- package/package.json +4 -4
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +47 -0
- package/esm/internals/isBandScale.d.ts +0 -5
- package/esm/internals/isBandScale.js +0 -3
- 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/isBandScale.d.ts +0 -5
- package/internals/isBandScale.js +0 -9
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isOrdinalScale } from "../../../scaleGuards.js";
|
|
2
2
|
function getAsANumber(value) {
|
|
3
3
|
return value instanceof Date ? value.getTime() : value;
|
|
4
4
|
}
|
|
@@ -13,7 +13,7 @@ export function getAxisIndex(axisConfig, pointerValue) {
|
|
|
13
13
|
data: axisData,
|
|
14
14
|
reverse
|
|
15
15
|
} = axisConfig;
|
|
16
|
-
if (!
|
|
16
|
+
if (!isOrdinalScale(scale)) {
|
|
17
17
|
const value = scale.invert(pointerValue);
|
|
18
18
|
if (axisData === undefined) {
|
|
19
19
|
return -1;
|
|
@@ -51,7 +51,7 @@ export function getAxisValue(axisConfig, pointerValue, dataIndex) {
|
|
|
51
51
|
scale,
|
|
52
52
|
data: axisData
|
|
53
53
|
} = axisConfig;
|
|
54
|
-
if (!
|
|
54
|
+
if (!isOrdinalScale(scale)) {
|
|
55
55
|
if (dataIndex === null) {
|
|
56
56
|
return scale.invert(pointerValue);
|
|
57
57
|
}
|
|
@@ -16,6 +16,7 @@ import { getSVGPoint } from "../../../getSVGPoint.js";
|
|
|
16
16
|
import { selectorChartsInteractionIsInitialized } from "../useChartInteraction/index.js";
|
|
17
17
|
import { selectorChartAxisInteraction } from "./useChartCartesianInteraction.selectors.js";
|
|
18
18
|
import { useLazySelectorEffect } from "../../utils/useLazySelectorEffect.js";
|
|
19
|
+
import { checkHasInteractionPlugin } from "../useChartInteraction/checkHasInteractionPlugin.js";
|
|
19
20
|
export const useChartCartesianAxis = ({
|
|
20
21
|
params,
|
|
21
22
|
store,
|
|
@@ -99,26 +100,27 @@ export const useChartCartesianAxis = ({
|
|
|
99
100
|
onHighlightedAxisChange(nextAxisInteraction);
|
|
100
101
|
}
|
|
101
102
|
}, !onHighlightedAxisChange);
|
|
103
|
+
const hasInteractionPlugin = checkHasInteractionPlugin(instance);
|
|
102
104
|
React.useEffect(() => {
|
|
103
105
|
const element = svgRef.current;
|
|
104
|
-
if (!isInteractionEnabled || !element || params.disableAxisListener) {
|
|
106
|
+
if (!isInteractionEnabled || !hasInteractionPlugin || !element || params.disableAxisListener) {
|
|
105
107
|
return () => {};
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
// Clean the interaction when the mouse leaves the chart.
|
|
109
111
|
const moveEndHandler = instance.addInteractionListener('moveEnd', event => {
|
|
110
112
|
if (!event.detail.activeGestures.pan) {
|
|
111
|
-
instance.cleanInteraction
|
|
113
|
+
instance.cleanInteraction();
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
116
|
const panEndHandler = instance.addInteractionListener('panEnd', event => {
|
|
115
117
|
if (!event.detail.activeGestures.move) {
|
|
116
|
-
instance.cleanInteraction
|
|
118
|
+
instance.cleanInteraction();
|
|
117
119
|
}
|
|
118
120
|
});
|
|
119
121
|
const pressEndHandler = instance.addInteractionListener('quickPressEnd', event => {
|
|
120
122
|
if (!event.detail.activeGestures.move && !event.detail.activeGestures.pan) {
|
|
121
|
-
instance.cleanInteraction
|
|
123
|
+
instance.cleanInteraction();
|
|
122
124
|
}
|
|
123
125
|
});
|
|
124
126
|
const gestureHandler = event => {
|
|
@@ -135,7 +137,7 @@ export const useChartCartesianAxis = ({
|
|
|
135
137
|
instance.cleanInteraction?.();
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
|
-
instance.setPointerCoordinate
|
|
140
|
+
instance.setPointerCoordinate(svgPoint);
|
|
139
141
|
};
|
|
140
142
|
const moveHandler = instance.addInteractionListener('move', gestureHandler);
|
|
141
143
|
const panHandler = instance.addInteractionListener('pan', gestureHandler);
|
|
@@ -148,7 +150,7 @@ export const useChartCartesianAxis = ({
|
|
|
148
150
|
pressHandler.cleanup();
|
|
149
151
|
pressEndHandler.cleanup();
|
|
150
152
|
};
|
|
151
|
-
}, [svgRef, store, xAxisWithScale, usedXAxis, yAxisWithScale, usedYAxis, instance, params.disableAxisListener, isInteractionEnabled]);
|
|
153
|
+
}, [svgRef, store, xAxisWithScale, usedXAxis, yAxisWithScale, usedYAxis, instance, params.disableAxisListener, isInteractionEnabled, hasInteractionPlugin]);
|
|
152
154
|
React.useEffect(() => {
|
|
153
155
|
const element = svgRef.current;
|
|
154
156
|
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]>;
|
|
@@ -5,6 +5,8 @@ import { computeAxisValue } from "./computeAxisValue.js";
|
|
|
5
5
|
import { selectorChartZoomAxisFilters, selectorChartZoomOptionsLookup } from "./useChartCartesianAxisRendering.selectors.js";
|
|
6
6
|
import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/index.js";
|
|
7
7
|
import { ZOOM_SLIDER_PREVIEW_SIZE } from "../../../constants.js";
|
|
8
|
+
import { selectorPreferStrictDomainInLineCharts } from "../../corePlugins/useChartExperimentalFeature/index.js";
|
|
9
|
+
import { getXAxesScales, getYAxesScales } from "./getAxisScale.js";
|
|
8
10
|
function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
|
|
9
11
|
return axisDirection === 'x' ? {
|
|
10
12
|
left: 0,
|
|
@@ -22,7 +24,25 @@ function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
|
|
|
22
24
|
bottom: mainChartDrawingArea.height
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
|
-
export const
|
|
27
|
+
export const selectorChartPreviewXScales = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewXScales(xAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
|
|
28
|
+
const hasAxis = xAxes?.some(axis => axis.id === axisId);
|
|
29
|
+
const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
|
|
30
|
+
const options = zoomOptions[axisId];
|
|
31
|
+
const zoomMap = new Map([[axisId, {
|
|
32
|
+
axisId,
|
|
33
|
+
start: options.minStart,
|
|
34
|
+
end: options.maxEnd
|
|
35
|
+
}]]);
|
|
36
|
+
return getXAxesScales({
|
|
37
|
+
drawingArea,
|
|
38
|
+
formattedSeries,
|
|
39
|
+
axis: xAxes,
|
|
40
|
+
seriesConfig,
|
|
41
|
+
zoomMap,
|
|
42
|
+
preferStrictDomainInLineCharts
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRawXAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorChartDrawingArea, selectorPreferStrictDomainInLineCharts, selectorChartPreviewXScales, (_, axisId) => axisId], (xAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
|
|
26
46
|
const hasAxis = xAxes?.some(axis => axis.id === axisId);
|
|
27
47
|
const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
|
|
28
48
|
const options = zoomOptions[axisId];
|
|
@@ -32,6 +52,7 @@ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRa
|
|
|
32
52
|
end: options.maxEnd
|
|
33
53
|
}]]);
|
|
34
54
|
const computedAxes = computeAxisValue({
|
|
55
|
+
scales,
|
|
35
56
|
drawingArea,
|
|
36
57
|
formattedSeries,
|
|
37
58
|
axis: xAxes,
|
|
@@ -39,7 +60,8 @@ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRa
|
|
|
39
60
|
axisDirection: 'x',
|
|
40
61
|
zoomMap,
|
|
41
62
|
zoomOptions,
|
|
42
|
-
getFilters
|
|
63
|
+
getFilters,
|
|
64
|
+
preferStrictDomainInLineCharts
|
|
43
65
|
});
|
|
44
66
|
if (computedAxes.axis[axisId]) {
|
|
45
67
|
return {
|
|
@@ -48,7 +70,25 @@ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRa
|
|
|
48
70
|
}
|
|
49
71
|
return computedAxes.axis;
|
|
50
72
|
});
|
|
51
|
-
export const
|
|
73
|
+
export const selectorChartPreviewYScales = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewYScales(yAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
|
|
74
|
+
const hasAxis = yAxes?.some(axis => axis.id === axisId);
|
|
75
|
+
const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
|
|
76
|
+
const options = zoomOptions[axisId];
|
|
77
|
+
const zoomMap = new Map([[axisId, {
|
|
78
|
+
axisId,
|
|
79
|
+
start: options.minStart,
|
|
80
|
+
end: options.maxEnd
|
|
81
|
+
}]]);
|
|
82
|
+
return getYAxesScales({
|
|
83
|
+
drawingArea,
|
|
84
|
+
formattedSeries,
|
|
85
|
+
axis: yAxes,
|
|
86
|
+
seriesConfig,
|
|
87
|
+
zoomMap,
|
|
88
|
+
preferStrictDomainInLineCharts
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRawYAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorChartDrawingArea, selectorPreferStrictDomainInLineCharts, selectorChartPreviewYScales, (_, axisId) => axisId], (yAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
|
|
52
92
|
const hasAxis = yAxes?.some(axis => axis.id === axisId);
|
|
53
93
|
const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
|
|
54
94
|
const options = zoomOptions[axisId];
|
|
@@ -58,6 +98,7 @@ export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRa
|
|
|
58
98
|
end: options.maxEnd
|
|
59
99
|
}]]);
|
|
60
100
|
const computedAxes = computeAxisValue({
|
|
101
|
+
scales,
|
|
61
102
|
drawingArea,
|
|
62
103
|
formattedSeries,
|
|
63
104
|
axis: yAxes,
|
|
@@ -65,7 +106,8 @@ export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRa
|
|
|
65
106
|
axisDirection: 'y',
|
|
66
107
|
zoomMap,
|
|
67
108
|
zoomOptions,
|
|
68
|
-
getFilters
|
|
109
|
+
getFilters,
|
|
110
|
+
preferStrictDomainInLineCharts
|
|
69
111
|
});
|
|
70
112
|
if (computedAxes.axis[axisId]) {
|
|
71
113
|
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
|
} & {
|
|
@@ -7,6 +7,7 @@ import { createAxisFilterMapper, createGetAxisFilters } from "./createAxisFilter
|
|
|
7
7
|
import { createZoomLookup } from "./createZoomLookup.js";
|
|
8
8
|
import { selectorChartRawXAxis, selectorChartRawYAxis } from "./useChartCartesianAxisLayout.selectors.js";
|
|
9
9
|
import { selectorPreferStrictDomainInLineCharts } from "../../corePlugins/useChartExperimentalFeature/index.js";
|
|
10
|
+
import { getXAxesScales, getYAxesScales } from "./getAxisScale.js";
|
|
10
11
|
export const createZoomMap = zoom => {
|
|
11
12
|
const zoomItemMap = new Map();
|
|
12
13
|
zoom.forEach(zoomItem => {
|
|
@@ -24,34 +25,42 @@ export const selectorChartZoomIsInteracting = createSelector([selectorChartZoomS
|
|
|
24
25
|
export const selectorChartZoomMap = createSelector([selectorChartZoomState], zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
|
|
25
26
|
export const selectorChartZoomOptionsLookup = createSelector([selectorChartRawXAxis, selectorChartRawYAxis], (xAxis, yAxis) => _extends({}, createZoomLookup('x')(xAxis), createZoomLookup('y')(yAxis)));
|
|
26
27
|
export const selectorChartAxisZoomOptionsLookup = createSelector([selectorChartZoomOptionsLookup, (_, axisId) => axisId], (axisLookup, axisId) => axisLookup[axisId]);
|
|
27
|
-
const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && createAxisFilterMapper(zoomMap, zoomOptions, 'x'));
|
|
29
|
+
const selectorChartYFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && createAxisFilterMapper(zoomMap, zoomOptions, 'y'));
|
|
30
|
+
export const selectorChartXScales = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorPreferStrictDomainInLineCharts], function selectorChartXScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
|
|
31
|
+
return getXAxesScales({
|
|
32
|
+
drawingArea,
|
|
33
|
+
formattedSeries,
|
|
34
|
+
axis,
|
|
35
|
+
seriesConfig,
|
|
36
|
+
zoomMap,
|
|
37
|
+
preferStrictDomainInLineCharts
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
export const selectorChartYScales = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorPreferStrictDomainInLineCharts], function selectorChartYScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
|
|
41
|
+
return getYAxesScales({
|
|
42
|
+
drawingArea,
|
|
43
|
+
formattedSeries,
|
|
44
|
+
axis,
|
|
45
|
+
seriesConfig,
|
|
46
|
+
zoomMap,
|
|
47
|
+
preferStrictDomainInLineCharts
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
export const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter, selectorChartYFilter, selectorChartRawXAxis, selectorChartRawYAxis, selectorChartXScales, selectorChartYScales], (xMapper, yMapper, xAxis, yAxis, xScales, yScales) => {
|
|
42
51
|
if (xMapper === undefined || yMapper === undefined) {
|
|
43
52
|
// Early return if there is no zoom.
|
|
44
53
|
return undefined;
|
|
45
54
|
}
|
|
46
|
-
const xFilters = xAxis?.reduce((acc, axis
|
|
47
|
-
const filter = xMapper(axis,
|
|
55
|
+
const xFilters = xAxis?.reduce((acc, axis) => {
|
|
56
|
+
const filter = xMapper(axis.id, axis.data, xScales[axis.id].scale);
|
|
48
57
|
if (filter !== null) {
|
|
49
58
|
acc[axis.id] = filter;
|
|
50
59
|
}
|
|
51
60
|
return acc;
|
|
52
61
|
}, {});
|
|
53
|
-
const yFilters = yAxis?.reduce((acc, axis
|
|
54
|
-
const filter = yMapper(axis,
|
|
62
|
+
const yFilters = yAxis?.reduce((acc, axis) => {
|
|
63
|
+
const filter = yMapper(axis.id, axis.data, yScales[axis.id].scale);
|
|
55
64
|
if (filter !== null) {
|
|
56
65
|
acc[axis.id] = filter;
|
|
57
66
|
}
|
|
@@ -67,7 +76,8 @@ export const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter
|
|
|
67
76
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
68
77
|
*/
|
|
69
78
|
|
|
70
|
-
export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts) => computeAxisValue({
|
|
79
|
+
export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts, selectorChartXScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => computeAxisValue({
|
|
80
|
+
scales,
|
|
71
81
|
drawingArea,
|
|
72
82
|
formattedSeries,
|
|
73
83
|
axis,
|
|
@@ -78,7 +88,8 @@ export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selecto
|
|
|
78
88
|
getFilters,
|
|
79
89
|
preferStrictDomainInLineCharts
|
|
80
90
|
}));
|
|
81
|
-
export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts) => computeAxisValue({
|
|
91
|
+
export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts, selectorChartYScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => computeAxisValue({
|
|
92
|
+
scales,
|
|
82
93
|
drawingArea,
|
|
83
94
|
formattedSeries,
|
|
84
95
|
axis,
|
|
@@ -11,7 +11,7 @@ import { useSelector } from "../../../store/useSelector.js";
|
|
|
11
11
|
import { selectorChartXAxis, selectorChartYAxis, selectorChartZoomIsInteracting } from "../useChartCartesianAxis/index.js";
|
|
12
12
|
import { selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/useChartSeries.selectors.js";
|
|
13
13
|
import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/index.js";
|
|
14
|
-
export const
|
|
14
|
+
export const useChartClosestPoint = ({
|
|
15
15
|
svgRef,
|
|
16
16
|
params,
|
|
17
17
|
store,
|
|
@@ -86,7 +86,8 @@ export const useChartVoronoi = ({
|
|
|
86
86
|
seriesId,
|
|
87
87
|
seriesIndexes,
|
|
88
88
|
startIndex: points.length,
|
|
89
|
-
endIndex: points.length + seriesPoints.length
|
|
89
|
+
endIndex: points.length + seriesPoints.length,
|
|
90
|
+
markerSize: series[seriesId].markerSize
|
|
90
91
|
};
|
|
91
92
|
points = points.concat(seriesPoints);
|
|
92
93
|
});
|
|
@@ -123,11 +124,12 @@ export const useChartVoronoi = ({
|
|
|
123
124
|
// The point index in the series with id=closestSeries.seriesId.
|
|
124
125
|
const seriesPointIndex = (2 * closestPointIndex - voronoiRef.current[closestSeries.seriesId].startIndex) / 2;
|
|
125
126
|
const dataIndex = voronoiRef.current[closestSeries.seriesId].seriesIndexes[seriesPointIndex];
|
|
126
|
-
|
|
127
|
+
const maxRadius = voronoiMaxRadius === 'item' ? closestSeries.markerSize : voronoiMaxRadius;
|
|
128
|
+
if (maxRadius !== undefined) {
|
|
127
129
|
const pointX = delauneyRef.current.points[2 * closestPointIndex];
|
|
128
130
|
const pointY = delauneyRef.current.points[2 * closestPointIndex + 1];
|
|
129
131
|
const dist2 = (pointX - svgPoint.x) ** 2 + (pointY - svgPoint.y) ** 2;
|
|
130
|
-
if (dist2 >
|
|
132
|
+
if (dist2 > maxRadius ** 2) {
|
|
131
133
|
// The closest point is too far to be considered.
|
|
132
134
|
return 'outside-voronoi-max-radius';
|
|
133
135
|
}
|
|
@@ -233,17 +235,17 @@ export const useChartVoronoi = ({
|
|
|
233
235
|
}
|
|
234
236
|
};
|
|
235
237
|
};
|
|
236
|
-
|
|
238
|
+
useChartClosestPoint.getDefaultizedParams = ({
|
|
237
239
|
params
|
|
238
240
|
}) => _extends({}, params, {
|
|
239
241
|
disableVoronoi: params.disableVoronoi ?? !params.series.some(item => item.type === 'scatter')
|
|
240
242
|
});
|
|
241
|
-
|
|
243
|
+
useChartClosestPoint.getInitialState = params => ({
|
|
242
244
|
voronoi: {
|
|
243
245
|
isVoronoiEnabled: !params.disableVoronoi
|
|
244
246
|
}
|
|
245
247
|
});
|
|
246
|
-
|
|
248
|
+
useChartClosestPoint.params = {
|
|
247
249
|
disableVoronoi: true,
|
|
248
250
|
voronoiMaxRadius: true,
|
|
249
251
|
onItemClick: true
|
|
@@ -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[]>;
|
|
@@ -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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function isSeriesHighlighted(scope, item, seriesId) {
|
|
2
|
+
return scope?.highlight === 'series' && item?.seriesId === seriesId;
|
|
3
|
+
}
|
|
4
|
+
export function isSeriesFaded(scope, item, seriesId) {
|
|
5
|
+
if (isSeriesHighlighted(scope, item, seriesId)) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return scope?.fade === 'global' && item != null || scope?.fade === 'series' && item?.seriesId === seriesId;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the data index of the highlighted item for a specific series.
|
|
13
|
+
* If the item is not highlighted, it returns `null`.
|
|
14
|
+
*/
|
|
15
|
+
export function getSeriesHighlightedItem(scope, item, seriesId) {
|
|
16
|
+
return scope?.highlight === 'item' && item?.seriesId === seriesId ? item.dataIndex : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns the data index of the "unfaded item" for a specific series.
|
|
21
|
+
* An "unfaded item" is the only item of a faded series that shouldn't be faded.
|
|
22
|
+
* If the series is not faded or if there is no highlighted item, it returns `null`.
|
|
23
|
+
*/
|
|
24
|
+
export function getSeriesUnfadedItem(scope, item, seriesId) {
|
|
25
|
+
if (isSeriesHighlighted(scope, item, seriesId)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (getSeriesHighlightedItem(scope, item, seriesId) === item?.dataIndex) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return (scope?.fade === 'series' || scope?.fade === 'global') && item?.seriesId === seriesId ? item.dataIndex : null;
|
|
32
|
+
}
|
package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts
CHANGED
|
@@ -27,4 +27,8 @@ export declare const selectorChartsIsFadedCallback: import("reselect").Selector<
|
|
|
27
27
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
28
|
} & import("./useChartHighlight.types.js").UseChartHighlightState, (item: HighlightItemData | null) => boolean, any[]>;
|
|
29
29
|
export declare const selectorChartsIsHighlighted: import("reselect").Selector<any, boolean, [item: HighlightItemData | null]>;
|
|
30
|
+
export declare const selectorChartIsSeriesHighlighted: import("reselect").Selector<any, boolean, [seriesId: SeriesId]>;
|
|
31
|
+
export declare const selectorChartIsSeriesFaded: import("reselect").Selector<any, boolean, [seriesId: SeriesId]>;
|
|
32
|
+
export declare const selectorChartSeriesUnfadedItem: import("reselect").Selector<any, number | null | undefined, [seriesId: SeriesId]>;
|
|
33
|
+
export declare const selectorChartSeriesHighlightedItem: import("reselect").Selector<any, number | null | undefined, [seriesId: SeriesId]>;
|
|
30
34
|
export declare const selectorChartsIsFaded: import("reselect").Selector<any, boolean, [item: HighlightItemData | null]>;
|
package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createSelector } from "../../utils/selectors.js";
|
|
2
2
|
import { createIsHighlighted } from "./createIsHighlighted.js";
|
|
3
3
|
import { createIsFaded } from "./createIsFaded.js";
|
|
4
|
+
import { getSeriesHighlightedItem, getSeriesUnfadedItem, isSeriesFaded, isSeriesHighlighted } from "./highlightStates.js";
|
|
4
5
|
const selectHighlight = state => state.highlight;
|
|
5
6
|
const selectSeries = state => state.series;
|
|
6
7
|
export const selectorChartsHighlightScopePerSeriesId = createSelector([selectSeries], series => {
|
|
@@ -32,6 +33,10 @@ export const selectorChartsIsFadedCallback = createSelector([selectorChartsHighl
|
|
|
32
33
|
export const selectorChartsIsHighlighted = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, item) => item], function selectorChartsIsHighlighted(highlightScope, highlightedItem, item) {
|
|
33
34
|
return createIsHighlighted(highlightScope, highlightedItem)(item);
|
|
34
35
|
});
|
|
36
|
+
export const selectorChartIsSeriesHighlighted = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], isSeriesHighlighted);
|
|
37
|
+
export const selectorChartIsSeriesFaded = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], isSeriesFaded);
|
|
38
|
+
export const selectorChartSeriesUnfadedItem = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], getSeriesUnfadedItem);
|
|
39
|
+
export const selectorChartSeriesHighlightedItem = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], getSeriesHighlightedItem);
|
|
35
40
|
export const selectorChartsIsFaded = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, item) => item], function selectorChartsIsFaded(highlightScope, highlightedItem, item) {
|
|
36
41
|
return createIsFaded(highlightScope, highlightedItem)(item);
|
|
37
42
|
});
|
package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChartAnyPluginSignature, ChartUsedInstance } from "../../models/plugin.js";
|
|
2
|
+
import { UseChartInteractionInstance } from "./useChartInteraction.types.js";
|
|
3
|
+
export declare function checkHasInteractionPlugin<T extends ChartAnyPluginSignature>(instance: ChartUsedInstance<T>): instance is ChartUsedInstance<T> & UseChartInteractionInstance;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
|
|
2
|
+
import { SeriesId } from "../../../../models/seriesType/common.js";
|
|
3
|
+
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the next series type and id that contains some data.
|
|
6
|
+
* Returns `null` if no other series have data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: ChartSeriesType, seriesId?: SeriesId): {
|
|
9
|
+
type: Exclude<ChartSeriesType, 'sankey'>;
|
|
10
|
+
seriesId: SeriesId;
|
|
11
|
+
} | null;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the previous series type and id that contains some data.
|
|
14
|
+
* Returns `null` if no other series have data.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: ChartSeriesType, seriesId?: SeriesId): {
|
|
17
|
+
type: Exclude<ChartSeriesType, 'sankey'>;
|
|
18
|
+
seriesId: SeriesId;
|
|
19
|
+
} | null;
|
|
20
|
+
export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean | undefined;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the next series type and id that contains some data.
|
|
3
|
+
* Returns `null` if no other series have data.
|
|
4
|
+
*/
|
|
5
|
+
export function getNextSeriesWithData(series, type, seriesId) {
|
|
6
|
+
const startingTypeIndex = type !== undefined && series[type] ? Object.keys(series).indexOf(type) : 0;
|
|
7
|
+
const currentSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : -1;
|
|
8
|
+
const typesAvailable = Object.keys(series).filter(t => t !== 'sankey');
|
|
9
|
+
|
|
10
|
+
// Loop over all series types starting with the current seriesType
|
|
11
|
+
for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
|
|
12
|
+
const typeIndex = (startingTypeIndex + typeGap) % typesAvailable.length;
|
|
13
|
+
const seriesOfType = series[typesAvailable[typeIndex]];
|
|
14
|
+
|
|
15
|
+
// Edge case for the current series type: we don't loop on previous series of the same type.
|
|
16
|
+
const startingSeriesIndex = typeGap === 0 ? currentSeriesIndex + 1 : 0;
|
|
17
|
+
for (let seriesIndex = startingSeriesIndex; seriesIndex < seriesOfType.seriesOrder.length; seriesIndex += 1) {
|
|
18
|
+
if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
|
|
19
|
+
return {
|
|
20
|
+
type: typesAvailable[typeIndex],
|
|
21
|
+
seriesId: seriesOfType.seriesOrder[seriesIndex]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// End looping on the initial type up to the initial series (excluded)
|
|
28
|
+
const typeIndex = startingTypeIndex;
|
|
29
|
+
const seriesOfType = series[typesAvailable[typeIndex]];
|
|
30
|
+
const endingSeriesIndex = currentSeriesIndex;
|
|
31
|
+
for (let seriesIndex = 0; seriesIndex < endingSeriesIndex; seriesIndex += 1) {
|
|
32
|
+
if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
|
|
33
|
+
return {
|
|
34
|
+
type: typesAvailable[typeIndex],
|
|
35
|
+
seriesId: seriesOfType.seriesOrder[seriesIndex]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns the previous series type and id that contains some data.
|
|
44
|
+
* Returns `null` if no other series have data.
|
|
45
|
+
*/
|
|
46
|
+
export function getPreviousSeriesWithData(series, type, seriesId) {
|
|
47
|
+
const startingTypeIndex = type !== undefined && series[type] ? Object.keys(series).indexOf(type) : 0;
|
|
48
|
+
const startingSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : 1;
|
|
49
|
+
const typesAvailable = Object.keys(series).filter(t => t !== 'sankey');
|
|
50
|
+
|
|
51
|
+
// Loop over all series types starting with the current seriesType
|
|
52
|
+
for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
|
|
53
|
+
const typeIndex = (typesAvailable.length + startingTypeIndex - typeGap) % typesAvailable.length;
|
|
54
|
+
const seriesOfType = series[typesAvailable[typeIndex]];
|
|
55
|
+
const maxGap = typeGap === 0 ? startingSeriesIndex + 1 : seriesOfType.seriesOrder.length;
|
|
56
|
+
for (let seriesGap = 1; seriesGap < maxGap; seriesGap += 1) {
|
|
57
|
+
const seriesIndex = (seriesOfType.seriesOrder.length + startingSeriesIndex - seriesGap) % seriesOfType.seriesOrder.length;
|
|
58
|
+
if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
|
|
59
|
+
return {
|
|
60
|
+
type: typesAvailable[typeIndex],
|
|
61
|
+
seriesId: seriesOfType.seriesOrder[seriesIndex]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// End looping on the initial type down to the initial series (excluded)
|
|
68
|
+
const typeIndex = startingTypeIndex;
|
|
69
|
+
const seriesOfType = series[typesAvailable[typeIndex]];
|
|
70
|
+
const availableSeriesIds = seriesOfType.seriesOrder;
|
|
71
|
+
for (let seriesIndex = availableSeriesIds.length - 1; seriesIndex > startingSeriesIndex; seriesIndex -= 1) {
|
|
72
|
+
if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
|
|
73
|
+
return {
|
|
74
|
+
type: typesAvailable[typeIndex],
|
|
75
|
+
seriesId: seriesOfType.seriesOrder[seriesIndex]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
export function seriesHasData(series, type, seriesId) {
|
|
82
|
+
// @ts-ignore snakey is not in MIT version
|
|
83
|
+
if (type === 'sankey') {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
const data = series[type]?.series[seriesId]?.data;
|
|
87
|
+
return data && data.length > 0;
|
|
88
|
+
}
|