@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
package/esm/models/axis.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-charts-vendor/d3-scale';
|
|
2
2
|
import { SxProps } from '@mui/system/styleFunctionSx';
|
|
3
|
+
import { MakeRequired } from '@mui/x-internals/types';
|
|
3
4
|
import { ChartsAxisClasses } from "../ChartsAxis/axisClasses.js";
|
|
4
5
|
import type { TickParams } from '../hooks/useTicks';
|
|
5
6
|
import { ChartsTextProps } from "../ChartsText/index.js";
|
|
@@ -104,17 +105,54 @@ export interface ChartsAxisProps extends TickParams {
|
|
|
104
105
|
sx?: SxProps;
|
|
105
106
|
}
|
|
106
107
|
export interface ChartsYAxisProps extends ChartsAxisProps {
|
|
108
|
+
axis?: 'y';
|
|
109
|
+
}
|
|
110
|
+
export interface ChartsXAxisProps extends ChartsAxisProps {
|
|
111
|
+
axis?: 'x';
|
|
107
112
|
/**
|
|
108
|
-
*
|
|
113
|
+
* The minimum gap in pixels between two tick labels.
|
|
114
|
+
* If two tick labels are closer than this minimum gap, one of them will be hidden.
|
|
115
|
+
* @default 4
|
|
109
116
|
*/
|
|
110
|
-
|
|
117
|
+
tickLabelMinGap?: number;
|
|
111
118
|
}
|
|
112
|
-
|
|
119
|
+
type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends ChartsXAxisProps ? {
|
|
113
120
|
/**
|
|
114
121
|
* Position of the axis.
|
|
122
|
+
*
|
|
123
|
+
* When set, the space for the axis is reserved, even if the axis is not displayed due to missing data.
|
|
124
|
+
*
|
|
125
|
+
* Set to 'none' to hide the axis.
|
|
126
|
+
*
|
|
127
|
+
* The first axis in the list will always have a default position.
|
|
115
128
|
*/
|
|
116
|
-
position?: 'top' | 'bottom';
|
|
117
|
-
|
|
129
|
+
position?: 'top' | 'bottom' | 'none';
|
|
130
|
+
/**
|
|
131
|
+
* The height of the axis.
|
|
132
|
+
* @default 30
|
|
133
|
+
*/
|
|
134
|
+
height?: number;
|
|
135
|
+
} : AxisProps extends ChartsYAxisProps ? {
|
|
136
|
+
/**
|
|
137
|
+
* Position of the axis.
|
|
138
|
+
*
|
|
139
|
+
* When set, the space for the axis is reserved, even if the axis is not displayed due to missing data.
|
|
140
|
+
*
|
|
141
|
+
* Set to 'none' to hide the axis.
|
|
142
|
+
*
|
|
143
|
+
* The first axis in the list will always have a default position.
|
|
144
|
+
*/
|
|
145
|
+
position?: 'left' | 'right' | 'none';
|
|
146
|
+
/**
|
|
147
|
+
* The width of the axis.
|
|
148
|
+
* @default 30
|
|
149
|
+
*/
|
|
150
|
+
width?: number;
|
|
151
|
+
} : {
|
|
152
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'none';
|
|
153
|
+
height?: number;
|
|
154
|
+
width?: number;
|
|
155
|
+
};
|
|
118
156
|
export interface ChartsRotationAxisProps extends ChartsAxisProps {
|
|
119
157
|
/**
|
|
120
158
|
* The start angle (in deg).
|
|
@@ -242,7 +280,7 @@ export type AxisValueFormatterContext<S extends ScaleName = ScaleName> = {
|
|
|
242
280
|
*/
|
|
243
281
|
scale: AxisScaleConfig[S]['scale'];
|
|
244
282
|
};
|
|
245
|
-
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
|
|
283
|
+
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
|
|
246
284
|
/**
|
|
247
285
|
* Id used to identify the axis.
|
|
248
286
|
*/
|
|
@@ -260,7 +298,7 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = Cha
|
|
|
260
298
|
/**
|
|
261
299
|
* The data used by `'band'` and `'point'` scales.
|
|
262
300
|
*/
|
|
263
|
-
data?: V[];
|
|
301
|
+
data?: readonly V[];
|
|
264
302
|
/**
|
|
265
303
|
* The key used to retrieve `data` from the `dataset` prop.
|
|
266
304
|
*/
|
|
@@ -280,6 +318,13 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = Cha
|
|
|
280
318
|
* If `true`, Reverse the axis scaleBand.
|
|
281
319
|
*/
|
|
282
320
|
reverse?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* The offset of the axis in pixels. It can be used to move the axis from its default position.
|
|
323
|
+
* X-axis: A top axis will move up, and a bottom axis will move down.
|
|
324
|
+
* Y-axis: A left axis will move left, and a right axis will move right.
|
|
325
|
+
* @default 0
|
|
326
|
+
*/
|
|
327
|
+
offset?: number;
|
|
283
328
|
/**
|
|
284
329
|
* Defines the axis scale domain based on the min/max values of series linked to it.
|
|
285
330
|
* - 'nice': Rounds the domain at human friendly values.
|
|
@@ -290,9 +335,9 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = Cha
|
|
|
290
335
|
min: number;
|
|
291
336
|
max: number;
|
|
292
337
|
});
|
|
293
|
-
} & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
|
|
338
|
+
} & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & AxisSideConfig<AxisProps> & TickParams & AxisConfigExtension;
|
|
294
339
|
export interface AxisConfigExtension {}
|
|
295
|
-
export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps = ChartsXAxisProps | ChartsYAxisProps> = Omit<AxisConfig<S, V, AxisProps>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
340
|
+
export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = MakeRequired<Omit<AxisConfig<S, V, AxisProps>, 'scaleType'>, 'offset'> & AxisScaleConfig[S] & AxisSideConfig<AxisProps> & AxisScaleComputedConfig[S] & {
|
|
296
341
|
/**
|
|
297
342
|
* An indication of the expected number of ticks.
|
|
298
343
|
*/
|
|
@@ -320,4 +365,5 @@ export interface ChartsAxisData {
|
|
|
320
365
|
* The mapping of series ids to their value for this particular axis index.
|
|
321
366
|
*/
|
|
322
367
|
seriesValues: Record<string, number | null | undefined>;
|
|
323
|
-
}
|
|
368
|
+
}
|
|
369
|
+
export {};
|
|
@@ -33,7 +33,7 @@ export interface OrdinalColorConfig<Value = number | Date | string> {
|
|
|
33
33
|
* The value to map.
|
|
34
34
|
* If undefined, it will be integers from 0 to the number of colors.
|
|
35
35
|
*/
|
|
36
|
-
values?: Value[];
|
|
36
|
+
values?: readonly Value[];
|
|
37
37
|
/**
|
|
38
38
|
* The color palette.
|
|
39
39
|
* Items equal to `values[k]` will get the color of `colors[k]`.
|
package/esm/models/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./seriesType/index.js";
|
|
2
|
-
export * from "./layout.js";
|
|
3
2
|
export * from "./stacking.js";
|
|
4
3
|
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData } from './axis';
|
|
5
4
|
export type { PropsFromSlot } from '@mui/x-internals/slots';
|
package/esm/models/index.js
CHANGED
|
@@ -76,6 +76,6 @@ export type ChartSeriesDefaultized<T extends ChartSeriesType> = ChartsSeriesConf
|
|
|
76
76
|
} : ChartsSeriesConfig[T]['series'];
|
|
77
77
|
export type ChartItemIdentifier<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
78
78
|
export type DatasetElementType<T> = {
|
|
79
|
-
[key: string]: T
|
|
79
|
+
[key: string]: Readonly<T>;
|
|
80
80
|
};
|
|
81
81
|
export type DatasetType<T = number | string | Date | null | undefined> = DatasetElementType<T>[];
|
|
@@ -29,7 +29,7 @@ export interface LineSeriesType extends CommonSeriesType<number | null>, Cartesi
|
|
|
29
29
|
/**
|
|
30
30
|
* Data associated to the line.
|
|
31
31
|
*/
|
|
32
|
-
data?: (number | null)[];
|
|
32
|
+
data?: readonly (number | null)[];
|
|
33
33
|
/**
|
|
34
34
|
* The key used to retrieve data from the dataset.
|
|
35
35
|
*/
|
|
@@ -27,7 +27,7 @@ export type DefaultizedPieValueType = PieValueType & Omit<D3PieArcDatum<any>, 'd
|
|
|
27
27
|
export type ChartsPieSorting = 'none' | 'asc' | 'desc' | ((a: number, b: number) => number);
|
|
28
28
|
export interface PieSeriesType<TData = PieValueType> extends CommonSeriesType<TData> {
|
|
29
29
|
type: 'pie';
|
|
30
|
-
data: TData[]
|
|
30
|
+
data: Readonly<TData[]>;
|
|
31
31
|
/**
|
|
32
32
|
* The radius between circle center and the beginning of the arc.
|
|
33
33
|
* Can be a number (in px) or a string with a percentage such as '50%'.
|
|
@@ -11,7 +11,7 @@ export type ScatterValueType = {
|
|
|
11
11
|
};
|
|
12
12
|
export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType | null>, CartesianSeriesType {
|
|
13
13
|
type: 'scatter';
|
|
14
|
-
data?: ScatterValueType[];
|
|
14
|
+
data?: readonly ScatterValueType[];
|
|
15
15
|
markerSize?: number;
|
|
16
16
|
/**
|
|
17
17
|
* The label to display on the tooltip or the legend. It can be a string or a function.
|
package/esm/models/z-axis.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-chart
|
|
|
2
2
|
import { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.js";
|
|
3
3
|
export interface ZAxisConfig<V = any> {
|
|
4
4
|
id: string;
|
|
5
|
-
data?: V[];
|
|
5
|
+
data?: readonly V[];
|
|
6
6
|
/**
|
|
7
7
|
* The key used to retrieve `data` from the `dataset` prop.
|
|
8
8
|
*/
|
package/hooks/useAxis.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { AxisId } from "../models/axis.js";
|
|
|
10
10
|
* @returns `{ xAxis, xAxisIds }` - The x-axes and their IDs.
|
|
11
11
|
*/
|
|
12
12
|
export declare function useXAxes(): {
|
|
13
|
-
xAxis: import("../internals").DefaultizedAxisConfig<import("
|
|
13
|
+
xAxis: import("../internals").DefaultizedAxisConfig<import("..").ChartsXAxisProps>;
|
|
14
14
|
xAxisIds: string[];
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -32,7 +32,7 @@ export declare function useYAxes(): {
|
|
|
32
32
|
* @param {AxisId | undefined} axisId - If provided returns the x axis with axisId, else returns the values for the default x axis.
|
|
33
33
|
* @returns The X axis.
|
|
34
34
|
*/
|
|
35
|
-
export declare function useXAxis(axisId?: AxisId): import("../internals").AxisDefaultized<keyof import("../internals").AxisScaleConfig, any, import("
|
|
35
|
+
export declare function useXAxis(axisId?: AxisId): import("../internals").AxisDefaultized<keyof import("../internals").AxisScaleConfig, any, import("..").ChartsXAxisProps>;
|
|
36
36
|
/**
|
|
37
37
|
* Get the Y axis.
|
|
38
38
|
* @param {AxisId | undefined} axisId - If provided returns the y axis with axisId, else returns the values for the default y axis.
|
package/hooks/useAxis.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.useXAxes = useXAxes;
|
|
|
8
8
|
exports.useXAxis = useXAxis;
|
|
9
9
|
exports.useYAxes = useYAxes;
|
|
10
10
|
exports.useYAxis = useYAxis;
|
|
11
|
-
var
|
|
11
|
+
var _useChartCartesianAxisRendering = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
|
|
12
12
|
var _useSelector = require("../internals/store/useSelector");
|
|
13
13
|
var _useStore = require("../internals/store/useStore");
|
|
14
14
|
/**
|
|
@@ -26,7 +26,7 @@ function useXAxes() {
|
|
|
26
26
|
const {
|
|
27
27
|
axis: xAxis,
|
|
28
28
|
axisIds: xAxisIds
|
|
29
|
-
} = (0, _useSelector.useSelector)(store,
|
|
29
|
+
} = (0, _useSelector.useSelector)(store, _useChartCartesianAxisRendering.selectorChartXAxis);
|
|
30
30
|
return {
|
|
31
31
|
xAxis,
|
|
32
32
|
xAxisIds
|
|
@@ -48,7 +48,7 @@ function useYAxes() {
|
|
|
48
48
|
const {
|
|
49
49
|
axis: yAxis,
|
|
50
50
|
axisIds: yAxisIds
|
|
51
|
-
} = (0, _useSelector.useSelector)(store,
|
|
51
|
+
} = (0, _useSelector.useSelector)(store, _useChartCartesianAxisRendering.selectorChartYAxis);
|
|
52
52
|
return {
|
|
53
53
|
yAxis,
|
|
54
54
|
yAxisIds
|
|
@@ -65,7 +65,7 @@ function useXAxis(axisId) {
|
|
|
65
65
|
const {
|
|
66
66
|
axis: xAxis,
|
|
67
67
|
axisIds: xAxisIds
|
|
68
|
-
} = (0, _useSelector.useSelector)(store,
|
|
68
|
+
} = (0, _useSelector.useSelector)(store, _useChartCartesianAxisRendering.selectorChartXAxis);
|
|
69
69
|
const id = axisId ?? xAxisIds[0];
|
|
70
70
|
return xAxis[id];
|
|
71
71
|
}
|
|
@@ -80,7 +80,7 @@ function useYAxis(axisId) {
|
|
|
80
80
|
const {
|
|
81
81
|
axis: yAxis,
|
|
82
82
|
axisIds: yAxisIds
|
|
83
|
-
} = (0, _useSelector.useSelector)(store,
|
|
83
|
+
} = (0, _useSelector.useSelector)(store, _useChartCartesianAxisRendering.selectorChartYAxis);
|
|
84
84
|
const id = axisId ?? yAxisIds[0];
|
|
85
85
|
return yAxis[id];
|
|
86
86
|
}
|
package/hooks/useSvgRef.js
CHANGED
|
@@ -13,7 +13,7 @@ var _ChartProvider = require("../context/ChartProvider");
|
|
|
13
13
|
function useSvgRef() {
|
|
14
14
|
const context = (0, _ChartProvider.useChartContext)();
|
|
15
15
|
if (!context) {
|
|
16
|
-
throw new Error(['MUI X: Could not find the svg ref context.', 'It looks like you rendered your component outside of a
|
|
16
|
+
throw new Error(['MUI X: Could not find the svg ref context.', 'It looks like you rendered your component outside of a ChartContainer parent component.'].join('\n'));
|
|
17
17
|
}
|
|
18
18
|
return context.svgRef;
|
|
19
19
|
}
|
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AllSeriesType } from "../models/seriesType/index.js";
|
|
2
2
|
export declare function defaultizeColor(series: AllSeriesType, seriesIndex: number, colors: string[]): {
|
|
3
3
|
data: {
|
|
4
|
-
value: number;
|
|
5
4
|
label?: string | ((location: "tooltip" | "legend" | "arc") => string) | undefined;
|
|
6
5
|
color: string;
|
|
7
|
-
labelMarkType?: "line" | "circle" | "
|
|
6
|
+
labelMarkType?: "line" | "square" | "circle" | import("react").ComponentType<import("..").ChartsLabelCustomMarkProps> | undefined;
|
|
7
|
+
value: number;
|
|
8
8
|
id?: import("..").PieItemId | undefined;
|
|
9
9
|
}[];
|
|
10
10
|
type: "pie";
|
|
@@ -46,24 +46,28 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
46
46
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
47
47
|
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
48
48
|
} | {
|
|
49
|
-
type: "
|
|
50
|
-
data?: (
|
|
51
|
-
|
|
49
|
+
type: "scatter";
|
|
50
|
+
data?: readonly import("..").ScatterValueType[];
|
|
51
|
+
markerSize?: number;
|
|
52
52
|
label?: string | ((location: "tooltip" | "legend") => string);
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
disableHover?: boolean;
|
|
54
|
+
zAxisId?: string;
|
|
55
|
+
datasetKeys?: {
|
|
56
|
+
x: string;
|
|
57
|
+
y: string;
|
|
58
|
+
z?: string;
|
|
59
|
+
id?: string;
|
|
60
|
+
};
|
|
55
61
|
id?: import(".").SeriesId;
|
|
56
62
|
color: string;
|
|
57
|
-
valueFormatter?: import(".").SeriesValueFormatter<
|
|
63
|
+
valueFormatter?: import(".").SeriesValueFormatter<import("..").ScatterValueType | null> | undefined;
|
|
58
64
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
59
65
|
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
60
66
|
xAxisId?: string;
|
|
61
67
|
yAxisId?: string;
|
|
62
|
-
stack?: string;
|
|
63
|
-
stackOrder?: import("..").StackOrderType;
|
|
64
68
|
} | {
|
|
65
69
|
type: "line";
|
|
66
|
-
data?: (number | null)[];
|
|
70
|
+
data?: readonly (number | null)[];
|
|
67
71
|
dataKey?: string;
|
|
68
72
|
stack?: string;
|
|
69
73
|
area?: boolean;
|
|
@@ -85,23 +89,19 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
85
89
|
yAxisId?: string;
|
|
86
90
|
stackOrder?: import("..").StackOrderType;
|
|
87
91
|
} | {
|
|
88
|
-
type: "
|
|
89
|
-
data?:
|
|
90
|
-
|
|
92
|
+
type: "bar";
|
|
93
|
+
data?: readonly (number | null)[];
|
|
94
|
+
dataKey?: string;
|
|
91
95
|
label?: string | ((location: "tooltip" | "legend") => string);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
datasetKeys?: {
|
|
95
|
-
x: string;
|
|
96
|
-
y: string;
|
|
97
|
-
z?: string;
|
|
98
|
-
id?: string;
|
|
99
|
-
};
|
|
96
|
+
layout?: "horizontal" | "vertical";
|
|
97
|
+
stackOffset?: import("..").StackOffsetType;
|
|
100
98
|
id?: import(".").SeriesId;
|
|
101
99
|
color: string;
|
|
102
|
-
valueFormatter?: import(".").SeriesValueFormatter<
|
|
100
|
+
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
103
101
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
104
102
|
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
105
103
|
xAxisId?: string;
|
|
106
104
|
yAxisId?: string;
|
|
105
|
+
stack?: string;
|
|
106
|
+
stackOrder?: import("..").StackOrderType;
|
|
107
107
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChartMargin, UseChartDimensionsParameters } from './plugins/corePlugins/useChartDimensions/useChartDimensions.types';
|
|
2
|
+
export declare function defaultizeMargin(input: UseChartDimensionsParameters['margin'], defaultMargin: ChartMargin): ChartMargin;
|
|
3
|
+
export declare function defaultizeMargin(input: UseChartDimensionsParameters['margin'], defaultMargin?: ChartMargin): Partial<ChartMargin> | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.defaultizeMargin = defaultizeMargin;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
function defaultizeMargin(input, defaultMargin) {
|
|
10
|
+
if (typeof input === 'number') {
|
|
11
|
+
return {
|
|
12
|
+
top: input,
|
|
13
|
+
bottom: input,
|
|
14
|
+
left: input,
|
|
15
|
+
right: input
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (defaultMargin) {
|
|
19
|
+
return (0, _extends2.default)({}, defaultMargin, input);
|
|
20
|
+
}
|
|
21
|
+
return input;
|
|
22
|
+
}
|
package/internals/domUtils.js
CHANGED
|
@@ -67,6 +67,7 @@ function camelToMiddleLine(text) {
|
|
|
67
67
|
const getStyleString = style => Object.keys(style).sort().reduce((result, s) => `${result}${camelToMiddleLine(s)}:${autoCompleteStyle(s, style[s])};`, '');
|
|
68
68
|
exports.getStyleString = getStyleString;
|
|
69
69
|
let domCleanTimeout;
|
|
70
|
+
|
|
70
71
|
/**
|
|
71
72
|
*
|
|
72
73
|
* @param text The string to estimate
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ChartPlugin } from "../../models/index.js";
|
|
2
|
-
import { UseChartDimensionsSignature } from
|
|
2
|
+
import type { UseChartDimensionsSignature } from './useChartDimensions.types';
|
|
3
3
|
export declare const useChartDimensions: ChartPlugin<UseChartDimensionsSignature>;
|
|
@@ -14,6 +14,7 @@ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedE
|
|
|
14
14
|
var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
15
15
|
var _constants = require("../../../../constants");
|
|
16
16
|
var _useChartDimensions = require("./useChartDimensions.selectors");
|
|
17
|
+
var _defaultizeMargin = require("../../../defaultizeMargin");
|
|
17
18
|
const MAX_COMPUTE_RUN = 10;
|
|
18
19
|
const useChartDimensions = ({
|
|
19
20
|
params,
|
|
@@ -39,36 +40,53 @@ const useChartDimensions = ({
|
|
|
39
40
|
const newHeight = Math.floor(parseFloat(computedStyle.height)) || 0;
|
|
40
41
|
const newWidth = Math.floor(parseFloat(computedStyle.width)) || 0;
|
|
41
42
|
store.update(prev => {
|
|
42
|
-
|
|
43
|
-
const prevHeight = prev.dimensions.height + prev.dimensions.top + prev.dimensions.bottom;
|
|
44
|
-
if (prevWidth === newWidth && prevHeight === newHeight) {
|
|
43
|
+
if (prev.dimensions.width === newWidth && prev.dimensions.height === newHeight) {
|
|
45
44
|
return prev;
|
|
46
45
|
}
|
|
47
46
|
return (0, _extends2.default)({}, prev, {
|
|
48
|
-
dimensions:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
dimensions: {
|
|
48
|
+
margin: {
|
|
49
|
+
top: params.margin.top,
|
|
50
|
+
right: params.margin.right,
|
|
51
|
+
bottom: params.margin.bottom,
|
|
52
|
+
left: params.margin.left
|
|
53
|
+
},
|
|
54
|
+
width: params.width ?? newWidth,
|
|
55
|
+
height: params.height ?? newHeight,
|
|
56
|
+
propsWidth: params.width,
|
|
57
|
+
propsHeight: params.height
|
|
58
|
+
}
|
|
52
59
|
});
|
|
53
60
|
});
|
|
54
61
|
return {
|
|
55
62
|
height: newHeight,
|
|
56
63
|
width: newWidth
|
|
57
64
|
};
|
|
58
|
-
}, [store, svgRef
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
}, [store, svgRef, params.height, params.width,
|
|
66
|
+
// Margin is an object, so we need to include all the properties to prevent infinite loops.
|
|
67
|
+
params.margin.left, params.margin.right, params.margin.top, params.margin.bottom]);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
store.update(prev => {
|
|
70
|
+
const width = params.width ?? prev.dimensions.width;
|
|
71
|
+
const height = params.height ?? prev.dimensions.height;
|
|
72
|
+
return (0, _extends2.default)({}, prev, {
|
|
73
|
+
dimensions: {
|
|
74
|
+
margin: {
|
|
75
|
+
top: params.margin.top,
|
|
76
|
+
right: params.margin.right,
|
|
77
|
+
bottom: params.margin.bottom,
|
|
78
|
+
left: params.margin.left
|
|
79
|
+
},
|
|
80
|
+
width,
|
|
81
|
+
height,
|
|
82
|
+
propsHeight: params.height,
|
|
83
|
+
propsWidth: params.width
|
|
84
|
+
}
|
|
85
|
+
});
|
|
70
86
|
});
|
|
71
|
-
}
|
|
87
|
+
}, [store, params.height, params.width,
|
|
88
|
+
// Margin is an object, so we need to include all the properties to prevent infinite loops.
|
|
89
|
+
params.margin.left, params.margin.right, params.margin.top, params.margin.bottom]);
|
|
72
90
|
React.useEffect(() => {
|
|
73
91
|
// Ensure the error detection occurs after the first rendering.
|
|
74
92
|
stateRef.current.displayError = true;
|
|
@@ -141,7 +159,7 @@ const useChartDimensions = ({
|
|
|
141
159
|
if (options?.targetElement && options?.targetElement.closest('[data-drawing-container]')) {
|
|
142
160
|
return true;
|
|
143
161
|
}
|
|
144
|
-
const drawingArea = (0, _useChartDimensions.
|
|
162
|
+
const drawingArea = (0, _useChartDimensions.selectorChartDrawingArea)(store.value);
|
|
145
163
|
const isInsideX = x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width;
|
|
146
164
|
const isInsideY = y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height;
|
|
147
165
|
if (options?.direction === 'x') {
|
|
@@ -167,17 +185,20 @@ useChartDimensions.params = {
|
|
|
167
185
|
useChartDimensions.getDefaultizedParams = ({
|
|
168
186
|
params
|
|
169
187
|
}) => (0, _extends2.default)({}, params, {
|
|
170
|
-
margin:
|
|
188
|
+
margin: (0, _defaultizeMargin.defaultizeMargin)(params.margin, _constants.DEFAULT_MARGINS)
|
|
171
189
|
});
|
|
172
190
|
useChartDimensions.getInitialState = ({
|
|
173
191
|
width,
|
|
174
192
|
height,
|
|
175
193
|
margin
|
|
176
|
-
}) =>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
194
|
+
}) => {
|
|
195
|
+
return {
|
|
196
|
+
dimensions: {
|
|
197
|
+
margin,
|
|
198
|
+
width: width ?? 0,
|
|
199
|
+
height: height ?? 0,
|
|
200
|
+
propsWidth: width,
|
|
201
|
+
propsHeight: height
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
};
|