@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,30 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ChartsAxisSlotProps, ChartsAxisSlots
|
|
2
|
+
import { ChartsAxisSlotProps, ChartsAxisSlots } from "../models/axis.js";
|
|
3
3
|
export interface ChartsAxisProps {
|
|
4
|
-
/**
|
|
5
|
-
* Indicate which axis to display the top of the charts.
|
|
6
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
7
|
-
* @default null
|
|
8
|
-
*/
|
|
9
|
-
topAxis?: null | string | ChartsXAxisProps;
|
|
10
|
-
/**
|
|
11
|
-
* Indicate which axis to display the bottom of the charts.
|
|
12
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
13
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
14
|
-
*/
|
|
15
|
-
bottomAxis?: null | string | ChartsXAxisProps;
|
|
16
|
-
/**
|
|
17
|
-
* Indicate which axis to display the left of the charts.
|
|
18
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
19
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
20
|
-
*/
|
|
21
|
-
leftAxis?: null | string | ChartsYAxisProps;
|
|
22
|
-
/**
|
|
23
|
-
* Indicate which axis to display the right of the charts.
|
|
24
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
25
|
-
* @default null
|
|
26
|
-
*/
|
|
27
|
-
rightAxis?: null | string | ChartsYAxisProps;
|
|
28
4
|
/**
|
|
29
5
|
* Overridable component slots.
|
|
30
6
|
* @default {}
|
package/ChartsAxis/ChartsAxis.js
CHANGED
|
@@ -1,38 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ChartsAxis = ChartsAxis;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var React = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
12
|
var _ChartsXAxis = require("../ChartsXAxis");
|
|
14
13
|
var _ChartsYAxis = require("../ChartsYAxis");
|
|
15
14
|
var _hooks = require("../hooks");
|
|
16
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const getAxisId = (propsValue, defaultAxisId) => {
|
|
18
|
-
if (propsValue == null) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
if (typeof propsValue === 'object') {
|
|
22
|
-
return propsValue.axisId ?? defaultAxisId ?? null;
|
|
23
|
-
}
|
|
24
|
-
return propsValue;
|
|
25
|
-
};
|
|
26
|
-
const mergeProps = (axisConfig, slots, slotProps) => {
|
|
27
|
-
return typeof axisConfig === 'object' ? (0, _extends2.default)({}, axisConfig, {
|
|
28
|
-
slots: (0, _extends2.default)({}, slots, axisConfig?.slots),
|
|
29
|
-
slotProps: (0, _extends2.default)({}, slotProps, axisConfig?.slotProps)
|
|
30
|
-
}) : {
|
|
31
|
-
slots,
|
|
32
|
-
slotProps
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
16
|
/**
|
|
37
17
|
* Demos:
|
|
38
18
|
*
|
|
@@ -44,55 +24,37 @@ const mergeProps = (axisConfig, slots, slotProps) => {
|
|
|
44
24
|
*/
|
|
45
25
|
function ChartsAxis(props) {
|
|
46
26
|
const {
|
|
47
|
-
topAxis,
|
|
48
|
-
leftAxis,
|
|
49
|
-
rightAxis,
|
|
50
|
-
bottomAxis,
|
|
51
27
|
slots,
|
|
52
28
|
slotProps
|
|
53
29
|
} = props;
|
|
54
30
|
const {
|
|
55
|
-
|
|
56
|
-
|
|
31
|
+
xAxisIds,
|
|
32
|
+
xAxis
|
|
57
33
|
} = (0, _hooks.useXAxes)();
|
|
58
34
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
yAxisIds,
|
|
36
|
+
yAxis
|
|
61
37
|
} = (0, _hooks.useYAxes)();
|
|
62
|
-
const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis, yAxisIds[0]);
|
|
63
|
-
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis, xAxisIds[0]);
|
|
64
|
-
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
65
|
-
const rightId = getAxisId(rightAxis, yAxisIds[0]);
|
|
66
|
-
if (topId !== null && !xAxis[topId]) {
|
|
67
|
-
throw new Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
68
|
-
}
|
|
69
|
-
if (leftId !== null && !yAxis[leftId]) {
|
|
70
|
-
throw new Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
71
|
-
}
|
|
72
|
-
if (rightId !== null && !yAxis[rightId]) {
|
|
73
|
-
throw new Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
74
|
-
}
|
|
75
|
-
if (bottomId !== null && !xAxis[bottomId]) {
|
|
76
|
-
throw new Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
77
|
-
}
|
|
78
|
-
const topAxisProps = mergeProps(topAxis, slots, slotProps);
|
|
79
|
-
const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
|
|
80
|
-
const leftAxisProps = mergeProps(leftAxis, slots, slotProps);
|
|
81
|
-
const rightAxisProps = mergeProps(rightAxis, slots, slotProps);
|
|
82
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
83
|
-
children: [
|
|
84
|
-
position
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
axisId
|
|
92
|
-
})
|
|
93
|
-
position
|
|
94
|
-
|
|
95
|
-
|
|
39
|
+
children: [xAxisIds.map(axisId => {
|
|
40
|
+
if (!xAxis[axisId].position || xAxis[axisId].position === 'none') {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsXAxis.ChartsXAxis, {
|
|
44
|
+
slots: slots,
|
|
45
|
+
slotProps: slotProps,
|
|
46
|
+
axisId: axisId
|
|
47
|
+
}, axisId);
|
|
48
|
+
}), yAxisIds.map(axisId => {
|
|
49
|
+
if (!yAxis[axisId].position || yAxis[axisId].position === 'none') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsYAxis.ChartsYAxis, {
|
|
53
|
+
slots: slots,
|
|
54
|
+
slotProps: slotProps,
|
|
55
|
+
axisId: axisId
|
|
56
|
+
}, axisId);
|
|
57
|
+
})]
|
|
96
58
|
});
|
|
97
59
|
}
|
|
98
60
|
process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
@@ -100,24 +62,6 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
100
62
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
101
63
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
102
64
|
// ----------------------------------------------------------------------
|
|
103
|
-
/**
|
|
104
|
-
* Indicate which axis to display the bottom of the charts.
|
|
105
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
106
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
107
|
-
*/
|
|
108
|
-
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
109
|
-
/**
|
|
110
|
-
* Indicate which axis to display the left of the charts.
|
|
111
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
112
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
113
|
-
*/
|
|
114
|
-
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
115
|
-
/**
|
|
116
|
-
* Indicate which axis to display the right of the charts.
|
|
117
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
118
|
-
* @default null
|
|
119
|
-
*/
|
|
120
|
-
rightAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
121
65
|
/**
|
|
122
66
|
* The props used for each component slot.
|
|
123
67
|
* @default {}
|
|
@@ -127,11 +71,5 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
127
71
|
* Overridable component slots.
|
|
128
72
|
* @default {}
|
|
129
73
|
*/
|
|
130
|
-
slots: _propTypes.default.object
|
|
131
|
-
/**
|
|
132
|
-
* Indicate which axis to display the top of the charts.
|
|
133
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
134
|
-
* @default null
|
|
135
|
-
*/
|
|
136
|
-
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string])
|
|
74
|
+
slots: _propTypes.default.object
|
|
137
75
|
} : void 0;
|
|
@@ -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
|
*/
|
|
@@ -27,8 +27,11 @@ const Root = (0, _styles.styled)('div', {
|
|
|
27
27
|
alignItems: 'center',
|
|
28
28
|
justifyContent: 'center',
|
|
29
29
|
flexShrink: 0,
|
|
30
|
+
width: 14,
|
|
31
|
+
height: 14,
|
|
30
32
|
[`&.${_labelMarkClasses.labelMarkClasses.line}`]: {
|
|
31
33
|
width: 16,
|
|
34
|
+
height: 'unset',
|
|
32
35
|
display: 'flex',
|
|
33
36
|
alignItems: 'center',
|
|
34
37
|
[`.${_labelMarkClasses.labelMarkClasses.mask}`]: {
|
|
@@ -51,7 +54,13 @@ const Root = (0, _styles.styled)('div', {
|
|
|
51
54
|
overflow: 'hidden'
|
|
52
55
|
},
|
|
53
56
|
svg: {
|
|
54
|
-
display: 'block'
|
|
57
|
+
display: 'block'
|
|
58
|
+
},
|
|
59
|
+
[`& .${_labelMarkClasses.labelMarkClasses.mask} > *`]: {
|
|
60
|
+
height: '100%',
|
|
61
|
+
width: '100%'
|
|
62
|
+
},
|
|
63
|
+
[`& .${_labelMarkClasses.labelMarkClasses.mask}`]: {
|
|
55
64
|
height: '100%',
|
|
56
65
|
width: '100%'
|
|
57
66
|
}
|
|
@@ -75,6 +84,7 @@ const ChartsLabelMark = exports.ChartsLabelMark = (0, _consumeThemeProps.consume
|
|
|
75
84
|
classes
|
|
76
85
|
} = props,
|
|
77
86
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
87
|
+
const Component = type;
|
|
78
88
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({
|
|
79
89
|
className: (0, _clsx.default)(classes?.root, className),
|
|
80
90
|
ownerState: props,
|
|
@@ -83,7 +93,10 @@ const ChartsLabelMark = exports.ChartsLabelMark = (0, _consumeThemeProps.consume
|
|
|
83
93
|
}, other, {
|
|
84
94
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
85
95
|
className: classes?.mask,
|
|
86
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
96
|
+
children: typeof Component === 'function' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
97
|
+
className: classes?.fill,
|
|
98
|
+
color: color
|
|
99
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
87
100
|
viewBox: "0 0 24 24",
|
|
88
101
|
preserveAspectRatio: type === 'line' ? 'none' : undefined,
|
|
89
102
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
package/ChartsLabel/index.d.ts
CHANGED
|
@@ -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";
|
|
@@ -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 };
|
|
@@ -18,7 +18,7 @@ const ChartsTooltipPaper = exports.ChartsTooltipPaper = (0, _styles.styled)('div
|
|
|
18
18
|
}) => ({
|
|
19
19
|
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
20
20
|
color: (theme.vars || theme).palette.text.primary,
|
|
21
|
-
borderRadius: theme.shape
|
|
21
|
+
borderRadius: (theme.vars || theme).shape?.borderRadius,
|
|
22
22
|
border: `solid ${(theme.vars || theme).palette.divider} 1px`
|
|
23
23
|
}));
|
|
24
24
|
|
|
@@ -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>;
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ChartsXAxis = ChartsXAxis;
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
@@ -43,61 +43,68 @@ const useUtilityClasses = ownerState => {
|
|
|
43
43
|
};
|
|
44
44
|
return (0, _composeClasses.default)(slots, _axisClasses.getAxisUtilityClass, classes);
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
/* Returns a set of indices of the tick labels that should be visible. */
|
|
48
|
+
function getVisibleLabels(xTicks, {
|
|
47
49
|
tickLabelStyle: style,
|
|
48
50
|
tickLabelInterval,
|
|
51
|
+
tickLabelMinGap,
|
|
49
52
|
reverse,
|
|
50
|
-
isMounted
|
|
53
|
+
isMounted,
|
|
54
|
+
isPointInside
|
|
51
55
|
}) {
|
|
52
|
-
const
|
|
56
|
+
const getTickLabelSize = tick => {
|
|
53
57
|
if (!isMounted || tick.formattedValue === undefined) {
|
|
54
|
-
return
|
|
58
|
+
return {
|
|
55
59
|
width: 0,
|
|
56
60
|
height: 0
|
|
57
|
-
}
|
|
61
|
+
};
|
|
58
62
|
}
|
|
59
63
|
const tickSizes = (0, _getWordsByLines.getWordsByLines)({
|
|
60
64
|
style,
|
|
61
65
|
needsComputation: true,
|
|
62
66
|
text: tick.formattedValue
|
|
63
67
|
});
|
|
64
|
-
return
|
|
68
|
+
return {
|
|
65
69
|
width: Math.max(...tickSizes.map(size => size.width)),
|
|
66
70
|
height: Math.max(tickSizes.length * tickSizes[0].height)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
69
73
|
if (typeof tickLabelInterval === 'function') {
|
|
70
|
-
return
|
|
71
|
-
skipLabel: !tickLabelInterval(item.value, index)
|
|
72
|
-
}));
|
|
74
|
+
return new Set(xTicks.filter((item, index) => tickLabelInterval(item.value, index)));
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
// Filter label to avoid overlap
|
|
76
|
-
let currentTextLimit = 0;
|
|
77
78
|
let previousTextLimit = 0;
|
|
78
79
|
const direction = reverse ? -1 : 1;
|
|
79
|
-
return
|
|
80
|
+
return new Set(xTicks.filter((item, labelIndex) => {
|
|
80
81
|
const {
|
|
81
|
-
width,
|
|
82
82
|
offset,
|
|
83
|
-
labelOffset
|
|
84
|
-
height
|
|
83
|
+
labelOffset
|
|
85
84
|
} = item;
|
|
86
|
-
const distance = (0, _geometry.getMinXTranslation)(width, height, style?.angle);
|
|
87
85
|
const textPosition = offset + labelOffset;
|
|
88
|
-
|
|
86
|
+
if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (!isPointInside(textPosition)) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
/* Measuring text width is expensive, so we need to delay it as much as possible to improve performance. */
|
|
94
|
+
const {
|
|
95
|
+
width,
|
|
96
|
+
height
|
|
97
|
+
} = getTickLabelSize(item);
|
|
98
|
+
const distance = (0, _geometry.getMinXTranslation)(width, height, style?.angle);
|
|
99
|
+
const currentTextLimit = textPosition - direction * distance / 2;
|
|
100
|
+
if (labelIndex > 0 && direction * currentTextLimit < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
92
101
|
// Except for the first label, we skip all label that overlap with the last accepted.
|
|
93
102
|
// Notice that the early return prevents `previousTextLimit` from being updated.
|
|
94
|
-
return
|
|
95
|
-
skipLabel: true
|
|
96
|
-
});
|
|
103
|
+
return false;
|
|
97
104
|
}
|
|
98
|
-
previousTextLimit = textPosition + direction *
|
|
99
|
-
return
|
|
100
|
-
});
|
|
105
|
+
previousTextLimit = textPosition + direction * distance / 2;
|
|
106
|
+
return true;
|
|
107
|
+
}));
|
|
101
108
|
}
|
|
102
109
|
const XAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
|
|
103
110
|
name: 'MuiChartsXAxis',
|
|
@@ -105,10 +112,10 @@ const XAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
|
|
|
105
112
|
overridesResolver: (props, styles) => styles.root
|
|
106
113
|
})({});
|
|
107
114
|
const defaultProps = {
|
|
108
|
-
position: 'bottom',
|
|
109
115
|
disableLine: false,
|
|
110
116
|
disableTicks: false,
|
|
111
|
-
tickSize: 6
|
|
117
|
+
tickSize: 6,
|
|
118
|
+
tickLabelMinGap: 4
|
|
112
119
|
};
|
|
113
120
|
|
|
114
121
|
/**
|
|
@@ -153,12 +160,12 @@ function ChartsXAxis(inProps) {
|
|
|
153
160
|
tickLabelInterval,
|
|
154
161
|
tickPlacement,
|
|
155
162
|
tickLabelPlacement,
|
|
156
|
-
|
|
163
|
+
tickLabelMinGap,
|
|
164
|
+
sx,
|
|
165
|
+
offset
|
|
157
166
|
} = defaultizedProps;
|
|
158
167
|
const theme = (0, _styles.useTheme)();
|
|
159
|
-
const classes = useUtilityClasses(
|
|
160
|
-
theme
|
|
161
|
-
}));
|
|
168
|
+
const classes = useUtilityClasses(defaultizedProps);
|
|
162
169
|
const {
|
|
163
170
|
left,
|
|
164
171
|
top,
|
|
@@ -178,7 +185,7 @@ function ChartsXAxis(inProps) {
|
|
|
178
185
|
elementType: TickLabel,
|
|
179
186
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
180
187
|
additionalProps: {
|
|
181
|
-
style: (0, _extends2.default)({
|
|
188
|
+
style: (0, _extends2.default)({}, theme.typography.caption, {
|
|
182
189
|
fontSize: 12,
|
|
183
190
|
textAnchor: 'middle',
|
|
184
191
|
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
|
|
@@ -195,11 +202,18 @@ function ChartsXAxis(inProps) {
|
|
|
195
202
|
tickPlacement,
|
|
196
203
|
tickLabelPlacement
|
|
197
204
|
});
|
|
198
|
-
const
|
|
205
|
+
const visibleLabels = getVisibleLabels(xTicks, {
|
|
199
206
|
tickLabelStyle: axisTickLabelProps.style,
|
|
200
207
|
tickLabelInterval,
|
|
208
|
+
tickLabelMinGap,
|
|
201
209
|
reverse,
|
|
202
|
-
isMounted
|
|
210
|
+
isMounted,
|
|
211
|
+
isPointInside: x => instance.isPointInside({
|
|
212
|
+
x,
|
|
213
|
+
y: -1
|
|
214
|
+
}, {
|
|
215
|
+
direction: 'x'
|
|
216
|
+
})
|
|
203
217
|
});
|
|
204
218
|
const labelRefPoint = {
|
|
205
219
|
x: left + width / 2,
|
|
@@ -222,44 +236,40 @@ function ChartsXAxis(inProps) {
|
|
|
222
236
|
// Skip axis rendering if no data is available
|
|
223
237
|
// - The domain is an empty array for band/point scales.
|
|
224
238
|
// - The domains contains Infinity for continuous scales.
|
|
225
|
-
|
|
239
|
+
// - The position is set to 'none'.
|
|
240
|
+
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity) || position === 'none') {
|
|
226
241
|
return null;
|
|
227
242
|
}
|
|
228
243
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(XAxisRoot, {
|
|
229
|
-
transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
|
|
244
|
+
transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
|
|
230
245
|
className: classes.root,
|
|
231
246
|
sx: sx,
|
|
232
247
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
233
248
|
x1: left,
|
|
234
249
|
x2: left + width,
|
|
235
250
|
className: classes.line
|
|
236
|
-
}, slotProps?.axisLine)),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
251
|
+
}, slotProps?.axisLine)), xTicks.map((item, index) => {
|
|
252
|
+
const {
|
|
253
|
+
formattedValue,
|
|
254
|
+
offset: tickOffset,
|
|
255
|
+
labelOffset
|
|
256
|
+
} = item;
|
|
242
257
|
const xTickLabel = labelOffset ?? 0;
|
|
243
258
|
const yTickLabel = positionSign * (tickSize + 3);
|
|
244
259
|
const showTick = instance.isPointInside({
|
|
245
|
-
x:
|
|
246
|
-
y: -1
|
|
247
|
-
}, {
|
|
248
|
-
direction: 'x'
|
|
249
|
-
});
|
|
250
|
-
const showTickLabel = instance.isPointInside({
|
|
251
|
-
x: offset + xTickLabel,
|
|
260
|
+
x: tickOffset,
|
|
252
261
|
y: -1
|
|
253
262
|
}, {
|
|
254
263
|
direction: 'x'
|
|
255
264
|
});
|
|
265
|
+
const showTickLabel = visibleLabels.has(item);
|
|
256
266
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
257
|
-
transform: `translate(${
|
|
267
|
+
transform: `translate(${tickOffset}, 0)`,
|
|
258
268
|
className: classes.tickContainer,
|
|
259
269
|
children: [!disableTicks && showTick && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
|
|
260
270
|
y2: positionSign * tickSize,
|
|
261
271
|
className: classes.tick
|
|
262
|
-
}, slotProps?.axisTick)), formattedValue !== undefined &&
|
|
272
|
+
}, slotProps?.axisTick)), formattedValue !== undefined && showTickLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
263
273
|
x: xTickLabel,
|
|
264
274
|
y: yTickLabel
|
|
265
275
|
}, axisTickLabelProps, {
|
|
@@ -279,6 +289,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
279
289
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
280
290
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
281
291
|
// ----------------------------------------------------------------------
|
|
292
|
+
axis: _propTypes.default.oneOf(['x']),
|
|
282
293
|
/**
|
|
283
294
|
* The id of the axis to render.
|
|
284
295
|
* If undefined, it will be the first defined axis.
|
|
@@ -311,10 +322,6 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
311
322
|
* The style applied to the axis label.
|
|
312
323
|
*/
|
|
313
324
|
labelStyle: _propTypes.default.object,
|
|
314
|
-
/**
|
|
315
|
-
* Position of the axis.
|
|
316
|
-
*/
|
|
317
|
-
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
318
325
|
/**
|
|
319
326
|
* The props used for each component slot.
|
|
320
327
|
* @default {}
|
|
@@ -348,6 +355,12 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
348
355
|
* @default 'auto'
|
|
349
356
|
*/
|
|
350
357
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
358
|
+
/**
|
|
359
|
+
* The minimum gap in pixels between two tick labels.
|
|
360
|
+
* If two tick labels are closer than this minimum gap, one of them will be hidden.
|
|
361
|
+
* @default 4
|
|
362
|
+
*/
|
|
363
|
+
tickLabelMinGap: _propTypes.default.number,
|
|
351
364
|
/**
|
|
352
365
|
* The placement of ticks label. Can be the middle of the band, or the tick position.
|
|
353
366
|
* Only used if scale is 'band'.
|