@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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useIsItemFocusedGetter = useIsItemFocusedGetter;
|
|
8
|
+
var _useFocusedItem = require("./useFocusedItem");
|
|
9
|
+
/**
|
|
10
|
+
* A hook to check focus state of multiple items.
|
|
11
|
+
* If you're interested by a single one, consider using `useIsItemFocused`.
|
|
12
|
+
*
|
|
13
|
+
* @returns {(item: FocusedItemData) => boolean} callback to get the state of the item.
|
|
14
|
+
*/
|
|
15
|
+
function useIsItemFocusedGetter() {
|
|
16
|
+
const focusedItem = (0, _useFocusedItem.useFocusedItem)();
|
|
17
|
+
return item => focusedItem !== null && focusedItem.seriesType === item.seriesType && focusedItem.seriesId === item.seriesId && focusedItem.dataIndex === item.dataIndex;
|
|
18
|
+
}
|
package/hooks/useScale.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.useRadiusScale = useRadiusScale;
|
|
|
9
9
|
exports.useRotationScale = useRotationScale;
|
|
10
10
|
exports.useXScale = useXScale;
|
|
11
11
|
exports.useYScale = useYScale;
|
|
12
|
-
var
|
|
12
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
13
13
|
var _useAxis = require("./useAxis");
|
|
14
14
|
/**
|
|
15
15
|
* For a given scale return a function that map value to their position.
|
|
@@ -18,9 +18,15 @@ var _useAxis = require("./useAxis");
|
|
|
18
18
|
* @returns {(value: any) => number} A function that map value to their position
|
|
19
19
|
*/
|
|
20
20
|
function getValueToPositionMapper(scale) {
|
|
21
|
-
if ((0,
|
|
21
|
+
if ((0, _scaleGuards.isOrdinalScale)(scale)) {
|
|
22
22
|
return value => (scale(value) ?? 0) + scale.bandwidth() / 2;
|
|
23
23
|
}
|
|
24
|
+
const domain = scale.domain();
|
|
25
|
+
|
|
26
|
+
// Fixes https://github.com/mui/mui-x/issues/18999#issuecomment-3173787401
|
|
27
|
+
if (domain[0] === domain[1]) {
|
|
28
|
+
return value => value === domain[0] ? scale(value) : NaN;
|
|
29
|
+
}
|
|
24
30
|
return value => scale(value);
|
|
25
31
|
}
|
|
26
32
|
|
package/hooks/useTicks.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.getTicks = getTicks;
|
|
|
9
9
|
exports.useTicks = useTicks;
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _ChartProvider = require("../context/ChartProvider");
|
|
12
|
-
var
|
|
12
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
13
13
|
var _isInfinity = require("../internals/isInfinity");
|
|
14
14
|
const offsetRatio = {
|
|
15
15
|
start: 0,
|
|
@@ -29,7 +29,7 @@ function getTicks(options) {
|
|
|
29
29
|
} = options;
|
|
30
30
|
|
|
31
31
|
// band scale
|
|
32
|
-
if ((0,
|
|
32
|
+
if ((0, _scaleGuards.isOrdinalScale)(scale)) {
|
|
33
33
|
const domain = scale.domain();
|
|
34
34
|
const tickLabelPlacement = tickLabelPlacementProp ?? 'middle';
|
|
35
35
|
if (scale.bandwidth() > 0) {
|
package/hooks/useTicksGrouped.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.useTicksGrouped = useTicksGrouped;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
10
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
11
11
|
const offsetRatio = {
|
|
12
12
|
start: 0,
|
|
13
13
|
extremities: 0,
|
|
@@ -68,7 +68,7 @@ function mapToGrouping(tickValues, groups, tickPlacement, tickLabelPlacement, sc
|
|
|
68
68
|
if (isNew) {
|
|
69
69
|
currentValueCount = 1;
|
|
70
70
|
// Calculate tick offset
|
|
71
|
-
const tickOffset = (0,
|
|
71
|
+
const tickOffset = (0, _scaleGuards.isOrdinalScale)(scale) ? scale(tickValue) - (scale.step() - scale.bandwidth()) / 2 + offsetRatio[tickPlacement] * scale.step() : scale(tickValue);
|
|
72
72
|
|
|
73
73
|
// Calculate the label offset
|
|
74
74
|
const labelOffset = scale.step() * currentValueCount * (offsetRatio[tickLabelPlacement] - offsetRatio[tickPlacement]);
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./constants/index.js";
|
|
2
2
|
export * from "./context/index.js";
|
|
3
3
|
export * from "./hooks/index.js";
|
|
4
|
+
export * from "./plugins/index.js";
|
|
4
5
|
export * from "./colorPalettes/index.js";
|
|
5
6
|
export * from "./models/index.js";
|
|
6
7
|
export * from "./ChartsClipPath/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.
|
|
2
|
+
* @mui/x-charts v8.12.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -55,6 +55,18 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
+
var _plugins = require("./plugins");
|
|
59
|
+
Object.keys(_plugins).forEach(function (key) {
|
|
60
|
+
if (key === "default" || key === "__esModule") return;
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
62
|
+
if (key in exports && exports[key] === _plugins[key]) return;
|
|
63
|
+
Object.defineProperty(exports, key, {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () {
|
|
66
|
+
return _plugins[key];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
58
70
|
var _colorPalettes = require("./colorPalettes");
|
|
59
71
|
Object.keys(_colorPalettes).forEach(function (key) {
|
|
60
72
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -55,7 +55,6 @@ class Transition {
|
|
|
55
55
|
/* If we're resuming the transition, then subtract elapsed to continue the easing. */
|
|
56
56
|
const time = (0, _d3Timer.now)() - this.elapsed;
|
|
57
57
|
this.timer = (0, _d3Timer.timer)(elapsed => this.timerCallback(elapsed), 0, time);
|
|
58
|
-
(0, _d3Timer.timerFlush)();
|
|
59
58
|
return this;
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -79,7 +78,6 @@ class Transition {
|
|
|
79
78
|
finish() {
|
|
80
79
|
this.stop();
|
|
81
80
|
(0, _d3Timer.timeout)(() => this.timerCallback(this.duration));
|
|
82
|
-
(0, _d3Timer.timerFlush)();
|
|
83
81
|
return this;
|
|
84
82
|
}
|
|
85
83
|
}
|
package/internals/index.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ export * from "./plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
|
25
25
|
export * from "./plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
26
26
|
export * from "./plugins/featurePlugins/useChartInteraction/index.js";
|
|
27
27
|
export * from "./plugins/featurePlugins/useChartHighlight/index.js";
|
|
28
|
-
export * from "./plugins/featurePlugins/
|
|
28
|
+
export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
29
|
+
export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
29
30
|
export * from "./plugins/utils/selectors.js";
|
|
30
31
|
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
|
|
31
32
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
|
@@ -52,9 +53,9 @@ export * from "./colorScale.js";
|
|
|
52
53
|
export * from "./ticks.js";
|
|
53
54
|
export * from "./dateHelpers.js";
|
|
54
55
|
export * from "./invertScale.js";
|
|
55
|
-
export * from "./
|
|
56
|
+
export * from "./scaleGuards.js";
|
|
56
57
|
export * from "./findMinMax.js";
|
|
57
|
-
export {
|
|
58
|
+
export { getAxisExtrema } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js";
|
|
58
59
|
export * from "../context/ChartProvider/index.js";
|
|
59
60
|
export * from "../context/ChartsSlotsContext.js";
|
|
60
61
|
export * from "../models/seriesType/config.js";
|
package/internals/index.js
CHANGED
|
@@ -18,12 +18,12 @@ var _exportNames = {
|
|
|
18
18
|
useRadarChartProps: true,
|
|
19
19
|
getCartesianAxisTriggerTooltip: true,
|
|
20
20
|
getCartesianAxisIndex: true,
|
|
21
|
-
|
|
21
|
+
getAxisExtrema: true
|
|
22
22
|
};
|
|
23
|
-
Object.defineProperty(exports, "
|
|
23
|
+
Object.defineProperty(exports, "getAxisExtrema", {
|
|
24
24
|
enumerable: true,
|
|
25
25
|
get: function () {
|
|
26
|
-
return
|
|
26
|
+
return _getAxisExtrema.getAxisExtrema;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "getCartesianAxisIndex", {
|
|
@@ -302,15 +302,27 @@ Object.keys(_useChartHighlight).forEach(function (key) {
|
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
});
|
|
305
|
-
var
|
|
306
|
-
Object.keys(
|
|
305
|
+
var _useChartKeyboardNavigation = require("./plugins/featurePlugins/useChartKeyboardNavigation");
|
|
306
|
+
Object.keys(_useChartKeyboardNavigation).forEach(function (key) {
|
|
307
307
|
if (key === "default" || key === "__esModule") return;
|
|
308
308
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
309
|
-
if (key in exports && exports[key] ===
|
|
309
|
+
if (key in exports && exports[key] === _useChartKeyboardNavigation[key]) return;
|
|
310
310
|
Object.defineProperty(exports, key, {
|
|
311
311
|
enumerable: true,
|
|
312
312
|
get: function () {
|
|
313
|
-
return
|
|
313
|
+
return _useChartKeyboardNavigation[key];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
var _useChartClosestPoint = require("./plugins/featurePlugins/useChartClosestPoint");
|
|
318
|
+
Object.keys(_useChartClosestPoint).forEach(function (key) {
|
|
319
|
+
if (key === "default" || key === "__esModule") return;
|
|
320
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
321
|
+
if (key in exports && exports[key] === _useChartClosestPoint[key]) return;
|
|
322
|
+
Object.defineProperty(exports, key, {
|
|
323
|
+
enumerable: true,
|
|
324
|
+
get: function () {
|
|
325
|
+
return _useChartClosestPoint[key];
|
|
314
326
|
}
|
|
315
327
|
});
|
|
316
328
|
});
|
|
@@ -604,15 +616,15 @@ Object.keys(_invertScale).forEach(function (key) {
|
|
|
604
616
|
}
|
|
605
617
|
});
|
|
606
618
|
});
|
|
607
|
-
var
|
|
608
|
-
Object.keys(
|
|
619
|
+
var _scaleGuards = require("./scaleGuards");
|
|
620
|
+
Object.keys(_scaleGuards).forEach(function (key) {
|
|
609
621
|
if (key === "default" || key === "__esModule") return;
|
|
610
622
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
611
|
-
if (key in exports && exports[key] ===
|
|
623
|
+
if (key in exports && exports[key] === _scaleGuards[key]) return;
|
|
612
624
|
Object.defineProperty(exports, key, {
|
|
613
625
|
enumerable: true,
|
|
614
626
|
get: function () {
|
|
615
|
-
return
|
|
627
|
+
return _scaleGuards[key];
|
|
616
628
|
}
|
|
617
629
|
});
|
|
618
630
|
});
|
|
@@ -628,7 +640,7 @@ Object.keys(_findMinMax).forEach(function (key) {
|
|
|
628
640
|
}
|
|
629
641
|
});
|
|
630
642
|
});
|
|
631
|
-
var
|
|
643
|
+
var _getAxisExtrema = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema");
|
|
632
644
|
var _ChartProvider = require("../context/ChartProvider");
|
|
633
645
|
Object.keys(_ChartProvider).forEach(function (key) {
|
|
634
646
|
if (key === "default" || key === "__esModule") return;
|
package/internals/invertScale.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.invertScale = invertScale;
|
|
7
|
-
var
|
|
7
|
+
var _scaleGuards = require("./scaleGuards");
|
|
8
8
|
function invertScale(scale, data, value) {
|
|
9
|
-
if ((0,
|
|
9
|
+
if ((0, _scaleGuards.isOrdinalScale)(scale)) {
|
|
10
10
|
const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
|
|
11
11
|
return data[dataIndex];
|
|
12
12
|
}
|
|
@@ -2,9 +2,10 @@ import { ChartSeriesType } from "../../models/seriesType/config.js";
|
|
|
2
2
|
import { UseChartCartesianAxisSignature } from "./featurePlugins/useChartCartesianAxis/index.js";
|
|
3
3
|
import { UseChartHighlightSignature } from "./featurePlugins/useChartHighlight/index.js";
|
|
4
4
|
import { UseChartInteractionSignature } from "./featurePlugins/useChartInteraction/index.js";
|
|
5
|
+
import { UseChartKeyboardNavigationSignature } from "./featurePlugins/useChartKeyboardNavigation/index.js";
|
|
5
6
|
import { UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarAxis/index.js";
|
|
6
|
-
import {
|
|
7
|
+
import { UseChartClosestPointSignature } from "./featurePlugins/useChartClosestPoint/index.js";
|
|
7
8
|
import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
|
|
8
|
-
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature,
|
|
9
|
-
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature,
|
|
10
|
-
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<
|
|
9
|
+
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
10
|
+
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
11
|
+
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
|
|
@@ -7,8 +7,9 @@ exports.DEFAULT_PLUGINS = void 0;
|
|
|
7
7
|
var _useChartCartesianAxis = require("./featurePlugins/useChartCartesianAxis");
|
|
8
8
|
var _useChartHighlight = require("./featurePlugins/useChartHighlight");
|
|
9
9
|
var _useChartInteraction = require("./featurePlugins/useChartInteraction");
|
|
10
|
-
var
|
|
10
|
+
var _useChartKeyboardNavigation = require("./featurePlugins/useChartKeyboardNavigation");
|
|
11
|
+
var _useChartClosestPoint = require("./featurePlugins/useChartClosestPoint");
|
|
11
12
|
var _useChartZAxis = require("./featurePlugins/useChartZAxis");
|
|
12
13
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
13
14
|
|
|
14
|
-
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight,
|
|
15
|
+
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
@@ -17,7 +17,7 @@ export declare const preprocessSeries: <TSeriesType extends ChartSeriesType>({
|
|
|
17
17
|
dataset
|
|
18
18
|
}: {
|
|
19
19
|
series: Readonly<AllSeriesType<TSeriesType>[]>;
|
|
20
|
-
colors: string[];
|
|
20
|
+
colors: readonly string[];
|
|
21
21
|
seriesConfig: ChartSeriesConfig<TSeriesType>;
|
|
22
22
|
dataset?: Readonly<DatasetType>;
|
|
23
23
|
}) => { [type in TSeriesType]?: SeriesProcessorResult<TSeriesType> | undefined };
|
|
@@ -5,11 +5,13 @@ import { ChartSeriesConfig } from "../../models/seriesConfig/index.js";
|
|
|
5
5
|
import { ComputedAxisConfig, DefaultizedZoomOptions } from "./useChartCartesianAxis.types.js";
|
|
6
6
|
import { ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.js";
|
|
7
7
|
import { GetZoomAxisFilters, ZoomData } from "./zoom.types.js";
|
|
8
|
+
import { ScaleDefinition } from "./getAxisScale.js";
|
|
8
9
|
export type ComputeResult<T extends ChartsAxisProps> = {
|
|
9
10
|
axis: ComputedAxisConfig<T>;
|
|
10
11
|
axisIds: AxisId[];
|
|
11
12
|
};
|
|
12
13
|
type ComputeCommonParams<T extends ChartSeriesType = ChartSeriesType> = {
|
|
14
|
+
scales: Record<AxisId, ScaleDefinition>;
|
|
13
15
|
drawingArea: ChartDrawingArea;
|
|
14
16
|
formattedSeries: ProcessedSeries<T>;
|
|
15
17
|
seriesConfig: ChartSeriesConfig<T>;
|
|
@@ -6,17 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.computeAxisValue = computeAxisValue;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
10
9
|
var _defaultValueFormatters = require("../../../defaultValueFormatters");
|
|
11
10
|
var _axis = require("../../../../models/axis");
|
|
12
11
|
var _colorScale = require("../../../colorScale");
|
|
13
12
|
var _ticks = require("../../../ticks");
|
|
14
13
|
var _getScale = require("../../../getScale");
|
|
15
14
|
var _dateHelpers = require("../../../dateHelpers");
|
|
16
|
-
var
|
|
17
|
-
var _getAxisExtremum = require("./getAxisExtremum");
|
|
15
|
+
var _getAxisExtrema = require("./getAxisExtrema");
|
|
18
16
|
var _getAxisTriggerTooltip = require("./getAxisTriggerTooltip");
|
|
19
|
-
var
|
|
17
|
+
var _getAxisScale = require("./getAxisScale");
|
|
18
|
+
var _scaleGuards = require("../../../scaleGuards");
|
|
20
19
|
function getRange(drawingArea, axisDirection,
|
|
21
20
|
// | 'rotation' | 'radius',
|
|
22
21
|
reverse) {
|
|
@@ -26,6 +25,7 @@ reverse) {
|
|
|
26
25
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
27
26
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
28
27
|
function computeAxisValue({
|
|
28
|
+
scales,
|
|
29
29
|
drawingArea,
|
|
30
30
|
formattedSeries,
|
|
31
31
|
axis: allAxis,
|
|
@@ -46,97 +46,91 @@ function computeAxisValue({
|
|
|
46
46
|
const completeAxis = {};
|
|
47
47
|
allAxis.forEach((eachAxis, axisIndex) => {
|
|
48
48
|
const axis = eachAxis;
|
|
49
|
+
const scaleDefinition = scales[axis.id];
|
|
50
|
+
let scale = scaleDefinition.scale;
|
|
49
51
|
const zoomOption = zoomOptions?.[axis.id];
|
|
50
52
|
const zoom = zoomMap?.get(axis.id);
|
|
51
53
|
const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
|
|
52
54
|
const range = getRange(drawingArea, axisDirection, axis.reverse ?? false);
|
|
53
|
-
const [minData, maxData] = (0, _getAxisExtremum.getAxisExtremum)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries, zoom === undefined && !zoomOption ? getFilters : undefined // Do not apply filtering if zoom is already defined.
|
|
54
|
-
);
|
|
55
55
|
const triggerTooltip = !axis.ignoreTooltip && axisIdsTriggeringTooltip.has(axis.id);
|
|
56
56
|
const data = axis.data ?? [];
|
|
57
|
-
if ((0,
|
|
58
|
-
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
59
|
-
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
57
|
+
if ((0, _scaleGuards.isOrdinalScale)(scale)) {
|
|
60
58
|
// Reverse range because ordinal scales are presented from top to bottom on y-axis
|
|
61
59
|
const scaleRange = axisDirection === 'y' ? [range[1], range[0]] : range;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
if ((0, _scaleGuards.isBandScale)(scale) && (0, _axis.isBandScaleConfig)(axis)) {
|
|
61
|
+
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
62
|
+
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
63
|
+
completeAxis[axis.id] = (0, _extends2.default)({
|
|
64
|
+
offset: 0,
|
|
65
|
+
height: 0,
|
|
66
|
+
categoryGapRatio,
|
|
67
|
+
barGapRatio,
|
|
68
|
+
triggerTooltip
|
|
69
|
+
}, axis, {
|
|
70
|
+
data,
|
|
71
|
+
scale,
|
|
72
|
+
tickNumber: axis.data.length,
|
|
73
|
+
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
74
|
+
values: axis.data
|
|
75
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
79
|
+
completeAxis[axis.id] = (0, _extends2.default)({
|
|
80
|
+
offset: 0,
|
|
81
|
+
height: 0,
|
|
82
|
+
triggerTooltip
|
|
83
|
+
}, axis, {
|
|
84
|
+
data,
|
|
85
|
+
scale,
|
|
86
|
+
tickNumber: axis.data.length,
|
|
87
|
+
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
88
|
+
values: axis.data
|
|
89
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
90
|
+
});
|
|
80
91
|
}
|
|
81
|
-
}
|
|
82
|
-
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
83
|
-
const scaleRange = axisDirection === 'y' ? [...range].reverse() : range;
|
|
84
|
-
const zoomedRange = (0, _zoom.zoomScaleRange)(scaleRange, zoomRange);
|
|
85
|
-
completeAxis[axis.id] = (0, _extends2.default)({
|
|
86
|
-
offset: 0,
|
|
87
|
-
height: 0,
|
|
88
|
-
triggerTooltip
|
|
89
|
-
}, axis, {
|
|
90
|
-
data,
|
|
91
|
-
scale: (0, _d3Scale.scalePoint)(axis.data, zoomedRange),
|
|
92
|
-
tickNumber: axis.data.length,
|
|
93
|
-
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
94
|
-
values: axis.data
|
|
95
|
-
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
96
|
-
});
|
|
97
92
|
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
98
93
|
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis.data, scaleRange, axis.tickNumber);
|
|
99
94
|
completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
|
|
100
95
|
}
|
|
96
|
+
return;
|
|
101
97
|
}
|
|
102
98
|
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
103
99
|
// Could be merged with the two previous "if conditions" but then TS does not get that `axis.scaleType` can't be `band` or `point`.
|
|
104
100
|
return;
|
|
105
101
|
}
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
if (typeof domainLimit === 'function') {
|
|
110
|
-
const {
|
|
111
|
-
min,
|
|
112
|
-
max
|
|
113
|
-
} = domainLimit(minData, maxData);
|
|
114
|
-
axisExtremums[0] = min;
|
|
115
|
-
axisExtremums[1] = max;
|
|
116
|
-
}
|
|
117
|
-
const rawTickNumber = (0, _ticks.getTickNumber)((0, _extends2.default)({}, axis, {
|
|
118
|
-
range,
|
|
119
|
-
domain: axisExtremums
|
|
120
|
-
}));
|
|
102
|
+
const rawTickNumber = scaleDefinition.tickNumber;
|
|
103
|
+
const continuousAxis = axis;
|
|
104
|
+
const scaleType = continuousAxis.scaleType ?? 'linear';
|
|
121
105
|
const tickNumber = (0, _ticks.scaleTickNumberByRange)(rawTickNumber, zoomRange);
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
scale.
|
|
106
|
+
const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
|
|
107
|
+
if (filter) {
|
|
108
|
+
const [minData, maxData] = (0, _getAxisExtrema.getAxisExtrema)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries, filter);
|
|
109
|
+
scale = scale.copy();
|
|
110
|
+
scale.domain([minData, maxData]);
|
|
111
|
+
const domainLimit = (0, _getAxisScale.getDomainLimit)(axis, axisDirection, axisIndex, formattedSeries, preferStrictDomainInLineCharts);
|
|
112
|
+
const axisExtrema = (0, _getAxisScale.getActualAxisExtrema)(axis, minData, maxData);
|
|
113
|
+
if (typeof domainLimit === 'function') {
|
|
114
|
+
const {
|
|
115
|
+
min,
|
|
116
|
+
max
|
|
117
|
+
} = domainLimit(minData, maxData);
|
|
118
|
+
axisExtrema[0] = min;
|
|
119
|
+
axisExtrema[1] = max;
|
|
120
|
+
}
|
|
121
|
+
scale.domain(axisExtrema);
|
|
122
|
+
(0, _getAxisScale.applyDomainLimit)(scale, axis, domainLimit, rawTickNumber);
|
|
126
123
|
}
|
|
127
|
-
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
128
|
-
const [minDomain, maxDomain] = finalScale.domain();
|
|
129
|
-
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
130
124
|
completeAxis[axis.id] = (0, _extends2.default)({
|
|
131
125
|
offset: 0,
|
|
132
126
|
height: 0,
|
|
133
127
|
triggerTooltip
|
|
134
|
-
},
|
|
128
|
+
}, continuousAxis, {
|
|
135
129
|
data,
|
|
136
|
-
scaleType
|
|
137
|
-
scale
|
|
130
|
+
scaleType,
|
|
131
|
+
scale,
|
|
138
132
|
tickNumber,
|
|
139
|
-
colorScale:
|
|
133
|
+
colorScale: continuousAxis.colorMap && (0, _colorScale.getSequentialColorScale)(continuousAxis.colorMap),
|
|
140
134
|
valueFormatter: axis.valueFormatter ?? (0, _defaultValueFormatters.createScalarFormatter)(tickNumber, (0, _getScale.getScale)(scaleType, range.map(v => scale.invert(v)), range))
|
|
141
135
|
});
|
|
142
136
|
});
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import { AxisId,
|
|
2
|
-
import { CartesianChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
3
|
-
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
1
|
+
import { AxisId, D3ContinuousScale, D3Scale } from "../../../../models/axis.js";
|
|
4
2
|
import { AxisConfig } from "../../../../models/index.js";
|
|
5
|
-
import { ChartSeriesConfig } from "../../models/seriesConfig/index.js";
|
|
6
3
|
import { DefaultizedZoomOptions, ExtremumFilter } from "./useChartCartesianAxis.types.js";
|
|
7
4
|
import { GetZoomAxisFilters, ZoomAxisFilters, ZoomData } from "./zoom.types.js";
|
|
8
|
-
export declare function createAxisFilterMapper(
|
|
9
|
-
zoomMap: Map<AxisId, ZoomData>;
|
|
10
|
-
zoomOptions: Record<AxisId, DefaultizedZoomOptions>;
|
|
11
|
-
seriesConfig: ChartSeriesConfig<CartesianChartSeriesType>;
|
|
12
|
-
formattedSeries: ProcessedSeries;
|
|
13
|
-
direction: 'x';
|
|
14
|
-
}): (axis: AxisConfig<ScaleName, any, ChartsXAxisProps>, axisIndex: number) => ExtremumFilter | null;
|
|
15
|
-
export declare function createAxisFilterMapper(params: {
|
|
16
|
-
zoomMap: Map<AxisId, ZoomData>;
|
|
17
|
-
zoomOptions: Record<AxisId, DefaultizedZoomOptions>;
|
|
18
|
-
seriesConfig: ChartSeriesConfig<CartesianChartSeriesType>;
|
|
19
|
-
formattedSeries: ProcessedSeries;
|
|
20
|
-
direction: 'y';
|
|
21
|
-
}): (axis: AxisConfig<ScaleName, any, ChartsYAxisProps>, axisIndex: number) => ExtremumFilter | null;
|
|
5
|
+
export declare function createAxisFilterMapper(zoomMap: Map<AxisId, ZoomData>, zoomOptions: Record<AxisId, DefaultizedZoomOptions>, direction: 'x' | 'y'): (axisId: AxisId, axisData: AxisConfig['data'], scale: D3Scale) => ExtremumFilter | null;
|
|
22
6
|
export declare function createDiscreteScaleGetAxisFilter(axisData: AxisConfig['data'], zoomStart: number, zoomEnd: number, direction: 'x' | 'y'): ExtremumFilter;
|
|
23
|
-
export declare function createContinuousScaleGetAxisFilter(
|
|
7
|
+
export declare function createContinuousScaleGetAxisFilter(scale: D3ContinuousScale, zoomStart: number, zoomEnd: number, direction: 'x' | 'y', axisData: AxisConfig['data']): ExtremumFilter;
|
|
24
8
|
export declare const createGetAxisFilters: (filters: ZoomAxisFilters) => GetZoomAxisFilters;
|
|
@@ -8,30 +8,22 @@ exports.createContinuousScaleGetAxisFilter = createContinuousScaleGetAxisFilter;
|
|
|
8
8
|
exports.createDiscreteScaleGetAxisFilter = createDiscreteScaleGetAxisFilter;
|
|
9
9
|
exports.createGetAxisFilters = void 0;
|
|
10
10
|
var _isDefined = require("../../../isDefined");
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
zoomOptions,
|
|
16
|
-
seriesConfig,
|
|
17
|
-
formattedSeries,
|
|
18
|
-
direction
|
|
19
|
-
}) {
|
|
20
|
-
return (axis, axisIndex) => {
|
|
21
|
-
const zoomOption = zoomOptions[axis.id];
|
|
11
|
+
var _scaleGuards = require("../../../scaleGuards");
|
|
12
|
+
function createAxisFilterMapper(zoomMap, zoomOptions, direction) {
|
|
13
|
+
return (axisId, axisData, scale) => {
|
|
14
|
+
const zoomOption = zoomOptions[axisId];
|
|
22
15
|
if (!zoomOption || zoomOption.filterMode !== 'discard') {
|
|
23
16
|
return null;
|
|
24
17
|
}
|
|
25
|
-
const zoom = zoomMap?.get(
|
|
18
|
+
const zoom = zoomMap?.get(axisId);
|
|
26
19
|
if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
|
|
27
20
|
// No zoom, or zoom with all data visible
|
|
28
21
|
return null;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return createDiscreteScaleGetAxisFilter(axis.data, zoom.start, zoom.end, direction);
|
|
23
|
+
if ((0, _scaleGuards.isOrdinalScale)(scale)) {
|
|
24
|
+
return createDiscreteScaleGetAxisFilter(axisData, zoom.start, zoom.end, direction);
|
|
33
25
|
}
|
|
34
|
-
return createContinuousScaleGetAxisFilter(
|
|
26
|
+
return createContinuousScaleGetAxisFilter(scale, zoom.start, zoom.end, direction, axisData);
|
|
35
27
|
};
|
|
36
28
|
}
|
|
37
29
|
function createDiscreteScaleGetAxisFilter(axisData, zoomStart, zoomEnd, direction) {
|
|
@@ -47,10 +39,10 @@ function createDiscreteScaleGetAxisFilter(axisData, zoomStart, zoomEnd, directio
|
|
|
47
39
|
return dataIndex >= minVal && dataIndex < maxVal;
|
|
48
40
|
};
|
|
49
41
|
}
|
|
50
|
-
function createContinuousScaleGetAxisFilter(
|
|
42
|
+
function createContinuousScaleGetAxisFilter(scale, zoomStart, zoomEnd, direction, axisData) {
|
|
51
43
|
let min;
|
|
52
44
|
let max;
|
|
53
|
-
[min, max] =
|
|
45
|
+
[min, max] = scale.domain();
|
|
54
46
|
min = min instanceof Date ? min.getTime() : min;
|
|
55
47
|
max = max instanceof Date ? max.getTime() : max;
|
|
56
48
|
const minVal = min + zoomStart * (max - min) / 100;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxisConfig } from "../../../../models/axis.js";
|
|
2
2
|
import { CartesianChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
3
3
|
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
4
|
-
export declare const getAxisDomainLimit: <T extends CartesianChartSeriesType>(axis: AxisConfig, axisDirection: "x" | "y", axisIndex: number, formattedSeries: ProcessedSeries<T | "line">) => "nice" | "strict" | ((min: number, max: number) => {
|
|
4
|
+
export declare const getAxisDomainLimit: <T extends CartesianChartSeriesType>(axis: Pick<AxisConfig, "id" | "domainLimit">, axisDirection: "x" | "y", axisIndex: number, formattedSeries: ProcessedSeries<T | "line">) => "nice" | "strict" | ((min: number, max: number) => {
|
|
5
5
|
min: number;
|
|
6
6
|
max: number;
|
|
7
7
|
});
|
|
@@ -3,4 +3,4 @@ import { CartesianChartSeriesType } from "../../../../models/seriesType/config.j
|
|
|
3
3
|
import { ChartSeriesConfig } from "../../models/seriesConfig/index.js";
|
|
4
4
|
import { ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.js";
|
|
5
5
|
import { GetZoomAxisFilters } from "./zoom.types.js";
|
|
6
|
-
export declare
|
|
6
|
+
export declare function getAxisExtrema<T extends CartesianChartSeriesType>(axis: AxisConfig, axisDirection: 'x' | 'y', seriesConfig: ChartSeriesConfig<T>, axisIndex: number, formattedSeries: ProcessedSeries<T>, getFilters?: GetZoomAxisFilters): [number, number];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAxisExtrema = getAxisExtrema;
|
|
7
|
+
var _isCartesian = require("../../../isCartesian");
|
|
8
|
+
const axisExtremumCallback = (chartType, axis, axisDirection, seriesConfig, axisIndex, formattedSeries, getFilters) => {
|
|
9
|
+
const getter = axisDirection === 'x' ? seriesConfig[chartType].xExtremumGetter : seriesConfig[chartType].yExtremumGetter;
|
|
10
|
+
const series = formattedSeries[chartType]?.series ?? {};
|
|
11
|
+
return getter?.({
|
|
12
|
+
series,
|
|
13
|
+
axis,
|
|
14
|
+
axisIndex,
|
|
15
|
+
isDefaultAxis: axisIndex === 0,
|
|
16
|
+
getFilters
|
|
17
|
+
}) ?? [Infinity, -Infinity];
|
|
18
|
+
};
|
|
19
|
+
function getAxisExtrema(axis, axisDirection, seriesConfig, axisIndex, formattedSeries, getFilters) {
|
|
20
|
+
const cartesianChartTypes = Object.keys(seriesConfig).filter(_isCartesian.isCartesianSeriesType);
|
|
21
|
+
let extrema = [Infinity, -Infinity];
|
|
22
|
+
for (const chartType of cartesianChartTypes) {
|
|
23
|
+
const [min, max] = axisExtremumCallback(chartType, axis, axisDirection, seriesConfig, axisIndex, formattedSeries, getFilters);
|
|
24
|
+
extrema = [Math.min(extrema[0], min), Math.max(extrema[1], max)];
|
|
25
|
+
}
|
|
26
|
+
if (Number.isNaN(extrema[0]) || Number.isNaN(extrema[1])) {
|
|
27
|
+
return [Infinity, -Infinity];
|
|
28
|
+
}
|
|
29
|
+
return extrema;
|
|
30
|
+
}
|