@mui/x-charts 8.0.0-alpha.12 → 8.0.0-alpha.13
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 +1 -1
- package/BarChart/BarChart.js +14 -30
- package/BarChart/useBarChartProps.js +3 -18
- package/CHANGELOG.md +299 -0
- package/ChartContainer/ChartContainer.d.ts +1 -1
- package/ChartContainer/ChartContainer.js +15 -7
- package/ChartDataProvider/ChartDataProvider.d.ts +2 -2
- package/ChartDataProvider/ChartDataProvider.js +4 -3
- package/ChartsAxis/ChartsAxis.d.ts +1 -25
- package/ChartsAxis/ChartsAxis.js +25 -87
- package/ChartsAxis/axisClasses.d.ts +5 -1
- package/ChartsLabel/ChartsLabelMark.d.ts +6 -1
- package/ChartsLabel/ChartsLabelMark.js +15 -2
- package/ChartsLabel/index.d.ts +1 -1
- package/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/ChartsLabel/labelMarkClasses.js +1 -1
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/ChartsXAxis/ChartsXAxis.js +70 -57
- package/ChartsYAxis/ChartsYAxis.js +11 -15
- package/Gauge/Gauge.js +4 -3
- package/Gauge/GaugeContainer.js +7 -5
- package/LineChart/LineChart.d.ts +1 -1
- package/LineChart/LineChart.js +14 -30
- package/LineChart/useLineChartProps.js +2 -17
- package/PieChart/PieArcLabelPlot.js +1 -1
- package/PieChart/PieArcPlot.js +1 -1
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +6 -4
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +14 -30
- package/ScatterChart/useScatterChartProps.js +2 -17
- package/SparkLineChart/SparkLineChart.d.ts +4 -8
- package/SparkLineChart/SparkLineChart.js +23 -21
- package/constants/index.d.ts +8 -1
- package/constants/index.js +13 -6
- package/context/AnimationProvider/useSkipAnimation.js +1 -1
- package/context/ChartProvider/ChartProvider.types.d.ts +6 -6
- package/context/PolarProvider/Polar.types.d.ts +3 -2
- package/esm/BarChart/BarChart.d.ts +1 -1
- package/esm/BarChart/BarChart.js +14 -30
- package/esm/BarChart/useBarChartProps.js +3 -18
- package/esm/ChartContainer/ChartContainer.d.ts +1 -1
- package/esm/ChartContainer/ChartContainer.js +15 -7
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +2 -2
- package/esm/ChartDataProvider/ChartDataProvider.js +4 -3
- package/esm/ChartsAxis/ChartsAxis.d.ts +1 -25
- package/esm/ChartsAxis/ChartsAxis.js +24 -86
- package/esm/ChartsAxis/axisClasses.d.ts +5 -1
- package/esm/ChartsLabel/ChartsLabelMark.d.ts +6 -1
- package/esm/ChartsLabel/ChartsLabelMark.js +15 -2
- package/esm/ChartsLabel/index.d.ts +1 -1
- package/esm/ChartsLabel/index.js +0 -3
- package/esm/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/esm/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/esm/ChartsLabel/labelMarkClasses.js +1 -1
- package/esm/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +70 -57
- package/esm/ChartsYAxis/ChartsYAxis.js +12 -16
- package/esm/Gauge/Gauge.js +4 -3
- package/esm/Gauge/GaugeContainer.js +7 -5
- package/esm/LineChart/LineChart.d.ts +1 -1
- package/esm/LineChart/LineChart.js +14 -30
- package/esm/LineChart/useLineChartProps.js +2 -17
- package/esm/PieChart/PieArcLabelPlot.js +1 -1
- package/esm/PieChart/PieArcPlot.js +1 -1
- package/esm/PieChart/PieChart.d.ts +1 -1
- package/esm/PieChart/PieChart.js +6 -4
- package/esm/ScatterChart/ScatterChart.d.ts +1 -1
- package/esm/ScatterChart/ScatterChart.js +14 -30
- package/esm/ScatterChart/useScatterChartProps.js +2 -17
- package/esm/SparkLineChart/SparkLineChart.d.ts +4 -8
- package/esm/SparkLineChart/SparkLineChart.js +23 -21
- package/esm/constants/index.d.ts +8 -1
- package/esm/constants/index.js +12 -5
- package/esm/context/AnimationProvider/useSkipAnimation.js +1 -1
- package/esm/context/ChartProvider/ChartProvider.types.d.ts +6 -6
- package/esm/context/PolarProvider/Polar.types.d.ts +3 -2
- package/esm/hooks/useAxis.d.ts +2 -2
- package/esm/hooks/useAxis.js +1 -1
- package/esm/hooks/useSvgRef.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/defaultizeColor.d.ts +23 -23
- package/esm/internals/defaultizeMargin.d.ts +3 -0
- package/esm/internals/defaultizeMargin.js +15 -0
- package/esm/internals/domUtils.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +52 -31
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +549 -105
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +19 -18
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +7 -16
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +2 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +2 -3
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +7 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +13 -15
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +37 -35
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +3 -36
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +37 -9
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +216 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +6 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +15 -14
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +15 -13
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +70 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +4 -0
- package/{internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts → esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts} +1815 -911
- package/{modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js → esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js} +4 -6
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +86 -130
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +188 -71
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +9 -4
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +2 -2
- package/esm/internals/plugins/models/plugin.d.ts +1 -1
- package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/esm/internals/plugins/utils/ChartStore.d.ts +7 -7
- package/esm/internals/plugins/utils/selectors.d.ts +1 -0
- package/esm/internals/store/useCharts.js +0 -8
- package/esm/internals/store/useSelector.d.ts +1 -1
- package/esm/internals/store/useSelector.js +4 -1
- package/esm/internals/store/useStore.js +1 -1
- package/esm/models/axis.d.ts +56 -10
- package/esm/models/colorMapping.d.ts +1 -1
- package/esm/models/index.d.ts +0 -1
- package/esm/models/index.js +0 -1
- package/esm/models/seriesType/bar.d.ts +1 -1
- package/esm/models/seriesType/config.d.ts +1 -1
- package/esm/models/seriesType/line.d.ts +1 -1
- package/esm/models/seriesType/pie.d.ts +1 -1
- package/esm/models/seriesType/scatter.d.ts +1 -1
- package/esm/models/z-axis.d.ts +1 -1
- package/hooks/useAxis.d.ts +2 -2
- package/hooks/useAxis.js +5 -5
- package/hooks/useSvgRef.js +1 -1
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +23 -23
- package/internals/defaultizeMargin.d.ts +3 -0
- package/internals/defaultizeMargin.js +22 -0
- package/internals/domUtils.js +1 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +51 -30
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +549 -105
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +20 -19
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +7 -16
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +2 -2
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +2 -3
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +7 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +13 -15
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +39 -37
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +3 -36
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +36 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +216 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +12 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +16 -15
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +15 -13
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +70 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +11 -0
- package/{modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts → internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts} +1815 -911
- package/internals/plugins/featurePlugins/useChartCartesianAxis/{useChartCartesianAxis.selectors.js → useChartCartesianAxisRendering.selectors.js} +10 -13
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +86 -130
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +188 -71
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -5
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +2 -2
- package/internals/plugins/models/plugin.d.ts +1 -1
- package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/internals/plugins/utils/ChartStore.d.ts +7 -7
- package/internals/plugins/utils/selectors.d.ts +1 -0
- package/internals/store/useCharts.js +0 -8
- package/internals/store/useSelector.d.ts +1 -1
- package/internals/store/useSelector.js +5 -1
- package/internals/store/useStore.js +1 -1
- package/models/axis.d.ts +56 -10
- package/models/colorMapping.d.ts +1 -1
- package/models/index.d.ts +0 -1
- package/models/index.js +0 -11
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -1
- package/models/z-axis.d.ts +1 -1
- package/modern/BarChart/BarChart.d.ts +1 -1
- package/modern/BarChart/BarChart.js +14 -30
- package/modern/BarChart/useBarChartProps.js +3 -18
- package/modern/ChartContainer/ChartContainer.d.ts +1 -1
- package/modern/ChartContainer/ChartContainer.js +15 -7
- package/modern/ChartDataProvider/ChartDataProvider.d.ts +2 -2
- package/modern/ChartDataProvider/ChartDataProvider.js +4 -3
- package/modern/ChartsAxis/ChartsAxis.d.ts +1 -25
- package/modern/ChartsAxis/ChartsAxis.js +24 -86
- package/modern/ChartsAxis/axisClasses.d.ts +5 -1
- package/modern/ChartsLabel/ChartsLabelMark.d.ts +6 -1
- package/modern/ChartsLabel/ChartsLabelMark.js +15 -2
- package/modern/ChartsLabel/index.d.ts +1 -1
- package/modern/ChartsLabel/index.js +0 -3
- package/modern/ChartsLabel/labelGradientClasses.d.ts +1 -1
- package/modern/ChartsLabel/labelMarkClasses.d.ts +1 -1
- package/modern/ChartsLabel/labelMarkClasses.js +1 -1
- package/modern/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/modern/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +70 -57
- package/modern/ChartsYAxis/ChartsYAxis.js +12 -16
- package/modern/Gauge/Gauge.js +4 -3
- package/modern/Gauge/GaugeContainer.js +7 -5
- package/modern/LineChart/LineChart.d.ts +1 -1
- package/modern/LineChart/LineChart.js +14 -30
- package/modern/LineChart/useLineChartProps.js +2 -17
- package/modern/PieChart/PieArcLabelPlot.js +1 -1
- package/modern/PieChart/PieArcPlot.js +1 -1
- package/modern/PieChart/PieChart.d.ts +1 -1
- package/modern/PieChart/PieChart.js +6 -4
- package/modern/ScatterChart/ScatterChart.d.ts +1 -1
- package/modern/ScatterChart/ScatterChart.js +14 -30
- package/modern/ScatterChart/useScatterChartProps.js +2 -17
- package/modern/SparkLineChart/SparkLineChart.d.ts +4 -8
- package/modern/SparkLineChart/SparkLineChart.js +23 -21
- package/modern/constants/index.d.ts +8 -1
- package/modern/constants/index.js +12 -5
- package/modern/context/AnimationProvider/useSkipAnimation.js +1 -1
- package/modern/context/ChartProvider/ChartProvider.types.d.ts +6 -6
- package/modern/context/PolarProvider/Polar.types.d.ts +3 -2
- package/modern/hooks/useAxis.d.ts +2 -2
- package/modern/hooks/useAxis.js +1 -1
- package/modern/hooks/useSvgRef.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/defaultizeColor.d.ts +23 -23
- package/modern/internals/defaultizeMargin.d.ts +3 -0
- package/modern/internals/defaultizeMargin.js +15 -0
- package/modern/internals/domUtils.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +1 -1
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +52 -31
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +549 -105
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +19 -18
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +7 -16
- package/modern/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +2 -2
- package/modern/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +2 -3
- package/modern/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -3
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +7 -2
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +13 -15
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +37 -35
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +3 -36
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +37 -9
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +216 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +6 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +15 -14
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +15 -13
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +70 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +4 -0
- package/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts → modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts} +1815 -911
- package/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js → modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js} +4 -6
- package/modern/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +86 -130
- package/modern/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +188 -71
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +9 -4
- package/modern/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +2 -2
- package/modern/internals/plugins/models/plugin.d.ts +1 -1
- package/modern/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/modern/internals/plugins/utils/ChartStore.d.ts +7 -7
- package/modern/internals/plugins/utils/selectors.d.ts +1 -0
- package/modern/internals/store/useCharts.js +0 -8
- package/modern/internals/store/useSelector.d.ts +1 -1
- package/modern/internals/store/useSelector.js +4 -1
- package/modern/internals/store/useStore.js +1 -1
- package/modern/models/axis.d.ts +56 -10
- package/modern/models/colorMapping.d.ts +1 -1
- package/modern/models/index.d.ts +0 -1
- package/modern/models/index.js +0 -1
- package/modern/models/seriesType/bar.d.ts +1 -1
- package/modern/models/seriesType/config.d.ts +1 -1
- package/modern/models/seriesType/line.d.ts +1 -1
- package/modern/models/seriesType/pie.d.ts +1 -1
- package/modern/models/seriesType/scatter.d.ts +1 -1
- package/modern/models/z-axis.d.ts +1 -1
- package/package.json +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/internals/calculateMargins.d.ts +0 -7
- package/esm/internals/calculateMargins.js +0 -25
- package/esm/models/layout.d.ts +0 -18
- package/esm/models/layout.js +0 -1
- package/internals/calculateMargins.d.ts +0 -7
- package/internals/calculateMargins.js +0 -33
- package/models/layout.d.ts +0 -18
- package/models/layout.js +0 -5
- package/modern/internals/calculateMargins.d.ts +0 -7
- package/modern/internals/calculateMargins.js +0 -25
- package/modern/models/layout.d.ts +0 -18
- package/modern/models/layout.js +0 -1
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import { ChartsXAxis } from "../ChartsXAxis/index.js";
|
|
7
6
|
import { ChartsYAxis } from "../ChartsYAxis/index.js";
|
|
8
7
|
import { useXAxes, useYAxes } from "../hooks/index.js";
|
|
9
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const getAxisId = (propsValue, defaultAxisId) => {
|
|
11
|
-
if (propsValue == null) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
if (typeof propsValue === 'object') {
|
|
15
|
-
return propsValue.axisId ?? defaultAxisId ?? null;
|
|
16
|
-
}
|
|
17
|
-
return propsValue;
|
|
18
|
-
};
|
|
19
|
-
const mergeProps = (axisConfig, slots, slotProps) => {
|
|
20
|
-
return typeof axisConfig === 'object' ? _extends({}, axisConfig, {
|
|
21
|
-
slots: _extends({}, slots, axisConfig?.slots),
|
|
22
|
-
slotProps: _extends({}, slotProps, axisConfig?.slotProps)
|
|
23
|
-
}) : {
|
|
24
|
-
slots,
|
|
25
|
-
slotProps
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
9
|
/**
|
|
30
10
|
* Demos:
|
|
31
11
|
*
|
|
@@ -37,55 +17,37 @@ const mergeProps = (axisConfig, slots, slotProps) => {
|
|
|
37
17
|
*/
|
|
38
18
|
function ChartsAxis(props) {
|
|
39
19
|
const {
|
|
40
|
-
topAxis,
|
|
41
|
-
leftAxis,
|
|
42
|
-
rightAxis,
|
|
43
|
-
bottomAxis,
|
|
44
20
|
slots,
|
|
45
21
|
slotProps
|
|
46
22
|
} = props;
|
|
47
23
|
const {
|
|
48
|
-
|
|
49
|
-
|
|
24
|
+
xAxisIds,
|
|
25
|
+
xAxis
|
|
50
26
|
} = useXAxes();
|
|
51
27
|
const {
|
|
52
|
-
|
|
53
|
-
|
|
28
|
+
yAxisIds,
|
|
29
|
+
yAxis
|
|
54
30
|
} = useYAxes();
|
|
55
|
-
const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis, yAxisIds[0]);
|
|
56
|
-
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis, xAxisIds[0]);
|
|
57
|
-
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
58
|
-
const rightId = getAxisId(rightAxis, yAxisIds[0]);
|
|
59
|
-
if (topId !== null && !xAxis[topId]) {
|
|
60
|
-
throw new Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
61
|
-
}
|
|
62
|
-
if (leftId !== null && !yAxis[leftId]) {
|
|
63
|
-
throw new Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
64
|
-
}
|
|
65
|
-
if (rightId !== null && !yAxis[rightId]) {
|
|
66
|
-
throw new Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
67
|
-
}
|
|
68
|
-
if (bottomId !== null && !xAxis[bottomId]) {
|
|
69
|
-
throw new Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
70
|
-
}
|
|
71
|
-
const topAxisProps = mergeProps(topAxis, slots, slotProps);
|
|
72
|
-
const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
|
|
73
|
-
const leftAxisProps = mergeProps(leftAxis, slots, slotProps);
|
|
74
|
-
const rightAxisProps = mergeProps(rightAxis, slots, slotProps);
|
|
75
31
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
76
|
-
children: [
|
|
77
|
-
position
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
axisId
|
|
85
|
-
})
|
|
86
|
-
position
|
|
87
|
-
|
|
88
|
-
|
|
32
|
+
children: [xAxisIds.map(axisId => {
|
|
33
|
+
if (!xAxis[axisId].position || xAxis[axisId].position === 'none') {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_jsx(ChartsXAxis, {
|
|
37
|
+
slots: slots,
|
|
38
|
+
slotProps: slotProps,
|
|
39
|
+
axisId: axisId
|
|
40
|
+
}, axisId);
|
|
41
|
+
}), yAxisIds.map(axisId => {
|
|
42
|
+
if (!yAxis[axisId].position || yAxis[axisId].position === 'none') {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/_jsx(ChartsYAxis, {
|
|
46
|
+
slots: slots,
|
|
47
|
+
slotProps: slotProps,
|
|
48
|
+
axisId: axisId
|
|
49
|
+
}, axisId);
|
|
50
|
+
})]
|
|
89
51
|
});
|
|
90
52
|
}
|
|
91
53
|
process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
@@ -93,24 +55,6 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
93
55
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
94
56
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
95
57
|
// ----------------------------------------------------------------------
|
|
96
|
-
/**
|
|
97
|
-
* Indicate which axis to display the bottom of the charts.
|
|
98
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
99
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
100
|
-
*/
|
|
101
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
102
|
-
/**
|
|
103
|
-
* Indicate which axis to display the left of the charts.
|
|
104
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
105
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
106
|
-
*/
|
|
107
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
108
|
-
/**
|
|
109
|
-
* Indicate which axis to display the right of the charts.
|
|
110
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
111
|
-
* @default null
|
|
112
|
-
*/
|
|
113
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
114
58
|
/**
|
|
115
59
|
* The props used for each component slot.
|
|
116
60
|
* @default {}
|
|
@@ -120,12 +64,6 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
120
64
|
* Overridable component slots.
|
|
121
65
|
* @default {}
|
|
122
66
|
*/
|
|
123
|
-
slots: PropTypes.object
|
|
124
|
-
/**
|
|
125
|
-
* Indicate which axis to display the top of the charts.
|
|
126
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
127
|
-
* @default null
|
|
128
|
-
*/
|
|
129
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string])
|
|
67
|
+
slots: PropTypes.object
|
|
130
68
|
} : void 0;
|
|
131
69
|
export { ChartsAxis };
|
|
@@ -7,7 +7,11 @@ export interface ChartsAxisClasses {
|
|
|
7
7
|
tickContainer: string;
|
|
8
8
|
/** Styles applied to ticks. */
|
|
9
9
|
tick: string;
|
|
10
|
-
/** Styles applied to ticks label.
|
|
10
|
+
/** Styles applied to ticks label.
|
|
11
|
+
*
|
|
12
|
+
* ⚠️ For performance reasons, only the inline styles get considered for bounding box computation.
|
|
13
|
+
* Modifying text size by adding properties like `font-size` or `letter-spacing` to this class might cause labels to overlap.
|
|
14
|
+
*/
|
|
11
15
|
tickLabel: string;
|
|
12
16
|
/** Styles applied to the group containing the axis label. */
|
|
13
17
|
label: string;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
3
|
import { ChartsLabelMarkClasses } from "./labelMarkClasses.js";
|
|
4
|
+
export interface ChartsLabelCustomMarkProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Color of the series this mark refers to. */
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
4
9
|
export interface ChartsLabelMarkProps {
|
|
5
10
|
/**
|
|
6
11
|
* The type of the mark.
|
|
7
12
|
* @default 'square'
|
|
8
13
|
*/
|
|
9
|
-
type?: 'square' | 'circle' | 'line'
|
|
14
|
+
type?: 'square' | 'circle' | 'line' | React.ComponentType<ChartsLabelCustomMarkProps>;
|
|
10
15
|
/**
|
|
11
16
|
* The color of the mark.
|
|
12
17
|
*/
|
|
@@ -20,8 +20,11 @@ const Root = styled('div', {
|
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
justifyContent: 'center',
|
|
22
22
|
flexShrink: 0,
|
|
23
|
+
width: 14,
|
|
24
|
+
height: 14,
|
|
23
25
|
[`&.${labelMarkClasses.line}`]: {
|
|
24
26
|
width: 16,
|
|
27
|
+
height: 'unset',
|
|
25
28
|
display: 'flex',
|
|
26
29
|
alignItems: 'center',
|
|
27
30
|
[`.${labelMarkClasses.mask}`]: {
|
|
@@ -44,7 +47,13 @@ const Root = styled('div', {
|
|
|
44
47
|
overflow: 'hidden'
|
|
45
48
|
},
|
|
46
49
|
svg: {
|
|
47
|
-
display: 'block'
|
|
50
|
+
display: 'block'
|
|
51
|
+
},
|
|
52
|
+
[`& .${labelMarkClasses.mask} > *`]: {
|
|
53
|
+
height: '100%',
|
|
54
|
+
width: '100%'
|
|
55
|
+
},
|
|
56
|
+
[`& .${labelMarkClasses.mask}`]: {
|
|
48
57
|
height: '100%',
|
|
49
58
|
width: '100%'
|
|
50
59
|
}
|
|
@@ -68,6 +77,7 @@ const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
|
|
|
68
77
|
classes
|
|
69
78
|
} = props,
|
|
70
79
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
80
|
+
const Component = type;
|
|
71
81
|
return /*#__PURE__*/_jsx(Root, _extends({
|
|
72
82
|
className: clsx(classes?.root, className),
|
|
73
83
|
ownerState: props,
|
|
@@ -76,7 +86,10 @@ const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
|
|
|
76
86
|
}, other, {
|
|
77
87
|
children: /*#__PURE__*/_jsx("div", {
|
|
78
88
|
className: classes?.mask,
|
|
79
|
-
children: /*#__PURE__*/_jsx(
|
|
89
|
+
children: typeof Component === 'function' ? /*#__PURE__*/_jsx(Component, {
|
|
90
|
+
className: classes?.fill,
|
|
91
|
+
color: color
|
|
92
|
+
}) : /*#__PURE__*/_jsx("svg", {
|
|
80
93
|
viewBox: "0 0 24 24",
|
|
81
94
|
preserveAspectRatio: type === 'line' ? 'none' : undefined,
|
|
82
95
|
children: /*#__PURE__*/_jsx("rect", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ChartsLabelMarkProps } from './ChartsLabelMark';
|
|
1
|
+
export type { ChartsLabelMarkProps, ChartsLabelCustomMarkProps } from './ChartsLabelMark';
|
|
2
2
|
export { labelClasses } from "./labelClasses.js";
|
|
3
3
|
export type { ChartsLabelClasses } from './labelClasses';
|
|
4
4
|
export { labelMarkClasses } from "./labelMarkClasses.js";
|
package/esm/ChartsLabel/index.js
CHANGED
|
@@ -13,4 +13,4 @@ export interface ChartsLabelGradientClasses {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function getLabelGradientUtilityClass(slot: string): string;
|
|
15
15
|
export declare const labelGradientClasses: ChartsLabelGradientClasses;
|
|
16
|
-
export declare const useUtilityClasses: (props: ChartsLabelGradientProps) => Record<"
|
|
16
|
+
export declare const useUtilityClasses: (props: ChartsLabelGradientProps) => Record<"root" | "mask" | "fill", string>;
|
|
@@ -15,4 +15,4 @@ export interface ChartsLabelMarkClasses {
|
|
|
15
15
|
}
|
|
16
16
|
export declare function getLabelMarkUtilityClass(slot: string): string;
|
|
17
17
|
export declare const labelMarkClasses: ChartsLabelMarkClasses;
|
|
18
|
-
export declare const useUtilityClasses: (props: ChartsLabelMarkProps) => Record<"
|
|
18
|
+
export declare const useUtilityClasses: (props: ChartsLabelMarkProps) => Record<"root" | "mask" | "fill", string>;
|
|
@@ -14,5 +14,5 @@ export interface ChartsLegendClasses {
|
|
|
14
14
|
/** Styles applied to the legend in row layout. */
|
|
15
15
|
horizontal: string;
|
|
16
16
|
}
|
|
17
|
-
export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"
|
|
17
|
+
export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "series", string>;
|
|
18
18
|
export declare const legendClasses: ChartsLegendClasses;
|
|
@@ -22,5 +22,5 @@ export interface ContinuousColorLegendClasses {
|
|
|
22
22
|
/** Styles applied to the series label. */
|
|
23
23
|
label: string;
|
|
24
24
|
}
|
|
25
|
-
export declare const useUtilityClasses: (props: ContinuousColorLegendProps & ChartsLegendSlotExtension) => Record<"
|
|
25
|
+
export declare const useUtilityClasses: (props: ContinuousColorLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "minLabel" | "maxLabel" | "gradient", string>;
|
|
26
26
|
export declare const continuousColorLegendClasses: ContinuousColorLegendClasses;
|
|
@@ -24,5 +24,5 @@ export interface PiecewiseColorLegendClasses {
|
|
|
24
24
|
/** Styles applied to the series label. */
|
|
25
25
|
label: string;
|
|
26
26
|
}
|
|
27
|
-
export declare const useUtilityClasses: (props: PiecewiseColorLegendProps & ChartsLegendSlotExtension) => Record<"
|
|
27
|
+
export declare const useUtilityClasses: (props: PiecewiseColorLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "item" | "minLabel" | "maxLabel", string>;
|
|
28
28
|
export declare const piecewiseColorLegendClasses: PiecewiseColorLegendClasses;
|
|
@@ -8,6 +8,6 @@ export type ChartsXReferenceLineProps<TValue extends string | number | Date = st
|
|
|
8
8
|
*/
|
|
9
9
|
x: TValue;
|
|
10
10
|
};
|
|
11
|
-
export declare function getXReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"
|
|
11
|
+
export declare function getXReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"root" | "line" | "label", string>;
|
|
12
12
|
declare function ChartsXReferenceLine(props: ChartsXReferenceLineProps): React.JSX.Element | null;
|
|
13
13
|
export { ChartsXReferenceLine };
|
|
@@ -8,6 +8,6 @@ export type ChartsYReferenceLineProps<TValue extends string | number | Date = st
|
|
|
8
8
|
*/
|
|
9
9
|
y: TValue;
|
|
10
10
|
};
|
|
11
|
-
export declare function getYReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"
|
|
11
|
+
export declare function getYReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"root" | "line" | "label", string>;
|
|
12
12
|
declare function ChartsYReferenceLine(props: ChartsYReferenceLineProps): React.JSX.Element | null;
|
|
13
13
|
export { ChartsYReferenceLine };
|
|
@@ -13,7 +13,7 @@ export const ChartsTooltipPaper = styled('div', {
|
|
|
13
13
|
}) => ({
|
|
14
14
|
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
15
15
|
color: (theme.vars || theme).palette.text.primary,
|
|
16
|
-
borderRadius: theme.shape
|
|
16
|
+
borderRadius: (theme.vars || theme).shape?.borderRadius,
|
|
17
17
|
border: `solid ${(theme.vars || theme).palette.divider} 1px`
|
|
18
18
|
}));
|
|
19
19
|
|
|
@@ -23,4 +23,4 @@ export interface ChartsTooltipClasses {
|
|
|
23
23
|
export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markCell' | 'labelCell' | 'valueCell'>;
|
|
24
24
|
export declare function getChartsTooltipUtilityClass(slot: string): string;
|
|
25
25
|
export declare const chartsTooltipClasses: ChartsTooltipClasses;
|
|
26
|
-
export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"
|
|
26
|
+
export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "markCell" | "labelCell" | "valueCell" | "paper" | "axisValueCell", string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["scale", "tickNumber", "reverse"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
@@ -36,61 +36,68 @@ const useUtilityClasses = ownerState => {
|
|
|
36
36
|
};
|
|
37
37
|
return composeClasses(slots, getAxisUtilityClass, classes);
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
/* Returns a set of indices of the tick labels that should be visible. */
|
|
41
|
+
function getVisibleLabels(xTicks, {
|
|
40
42
|
tickLabelStyle: style,
|
|
41
43
|
tickLabelInterval,
|
|
44
|
+
tickLabelMinGap,
|
|
42
45
|
reverse,
|
|
43
|
-
isMounted
|
|
46
|
+
isMounted,
|
|
47
|
+
isPointInside
|
|
44
48
|
}) {
|
|
45
|
-
const
|
|
49
|
+
const getTickLabelSize = tick => {
|
|
46
50
|
if (!isMounted || tick.formattedValue === undefined) {
|
|
47
|
-
return
|
|
51
|
+
return {
|
|
48
52
|
width: 0,
|
|
49
53
|
height: 0
|
|
50
|
-
}
|
|
54
|
+
};
|
|
51
55
|
}
|
|
52
56
|
const tickSizes = getWordsByLines({
|
|
53
57
|
style,
|
|
54
58
|
needsComputation: true,
|
|
55
59
|
text: tick.formattedValue
|
|
56
60
|
});
|
|
57
|
-
return
|
|
61
|
+
return {
|
|
58
62
|
width: Math.max(...tickSizes.map(size => size.width)),
|
|
59
63
|
height: Math.max(tickSizes.length * tickSizes[0].height)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
62
66
|
if (typeof tickLabelInterval === 'function') {
|
|
63
|
-
return
|
|
64
|
-
skipLabel: !tickLabelInterval(item.value, index)
|
|
65
|
-
}));
|
|
67
|
+
return new Set(xTicks.filter((item, index) => tickLabelInterval(item.value, index)));
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
// Filter label to avoid overlap
|
|
69
|
-
let currentTextLimit = 0;
|
|
70
71
|
let previousTextLimit = 0;
|
|
71
72
|
const direction = reverse ? -1 : 1;
|
|
72
|
-
return
|
|
73
|
+
return new Set(xTicks.filter((item, labelIndex) => {
|
|
73
74
|
const {
|
|
74
|
-
width,
|
|
75
75
|
offset,
|
|
76
|
-
labelOffset
|
|
77
|
-
height
|
|
76
|
+
labelOffset
|
|
78
77
|
} = item;
|
|
79
|
-
const distance = getMinXTranslation(width, height, style?.angle);
|
|
80
78
|
const textPosition = offset + labelOffset;
|
|
81
|
-
|
|
79
|
+
if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (!isPointInside(textPosition)) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
82
85
|
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
/* Measuring text width is expensive, so we need to delay it as much as possible to improve performance. */
|
|
87
|
+
const {
|
|
88
|
+
width,
|
|
89
|
+
height
|
|
90
|
+
} = getTickLabelSize(item);
|
|
91
|
+
const distance = getMinXTranslation(width, height, style?.angle);
|
|
92
|
+
const currentTextLimit = textPosition - direction * distance / 2;
|
|
93
|
+
if (labelIndex > 0 && direction * currentTextLimit < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
85
94
|
// Except for the first label, we skip all label that overlap with the last accepted.
|
|
86
95
|
// Notice that the early return prevents `previousTextLimit` from being updated.
|
|
87
|
-
return
|
|
88
|
-
skipLabel: true
|
|
89
|
-
});
|
|
96
|
+
return false;
|
|
90
97
|
}
|
|
91
|
-
previousTextLimit = textPosition + direction *
|
|
92
|
-
return
|
|
93
|
-
});
|
|
98
|
+
previousTextLimit = textPosition + direction * distance / 2;
|
|
99
|
+
return true;
|
|
100
|
+
}));
|
|
94
101
|
}
|
|
95
102
|
const XAxisRoot = styled(AxisRoot, {
|
|
96
103
|
name: 'MuiChartsXAxis',
|
|
@@ -98,10 +105,10 @@ const XAxisRoot = styled(AxisRoot, {
|
|
|
98
105
|
overridesResolver: (props, styles) => styles.root
|
|
99
106
|
})({});
|
|
100
107
|
const defaultProps = {
|
|
101
|
-
position: 'bottom',
|
|
102
108
|
disableLine: false,
|
|
103
109
|
disableTicks: false,
|
|
104
|
-
tickSize: 6
|
|
110
|
+
tickSize: 6,
|
|
111
|
+
tickLabelMinGap: 4
|
|
105
112
|
};
|
|
106
113
|
|
|
107
114
|
/**
|
|
@@ -146,12 +153,12 @@ function ChartsXAxis(inProps) {
|
|
|
146
153
|
tickLabelInterval,
|
|
147
154
|
tickPlacement,
|
|
148
155
|
tickLabelPlacement,
|
|
149
|
-
|
|
156
|
+
tickLabelMinGap,
|
|
157
|
+
sx,
|
|
158
|
+
offset
|
|
150
159
|
} = defaultizedProps;
|
|
151
160
|
const theme = useTheme();
|
|
152
|
-
const classes = useUtilityClasses(
|
|
153
|
-
theme
|
|
154
|
-
}));
|
|
161
|
+
const classes = useUtilityClasses(defaultizedProps);
|
|
155
162
|
const {
|
|
156
163
|
left,
|
|
157
164
|
top,
|
|
@@ -171,7 +178,7 @@ function ChartsXAxis(inProps) {
|
|
|
171
178
|
elementType: TickLabel,
|
|
172
179
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
173
180
|
additionalProps: {
|
|
174
|
-
style: _extends({
|
|
181
|
+
style: _extends({}, theme.typography.caption, {
|
|
175
182
|
fontSize: 12,
|
|
176
183
|
textAnchor: 'middle',
|
|
177
184
|
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
|
|
@@ -188,11 +195,18 @@ function ChartsXAxis(inProps) {
|
|
|
188
195
|
tickPlacement,
|
|
189
196
|
tickLabelPlacement
|
|
190
197
|
});
|
|
191
|
-
const
|
|
198
|
+
const visibleLabels = getVisibleLabels(xTicks, {
|
|
192
199
|
tickLabelStyle: axisTickLabelProps.style,
|
|
193
200
|
tickLabelInterval,
|
|
201
|
+
tickLabelMinGap,
|
|
194
202
|
reverse,
|
|
195
|
-
isMounted
|
|
203
|
+
isMounted,
|
|
204
|
+
isPointInside: x => instance.isPointInside({
|
|
205
|
+
x,
|
|
206
|
+
y: -1
|
|
207
|
+
}, {
|
|
208
|
+
direction: 'x'
|
|
209
|
+
})
|
|
196
210
|
});
|
|
197
211
|
const labelRefPoint = {
|
|
198
212
|
x: left + width / 2,
|
|
@@ -215,44 +229,40 @@ function ChartsXAxis(inProps) {
|
|
|
215
229
|
// Skip axis rendering if no data is available
|
|
216
230
|
// - The domain is an empty array for band/point scales.
|
|
217
231
|
// - The domains contains Infinity for continuous scales.
|
|
218
|
-
|
|
232
|
+
// - The position is set to 'none'.
|
|
233
|
+
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity) || position === 'none') {
|
|
219
234
|
return null;
|
|
220
235
|
}
|
|
221
236
|
return /*#__PURE__*/_jsxs(XAxisRoot, {
|
|
222
|
-
transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
|
|
237
|
+
transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
|
|
223
238
|
className: classes.root,
|
|
224
239
|
sx: sx,
|
|
225
240
|
children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
|
|
226
241
|
x1: left,
|
|
227
242
|
x2: left + width,
|
|
228
243
|
className: classes.line
|
|
229
|
-
}, slotProps?.axisLine)),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
244
|
+
}, slotProps?.axisLine)), xTicks.map((item, index) => {
|
|
245
|
+
const {
|
|
246
|
+
formattedValue,
|
|
247
|
+
offset: tickOffset,
|
|
248
|
+
labelOffset
|
|
249
|
+
} = item;
|
|
235
250
|
const xTickLabel = labelOffset ?? 0;
|
|
236
251
|
const yTickLabel = positionSign * (tickSize + 3);
|
|
237
252
|
const showTick = instance.isPointInside({
|
|
238
|
-
x:
|
|
239
|
-
y: -1
|
|
240
|
-
}, {
|
|
241
|
-
direction: 'x'
|
|
242
|
-
});
|
|
243
|
-
const showTickLabel = instance.isPointInside({
|
|
244
|
-
x: offset + xTickLabel,
|
|
253
|
+
x: tickOffset,
|
|
245
254
|
y: -1
|
|
246
255
|
}, {
|
|
247
256
|
direction: 'x'
|
|
248
257
|
});
|
|
258
|
+
const showTickLabel = visibleLabels.has(item);
|
|
249
259
|
return /*#__PURE__*/_jsxs("g", {
|
|
250
|
-
transform: `translate(${
|
|
260
|
+
transform: `translate(${tickOffset}, 0)`,
|
|
251
261
|
className: classes.tickContainer,
|
|
252
262
|
children: [!disableTicks && showTick && /*#__PURE__*/_jsx(Tick, _extends({
|
|
253
263
|
y2: positionSign * tickSize,
|
|
254
264
|
className: classes.tick
|
|
255
|
-
}, slotProps?.axisTick)), formattedValue !== undefined &&
|
|
265
|
+
}, slotProps?.axisTick)), formattedValue !== undefined && showTickLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
256
266
|
x: xTickLabel,
|
|
257
267
|
y: yTickLabel
|
|
258
268
|
}, axisTickLabelProps, {
|
|
@@ -272,6 +282,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
272
282
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
273
283
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
274
284
|
// ----------------------------------------------------------------------
|
|
285
|
+
axis: PropTypes.oneOf(['x']),
|
|
275
286
|
/**
|
|
276
287
|
* The id of the axis to render.
|
|
277
288
|
* If undefined, it will be the first defined axis.
|
|
@@ -304,10 +315,6 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
304
315
|
* The style applied to the axis label.
|
|
305
316
|
*/
|
|
306
317
|
labelStyle: PropTypes.object,
|
|
307
|
-
/**
|
|
308
|
-
* Position of the axis.
|
|
309
|
-
*/
|
|
310
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
311
318
|
/**
|
|
312
319
|
* The props used for each component slot.
|
|
313
320
|
* @default {}
|
|
@@ -341,6 +348,12 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
341
348
|
* @default 'auto'
|
|
342
349
|
*/
|
|
343
350
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
351
|
+
/**
|
|
352
|
+
* The minimum gap in pixels between two tick labels.
|
|
353
|
+
* If two tick labels are closer than this minimum gap, one of them will be hidden.
|
|
354
|
+
* @default 4
|
|
355
|
+
*/
|
|
356
|
+
tickLabelMinGap: PropTypes.number,
|
|
344
357
|
/**
|
|
345
358
|
* The placement of ticks label. Can be the middle of the band, or the tick position.
|
|
346
359
|
* Only used if scale is 'band'.
|