@mui/x-charts 8.11.3 → 8.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +2 -2
- package/BarChart/BarChart.js +1 -0
- package/BarChart/BarChart.plugins.d.ts +3 -2
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/BarElement.js +10 -2
- package/BarChart/index.d.ts +1 -0
- package/BarChart/index.js +12 -0
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/CHANGELOG.md +296 -6
- package/ChartContainer/ChartContainer.js +4 -2
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/ChartsSurface/ChartsSurface.js +23 -3
- package/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/ChartsWrapper/ChartsWrapper.js +49 -46
- package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/LineChart/FocusedMark.d.ts +2 -0
- package/LineChart/FocusedMark.js +44 -0
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +3 -1
- package/LineChart/LineChart.plugins.d.ts +3 -2
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/index.d.ts +1 -0
- package/LineChart/index.js +12 -0
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/PieChart/PieArc.d.ts +4 -0
- package/PieChart/PieArc.js +16 -11
- package/PieChart/PieArcPlot.js +28 -3
- package/PieChart/PieChart.js +1 -0
- package/PieChart/PieChart.plugins.d.ts +2 -1
- package/PieChart/PieChart.plugins.js +2 -1
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +9 -1
- package/PieChart/index.d.ts +1 -0
- package/PieChart/index.js +12 -0
- package/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/RadarChart/index.d.ts +2 -1
- package/RadarChart/index.js +12 -0
- package/RadarChart/useRadarChartProps.d.ts +2 -2
- package/ScatterChart/BatchScatter.d.ts +32 -0
- package/ScatterChart/BatchScatter.js +171 -0
- package/ScatterChart/Scatter.js +13 -5
- package/ScatterChart/ScatterChart.d.ts +4 -4
- package/ScatterChart/ScatterChart.js +13 -2
- package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/ScatterChart/ScatterChart.plugins.js +3 -2
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +14 -2
- package/ScatterChart/index.d.ts +1 -0
- package/ScatterChart/index.js +12 -0
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +8 -5
- package/SparkLineChart/SparkLineChart.js +10 -5
- package/Toolbar/Toolbar.js +1 -2
- package/colorPalettes/types.d.ts +1 -1
- package/context/ChartApi.d.ts +6 -6
- package/esm/BarChart/BarChart.d.ts +2 -2
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarChart.plugins.d.ts +3 -2
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/BarElement.js +10 -2
- package/esm/BarChart/index.d.ts +1 -0
- package/esm/BarChart/index.js +1 -0
- package/esm/BarChart/useBarChartProps.d.ts +2 -2
- package/esm/ChartContainer/ChartContainer.js +4 -2
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/esm/ChartsSurface/ChartsSurface.js +23 -3
- package/esm/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/esm/ChartsWrapper/ChartsWrapper.js +49 -46
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/LineChart/FocusedMark.d.ts +2 -0
- package/esm/LineChart/FocusedMark.js +38 -0
- package/esm/LineChart/LineChart.d.ts +2 -2
- package/esm/LineChart/LineChart.js +3 -1
- package/esm/LineChart/LineChart.plugins.d.ts +3 -2
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/index.d.ts +1 -0
- package/esm/LineChart/index.js +1 -0
- package/esm/LineChart/useLineChartProps.d.ts +2 -2
- package/esm/PieChart/PieArc.d.ts +4 -0
- package/esm/PieChart/PieArc.js +17 -12
- package/esm/PieChart/PieArcPlot.js +30 -5
- package/esm/PieChart/PieChart.js +1 -0
- package/esm/PieChart/PieChart.plugins.d.ts +2 -1
- package/esm/PieChart/PieChart.plugins.js +2 -1
- package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/esm/PieChart/dataTransform/useTransformData.js +9 -1
- package/esm/PieChart/index.d.ts +1 -0
- package/esm/PieChart/index.js +1 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/esm/RadarChart/index.d.ts +2 -1
- package/esm/RadarChart/index.js +2 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
- package/esm/ScatterChart/BatchScatter.d.ts +32 -0
- package/esm/ScatterChart/BatchScatter.js +165 -0
- package/esm/ScatterChart/Scatter.js +13 -5
- package/esm/ScatterChart/ScatterChart.d.ts +4 -4
- package/esm/ScatterChart/ScatterChart.js +13 -2
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
- package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
- package/esm/ScatterChart/ScatterPlot.js +14 -2
- package/esm/ScatterChart/index.d.ts +1 -0
- package/esm/ScatterChart/index.js +1 -0
- package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +8 -5
- package/esm/SparkLineChart/SparkLineChart.js +10 -5
- package/esm/Toolbar/Toolbar.js +1 -2
- package/esm/colorPalettes/types.d.ts +1 -1
- package/esm/context/ChartApi.d.ts +6 -6
- package/esm/hooks/useAxis.d.ts +5 -5
- package/esm/hooks/useDrawingArea.d.ts +20 -2
- package/esm/hooks/useFocusedItem.d.ts +15 -0
- package/esm/hooks/useFocusedItem.js +20 -0
- package/esm/hooks/useIsItemFocused.d.ts +12 -0
- package/esm/hooks/useIsItemFocused.js +15 -0
- package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/esm/hooks/useIsItemFocusedGetter.js +14 -0
- package/esm/hooks/useScale.js +6 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/internals/animation/Transition.js +1 -3
- package/esm/internals/index.d.ts +3 -2
- package/esm/internals/index.js +3 -2
- package/esm/internals/plugins/allPlugins.d.ts +5 -4
- package/esm/internals/plugins/allPlugins.js +3 -2
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +60 -32
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +66 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +121 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +49 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +20 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +41 -21
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
- 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/useChartInteraction/useChartInteraction.js +6 -4
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -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 +170 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +37 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +33 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +36 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/esm/internals/scaleGuards.d.ts +7 -0
- package/esm/internals/scaleGuards.js +6 -0
- package/esm/internals/ticks.d.ts +3 -5
- package/esm/internals/ticks.js +6 -5
- package/esm/locales/elGR.d.ts +96 -0
- package/esm/locales/elGR.js +100 -0
- package/esm/locales/enUS.d.ts +96 -0
- package/esm/locales/enUS.js +99 -1
- package/esm/locales/frFR.d.ts +96 -0
- package/esm/locales/frFR.js +100 -2
- package/esm/locales/ptBR.d.ts +96 -0
- package/esm/locales/ptBR.js +100 -0
- package/esm/locales/ptPT.d.ts +96 -0
- package/esm/locales/ptPT.js +100 -0
- package/esm/locales/svSE.d.ts +97 -1
- package/esm/locales/svSE.js +100 -0
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
- package/esm/plugins/index.d.ts +6 -0
- package/esm/plugins/index.js +12 -0
- package/hooks/useAxis.d.ts +5 -5
- package/hooks/useDrawingArea.d.ts +20 -2
- package/hooks/useFocusedItem.d.ts +15 -0
- package/hooks/useFocusedItem.js +26 -0
- package/hooks/useIsItemFocused.d.ts +12 -0
- package/hooks/useIsItemFocused.js +20 -0
- package/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/hooks/useIsItemFocusedGetter.js +18 -0
- package/hooks/useScale.js +6 -0
- package/index.d.ts +1 -0
- package/index.js +13 -1
- package/internals/animation/Transition.js +0 -2
- package/internals/index.d.ts +3 -2
- package/internals/index.js +20 -8
- package/internals/plugins/allPlugins.d.ts +5 -4
- package/internals/plugins/allPlugins.js +3 -2
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +59 -31
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +66 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +131 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +49 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +20 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +42 -22
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
- 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/useChartInteraction/useChartInteraction.js +6 -4
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +3 -2
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -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 +178 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +37 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +39 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +36 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/internals/scaleGuards.d.ts +7 -0
- package/internals/scaleGuards.js +8 -0
- package/internals/ticks.d.ts +3 -5
- package/internals/ticks.js +7 -5
- package/locales/elGR.d.ts +96 -0
- package/locales/elGR.js +100 -0
- package/locales/enUS.d.ts +96 -0
- package/locales/enUS.js +99 -1
- package/locales/frFR.d.ts +96 -0
- package/locales/frFR.js +100 -2
- package/locales/ptBR.d.ts +96 -0
- package/locales/ptBR.js +100 -0
- package/locales/ptPT.d.ts +96 -0
- package/locales/ptPT.js +100 -0
- package/locales/svSE.d.ts +97 -1
- package/locales/svSE.js +100 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/locales/utils/getChartsLocalization.d.ts +96 -0
- package/package.json +5 -5
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
- package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
- /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
- /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
|
|
5
|
+
const _excluded = ["className", "classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "stroke"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
10
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
10
|
-
import { styled } from '@mui/material/styles';
|
|
11
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
11
12
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
12
13
|
import { useAnimatePieArc } from "../hooks/index.js";
|
|
13
14
|
import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
|
|
@@ -16,7 +17,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
17
|
export function getPieArcUtilityClass(slot) {
|
|
17
18
|
return generateUtilityClass('MuiPieArc', slot);
|
|
18
19
|
}
|
|
19
|
-
export const pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded', 'series']);
|
|
20
|
+
export const pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded', 'series', 'focusIndicator']);
|
|
20
21
|
const useUtilityClasses = ownerState => {
|
|
21
22
|
const {
|
|
22
23
|
classes,
|
|
@@ -34,23 +35,21 @@ const PieArcRoot = styled('path', {
|
|
|
34
35
|
name: 'MuiPieArc',
|
|
35
36
|
slot: 'Root',
|
|
36
37
|
overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
|
|
37
|
-
})(
|
|
38
|
-
theme
|
|
39
|
-
}) => ({
|
|
40
|
-
// Got to move stroke to an element prop instead of style.
|
|
41
|
-
stroke: (theme.vars || theme).palette.background.paper,
|
|
38
|
+
})({
|
|
42
39
|
transitionProperty: 'opacity, fill, filter',
|
|
43
40
|
transitionDuration: `${ANIMATION_DURATION_MS}ms`,
|
|
44
41
|
transitionTimingFunction: ANIMATION_TIMING_FUNCTION
|
|
45
|
-
})
|
|
42
|
+
});
|
|
46
43
|
const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
47
44
|
const {
|
|
45
|
+
className,
|
|
48
46
|
classes: innerClasses,
|
|
49
47
|
color,
|
|
50
48
|
dataIndex,
|
|
51
49
|
id,
|
|
52
50
|
isFaded,
|
|
53
51
|
isHighlighted,
|
|
52
|
+
isFocused,
|
|
54
53
|
onClick,
|
|
55
54
|
cornerRadius,
|
|
56
55
|
startAngle,
|
|
@@ -58,16 +57,20 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
58
57
|
innerRadius,
|
|
59
58
|
outerRadius,
|
|
60
59
|
paddingAngle,
|
|
61
|
-
skipAnimation
|
|
60
|
+
skipAnimation,
|
|
61
|
+
stroke: strokeProp
|
|
62
62
|
} = props,
|
|
63
63
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
64
|
+
const theme = useTheme();
|
|
65
|
+
const stroke = strokeProp ?? (theme.vars || theme).palette.background.paper;
|
|
64
66
|
const ownerState = {
|
|
65
67
|
id,
|
|
66
68
|
dataIndex,
|
|
67
69
|
classes: innerClasses,
|
|
68
70
|
color,
|
|
69
71
|
isFaded,
|
|
70
|
-
isHighlighted
|
|
72
|
+
isHighlighted,
|
|
73
|
+
isFocused
|
|
71
74
|
};
|
|
72
75
|
const classes = useUtilityClasses(ownerState);
|
|
73
76
|
const interactionProps = useInteractionItemProps({
|
|
@@ -89,10 +92,11 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
89
92
|
onClick: onClick,
|
|
90
93
|
cursor: onClick ? 'pointer' : 'unset',
|
|
91
94
|
ownerState: ownerState,
|
|
92
|
-
className: classes.root,
|
|
95
|
+
className: clsx(classes.root, className),
|
|
93
96
|
fill: ownerState.color,
|
|
94
97
|
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
95
98
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : 'none',
|
|
99
|
+
stroke: stroke,
|
|
96
100
|
strokeWidth: 1,
|
|
97
101
|
strokeLinejoin: "round",
|
|
98
102
|
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
@@ -112,6 +116,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
112
116
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
113
117
|
innerRadius: PropTypes.number.isRequired,
|
|
114
118
|
isFaded: PropTypes.bool.isRequired,
|
|
119
|
+
isFocused: PropTypes.bool.isRequired,
|
|
115
120
|
isHighlighted: PropTypes.bool.isRequired,
|
|
116
121
|
outerRadius: PropTypes.number.isRequired,
|
|
117
122
|
paddingAngle: PropTypes.number.isRequired,
|
|
@@ -5,9 +5,11 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlighted", "faded", "data", "onItemClick", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import {
|
|
8
|
+
import { useTheme } from '@mui/material/styles';
|
|
9
|
+
import { useFocusedItem } from "../hooks/useFocusedItem.js";
|
|
10
|
+
import { PieArc, pieArcClasses } from "./PieArc.js";
|
|
9
11
|
import { useTransformData } from "./dataTransform/useTransformData.js";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
13
|
function PieArcPlot(props) {
|
|
12
14
|
const {
|
|
13
15
|
slots,
|
|
@@ -26,6 +28,7 @@ function PieArcPlot(props) {
|
|
|
26
28
|
skipAnimation
|
|
27
29
|
} = props,
|
|
28
30
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
+
const theme = useTheme();
|
|
29
32
|
const transformedData = useTransformData({
|
|
30
33
|
innerRadius,
|
|
31
34
|
outerRadius,
|
|
@@ -36,12 +39,16 @@ function PieArcPlot(props) {
|
|
|
36
39
|
faded,
|
|
37
40
|
data
|
|
38
41
|
});
|
|
42
|
+
const {
|
|
43
|
+
dataIndex: focusedIndex = -1
|
|
44
|
+
} = useFocusedItem() ?? {};
|
|
45
|
+
const focusedItem = focusedIndex !== -1 ? transformedData[focusedIndex] : null;
|
|
39
46
|
if (data.length === 0) {
|
|
40
47
|
return null;
|
|
41
48
|
}
|
|
42
49
|
const Arc = slots?.pieArc ?? PieArc;
|
|
43
|
-
return /*#__PURE__*/
|
|
44
|
-
children: transformedData.map((item, index) => /*#__PURE__*/_jsx(Arc, _extends({
|
|
50
|
+
return /*#__PURE__*/_jsxs("g", _extends({}, other, {
|
|
51
|
+
children: [transformedData.map((item, index) => /*#__PURE__*/_jsx(Arc, _extends({
|
|
45
52
|
startAngle: item.startAngle,
|
|
46
53
|
endAngle: item.endAngle,
|
|
47
54
|
paddingAngle: item.paddingAngle,
|
|
@@ -54,6 +61,7 @@ function PieArcPlot(props) {
|
|
|
54
61
|
dataIndex: index,
|
|
55
62
|
isFaded: item.isFaded,
|
|
56
63
|
isHighlighted: item.isHighlighted,
|
|
64
|
+
isFocused: item.isFocused,
|
|
57
65
|
onClick: onItemClick && (event => {
|
|
58
66
|
onItemClick(event, {
|
|
59
67
|
type: 'pie',
|
|
@@ -61,7 +69,24 @@ function PieArcPlot(props) {
|
|
|
61
69
|
dataIndex: index
|
|
62
70
|
}, item);
|
|
63
71
|
})
|
|
64
|
-
}, slotProps?.pieArc), item.dataIndex))
|
|
72
|
+
}, slotProps?.pieArc), item.dataIndex)), focusedItem && /*#__PURE__*/_jsx(Arc, {
|
|
73
|
+
startAngle: focusedItem.startAngle,
|
|
74
|
+
endAngle: focusedItem.endAngle,
|
|
75
|
+
paddingAngle: focusedItem.paddingAngle,
|
|
76
|
+
innerRadius: focusedItem.innerRadius,
|
|
77
|
+
color: focusedItem.color,
|
|
78
|
+
outerRadius: focusedItem.outerRadius,
|
|
79
|
+
cornerRadius: focusedItem.cornerRadius,
|
|
80
|
+
skipAnimation: true,
|
|
81
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
82
|
+
id: id,
|
|
83
|
+
className: pieArcClasses.focusIndicator,
|
|
84
|
+
dataIndex: focusedIndex,
|
|
85
|
+
isFaded: false,
|
|
86
|
+
isHighlighted: false,
|
|
87
|
+
isFocused: false,
|
|
88
|
+
strokeWidth: 3
|
|
89
|
+
})]
|
|
65
90
|
}));
|
|
66
91
|
}
|
|
67
92
|
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -120,6 +120,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
120
120
|
*/
|
|
121
121
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
122
122
|
desc: PropTypes.string,
|
|
123
|
+
enableKeyboardNavigation: PropTypes.bool,
|
|
123
124
|
/**
|
|
124
125
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
125
126
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
2
2
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
3
|
+
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
3
4
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
4
|
-
export type PieChartPluginSignatures = [UseChartInteractionSignature, UseChartHighlightSignature];
|
|
5
|
+
export type PieChartPluginSignatures = [UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
5
6
|
export declare const PIE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<PieChartPluginSignatures>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
2
2
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
3
|
-
|
|
3
|
+
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
4
|
+
export const PIE_CHART_PLUGINS = [useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
|
|
@@ -12,5 +12,6 @@ export interface ValueWithHighlight extends DefaultizedPieValueType, AnimatedObj
|
|
|
12
12
|
dataIndex: number;
|
|
13
13
|
isFaded: boolean;
|
|
14
14
|
isHighlighted: boolean;
|
|
15
|
+
isFocused: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function useTransformData(series: Pick<DefaultizedPieSeriesType, 'cornerRadius' | 'paddingAngle' | 'id' | 'highlighted' | 'faded' | 'data'> & ComputedPieRadius): ValueWithHighlight[];
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useItemHighlightedGetter } from "../../hooks/useItemHighlightedGetter.js";
|
|
6
|
+
import { useIsItemFocusedGetter } from "../../hooks/useIsItemFocusedGetter.js";
|
|
6
7
|
import { deg2rad } from "../../internals/angleConversion.js";
|
|
7
8
|
export function useTransformData(series) {
|
|
8
9
|
const {
|
|
@@ -20,6 +21,7 @@ export function useTransformData(series) {
|
|
|
20
21
|
isFaded: isItemFaded,
|
|
21
22
|
isHighlighted: isItemHighlighted
|
|
22
23
|
} = useItemHighlightedGetter();
|
|
24
|
+
const isItemFocused = useIsItemFocusedGetter();
|
|
23
25
|
const dataWithHighlight = React.useMemo(() => data.map((item, itemIndex) => {
|
|
24
26
|
const currentItem = {
|
|
25
27
|
seriesId,
|
|
@@ -27,6 +29,11 @@ export function useTransformData(series) {
|
|
|
27
29
|
};
|
|
28
30
|
const isHighlighted = isItemHighlighted(currentItem);
|
|
29
31
|
const isFaded = !isHighlighted && isItemFaded(currentItem);
|
|
32
|
+
const isFocused = isItemFocused({
|
|
33
|
+
seriesType: 'pie',
|
|
34
|
+
seriesId,
|
|
35
|
+
dataIndex: itemIndex
|
|
36
|
+
});
|
|
30
37
|
const attributesOverride = _extends({
|
|
31
38
|
additionalRadius: 0
|
|
32
39
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
@@ -39,12 +46,13 @@ export function useTransformData(series) {
|
|
|
39
46
|
dataIndex: itemIndex,
|
|
40
47
|
isFaded,
|
|
41
48
|
isHighlighted,
|
|
49
|
+
isFocused,
|
|
42
50
|
paddingAngle,
|
|
43
51
|
innerRadius,
|
|
44
52
|
outerRadius,
|
|
45
53
|
cornerRadius,
|
|
46
54
|
arcLabelRadius
|
|
47
55
|
});
|
|
48
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, seriesId]);
|
|
56
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, isItemFocused, seriesId]);
|
|
49
57
|
return dataWithHighlight;
|
|
50
58
|
}
|
package/esm/PieChart/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export * from "./PieArcLabelPlot.js";
|
|
|
5
5
|
export * from "./PieArc.js";
|
|
6
6
|
export * from "./PieArcLabel.js";
|
|
7
7
|
export * from "./getPieCoordinates.js";
|
|
8
|
+
export * from "./PieChart.plugins.js";
|
|
8
9
|
export { pieClasses } from "./pieClasses.js";
|
|
9
10
|
export type { PieClasses, PieClassKey } from "./pieClasses.js";
|
package/esm/PieChart/index.js
CHANGED
|
@@ -2,4 +2,4 @@ import { UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/
|
|
|
2
2
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
3
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
4
|
export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<UseChartPolarAxisSignature<any>>, import("../internals/index.js").ChartPlugin<UseChartInteractionSignature>, import("../internals/index.js").ChartPlugin<UseChartHighlightSignature>];
|
|
5
|
-
export type
|
|
5
|
+
export type RadarChartPluginSignatures = [UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
-
import {
|
|
3
|
+
import { RadarChartPluginSignatures } from "../RadarChart.plugins.js";
|
|
4
4
|
import { RadarSeriesType } from "../../models/seriesType/radar.js";
|
|
5
5
|
import { ChartDataProviderProps } from "../../ChartDataProvider/index.js";
|
|
6
6
|
import { RadarConfig } from "./radar.types.js";
|
|
7
7
|
import { ChartAnyPluginSignature } from "../../internals/plugins/models/plugin.js";
|
|
8
8
|
export type RadarSeries = MakeOptional<RadarSeriesType, 'type'>;
|
|
9
|
-
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] =
|
|
9
|
+
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginSignatures> = Omit<ChartDataProviderProps<'radar', TSignatures>, 'series' | 'rotationAxis' | 'radiusAxis' | 'dataset' | 'experimentalFeatures'> & {
|
|
10
10
|
/**
|
|
11
11
|
* The series to display in the bar chart.
|
|
12
12
|
* An array of [[RadarSeries]] objects.
|
|
@@ -22,5 +22,5 @@ export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSi
|
|
|
22
22
|
*/
|
|
23
23
|
highlight?: 'axis' | 'series' | 'none';
|
|
24
24
|
};
|
|
25
|
-
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] =
|
|
25
|
+
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginSignatures>(props: RadarDataProviderProps<TSignatures>): React.JSX.Element;
|
|
26
26
|
export { RadarDataProvider };
|
|
@@ -15,4 +15,5 @@ export * from "./RadarGrid/index.js";
|
|
|
15
15
|
export * from "./RadarAxis/index.js";
|
|
16
16
|
export * from "./RadarAxisHighlight/index.js";
|
|
17
17
|
export * from "./RadarMetricLabels/index.js";
|
|
18
|
-
export * from "./RadarSeriesPlot/index.js";
|
|
18
|
+
export * from "./RadarSeriesPlot/index.js";
|
|
19
|
+
export * from "./RadarChart.plugins.js";
|
package/esm/RadarChart/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export * from "./RadarGrid/index.js";
|
|
|
16
16
|
export * from "./RadarAxis/index.js";
|
|
17
17
|
export * from "./RadarAxisHighlight/index.js";
|
|
18
18
|
export * from "./RadarMetricLabels/index.js";
|
|
19
|
-
export * from "./RadarSeriesPlot/index.js";
|
|
19
|
+
export * from "./RadarSeriesPlot/index.js";
|
|
20
|
+
export * from "./RadarChart.plugins.js";
|
|
@@ -5,7 +5,7 @@ import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
|
5
5
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
6
6
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
7
7
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { RadarChartPluginSignatures } from "./RadarChart.plugins.js";
|
|
9
9
|
import { RadarSeriesAreaProps, RadarSeriesMarksProps } from "./RadarSeriesPlot/index.js";
|
|
10
10
|
/**
|
|
11
11
|
* A helper function that extracts RadarChartProps from the input props
|
|
@@ -18,7 +18,7 @@ export declare const useRadarChartProps: (props: RadarChartProps) => {
|
|
|
18
18
|
highlight: "none" | "series" | "axis";
|
|
19
19
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
20
20
|
chartsSurfaceProps: ChartsSurfaceProps;
|
|
21
|
-
radarDataProviderProps: RadarDataProviderProps<
|
|
21
|
+
radarDataProviderProps: RadarDataProviderProps<RadarChartPluginSignatures>;
|
|
22
22
|
radarGrid: RadarGridProps;
|
|
23
23
|
radarSeriesAreaProps: RadarSeriesAreaProps;
|
|
24
24
|
radarSeriesMarksProps: RadarSeriesMarksProps;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DefaultizedScatterSeriesType } from "../models/seriesType/scatter.js";
|
|
3
|
+
import { D3Scale } from "../models/axis.js";
|
|
4
|
+
import { ScatterClasses } from "./scatterClasses.js";
|
|
5
|
+
import { ColorGetter } from "../internals/plugins/models/seriesConfig/index.js";
|
|
6
|
+
export interface BatchScatterProps {
|
|
7
|
+
series: DefaultizedScatterSeriesType;
|
|
8
|
+
xScale: D3Scale;
|
|
9
|
+
yScale: D3Scale;
|
|
10
|
+
color: string;
|
|
11
|
+
colorGetter?: ColorGetter<'scatter'>;
|
|
12
|
+
classes?: Partial<ScatterClasses>;
|
|
13
|
+
}
|
|
14
|
+
export interface BatchScatterPathsProps {
|
|
15
|
+
series: DefaultizedScatterSeriesType;
|
|
16
|
+
xScale: D3Scale;
|
|
17
|
+
yScale: D3Scale;
|
|
18
|
+
color: string;
|
|
19
|
+
colorGetter?: ColorGetter<'scatter'>;
|
|
20
|
+
markerSize: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
* A batch version of the Scatter component that uses SVG paths to render points.
|
|
25
|
+
* This component is optimized for performance and is suitable for rendering large datasets, but has limitations. Some of the limitations include:
|
|
26
|
+
* - Limited CSS styling;
|
|
27
|
+
* - Overriding the `marker` slot is not supported;
|
|
28
|
+
* - Highlight style must not contain opacity.
|
|
29
|
+
*
|
|
30
|
+
* You can read about all the limitations [here](https://mui.com/x/react-charts/scatter/#performance).
|
|
31
|
+
*/
|
|
32
|
+
export declare function BatchScatter(props: BatchScatterProps): React.JSX.Element;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { useUtilityClasses } from "./scatterClasses.js";
|
|
6
|
+
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
7
|
+
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
8
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
9
|
+
import { selectorChartIsSeriesFaded, selectorChartIsSeriesHighlighted, selectorChartSeriesUnfadedItem, selectorChartSeriesHighlightedItem } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const MAX_POINTS_PER_PATH = 1000;
|
|
12
|
+
/* In an SVG arc, if the arc starts and ends at the same point, it is not rendered, so we add a tiny
|
|
13
|
+
* value to one of the coordinates to ensure that the arc is rendered. */
|
|
14
|
+
const ALMOST_ZERO = 0.01;
|
|
15
|
+
function appendAtKey(map, key, value) {
|
|
16
|
+
let bucket = map.get(key);
|
|
17
|
+
if (!bucket) {
|
|
18
|
+
bucket = [value];
|
|
19
|
+
map.set(key, bucket);
|
|
20
|
+
} else {
|
|
21
|
+
bucket.push(value);
|
|
22
|
+
}
|
|
23
|
+
return bucket;
|
|
24
|
+
}
|
|
25
|
+
function createPath(x, y, markerSize) {
|
|
26
|
+
return `M${x - markerSize} ${y} a${markerSize} ${markerSize} 0 1 1 0 ${ALMOST_ZERO}`;
|
|
27
|
+
}
|
|
28
|
+
function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGetter) {
|
|
29
|
+
const {
|
|
30
|
+
instance
|
|
31
|
+
} = useChartContext();
|
|
32
|
+
const getXPosition = getValueToPositionMapper(xScale);
|
|
33
|
+
const getYPosition = getValueToPositionMapper(yScale);
|
|
34
|
+
const paths = new Map();
|
|
35
|
+
const temporaryPaths = new Map();
|
|
36
|
+
for (let i = 0; i < seriesData.length; i += 1) {
|
|
37
|
+
const scatterPoint = seriesData[i];
|
|
38
|
+
const x = getXPosition(scatterPoint.x);
|
|
39
|
+
const y = getYPosition(scatterPoint.y);
|
|
40
|
+
if (!instance.isPointInside(x, y)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const path = createPath(x, y, markerSize);
|
|
44
|
+
const fill = colorGetter ? colorGetter(i) : color;
|
|
45
|
+
const tempPath = appendAtKey(temporaryPaths, fill, path);
|
|
46
|
+
if (tempPath.length >= MAX_POINTS_PER_PATH) {
|
|
47
|
+
appendAtKey(paths, fill, tempPath.join(''));
|
|
48
|
+
temporaryPaths.delete(fill);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const [fill, tempPath] of temporaryPaths.entries()) {
|
|
52
|
+
if (tempPath.length > 0) {
|
|
53
|
+
appendAtKey(paths, fill, tempPath.join(''));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return paths;
|
|
57
|
+
}
|
|
58
|
+
function BatchScatterPaths(props) {
|
|
59
|
+
const {
|
|
60
|
+
series,
|
|
61
|
+
xScale,
|
|
62
|
+
yScale,
|
|
63
|
+
color,
|
|
64
|
+
colorGetter,
|
|
65
|
+
markerSize
|
|
66
|
+
} = props;
|
|
67
|
+
const paths = useCreatePaths(series.data, markerSize, xScale, yScale, color, colorGetter);
|
|
68
|
+
const children = [];
|
|
69
|
+
let i = 0;
|
|
70
|
+
for (const [fill, dArray] of paths.entries()) {
|
|
71
|
+
for (const d of dArray) {
|
|
72
|
+
children.push(/*#__PURE__*/_jsx("path", {
|
|
73
|
+
fill: fill,
|
|
74
|
+
d: d
|
|
75
|
+
}, i));
|
|
76
|
+
i += 1;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
80
|
+
children: children
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const MemoBatchScatterPaths = /*#__PURE__*/React.memo(BatchScatterPaths);
|
|
84
|
+
if (process.env.NODE_ENV !== "production") MemoBatchScatterPaths.displayName = "MemoBatchScatterPaths";
|
|
85
|
+
const Group = styled('g')({
|
|
86
|
+
'&[data-faded="true"]': {
|
|
87
|
+
opacity: 0.3
|
|
88
|
+
},
|
|
89
|
+
'& path': {
|
|
90
|
+
/* The browser must do hit testing to know which element a pointer is interacting with.
|
|
91
|
+
* With many data points, we create many paths causing significant time to be spent in the hit test phase.
|
|
92
|
+
* To fix this issue, we disable pointer events for the descendant paths.
|
|
93
|
+
*
|
|
94
|
+
* Ideally, users should be able to override this in case they need pointer events to be enabled,
|
|
95
|
+
* but it can affect performance negatively, especially with many data points. */
|
|
96
|
+
pointerEvents: 'none'
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
* A batch version of the Scatter component that uses SVG paths to render points.
|
|
103
|
+
* This component is optimized for performance and is suitable for rendering large datasets, but has limitations. Some of the limitations include:
|
|
104
|
+
* - Limited CSS styling;
|
|
105
|
+
* - Overriding the `marker` slot is not supported;
|
|
106
|
+
* - Highlight style must not contain opacity.
|
|
107
|
+
*
|
|
108
|
+
* You can read about all the limitations [here](https://mui.com/x/react-charts/scatter/#performance).
|
|
109
|
+
*/
|
|
110
|
+
export function BatchScatter(props) {
|
|
111
|
+
const {
|
|
112
|
+
series,
|
|
113
|
+
xScale,
|
|
114
|
+
yScale,
|
|
115
|
+
color,
|
|
116
|
+
colorGetter,
|
|
117
|
+
classes: inClasses
|
|
118
|
+
} = props;
|
|
119
|
+
const {
|
|
120
|
+
store
|
|
121
|
+
} = useChartContext();
|
|
122
|
+
const isSeriesHighlighted = useSelector(store, selectorChartIsSeriesHighlighted, [series.id]);
|
|
123
|
+
const isSeriesFaded = useSelector(store, selectorChartIsSeriesFaded, [series.id]);
|
|
124
|
+
const seriesHighlightedItem = useSelector(store, selectorChartSeriesHighlightedItem, [series.id]);
|
|
125
|
+
const seriesUnfadedItem = useSelector(store, selectorChartSeriesUnfadedItem, [series.id]);
|
|
126
|
+
const highlightedModifier = 1.2;
|
|
127
|
+
const markerSize = series.markerSize * (isSeriesHighlighted ? highlightedModifier : 1);
|
|
128
|
+
const classes = useUtilityClasses(inClasses);
|
|
129
|
+
const siblings = [];
|
|
130
|
+
if (seriesHighlightedItem != null) {
|
|
131
|
+
const datum = series.data[seriesHighlightedItem];
|
|
132
|
+
const getXPosition = getValueToPositionMapper(xScale);
|
|
133
|
+
const getYPosition = getValueToPositionMapper(yScale);
|
|
134
|
+
siblings.push(/*#__PURE__*/_jsx("path", {
|
|
135
|
+
fill: colorGetter ? colorGetter(seriesHighlightedItem) : color,
|
|
136
|
+
"data-highlighted": true,
|
|
137
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), markerSize * highlightedModifier)
|
|
138
|
+
}, `highlighted-${series.id}`));
|
|
139
|
+
}
|
|
140
|
+
if (seriesUnfadedItem != null) {
|
|
141
|
+
const datum = series.data[seriesUnfadedItem];
|
|
142
|
+
const getXPosition = getValueToPositionMapper(xScale);
|
|
143
|
+
const getYPosition = getValueToPositionMapper(yScale);
|
|
144
|
+
siblings.push(/*#__PURE__*/_jsx("path", {
|
|
145
|
+
fill: colorGetter ? colorGetter(seriesUnfadedItem) : color,
|
|
146
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), markerSize)
|
|
147
|
+
}, `unfaded-${series.id}`));
|
|
148
|
+
}
|
|
149
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
150
|
+
children: [/*#__PURE__*/_jsx(Group, {
|
|
151
|
+
className: classes.root,
|
|
152
|
+
"data-series": series.id,
|
|
153
|
+
"data-faded": isSeriesFaded || undefined,
|
|
154
|
+
"data-highlighted": isSeriesHighlighted || undefined,
|
|
155
|
+
children: /*#__PURE__*/_jsx(MemoBatchScatterPaths, {
|
|
156
|
+
series: series,
|
|
157
|
+
xScale: xScale,
|
|
158
|
+
yScale: yScale,
|
|
159
|
+
color: color,
|
|
160
|
+
colorGetter: colorGetter,
|
|
161
|
+
markerSize: markerSize
|
|
162
|
+
})
|
|
163
|
+
}), siblings]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
@@ -10,11 +10,12 @@ import { getInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
|
10
10
|
import { useStore } from "../internals/store/useStore.js";
|
|
11
11
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
12
12
|
import { useItemHighlightedGetter } from "../hooks/useItemHighlightedGetter.js";
|
|
13
|
-
import {
|
|
13
|
+
import { selectorChartsIsVoronoiEnabled } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
14
14
|
import { ScatterMarker } from "./ScatterMarker.js";
|
|
15
15
|
import { useUtilityClasses } from "./scatterClasses.js";
|
|
16
16
|
import { useScatterPlotData } from "./useScatterPlotData.js";
|
|
17
17
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
18
|
+
import { useIsItemFocusedGetter } from "../hooks/useIsItemFocusedGetter.js";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
/**
|
|
20
21
|
* Demos:
|
|
@@ -42,12 +43,13 @@ function Scatter(props) {
|
|
|
42
43
|
instance
|
|
43
44
|
} = useChartContext();
|
|
44
45
|
const store = useStore();
|
|
45
|
-
const isVoronoiEnabled = useSelector(store,
|
|
46
|
+
const isVoronoiEnabled = useSelector(store, selectorChartsIsVoronoiEnabled);
|
|
46
47
|
const skipInteractionHandlers = isVoronoiEnabled || series.disableHover;
|
|
47
48
|
const {
|
|
48
49
|
isFaded,
|
|
49
50
|
isHighlighted
|
|
50
51
|
} = useItemHighlightedGetter();
|
|
52
|
+
const isFocused = useIsItemFocusedGetter();
|
|
51
53
|
const scatterPlotData = useScatterPlotData(series, xScale, yScale, instance.isPointInside);
|
|
52
54
|
const Marker = slots?.marker ?? ScatterMarker;
|
|
53
55
|
const _useSlotProps = useSlotProps({
|
|
@@ -64,12 +66,17 @@ function Scatter(props) {
|
|
|
64
66
|
return /*#__PURE__*/_jsx("g", {
|
|
65
67
|
"data-series": series.id,
|
|
66
68
|
className: classes.root,
|
|
67
|
-
children: scatterPlotData.map(
|
|
69
|
+
children: scatterPlotData.map(dataPoint => {
|
|
68
70
|
const isItemHighlighted = isHighlighted(dataPoint);
|
|
69
71
|
const isItemFaded = !isItemHighlighted && isFaded(dataPoint);
|
|
72
|
+
const isItemFocused = isFocused({
|
|
73
|
+
seriesType: 'scatter',
|
|
74
|
+
seriesId: series.id,
|
|
75
|
+
dataIndex: dataPoint.dataIndex
|
|
76
|
+
});
|
|
70
77
|
return /*#__PURE__*/_jsx(Marker, _extends({
|
|
71
78
|
dataIndex: dataPoint.dataIndex,
|
|
72
|
-
color: colorGetter ? colorGetter(
|
|
79
|
+
color: colorGetter ? colorGetter(dataPoint.dataIndex) : color,
|
|
73
80
|
isHighlighted: isItemHighlighted,
|
|
74
81
|
isFaded: isItemFaded,
|
|
75
82
|
x: dataPoint.x,
|
|
@@ -80,7 +87,8 @@ function Scatter(props) {
|
|
|
80
87
|
dataIndex: dataPoint.dataIndex
|
|
81
88
|
})),
|
|
82
89
|
"data-highlighted": isItemHighlighted || undefined,
|
|
83
|
-
"data-faded": isItemFaded || undefined
|
|
90
|
+
"data-faded": isItemFaded || undefined,
|
|
91
|
+
"data-focused": isItemFocused || undefined
|
|
84
92
|
}, skipInteractionHandlers ? undefined : getInteractionItemProps(instance, dataPoint), markerProps), dataPoint.id ?? dataPoint.dataIndex);
|
|
85
93
|
})
|
|
86
94
|
});
|
|
@@ -13,8 +13,8 @@ import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "
|
|
|
13
13
|
import { ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.js";
|
|
14
14
|
import { ChartsAxisSlots, ChartsAxisSlotProps } from "../models/axis.js";
|
|
15
15
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { UseChartClosestPointSignature } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
17
|
+
import { ScatterChartPluginSignatures } from "./ScatterChart.plugins.js";
|
|
18
18
|
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
19
19
|
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, Omit<ChartsTooltipSlotProps, 'tooltip'>, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {
|
|
20
20
|
/**
|
|
@@ -24,7 +24,7 @@ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotS
|
|
|
24
24
|
tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>>;
|
|
25
25
|
}
|
|
26
26
|
export type ScatterSeries = MakeOptional<ScatterSeriesType, 'type'>;
|
|
27
|
-
export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter',
|
|
27
|
+
export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', ScatterChartPluginSignatures>, 'series' | 'plugins' | 'onItemClick' | 'experimentalFeatures' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ScatterPlotProps, 'renderer'> {
|
|
28
28
|
/**
|
|
29
29
|
* The series to display in the scatter chart.
|
|
30
30
|
* An array of [[ScatterSeries]] objects.
|
|
@@ -69,7 +69,7 @@ export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', S
|
|
|
69
69
|
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element if using Voronoi cells. Or the Mouse event from the scatter element, when `disableVoronoi=true`.
|
|
70
70
|
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
71
71
|
*/
|
|
72
|
-
onItemClick?: ScatterPlotProps['onItemClick'] |
|
|
72
|
+
onItemClick?: ScatterPlotProps['onItemClick'] | UseChartClosestPointSignature['params']['onItemClick'];
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Demos:
|
|
@@ -103,6 +103,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
103
103
|
* @default false
|
|
104
104
|
*/
|
|
105
105
|
disableVoronoi: PropTypes.bool,
|
|
106
|
+
enableKeyboardNavigation: PropTypes.bool,
|
|
106
107
|
/**
|
|
107
108
|
* Option to display a cartesian grid in the background.
|
|
108
109
|
*/
|
|
@@ -171,6 +172,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
171
172
|
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
172
173
|
*/
|
|
173
174
|
onItemClick: PropTypes.func,
|
|
175
|
+
/**
|
|
176
|
+
* The type of renderer to use for the scatter plot.
|
|
177
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
178
|
+
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
179
|
+
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
180
|
+
*
|
|
181
|
+
* @default 'svg-single'
|
|
182
|
+
*/
|
|
183
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
|
|
174
184
|
/**
|
|
175
185
|
* The series to display in the scatter chart.
|
|
176
186
|
* An array of [[ScatterSeries]] objects.
|
|
@@ -200,10 +210,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
200
210
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
201
211
|
title: PropTypes.string,
|
|
202
212
|
/**
|
|
203
|
-
* Defines the
|
|
213
|
+
* Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
|
|
214
|
+
* If set to `'item'`, the radius is the `markerSize`.
|
|
204
215
|
* If `undefined`, the radius is assumed to be infinite.
|
|
205
216
|
*/
|
|
206
|
-
voronoiMaxRadius: PropTypes.number,
|
|
217
|
+
voronoiMaxRadius: PropTypes.oneOfType([PropTypes.oneOf(['item']), PropTypes.number]),
|
|
207
218
|
/**
|
|
208
219
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
209
220
|
*/
|