@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
|
@@ -12,12 +12,7 @@ import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
|
|
|
12
12
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
13
13
|
import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const
|
|
16
|
-
top: 5,
|
|
17
|
-
bottom: 5,
|
|
18
|
-
left: 5,
|
|
19
|
-
right: 5
|
|
20
|
-
};
|
|
15
|
+
const SPARK_LINE_DEFAULT_MARGIN = 5;
|
|
21
16
|
|
|
22
17
|
/**
|
|
23
18
|
* Demos:
|
|
@@ -34,7 +29,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
34
29
|
yAxis,
|
|
35
30
|
width,
|
|
36
31
|
height,
|
|
37
|
-
margin =
|
|
32
|
+
margin = SPARK_LINE_DEFAULT_MARGIN,
|
|
38
33
|
color,
|
|
39
34
|
sx,
|
|
40
35
|
showTooltip,
|
|
@@ -86,10 +81,14 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
86
81
|
length: data.length
|
|
87
82
|
}, (_, index) => index),
|
|
88
83
|
hideTooltip: xAxis === undefined
|
|
89
|
-
}, xAxis
|
|
84
|
+
}, xAxis, {
|
|
85
|
+
position: 'none'
|
|
86
|
+
})],
|
|
90
87
|
yAxis: [_extends({
|
|
91
88
|
id: DEFAULT_Y_AXIS_KEY
|
|
92
|
-
}, yAxis
|
|
89
|
+
}, yAxis, {
|
|
90
|
+
position: 'none'
|
|
91
|
+
})],
|
|
93
92
|
colors: colors,
|
|
94
93
|
sx: sx,
|
|
95
94
|
disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
@@ -181,20 +180,16 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
181
180
|
/**
|
|
182
181
|
* The margin between the SVG and the drawing area.
|
|
183
182
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* bottom: 5,
|
|
188
|
-
* left: 5,
|
|
189
|
-
* right: 5,
|
|
190
|
-
* }
|
|
183
|
+
*
|
|
184
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
185
|
+
* @default 5
|
|
191
186
|
*/
|
|
192
|
-
margin: PropTypes.shape({
|
|
187
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
193
188
|
bottom: PropTypes.number,
|
|
194
189
|
left: PropTypes.number,
|
|
195
190
|
right: PropTypes.number,
|
|
196
191
|
top: PropTypes.number
|
|
197
|
-
}),
|
|
192
|
+
})]),
|
|
198
193
|
/**
|
|
199
194
|
* The function called for onClick events.
|
|
200
195
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
@@ -271,6 +266,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
271
266
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
272
267
|
*/
|
|
273
268
|
xAxis: PropTypes.shape({
|
|
269
|
+
axis: PropTypes.oneOf(['x']),
|
|
274
270
|
classes: PropTypes.object,
|
|
275
271
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
276
272
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -293,13 +289,15 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
293
289
|
disableTicks: PropTypes.bool,
|
|
294
290
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
295
291
|
fill: PropTypes.string,
|
|
292
|
+
height: PropTypes.number,
|
|
296
293
|
hideTooltip: PropTypes.bool,
|
|
297
294
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
298
295
|
label: PropTypes.string,
|
|
299
296
|
labelStyle: PropTypes.object,
|
|
300
297
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
301
298
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
302
|
-
|
|
299
|
+
offset: PropTypes.number,
|
|
300
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
303
301
|
reverse: PropTypes.bool,
|
|
304
302
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
305
303
|
slotProps: PropTypes.object,
|
|
@@ -308,6 +306,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
308
306
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
309
307
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
310
308
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
309
|
+
tickLabelMinGap: PropTypes.number,
|
|
311
310
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
312
311
|
tickLabelStyle: PropTypes.object,
|
|
313
312
|
tickMaxStep: PropTypes.number,
|
|
@@ -322,6 +321,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
322
321
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
323
322
|
*/
|
|
324
323
|
yAxis: PropTypes.shape({
|
|
324
|
+
axis: PropTypes.oneOf(['y']),
|
|
325
325
|
classes: PropTypes.object,
|
|
326
326
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
327
327
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -350,7 +350,8 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
350
350
|
labelStyle: PropTypes.object,
|
|
351
351
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
352
352
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
353
|
-
|
|
353
|
+
offset: PropTypes.number,
|
|
354
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
354
355
|
reverse: PropTypes.bool,
|
|
355
356
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
356
357
|
slotProps: PropTypes.object,
|
|
@@ -366,7 +367,8 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
366
367
|
tickNumber: PropTypes.number,
|
|
367
368
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
368
369
|
tickSize: PropTypes.number,
|
|
369
|
-
valueFormatter: PropTypes.func
|
|
370
|
+
valueFormatter: PropTypes.func,
|
|
371
|
+
width: PropTypes.number
|
|
370
372
|
})
|
|
371
373
|
} : void 0;
|
|
372
374
|
export { SparkLineChart };
|
|
@@ -6,4 +6,11 @@ export declare const DEFAULT_MARGINS: {
|
|
|
6
6
|
left: number;
|
|
7
7
|
right: number;
|
|
8
8
|
};
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const DEFAULT_AXIS_SIZE_WIDTH = 30;
|
|
10
|
+
export declare const DEFAULT_AXIS_SIZE_HEIGHT = 25;
|
|
11
|
+
export declare const EMPTY_SIDES: {
|
|
12
|
+
top: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
left: number;
|
|
15
|
+
right: number;
|
|
16
|
+
};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export const DEFAULT_X_AXIS_KEY = 'DEFAULT_X_AXIS_KEY';
|
|
2
2
|
export const DEFAULT_Y_AXIS_KEY = 'DEFAULT_Y_AXIS_KEY';
|
|
3
3
|
export const DEFAULT_MARGINS = {
|
|
4
|
-
top:
|
|
5
|
-
bottom:
|
|
6
|
-
left:
|
|
7
|
-
right:
|
|
4
|
+
top: 20,
|
|
5
|
+
bottom: 20,
|
|
6
|
+
left: 20,
|
|
7
|
+
right: 20
|
|
8
8
|
};
|
|
9
|
-
export const
|
|
9
|
+
export const DEFAULT_AXIS_SIZE_WIDTH = 30;
|
|
10
|
+
export const DEFAULT_AXIS_SIZE_HEIGHT = 25;
|
|
11
|
+
export const EMPTY_SIDES = {
|
|
12
|
+
top: 0,
|
|
13
|
+
bottom: 0,
|
|
14
|
+
left: 0,
|
|
15
|
+
right: 0
|
|
16
|
+
};
|
|
@@ -14,7 +14,7 @@ export function useSkipAnimation(skipAnimation) {
|
|
|
14
14
|
data
|
|
15
15
|
} = React.useContext(AnimationContext);
|
|
16
16
|
if (!isInitialized) {
|
|
17
|
-
throw new Error(['MUI X: Could not find the animation ref context.', 'It looks like you rendered your component outside of a
|
|
17
|
+
throw new Error(['MUI X: Could not find the animation ref context.', 'It looks like you rendered your component outside of a ChartContainer parent component.'].join('\n'));
|
|
18
18
|
}
|
|
19
19
|
return skipAnimation || data.skipAnimation;
|
|
20
20
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ChartAnyPluginSignature, ChartInstance, ChartPublicAPI, ConvertSignaturesIntoPlugins, MergeSignaturesProperty } from
|
|
3
|
-
import { ChartStore } from
|
|
4
|
-
import { ChartCorePluginSignatures } from
|
|
5
|
-
import { ChartSeriesConfig } from
|
|
6
|
-
import { UseChartBaseProps } from
|
|
7
|
-
import { ChartSeriesType } from
|
|
2
|
+
import type { ChartAnyPluginSignature, ChartInstance, ChartPublicAPI, ConvertSignaturesIntoPlugins, MergeSignaturesProperty } from '../../internals/plugins/models';
|
|
3
|
+
import type { ChartStore } from '../../internals/plugins/utils/ChartStore';
|
|
4
|
+
import type { ChartCorePluginSignatures } from '../../internals/plugins/corePlugins';
|
|
5
|
+
import type { ChartSeriesConfig } from '../../internals/plugins/models/seriesConfig';
|
|
6
|
+
import type { UseChartBaseProps } from '../../internals/store/useCharts.types';
|
|
7
|
+
import type { ChartSeriesType } from '../../models/seriesType/config';
|
|
8
8
|
export type ChartContextValue<TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []> = {
|
|
9
9
|
/**
|
|
10
10
|
* And object with all the methods needed to interact with the chart.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DatasetType } from "../../models/seriesType/config.js";
|
|
2
2
|
import { AxisDefaultized, ScaleName, AxisId, AxisConfig, ChartsRotationAxisProps, ChartsRadiusAxisProps } from "../../models/axis.js";
|
|
3
|
+
import { ChartsAxisProps } from "../../ChartsAxis/index.js";
|
|
3
4
|
export type PolarProviderProps = {
|
|
4
5
|
/**
|
|
5
6
|
* The configuration of the rotation-axes.
|
|
@@ -16,10 +17,10 @@ export type PolarProviderProps = {
|
|
|
16
17
|
/**
|
|
17
18
|
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
18
19
|
*/
|
|
19
|
-
dataset?: DatasetType
|
|
20
|
+
dataset?: Readonly<DatasetType>;
|
|
20
21
|
children: React.ReactNode;
|
|
21
22
|
};
|
|
22
|
-
export type DefaultizedAxisConfig<Axis> = {
|
|
23
|
+
export type DefaultizedAxisConfig<Axis extends ChartsAxisProps> = {
|
|
23
24
|
[axisId: AxisId]: AxisDefaultized<ScaleName, any, Axis>;
|
|
24
25
|
};
|
|
25
26
|
export type PolarContextState = {
|
|
@@ -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/modern/hooks/useAxis.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { selectorChartXAxis, selectorChartYAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/
|
|
3
|
+
import { selectorChartXAxis, selectorChartYAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js";
|
|
4
4
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
5
5
|
import { useStore } from "../internals/store/useStore.js";
|
|
6
6
|
/**
|
|
@@ -9,7 +9,7 @@ import { useChartContext } from "../context/ChartProvider/index.js";
|
|
|
9
9
|
export function useSvgRef() {
|
|
10
10
|
const context = useChartContext();
|
|
11
11
|
if (!context) {
|
|
12
|
-
throw new Error(['MUI X: Could not find the svg ref context.', 'It looks like you rendered your component outside of a
|
|
12
|
+
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'));
|
|
13
13
|
}
|
|
14
14
|
return context.svgRef;
|
|
15
15
|
}
|
package/modern/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,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
export function defaultizeMargin(input, defaultMargin) {
|
|
3
|
+
if (typeof input === 'number') {
|
|
4
|
+
return {
|
|
5
|
+
top: input,
|
|
6
|
+
bottom: input,
|
|
7
|
+
left: input,
|
|
8
|
+
right: input
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
if (defaultMargin) {
|
|
12
|
+
return _extends({}, defaultMargin, input);
|
|
13
|
+
}
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
@@ -58,6 +58,7 @@ function camelToMiddleLine(text) {
|
|
|
58
58
|
*/
|
|
59
59
|
export const getStyleString = style => Object.keys(style).sort().reduce((result, s) => `${result}${camelToMiddleLine(s)}:${autoCompleteStyle(s, style[s])};`, '');
|
|
60
60
|
let domCleanTimeout;
|
|
61
|
+
|
|
61
62
|
/**
|
|
62
63
|
*
|
|
63
64
|
* @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>;
|
|
@@ -6,7 +6,8 @@ import * as React from 'react';
|
|
|
6
6
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
7
7
|
import ownerWindow from '@mui/utils/ownerWindow';
|
|
8
8
|
import { DEFAULT_MARGINS } from "../../../../constants/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { selectorChartDrawingArea } from "./useChartDimensions.selectors.js";
|
|
10
|
+
import { defaultizeMargin } from "../../../defaultizeMargin.js";
|
|
10
11
|
const MAX_COMPUTE_RUN = 10;
|
|
11
12
|
export const useChartDimensions = ({
|
|
12
13
|
params,
|
|
@@ -32,36 +33,53 @@ export const useChartDimensions = ({
|
|
|
32
33
|
const newHeight = Math.floor(parseFloat(computedStyle.height)) || 0;
|
|
33
34
|
const newWidth = Math.floor(parseFloat(computedStyle.width)) || 0;
|
|
34
35
|
store.update(prev => {
|
|
35
|
-
|
|
36
|
-
const prevHeight = prev.dimensions.height + prev.dimensions.top + prev.dimensions.bottom;
|
|
37
|
-
if (prevWidth === newWidth && prevHeight === newHeight) {
|
|
36
|
+
if (prev.dimensions.width === newWidth && prev.dimensions.height === newHeight) {
|
|
38
37
|
return prev;
|
|
39
38
|
}
|
|
40
39
|
return _extends({}, prev, {
|
|
41
|
-
dimensions:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
dimensions: {
|
|
41
|
+
margin: {
|
|
42
|
+
top: params.margin.top,
|
|
43
|
+
right: params.margin.right,
|
|
44
|
+
bottom: params.margin.bottom,
|
|
45
|
+
left: params.margin.left
|
|
46
|
+
},
|
|
47
|
+
width: params.width ?? newWidth,
|
|
48
|
+
height: params.height ?? newHeight,
|
|
49
|
+
propsWidth: params.width,
|
|
50
|
+
propsHeight: params.height
|
|
51
|
+
}
|
|
45
52
|
});
|
|
46
53
|
});
|
|
47
54
|
return {
|
|
48
55
|
height: newHeight,
|
|
49
56
|
width: newWidth
|
|
50
57
|
};
|
|
51
|
-
}, [store, svgRef
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
}, [store, svgRef, params.height, params.width,
|
|
59
|
+
// Margin is an object, so we need to include all the properties to prevent infinite loops.
|
|
60
|
+
params.margin.left, params.margin.right, params.margin.top, params.margin.bottom]);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
store.update(prev => {
|
|
63
|
+
const width = params.width ?? prev.dimensions.width;
|
|
64
|
+
const height = params.height ?? prev.dimensions.height;
|
|
65
|
+
return _extends({}, prev, {
|
|
66
|
+
dimensions: {
|
|
67
|
+
margin: {
|
|
68
|
+
top: params.margin.top,
|
|
69
|
+
right: params.margin.right,
|
|
70
|
+
bottom: params.margin.bottom,
|
|
71
|
+
left: params.margin.left
|
|
72
|
+
},
|
|
73
|
+
width,
|
|
74
|
+
height,
|
|
75
|
+
propsHeight: params.height,
|
|
76
|
+
propsWidth: params.width
|
|
77
|
+
}
|
|
78
|
+
});
|
|
63
79
|
});
|
|
64
|
-
}
|
|
80
|
+
}, [store, params.height, params.width,
|
|
81
|
+
// Margin is an object, so we need to include all the properties to prevent infinite loops.
|
|
82
|
+
params.margin.left, params.margin.right, params.margin.top, params.margin.bottom]);
|
|
65
83
|
React.useEffect(() => {
|
|
66
84
|
// Ensure the error detection occurs after the first rendering.
|
|
67
85
|
stateRef.current.displayError = true;
|
|
@@ -134,7 +152,7 @@ export const useChartDimensions = ({
|
|
|
134
152
|
if (options?.targetElement && options?.targetElement.closest('[data-drawing-container]')) {
|
|
135
153
|
return true;
|
|
136
154
|
}
|
|
137
|
-
const drawingArea =
|
|
155
|
+
const drawingArea = selectorChartDrawingArea(store.value);
|
|
138
156
|
const isInsideX = x >= drawingArea.left - 1 && x <= drawingArea.left + drawingArea.width;
|
|
139
157
|
const isInsideY = y >= drawingArea.top - 1 && y <= drawingArea.top + drawingArea.height;
|
|
140
158
|
if (options?.direction === 'x') {
|
|
@@ -159,17 +177,20 @@ useChartDimensions.params = {
|
|
|
159
177
|
useChartDimensions.getDefaultizedParams = ({
|
|
160
178
|
params
|
|
161
179
|
}) => _extends({}, params, {
|
|
162
|
-
margin: params.margin
|
|
180
|
+
margin: defaultizeMargin(params.margin, DEFAULT_MARGINS)
|
|
163
181
|
});
|
|
164
182
|
useChartDimensions.getInitialState = ({
|
|
165
183
|
width,
|
|
166
184
|
height,
|
|
167
185
|
margin
|
|
168
|
-
}) =>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
186
|
+
}) => {
|
|
187
|
+
return {
|
|
188
|
+
dimensions: {
|
|
189
|
+
margin,
|
|
190
|
+
width: width ?? 0,
|
|
191
|
+
height: height ?? 0,
|
|
192
|
+
propsWidth: width,
|
|
193
|
+
propsHeight: height
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
};
|