@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
6
6
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
7
7
|
import { useStore } from "../internals/store/useStore.js";
|
|
8
8
|
import { selectorChartsHighlightYAxisValue, selectorChartYAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
@@ -35,15 +35,15 @@ export default function ChartsYHighlight(props) {
|
|
|
35
35
|
const yAxis = yAxes.axis[axisId];
|
|
36
36
|
const yScale = yAxis.scale;
|
|
37
37
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
38
|
-
const
|
|
38
|
+
const isYScaleOrdinal = type === 'band' && value !== null && isOrdinalScale(yScale);
|
|
39
39
|
if (process.env.NODE_ENV !== 'production') {
|
|
40
|
-
const isError =
|
|
40
|
+
const isError = isYScaleOrdinal && yScale(value) === undefined;
|
|
41
41
|
if (isError) {
|
|
42
42
|
console.error([`MUI X Charts: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
-
children: [
|
|
46
|
+
children: [isYScaleOrdinal && yScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
47
47
|
d: `M ${left} ${yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
|
|
48
48
|
className: classes.root,
|
|
49
49
|
ownerState: {
|
|
@@ -51,7 +51,8 @@ const RootElement = styled('ul', {
|
|
|
51
51
|
display: ownerState.direction === 'vertical' ? 'flex' : 'inline-flex',
|
|
52
52
|
alignItems: 'center',
|
|
53
53
|
gap: theme.spacing(1)
|
|
54
|
-
}
|
|
54
|
+
},
|
|
55
|
+
gridArea: 'legend'
|
|
55
56
|
}));
|
|
56
57
|
const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
|
|
57
58
|
defaultProps: {
|
|
@@ -66,6 +66,7 @@ const RootElement = styled('ul', {
|
|
|
66
66
|
paddingInlineStart: 0,
|
|
67
67
|
marginBlock: theme.spacing(1),
|
|
68
68
|
marginInline: theme.spacing(1),
|
|
69
|
+
gridArea: 'legend',
|
|
69
70
|
[`&.${continuousColorLegendClasses.horizontal}`]: {
|
|
70
71
|
gridTemplateRows: 'min-content min-content',
|
|
71
72
|
gridTemplateColumns: 'min-content auto min-content',
|
|
@@ -20,10 +20,10 @@ export interface PiecewiseColorLegendProps extends ColorLegendSelector, PrependK
|
|
|
20
20
|
*/
|
|
21
21
|
labelFormatter?: (params: PiecewiseLabelFormatterParams) => string | null;
|
|
22
22
|
/**
|
|
23
|
-
* Where to position the labels relative to the
|
|
23
|
+
* Where to position the labels relative to the color marks.
|
|
24
24
|
* @default 'extremes'
|
|
25
25
|
*/
|
|
26
|
-
labelPosition?: 'start' | 'end' | 'extremes';
|
|
26
|
+
labelPosition?: 'start' | 'end' | 'extremes' | 'inline-start' | 'inline-end';
|
|
27
27
|
/**
|
|
28
28
|
* Callback fired when a legend item is clicked.
|
|
29
29
|
* @param {React.MouseEvent<HTMLButtonElement, MouseEvent>} event The click event.
|
|
@@ -21,6 +21,7 @@ const RootElement = styled('ul', {
|
|
|
21
21
|
theme,
|
|
22
22
|
ownerState
|
|
23
23
|
}) => {
|
|
24
|
+
const classes = piecewiseColorLegendClasses;
|
|
24
25
|
return _extends({}, theme.typography.caption, {
|
|
25
26
|
color: (theme.vars || theme).palette.text.primary,
|
|
26
27
|
lineHeight: '100%',
|
|
@@ -32,8 +33,9 @@ const RootElement = styled('ul', {
|
|
|
32
33
|
paddingInlineStart: 0,
|
|
33
34
|
marginBlock: theme.spacing(1),
|
|
34
35
|
marginInline: theme.spacing(1),
|
|
35
|
-
width: '
|
|
36
|
-
|
|
36
|
+
width: 'fit-content',
|
|
37
|
+
gridArea: 'legend',
|
|
38
|
+
[`button.${classes.item}`]: {
|
|
37
39
|
// Reset button styles
|
|
38
40
|
background: 'none',
|
|
39
41
|
border: 'none',
|
|
@@ -45,55 +47,62 @@ const RootElement = styled('ul', {
|
|
|
45
47
|
letterSpacing: 'inherit',
|
|
46
48
|
color: 'inherit'
|
|
47
49
|
},
|
|
48
|
-
[`.${
|
|
50
|
+
[`.${classes.item}`]: {
|
|
49
51
|
display: 'flex',
|
|
50
52
|
gap: theme.spacing(0.5)
|
|
51
53
|
},
|
|
52
|
-
[`li :not(.${
|
|
54
|
+
[`li :not(.${classes.minLabel}, .${classes.maxLabel}) .${classes?.mark}`]: {
|
|
53
55
|
alignSelf: 'center'
|
|
54
56
|
},
|
|
55
|
-
[`&.${
|
|
57
|
+
[`&.${classes.start}`]: {
|
|
56
58
|
alignItems: 'end'
|
|
57
59
|
},
|
|
58
|
-
[`&.${
|
|
60
|
+
[`&.${classes.end}`]: {
|
|
59
61
|
alignItems: 'start'
|
|
60
62
|
},
|
|
61
|
-
[`&.${
|
|
63
|
+
[`&.${classes.horizontal}`]: {
|
|
62
64
|
alignItems: 'center',
|
|
63
|
-
[`.${
|
|
65
|
+
[`.${classes.item}`]: {
|
|
64
66
|
flexDirection: 'column'
|
|
65
67
|
},
|
|
66
|
-
[`&.${
|
|
68
|
+
[`&.${classes.inlineStart}, &.${classes.inlineEnd}`]: {
|
|
69
|
+
gap: theme.spacing(1.5),
|
|
70
|
+
flexWrap: 'wrap',
|
|
71
|
+
[`.${classes.item}`]: {
|
|
72
|
+
flexDirection: 'row'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[`&.${classes.start}`]: {
|
|
67
76
|
alignItems: 'end'
|
|
68
77
|
},
|
|
69
|
-
[`&.${
|
|
78
|
+
[`&.${classes.end}`]: {
|
|
70
79
|
alignItems: 'start'
|
|
71
80
|
},
|
|
72
|
-
[`.${
|
|
81
|
+
[`.${classes.minLabel}`]: {
|
|
73
82
|
alignItems: 'end'
|
|
74
83
|
},
|
|
75
|
-
[`&.${
|
|
76
|
-
[`.${
|
|
84
|
+
[`&.${classes.extremes}`]: {
|
|
85
|
+
[`.${classes.minLabel}, .${classes.maxLabel}`]: {
|
|
77
86
|
alignItems: 'center',
|
|
78
87
|
display: 'flex',
|
|
79
88
|
flexDirection: 'row'
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
},
|
|
83
|
-
[`&.${
|
|
84
|
-
[`.${
|
|
92
|
+
[`&.${classes.vertical}`]: {
|
|
93
|
+
[`.${classes.item}`]: {
|
|
85
94
|
flexDirection: 'row',
|
|
86
95
|
alignItems: 'center'
|
|
87
96
|
},
|
|
88
|
-
[`&.${
|
|
97
|
+
[`&.${classes.start}, &.${classes.inlineStart}`]: {
|
|
89
98
|
alignItems: 'end'
|
|
90
99
|
},
|
|
91
|
-
[`&.${
|
|
100
|
+
[`&.${classes.end}, &.${classes.inlineEnd}`]: {
|
|
92
101
|
alignItems: 'start'
|
|
93
102
|
},
|
|
94
|
-
[`&.${
|
|
103
|
+
[`&.${classes.extremes}`]: {
|
|
95
104
|
alignItems: 'center',
|
|
96
|
-
[`.${
|
|
105
|
+
[`.${classes.minLabel}, .${classes.maxLabel}`]: {
|
|
97
106
|
alignItems: 'center',
|
|
98
107
|
display: 'flex',
|
|
99
108
|
flexDirection: 'column'
|
|
@@ -146,6 +155,8 @@ const PiecewiseColorLegend = consumeThemeProps('MuiPiecewiseColorLegend', {
|
|
|
146
155
|
const isStart = labelPosition === 'start';
|
|
147
156
|
const isEnd = labelPosition === 'end';
|
|
148
157
|
const isExtremes = labelPosition === 'extremes';
|
|
158
|
+
const isInlineStart = labelPosition === 'inline-start';
|
|
159
|
+
const isInlineEnd = labelPosition === 'inline-end';
|
|
149
160
|
return /*#__PURE__*/_jsx(RootElement, _extends({
|
|
150
161
|
className: clsx(classes?.root, className),
|
|
151
162
|
ref: ref
|
|
@@ -179,8 +190,8 @@ const PiecewiseColorLegend = consumeThemeProps('MuiPiecewiseColorLegend', {
|
|
|
179
190
|
if (label === null || label === undefined) {
|
|
180
191
|
return null;
|
|
181
192
|
}
|
|
182
|
-
const isTextBefore = isStart || isExtremes && isFirst;
|
|
183
|
-
const isTextAfter = isEnd || isExtremes && isLast;
|
|
193
|
+
const isTextBefore = isStart || isExtremes && isFirst || isInlineStart;
|
|
194
|
+
const isTextAfter = isEnd || isExtremes && isLast || isInlineEnd;
|
|
184
195
|
const clickObject = {
|
|
185
196
|
type: 'piecewiseColor',
|
|
186
197
|
color,
|
|
@@ -248,7 +259,7 @@ process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
|
|
|
248
259
|
* Where to position the labels relative to the gradient.
|
|
249
260
|
* @default 'extremes'
|
|
250
261
|
*/
|
|
251
|
-
labelPosition: PropTypes.oneOf(['start', 'end', 'extremes']),
|
|
262
|
+
labelPosition: PropTypes.oneOf(['start', 'end', 'extremes', 'inline-start', 'inline-end']),
|
|
252
263
|
/**
|
|
253
264
|
* The type of the mark.
|
|
254
265
|
* @default 'square'
|
|
@@ -19,6 +19,10 @@ export interface PiecewiseColorLegendClasses {
|
|
|
19
19
|
end: string;
|
|
20
20
|
/** Styles applied to the legend with the labels on the extremes of the color marks. */
|
|
21
21
|
extremes: string;
|
|
22
|
+
/** Styles applied to the legend with the labels inlined before the color marks. */
|
|
23
|
+
inlineStart: string;
|
|
24
|
+
/** Styles applied to the legend with the labels inlined after the color marks. */
|
|
25
|
+
inlineEnd: string;
|
|
22
26
|
/** Styles applied to the marks. */
|
|
23
27
|
mark: string;
|
|
24
28
|
/** Styles applied to the series label. */
|
|
@@ -11,7 +11,7 @@ export const useUtilityClasses = props => {
|
|
|
11
11
|
labelPosition
|
|
12
12
|
} = props;
|
|
13
13
|
const slots = {
|
|
14
|
-
root: ['root', direction, labelPosition],
|
|
14
|
+
root: ['root', direction, labelPosition?.replaceAll(/-(\w)/g, match => match[1].toUpperCase())],
|
|
15
15
|
minLabel: ['minLabel'],
|
|
16
16
|
maxLabel: ['maxLabel'],
|
|
17
17
|
item: ['item'],
|
|
@@ -20,4 +20,4 @@ export const useUtilityClasses = props => {
|
|
|
20
20
|
};
|
|
21
21
|
return composeClasses(slots, getLegendUtilityClass, classes);
|
|
22
22
|
};
|
|
23
|
-
export const piecewiseColorLegendClasses = generateUtilityClasses('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'mark', 'label']);
|
|
23
|
+
export const piecewiseColorLegendClasses = generateUtilityClasses('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'inlineStart', 'inlineEnd', 'mark', 'label']);
|
|
@@ -12,6 +12,7 @@ import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
|
12
12
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
13
13
|
import { useStore } from "../internals/store/useStore.js";
|
|
14
14
|
import { selectorChartContainerSize, selectorChartPropsSize } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js";
|
|
15
|
+
import { selectorChartsHasFocusedItem, selectorChartsIsKeyboardNavigationEnabled } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const ChartsSurfaceStyles = styled('svg', {
|
|
17
18
|
name: 'MuiChartsSurface',
|
|
@@ -30,7 +31,22 @@ const ChartsSurfaceStyles = styled('svg', {
|
|
|
30
31
|
// This prevents default touch actions when using the svg on mobile devices.
|
|
31
32
|
// For example, prevent page scroll & zoom.
|
|
32
33
|
touchAction: 'pan-y',
|
|
33
|
-
userSelect: 'none'
|
|
34
|
+
userSelect: 'none',
|
|
35
|
+
gridArea: 'chart',
|
|
36
|
+
'&:focus': {
|
|
37
|
+
outline: 'none' // By default don't show focus on the SVG container
|
|
38
|
+
},
|
|
39
|
+
'&:focus-visible': {
|
|
40
|
+
// Show focus outline on the SVG container only when using keyboard navigation
|
|
41
|
+
outline: 'auto',
|
|
42
|
+
'&[data-has-focused-item=true]': {
|
|
43
|
+
// But not if the chart has a focused children item
|
|
44
|
+
outline: 'none'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
'& [data-focused=true]': {
|
|
48
|
+
outline: 'auto'
|
|
49
|
+
}
|
|
34
50
|
}));
|
|
35
51
|
|
|
36
52
|
/**
|
|
@@ -57,6 +73,8 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inPro
|
|
|
57
73
|
width: propsWidth,
|
|
58
74
|
height: propsHeight
|
|
59
75
|
} = useSelector(store, selectorChartPropsSize);
|
|
76
|
+
const isKeyboardNavigationEnabled = useSelector(store, selectorChartsIsKeyboardNavigationEnabled);
|
|
77
|
+
const hasFocusedItem = useSelector(store, selectorChartsHasFocusedItem);
|
|
60
78
|
const svgRef = useSvgRef();
|
|
61
79
|
const handleRef = useForkRef(svgRef, ref);
|
|
62
80
|
const themeProps = useThemeProps({
|
|
@@ -77,7 +95,9 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inPro
|
|
|
77
95
|
height: propsHeight
|
|
78
96
|
},
|
|
79
97
|
viewBox: `${0} ${0} ${svgWidth} ${svgHeight}`,
|
|
80
|
-
className: className
|
|
98
|
+
className: className,
|
|
99
|
+
tabIndex: isKeyboardNavigationEnabled ? 0 : undefined,
|
|
100
|
+
"data-has-focused-item": hasFocusedItem || undefined
|
|
81
101
|
}, other, {
|
|
82
102
|
ref: handleRef,
|
|
83
103
|
children: [title && /*#__PURE__*/_jsx("title", {
|
|
@@ -13,6 +13,11 @@ export interface ChartsWrapperProps {
|
|
|
13
13
|
* @default 'horizontal'
|
|
14
14
|
*/
|
|
15
15
|
legendDirection?: Direction;
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the legend is not rendered.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
hideLegend?: boolean;
|
|
16
21
|
/**
|
|
17
22
|
* If `true`, the chart wrapper set `height: 100%`.
|
|
18
23
|
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
@@ -6,59 +6,103 @@ import { useChartRootRef } from "../hooks/useChartRootRef.js";
|
|
|
6
6
|
import { useStore } from "../internals/store/useStore.js";
|
|
7
7
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
8
8
|
import { selectorChartPropsSize } from "../internals/plugins/corePlugins/useChartDimensions/index.js";
|
|
9
|
+
import { chartsToolbarClasses } from "../Toolbar/index.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
const
|
|
11
|
+
const getJustifyItems = position => {
|
|
12
|
+
if (position?.horizontal === 'start') {
|
|
13
|
+
return 'start';
|
|
14
|
+
}
|
|
15
|
+
if (position?.horizontal === 'end') {
|
|
16
|
+
return 'end';
|
|
17
|
+
}
|
|
18
|
+
return 'center';
|
|
19
|
+
};
|
|
20
|
+
const getAlignItems = position => {
|
|
21
|
+
if (position?.vertical === 'top') {
|
|
22
|
+
return 'flex-start';
|
|
23
|
+
}
|
|
24
|
+
if (position?.vertical === 'bottom') {
|
|
25
|
+
return 'flex-end';
|
|
26
|
+
}
|
|
27
|
+
return 'center';
|
|
28
|
+
};
|
|
29
|
+
const getGridTemplateAreas = (hideLegend, direction, position) => {
|
|
30
|
+
if (hideLegend) {
|
|
31
|
+
return `"chart"`;
|
|
32
|
+
}
|
|
11
33
|
if (direction === 'vertical') {
|
|
12
34
|
if (position?.horizontal === 'start') {
|
|
13
|
-
return
|
|
35
|
+
return `"legend chart"`;
|
|
14
36
|
}
|
|
15
|
-
return
|
|
37
|
+
return `"chart legend"`;
|
|
16
38
|
}
|
|
17
39
|
if (position?.vertical === 'bottom') {
|
|
18
|
-
return
|
|
40
|
+
return `"chart"
|
|
41
|
+
"legend"`;
|
|
19
42
|
}
|
|
20
|
-
return
|
|
43
|
+
return `"legend"
|
|
44
|
+
"chart"`;
|
|
21
45
|
};
|
|
22
|
-
const
|
|
46
|
+
const getTemplateColumns = (hideLegend = false, direction = 'horizontal', horizontalPosition = 'end', width = undefined) => {
|
|
47
|
+
const drawingAreaColumn = width ? 'auto' : '1fr';
|
|
48
|
+
if (direction === 'horizontal') {
|
|
49
|
+
return drawingAreaColumn;
|
|
50
|
+
}
|
|
51
|
+
if (hideLegend) {
|
|
52
|
+
return drawingAreaColumn;
|
|
53
|
+
}
|
|
54
|
+
return horizontalPosition === 'start' ? `auto ${drawingAreaColumn}` : `${drawingAreaColumn} auto`;
|
|
55
|
+
};
|
|
56
|
+
const getTemplateRows = (hideLegend = false, direction = 'horizontal', verticalPosition = 'top') => {
|
|
57
|
+
const drawingAreaRow = '1fr';
|
|
23
58
|
if (direction === 'vertical') {
|
|
24
|
-
|
|
25
|
-
return 'flex-start';
|
|
26
|
-
}
|
|
27
|
-
if (position?.vertical === 'bottom') {
|
|
28
|
-
return 'flex-end';
|
|
29
|
-
}
|
|
59
|
+
return drawingAreaRow;
|
|
30
60
|
}
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
return 'flex-start';
|
|
34
|
-
}
|
|
35
|
-
if (position?.horizontal === 'end') {
|
|
36
|
-
return 'flex-end';
|
|
37
|
-
}
|
|
61
|
+
if (hideLegend) {
|
|
62
|
+
return drawingAreaRow;
|
|
38
63
|
}
|
|
39
|
-
return '
|
|
64
|
+
return verticalPosition === 'bottom' ? `${drawingAreaRow} auto` : `auto ${drawingAreaRow}`;
|
|
40
65
|
};
|
|
41
66
|
const Root = styled('div', {
|
|
42
67
|
name: 'MuiChartsWrapper',
|
|
43
68
|
slot: 'Root',
|
|
44
|
-
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'extendVertically'
|
|
69
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'extendVertically' && prop !== 'width'
|
|
45
70
|
})(({
|
|
46
|
-
ownerState
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
71
|
+
ownerState,
|
|
72
|
+
width
|
|
73
|
+
}) => {
|
|
74
|
+
const gridTemplateColumns = getTemplateColumns(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition?.horizontal, width);
|
|
75
|
+
const gridTemplateRows = getTemplateRows(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition?.vertical);
|
|
76
|
+
const gridTemplateAreas = getGridTemplateAreas(ownerState.hideLegend, ownerState.legendDirection, ownerState.legendPosition);
|
|
77
|
+
return {
|
|
78
|
+
variants: [{
|
|
79
|
+
props: {
|
|
80
|
+
extendVertically: true
|
|
81
|
+
},
|
|
82
|
+
style: {
|
|
83
|
+
height: '100%'
|
|
84
|
+
}
|
|
85
|
+
}],
|
|
86
|
+
flex: 1,
|
|
87
|
+
display: 'grid',
|
|
88
|
+
gridTemplateColumns,
|
|
89
|
+
gridTemplateRows,
|
|
90
|
+
gridTemplateAreas,
|
|
91
|
+
[`&:has(.${chartsToolbarClasses.root})`]: {
|
|
92
|
+
// Add a row for toolbar if there is one.
|
|
93
|
+
gridTemplateRows: `auto ${gridTemplateRows}`,
|
|
94
|
+
gridTemplateAreas: `"${gridTemplateColumns.split(' ').map(() => 'toolbar').join(' ')}"
|
|
95
|
+
${gridTemplateAreas}`
|
|
56
96
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
97
|
+
[`& .${chartsToolbarClasses.root}`]: {
|
|
98
|
+
gridArea: 'toolbar',
|
|
99
|
+
justifySelf: 'center'
|
|
100
|
+
},
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
justifyItems: getJustifyItems(ownerState.legendPosition),
|
|
103
|
+
alignItems: getAlignItems(ownerState.legendPosition)
|
|
104
|
+
};
|
|
105
|
+
});
|
|
62
106
|
|
|
63
107
|
/**
|
|
64
108
|
* Wrapper for the charts components.
|
|
@@ -73,6 +117,7 @@ function ChartsWrapper(props) {
|
|
|
73
117
|
const chartRootRef = useChartRootRef();
|
|
74
118
|
const store = useStore();
|
|
75
119
|
const {
|
|
120
|
+
width: propsWidth,
|
|
76
121
|
height: propsHeight
|
|
77
122
|
} = useSelector(store, selectorChartPropsSize);
|
|
78
123
|
return /*#__PURE__*/_jsx(Root, {
|
|
@@ -80,6 +125,7 @@ function ChartsWrapper(props) {
|
|
|
80
125
|
ownerState: props,
|
|
81
126
|
sx: sx,
|
|
82
127
|
extendVertically: extendVertically ?? propsHeight === undefined,
|
|
128
|
+
width: propsWidth,
|
|
83
129
|
children: children
|
|
84
130
|
});
|
|
85
131
|
}
|
|
@@ -94,6 +140,11 @@ process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
|
|
|
94
140
|
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
95
141
|
*/
|
|
96
142
|
extendVertically: PropTypes.bool,
|
|
143
|
+
/**
|
|
144
|
+
* If `true`, the legend is not rendered.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
hideLegend: PropTypes.bool,
|
|
97
148
|
/**
|
|
98
149
|
* The direction of the legend.
|
|
99
150
|
* @default 'horizontal'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
6
6
|
import { useChartContext } from "../context/ChartProvider/useChartContext.js";
|
|
7
7
|
import { TICK_LABEL_GAP } from "./utilities.js";
|
|
8
8
|
import { useTicksGrouped } from "../hooks/useTicksGrouped.js";
|
|
@@ -33,7 +33,7 @@ function ChartsGroupedXAxisTicks(inProps) {
|
|
|
33
33
|
TickLabel,
|
|
34
34
|
axisTickLabelProps
|
|
35
35
|
} = useAxisTicksProps(inProps);
|
|
36
|
-
if (!
|
|
36
|
+
if (!isOrdinalScale(xScale)) {
|
|
37
37
|
throw new Error('MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.');
|
|
38
38
|
}
|
|
39
39
|
const {
|
|
@@ -10,7 +10,7 @@ import { styled, useTheme, useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import { ChartsSingleXAxisTicks } from "./ChartsSingleXAxisTicks.js";
|
|
11
11
|
import { ChartsGroupedXAxisTicks } from "./ChartsGroupedXAxisTicks.js";
|
|
12
12
|
import { ChartsText } from "../ChartsText/index.js";
|
|
13
|
-
import {
|
|
13
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
14
14
|
import { isInfinity } from "../internals/isInfinity.js";
|
|
15
15
|
import { defaultProps, useUtilityClasses } from "./utilities.js";
|
|
16
16
|
import { useDrawingArea } from "../hooks/index.js";
|
|
@@ -80,8 +80,8 @@ export function ChartsXAxisImpl(_ref) {
|
|
|
80
80
|
}
|
|
81
81
|
const labelHeight = label ? getStringSize(label, axisLabelProps.style).height : 0;
|
|
82
82
|
const domain = xScale.domain();
|
|
83
|
-
const
|
|
84
|
-
const skipTickRendering =
|
|
83
|
+
const isScaleOrdinal = isOrdinalScale(xScale);
|
|
84
|
+
const skipTickRendering = isScaleOrdinal ? domain.length === 0 : domain.some(isInfinity);
|
|
85
85
|
let children = null;
|
|
86
86
|
if (!skipTickRendering) {
|
|
87
87
|
children = 'groups' in axis && Array.isArray(axis.groups) ? /*#__PURE__*/_jsx(ChartsGroupedXAxisTicks, _extends({}, inProps)) : /*#__PURE__*/_jsx(ChartsSingleXAxisTicks, _extends({}, inProps, {
|
|
@@ -39,8 +39,12 @@ export function getVisibleLabels(xTicks, {
|
|
|
39
39
|
return new Set(xTicks.filter((item, labelIndex) => {
|
|
40
40
|
const {
|
|
41
41
|
offset,
|
|
42
|
-
labelOffset
|
|
42
|
+
labelOffset,
|
|
43
|
+
formattedValue
|
|
43
44
|
} = item;
|
|
45
|
+
if (formattedValue === '') {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
44
48
|
const textPosition = offset + labelOffset;
|
|
45
49
|
if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
46
50
|
return false;
|
|
@@ -3685,9 +3685,11 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
|
|
|
3685
3685
|
x?: number | string | undefined | undefined;
|
|
3686
3686
|
y?: number | string | undefined | undefined;
|
|
3687
3687
|
radius?: number | string | undefined | undefined;
|
|
3688
|
+
href?: string | undefined | undefined;
|
|
3688
3689
|
media?: string | undefined | undefined;
|
|
3689
|
-
method?: string | undefined | undefined;
|
|
3690
3690
|
target?: string | undefined | undefined;
|
|
3691
|
+
from?: number | string | undefined | undefined;
|
|
3692
|
+
method?: string | undefined | undefined;
|
|
3691
3693
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
3692
3694
|
accentHeight?: number | string | undefined | undefined;
|
|
3693
3695
|
accumulate?: "none" | "sum" | undefined | undefined;
|
|
@@ -3731,7 +3733,6 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
|
|
|
3731
3733
|
focusable?: "auto" | (boolean | "true" | "false") | undefined;
|
|
3732
3734
|
format?: number | string | undefined | undefined;
|
|
3733
3735
|
fr?: number | string | undefined | undefined;
|
|
3734
|
-
from?: number | string | undefined | undefined;
|
|
3735
3736
|
fx?: number | string | undefined | undefined;
|
|
3736
3737
|
fy?: number | string | undefined | undefined;
|
|
3737
3738
|
g1?: number | string | undefined | undefined;
|
|
@@ -3744,7 +3745,6 @@ export declare function useAxisTicksProps(inProps: ChartsXAxisProps): {
|
|
|
3744
3745
|
hanging?: number | string | undefined | undefined;
|
|
3745
3746
|
horizAdvX?: number | string | undefined | undefined;
|
|
3746
3747
|
horizOriginX?: number | string | undefined | undefined;
|
|
3747
|
-
href?: string | undefined | undefined;
|
|
3748
3748
|
ideographic?: number | string | undefined | undefined;
|
|
3749
3749
|
in2?: number | string | undefined | undefined;
|
|
3750
3750
|
in?: string | undefined | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
6
6
|
import { useChartContext } from "../context/ChartProvider/useChartContext.js";
|
|
7
7
|
import { TICK_LABEL_GAP } from "./utilities.js";
|
|
8
8
|
import { useTicksGrouped } from "../hooks/useTicksGrouped.js";
|
|
@@ -34,7 +34,7 @@ function ChartsGroupedYAxisTicks(inProps) {
|
|
|
34
34
|
TickLabel,
|
|
35
35
|
axisTickLabelProps
|
|
36
36
|
} = useAxisTicksProps(inProps);
|
|
37
|
-
if (!
|
|
37
|
+
if (!isOrdinalScale(yScale)) {
|
|
38
38
|
throw new Error('MUI X Charts: ChartsGroupedYAxis only supports the `band` and `point` scale types.');
|
|
39
39
|
}
|
|
40
40
|
const {
|
|
@@ -14,7 +14,7 @@ import { defaultProps, useUtilityClasses } from "./utilities.js";
|
|
|
14
14
|
import { isInfinity } from "../internals/isInfinity.js";
|
|
15
15
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
16
16
|
import { useIsHydrated } from "../hooks/useIsHydrated.js";
|
|
17
|
-
import {
|
|
17
|
+
import { isOrdinalScale } from "../internals/scaleGuards.js";
|
|
18
18
|
import { getStringSize } from "../internals/domUtils.js";
|
|
19
19
|
import { AxisRoot } from "../internals/components/AxisSharedComponents.js";
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -100,8 +100,8 @@ export function ChartsYAxisImpl(_ref) {
|
|
|
100
100
|
};
|
|
101
101
|
const axisLabelHeight = label == null ? 0 : getStringSize(label, axisLabelProps.style).height;
|
|
102
102
|
const domain = yScale.domain();
|
|
103
|
-
const
|
|
104
|
-
const skipTickRendering =
|
|
103
|
+
const isScaleOrdinal = isOrdinalScale(yScale);
|
|
104
|
+
const skipTickRendering = isScaleOrdinal ? domain.length === 0 : domain.some(isInfinity);
|
|
105
105
|
let children = null;
|
|
106
106
|
if (!skipTickRendering) {
|
|
107
107
|
children = 'groups' in axis && Array.isArray(axis.groups) ? /*#__PURE__*/_jsx(ChartsGroupedYAxisTicks, _extends({}, inProps)) : /*#__PURE__*/_jsx(ChartsSingleYAxisTicks, _extends({}, inProps, {
|
|
@@ -3604,9 +3604,11 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
|
|
|
3604
3604
|
x?: number | string | undefined | undefined;
|
|
3605
3605
|
y?: number | string | undefined | undefined;
|
|
3606
3606
|
radius?: number | string | undefined | undefined;
|
|
3607
|
+
href?: string | undefined | undefined;
|
|
3607
3608
|
media?: string | undefined | undefined;
|
|
3608
|
-
method?: string | undefined | undefined;
|
|
3609
3609
|
target?: string | undefined | undefined;
|
|
3610
|
+
from?: number | string | undefined | undefined;
|
|
3611
|
+
method?: string | undefined | undefined;
|
|
3610
3612
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
3611
3613
|
accentHeight?: number | string | undefined | undefined;
|
|
3612
3614
|
accumulate?: "none" | "sum" | undefined | undefined;
|
|
@@ -3650,7 +3652,6 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
|
|
|
3650
3652
|
focusable?: "auto" | (boolean | "true" | "false") | undefined;
|
|
3651
3653
|
format?: number | string | undefined | undefined;
|
|
3652
3654
|
fr?: number | string | undefined | undefined;
|
|
3653
|
-
from?: number | string | undefined | undefined;
|
|
3654
3655
|
fx?: number | string | undefined | undefined;
|
|
3655
3656
|
fy?: number | string | undefined | undefined;
|
|
3656
3657
|
g1?: number | string | undefined | undefined;
|
|
@@ -3663,7 +3664,6 @@ export declare function useAxisTicksProps(inProps: ChartsYAxisProps): {
|
|
|
3663
3664
|
hanging?: number | string | undefined | undefined;
|
|
3664
3665
|
horizAdvX?: number | string | undefined | undefined;
|
|
3665
3666
|
horizOriginX?: number | string | undefined | undefined;
|
|
3666
|
-
href?: string | undefined | undefined;
|
|
3667
3667
|
ideographic?: number | string | undefined | undefined;
|
|
3668
3668
|
in2?: number | string | undefined | undefined;
|
|
3669
3669
|
in?: string | undefined | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useTheme } from '@mui/material/styles';
|
|
5
|
+
import { useFocusedItem } from "../hooks/useFocusedItem.js";
|
|
6
|
+
import { useLineSeriesContext, useXAxes, useYAxes } from "../hooks/index.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const RADIUS = 6;
|
|
9
|
+
export function FocusedMark() {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const focusedItem = useFocusedItem();
|
|
12
|
+
const lineSeries = useLineSeriesContext();
|
|
13
|
+
const {
|
|
14
|
+
xAxis,
|
|
15
|
+
xAxisIds
|
|
16
|
+
} = useXAxes();
|
|
17
|
+
const {
|
|
18
|
+
yAxis,
|
|
19
|
+
yAxisIds
|
|
20
|
+
} = useYAxes();
|
|
21
|
+
if (focusedItem === null || focusedItem.seriesType !== 'line' || !lineSeries) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const series = lineSeries?.series[focusedItem.seriesId];
|
|
25
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
26
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
27
|
+
return /*#__PURE__*/_jsx("rect", {
|
|
28
|
+
fill: "none",
|
|
29
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
30
|
+
strokeWidth: 2,
|
|
31
|
+
x: xAxis[xAxisId].scale(xAxis[xAxisId].data[focusedItem.dataIndex]) - RADIUS,
|
|
32
|
+
y: yAxis[yAxisId].scale(series.stackedData[focusedItem.dataIndex][1]) - RADIUS,
|
|
33
|
+
width: 2 * RADIUS,
|
|
34
|
+
height: 2 * RADIUS,
|
|
35
|
+
rx: 3,
|
|
36
|
+
ry: 3
|
|
37
|
+
});
|
|
38
|
+
}
|