@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
|
@@ -14,12 +14,12 @@ import { ChartsAxisSlotProps, ChartsAxisSlots } from "../models/axis.js";
|
|
|
14
14
|
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighlightPlot.js";
|
|
15
15
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
16
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
17
|
-
import {
|
|
17
|
+
import { LineChartPluginSignatures } from "./LineChart.plugins.js";
|
|
18
18
|
import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
|
|
19
19
|
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
20
20
|
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
21
21
|
export type LineSeries = MakeOptional<LineSeriesType, 'type'>;
|
|
22
|
-
export interface LineChartProps extends Omit<ChartContainerProps<'line',
|
|
22
|
+
export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
23
23
|
/**
|
|
24
24
|
* The series to display in the line chart.
|
|
25
25
|
* An array of [[LineSeries]] objects.
|
|
@@ -20,6 +20,7 @@ import { useChartContainerProps } from "../ChartContainer/useChartContainerProps
|
|
|
20
20
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
21
21
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
22
22
|
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
23
|
+
import { FocusedMark } from "./FocusedMark.js";
|
|
23
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
/**
|
|
25
26
|
* Demos:
|
|
@@ -63,7 +64,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
63
64
|
children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
64
65
|
children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
65
66
|
children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
66
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
67
|
+
})), /*#__PURE__*/_jsx(FocusedMark, {}), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
67
68
|
"data-drawing-container": true,
|
|
68
69
|
children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
|
|
69
70
|
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
@@ -111,6 +112,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
111
112
|
* If `true`, render the line highlight item.
|
|
112
113
|
*/
|
|
113
114
|
disableLineItemHighlight: PropTypes.bool,
|
|
115
|
+
enableKeyboardNavigation: PropTypes.bool,
|
|
114
116
|
/**
|
|
115
117
|
* Options to enable features planned for the next major.
|
|
116
118
|
*/
|
|
@@ -2,6 +2,7 @@ import { UseChartZAxisSignature } from "../internals/plugins/featurePlugins/useC
|
|
|
2
2
|
import { UseChartCartesianAxisSignature } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
3
3
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
+
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
5
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
6
|
-
export type
|
|
7
|
-
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<
|
|
7
|
+
export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
8
|
+
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;
|
|
@@ -2,4 +2,5 @@ import { useChartZAxis } from "../internals/plugins/featurePlugins/useChartZAxis
|
|
|
2
2
|
import { useChartCartesianAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
3
3
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
-
|
|
5
|
+
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
|
+
export const LINE_CHART_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
|
package/esm/LineChart/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export * from "./LineElement.js";
|
|
|
9
9
|
export * from "./AnimatedLine.js";
|
|
10
10
|
export * from "./MarkElement.js";
|
|
11
11
|
export * from "./LineHighlightElement.js";
|
|
12
|
+
export * from "./LineChart.plugins.js";
|
|
12
13
|
export type { MarkElementClasses, MarkElementClassKey } from "./markElementClasses.js";
|
|
13
14
|
export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
|
package/esm/LineChart/index.js
CHANGED
|
@@ -9,4 +9,5 @@ export * from "./LineElement.js";
|
|
|
9
9
|
export * from "./AnimatedLine.js";
|
|
10
10
|
export * from "./MarkElement.js";
|
|
11
11
|
export * from "./LineHighlightElement.js";
|
|
12
|
+
export * from "./LineChart.plugins.js";
|
|
12
13
|
export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
|
|
3
3
|
import { useChartGradientIdBuilder } from "../hooks/useChartGradientId.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
5
5
|
import { getCurveFactory } from "../internals/getCurve.js";
|
|
6
6
|
import { getValueToPositionMapper, useLineSeriesContext, useXAxes, useYAxes } from "../hooks/index.js";
|
|
7
7
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -52,7 +52,7 @@ export function useAreaPlotData(xAxes, yAxes) {
|
|
|
52
52
|
throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const shouldExpand = curve?.includes('step') && !strictStepCurve &&
|
|
55
|
+
const shouldExpand = curve?.includes('step') && !strictStepCurve && isOrdinalScale(xScale);
|
|
56
56
|
const formattedData = xData?.flatMap((x, index) => {
|
|
57
57
|
const nullData = data[index] == null;
|
|
58
58
|
if (shouldExpand) {
|
|
@@ -12,7 +12,7 @@ import { LineHighlightPlotProps } from "./LineHighlightPlot.js";
|
|
|
12
12
|
import { LinePlotProps } from "./LinePlot.js";
|
|
13
13
|
import { MarkPlotProps } from "./MarkPlot.js";
|
|
14
14
|
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { LineChartPluginSignatures } from "./LineChart.plugins.js";
|
|
16
16
|
/**
|
|
17
17
|
* A helper function that extracts LineChartProps from the input props
|
|
18
18
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -22,7 +22,7 @@ import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const useLineChartProps: (props: LineChartProps) => {
|
|
24
24
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
25
|
-
chartContainerProps: ChartContainerProps<"line",
|
|
25
|
+
chartContainerProps: ChartContainerProps<"line", LineChartPluginSignatures>;
|
|
26
26
|
gridProps: ChartsGridProps;
|
|
27
27
|
clipPathProps: ChartsClipPathProps;
|
|
28
28
|
clipPathGroupProps: {
|
|
@@ -119,7 +119,8 @@ export const useLineChartProps = props => {
|
|
|
119
119
|
const chartsWrapperProps = {
|
|
120
120
|
sx,
|
|
121
121
|
legendPosition: props.slotProps?.legend?.position,
|
|
122
|
-
legendDirection: props.slotProps?.legend?.direction
|
|
122
|
+
legendDirection: props.slotProps?.legend?.direction,
|
|
123
|
+
hideLegend: props.hideLegend ?? false
|
|
123
124
|
};
|
|
124
125
|
return {
|
|
125
126
|
chartsWrapperProps,
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
3
3
|
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
4
4
|
import { useChartGradientIdBuilder } from "../hooks/useChartGradientId.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
6
6
|
import { getCurveFactory } from "../internals/getCurve.js";
|
|
7
7
|
import { getValueToPositionMapper, useLineSeriesContext, useXAxes, useYAxes } from "../hooks/index.js";
|
|
8
8
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -50,7 +50,7 @@ export function useLinePlotData(xAxes, yAxes) {
|
|
|
50
50
|
warnOnce(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`, 'error');
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const shouldExpand = curve?.includes('step') && !strictStepCurve &&
|
|
53
|
+
const shouldExpand = curve?.includes('step') && !strictStepCurve && isOrdinalScale(xScale);
|
|
54
54
|
const formattedData = xData?.flatMap((x, index) => {
|
|
55
55
|
const nullData = data[index] == null;
|
|
56
56
|
if (shouldExpand) {
|
package/esm/PieChart/PieArc.d.ts
CHANGED
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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 = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -51,6 +51,7 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
51
51
|
id,
|
|
52
52
|
isFaded,
|
|
53
53
|
isHighlighted,
|
|
54
|
+
isFocused,
|
|
54
55
|
onClick,
|
|
55
56
|
cornerRadius,
|
|
56
57
|
startAngle,
|
|
@@ -67,7 +68,8 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
67
68
|
classes: innerClasses,
|
|
68
69
|
color,
|
|
69
70
|
isFaded,
|
|
70
|
-
isHighlighted
|
|
71
|
+
isHighlighted,
|
|
72
|
+
isFocused
|
|
71
73
|
};
|
|
72
74
|
const classes = useUtilityClasses(ownerState);
|
|
73
75
|
const interactionProps = useInteractionItemProps({
|
|
@@ -96,7 +98,8 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
96
98
|
strokeWidth: 1,
|
|
97
99
|
strokeLinejoin: "round",
|
|
98
100
|
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
99
|
-
"data-faded": ownerState.isFaded || undefined
|
|
101
|
+
"data-faded": ownerState.isFaded || undefined,
|
|
102
|
+
"data-focused": isFocused || undefined
|
|
100
103
|
}, other, interactionProps, animatedProps));
|
|
101
104
|
});
|
|
102
105
|
if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
|
|
@@ -112,6 +115,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
112
115
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
113
116
|
innerRadius: PropTypes.number.isRequired,
|
|
114
117
|
isFaded: PropTypes.bool.isRequired,
|
|
118
|
+
isFocused: PropTypes.bool.isRequired,
|
|
115
119
|
isHighlighted: PropTypes.bool.isRequired,
|
|
116
120
|
outerRadius: PropTypes.number.isRequired,
|
|
117
121
|
paddingAngle: PropTypes.number.isRequired,
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -78,6 +78,7 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
78
78
|
legendPosition: props.slotProps?.legend?.position,
|
|
79
79
|
legendDirection: props.slotProps?.legend?.direction ?? 'vertical',
|
|
80
80
|
sx: sx,
|
|
81
|
+
hideLegend: hideLegend ?? false,
|
|
81
82
|
children: [showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
|
|
82
83
|
direction: props.slotProps?.legend?.direction ?? 'vertical',
|
|
83
84
|
slots: slots,
|
|
@@ -119,6 +120,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
119
120
|
*/
|
|
120
121
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
121
122
|
desc: PropTypes.string,
|
|
123
|
+
enableKeyboardNavigation: PropTypes.bool,
|
|
122
124
|
/**
|
|
123
125
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
124
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
|
@@ -3,7 +3,7 @@ import { useRadiusAxes } from "../../hooks/useAxis.js";
|
|
|
3
3
|
import { useRotationScale } from "../../hooks/useScale.js";
|
|
4
4
|
import { useChartContext } from "../../context/ChartProvider/useChartContext.js";
|
|
5
5
|
import { selectorChartPolarCenter } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { isOrdinalScale } from "../../internals/scaleGuards.js";
|
|
7
7
|
import { degToRad } from "../../internals/degToRad.js";
|
|
8
8
|
import { clampAngle } from "../../internals/clampAngle.js";
|
|
9
9
|
import { useSelector } from "../../internals/store/useSelector.js";
|
|
@@ -42,7 +42,7 @@ export function useRadarAxis(params) {
|
|
|
42
42
|
}, (_, index) => (index + 1) / divisions);
|
|
43
43
|
const radiusScale = radiusAxis[metric].scale;
|
|
44
44
|
const R = radiusScale.range()[1];
|
|
45
|
-
if (
|
|
45
|
+
if (isOrdinalScale(radiusScale)) {
|
|
46
46
|
if (process.env.NODE_ENV !== 'production') {
|
|
47
47
|
console.error('MUI X Charts: Radar chart does not support ordinal axes');
|
|
48
48
|
}
|
|
@@ -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
|
+
}
|