@mui/x-charts 9.0.0-alpha.3 → 9.0.0-beta.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.mts +2 -2
- package/BarChart/BarChart.d.ts +2 -2
- package/BarChart/BarChart.js +55 -34
- package/BarChart/BarChart.mjs +55 -34
- package/BarChart/BarElement.js +4 -8
- package/BarChart/BarElement.mjs +4 -8
- package/BarChart/BarLabel/BarLabel.js +1 -11
- package/BarChart/BarLabel/BarLabel.mjs +1 -11
- package/BarChart/BarLabel/BarLabelItem.js +1 -3
- package/BarChart/BarLabel/BarLabelItem.mjs +1 -3
- package/BarChart/BarLabel/BarLabelPlot.d.mts +0 -2
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -2
- package/BarChart/BarLabel/BarLabelPlot.js +2 -3
- package/BarChart/BarLabel/BarLabelPlot.mjs +2 -3
- package/BarChart/BarLabel/index.d.mts +1 -3
- package/BarChart/BarLabel/index.d.ts +1 -3
- package/BarChart/BarLabel/index.js +1 -14
- package/BarChart/BarLabel/index.mjs +1 -2
- package/BarChart/BarPlot.d.mts +6 -12
- package/BarChart/BarPlot.d.ts +6 -12
- package/BarChart/BarPlot.js +11 -19
- package/BarChart/BarPlot.mjs +11 -19
- package/BarChart/BatchBarPlot/BatchBarPlot.js +3 -30
- package/BarChart/BatchBarPlot/BatchBarPlot.mjs +3 -30
- package/BarChart/IndividualBarPlot.d.mts +1 -2
- package/BarChart/IndividualBarPlot.d.ts +1 -2
- package/BarChart/IndividualBarPlot.js +5 -10
- package/BarChart/IndividualBarPlot.mjs +5 -10
- package/BarChart/index.d.mts +0 -1
- package/BarChart/index.d.ts +0 -1
- package/BarChart/index.js +0 -12
- package/BarChart/index.mjs +0 -1
- package/BarChart/seriesConfig/bar/descriptionGetter.d.mts +3 -0
- package/BarChart/seriesConfig/bar/descriptionGetter.d.ts +3 -0
- package/BarChart/seriesConfig/bar/descriptionGetter.js +36 -0
- package/BarChart/seriesConfig/bar/descriptionGetter.mjs +30 -0
- package/BarChart/seriesConfig/bar/legend.js +2 -21
- package/BarChart/seriesConfig/bar/legend.mjs +2 -21
- package/BarChart/seriesConfig/index.js +5 -1
- package/BarChart/seriesConfig/index.mjs +5 -1
- package/BarChart/useBarChartProps.d.mts +2 -2
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +4 -6
- package/BarChart/useBarChartProps.mjs +4 -6
- package/BarChart/useRegisterItemClickHandlers.js +2 -2
- package/BarChart/useRegisterItemClickHandlers.mjs +2 -2
- package/CHANGELOG.md +229 -0
- package/ChartsAxis/index.d.mts +2 -1
- package/ChartsAxis/index.d.ts +2 -1
- package/ChartsAxis/index.js +11 -11
- package/ChartsAxis/index.mjs +1 -1
- package/ChartsAxisHighlight/index.d.mts +2 -1
- package/ChartsAxisHighlight/index.d.ts +2 -1
- package/ChartsAxisHighlight/index.js +12 -10
- package/ChartsAxisHighlight/index.mjs +1 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.mts +6 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +12 -9
- package/ChartsBrushOverlay/ChartsBrushOverlay.mjs +12 -9
- package/ChartsContainer/ChartsContainer.js +77 -43
- package/ChartsContainer/ChartsContainer.mjs +77 -43
- package/ChartsContainer/useChartsContainerProps.d.mts +2 -2
- package/ChartsContainer/useChartsContainerProps.d.ts +2 -2
- package/ChartsContainer/useChartsContainerProps.js +8 -8
- package/ChartsContainer/useChartsContainerProps.mjs +8 -8
- package/ChartsDataProvider/ChartsDataProvider.js +0 -6
- package/ChartsDataProvider/ChartsDataProvider.mjs +0 -6
- package/ChartsDataProvider/useChartsDataProviderProps.js +1 -1
- package/ChartsDataProvider/useChartsDataProviderProps.mjs +1 -1
- package/ChartsGrid/ChartsGrid.d.mts +4 -0
- package/ChartsGrid/ChartsGrid.d.ts +4 -0
- package/ChartsGrid/ChartsGrid.js +4 -2
- package/ChartsGrid/ChartsGrid.mjs +4 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.mjs +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +2 -2
- package/ChartsGrid/ChartsVerticalGrid.mjs +2 -2
- package/ChartsGrid/index.d.mts +2 -1
- package/ChartsGrid/index.d.ts +2 -1
- package/ChartsGrid/index.js +11 -11
- package/ChartsGrid/index.mjs +1 -1
- package/ChartsLayerContainer/ChartsLayerContainer.d.mts +10 -0
- package/ChartsLayerContainer/ChartsLayerContainer.d.ts +10 -0
- package/ChartsLayerContainer/ChartsLayerContainer.js +53 -9
- package/ChartsLayerContainer/ChartsLayerContainer.mjs +55 -10
- package/ChartsLayerContainer/chartsLayerContainerClasses.d.mts +6 -0
- package/ChartsLayerContainer/chartsLayerContainerClasses.d.ts +6 -0
- package/ChartsLayerContainer/chartsLayerContainerClasses.js +21 -0
- package/ChartsLayerContainer/chartsLayerContainerClasses.mjs +13 -0
- package/ChartsLegend/ChartsLegend.js +2 -2
- package/ChartsLegend/ChartsLegend.mjs +2 -2
- package/ChartsLegend/legendContext.types.d.mts +0 -6
- package/ChartsLegend/legendContext.types.d.ts +0 -6
- package/ChartsLegend/onClickContextBuilder.js +0 -1
- package/ChartsLegend/onClickContextBuilder.mjs +0 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +2 -8
- package/ChartsOverlay/ChartsLoadingOverlay.mjs +2 -8
- package/ChartsOverlay/ChartsNoDataOverlay.js +2 -8
- package/ChartsOverlay/ChartsNoDataOverlay.mjs +2 -8
- package/ChartsOverlay/ChartsOverlay.d.mts +0 -6
- package/ChartsOverlay/ChartsOverlay.d.ts +0 -6
- package/ChartsReferenceLine/index.d.mts +2 -1
- package/ChartsReferenceLine/index.d.ts +2 -1
- package/ChartsReferenceLine/index.js +11 -11
- package/ChartsReferenceLine/index.mjs +1 -2
- package/ChartsSurface/ChartsSurface.d.mts +2 -3
- package/ChartsSurface/ChartsSurface.d.ts +2 -3
- package/ChartsSurface/ChartsSurface.js +14 -2
- package/ChartsSurface/ChartsSurface.mjs +14 -2
- package/ChartsSvgLayer/ChartsSvgLayer.d.mts +0 -4
- package/ChartsSvgLayer/ChartsSvgLayer.d.ts +0 -4
- package/ChartsSvgLayer/ChartsSvgLayer.js +8 -30
- package/ChartsSvgLayer/ChartsSvgLayer.mjs +8 -30
- package/ChartsTooltip/ChartsAxisTooltipContent.js +45 -31
- package/ChartsTooltip/ChartsAxisTooltipContent.mjs +45 -31
- package/ChartsTooltip/ChartsItemTooltipContent.js +77 -41
- package/ChartsTooltip/ChartsItemTooltipContent.mjs +76 -41
- package/ChartsTooltip/ChartsTooltipContainer.js +5 -1
- package/ChartsTooltip/ChartsTooltipContainer.mjs +5 -1
- package/ChartsTooltip/index.d.mts +1 -2
- package/ChartsTooltip/index.d.ts +1 -2
- package/ChartsTooltip/index.js +1 -16
- package/ChartsTooltip/index.mjs +1 -2
- package/ChartsTooltip/useAxesTooltip.d.mts +2 -3
- package/ChartsTooltip/useAxesTooltip.d.ts +2 -3
- package/ChartsTooltip/useItemTooltip.d.mts +2 -4
- package/ChartsTooltip/useItemTooltip.d.ts +2 -4
- package/ChartsTooltip/utils.d.mts +0 -4
- package/ChartsTooltip/utils.d.ts +0 -4
- package/ChartsTooltip/utils.js +0 -39
- package/ChartsTooltip/utils.mjs +0 -38
- package/ChartsXAxis/ChartsGroupedXAxisTicks.js +14 -5
- package/ChartsXAxis/ChartsGroupedXAxisTicks.mjs +14 -5
- package/ChartsXAxis/ChartsSingleXAxisTicks.js +2 -2
- package/ChartsXAxis/ChartsSingleXAxisTicks.mjs +2 -2
- package/ChartsXAxis/ChartsXAxisImpl.js +3 -1
- package/ChartsXAxis/ChartsXAxisImpl.mjs +3 -1
- package/ChartsXAxis/useAxisTicksProps.d.mts +170 -89
- package/ChartsXAxis/useAxisTicksProps.d.ts +170 -89
- package/ChartsYAxis/ChartsGroupedYAxisTicks.js +14 -5
- package/ChartsYAxis/ChartsGroupedYAxisTicks.mjs +14 -5
- package/ChartsYAxis/ChartsSingleYAxisTicks.js +2 -2
- package/ChartsYAxis/ChartsSingleYAxisTicks.mjs +2 -2
- package/ChartsYAxis/ChartsYAxisImpl.js +3 -1
- package/ChartsYAxis/ChartsYAxisImpl.mjs +3 -1
- package/ChartsYAxis/useAxisTicksProps.d.mts +170 -89
- package/ChartsYAxis/useAxisTicksProps.d.ts +170 -89
- package/Gauge/Gauge.js +8 -0
- package/Gauge/Gauge.mjs +8 -0
- package/Gauge/GaugeContainer.d.mts +1 -1
- package/Gauge/GaugeContainer.d.ts +1 -1
- package/Gauge/GaugeContainer.js +10 -2
- package/Gauge/GaugeContainer.mjs +10 -2
- package/Gauge/index.d.mts +2 -1
- package/Gauge/index.d.ts +2 -1
- package/Gauge/index.js +7 -11
- package/Gauge/index.mjs +1 -1
- package/LineChart/AreaElement.d.mts +2 -35
- package/LineChart/AreaElement.d.ts +2 -35
- package/LineChart/AreaElement.js +8 -42
- package/LineChart/AreaElement.mjs +8 -42
- package/LineChart/CircleMarkElement.d.mts +1 -1
- package/LineChart/CircleMarkElement.d.ts +1 -1
- package/LineChart/CircleMarkElement.js +11 -16
- package/LineChart/CircleMarkElement.mjs +12 -17
- package/LineChart/LineChart.d.mts +2 -2
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +51 -25
- package/LineChart/LineChart.mjs +51 -25
- package/LineChart/LineElement.d.mts +2 -35
- package/LineChart/LineElement.d.ts +2 -35
- package/LineChart/LineElement.js +8 -42
- package/LineChart/LineElement.mjs +8 -42
- package/LineChart/LineHighlightElement.d.mts +0 -20
- package/LineChart/LineHighlightElement.d.ts +0 -20
- package/LineChart/LineHighlightElement.js +2 -39
- package/LineChart/LineHighlightElement.mjs +2 -39
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LineHighlightPlot.mjs +2 -2
- package/LineChart/MarkElement.d.mts +1 -1
- package/LineChart/MarkElement.d.ts +1 -1
- package/LineChart/MarkElement.js +10 -8
- package/LineChart/MarkElement.mjs +11 -9
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/MarkPlot.mjs +2 -2
- package/LineChart/index.d.mts +0 -2
- package/LineChart/index.d.ts +0 -2
- package/LineChart/index.js +0 -15
- package/LineChart/index.mjs +0 -1
- package/LineChart/seriesConfig/curveEvaluation.d.mts +11 -0
- package/LineChart/seriesConfig/curveEvaluation.d.ts +11 -0
- package/LineChart/seriesConfig/curveEvaluation.js +134 -0
- package/LineChart/seriesConfig/curveEvaluation.mjs +129 -0
- package/LineChart/seriesConfig/descriptionGetter.d.mts +3 -0
- package/LineChart/seriesConfig/descriptionGetter.d.ts +3 -0
- package/LineChart/seriesConfig/descriptionGetter.js +37 -0
- package/LineChart/seriesConfig/descriptionGetter.mjs +31 -0
- package/LineChart/seriesConfig/getItemAtPosition.d.mts +7 -0
- package/LineChart/seriesConfig/getItemAtPosition.d.ts +7 -0
- package/LineChart/seriesConfig/getItemAtPosition.js +356 -0
- package/LineChart/seriesConfig/getItemAtPosition.mjs +351 -0
- package/LineChart/seriesConfig/index.js +4 -0
- package/LineChart/seriesConfig/index.mjs +4 -0
- package/LineChart/seriesConfig/seriesProcessor.js +8 -5
- package/LineChart/seriesConfig/seriesProcessor.mjs +8 -5
- package/LineChart/useLineChartProps.d.mts +2 -2
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +2 -2
- package/LineChart/useLineChartProps.mjs +2 -2
- package/LineChart/useMarkPlotData.js +2 -2
- package/LineChart/useMarkPlotData.mjs +2 -2
- package/PieChart/FocusedPieArc.js +1 -4
- package/PieChart/FocusedPieArc.mjs +2 -4
- package/PieChart/PieArc.d.mts +0 -37
- package/PieChart/PieArc.d.ts +0 -37
- package/PieChart/PieArc.js +5 -45
- package/PieChart/PieArc.mjs +5 -45
- package/PieChart/PieArcLabel.d.mts +2 -43
- package/PieChart/PieArcLabel.d.ts +2 -43
- package/PieChart/PieArcLabel.js +3 -46
- package/PieChart/PieArcLabel.mjs +5 -48
- package/PieChart/PieArcLabelPlot.js +0 -2
- package/PieChart/PieArcLabelPlot.mjs +0 -2
- package/PieChart/PieChart.d.mts +2 -2
- package/PieChart/PieChart.d.ts +2 -2
- package/PieChart/PieChart.js +17 -5
- package/PieChart/PieChart.mjs +17 -5
- package/PieChart/index.d.mts +1 -1
- package/PieChart/index.d.ts +1 -1
- package/PieChart/seriesConfig/descriptionGetter.d.mts +3 -0
- package/PieChart/seriesConfig/descriptionGetter.d.ts +3 -0
- package/PieChart/seriesConfig/descriptionGetter.js +26 -0
- package/PieChart/seriesConfig/descriptionGetter.mjs +20 -0
- package/PieChart/seriesConfig/index.js +2 -0
- package/PieChart/seriesConfig/index.mjs +2 -0
- package/PieChart/seriesConfig/legend.js +0 -2
- package/PieChart/seriesConfig/legend.mjs +0 -2
- package/RadarChart/RadarAxis/RadarAxis.d.mts +6 -2
- package/RadarChart/RadarAxis/RadarAxis.d.ts +6 -2
- package/RadarChart/RadarAxis/RadarAxis.js +7 -5
- package/RadarChart/RadarAxis/RadarAxis.mjs +6 -4
- package/RadarChart/RadarAxis/index.d.mts +1 -2
- package/RadarChart/RadarAxis/index.d.ts +1 -2
- package/RadarChart/RadarAxis/index.js +1 -13
- package/RadarChart/RadarAxis/index.mjs +1 -2
- package/RadarChart/RadarAxis/useRadarAxis.js +2 -2
- package/RadarChart/RadarAxis/useRadarAxis.mjs +2 -2
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.d.mts +6 -2
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.d.ts +6 -2
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +9 -14
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.mjs +8 -13
- package/RadarChart/RadarAxisHighlight/index.d.mts +1 -2
- package/RadarChart/RadarAxisHighlight/index.d.ts +1 -2
- package/RadarChart/RadarAxisHighlight/index.mjs +1 -2
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +2 -2
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.mjs +2 -2
- package/RadarChart/RadarChart.js +15 -0
- package/RadarChart/RadarChart.mjs +15 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.mts +2 -2
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +2 -2
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +2 -2
- package/RadarChart/RadarDataProvider/RadarDataProvider.mjs +2 -2
- package/RadarChart/RadarGrid/CircularRadarGrid.js +2 -2
- package/RadarChart/RadarGrid/CircularRadarGrid.mjs +2 -2
- package/RadarChart/RadarGrid/CircularRadarStripes.js +1 -1
- package/RadarChart/RadarGrid/CircularRadarStripes.mjs +1 -1
- package/RadarChart/RadarGrid/RadarGrid.js +2 -2
- package/RadarChart/RadarGrid/RadarGrid.mjs +2 -2
- package/RadarChart/RadarGrid/RadarGrid.types.d.mts +6 -7
- package/RadarChart/RadarGrid/RadarGrid.types.d.ts +6 -7
- package/RadarChart/RadarGrid/SharpRadarGrid.js +2 -2
- package/RadarChart/RadarGrid/SharpRadarGrid.mjs +2 -2
- package/RadarChart/RadarGrid/SharpRadarStripes.js +1 -1
- package/RadarChart/RadarGrid/SharpRadarStripes.mjs +1 -1
- package/RadarChart/RadarGrid/index.d.mts +1 -2
- package/RadarChart/RadarGrid/index.d.ts +1 -2
- package/RadarChart/RadarGrid/useRadarGridData.js +2 -2
- package/RadarChart/RadarGrid/useRadarGridData.mjs +2 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.d.mts +2 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.d.ts +2 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +6 -6
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +6 -6
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.d.mts +13 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.d.ts +13 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +8 -6
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +8 -6
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +5 -3
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.mjs +4 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.mts +6 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +6 -4
- package/RadarChart/RadarSeriesPlot/index.d.mts +1 -3
- package/RadarChart/RadarSeriesPlot/index.d.ts +1 -3
- package/RadarChart/RadarSeriesPlot/index.js +2 -10
- package/RadarChart/RadarSeriesPlot/index.mjs +1 -2
- package/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.js +2 -2
- package/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.mjs +2 -2
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.mjs +2 -2
- package/RadarChart/index.d.mts +3 -1
- package/RadarChart/index.d.ts +3 -1
- package/RadarChart/index.js +9 -1
- package/RadarChart/index.mjs +2 -1
- package/RadarChart/radarClasses.d.mts +30 -0
- package/RadarChart/radarClasses.d.ts +30 -0
- package/RadarChart/radarClasses.js +33 -0
- package/RadarChart/radarClasses.mjs +24 -0
- package/RadarChart/seriesConfig/descriptionGetter.d.mts +3 -0
- package/RadarChart/seriesConfig/descriptionGetter.d.ts +3 -0
- package/RadarChart/seriesConfig/descriptionGetter.js +37 -0
- package/RadarChart/seriesConfig/descriptionGetter.mjs +31 -0
- package/RadarChart/seriesConfig/index.js +2 -0
- package/RadarChart/seriesConfig/index.mjs +2 -0
- package/RadarChart/seriesConfig/legend.js +2 -21
- package/RadarChart/seriesConfig/legend.mjs +2 -21
- package/ScatterChart/BatchScatter.js +3 -3
- package/ScatterChart/BatchScatter.mjs +3 -3
- package/ScatterChart/Scatter.js +3 -3
- package/ScatterChart/Scatter.mjs +3 -3
- package/ScatterChart/ScatterChart.d.mts +15 -3
- package/ScatterChart/ScatterChart.d.ts +15 -3
- package/ScatterChart/ScatterChart.js +73 -31
- package/ScatterChart/ScatterChart.mjs +73 -31
- package/ScatterChart/seriesConfig/descriptionGetter.d.mts +3 -0
- package/ScatterChart/seriesConfig/descriptionGetter.d.ts +3 -0
- package/ScatterChart/seriesConfig/descriptionGetter.js +34 -0
- package/ScatterChart/seriesConfig/descriptionGetter.mjs +28 -0
- package/ScatterChart/seriesConfig/index.js +2 -0
- package/ScatterChart/seriesConfig/index.mjs +2 -0
- package/ScatterChart/seriesConfig/legend.js +2 -21
- package/ScatterChart/seriesConfig/legend.mjs +2 -21
- package/ScatterChart/useScatterChartProps.d.mts +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +9 -8
- package/ScatterChart/useScatterChartProps.mjs +9 -8
- package/SparkLineChart/SparkLineChart.d.mts +2 -2
- package/SparkLineChart/SparkLineChart.d.ts +2 -2
- package/SparkLineChart/SparkLineChart.js +60 -28
- package/SparkLineChart/SparkLineChart.mjs +60 -28
- package/constants/index.js +0 -2
- package/constants/index.mjs +0 -2
- package/context/useChartApiContext.d.mts +1 -1
- package/context/useChartApiContext.d.ts +1 -1
- package/context/useChartApiContext.js +3 -3
- package/context/useChartApiContext.mjs +3 -3
- package/hooks/animation/useAnimatePieArcLabel.d.mts +1 -10
- package/hooks/animation/useAnimatePieArcLabel.d.ts +1 -10
- package/hooks/animation/useAnimatePieArcLabel.js +6 -10
- package/hooks/animation/useAnimatePieArcLabel.mjs +6 -10
- package/hooks/useChartRootRef.js +2 -2
- package/hooks/useChartRootRef.mjs +2 -2
- package/hooks/useChartsLayerContainerRef.js +2 -2
- package/hooks/useChartsLayerContainerRef.mjs +2 -2
- package/hooks/useDataset.js +1 -1
- package/hooks/useDataset.mjs +2 -2
- package/hooks/useInteractionItemProps.d.mts +1 -1
- package/hooks/useInteractionItemProps.d.ts +1 -1
- package/hooks/useInteractionItemProps.js +5 -5
- package/hooks/useInteractionItemProps.mjs +5 -5
- package/hooks/useTicks.js +2 -2
- package/hooks/useTicks.mjs +2 -2
- package/index.d.mts +0 -3
- package/index.d.ts +0 -3
- package/index.js +2 -22
- package/index.mjs +1 -3
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.d.mts +5 -0
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.d.ts +5 -0
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.js +100 -0
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.mjs +96 -0
- package/internals/components/ChartsAccessibilityProxy/index.d.mts +1 -0
- package/internals/components/ChartsAccessibilityProxy/index.d.ts +1 -0
- package/internals/components/ChartsAccessibilityProxy/index.js +16 -0
- package/internals/components/ChartsAccessibilityProxy/index.mjs +1 -0
- package/internals/components/ChartsAccessibilityProxy/useDescription.d.mts +5 -0
- package/internals/components/ChartsAccessibilityProxy/useDescription.d.ts +5 -0
- package/internals/components/ChartsAccessibilityProxy/useDescription.js +71 -0
- package/internals/components/ChartsAccessibilityProxy/useDescription.mjs +66 -0
- package/internals/consumeSlots.d.mts +1 -1
- package/internals/consumeSlots.d.ts +1 -1
- package/internals/getChartPoint.js +18 -1
- package/internals/getChartPoint.mjs +18 -1
- package/internals/identifierCleaner.d.mts +5 -5
- package/internals/identifierCleaner.d.ts +5 -5
- package/internals/identifierCleaner.js +0 -1
- package/internals/identifierCleaner.mjs +0 -1
- package/internals/index.d.mts +2 -3
- package/internals/index.d.ts +2 -3
- package/internals/index.js +27 -36
- package/internals/index.mjs +2 -3
- package/internals/legendUtils.d.mts +11 -0
- package/internals/legendUtils.d.ts +11 -0
- package/internals/legendUtils.js +28 -0
- package/internals/legendUtils.mjs +22 -0
- package/internals/plugins/corePlugins/corePlugins.d.mts +2 -2
- package/internals/plugins/corePlugins/corePlugins.d.ts +2 -2
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +2 -2
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.mjs +2 -2
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.mts +2 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +2 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.mts +2 -4
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +2 -4
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +2 -4
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.mjs +1 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.mts +19 -9
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +19 -9
- package/internals/plugins/corePlugins/useChartSeries/index.d.mts +2 -1
- package/internals/plugins/corePlugins/useChartSeries/index.d.ts +2 -1
- package/internals/plugins/corePlugins/useChartSeries/index.js +12 -0
- package/internals/plugins/corePlugins/useChartSeries/index.mjs +2 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.mts +21 -6
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +21 -6
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +20 -9
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.mjs +20 -9
- package/internals/plugins/corePlugins/useChartSeries/useChartSeriesLayout.selectors.d.mts +8 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeriesLayout.selectors.d.ts +8 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeriesLayout.selectors.js +19 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeriesLayout.selectors.mjs +14 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/TooltipContent.types.d.mts +18 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/TooltipContent.types.d.ts +18 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/descriptionGetter.types.d.mts +5 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/descriptionGetter.types.d.ts +5 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/descriptionGetter.types.js +5 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/descriptionGetter.types.mjs +1 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.d.mts +3 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.d.ts +3 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.js +22 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.mjs +3 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.mts +7 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.ts +7 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.mts +16 -37
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.ts +16 -37
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.mts +4 -10
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +4 -10
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +30 -21
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.mjs +30 -20
- package/internals/plugins/featurePlugins/useChartCartesianAxis/autoSizeConstants.d.mts +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/autoSizeConstants.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/autoSizeConstants.js +11 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/autoSizeConstants.mjs +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.d.mts +33 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.d.ts +33 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.js +318 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.mjs +311 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.mts +5 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.mjs +62 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +12 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +12 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.mts +13 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.ts +13 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.js +32 -7
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.mjs +31 -7
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.mts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +22 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.d.mts +30 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.d.ts +30 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.js +96 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.mjs +91 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisDomains.selectors.d.mts +16 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisDomains.selectors.d.ts +16 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisDomains.selectors.js +36 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisDomains.selectors.mjs +31 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisExtrema.selectors.d.mts +15 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisExtrema.selectors.d.ts +15 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisExtrema.selectors.js +45 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisExtrema.selectors.mjs +39 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.mts +11 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +11 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +53 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.mjs +52 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +4 -9
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +4 -9
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +20 -45
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +23 -48
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.mts +5 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianTooltip.selectors.d.mts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianTooltip.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianTooltip.selectors.js +20 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianTooltip.selectors.mjs +20 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +13 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +13 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +4 -9
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +4 -9
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.mts +3 -3
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +36 -30
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.mjs +36 -30
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.mts +8 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +8 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.mjs +9 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.mts +6 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -0
- package/internals/seriesSelectorOfType.d.mts +3 -3
- package/internals/seriesSelectorOfType.d.ts +3 -3
- package/internals/store/useCharts.d.mts +1 -1
- package/internals/store/useCharts.d.ts +1 -1
- package/internals/store/useStore.js +2 -2
- package/internals/store/useStore.mjs +2 -2
- package/locales/elGR.d.mts +80 -0
- package/locales/elGR.d.ts +80 -0
- package/locales/elGR.js +95 -0
- package/locales/elGR.mjs +95 -0
- package/locales/enUS.d.mts +80 -0
- package/locales/enUS.d.ts +80 -0
- package/locales/enUS.js +94 -1
- package/locales/enUS.mjs +94 -1
- package/locales/frFR.d.mts +80 -0
- package/locales/frFR.d.ts +80 -0
- package/locales/frFR.js +95 -1
- package/locales/frFR.mjs +95 -1
- package/locales/nbNO.d.mts +80 -0
- package/locales/nbNO.d.ts +80 -0
- package/locales/nbNO.js +95 -0
- package/locales/nbNO.mjs +95 -0
- package/locales/ptBR.d.mts +80 -0
- package/locales/ptBR.d.ts +80 -0
- package/locales/ptBR.js +95 -0
- package/locales/ptBR.mjs +95 -0
- package/locales/ptPT.d.mts +80 -0
- package/locales/ptPT.d.ts +80 -0
- package/locales/ptPT.js +191 -99
- package/locales/ptPT.mjs +191 -99
- package/locales/svSE.d.mts +80 -0
- package/locales/svSE.d.ts +80 -0
- package/locales/svSE.js +95 -0
- package/locales/svSE.mjs +95 -0
- package/locales/utils/chartsLocaleTextApi.d.mts +205 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +205 -0
- package/locales/utils/getChartsLocalization.d.mts +80 -0
- package/locales/utils/getChartsLocalization.d.ts +80 -0
- package/models/axis.d.mts +15 -5
- package/models/axis.d.ts +15 -5
- package/models/seriesType/composition.d.mts +1 -1
- package/models/seriesType/composition.d.ts +1 -1
- package/models/seriesType/composition.js +1 -1
- package/models/seriesType/composition.mjs +1 -1
- package/models/seriesType/config.d.mts +29 -0
- package/models/seriesType/config.d.ts +29 -0
- package/models/seriesType/line.d.mts +2 -1
- package/models/seriesType/line.d.ts +2 -1
- package/models/seriesType/scatter.d.mts +0 -7
- package/models/seriesType/scatter.d.ts +0 -7
- package/package.json +3 -31
- package/themeAugmentation/components.d.mts +5 -25
- package/themeAugmentation/components.d.ts +5 -25
- package/themeAugmentation/overrides.d.mts +3 -15
- package/themeAugmentation/overrides.d.ts +3 -15
- package/themeAugmentation/props.d.mts +0 -2
- package/themeAugmentation/props.d.ts +0 -2
- package/BarChart/BarLabel/barLabelClasses.d.mts +0 -41
- package/BarChart/BarLabel/barLabelClasses.d.ts +0 -41
- package/BarChart/BarLabel/barLabelClasses.js +0 -49
- package/BarChart/BarLabel/barLabelClasses.mjs +0 -40
- package/BarChart/barElementClasses.d.mts +0 -40
- package/BarChart/barElementClasses.d.ts +0 -40
- package/BarChart/barElementClasses.js +0 -48
- package/BarChart/barElementClasses.mjs +0 -39
- package/ChartContainer/ChartContainer.d.mts +0 -22
- package/ChartContainer/ChartContainer.d.ts +0 -22
- package/ChartContainer/ChartContainer.js +0 -24
- package/ChartContainer/ChartContainer.mjs +0 -20
- package/ChartContainer/index.d.mts +0 -1
- package/ChartContainer/index.d.ts +0 -1
- package/ChartContainer/index.js +0 -16
- package/ChartContainer/index.mjs +0 -1
- package/ChartContainer/useChartContainerProps.d.mts +0 -13
- package/ChartContainer/useChartContainerProps.d.ts +0 -13
- package/ChartContainer/useChartContainerProps.js +0 -19
- package/ChartContainer/useChartContainerProps.mjs +0 -14
- package/ChartDataProvider/ChartDataProvider.d.mts +0 -20
- package/ChartDataProvider/ChartDataProvider.d.ts +0 -20
- package/ChartDataProvider/ChartDataProvider.js +0 -24
- package/ChartDataProvider/ChartDataProvider.mjs +0 -20
- package/ChartDataProvider/index.d.mts +0 -1
- package/ChartDataProvider/index.d.ts +0 -1
- package/ChartDataProvider/index.js +0 -16
- package/ChartDataProvider/index.mjs +0 -1
- package/ChartDataProvider/useChartDataProviderProps.d.mts +0 -10
- package/ChartDataProvider/useChartDataProviderProps.d.ts +0 -10
- package/ChartDataProvider/useChartDataProviderProps.js +0 -12
- package/ChartDataProvider/useChartDataProviderProps.mjs +0 -8
- package/LineChart/markElementClasses.d.mts +0 -42
- package/LineChart/markElementClasses.d.ts +0 -42
- package/LineChart/markElementClasses.js +0 -48
- package/LineChart/markElementClasses.mjs +0 -40
- package/RadarChart/RadarAxis/radarAxisClasses.d.mts +0 -12
- package/RadarChart/RadarAxis/radarAxisClasses.d.ts +0 -12
- package/RadarChart/RadarAxis/radarAxisClasses.js +0 -25
- package/RadarChart/RadarAxis/radarAxisClasses.mjs +0 -15
- package/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.d.mts +0 -11
- package/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.d.ts +0 -11
- package/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.js +0 -14
- package/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.mjs +0 -6
- package/RadarChart/RadarGrid/radarGridClasses.d.mts +0 -12
- package/RadarChart/RadarGrid/radarGridClasses.d.ts +0 -12
- package/RadarChart/RadarGrid/radarGridClasses.js +0 -25
- package/RadarChart/RadarGrid/radarGridClasses.mjs +0 -15
- package/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.d.mts +0 -22
- package/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.d.ts +0 -22
- package/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.js +0 -26
- package/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.mjs +0 -17
- package/context/ChartProvider/ChartContext.d.mts +0 -5
- package/context/ChartProvider/ChartContext.d.ts +0 -5
- package/context/ChartProvider/ChartContext.js +0 -13
- package/context/ChartProvider/ChartContext.mjs +0 -9
- package/context/ChartProvider/ChartProvider.d.mts +0 -5
- package/context/ChartProvider/ChartProvider.d.ts +0 -5
- package/context/ChartProvider/ChartProvider.js +0 -12
- package/context/ChartProvider/ChartProvider.mjs +0 -8
- package/context/ChartProvider/ChartProvider.types.d.mts +0 -15
- package/context/ChartProvider/ChartProvider.types.d.ts +0 -15
- package/context/ChartProvider/index.d.mts +0 -3
- package/context/ChartProvider/index.d.ts +0 -3
- package/context/ChartProvider/index.js +0 -38
- package/context/ChartProvider/index.mjs +0 -3
- package/context/ChartProvider/useChartContext.d.mts +0 -4
- package/context/ChartProvider/useChartContext.d.ts +0 -4
- package/context/ChartProvider/useChartContext.js +0 -12
- package/context/ChartProvider/useChartContext.mjs +0 -8
- package/tests/constants.js +0 -7
- package/tests/constants.mjs +0 -1
- /package/{context/ChartProvider/ChartProvider.types.js → internals/plugins/corePlugins/useChartSeriesConfig/types/TooltipContent.types.js} +0 -0
- /package/{context/ChartProvider/ChartProvider.types.mjs → internals/plugins/corePlugins/useChartSeriesConfig/types/TooltipContent.types.mjs} +0 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.computeAxisAutoSize = computeAxisAutoSize;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _domUtils = require("../../../domUtils");
|
|
10
|
+
var _angleConversion = require("../../../angleConversion");
|
|
11
|
+
var _getGraphemeCount = require("../../../getGraphemeCount");
|
|
12
|
+
var _getScale = require("../../../getScale");
|
|
13
|
+
var _scales = require("../../../scales");
|
|
14
|
+
var _constants = require("../../../../constants");
|
|
15
|
+
var _autoSizeConstants = require("./autoSizeConstants");
|
|
16
|
+
/**
|
|
17
|
+
* Checks if an axis has groups defined.
|
|
18
|
+
*/
|
|
19
|
+
function hasGroups(axis) {
|
|
20
|
+
return 'groups' in axis && Array.isArray(axis.groups) && axis.groups.length > 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Gets the unique labels for a specific group level.
|
|
25
|
+
*/
|
|
26
|
+
function getGroupLabels(data, group) {
|
|
27
|
+
const uniqueLabels = new Set();
|
|
28
|
+
for (let dataIndex = 0; dataIndex < data.length; dataIndex += 1) {
|
|
29
|
+
const value = data[dataIndex];
|
|
30
|
+
const groupValue = group.getValue(value, dataIndex);
|
|
31
|
+
uniqueLabels.add(`${groupValue}`);
|
|
32
|
+
}
|
|
33
|
+
return Array.from(uniqueLabels);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Result of auto-size computation for axes.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The maximum number of labels to measure for band/point scales.
|
|
42
|
+
* We only need the widest and tallest labels to determine auto-size, so we pick a small set of
|
|
43
|
+
* candidates using grapheme count as a proxy for visual width instead of measuring all.
|
|
44
|
+
*/
|
|
45
|
+
const MAX_AUTO_SIZE_CANDIDATES = 5;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the maximum grapheme count of a label's lines (splitting by newlines).
|
|
49
|
+
* Uses grapheme count instead of string length for correct handling of emojis and complex characters.
|
|
50
|
+
*/
|
|
51
|
+
function maxLineLength(label) {
|
|
52
|
+
const lines = label.split('\n');
|
|
53
|
+
return Math.max(...lines.map(line => (0, _getGraphemeCount.getGraphemeCount)(line)));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* From a list of rendered label strings, returns a small subset of candidates
|
|
58
|
+
* that are most likely to be the visually widest and highest labels to measure for auto-size calculation.
|
|
59
|
+
* Uses character count as a proxy for visual width, and number of lines as a proxy for visual height, which works well in practice.
|
|
60
|
+
*
|
|
61
|
+
* Maintains a sorted list of the top candidates by width, plus the label with the most lines.
|
|
62
|
+
*/
|
|
63
|
+
function selectLargestCandidates(labels) {
|
|
64
|
+
if (labels.length <= MAX_AUTO_SIZE_CANDIDATES) {
|
|
65
|
+
return labels;
|
|
66
|
+
}
|
|
67
|
+
const candidates = [];
|
|
68
|
+
let maxLines = 1;
|
|
69
|
+
let maxLinesValue = null;
|
|
70
|
+
for (const label of labels) {
|
|
71
|
+
const lines = label.split('\n').length;
|
|
72
|
+
if (lines > maxLines) {
|
|
73
|
+
maxLines = lines;
|
|
74
|
+
maxLinesValue = label;
|
|
75
|
+
}
|
|
76
|
+
const length = maxLineLength(label);
|
|
77
|
+
|
|
78
|
+
// Keep a sorted array with the largest labels found
|
|
79
|
+
if (candidates.length < MAX_AUTO_SIZE_CANDIDATES || length > candidates[0].length) {
|
|
80
|
+
const index = candidates.findIndex(candidate => candidate.length > length);
|
|
81
|
+
candidates.splice(index === -1 ? candidates.length : index, 0, {
|
|
82
|
+
label,
|
|
83
|
+
length
|
|
84
|
+
});
|
|
85
|
+
if (candidates.length > MAX_AUTO_SIZE_CANDIDATES) {
|
|
86
|
+
candidates.shift();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Add the item with the largest number of lines
|
|
92
|
+
if (maxLinesValue !== null && candidates.find(candidate => candidate.label === maxLinesValue) === undefined) {
|
|
93
|
+
candidates.push({
|
|
94
|
+
label: maxLinesValue,
|
|
95
|
+
length: maxLineLength(maxLinesValue)
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return candidates.map(candidate => candidate.label);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Gets tick labels that would be displayed for the axis.
|
|
103
|
+
* For ordinal scales (band/point), use axis.data.
|
|
104
|
+
* For continuous scales, generate estimated tick values from axis min/max configuration.
|
|
105
|
+
*/
|
|
106
|
+
function getTickLabels(axis, domain) {
|
|
107
|
+
const {
|
|
108
|
+
valueFormatter,
|
|
109
|
+
scaleType,
|
|
110
|
+
data
|
|
111
|
+
} = axis;
|
|
112
|
+
if (scaleType === 'band' || scaleType === 'point') {
|
|
113
|
+
if (!data || data.length === 0) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
const scale = scaleType === 'band' ? (0, _scales.scaleBand)(data, [0, 1]) : (0, _scales.scalePoint)(data, [0, 1]);
|
|
117
|
+
const labels = data.map(value => {
|
|
118
|
+
if (valueFormatter) {
|
|
119
|
+
return valueFormatter(value, {
|
|
120
|
+
location: 'tick',
|
|
121
|
+
scale,
|
|
122
|
+
defaultTickLabel: `${value}`
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return `${value}`;
|
|
126
|
+
});
|
|
127
|
+
return selectLargestCandidates(labels);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Use niced domain values (already processed through domainLimit), or defaults.
|
|
131
|
+
const minVal = domain ? domain.domain[0] : 0;
|
|
132
|
+
const maxVal = domain ? domain.domain[1] : 100;
|
|
133
|
+
const tickNumber = domain?.tickNumber ?? 2;
|
|
134
|
+
|
|
135
|
+
// Create a temporary scale for formatting (tickFormat only uses the domain, not the range)
|
|
136
|
+
const continuousScaleType = scaleType ?? 'linear';
|
|
137
|
+
const scale = (0, _getScale.getScale)(continuousScaleType, [minVal, maxVal], [0, 1]);
|
|
138
|
+
const valuesToMeasure = minVal === maxVal ? [minVal] : [minVal, maxVal];
|
|
139
|
+
const tickFormat = scale.tickFormat(tickNumber);
|
|
140
|
+
return valuesToMeasure.map(value => {
|
|
141
|
+
const defaultTickLabel = tickFormat(value);
|
|
142
|
+
if (valueFormatter) {
|
|
143
|
+
return valueFormatter(value, {
|
|
144
|
+
location: 'tick',
|
|
145
|
+
scale,
|
|
146
|
+
defaultTickLabel
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return defaultTickLabel;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Measures all lines of text from tick labels and returns the maximum dimensions.
|
|
155
|
+
*/
|
|
156
|
+
function measureTickLabels(labels, style) {
|
|
157
|
+
if (labels.length === 0) {
|
|
158
|
+
return {
|
|
159
|
+
maxWidth: 0,
|
|
160
|
+
maxHeight: 0
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
const allLines = new Set();
|
|
164
|
+
for (const label of labels) {
|
|
165
|
+
const lines = label.split('\n');
|
|
166
|
+
for (const line of lines) {
|
|
167
|
+
allLines.add(line);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const sizeMap = (0, _domUtils.batchMeasureStrings)(allLines, style);
|
|
171
|
+
let maxWidth = 0;
|
|
172
|
+
let maxHeight = 0;
|
|
173
|
+
for (const label of labels) {
|
|
174
|
+
const lines = label.split('\n');
|
|
175
|
+
let labelWidth = 0;
|
|
176
|
+
let labelHeight = 0;
|
|
177
|
+
for (const line of lines) {
|
|
178
|
+
const size = sizeMap.get(line) ?? {
|
|
179
|
+
width: 0,
|
|
180
|
+
height: 0
|
|
181
|
+
};
|
|
182
|
+
labelWidth = Math.max(labelWidth, size.width);
|
|
183
|
+
labelHeight += size.height;
|
|
184
|
+
}
|
|
185
|
+
maxWidth = Math.max(maxWidth, labelWidth);
|
|
186
|
+
maxHeight = Math.max(maxHeight, labelHeight);
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
maxWidth,
|
|
190
|
+
maxHeight
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Computes the bounding box dimension when a rectangle is rotated.
|
|
196
|
+
* For x-axis, we need the height of the rotated bounding box.
|
|
197
|
+
* For y-axis, we need the width of the rotated bounding box.
|
|
198
|
+
*/
|
|
199
|
+
function getRotatedDimension(width, height, angle, direction) {
|
|
200
|
+
if (!angle || angle % 180 === 0) {
|
|
201
|
+
return direction === 'x' ? height : width;
|
|
202
|
+
}
|
|
203
|
+
if (angle % 90 === 0) {
|
|
204
|
+
return direction === 'x' ? width : height;
|
|
205
|
+
}
|
|
206
|
+
const radAngle = (0, _angleConversion.deg2rad)(Math.abs(angle));
|
|
207
|
+
const cosAngle = Math.cos(radAngle);
|
|
208
|
+
const sinAngle = Math.sin(radAngle);
|
|
209
|
+
if (direction === 'x') {
|
|
210
|
+
return Math.abs(width * sinAngle) + Math.abs(height * cosAngle);
|
|
211
|
+
}
|
|
212
|
+
return Math.abs(width * cosAngle) + Math.abs(height * sinAngle);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Computes the auto-size dimension for a grouped axis.
|
|
217
|
+
* For grouped axes, we compute cumulative tick sizes so that each group's labels
|
|
218
|
+
* are positioned after the previous group's labels (no overlap).
|
|
219
|
+
*
|
|
220
|
+
* Returns both the total size and the computed tick sizes for each group level.
|
|
221
|
+
*/
|
|
222
|
+
function computeGroupedAxisAutoSize(axis, direction) {
|
|
223
|
+
const {
|
|
224
|
+
groups,
|
|
225
|
+
data,
|
|
226
|
+
tickSize: baseTickSize,
|
|
227
|
+
tickLabelStyle: axisTickLabelStyle
|
|
228
|
+
} = axis;
|
|
229
|
+
const hasAxisLabel = Boolean(axis.label);
|
|
230
|
+
if (!data || data.length === 0) {
|
|
231
|
+
return {
|
|
232
|
+
size: _autoSizeConstants.AXIS_AUTO_SIZE_MIN
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const groupTickSizes = [];
|
|
236
|
+
const labelDimensions = [];
|
|
237
|
+
const defaultTickSize = baseTickSize ?? _autoSizeConstants.AXIS_AUTO_SIZE_TICK_SIZE;
|
|
238
|
+
for (let groupIndex = 0; groupIndex < groups.length; groupIndex += 1) {
|
|
239
|
+
const group = groups[groupIndex];
|
|
240
|
+
const groupLabels = selectLargestCandidates(getGroupLabels(data, group));
|
|
241
|
+
const groupTickLabelStyle = (0, _extends2.default)({}, axisTickLabelStyle, group.tickLabelStyle);
|
|
242
|
+
const angle = groupTickLabelStyle?.angle;
|
|
243
|
+
const {
|
|
244
|
+
maxWidth,
|
|
245
|
+
maxHeight
|
|
246
|
+
} = measureTickLabels(groupLabels, groupTickLabelStyle);
|
|
247
|
+
if (maxWidth === 0 && maxHeight === 0) {
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
const labelDimension = getRotatedDimension(maxWidth, maxHeight, angle, direction);
|
|
251
|
+
labelDimensions.push(labelDimension);
|
|
252
|
+
const customTickSize = group.tickSize;
|
|
253
|
+
if (customTickSize !== undefined) {
|
|
254
|
+
groupTickSizes.push(customTickSize);
|
|
255
|
+
} else if (groupIndex === 0) {
|
|
256
|
+
groupTickSizes.push(defaultTickSize);
|
|
257
|
+
} else {
|
|
258
|
+
// Position after previous group's labels
|
|
259
|
+
const previousExtent = groupTickSizes[groupIndex - 1] + _autoSizeConstants.AXIS_AUTO_SIZE_TICK_LABEL_GAP + labelDimensions[groupIndex - 1] + _autoSizeConstants.AXIS_AUTO_SIZE_GROUP_GAP;
|
|
260
|
+
groupTickSizes.push(previousExtent + defaultTickSize);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const lastGroupIndex = groups.length - 1;
|
|
264
|
+
let totalExtent = groupTickSizes[lastGroupIndex] + _autoSizeConstants.AXIS_AUTO_SIZE_TICK_LABEL_GAP + labelDimensions[lastGroupIndex];
|
|
265
|
+
if (hasAxisLabel) {
|
|
266
|
+
totalExtent += _constants.AXIS_LABEL_DEFAULT_HEIGHT;
|
|
267
|
+
}
|
|
268
|
+
totalExtent += _autoSizeConstants.AXIS_AUTO_SIZE_PADDING;
|
|
269
|
+
const size = Math.max(Math.ceil(totalExtent), _autoSizeConstants.AXIS_AUTO_SIZE_MIN);
|
|
270
|
+
return {
|
|
271
|
+
size,
|
|
272
|
+
groupTickSizes
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Computes the auto-size dimension for an axis based on tick label measurements.
|
|
278
|
+
* Returns undefined if measurement is not available (SSR or not hydrated).
|
|
279
|
+
*
|
|
280
|
+
* For regular axes, returns just a number (the size).
|
|
281
|
+
* For grouped axes, returns an object with size and computed group tick sizes.
|
|
282
|
+
*/
|
|
283
|
+
function computeAxisAutoSize(options) {
|
|
284
|
+
const {
|
|
285
|
+
axis,
|
|
286
|
+
direction,
|
|
287
|
+
domain
|
|
288
|
+
} = options;
|
|
289
|
+
if (hasGroups(axis)) {
|
|
290
|
+
return computeGroupedAxisAutoSize(axis, direction);
|
|
291
|
+
}
|
|
292
|
+
const tickLabelStyle = axis.tickLabelStyle;
|
|
293
|
+
const tickSize = axis.tickSize ?? _autoSizeConstants.AXIS_AUTO_SIZE_TICK_SIZE;
|
|
294
|
+
const hasLabel = Boolean(axis.label);
|
|
295
|
+
const angle = tickLabelStyle?.angle;
|
|
296
|
+
const labels = getTickLabels(axis, domain);
|
|
297
|
+
if (labels.length === 0) {
|
|
298
|
+
return {
|
|
299
|
+
size: _autoSizeConstants.AXIS_AUTO_SIZE_MIN
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const {
|
|
303
|
+
maxWidth,
|
|
304
|
+
maxHeight
|
|
305
|
+
} = measureTickLabels(labels, tickLabelStyle);
|
|
306
|
+
if (maxWidth === 0 && maxHeight === 0) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
const labelDimension = getRotatedDimension(maxWidth, maxHeight, angle, direction);
|
|
310
|
+
let totalSize = tickSize + _autoSizeConstants.AXIS_AUTO_SIZE_TICK_LABEL_GAP + labelDimension;
|
|
311
|
+
if (hasLabel) {
|
|
312
|
+
totalSize += _constants.AXIS_LABEL_DEFAULT_HEIGHT;
|
|
313
|
+
}
|
|
314
|
+
totalSize += _autoSizeConstants.AXIS_AUTO_SIZE_PADDING;
|
|
315
|
+
return {
|
|
316
|
+
size: Math.max(Math.ceil(totalSize), _autoSizeConstants.AXIS_AUTO_SIZE_MIN)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { batchMeasureStrings } from "../../../domUtils.mjs";
|
|
3
|
+
import { deg2rad } from "../../../angleConversion.mjs";
|
|
4
|
+
import { getGraphemeCount } from "../../../getGraphemeCount.mjs";
|
|
5
|
+
import { getScale } from "../../../getScale.mjs";
|
|
6
|
+
import { scaleBand, scalePoint } from "../../../scales/index.mjs";
|
|
7
|
+
import { AXIS_LABEL_DEFAULT_HEIGHT } from "../../../../constants/index.mjs";
|
|
8
|
+
import { AXIS_AUTO_SIZE_PADDING, AXIS_AUTO_SIZE_MIN, AXIS_AUTO_SIZE_TICK_SIZE, AXIS_AUTO_SIZE_TICK_LABEL_GAP, AXIS_AUTO_SIZE_GROUP_GAP } from "./autoSizeConstants.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* Checks if an axis has groups defined.
|
|
11
|
+
*/
|
|
12
|
+
function hasGroups(axis) {
|
|
13
|
+
return 'groups' in axis && Array.isArray(axis.groups) && axis.groups.length > 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gets the unique labels for a specific group level.
|
|
18
|
+
*/
|
|
19
|
+
function getGroupLabels(data, group) {
|
|
20
|
+
const uniqueLabels = new Set();
|
|
21
|
+
for (let dataIndex = 0; dataIndex < data.length; dataIndex += 1) {
|
|
22
|
+
const value = data[dataIndex];
|
|
23
|
+
const groupValue = group.getValue(value, dataIndex);
|
|
24
|
+
uniqueLabels.add(`${groupValue}`);
|
|
25
|
+
}
|
|
26
|
+
return Array.from(uniqueLabels);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Result of auto-size computation for axes.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The maximum number of labels to measure for band/point scales.
|
|
35
|
+
* We only need the widest and tallest labels to determine auto-size, so we pick a small set of
|
|
36
|
+
* candidates using grapheme count as a proxy for visual width instead of measuring all.
|
|
37
|
+
*/
|
|
38
|
+
const MAX_AUTO_SIZE_CANDIDATES = 5;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the maximum grapheme count of a label's lines (splitting by newlines).
|
|
42
|
+
* Uses grapheme count instead of string length for correct handling of emojis and complex characters.
|
|
43
|
+
*/
|
|
44
|
+
function maxLineLength(label) {
|
|
45
|
+
const lines = label.split('\n');
|
|
46
|
+
return Math.max(...lines.map(line => getGraphemeCount(line)));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* From a list of rendered label strings, returns a small subset of candidates
|
|
51
|
+
* that are most likely to be the visually widest and highest labels to measure for auto-size calculation.
|
|
52
|
+
* Uses character count as a proxy for visual width, and number of lines as a proxy for visual height, which works well in practice.
|
|
53
|
+
*
|
|
54
|
+
* Maintains a sorted list of the top candidates by width, plus the label with the most lines.
|
|
55
|
+
*/
|
|
56
|
+
function selectLargestCandidates(labels) {
|
|
57
|
+
if (labels.length <= MAX_AUTO_SIZE_CANDIDATES) {
|
|
58
|
+
return labels;
|
|
59
|
+
}
|
|
60
|
+
const candidates = [];
|
|
61
|
+
let maxLines = 1;
|
|
62
|
+
let maxLinesValue = null;
|
|
63
|
+
for (const label of labels) {
|
|
64
|
+
const lines = label.split('\n').length;
|
|
65
|
+
if (lines > maxLines) {
|
|
66
|
+
maxLines = lines;
|
|
67
|
+
maxLinesValue = label;
|
|
68
|
+
}
|
|
69
|
+
const length = maxLineLength(label);
|
|
70
|
+
|
|
71
|
+
// Keep a sorted array with the largest labels found
|
|
72
|
+
if (candidates.length < MAX_AUTO_SIZE_CANDIDATES || length > candidates[0].length) {
|
|
73
|
+
const index = candidates.findIndex(candidate => candidate.length > length);
|
|
74
|
+
candidates.splice(index === -1 ? candidates.length : index, 0, {
|
|
75
|
+
label,
|
|
76
|
+
length
|
|
77
|
+
});
|
|
78
|
+
if (candidates.length > MAX_AUTO_SIZE_CANDIDATES) {
|
|
79
|
+
candidates.shift();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Add the item with the largest number of lines
|
|
85
|
+
if (maxLinesValue !== null && candidates.find(candidate => candidate.label === maxLinesValue) === undefined) {
|
|
86
|
+
candidates.push({
|
|
87
|
+
label: maxLinesValue,
|
|
88
|
+
length: maxLineLength(maxLinesValue)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return candidates.map(candidate => candidate.label);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Gets tick labels that would be displayed for the axis.
|
|
96
|
+
* For ordinal scales (band/point), use axis.data.
|
|
97
|
+
* For continuous scales, generate estimated tick values from axis min/max configuration.
|
|
98
|
+
*/
|
|
99
|
+
function getTickLabels(axis, domain) {
|
|
100
|
+
const {
|
|
101
|
+
valueFormatter,
|
|
102
|
+
scaleType,
|
|
103
|
+
data
|
|
104
|
+
} = axis;
|
|
105
|
+
if (scaleType === 'band' || scaleType === 'point') {
|
|
106
|
+
if (!data || data.length === 0) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const scale = scaleType === 'band' ? scaleBand(data, [0, 1]) : scalePoint(data, [0, 1]);
|
|
110
|
+
const labels = data.map(value => {
|
|
111
|
+
if (valueFormatter) {
|
|
112
|
+
return valueFormatter(value, {
|
|
113
|
+
location: 'tick',
|
|
114
|
+
scale,
|
|
115
|
+
defaultTickLabel: `${value}`
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return `${value}`;
|
|
119
|
+
});
|
|
120
|
+
return selectLargestCandidates(labels);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Use niced domain values (already processed through domainLimit), or defaults.
|
|
124
|
+
const minVal = domain ? domain.domain[0] : 0;
|
|
125
|
+
const maxVal = domain ? domain.domain[1] : 100;
|
|
126
|
+
const tickNumber = domain?.tickNumber ?? 2;
|
|
127
|
+
|
|
128
|
+
// Create a temporary scale for formatting (tickFormat only uses the domain, not the range)
|
|
129
|
+
const continuousScaleType = scaleType ?? 'linear';
|
|
130
|
+
const scale = getScale(continuousScaleType, [minVal, maxVal], [0, 1]);
|
|
131
|
+
const valuesToMeasure = minVal === maxVal ? [minVal] : [minVal, maxVal];
|
|
132
|
+
const tickFormat = scale.tickFormat(tickNumber);
|
|
133
|
+
return valuesToMeasure.map(value => {
|
|
134
|
+
const defaultTickLabel = tickFormat(value);
|
|
135
|
+
if (valueFormatter) {
|
|
136
|
+
return valueFormatter(value, {
|
|
137
|
+
location: 'tick',
|
|
138
|
+
scale,
|
|
139
|
+
defaultTickLabel
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return defaultTickLabel;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Measures all lines of text from tick labels and returns the maximum dimensions.
|
|
148
|
+
*/
|
|
149
|
+
function measureTickLabels(labels, style) {
|
|
150
|
+
if (labels.length === 0) {
|
|
151
|
+
return {
|
|
152
|
+
maxWidth: 0,
|
|
153
|
+
maxHeight: 0
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const allLines = new Set();
|
|
157
|
+
for (const label of labels) {
|
|
158
|
+
const lines = label.split('\n');
|
|
159
|
+
for (const line of lines) {
|
|
160
|
+
allLines.add(line);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const sizeMap = batchMeasureStrings(allLines, style);
|
|
164
|
+
let maxWidth = 0;
|
|
165
|
+
let maxHeight = 0;
|
|
166
|
+
for (const label of labels) {
|
|
167
|
+
const lines = label.split('\n');
|
|
168
|
+
let labelWidth = 0;
|
|
169
|
+
let labelHeight = 0;
|
|
170
|
+
for (const line of lines) {
|
|
171
|
+
const size = sizeMap.get(line) ?? {
|
|
172
|
+
width: 0,
|
|
173
|
+
height: 0
|
|
174
|
+
};
|
|
175
|
+
labelWidth = Math.max(labelWidth, size.width);
|
|
176
|
+
labelHeight += size.height;
|
|
177
|
+
}
|
|
178
|
+
maxWidth = Math.max(maxWidth, labelWidth);
|
|
179
|
+
maxHeight = Math.max(maxHeight, labelHeight);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
maxWidth,
|
|
183
|
+
maxHeight
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Computes the bounding box dimension when a rectangle is rotated.
|
|
189
|
+
* For x-axis, we need the height of the rotated bounding box.
|
|
190
|
+
* For y-axis, we need the width of the rotated bounding box.
|
|
191
|
+
*/
|
|
192
|
+
function getRotatedDimension(width, height, angle, direction) {
|
|
193
|
+
if (!angle || angle % 180 === 0) {
|
|
194
|
+
return direction === 'x' ? height : width;
|
|
195
|
+
}
|
|
196
|
+
if (angle % 90 === 0) {
|
|
197
|
+
return direction === 'x' ? width : height;
|
|
198
|
+
}
|
|
199
|
+
const radAngle = deg2rad(Math.abs(angle));
|
|
200
|
+
const cosAngle = Math.cos(radAngle);
|
|
201
|
+
const sinAngle = Math.sin(radAngle);
|
|
202
|
+
if (direction === 'x') {
|
|
203
|
+
return Math.abs(width * sinAngle) + Math.abs(height * cosAngle);
|
|
204
|
+
}
|
|
205
|
+
return Math.abs(width * cosAngle) + Math.abs(height * sinAngle);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Computes the auto-size dimension for a grouped axis.
|
|
210
|
+
* For grouped axes, we compute cumulative tick sizes so that each group's labels
|
|
211
|
+
* are positioned after the previous group's labels (no overlap).
|
|
212
|
+
*
|
|
213
|
+
* Returns both the total size and the computed tick sizes for each group level.
|
|
214
|
+
*/
|
|
215
|
+
function computeGroupedAxisAutoSize(axis, direction) {
|
|
216
|
+
const {
|
|
217
|
+
groups,
|
|
218
|
+
data,
|
|
219
|
+
tickSize: baseTickSize,
|
|
220
|
+
tickLabelStyle: axisTickLabelStyle
|
|
221
|
+
} = axis;
|
|
222
|
+
const hasAxisLabel = Boolean(axis.label);
|
|
223
|
+
if (!data || data.length === 0) {
|
|
224
|
+
return {
|
|
225
|
+
size: AXIS_AUTO_SIZE_MIN
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
const groupTickSizes = [];
|
|
229
|
+
const labelDimensions = [];
|
|
230
|
+
const defaultTickSize = baseTickSize ?? AXIS_AUTO_SIZE_TICK_SIZE;
|
|
231
|
+
for (let groupIndex = 0; groupIndex < groups.length; groupIndex += 1) {
|
|
232
|
+
const group = groups[groupIndex];
|
|
233
|
+
const groupLabels = selectLargestCandidates(getGroupLabels(data, group));
|
|
234
|
+
const groupTickLabelStyle = _extends({}, axisTickLabelStyle, group.tickLabelStyle);
|
|
235
|
+
const angle = groupTickLabelStyle?.angle;
|
|
236
|
+
const {
|
|
237
|
+
maxWidth,
|
|
238
|
+
maxHeight
|
|
239
|
+
} = measureTickLabels(groupLabels, groupTickLabelStyle);
|
|
240
|
+
if (maxWidth === 0 && maxHeight === 0) {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
const labelDimension = getRotatedDimension(maxWidth, maxHeight, angle, direction);
|
|
244
|
+
labelDimensions.push(labelDimension);
|
|
245
|
+
const customTickSize = group.tickSize;
|
|
246
|
+
if (customTickSize !== undefined) {
|
|
247
|
+
groupTickSizes.push(customTickSize);
|
|
248
|
+
} else if (groupIndex === 0) {
|
|
249
|
+
groupTickSizes.push(defaultTickSize);
|
|
250
|
+
} else {
|
|
251
|
+
// Position after previous group's labels
|
|
252
|
+
const previousExtent = groupTickSizes[groupIndex - 1] + AXIS_AUTO_SIZE_TICK_LABEL_GAP + labelDimensions[groupIndex - 1] + AXIS_AUTO_SIZE_GROUP_GAP;
|
|
253
|
+
groupTickSizes.push(previousExtent + defaultTickSize);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const lastGroupIndex = groups.length - 1;
|
|
257
|
+
let totalExtent = groupTickSizes[lastGroupIndex] + AXIS_AUTO_SIZE_TICK_LABEL_GAP + labelDimensions[lastGroupIndex];
|
|
258
|
+
if (hasAxisLabel) {
|
|
259
|
+
totalExtent += AXIS_LABEL_DEFAULT_HEIGHT;
|
|
260
|
+
}
|
|
261
|
+
totalExtent += AXIS_AUTO_SIZE_PADDING;
|
|
262
|
+
const size = Math.max(Math.ceil(totalExtent), AXIS_AUTO_SIZE_MIN);
|
|
263
|
+
return {
|
|
264
|
+
size,
|
|
265
|
+
groupTickSizes
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Computes the auto-size dimension for an axis based on tick label measurements.
|
|
271
|
+
* Returns undefined if measurement is not available (SSR or not hydrated).
|
|
272
|
+
*
|
|
273
|
+
* For regular axes, returns just a number (the size).
|
|
274
|
+
* For grouped axes, returns an object with size and computed group tick sizes.
|
|
275
|
+
*/
|
|
276
|
+
export function computeAxisAutoSize(options) {
|
|
277
|
+
const {
|
|
278
|
+
axis,
|
|
279
|
+
direction,
|
|
280
|
+
domain
|
|
281
|
+
} = options;
|
|
282
|
+
if (hasGroups(axis)) {
|
|
283
|
+
return computeGroupedAxisAutoSize(axis, direction);
|
|
284
|
+
}
|
|
285
|
+
const tickLabelStyle = axis.tickLabelStyle;
|
|
286
|
+
const tickSize = axis.tickSize ?? AXIS_AUTO_SIZE_TICK_SIZE;
|
|
287
|
+
const hasLabel = Boolean(axis.label);
|
|
288
|
+
const angle = tickLabelStyle?.angle;
|
|
289
|
+
const labels = getTickLabels(axis, domain);
|
|
290
|
+
if (labels.length === 0) {
|
|
291
|
+
return {
|
|
292
|
+
size: AXIS_AUTO_SIZE_MIN
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
const {
|
|
296
|
+
maxWidth,
|
|
297
|
+
maxHeight
|
|
298
|
+
} = measureTickLabels(labels, tickLabelStyle);
|
|
299
|
+
if (maxWidth === 0 && maxHeight === 0) {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
const labelDimension = getRotatedDimension(maxWidth, maxHeight, angle, direction);
|
|
303
|
+
let totalSize = tickSize + AXIS_AUTO_SIZE_TICK_LABEL_GAP + labelDimension;
|
|
304
|
+
if (hasLabel) {
|
|
305
|
+
totalSize += AXIS_LABEL_DEFAULT_HEIGHT;
|
|
306
|
+
}
|
|
307
|
+
totalSize += AXIS_AUTO_SIZE_PADDING;
|
|
308
|
+
return {
|
|
309
|
+
size: Math.max(Math.ceil(totalSize), AXIS_AUTO_SIZE_MIN)
|
|
310
|
+
};
|
|
311
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ScaleName } from "../../../../models/index.mjs";
|
|
3
|
+
import { type ChartsXAxisProps, type ChartsAxisProps, type ChartsYAxisProps, type AxisId, type DefaultedXAxis, type DefaultedYAxis, type DefaultedAxis, type D3Scale } from "../../../../models/axis.mjs";
|
|
3
4
|
import { type ChartSeriesType } from "../../../../models/seriesType/config.mjs";
|
|
4
5
|
import type { ChartDrawingArea } from "../../../../hooks/index.mjs";
|
|
5
6
|
import { type ChartSeriesConfig } from "../../corePlugins/useChartSeriesConfig/index.mjs";
|
|
6
7
|
import { type ComputedAxisConfig } from "./useChartCartesianAxis.types.mjs";
|
|
7
8
|
import { type ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.mjs";
|
|
8
9
|
import { type ZoomData } from "./zoom.types.mjs";
|
|
10
|
+
export declare function resolveAxisSize(axis: DefaultedAxis<ScaleName, any, Readonly<ChartsAxisProps>>, autoSizes: Record<AxisId, number> | undefined, direction: 'x' | 'y'): number;
|
|
9
11
|
export type ComputeResult<T extends ChartsAxisProps> = {
|
|
10
12
|
axis: ComputedAxisConfig<T>;
|
|
11
13
|
axisIds: AxisId[];
|
|
@@ -20,6 +22,8 @@ type ComputeCommonParams<SeriesType extends ChartSeriesType = ChartSeriesType> =
|
|
|
20
22
|
domain: ReadonlyArray<string | NumberValue>;
|
|
21
23
|
tickNumber?: number;
|
|
22
24
|
}>;
|
|
25
|
+
autoSizes?: Record<AxisId, number>;
|
|
26
|
+
axesGap?: number;
|
|
23
27
|
};
|
|
24
28
|
export declare function computeAxisValue<SeriesType extends ChartSeriesType>(options: ComputeCommonParams<SeriesType> & {
|
|
25
29
|
axis?: DefaultedYAxis[];
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ScaleName } from "../../../../models/index.js";
|
|
3
|
+
import { type ChartsXAxisProps, type ChartsAxisProps, type ChartsYAxisProps, type AxisId, type DefaultedXAxis, type DefaultedYAxis, type DefaultedAxis, type D3Scale } from "../../../../models/axis.js";
|
|
3
4
|
import { type ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
4
5
|
import type { ChartDrawingArea } from "../../../../hooks/index.js";
|
|
5
6
|
import { type ChartSeriesConfig } from "../../corePlugins/useChartSeriesConfig/index.js";
|
|
6
7
|
import { type ComputedAxisConfig } from "./useChartCartesianAxis.types.js";
|
|
7
8
|
import { type ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.js";
|
|
8
9
|
import { type ZoomData } from "./zoom.types.js";
|
|
10
|
+
export declare function resolveAxisSize(axis: DefaultedAxis<ScaleName, any, Readonly<ChartsAxisProps>>, autoSizes: Record<AxisId, number> | undefined, direction: 'x' | 'y'): number;
|
|
9
11
|
export type ComputeResult<T extends ChartsAxisProps> = {
|
|
10
12
|
axis: ComputedAxisConfig<T>;
|
|
11
13
|
axisIds: AxisId[];
|
|
@@ -20,6 +22,8 @@ type ComputeCommonParams<SeriesType extends ChartSeriesType = ChartSeriesType> =
|
|
|
20
22
|
domain: ReadonlyArray<string | NumberValue>;
|
|
21
23
|
tickNumber?: number;
|
|
22
24
|
}>;
|
|
25
|
+
autoSizes?: Record<AxisId, number>;
|
|
26
|
+
axesGap?: number;
|
|
23
27
|
};
|
|
24
28
|
export declare function computeAxisValue<SeriesType extends ChartSeriesType>(options: ComputeCommonParams<SeriesType> & {
|
|
25
29
|
axis?: DefaultedYAxis[];
|