@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/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { createSelector } from "../../utils/selectors.js";
|
|
2
|
+
import { selectorChartBottomAxisSize, selectorChartLeftAxisSize, selectorChartRightAxisSize, selectorChartTopAxisSize } from "../../featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js";
|
|
2
3
|
export const selectorChartDimensionsState = state => state.dimensions;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const selectorChartMargin = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.margin);
|
|
5
|
+
const selectorChartWidth = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.width);
|
|
6
|
+
const selectorChartHeight = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.height);
|
|
7
|
+
const selectorChartTopMargin = createSelector(selectorChartMargin, margin => margin.top);
|
|
8
|
+
const selectorChartRightMargin = createSelector(selectorChartMargin, margin => margin.right);
|
|
9
|
+
const selectorChartBottomMargin = createSelector(selectorChartMargin, margin => margin.bottom);
|
|
10
|
+
const selectorChartLeftMargin = createSelector(selectorChartMargin, margin => margin.left);
|
|
11
|
+
export const selectorChartDrawingArea = createSelector(selectorChartWidth, selectorChartHeight, selectorChartTopMargin, selectorChartRightMargin, selectorChartBottomMargin, selectorChartLeftMargin, selectorChartTopAxisSize, selectorChartRightAxisSize, selectorChartBottomAxisSize, selectorChartLeftAxisSize, (width, height, marginTop, marginRight, marginBottom, marginLeft, axisSizeTop, axisSizeRight, axisSizeBottom, axisSizeLeft) => ({
|
|
12
|
+
width: width - marginLeft - marginRight - axisSizeLeft - axisSizeRight,
|
|
13
|
+
left: marginLeft + axisSizeLeft,
|
|
14
|
+
right: marginRight + axisSizeRight,
|
|
15
|
+
height: height - marginTop - marginBottom - axisSizeTop - axisSizeBottom,
|
|
16
|
+
top: marginTop + axisSizeTop,
|
|
17
|
+
bottom: marginBottom + axisSizeBottom
|
|
10
18
|
}));
|
|
11
19
|
export const selectorChartPropsSize = createSelector(selectorChartDimensionsState, dimensionsState => ({
|
|
12
20
|
width: dimensionsState.propsWidth,
|
|
13
21
|
height: dimensionsState.propsHeight
|
|
14
22
|
}));
|
|
15
|
-
export const selectorChartContainerSize = createSelector(
|
|
16
|
-
width
|
|
17
|
-
height
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get the id attribute of the chart.
|
|
22
|
-
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
23
|
-
* @returns {string} The id attribute of the chart.
|
|
24
|
-
*/
|
|
25
|
-
export const selectorChartHasIntrinsicSize = createSelector(selectorChartContainerSize, svgSize => svgSize.width > 0 && svgSize.height > 0);
|
|
23
|
+
export const selectorChartContainerSize = createSelector(selectorChartWidth, selectorChartHeight, (width, height) => ({
|
|
24
|
+
width,
|
|
25
|
+
height
|
|
26
|
+
}));
|
package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChartPluginSignature } from "../../models/index.js";
|
|
2
|
+
import type { UseChartCartesianAxisSignature } from '../../featurePlugins/useChartCartesianAxis';
|
|
2
3
|
export interface ChartMargin {
|
|
3
4
|
/**
|
|
4
5
|
* The gap between the left border of the SVG and the drawing area.
|
|
@@ -29,9 +30,10 @@ export interface UseChartDimensionsParameters {
|
|
|
29
30
|
/**
|
|
30
31
|
* The margin between the SVG and the drawing area.
|
|
31
32
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
32
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
33
35
|
*/
|
|
34
|
-
margin?: Partial<ChartMargin
|
|
36
|
+
margin?: Partial<ChartMargin> | number;
|
|
35
37
|
}
|
|
36
38
|
export type UseChartDimensionsDefaultizedParameters = UseChartDimensionsParameters & {
|
|
37
39
|
margin: ChartMargin;
|
|
@@ -39,21 +41,9 @@ export type UseChartDimensionsDefaultizedParameters = UseChartDimensionsParamete
|
|
|
39
41
|
export interface UseChartDimensionsState {
|
|
40
42
|
dimensions: {
|
|
41
43
|
/**
|
|
42
|
-
* The
|
|
44
|
+
* The drawing area's margin.
|
|
43
45
|
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The gap between the top border of the SVG and the drawing area.
|
|
47
|
-
*/
|
|
48
|
-
top: number;
|
|
49
|
-
/**
|
|
50
|
-
* The gap between the bottom border of the SVG and the drawing area.
|
|
51
|
-
*/
|
|
52
|
-
bottom: number;
|
|
53
|
-
/**
|
|
54
|
-
* The gap between the right border of the SVG and the drawing area.
|
|
55
|
-
*/
|
|
56
|
-
right: number;
|
|
46
|
+
margin: ChartMargin;
|
|
57
47
|
/**
|
|
58
48
|
* The width of the drawing area.
|
|
59
49
|
*/
|
|
@@ -96,4 +86,5 @@ export type UseChartDimensionsSignature = ChartPluginSignature<{
|
|
|
96
86
|
defaultizedParams: UseChartDimensionsDefaultizedParameters;
|
|
97
87
|
state: UseChartDimensionsState;
|
|
98
88
|
instance: UseChartDimensionsInstance;
|
|
89
|
+
optionalDependencies: [UseChartCartesianAxisSignature];
|
|
99
90
|
}>;
|
|
@@ -16,8 +16,8 @@ export declare const preprocessSeries: <TSeriesType extends ChartSeriesType>({
|
|
|
16
16
|
seriesConfig,
|
|
17
17
|
dataset
|
|
18
18
|
}: {
|
|
19
|
-
series: AllSeriesType<TSeriesType>[]
|
|
19
|
+
series: Readonly<AllSeriesType<TSeriesType>[]>;
|
|
20
20
|
colors: string[];
|
|
21
21
|
seriesConfig: ChartSeriesConfig<TSeriesType>;
|
|
22
|
-
dataset?: DatasetType
|
|
22
|
+
dataset?: Readonly<DatasetType>;
|
|
23
23
|
}) => { [type in TSeriesType]?: SeriesProcessorResult<TSeriesType> | undefined };
|
|
@@ -46,9 +46,8 @@ useChartSeries.params = {
|
|
|
46
46
|
const EMPTY_ARRAY = [];
|
|
47
47
|
useChartSeries.getDefaultizedParams = ({
|
|
48
48
|
params
|
|
49
|
-
}) => _extends({
|
|
50
|
-
series: EMPTY_ARRAY
|
|
51
|
-
}, params, {
|
|
49
|
+
}) => _extends({}, params, {
|
|
50
|
+
series: params.series?.length ? params.series : EMPTY_ARRAY,
|
|
52
51
|
colors: params.colors ?? rainbowSurgePalette,
|
|
53
52
|
theme: params.theme ?? 'light'
|
|
54
53
|
});
|
|
@@ -7,13 +7,13 @@ export interface UseChartSeriesParameters<T extends ChartSeriesType = ChartSerie
|
|
|
7
7
|
/**
|
|
8
8
|
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
9
9
|
*/
|
|
10
|
-
dataset?: DatasetType
|
|
10
|
+
dataset?: Readonly<DatasetType>;
|
|
11
11
|
/**
|
|
12
12
|
* The array of series to display.
|
|
13
13
|
* Each type of series has its own specificity.
|
|
14
14
|
* Please refer to the appropriate docs page to learn more about it.
|
|
15
15
|
*/
|
|
16
|
-
series?: AllSeriesType<T>[]
|
|
16
|
+
series?: Readonly<AllSeriesType<T>[]>;
|
|
17
17
|
/**
|
|
18
18
|
* Color palette used to colorize multiple series.
|
|
19
19
|
* @default rainbowSurgePalette
|
|
@@ -27,7 +27,7 @@ export type UseChartSeriesDefaultizedParameters<T extends ChartSeriesType = Char
|
|
|
27
27
|
* Each type of series has its own specificity.
|
|
28
28
|
* Please refer to the appropriate docs page to learn more about it.
|
|
29
29
|
*/
|
|
30
|
-
series: AllSeriesType<T>[]
|
|
30
|
+
series: Readonly<AllSeriesType<T>[]>;
|
|
31
31
|
/**
|
|
32
32
|
* Color palette used to colorize multiple series.
|
|
33
33
|
* @default rainbowSurgePalette
|
|
@@ -25,5 +25,5 @@ export declare function computeAxisValue<T extends ChartSeriesType>(options: Com
|
|
|
25
25
|
export declare function computeAxisValue<T extends ChartSeriesType>(options: ComputeCommonParams<T> & {
|
|
26
26
|
axis?: AxisConfig<ScaleName, any, ChartsXAxisProps>[];
|
|
27
27
|
axisDirection: 'x';
|
|
28
|
-
}): ComputeResult<
|
|
28
|
+
}): ComputeResult<ChartsXAxisProps>;
|
|
29
29
|
export {};
|
|
@@ -54,6 +54,7 @@ export function computeAxisValue({
|
|
|
54
54
|
const scaleRange = axisDirection === 'y' ? [range[1], range[0]] : range;
|
|
55
55
|
const zoomedRange = zoomScaleRange(scaleRange, zoomRange);
|
|
56
56
|
completeAxis[axis.id] = _extends({
|
|
57
|
+
offset: 0,
|
|
57
58
|
categoryGapRatio,
|
|
58
59
|
barGapRatio
|
|
59
60
|
}, axis, {
|
|
@@ -72,7 +73,9 @@ export function computeAxisValue({
|
|
|
72
73
|
if (isPointScaleConfig(axis)) {
|
|
73
74
|
const scaleRange = axisDirection === 'y' ? [...range].reverse() : range;
|
|
74
75
|
const zoomedRange = zoomScaleRange(scaleRange, zoomRange);
|
|
75
|
-
completeAxis[axis.id] = _extends({
|
|
76
|
+
completeAxis[axis.id] = _extends({
|
|
77
|
+
offset: 0
|
|
78
|
+
}, axis, {
|
|
76
79
|
data,
|
|
77
80
|
scale: scalePoint(axis.data, zoomedRange),
|
|
78
81
|
tickNumber: axis.data.length,
|
|
@@ -110,7 +113,9 @@ export function computeAxisValue({
|
|
|
110
113
|
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
111
114
|
const [minDomain, maxDomain] = finalScale.domain();
|
|
112
115
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
113
|
-
completeAxis[axis.id] = _extends({
|
|
116
|
+
completeAxis[axis.id] = _extends({
|
|
117
|
+
offset: 0
|
|
118
|
+
}, axis, {
|
|
114
119
|
data,
|
|
115
120
|
scaleType: scaleType,
|
|
116
121
|
scale: finalScale.domain(domain),
|
package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AxisId } from "../../../../models/axis.js";
|
|
1
|
+
import { AxisId, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from "../../../../models/axis.js";
|
|
3
2
|
import { CartesianChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
4
3
|
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
5
|
-
import { AxisConfig
|
|
4
|
+
import { AxisConfig } from "../../../../models/index.js";
|
|
6
5
|
import { ChartSeriesConfig } from "../../models/seriesConfig/index.js";
|
|
7
6
|
import { DefaultizedZoomOptions, ExtremumFilter } from "./useChartCartesianAxis.types.js";
|
|
8
7
|
import { GetZoomAxisFilters, ZoomAxisFilters, ZoomData } from "./zoom.types.js";
|
|
9
|
-
|
|
8
|
+
export declare function createAxisFilterMapper(params: {
|
|
10
9
|
zoomMap: Map<AxisId, ZoomData>;
|
|
11
10
|
zoomOptions: Record<AxisId, DefaultizedZoomOptions>;
|
|
12
11
|
seriesConfig: ChartSeriesConfig<CartesianChartSeriesType>;
|
|
13
12
|
formattedSeries: ProcessedSeries;
|
|
14
|
-
direction: 'x'
|
|
15
|
-
};
|
|
16
|
-
export declare
|
|
17
|
-
zoomMap,
|
|
18
|
-
zoomOptions,
|
|
19
|
-
seriesConfig
|
|
20
|
-
formattedSeries
|
|
21
|
-
direction
|
|
22
|
-
}:
|
|
23
|
-
export declare const createGetAxisFilters: (filters: ZoomAxisFilters) => GetZoomAxisFilters;
|
|
24
|
-
export {};
|
|
13
|
+
direction: 'x';
|
|
14
|
+
}): (axis: AxisConfig<ScaleName, any, ChartsXAxisProps>, axisIndex: number) => ExtremumFilter | null;
|
|
15
|
+
export declare function createAxisFilterMapper(params: {
|
|
16
|
+
zoomMap: Map<AxisId, ZoomData>;
|
|
17
|
+
zoomOptions: Record<AxisId, DefaultizedZoomOptions>;
|
|
18
|
+
seriesConfig: ChartSeriesConfig<CartesianChartSeriesType>;
|
|
19
|
+
formattedSeries: ProcessedSeries;
|
|
20
|
+
direction: 'y';
|
|
21
|
+
}): (axis: AxisConfig<ScaleName, any, ChartsYAxisProps>, axisIndex: number) => ExtremumFilter | null;
|
|
22
|
+
export declare const createGetAxisFilters: (filters: ZoomAxisFilters) => GetZoomAxisFilters;
|
package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
import { isDefined } from "../../../isDefined.js";
|
|
2
2
|
import { getAxisExtremum } from "./getAxisExtremum.js";
|
|
3
3
|
import { getScale } from "../../../getScale.js";
|
|
4
|
-
export
|
|
4
|
+
export function createAxisFilterMapper({
|
|
5
5
|
zoomMap,
|
|
6
6
|
zoomOptions,
|
|
7
7
|
seriesConfig,
|
|
8
8
|
formattedSeries,
|
|
9
9
|
direction
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let extremums = [];
|
|
21
|
-
const scaleType = axis.scaleType;
|
|
22
|
-
if (scaleType === 'point' || scaleType === 'band') {
|
|
23
|
-
extremums = [0, (axis.data?.length ?? 1) - 1];
|
|
24
|
-
} else {
|
|
25
|
-
extremums = getAxisExtremum(axis, direction, seriesConfig, axisIndex, formattedSeries);
|
|
26
|
-
}
|
|
27
|
-
let min;
|
|
28
|
-
let max;
|
|
29
|
-
const continuousScaleType = !scaleType || scaleType === 'band' || scaleType === 'point' ? 'linear' : scaleType;
|
|
30
|
-
[min, max] = getScale(continuousScaleType, extremums, [0, 100]).nice().domain();
|
|
31
|
-
min = min instanceof Date ? min.getTime() : min;
|
|
32
|
-
max = max instanceof Date ? max.getTime() : max;
|
|
33
|
-
const minVal = min + zoom.start * (max - min) / 100;
|
|
34
|
-
const maxVal = min + zoom.end * (max - min) / 100;
|
|
35
|
-
return (value, dataIndex) => {
|
|
36
|
-
const val = value[direction] ?? axis.data?.[dataIndex];
|
|
37
|
-
if (val == null) {
|
|
38
|
-
// If the value does not exist because of missing data point, or out of range index, we just ignore.
|
|
39
|
-
return true;
|
|
10
|
+
}) {
|
|
11
|
+
return (axis, axisIndex) => {
|
|
12
|
+
const zoomOption = zoomOptions[axis.id];
|
|
13
|
+
if (!zoomOption || zoomOption.filterMode !== 'discard') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const zoom = zoomMap?.get(axis.id);
|
|
17
|
+
if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
|
|
18
|
+
// No zoom, or zoom with all data visible
|
|
19
|
+
return null;
|
|
40
20
|
}
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
let extremums = [];
|
|
22
|
+
const scaleType = axis.scaleType;
|
|
23
|
+
if (scaleType === 'point' || scaleType === 'band') {
|
|
24
|
+
extremums = [0, (axis.data?.length ?? 1) - 1];
|
|
25
|
+
} else {
|
|
26
|
+
extremums = getAxisExtremum(axis, direction, seriesConfig, axisIndex, formattedSeries);
|
|
43
27
|
}
|
|
44
|
-
|
|
28
|
+
let min;
|
|
29
|
+
let max;
|
|
30
|
+
const continuousScaleType = !scaleType || scaleType === 'band' || scaleType === 'point' ? 'linear' : scaleType;
|
|
31
|
+
[min, max] = getScale(continuousScaleType, extremums, [0, 100]).nice().domain();
|
|
32
|
+
min = min instanceof Date ? min.getTime() : min;
|
|
33
|
+
max = max instanceof Date ? max.getTime() : max;
|
|
34
|
+
const minVal = min + zoom.start * (max - min) / 100;
|
|
35
|
+
const maxVal = min + zoom.end * (max - min) / 100;
|
|
36
|
+
return (value, dataIndex) => {
|
|
37
|
+
const val = value[direction] ?? axis.data?.[dataIndex];
|
|
38
|
+
if (val == null) {
|
|
39
|
+
// If the value does not exist because of missing data point, or out of range index, we just ignore.
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
if (axis.scaleType === 'point' || axis.scaleType === 'band' || typeof val === 'string') {
|
|
43
|
+
return dataIndex >= minVal && dataIndex <= maxVal;
|
|
44
|
+
}
|
|
45
|
+
return val >= minVal && val <= maxVal;
|
|
46
|
+
};
|
|
45
47
|
};
|
|
46
|
-
}
|
|
48
|
+
}
|
|
47
49
|
export const createGetAxisFilters = filters => ({
|
|
48
50
|
currentAxisId,
|
|
49
51
|
seriesXAxisId,
|
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
2
|
import { AxisConfig, ScaleName } from "../../../../models/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ChartsXAxisProps, ChartsYAxisProps } from "../../../../models/axis.js";
|
|
4
4
|
import { DatasetType } from "../../../../models/seriesType/config.js";
|
|
5
|
-
export declare function defaultizeAxis(inAxis: MakeOptional<AxisConfig<ScaleName, any,
|
|
6
|
-
|
|
7
|
-
reverse?: boolean | undefined;
|
|
8
|
-
fill?: string | undefined;
|
|
9
|
-
data?: any[] | undefined;
|
|
10
|
-
slots?: Partial<import("../../..").ChartsAxisSlots> | undefined;
|
|
11
|
-
slotProps?: Partial<import("../../..").ChartsAxisSlotProps> | undefined;
|
|
12
|
-
classes?: Partial<import("../../../..").ChartsAxisClasses> | undefined;
|
|
13
|
-
stroke?: string | undefined;
|
|
14
|
-
sx?: import("@mui/system").SxProps | undefined;
|
|
15
|
-
valueFormatter?: (<TScaleName extends keyof import("../../..").AxisScaleConfig>(value: any, context: import("../../..").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
16
|
-
dataKey?: string | undefined;
|
|
17
|
-
min?: (number | Date) | undefined;
|
|
18
|
-
max?: (number | Date) | undefined;
|
|
19
|
-
tickMaxStep?: number | undefined;
|
|
20
|
-
tickMinStep?: number | undefined;
|
|
21
|
-
tickNumber?: number | undefined;
|
|
22
|
-
disableLine?: boolean | undefined;
|
|
23
|
-
disableTicks?: boolean | undefined;
|
|
24
|
-
tickLabelStyle?: import("../../../getWordsByLines").ChartsTextStyle | undefined;
|
|
25
|
-
labelStyle?: import("../../../getWordsByLines").ChartsTextStyle | undefined;
|
|
26
|
-
tickLabelInterval?: "auto" | ((value: any, index: number) => boolean) | undefined;
|
|
27
|
-
tickSize?: number | undefined;
|
|
28
|
-
tickInterval?: "auto" | ((value: any, index: number) => boolean) | any[] | undefined;
|
|
29
|
-
tickPlacement?: "start" | "end" | "middle" | "extremities" | undefined;
|
|
30
|
-
tickLabelPlacement?: "middle" | "tick" | undefined;
|
|
31
|
-
scaleType?: "time" | "linear" | "band" | "point" | "log" | "pow" | "sqrt" | "utc" | undefined;
|
|
32
|
-
colorMap?: import("../../../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
33
|
-
hideTooltip?: boolean | undefined;
|
|
34
|
-
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
35
|
-
min: number;
|
|
36
|
-
max: number;
|
|
37
|
-
}) | undefined;
|
|
38
|
-
id: import("../../..").AxisId;
|
|
39
|
-
}[];
|
|
5
|
+
export declare function defaultizeAxis(inAxis: readonly MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'x'): AxisConfig<ScaleName, any, ChartsXAxisProps>[];
|
|
6
|
+
export declare function defaultizeAxis(inAxis: readonly MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'y'): AxisConfig<ScaleName, any, ChartsYAxisProps>[];
|
|
@@ -1,24 +1,52 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../../../../constants/index.js";
|
|
2
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY, DEFAULT_AXIS_SIZE_HEIGHT, DEFAULT_AXIS_SIZE_WIDTH } from "../../../../constants/index.js";
|
|
3
3
|
export function defaultizeAxis(inAxis, dataset, axisName) {
|
|
4
4
|
const DEFAULT_AXIS_KEY = axisName === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const offsets = {
|
|
6
|
+
top: 0,
|
|
7
|
+
right: 0,
|
|
8
|
+
bottom: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
none: 0
|
|
11
|
+
};
|
|
12
|
+
const inputAxes = inAxis && inAxis.length > 0 ? inAxis : [{
|
|
10
13
|
id: DEFAULT_AXIS_KEY,
|
|
11
14
|
scaleType: 'linear'
|
|
12
|
-
}]
|
|
15
|
+
}];
|
|
16
|
+
const parsedAxes = inputAxes.map((axisConfig, index) => {
|
|
13
17
|
const dataKey = axisConfig.dataKey;
|
|
18
|
+
const defaultPosition = axisName === 'x' ? 'bottom' : 'left';
|
|
19
|
+
const position = axisConfig.position ?? 'none';
|
|
20
|
+
const dimension = axisName === 'x' ? 'height' : 'width';
|
|
21
|
+
const height = axisName === 'x' ? DEFAULT_AXIS_SIZE_HEIGHT : 0;
|
|
22
|
+
const width = axisName === 'y' ? DEFAULT_AXIS_SIZE_WIDTH : 0;
|
|
23
|
+
const sharedConfig = _extends({
|
|
24
|
+
id: `defaultized-${axisName}-axis-${index}`
|
|
25
|
+
}, index === 0 ? {
|
|
26
|
+
position: defaultPosition
|
|
27
|
+
} : {}, {
|
|
28
|
+
height,
|
|
29
|
+
width,
|
|
30
|
+
offset: offsets[position]
|
|
31
|
+
}, axisConfig);
|
|
32
|
+
|
|
33
|
+
// Increment the offset for the next axis
|
|
34
|
+
if (position !== 'none') {
|
|
35
|
+
offsets[position] += axisConfig[dimension] ?? (dimension === 'height' ? height : width);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// If `dataKey` is NOT provided
|
|
14
39
|
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
15
|
-
return
|
|
40
|
+
return sharedConfig;
|
|
16
41
|
}
|
|
17
42
|
if (dataset === undefined) {
|
|
18
43
|
throw new Error(`MUI X: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
|
|
19
44
|
}
|
|
20
|
-
|
|
45
|
+
|
|
46
|
+
// If `dataKey` is provided
|
|
47
|
+
return _extends({}, sharedConfig, {
|
|
21
48
|
data: dataset.map(d => d[dataKey])
|
|
22
49
|
});
|
|
23
50
|
});
|
|
51
|
+
return parsedAxes;
|
|
24
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { useChartCartesianAxis } from "./useChartCartesianAxis.js";
|
|
2
2
|
export type * from './useChartCartesianAxis.types';
|
|
3
|
-
export * from "./
|
|
3
|
+
export * from "./useChartCartesianAxisRendering.selectors.js";
|
|
4
4
|
export { defaultizeAxis } from "./defaultizeAxis.js";
|
|
5
5
|
export * from "./computeAxisValue.js";
|
|
6
6
|
export * from "./createZoomLookup.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useChartCartesianAxis } from "./useChartCartesianAxis.js";
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./useChartCartesianAxisRendering.selectors.js";
|
|
3
3
|
export { defaultizeAxis } from "./defaultizeAxis.js";
|
|
4
4
|
export * from "./computeAxisValue.js";
|
|
5
5
|
export * from "./createZoomLookup.js";
|