@mui/x-charts 8.0.0-alpha.7 → 8.0.0-alpha.8
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 +9 -1
- package/BarChart/BarLabel/BarLabelPlot.js +1 -1
- package/BarChart/BarPlot.js +8 -9
- package/BarChart/extremums.d.ts +3 -3
- package/BarChart/formatter.d.ts +2 -2
- package/BarChart/formatter.js +2 -1
- package/BarChart/getColor.d.ts +1 -1
- package/BarChart/legend.d.ts +1 -1
- package/BarChart/legend.js +1 -1
- package/BarChart/plugin.d.ts +2 -2
- package/BarChart/plugin.js +1 -2
- package/BarChart/useBarChartProps.d.ts +1 -1
- package/CHANGELOG.md +115 -0
- package/ChartContainer/ChartContainer.d.ts +6 -2
- package/ChartContainer/ChartContainer.js +13 -7
- package/ChartContainer/useChartContainerProps.d.ts +5 -3
- package/ChartContainer/useChartContainerProps.js +7 -5
- package/ChartsAxis/ChartsAxis.js +5 -3
- package/ChartsGrid/ChartsGrid.js +9 -5
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +4 -3
- package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +4 -3
- package/ChartsLabel/ChartsLabelGradient.js +11 -12
- package/ChartsLegend/ContinuousColorLegend.js +3 -3
- package/ChartsLegend/useAxis.js +7 -5
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +7 -6
- package/ChartsSurface/ChartsSurface.js +16 -26
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +6 -3
- package/ChartsTooltip/ChartsTooltipTable.d.ts +0 -6
- package/ChartsTooltip/ChartsTooltipTable.js +0 -20
- package/ChartsTooltip/useAxisTooltip.d.ts +3 -1
- package/ChartsTooltip/useAxisTooltip.js +13 -9
- package/ChartsTooltip/useItemTooltip.d.ts +3 -1
- package/ChartsTooltip/useItemTooltip.js +14 -10
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +16 -9
- package/ChartsXAxis/ChartsXAxis.js +11 -8
- package/ChartsYAxis/ChartsYAxis.js +8 -5
- package/Gauge/Gauge.js +5 -1
- package/Gauge/GaugeContainer.d.ts +3 -10
- package/Gauge/GaugeContainer.js +38 -38
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AppearingMask.js +1 -1
- package/LineChart/AreaPlot.js +16 -15
- package/LineChart/LineChart.js +9 -1
- package/LineChart/LineHighlightPlot.js +14 -11
- package/LineChart/LinePlot.js +16 -15
- package/LineChart/MarkPlot.js +14 -11
- package/LineChart/extremums.d.ts +3 -3
- package/LineChart/formatter.d.ts +2 -2
- package/LineChart/formatter.js +3 -1
- package/LineChart/getColor.d.ts +1 -1
- package/LineChart/legend.d.ts +1 -1
- package/LineChart/legend.js +1 -1
- package/LineChart/plugin.d.ts +2 -2
- package/LineChart/plugin.js +1 -2
- package/LineChart/useLineChartProps.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.js +2 -2
- package/PieChart/PieChart.js +9 -1
- package/PieChart/dataTransform/transition.d.ts +2 -2
- package/PieChart/dataTransform/transition.js +6 -6
- package/PieChart/formatter.d.ts +2 -2
- package/PieChart/formatter.js +4 -1
- package/PieChart/getColor.d.ts +1 -1
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/PieChart/legend.d.ts +1 -1
- package/PieChart/legend.js +1 -1
- package/PieChart/plugin.d.ts +2 -2
- package/PieChart/plugin.js +1 -2
- package/ScatterChart/Scatter.js +6 -4
- package/ScatterChart/ScatterChart.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +16 -12
- package/ScatterChart/ScatterPlot.js +11 -10
- package/ScatterChart/extremums.d.ts +3 -3
- package/ScatterChart/extremums.js +3 -1
- package/ScatterChart/formatter.d.ts +2 -2
- package/ScatterChart/formatter.js +3 -1
- package/ScatterChart/getColor.d.ts +1 -1
- package/ScatterChart/legend.d.ts +1 -1
- package/ScatterChart/legend.js +1 -1
- package/ScatterChart/plugin.d.ts +2 -2
- package/ScatterChart/plugin.js +1 -2
- package/ScatterChart/useScatterChartProps.d.ts +1 -3
- package/ScatterChart/useScatterChartProps.js +1 -4
- package/SparkLineChart/SparkLineChart.d.ts +2 -2
- package/SparkLineChart/SparkLineChart.js +11 -2
- package/context/ChartDataProvider/ChartDataProvider.d.ts +6 -22
- package/context/ChartDataProvider/ChartDataProvider.js +22 -184
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +6 -83
- package/context/ChartDataProvider/useChartDataProviderProps.js +33 -47
- package/context/ChartProvider/ChartProvider.d.ts +5 -1
- package/context/ChartProvider/ChartProvider.js +22 -2
- package/context/ChartProvider/ChartProvider.types.d.ts +17 -2
- package/context/InteractionSelectors.d.ts +33 -33
- package/context/PolarProvider/PolarProvider.d.ts +0 -4
- package/context/PolarProvider/PolarProvider.js +59 -47
- package/context/PolarProvider/getAxisExtremum.d.ts +0 -4
- package/context/PolarProvider/getAxisExtremum.js +48 -20
- package/context/PolarProvider/usePolarContext.d.ts +0 -2
- package/context/PolarProvider/usePolarContext.js +9 -8
- package/context/index.d.ts +0 -2
- package/context/index.js +0 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +3 -1
- package/hooks/useAxis.d.ts +9 -1
- package/hooks/useAxis.js +32 -6
- package/hooks/useAxisEvents.js +12 -8
- package/hooks/useChartGradientId.d.ts +31 -0
- package/hooks/useChartGradientId.js +47 -0
- package/hooks/useColorScale.js +5 -5
- package/hooks/useDrawingArea.d.ts +16 -2
- package/hooks/useDrawingArea.js +5 -20
- package/hooks/useSeries.d.ts +11 -6
- package/hooks/useSeries.js +5 -10
- package/hooks/useZAxis.d.ts +3 -2
- package/hooks/useZAxis.js +25 -6
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +0 -3
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +19 -27
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/internals/defaultizeColor.d.ts +22 -22
- package/internals/index.d.ts +13 -8
- package/internals/index.js +16 -9
- package/internals/plugins/allPlugins.d.ts +12 -1
- package/internals/plugins/allPlugins.js +5 -2
- package/internals/plugins/corePlugins/corePlugins.d.ts +1 -1
- package/internals/plugins/corePlugins/corePlugins.js +3 -1
- package/internals/plugins/corePlugins/useChartDimensions/index.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartDimensions/index.js +2 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +175 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +264 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +25 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +99 -0
- package/internals/plugins/corePlugins/useChartId/index.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartId/index.js +2 -1
- package/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +2 -2
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartSeries/index.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartSeries/index.js +2 -0
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +18 -0
- package/{modern/context/SeriesProvider → internals/plugins/corePlugins/useChartSeries}/processSeries.js +9 -6
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +72 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +61 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +4 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +51 -0
- package/internals/plugins/corePlugins/useChartSeries/useColorProcessor.d.ts +10 -0
- package/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +21 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +29 -0
- package/internals/{computeAxisValue.js → plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js} +19 -27
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +18 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +61 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +39 -0
- package/{modern/context/ChartDataProvider/useDefaultizeAxis.js → internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js} +3 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +6 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +22 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +4 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +68 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts +1372 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +87 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +76 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +18 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +22 -22
- package/internals/plugins/featurePlugins/useChartZAxis/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartZAxis/index.js +2 -0
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +86 -0
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +45 -0
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +3 -0
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +39 -0
- package/internals/plugins/featurePlugins/useChartZAxis/utils.d.ts +0 -0
- package/internals/plugins/featurePlugins/useChartZAxis/utils.js +0 -0
- package/internals/plugins/models/index.d.ts +1 -0
- package/internals/plugins/models/index.js +2 -1
- package/internals/plugins/models/plugin.d.ts +32 -2
- package/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
- package/internals/plugins/models/seriesConfig/extremumGetter.types.d.ts +22 -0
- package/internals/plugins/models/seriesConfig/index.d.ts +4 -0
- package/internals/plugins/models/seriesConfig/index.js +4 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +14 -0
- package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +18 -0
- package/internals/store/extractPluginParamsFromProps.d.ts +7 -0
- package/internals/store/extractPluginParamsFromProps.js +28 -0
- package/internals/store/useChartModels.d.ts +7 -0
- package/internals/store/useChartModels.js +64 -0
- package/internals/store/useCharts.d.ts +4 -2
- package/internals/store/useCharts.js +14 -9
- package/internals/store/useCharts.types.d.ts +1 -1
- package/internals/store/useStore.d.ts +5 -1
- package/internals/store/useStore.js +1 -9
- package/models/layout.d.ts +2 -1
- package/modern/BarChart/BarChart.js +9 -1
- package/modern/BarChart/BarLabel/BarLabelPlot.js +1 -1
- package/modern/BarChart/BarPlot.js +8 -9
- package/modern/BarChart/formatter.js +2 -1
- package/modern/BarChart/legend.js +1 -1
- package/modern/BarChart/plugin.js +1 -2
- package/modern/ChartContainer/ChartContainer.js +13 -7
- package/modern/ChartContainer/useChartContainerProps.js +7 -5
- package/modern/ChartsAxis/ChartsAxis.js +5 -3
- package/modern/ChartsGrid/ChartsGrid.js +9 -5
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +4 -3
- package/modern/ChartsGrid/ChartsVerticalGrid.js +4 -3
- package/modern/ChartsLabel/ChartsLabelGradient.js +11 -12
- package/modern/ChartsLegend/ContinuousColorLegend.js +3 -3
- package/modern/ChartsLegend/useAxis.js +7 -5
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +7 -6
- package/modern/ChartsSurface/ChartsSurface.js +16 -26
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +6 -3
- package/modern/ChartsTooltip/ChartsTooltipTable.js +0 -20
- package/modern/ChartsTooltip/useAxisTooltip.js +13 -9
- package/modern/ChartsTooltip/useItemTooltip.js +14 -10
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +16 -9
- package/modern/ChartsXAxis/ChartsXAxis.js +11 -8
- package/modern/ChartsYAxis/ChartsYAxis.js +8 -5
- package/modern/Gauge/Gauge.js +5 -1
- package/modern/Gauge/GaugeContainer.js +38 -38
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AppearingMask.js +1 -1
- package/modern/LineChart/AreaPlot.js +16 -15
- package/modern/LineChart/LineChart.js +9 -1
- package/modern/LineChart/LineHighlightPlot.js +14 -11
- package/modern/LineChart/LinePlot.js +16 -15
- package/modern/LineChart/MarkPlot.js +14 -11
- package/modern/LineChart/formatter.js +3 -1
- package/modern/LineChart/legend.js +1 -1
- package/modern/LineChart/plugin.js +1 -2
- package/modern/PieChart/PieArcLabelPlot.js +2 -2
- package/modern/PieChart/PieArcPlot.js +2 -2
- package/modern/PieChart/PieChart.js +9 -1
- package/modern/PieChart/dataTransform/transition.js +6 -6
- package/modern/PieChart/formatter.js +4 -1
- package/modern/PieChart/legend.js +1 -1
- package/modern/PieChart/plugin.js +1 -2
- package/modern/ScatterChart/Scatter.js +6 -4
- package/modern/ScatterChart/ScatterChart.js +16 -12
- package/modern/ScatterChart/ScatterPlot.js +11 -10
- package/modern/ScatterChart/extremums.js +3 -1
- package/modern/ScatterChart/formatter.js +3 -1
- package/modern/ScatterChart/legend.js +1 -1
- package/modern/ScatterChart/plugin.js +1 -2
- package/modern/ScatterChart/useScatterChartProps.js +1 -4
- package/modern/SparkLineChart/SparkLineChart.js +11 -2
- package/modern/context/ChartDataProvider/ChartDataProvider.js +22 -184
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +33 -47
- package/modern/context/ChartProvider/ChartProvider.js +22 -2
- package/modern/context/PolarProvider/PolarProvider.js +59 -47
- package/modern/context/PolarProvider/getAxisExtremum.js +48 -20
- package/modern/context/PolarProvider/usePolarContext.js +9 -8
- package/modern/context/index.js +0 -1
- package/modern/hooks/index.js +3 -1
- package/modern/hooks/useAxis.js +32 -6
- package/modern/hooks/useAxisEvents.js +12 -8
- package/modern/hooks/useChartGradientId.js +47 -0
- package/modern/hooks/useColorScale.js +5 -5
- package/modern/hooks/useDrawingArea.js +5 -20
- package/modern/hooks/useSeries.js +5 -10
- package/modern/hooks/useZAxis.js +25 -6
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +19 -27
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/modern/internals/index.js +16 -9
- package/modern/internals/plugins/allPlugins.js +5 -2
- package/modern/internals/plugins/corePlugins/corePlugins.js +3 -1
- package/modern/internals/plugins/corePlugins/useChartDimensions/index.js +2 -0
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +175 -0
- package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +25 -0
- package/modern/internals/plugins/corePlugins/useChartId/index.js +2 -1
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/modern/internals/plugins/corePlugins/useChartSeries/index.js +2 -0
- package/{context/SeriesProvider → modern/internals/plugins/corePlugins/useChartSeries}/processSeries.js +9 -6
- package/modern/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +72 -0
- package/modern/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +4 -0
- package/modern/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +21 -0
- package/modern/internals/{computeAxisValue.js → plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js} +19 -27
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +61 -0
- package/{context/ChartDataProvider/useDefaultizeAxis.js → modern/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js} +3 -11
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +22 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +4 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +68 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +87 -0
- package/modern/internals/plugins/featurePlugins/useChartZAxis/index.js +2 -0
- package/modern/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +86 -0
- package/modern/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +3 -0
- package/modern/internals/plugins/featurePlugins/useChartZAxis/utils.js +0 -0
- package/modern/internals/plugins/models/index.js +2 -1
- package/modern/internals/plugins/models/seriesConfig/index.js +4 -0
- package/modern/internals/plugins/models/seriesConfig/seriesConfig.types.js +1 -0
- package/modern/internals/plugins/models/seriesConfig/seriesProcessor.types.js +1 -0
- package/modern/internals/store/extractPluginParamsFromProps.js +28 -0
- package/modern/internals/store/useChartModels.js +64 -0
- package/modern/internals/store/useCharts.js +14 -9
- package/modern/internals/store/useStore.js +1 -9
- package/node/BarChart/BarChart.js +9 -1
- package/node/BarChart/BarLabel/BarLabelPlot.js +1 -1
- package/node/BarChart/BarPlot.js +6 -6
- package/node/BarChart/formatter.js +2 -1
- package/node/BarChart/legend.js +1 -1
- package/node/BarChart/plugin.js +1 -2
- package/node/ChartContainer/ChartContainer.js +13 -7
- package/node/ChartContainer/useChartContainerProps.js +7 -5
- package/node/ChartsAxis/ChartsAxis.js +5 -3
- package/node/ChartsGrid/ChartsGrid.js +9 -5
- package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -3
- package/node/ChartsGrid/ChartsVerticalGrid.js +4 -3
- package/node/ChartsLabel/ChartsLabelGradient.js +11 -12
- package/node/ChartsLegend/ContinuousColorLegend.js +3 -3
- package/node/ChartsLegend/useAxis.js +6 -4
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +6 -5
- package/node/ChartsSurface/ChartsSurface.js +17 -27
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +5 -2
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +5 -2
- package/node/ChartsTooltip/ChartsTooltipTable.js +1 -21
- package/node/ChartsTooltip/useAxisTooltip.js +11 -7
- package/node/ChartsTooltip/useItemTooltip.js +13 -9
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +19 -12
- package/node/ChartsXAxis/ChartsXAxis.js +11 -8
- package/node/ChartsYAxis/ChartsYAxis.js +8 -5
- package/node/Gauge/Gauge.js +5 -1
- package/node/Gauge/GaugeContainer.js +38 -38
- package/node/LineChart/AnimatedArea.js +1 -1
- package/node/LineChart/AnimatedLine.js +1 -1
- package/node/LineChart/AppearingMask.js +1 -1
- package/node/LineChart/AreaPlot.js +16 -15
- package/node/LineChart/LineChart.js +9 -1
- package/node/LineChart/LineHighlightPlot.js +14 -11
- package/node/LineChart/LinePlot.js +16 -15
- package/node/LineChart/MarkPlot.js +14 -11
- package/node/LineChart/formatter.js +3 -1
- package/node/LineChart/legend.js +1 -1
- package/node/LineChart/plugin.js +1 -2
- package/node/PieChart/PieArcLabelPlot.js +1 -1
- package/node/PieChart/PieArcPlot.js +1 -1
- package/node/PieChart/PieChart.js +9 -1
- package/node/PieChart/dataTransform/transition.js +9 -7
- package/node/PieChart/formatter.js +4 -1
- package/node/PieChart/legend.js +1 -1
- package/node/PieChart/plugin.js +1 -2
- package/node/ScatterChart/Scatter.js +6 -4
- package/node/ScatterChart/ScatterChart.js +16 -12
- package/node/ScatterChart/ScatterPlot.js +10 -9
- package/node/ScatterChart/extremums.js +3 -1
- package/node/ScatterChart/formatter.js +3 -1
- package/node/ScatterChart/legend.js +1 -1
- package/node/ScatterChart/plugin.js +1 -2
- package/node/ScatterChart/useScatterChartProps.js +1 -4
- package/node/SparkLineChart/SparkLineChart.js +10 -1
- package/node/context/ChartDataProvider/ChartDataProvider.js +22 -184
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +34 -47
- package/node/context/ChartProvider/ChartProvider.js +23 -2
- package/node/context/PolarProvider/PolarProvider.js +59 -51
- package/node/context/PolarProvider/getAxisExtremum.js +49 -27
- package/node/context/PolarProvider/usePolarContext.js +9 -14
- package/node/context/index.js +0 -8
- package/node/hooks/index.js +29 -2
- package/node/hooks/useAxis.js +34 -6
- package/node/hooks/useAxisEvents.js +12 -8
- package/node/hooks/useChartGradientId.js +56 -0
- package/node/hooks/useColorScale.js +4 -4
- package/node/hooks/useDrawingArea.js +5 -21
- package/node/hooks/useSeries.js +5 -9
- package/node/hooks/useZAxis.js +27 -9
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +17 -27
- package/node/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/node/internals/index.js +122 -62
- package/node/internals/plugins/allPlugins.js +4 -2
- package/node/internals/plugins/corePlugins/corePlugins.js +3 -1
- package/node/internals/plugins/corePlugins/useChartDimensions/index.js +27 -0
- package/node/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +183 -0
- package/node/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +32 -0
- package/node/internals/plugins/corePlugins/useChartId/index.js +16 -1
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/node/internals/plugins/corePlugins/useChartSeries/index.js +27 -0
- package/node/{context/SeriesProvider → internals/plugins/corePlugins/useChartSeries}/processSeries.js +9 -6
- package/node/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +80 -0
- package/node/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +11 -0
- package/node/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +27 -0
- package/node/internals/{computeAxisValue.js → plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js} +19 -27
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +69 -0
- package/node/{context/ChartDataProvider/useDefaultizeAxis.js → internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js} +4 -13
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +29 -0
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +47 -0
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +76 -0
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +96 -0
- package/node/internals/plugins/featurePlugins/useChartZAxis/index.js +27 -0
- package/node/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +94 -0
- package/node/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +9 -0
- package/node/internals/plugins/featurePlugins/useChartZAxis/utils.js +1 -0
- package/node/internals/plugins/models/index.js +11 -0
- package/node/internals/plugins/models/seriesConfig/index.js +49 -0
- package/node/internals/plugins/models/seriesConfig/seriesProcessor.types.js +5 -0
- package/node/internals/store/extractPluginParamsFromProps.js +36 -0
- package/node/internals/store/useChartModels.js +73 -0
- package/node/internals/store/useCharts.js +14 -9
- package/node/internals/store/useStore.js +1 -9
- package/package.json +3 -3
- package/context/CartesianProvider/Cartesian.types.d.ts +0 -59
- package/context/CartesianProvider/CartesianContext.d.ts +0 -4
- package/context/CartesianProvider/CartesianContext.js +0 -13
- package/context/CartesianProvider/CartesianProvider.d.ts +0 -4
- package/context/CartesianProvider/CartesianProvider.js +0 -49
- package/context/CartesianProvider/defaultizeAxis.d.ts +0 -38
- package/context/CartesianProvider/defaultizeAxis.js +0 -13
- package/context/CartesianProvider/getAxisExtremum.d.ts +0 -5
- package/context/CartesianProvider/getAxisExtremum.js +0 -21
- package/context/CartesianProvider/index.d.ts +0 -4
- package/context/CartesianProvider/index.js +0 -4
- package/context/CartesianProvider/useCartesianContext.d.ts +0 -2
- package/context/CartesianProvider/useCartesianContext.js +0 -10
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +0 -39
- package/context/DrawingAreaProvider/DrawingArea.types.d.ts +0 -51
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +0 -3
- package/context/DrawingAreaProvider/DrawingAreaContext.js +0 -15
- package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +0 -3
- package/context/DrawingAreaProvider/DrawingAreaProvider.js +0 -48
- package/context/DrawingAreaProvider/index.d.ts +0 -3
- package/context/DrawingAreaProvider/index.js +0 -3
- package/context/PluginProvider/ColorProcessor.types.d.ts +0 -8
- package/context/PluginProvider/ExtremumGetter.types.d.ts +0 -25
- package/context/PluginProvider/Plugin.types.d.ts +0 -29
- package/context/PluginProvider/PluginContext.d.ts +0 -4
- package/context/PluginProvider/PluginContext.js +0 -15
- package/context/PluginProvider/PluginProvider.d.ts +0 -4
- package/context/PluginProvider/PluginProvider.js +0 -21
- package/context/PluginProvider/SeriesFormatter.types.d.ts +0 -21
- package/context/PluginProvider/index.d.ts +0 -12
- package/context/PluginProvider/index.js +0 -12
- package/context/PluginProvider/mergePlugins.d.ts +0 -46
- package/context/PluginProvider/mergePlugins.js +0 -40
- package/context/PluginProvider/useColorProcessor.d.ts +0 -4
- package/context/PluginProvider/useColorProcessor.js +0 -17
- package/context/PluginProvider/useRadiusExtremumGetter.d.ts +0 -4
- package/context/PluginProvider/useRadiusExtremumGetter.js +0 -17
- package/context/PluginProvider/useRotationExtremumGetter.d.ts +0 -4
- package/context/PluginProvider/useRotationExtremumGetter.js +0 -17
- package/context/PluginProvider/useSeriesFormatter.d.ts +0 -4
- package/context/PluginProvider/useSeriesFormatter.js +0 -17
- package/context/PluginProvider/useXExtremumGetter.d.ts +0 -4
- package/context/PluginProvider/useXExtremumGetter.js +0 -15
- package/context/PluginProvider/useYExtremumGetter.d.ts +0 -4
- package/context/PluginProvider/useYExtremumGetter.js +0 -15
- package/context/SeriesProvider/Series.types.d.ts +0 -26
- package/context/SeriesProvider/SeriesContext.d.ts +0 -4
- package/context/SeriesProvider/SeriesContext.js +0 -8
- package/context/SeriesProvider/SeriesProvider.d.ts +0 -5
- package/context/SeriesProvider/SeriesProvider.js +0 -33
- package/context/SeriesProvider/index.d.ts +0 -12
- package/context/SeriesProvider/index.js +0 -8
- package/context/SeriesProvider/processSeries.d.ts +0 -18
- package/context/SizeProvider/Size.types.d.ts +0 -30
- package/context/SizeProvider/SizeContext.d.ts +0 -4
- package/context/SizeProvider/SizeContext.js +0 -15
- package/context/SizeProvider/SizeProvider.d.ts +0 -11
- package/context/SizeProvider/SizeProvider.js +0 -26
- package/context/SizeProvider/index.d.ts +0 -4
- package/context/SizeProvider/index.js +0 -4
- package/context/SizeProvider/useChartContainerDimensions.d.ts +0 -9
- package/context/SizeProvider/useChartContainerDimensions.js +0 -108
- package/context/SizeProvider/useSize.d.ts +0 -5
- package/context/SizeProvider/useSize.js +0 -13
- package/context/ZAxisContextProvider.d.ts +0 -33
- package/context/ZAxisContextProvider.js +0 -96
- package/internals/computeAxisValue.d.ts +0 -38
- package/modern/context/CartesianProvider/CartesianContext.js +0 -13
- package/modern/context/CartesianProvider/CartesianProvider.js +0 -49
- package/modern/context/CartesianProvider/defaultizeAxis.js +0 -13
- package/modern/context/CartesianProvider/getAxisExtremum.js +0 -21
- package/modern/context/CartesianProvider/index.js +0 -4
- package/modern/context/CartesianProvider/useCartesianContext.js +0 -10
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +0 -15
- package/modern/context/DrawingAreaProvider/DrawingAreaProvider.js +0 -48
- package/modern/context/DrawingAreaProvider/index.js +0 -3
- package/modern/context/PluginProvider/PluginContext.js +0 -15
- package/modern/context/PluginProvider/PluginProvider.js +0 -21
- package/modern/context/PluginProvider/index.js +0 -12
- package/modern/context/PluginProvider/mergePlugins.js +0 -40
- package/modern/context/PluginProvider/useColorProcessor.js +0 -17
- package/modern/context/PluginProvider/useRadiusExtremumGetter.js +0 -17
- package/modern/context/PluginProvider/useRotationExtremumGetter.js +0 -17
- package/modern/context/PluginProvider/useSeriesFormatter.js +0 -17
- package/modern/context/PluginProvider/useXExtremumGetter.js +0 -15
- package/modern/context/PluginProvider/useYExtremumGetter.js +0 -15
- package/modern/context/SeriesProvider/SeriesContext.js +0 -8
- package/modern/context/SeriesProvider/SeriesProvider.js +0 -33
- package/modern/context/SeriesProvider/index.js +0 -8
- package/modern/context/SizeProvider/SizeContext.js +0 -15
- package/modern/context/SizeProvider/SizeProvider.js +0 -26
- package/modern/context/SizeProvider/index.js +0 -4
- package/modern/context/SizeProvider/useChartContainerDimensions.js +0 -108
- package/modern/context/SizeProvider/useSize.js +0 -13
- package/modern/context/ZAxisContextProvider.js +0 -96
- package/node/context/CartesianProvider/CartesianContext.js +0 -20
- package/node/context/CartesianProvider/CartesianProvider.js +0 -54
- package/node/context/CartesianProvider/defaultizeAxis.js +0 -21
- package/node/context/CartesianProvider/getAxisExtremum.js +0 -28
- package/node/context/CartesianProvider/index.js +0 -49
- package/node/context/CartesianProvider/useCartesianContext.js +0 -17
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +0 -21
- package/node/context/DrawingAreaProvider/DrawingAreaProvider.js +0 -55
- package/node/context/DrawingAreaProvider/index.js +0 -38
- package/node/context/PluginProvider/PluginContext.js +0 -22
- package/node/context/PluginProvider/PluginProvider.js +0 -26
- package/node/context/PluginProvider/index.js +0 -137
- package/node/context/PluginProvider/mergePlugins.js +0 -47
- package/node/context/PluginProvider/useColorProcessor.js +0 -23
- package/node/context/PluginProvider/useRadiusExtremumGetter.js +0 -23
- package/node/context/PluginProvider/useRotationExtremumGetter.js +0 -23
- package/node/context/PluginProvider/useSeriesFormatter.js +0 -23
- package/node/context/PluginProvider/useXExtremumGetter.js +0 -22
- package/node/context/PluginProvider/useYExtremumGetter.js +0 -22
- package/node/context/SeriesProvider/SeriesContext.js +0 -15
- package/node/context/SeriesProvider/SeriesProvider.js +0 -38
- package/node/context/SeriesProvider/index.js +0 -49
- package/node/context/SizeProvider/SizeContext.js +0 -22
- package/node/context/SizeProvider/SizeProvider.js +0 -29
- package/node/context/SizeProvider/index.js +0 -49
- package/node/context/SizeProvider/useChartContainerDimensions.js +0 -116
- package/node/context/SizeProvider/useSize.js +0 -20
- package/node/context/ZAxisContextProvider.js +0 -103
- /package/{context/CartesianProvider/Cartesian.types.js → internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js} +0 -0
- /package/{context/DrawingAreaProvider/DrawingArea.types.js → internals/plugins/corePlugins/useChartSeries/useChartSeries.types.js} +0 -0
- /package/{context/PluginProvider/ColorProcessor.types.js → internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js} +0 -0
- /package/{context/CartesianProvider → internals/plugins/featurePlugins/useChartCartesianAxis}/zoom.d.ts +0 -0
- /package/{context/CartesianProvider → internals/plugins/featurePlugins/useChartCartesianAxis}/zoom.js +0 -0
- /package/{context/PluginProvider/ExtremumGetter.types.js → internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.js} +0 -0
- /package/{context/PluginProvider/Plugin.types.js → internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.js} +0 -0
- /package/{context/PluginProvider/SeriesFormatter.types.js → internals/plugins/models/seriesConfig/colorProcessor.types.js} +0 -0
- /package/{context/SeriesProvider/Series.types.js → internals/plugins/models/seriesConfig/extremumGetter.types.js} +0 -0
- /package/{context/SizeProvider/Size.types.js → internals/plugins/models/seriesConfig/seriesConfig.types.js} +0 -0
- /package/{modern/context/CartesianProvider/Cartesian.types.js → internals/plugins/models/seriesConfig/seriesProcessor.types.js} +0 -0
- /package/modern/{context/DrawingAreaProvider/DrawingArea.types.js → internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js} +0 -0
- /package/modern/{context/PluginProvider/ColorProcessor.types.js → internals/plugins/corePlugins/useChartSeries/useChartSeries.types.js} +0 -0
- /package/modern/{context/PluginProvider/ExtremumGetter.types.js → internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js} +0 -0
- /package/modern/{context/CartesianProvider → internals/plugins/featurePlugins/useChartCartesianAxis}/zoom.js +0 -0
- /package/modern/{context/PluginProvider/Plugin.types.js → internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.js} +0 -0
- /package/modern/{context/PluginProvider/SeriesFormatter.types.js → internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.js} +0 -0
- /package/modern/{context/SeriesProvider/Series.types.js → internals/plugins/models/seriesConfig/colorProcessor.types.js} +0 -0
- /package/modern/{context/SizeProvider/Size.types.js → internals/plugins/models/seriesConfig/extremumGetter.types.js} +0 -0
- /package/node/{context/CartesianProvider/Cartesian.types.js → internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js} +0 -0
- /package/node/{context/DrawingAreaProvider/DrawingArea.types.js → internals/plugins/corePlugins/useChartSeries/useChartSeries.types.js} +0 -0
- /package/node/{context/PluginProvider/ColorProcessor.types.js → internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js} +0 -0
- /package/node/{context/CartesianProvider → internals/plugins/featurePlugins/useChartCartesianAxis}/zoom.js +0 -0
- /package/node/{context/PluginProvider/ExtremumGetter.types.js → internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.js} +0 -0
- /package/node/{context/PluginProvider/Plugin.types.js → internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.js} +0 -0
- /package/node/{context/PluginProvider/SeriesFormatter.types.js → internals/plugins/models/seriesConfig/colorProcessor.types.js} +0 -0
- /package/node/{context/SeriesProvider/Series.types.js → internals/plugins/models/seriesConfig/extremumGetter.types.js} +0 -0
- /package/node/{context/SizeProvider/Size.types.js → internals/plugins/models/seriesConfig/seriesConfig.types.js} +0 -0
package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/index.js";
|
|
3
|
+
import { selectorChartSeriesConfig, selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
import { createSelector } from "../../utils/selectors.js";
|
|
5
|
+
import { computeAxisValue } from "./computeAxisValue.js";
|
|
6
|
+
import { createAxisFilterMapper, createGetAxisFilters } from "./createAxisFilterMapper.js";
|
|
7
|
+
export const createZoomMap = zoom => {
|
|
8
|
+
const zoomItemMap = new Map();
|
|
9
|
+
zoom.forEach(zoomItem => {
|
|
10
|
+
zoomItemMap.set(zoomItem.axisId, zoomItem);
|
|
11
|
+
});
|
|
12
|
+
return zoomItemMap;
|
|
13
|
+
};
|
|
14
|
+
export const selectorChartCartesianAxisState = state => state.cartesianAxis;
|
|
15
|
+
const selectorChartZoomState = state => state.zoom;
|
|
16
|
+
export const selectorChartRawXAxis = createSelector(selectorChartCartesianAxisState, axis => axis?.x);
|
|
17
|
+
export const selectorChartRawYAxis = createSelector(selectorChartCartesianAxisState, axis => axis?.y);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Following selectors are not exported because they exist in the MIT chart only to ba able to reuse the Zoom state from the pro.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const selectorChartZoomMap = createSelector(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
|
|
24
|
+
const selectorChartZoomOptionsLookup = createSelector(selectorChartZoomState, zoom => zoom?.optionsLookup);
|
|
25
|
+
const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartSeriesConfig, selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && createAxisFilterMapper({
|
|
26
|
+
zoomMap,
|
|
27
|
+
zoomOptions,
|
|
28
|
+
seriesConfig,
|
|
29
|
+
formattedSeries,
|
|
30
|
+
direction: 'x'
|
|
31
|
+
}));
|
|
32
|
+
const selectorChartYFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartSeriesConfig, selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && createAxisFilterMapper({
|
|
33
|
+
zoomMap,
|
|
34
|
+
zoomOptions,
|
|
35
|
+
seriesConfig,
|
|
36
|
+
formattedSeries,
|
|
37
|
+
direction: 'y'
|
|
38
|
+
}));
|
|
39
|
+
const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter, selectorChartYFilter, selectorChartRawXAxis, selectorChartRawYAxis], (xMapper, yMapper, xAxis, yAxis) => {
|
|
40
|
+
if (xMapper === undefined || yMapper === undefined) {
|
|
41
|
+
// Early return if there is no zoom.
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const xFilters = xAxis.reduce((acc, axis, index) => {
|
|
45
|
+
const filter = xMapper(axis, index);
|
|
46
|
+
if (filter !== null) {
|
|
47
|
+
acc[axis.id] = filter;
|
|
48
|
+
}
|
|
49
|
+
return acc;
|
|
50
|
+
}, {});
|
|
51
|
+
const yFilters = yAxis.reduce((acc, axis, index) => {
|
|
52
|
+
const filter = yMapper(axis, index);
|
|
53
|
+
if (filter !== null) {
|
|
54
|
+
acc[axis.id] = filter;
|
|
55
|
+
}
|
|
56
|
+
return acc;
|
|
57
|
+
}, {});
|
|
58
|
+
if (Object.keys(xFilters).length === 0 && Object.keys(yFilters).length === 0) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return createGetAxisFilters(_extends({}, xFilters, yFilters));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The only interesting selectors that merge axis data and zoom if provided.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters) => computeAxisValue({
|
|
69
|
+
drawingArea,
|
|
70
|
+
formattedSeries,
|
|
71
|
+
axis,
|
|
72
|
+
seriesConfig,
|
|
73
|
+
axisDirection: 'x',
|
|
74
|
+
zoomMap,
|
|
75
|
+
zoomOptions,
|
|
76
|
+
getFilters
|
|
77
|
+
}));
|
|
78
|
+
export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters) => computeAxisValue({
|
|
79
|
+
drawingArea,
|
|
80
|
+
formattedSeries,
|
|
81
|
+
axis,
|
|
82
|
+
seriesConfig,
|
|
83
|
+
axisDirection: 'y',
|
|
84
|
+
zoomMap,
|
|
85
|
+
zoomOptions,
|
|
86
|
+
getFilters
|
|
87
|
+
}));
|
package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
|
+
import { ChartPluginSignature } from '../../models';
|
|
3
|
+
import { ChartSeriesType, DatasetType } from '../../../../models/seriesType/config';
|
|
4
|
+
import { AxisDefaultized, ScaleName, ChartsXAxisProps, ChartsYAxisProps, AxisId, AxisConfig } from '../../../../models/axis';
|
|
5
|
+
import { UseChartSeriesSignature } from '../../corePlugins/useChartSeries';
|
|
6
|
+
import { ZoomData, ZoomOptions } from './zoom.types';
|
|
7
|
+
export type DefaultizedAxisConfig<AxisProps> = {
|
|
8
|
+
[axisId: AxisId]: AxisDefaultized<ScaleName, any, AxisProps>;
|
|
9
|
+
};
|
|
10
|
+
export type CartesianContextState = {
|
|
11
|
+
/**
|
|
12
|
+
* Mapping from x-axis key to scaling configuration.
|
|
13
|
+
*/
|
|
14
|
+
xAxis: DefaultizedAxisConfig<ChartsXAxisProps>;
|
|
15
|
+
/**
|
|
16
|
+
* Mapping from y-axis key to scaling configuration.
|
|
17
|
+
*/
|
|
18
|
+
yAxis: DefaultizedAxisConfig<ChartsYAxisProps>;
|
|
19
|
+
/**
|
|
20
|
+
* The x-axes IDs sorted by order they got provided.
|
|
21
|
+
*/
|
|
22
|
+
xAxisIds: AxisId[];
|
|
23
|
+
/**
|
|
24
|
+
* The y-axes IDs sorted by order they got provided.
|
|
25
|
+
*/
|
|
26
|
+
yAxisIds: AxisId[];
|
|
27
|
+
};
|
|
28
|
+
export interface UseChartCartesianAxisParameters {
|
|
29
|
+
/**
|
|
30
|
+
* The configuration of the x-axes.
|
|
31
|
+
* If not provided, a default axis config is used.
|
|
32
|
+
* An array of [[AxisConfig]] objects.
|
|
33
|
+
*/
|
|
34
|
+
xAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>[];
|
|
35
|
+
/**
|
|
36
|
+
* The configuration of the y-axes.
|
|
37
|
+
* If not provided, a default axis config is used.
|
|
38
|
+
* An array of [[AxisConfig]] objects.
|
|
39
|
+
*/
|
|
40
|
+
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[];
|
|
41
|
+
dataset?: DatasetType;
|
|
42
|
+
}
|
|
43
|
+
export type UseChartCartesianAxisDefaultizedParameters = UseChartCartesianAxisParameters & {
|
|
44
|
+
defaultizedXAxis: AxisConfig<ScaleName, any, ChartsXAxisProps>[];
|
|
45
|
+
defaultizedYAxis: AxisConfig<ScaleName, any, ChartsYAxisProps>[];
|
|
46
|
+
};
|
|
47
|
+
export interface DefaultizedZoomOptions extends Required<ZoomOptions> {
|
|
48
|
+
axisId: AxisId;
|
|
49
|
+
axisDirection: 'x' | 'y';
|
|
50
|
+
}
|
|
51
|
+
export interface UseChartCartesianAxisState {
|
|
52
|
+
/**
|
|
53
|
+
* @ignore - state populated by the useChartProZoomPlugin
|
|
54
|
+
*/
|
|
55
|
+
zoom?: {
|
|
56
|
+
optionsLookup: Record<AxisId, DefaultizedZoomOptions>;
|
|
57
|
+
isInteracting: boolean;
|
|
58
|
+
zoomData: ZoomData[];
|
|
59
|
+
};
|
|
60
|
+
cartesianAxis: {
|
|
61
|
+
x: AxisConfig<ScaleName, any, ChartsXAxisProps>[];
|
|
62
|
+
y: AxisConfig<ScaleName, any, ChartsYAxisProps>[];
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export type ExtremumFilter = (value: {
|
|
66
|
+
x: number | Date | string | null;
|
|
67
|
+
y: number | Date | string | null;
|
|
68
|
+
}, dataIndex: number) => boolean;
|
|
69
|
+
export interface UseChartCartesianAxisInstance {
|
|
70
|
+
}
|
|
71
|
+
export type UseChartCartesianAxisSignature<SeriesType extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
|
|
72
|
+
params: UseChartCartesianAxisParameters;
|
|
73
|
+
defaultizedParams: UseChartCartesianAxisDefaultizedParameters;
|
|
74
|
+
state: UseChartCartesianAxisState;
|
|
75
|
+
dependencies: [UseChartSeriesSignature<SeriesType>];
|
|
76
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxisId } from '../../../../models/axis';
|
|
2
|
+
import type { ExtremumFilter } from './useChartCartesianAxis.types';
|
|
3
|
+
export type ZoomData = {
|
|
4
|
+
axisId: AxisId;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
};
|
|
8
|
+
export type ZoomFilterMode = 'keep' | 'discard';
|
|
9
|
+
export interface ZoomOptions {
|
|
10
|
+
filterMode?: ZoomFilterMode;
|
|
11
|
+
}
|
|
12
|
+
export type ZoomAxisFilters = Record<AxisId, ExtremumFilter>;
|
|
13
|
+
export type GetZoomAxisFilters = (params: {
|
|
14
|
+
currentAxisId: AxisId | undefined;
|
|
15
|
+
seriesXAxisId?: AxisId;
|
|
16
|
+
seriesYAxisId?: AxisId;
|
|
17
|
+
isDefaultAxis: boolean;
|
|
18
|
+
}) => ExtremumFilter;
|
package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChartRootSelector } from '../../utils/selectors';
|
|
2
2
|
import { UseChartInteractionSignature } from './useChartInteraction.types';
|
|
3
|
-
export declare const selectorChartsInteractionItem: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
3
|
+
export declare const selectorChartsInteractionItem: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
4
4
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
5
5
|
}) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) & {
|
|
6
6
|
clearCache: () => void;
|
|
@@ -28,10 +28,10 @@ export declare const selectorChartsInteractionItem: ((state: import("../../coreP
|
|
|
28
28
|
dependencyRecomputations: () => number;
|
|
29
29
|
resetDependencyRecomputations: () => void;
|
|
30
30
|
} & {
|
|
31
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
32
31
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
32
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
33
33
|
};
|
|
34
|
-
export declare const selectorChartsInteractionAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
34
|
+
export declare const selectorChartsInteractionAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
35
35
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
36
36
|
}) => import("./useChartInteraction.types").AxisInteractionData) & {
|
|
37
37
|
clearCache: () => void;
|
|
@@ -59,10 +59,10 @@ export declare const selectorChartsInteractionAxis: ((state: import("../../coreP
|
|
|
59
59
|
dependencyRecomputations: () => number;
|
|
60
60
|
resetDependencyRecomputations: () => void;
|
|
61
61
|
} & {
|
|
62
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
63
62
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
63
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
64
64
|
};
|
|
65
|
-
export declare const selectorChartsInteractionXAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
65
|
+
export declare const selectorChartsInteractionXAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
66
66
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
67
67
|
}) => {
|
|
68
68
|
value: number | Date | string;
|
|
@@ -102,10 +102,10 @@ export declare const selectorChartsInteractionXAxis: ((state: import("../../core
|
|
|
102
102
|
dependencyRecomputations: () => number;
|
|
103
103
|
resetDependencyRecomputations: () => void;
|
|
104
104
|
} & {
|
|
105
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
106
105
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
106
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
107
107
|
};
|
|
108
|
-
export declare const selectorChartsInteractionYAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
108
|
+
export declare const selectorChartsInteractionYAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
109
109
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
110
110
|
}) => {
|
|
111
111
|
value: number | Date | string;
|
|
@@ -145,10 +145,10 @@ export declare const selectorChartsInteractionYAxis: ((state: import("../../core
|
|
|
145
145
|
dependencyRecomputations: () => number;
|
|
146
146
|
resetDependencyRecomputations: () => void;
|
|
147
147
|
} & {
|
|
148
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
149
148
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
149
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
150
150
|
};
|
|
151
|
-
export declare const selectorChartsInteractionItemIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
151
|
+
export declare const selectorChartsInteractionItemIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
152
152
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
153
153
|
}) => boolean) & {
|
|
154
154
|
clearCache: () => void;
|
|
@@ -162,7 +162,7 @@ export declare const selectorChartsInteractionItemIsDefined: ((state: import("..
|
|
|
162
162
|
resetResultsCount: () => void;
|
|
163
163
|
};
|
|
164
164
|
lastResult: () => boolean;
|
|
165
|
-
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
165
|
+
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
166
166
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
167
167
|
}) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) & {
|
|
168
168
|
clearCache: () => void;
|
|
@@ -190,18 +190,18 @@ export declare const selectorChartsInteractionItemIsDefined: ((state: import("..
|
|
|
190
190
|
dependencyRecomputations: () => number;
|
|
191
191
|
resetDependencyRecomputations: () => void;
|
|
192
192
|
} & {
|
|
193
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
194
193
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
194
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
195
195
|
}];
|
|
196
196
|
recomputations: () => number;
|
|
197
197
|
resetRecomputations: () => void;
|
|
198
198
|
dependencyRecomputations: () => number;
|
|
199
199
|
resetDependencyRecomputations: () => void;
|
|
200
200
|
} & {
|
|
201
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
202
201
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
202
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
203
203
|
};
|
|
204
|
-
export declare const selectorChartsInteractionXAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
204
|
+
export declare const selectorChartsInteractionXAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
205
205
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
206
206
|
}) => boolean) & {
|
|
207
207
|
clearCache: () => void;
|
|
@@ -221,7 +221,7 @@ export declare const selectorChartsInteractionXAxisIsDefined: ((state: import(".
|
|
|
221
221
|
resetResultsCount: () => void;
|
|
222
222
|
};
|
|
223
223
|
lastResult: () => boolean;
|
|
224
|
-
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
224
|
+
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
225
225
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
226
226
|
}) => {
|
|
227
227
|
value: number | Date | string;
|
|
@@ -261,18 +261,18 @@ export declare const selectorChartsInteractionXAxisIsDefined: ((state: import(".
|
|
|
261
261
|
dependencyRecomputations: () => number;
|
|
262
262
|
resetDependencyRecomputations: () => void;
|
|
263
263
|
} & {
|
|
264
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
265
264
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
265
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
266
266
|
}];
|
|
267
267
|
recomputations: () => number;
|
|
268
268
|
resetRecomputations: () => void;
|
|
269
269
|
dependencyRecomputations: () => number;
|
|
270
270
|
resetDependencyRecomputations: () => void;
|
|
271
271
|
} & {
|
|
272
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
273
272
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
273
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
274
274
|
};
|
|
275
|
-
export declare const selectorChartsInteractionYAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
275
|
+
export declare const selectorChartsInteractionYAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
276
276
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
277
277
|
}) => boolean) & {
|
|
278
278
|
clearCache: () => void;
|
|
@@ -292,7 +292,7 @@ export declare const selectorChartsInteractionYAxisIsDefined: ((state: import(".
|
|
|
292
292
|
resetResultsCount: () => void;
|
|
293
293
|
};
|
|
294
294
|
lastResult: () => boolean;
|
|
295
|
-
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
295
|
+
dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
296
296
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
297
297
|
}) => {
|
|
298
298
|
value: number | Date | string;
|
|
@@ -332,18 +332,18 @@ export declare const selectorChartsInteractionYAxisIsDefined: ((state: import(".
|
|
|
332
332
|
dependencyRecomputations: () => number;
|
|
333
333
|
resetDependencyRecomputations: () => void;
|
|
334
334
|
} & {
|
|
335
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
336
335
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
336
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
337
337
|
}];
|
|
338
338
|
recomputations: () => number;
|
|
339
339
|
resetRecomputations: () => void;
|
|
340
340
|
dependencyRecomputations: () => number;
|
|
341
341
|
resetDependencyRecomputations: () => void;
|
|
342
342
|
} & {
|
|
343
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
344
343
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
344
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
345
345
|
};
|
|
346
|
-
export declare const selectorChartsInteractionIsVoronoiEnabled: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
346
|
+
export declare const selectorChartsInteractionIsVoronoiEnabled: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
347
347
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
348
348
|
}) => boolean | undefined) & {
|
|
349
349
|
clearCache: () => void;
|
|
@@ -371,6 +371,6 @@ export declare const selectorChartsInteractionIsVoronoiEnabled: ((state: import(
|
|
|
371
371
|
dependencyRecomputations: () => number;
|
|
372
372
|
resetDependencyRecomputations: () => void;
|
|
373
373
|
} & {
|
|
374
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
375
374
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
375
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
376
376
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { getColorScale, getOrdinalColorScale } from "../../../colorScale.js";
|
|
6
|
+
function addDefaultId(axisConfig, defaultId) {
|
|
7
|
+
if (axisConfig.id !== undefined) {
|
|
8
|
+
return axisConfig;
|
|
9
|
+
}
|
|
10
|
+
return _extends({
|
|
11
|
+
id: defaultId
|
|
12
|
+
}, axisConfig);
|
|
13
|
+
}
|
|
14
|
+
function processColorMap(axisConfig) {
|
|
15
|
+
if (!axisConfig.colorMap) {
|
|
16
|
+
return axisConfig;
|
|
17
|
+
}
|
|
18
|
+
return _extends({}, axisConfig, {
|
|
19
|
+
colorScale: axisConfig.colorMap.type === 'ordinal' && axisConfig.data ? getOrdinalColorScale(_extends({
|
|
20
|
+
values: axisConfig.data
|
|
21
|
+
}, axisConfig.colorMap)) : getColorScale(axisConfig.colorMap.type === 'continuous' ? _extends({
|
|
22
|
+
min: axisConfig.min,
|
|
23
|
+
max: axisConfig.max
|
|
24
|
+
}, axisConfig.colorMap) : axisConfig.colorMap)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function getZAxisState(zAxis, dataset) {
|
|
28
|
+
if (!zAxis || zAxis.length === 0) {
|
|
29
|
+
return {
|
|
30
|
+
axis: {},
|
|
31
|
+
axisIds: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const zAxisLookup = {};
|
|
35
|
+
const axisIds = [];
|
|
36
|
+
zAxis.forEach((axisConfig, index) => {
|
|
37
|
+
const dataKey = axisConfig.dataKey;
|
|
38
|
+
const defaultizedId = axisConfig.id ?? `defaultized-z-axis-${index}`;
|
|
39
|
+
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
40
|
+
zAxisLookup[defaultizedId] = processColorMap(addDefaultId(axisConfig, defaultizedId));
|
|
41
|
+
axisIds.push(defaultizedId);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (dataset === undefined) {
|
|
45
|
+
throw new Error('MUI X: z-axis uses `dataKey` but no `dataset` is provided.');
|
|
46
|
+
}
|
|
47
|
+
zAxisLookup[defaultizedId] = processColorMap(addDefaultId(_extends({}, axisConfig, {
|
|
48
|
+
data: dataset.map(d => d[dataKey])
|
|
49
|
+
}), defaultizedId));
|
|
50
|
+
axisIds.push(defaultizedId);
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
axis: zAxisLookup,
|
|
54
|
+
axisIds
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export const useChartZAxis = ({
|
|
58
|
+
params,
|
|
59
|
+
store
|
|
60
|
+
}) => {
|
|
61
|
+
const {
|
|
62
|
+
zAxis,
|
|
63
|
+
dataset
|
|
64
|
+
} = params;
|
|
65
|
+
|
|
66
|
+
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useChartZAxis`
|
|
67
|
+
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
68
|
+
const isFirstRender = React.useRef(true);
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
if (isFirstRender.current) {
|
|
71
|
+
isFirstRender.current = false;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
store.update(prev => _extends({}, prev, {
|
|
75
|
+
zAxis: getZAxisState(zAxis, dataset)
|
|
76
|
+
}));
|
|
77
|
+
}, [zAxis, dataset, store]);
|
|
78
|
+
return {};
|
|
79
|
+
};
|
|
80
|
+
useChartZAxis.params = {
|
|
81
|
+
zAxis: true,
|
|
82
|
+
dataset: true
|
|
83
|
+
};
|
|
84
|
+
useChartZAxis.getInitialState = params => ({
|
|
85
|
+
zAxis: getZAxisState(params.zAxis, params.dataset)
|
|
86
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ChartState } from '../../models/chart';
|
|
2
|
+
import { UseChartZAxisSignature } from './useChartZAxis.types';
|
|
3
|
+
export declare const selectorChartZAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("../../..").ChartsSeriesConfig> & import("./useChartZAxis.types").UseChartZAxisState & Partial<{}> & {
|
|
4
|
+
cacheKey: import("../../models").ChartStateCacheKey;
|
|
5
|
+
}) => {
|
|
6
|
+
axis: {
|
|
7
|
+
[axisId: string]: import("../../..").ZAxisDefaultized;
|
|
8
|
+
};
|
|
9
|
+
axisIds: import("../../..").AxisId[];
|
|
10
|
+
}) & {
|
|
11
|
+
clearCache: () => void;
|
|
12
|
+
resultsCount: () => number;
|
|
13
|
+
resetResultsCount: () => void;
|
|
14
|
+
} & {
|
|
15
|
+
resultFunc: (resultFuncArgs_0: ChartState<[UseChartZAxisSignature]>) => {
|
|
16
|
+
axis: {
|
|
17
|
+
[axisId: string]: import("../../..").ZAxisDefaultized;
|
|
18
|
+
};
|
|
19
|
+
axisIds: import("../../..").AxisId[];
|
|
20
|
+
};
|
|
21
|
+
memoizedResultFunc: ((resultFuncArgs_0: ChartState<[UseChartZAxisSignature]>) => {
|
|
22
|
+
axis: {
|
|
23
|
+
[axisId: string]: import("../../..").ZAxisDefaultized;
|
|
24
|
+
};
|
|
25
|
+
axisIds: import("../../..").AxisId[];
|
|
26
|
+
}) & {
|
|
27
|
+
clearCache: () => void;
|
|
28
|
+
resultsCount: () => number;
|
|
29
|
+
resetResultsCount: () => void;
|
|
30
|
+
};
|
|
31
|
+
lastResult: () => {
|
|
32
|
+
axis: {
|
|
33
|
+
[axisId: string]: import("../../..").ZAxisDefaultized;
|
|
34
|
+
};
|
|
35
|
+
axisIds: import("../../..").AxisId[];
|
|
36
|
+
};
|
|
37
|
+
dependencies: [(state: ChartState<[UseChartZAxisSignature]>) => ChartState<[UseChartZAxisSignature]>];
|
|
38
|
+
recomputations: () => number;
|
|
39
|
+
resetRecomputations: () => void;
|
|
40
|
+
dependencyRecomputations: () => number;
|
|
41
|
+
resetDependencyRecomputations: () => void;
|
|
42
|
+
} & {
|
|
43
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
44
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
45
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
|
+
import { ChartPluginSignature } from '../../models';
|
|
3
|
+
import { DatasetType } from '../../../../models/seriesType/config';
|
|
4
|
+
import { AxisId } from '../../../../models/axis';
|
|
5
|
+
import { ZAxisConfig, ZAxisDefaultized } from '../../../../models/z-axis';
|
|
6
|
+
type DefaultizedZAxisConfig = {
|
|
7
|
+
[axisId: string]: ZAxisDefaultized;
|
|
8
|
+
};
|
|
9
|
+
export interface UseChartZAxisParameters {
|
|
10
|
+
/**
|
|
11
|
+
* The configuration of the z-axes.
|
|
12
|
+
*/
|
|
13
|
+
zAxis?: MakeOptional<ZAxisConfig, 'id'>[];
|
|
14
|
+
/**
|
|
15
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
16
|
+
*/
|
|
17
|
+
dataset?: DatasetType;
|
|
18
|
+
}
|
|
19
|
+
export type UseChartZAxisDefaultizedParameters = UseChartZAxisParameters;
|
|
20
|
+
export interface UseChartZAxisState {
|
|
21
|
+
zAxis: {
|
|
22
|
+
/**
|
|
23
|
+
* Mapping from z-axis key to scaling configuration.
|
|
24
|
+
*/
|
|
25
|
+
axis: DefaultizedZAxisConfig;
|
|
26
|
+
/**
|
|
27
|
+
* The z-axes IDs sorted by order they got provided.
|
|
28
|
+
*/
|
|
29
|
+
axisIds: AxisId[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface UseChartZAxisInstance {
|
|
33
|
+
}
|
|
34
|
+
export type UseChartZAxisSignature = ChartPluginSignature<{
|
|
35
|
+
params: UseChartZAxisParameters;
|
|
36
|
+
defaultizedParams: UseChartZAxisDefaultizedParameters;
|
|
37
|
+
state: UseChartZAxisState;
|
|
38
|
+
}>;
|
|
39
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -2,13 +2,21 @@ import * as React from 'react';
|
|
|
2
2
|
import type { MergeSignaturesProperty, OptionalIfEmpty } from './helpers';
|
|
3
3
|
import type { ChartCorePluginSignatures } from '../corePlugins';
|
|
4
4
|
import { ChartStore } from '../utils/ChartStore';
|
|
5
|
+
import { ChartSeriesConfig } from './seriesConfig';
|
|
5
6
|
export interface ChartPluginOptions<TSignature extends ChartAnyPluginSignature> {
|
|
6
7
|
instance: ChartUsedInstance<TSignature>;
|
|
7
8
|
params: ChartUsedDefaultizedParams<TSignature>;
|
|
9
|
+
models: ChartUsedControlModels<TSignature>;
|
|
8
10
|
store: ChartUsedStore<TSignature>;
|
|
9
11
|
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
10
12
|
plugins: ChartPlugin<ChartAnyPluginSignature>[];
|
|
13
|
+
seriesConfig: ChartSeriesConfig<any>;
|
|
11
14
|
}
|
|
15
|
+
type ChartControlModelsInitializer<TSignature extends ChartAnyPluginSignature> = {
|
|
16
|
+
[TControlled in keyof TSignature['models']]: {
|
|
17
|
+
getDefaultValue: (params: TSignature['defaultizedParams']) => Exclude<TSignature['defaultizedParams'][TControlled], undefined>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
12
20
|
type ChartResponse<TSignature extends ChartAnyPluginSignature> = OptionalIfEmpty<'publicAPI', TSignature['publicAPI']> & OptionalIfEmpty<'instance', TSignature['instance']>;
|
|
13
21
|
export type ChartPluginSignature<T extends {
|
|
14
22
|
params?: {};
|
|
@@ -16,6 +24,7 @@ export type ChartPluginSignature<T extends {
|
|
|
16
24
|
instance?: {};
|
|
17
25
|
publicAPI?: {};
|
|
18
26
|
state?: {};
|
|
27
|
+
modelNames?: keyof T['defaultizedParams'];
|
|
19
28
|
dependencies?: readonly ChartAnyPluginSignature[];
|
|
20
29
|
optionalDependencies?: readonly ChartAnyPluginSignature[];
|
|
21
30
|
}> = {
|
|
@@ -34,6 +43,12 @@ export type ChartPluginSignature<T extends {
|
|
|
34
43
|
publicAPI: T extends {
|
|
35
44
|
publicAPI: {};
|
|
36
45
|
} ? T['publicAPI'] : {};
|
|
46
|
+
models: T extends {
|
|
47
|
+
defaultizedParams: {};
|
|
48
|
+
modelNames: keyof T['defaultizedParams'];
|
|
49
|
+
} ? {
|
|
50
|
+
[TControlled in T['modelNames']]-?: ChartControlModel<Exclude<T['defaultizedParams'][TControlled], undefined>>;
|
|
51
|
+
} : {};
|
|
37
52
|
dependencies: T extends {
|
|
38
53
|
dependencies: Array<any>;
|
|
39
54
|
} ? T['dependencies'] : [];
|
|
@@ -45,6 +60,7 @@ export type ChartAnyPluginSignature = {
|
|
|
45
60
|
state: any;
|
|
46
61
|
instance: any;
|
|
47
62
|
params: any;
|
|
63
|
+
models: any;
|
|
48
64
|
defaultizedParams: any;
|
|
49
65
|
dependencies: any;
|
|
50
66
|
optionalDependencies: any;
|
|
@@ -55,7 +71,7 @@ type ChartRequiredPlugins<TSignature extends ChartAnyPluginSignature> = [
|
|
|
55
71
|
...TSignature['dependencies']
|
|
56
72
|
];
|
|
57
73
|
type PluginPropertyWithDependencies<TSignature extends ChartAnyPluginSignature, TProperty extends keyof ChartAnyPluginSignature> = TSignature[TProperty] & MergeSignaturesProperty<ChartRequiredPlugins<TSignature>, TProperty> & Partial<MergeSignaturesProperty<TSignature['optionalDependencies'], TProperty>>;
|
|
58
|
-
export type ChartUsedParams<TSignature extends ChartAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'params'>;
|
|
74
|
+
export type ChartUsedParams<TSignature extends ChartAnyPluginSignature> = MergeSignaturesProperty<TSignature['dependencies'], 'defaultizedParams'> & PluginPropertyWithDependencies<TSignature, 'params'>;
|
|
59
75
|
type ChartUsedDefaultizedParams<TSignature extends ChartAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'defaultizedParams'>;
|
|
60
76
|
export type ChartUsedInstance<TSignature extends ChartAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'instance'> & {
|
|
61
77
|
/**
|
|
@@ -63,13 +79,27 @@ export type ChartUsedInstance<TSignature extends ChartAnyPluginSignature> = Plug
|
|
|
63
79
|
*/
|
|
64
80
|
$$signature: TSignature;
|
|
65
81
|
};
|
|
82
|
+
export interface ChartControlModel<TValue> {
|
|
83
|
+
name: string;
|
|
84
|
+
value: TValue;
|
|
85
|
+
setControlledValue: (value: TValue | ((prevValue: TValue) => TValue)) => void;
|
|
86
|
+
isControlled: boolean;
|
|
87
|
+
}
|
|
88
|
+
type RemoveSetValue<Models extends Record<string, ChartControlModel<any>>> = {
|
|
89
|
+
[K in keyof Models]: Omit<Models[K], 'setValue'>;
|
|
90
|
+
};
|
|
91
|
+
export type ChartUsedControlModels<TSignature extends ChartAnyPluginSignature> = TSignature['models'] & RemoveSetValue<MergeSignaturesProperty<ChartRequiredPlugins<TSignature>, 'models'>>;
|
|
66
92
|
export type ChartUsedStore<TSignature extends ChartAnyPluginSignature> = ChartStore<[
|
|
67
93
|
TSignature,
|
|
68
94
|
...TSignature['dependencies']
|
|
69
95
|
]>;
|
|
70
96
|
export type ChartPlugin<TSignature extends ChartAnyPluginSignature> = {
|
|
71
97
|
(options: ChartPluginOptions<TSignature>): ChartResponse<TSignature>;
|
|
72
|
-
getInitialState?: (params: ChartUsedDefaultizedParams<TSignature>) => TSignature['state'];
|
|
98
|
+
getInitialState?: (params: ChartUsedDefaultizedParams<TSignature>, currentState: MergeSignaturesProperty<ChartRequiredPlugins<TSignature>, 'state'>, seriesConfig: ChartSeriesConfig<any>) => TSignature['state'];
|
|
99
|
+
models?: ChartControlModelsInitializer<TSignature>;
|
|
73
100
|
params: Record<keyof TSignature['params'], true>;
|
|
101
|
+
getDefaultizedParams?: (options: {
|
|
102
|
+
params: ChartUsedParams<TSignature>;
|
|
103
|
+
}) => TSignature['defaultizedParams'];
|
|
74
104
|
};
|
|
75
105
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AxisDefaultized } from '../../../../models/axis';
|
|
2
|
+
import type { DefaultizedSeriesType } from '../../../../models/seriesType';
|
|
3
|
+
import type { ZAxisDefaultized } from '../../../../models/z-axis';
|
|
4
|
+
import type { ChartSeriesType } from '../../../../models/seriesType/config';
|
|
5
|
+
export type ColorProcessor<TSeriesType extends ChartSeriesType> = (series: DefaultizedSeriesType<TSeriesType>, xAxis?: AxisDefaultized, yAxis?: AxisDefaultized, zAxis?: ZAxisDefaultized) => (dataIndex: number) => string;
|