@mui/x-charts 8.0.0-alpha.7 → 8.0.0-alpha.9
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 +10 -2
- 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 +3 -2
- package/BarChart/useBarChartProps.d.ts +1 -1
- package/CHANGELOG.md +551 -3
- package/ChartContainer/ChartContainer.d.ts +8 -4
- package/ChartContainer/ChartContainer.js +15 -9
- package/ChartContainer/useChartContainerProps.d.ts +6 -4
- package/ChartContainer/useChartContainerProps.js +7 -5
- package/ChartDataProvider/ChartDataProvider.d.ts +42 -0
- package/ChartDataProvider/ChartDataProvider.js +108 -0
- package/ChartDataProvider/package.json +6 -0
- package/ChartDataProvider/useChartDataProviderProps.d.ts +13 -0
- package/ChartDataProvider/useChartDataProviderProps.js +52 -0
- 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.d.ts +1 -1
- package/ChartsSurface/ChartsSurface.js +17 -27
- 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/ChartsTooltip/utils.js +2 -0
- 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/Gauge/GaugeProvider.js +2 -0
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AppearingMask.js +1 -1
- package/LineChart/AreaPlot.js +59 -25
- package/LineChart/CircleMarkElement.d.ts +0 -4
- package/LineChart/CircleMarkElement.js +2 -7
- package/LineChart/LineChart.d.ts +0 -4
- package/LineChart/LineChart.js +10 -6
- package/LineChart/LineHighlightElement.d.ts +5 -1
- package/LineChart/LineHighlightElement.js +29 -9
- package/LineChart/LineHighlightPlot.js +18 -13
- package/LineChart/LinePlot.js +59 -24
- package/LineChart/MarkPlot.d.ts +0 -6
- package/LineChart/MarkPlot.js +20 -23
- 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 +3 -2
- package/LineChart/useLineChartProps.d.ts +1 -1
- package/LineChart/useLineChartProps.js +3 -5
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.js +2 -2
- package/PieChart/PieChart.js +10 -2
- 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 +3 -2
- package/ScatterChart/Scatter.js +6 -4
- package/ScatterChart/ScatterChart.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +17 -13
- 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 +3 -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/AnimationProvider/AnimationProvider.js +1 -1
- 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 +22 -22
- 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 -4
- package/context/index.js +1 -3
- 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/useLegend.js +8 -13
- 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.d.ts +1 -0
- package/index.js +3 -2
- 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 +24 -22
- package/internals/index.d.ts +14 -10
- package/internals/index.js +17 -11
- 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 +1 -1
- 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 +6 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +5 -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 +1336 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +89 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +75 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +18 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +11 -11
- 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 +15 -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/models/seriesType/line.d.ts +11 -0
- package/modern/BarChart/BarChart.js +10 -2
- 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 +3 -2
- package/modern/ChartContainer/ChartContainer.js +15 -9
- package/modern/ChartContainer/useChartContainerProps.js +7 -5
- package/modern/ChartDataProvider/ChartDataProvider.js +108 -0
- package/modern/ChartDataProvider/useChartDataProviderProps.js +52 -0
- 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 +17 -27
- 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/ChartsTooltip/utils.js +2 -0
- 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/Gauge/GaugeProvider.js +2 -0
- 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 +59 -25
- package/modern/LineChart/CircleMarkElement.js +2 -7
- package/modern/LineChart/LineChart.js +10 -6
- package/modern/LineChart/LineHighlightElement.js +29 -9
- package/modern/LineChart/LineHighlightPlot.js +18 -13
- package/modern/LineChart/LinePlot.js +59 -24
- package/modern/LineChart/MarkPlot.js +20 -23
- package/modern/LineChart/formatter.js +3 -1
- package/modern/LineChart/legend.js +1 -1
- package/modern/LineChart/plugin.js +3 -2
- package/modern/LineChart/useLineChartProps.js +3 -5
- package/modern/PieChart/PieArcLabelPlot.js +2 -2
- package/modern/PieChart/PieArcPlot.js +2 -2
- package/modern/PieChart/PieChart.js +10 -2
- 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 +3 -2
- package/modern/ScatterChart/Scatter.js +6 -4
- package/modern/ScatterChart/ScatterChart.js +17 -13
- 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 +3 -2
- package/modern/ScatterChart/useScatterChartProps.js +1 -4
- package/modern/SparkLineChart/SparkLineChart.js +11 -2
- package/modern/context/AnimationProvider/AnimationProvider.js +1 -1
- 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 +1 -3
- 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/useLegend.js +8 -13
- package/modern/hooks/useSeries.js +5 -10
- package/modern/hooks/useZAxis.js +25 -6
- package/modern/index.js +3 -2
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +19 -27
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/modern/internals/index.js +17 -11
- 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 +5 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +68 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +89 -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 +11 -3
- 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 +3 -2
- package/node/ChartContainer/ChartContainer.js +15 -9
- package/node/ChartContainer/useChartContainerProps.js +7 -5
- package/node/ChartDataProvider/ChartDataProvider.js +114 -0
- package/node/ChartDataProvider/useChartDataProviderProps.js +59 -0
- 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 +18 -28
- 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/ChartsTooltip/utils.js +1 -0
- 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/Gauge/GaugeProvider.js +2 -2
- 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 +59 -25
- package/node/LineChart/CircleMarkElement.js +2 -7
- package/node/LineChart/LineChart.js +11 -7
- package/node/LineChart/LineHighlightElement.js +29 -9
- package/node/LineChart/LineHighlightPlot.js +18 -13
- package/node/LineChart/LinePlot.js +59 -24
- package/node/LineChart/MarkPlot.js +20 -23
- package/node/LineChart/formatter.js +3 -1
- package/node/LineChart/legend.js +1 -1
- package/node/LineChart/plugin.js +3 -2
- package/node/LineChart/useLineChartProps.js +3 -5
- package/node/PieChart/PieArcLabelPlot.js +1 -1
- package/node/PieChart/PieArcPlot.js +1 -1
- package/node/PieChart/PieChart.js +11 -3
- 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 +3 -2
- package/node/ScatterChart/Scatter.js +6 -4
- package/node/ScatterChart/ScatterChart.js +18 -14
- 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 +3 -2
- package/node/ScatterChart/useScatterChartProps.js +1 -4
- package/node/SparkLineChart/SparkLineChart.js +10 -1
- package/node/context/AnimationProvider/AnimationProvider.js +1 -1
- 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 +1 -20
- 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/useLegend.js +8 -14
- package/node/hooks/useSeries.js +5 -9
- package/node/hooks/useZAxis.js +27 -9
- package/node/index.js +12 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +17 -27
- package/node/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/node/internals/index.js +111 -63
- 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 +59 -0
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +76 -0
- package/node/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +98 -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/ChartDataProvider.d.ts +0 -58
- package/context/ChartDataProvider/ChartDataProvider.js +0 -270
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +0 -90
- package/context/ChartDataProvider/useChartDataProviderProps.js +0 -66
- 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/ChartDataProvider/ChartDataProvider.js +0 -270
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +0 -66
- 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/ChartDataProvider/ChartDataProvider.js +0 -276
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +0 -72
- 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/ChartDataProvider → ChartDataProvider}/index.d.ts +0 -0
- /package/{context/ChartDataProvider → ChartDataProvider}/index.js +0 -0
- /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/ChartDataProvider → ChartDataProvider}/index.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/ChartDataProvider → ChartDataProvider}/index.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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAxisExtremum = void 0;
|
|
7
|
+
var _isCartesian = require("../../../isCartesian");
|
|
8
|
+
const axisExtremumCallback = (acc, chartType, axis, axisDirection, seriesConfig, axisIndex, formattedSeries, getFilters) => {
|
|
9
|
+
const getter = axisDirection === 'x' ? seriesConfig[chartType].xExtremumGetter : seriesConfig[chartType].yExtremumGetter;
|
|
10
|
+
const series = formattedSeries[chartType]?.series ?? {};
|
|
11
|
+
const [minChartTypeData, maxChartTypeData] = getter?.({
|
|
12
|
+
series,
|
|
13
|
+
axis,
|
|
14
|
+
axisIndex,
|
|
15
|
+
isDefaultAxis: axisIndex === 0,
|
|
16
|
+
getFilters
|
|
17
|
+
}) ?? [Infinity, -Infinity];
|
|
18
|
+
const [minData, maxData] = acc;
|
|
19
|
+
return [Math.min(minChartTypeData, minData), Math.max(maxChartTypeData, maxData)];
|
|
20
|
+
};
|
|
21
|
+
const getAxisExtremum = (axis, axisDirection, seriesConfig, axisIndex, formattedSeries, getFilters) => {
|
|
22
|
+
const charTypes = Object.keys(seriesConfig).filter(_isCartesian.isCartesianSeriesType);
|
|
23
|
+
const extremums = charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, axisDirection, seriesConfig, axisIndex, formattedSeries, getFilters), [Infinity, -Infinity]);
|
|
24
|
+
if (Number.isNaN(extremums[0]) || Number.isNaN(extremums[1])) {
|
|
25
|
+
return [Infinity, -Infinity];
|
|
26
|
+
}
|
|
27
|
+
return extremums;
|
|
28
|
+
};
|
|
29
|
+
exports.getAxisExtremum = getAxisExtremum;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useChartCartesianAxis: true,
|
|
8
|
+
defaultizeAxis: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "defaultizeAxis", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _defaultizeAxis.defaultizeAxis;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "useChartCartesianAxis", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _useChartCartesianAxis.useChartCartesianAxis;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _useChartCartesianAxis = require("./useChartCartesianAxis");
|
|
23
|
+
var _useChartCartesianAxis2 = require("./useChartCartesianAxis.selectors");
|
|
24
|
+
Object.keys(_useChartCartesianAxis2).forEach(function (key) {
|
|
25
|
+
if (key === "default" || key === "__esModule") return;
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
+
if (key in exports && exports[key] === _useChartCartesianAxis2[key]) return;
|
|
28
|
+
Object.defineProperty(exports, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _useChartCartesianAxis2[key];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var _defaultizeAxis = require("./defaultizeAxis");
|
|
36
|
+
var _computeAxisValue = require("./computeAxisValue");
|
|
37
|
+
Object.keys(_computeAxisValue).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _computeAxisValue[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _computeAxisValue[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var _zoom = require("./zoom.types");
|
|
49
|
+
Object.keys(_zoom).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
52
|
+
if (key in exports && exports[key] === _zoom[key]) return;
|
|
53
|
+
Object.defineProperty(exports, key, {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return _zoom[key];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.useChartCartesianAxis = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _warning = require("@mui/x-internals/warning");
|
|
13
|
+
var _colorPalettes = require("../../../../colorPalettes");
|
|
14
|
+
var _useSelector = require("../../../store/useSelector");
|
|
15
|
+
var _useChartDimensions = require("../../corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
16
|
+
var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
|
|
17
|
+
var _defaultizeAxis = require("./defaultizeAxis");
|
|
18
|
+
const useChartCartesianAxis = ({
|
|
19
|
+
params,
|
|
20
|
+
store,
|
|
21
|
+
seriesConfig
|
|
22
|
+
}) => {
|
|
23
|
+
const {
|
|
24
|
+
xAxis,
|
|
25
|
+
yAxis,
|
|
26
|
+
dataset
|
|
27
|
+
} = params;
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
const ids = [...(xAxis ?? []), ...(yAxis ?? [])].filter(axis => axis.id).map(axis => axis.id);
|
|
30
|
+
const duplicates = new Set(ids.filter((id, index) => ids.indexOf(id) !== index));
|
|
31
|
+
if (duplicates.size > 0) {
|
|
32
|
+
(0, _warning.warnOnce)([`MUI X: The following axis ids are duplicated: ${Array.from(duplicates).join(', ')}.`, `Please make sure that each axis has a unique id.`].join('\n'), 'error');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const drawingArea = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartDrawingArea);
|
|
36
|
+
const formattedSeries = (0, _useSelector.useSelector)(store, _useChartSeries.selectorChartSeriesState);
|
|
37
|
+
|
|
38
|
+
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useChartCartesianAxis`
|
|
39
|
+
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
40
|
+
const isFirstRender = React.useRef(true);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (isFirstRender.current) {
|
|
43
|
+
isFirstRender.current = false;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
47
|
+
cartesianAxis: (0, _extends2.default)({}, prev.cartesianAxis, {
|
|
48
|
+
x: (0, _defaultizeAxis.defaultizeAxis)(xAxis, dataset, 'x'),
|
|
49
|
+
y: (0, _defaultizeAxis.defaultizeAxis)(yAxis, dataset, 'y')
|
|
50
|
+
})
|
|
51
|
+
}));
|
|
52
|
+
}, [seriesConfig, drawingArea, formattedSeries, xAxis, yAxis, dataset, store]);
|
|
53
|
+
return {};
|
|
54
|
+
};
|
|
55
|
+
exports.useChartCartesianAxis = useChartCartesianAxis;
|
|
56
|
+
useChartCartesianAxis.params = {
|
|
57
|
+
xAxis: true,
|
|
58
|
+
yAxis: true,
|
|
59
|
+
dataset: true
|
|
60
|
+
};
|
|
61
|
+
useChartCartesianAxis.getDefaultizedParams = ({
|
|
62
|
+
params
|
|
63
|
+
}) => {
|
|
64
|
+
return (0, _extends2.default)({}, params, {
|
|
65
|
+
colors: params.colors ?? _colorPalettes.blueberryTwilightPalette,
|
|
66
|
+
theme: params.theme ?? 'light',
|
|
67
|
+
defaultizedXAxis: (0, _defaultizeAxis.defaultizeAxis)(params.xAxis, params.dataset, 'x'),
|
|
68
|
+
defaultizedYAxis: (0, _defaultizeAxis.defaultizeAxis)(params.yAxis, params.dataset, 'y')
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
useChartCartesianAxis.getInitialState = params => ({
|
|
72
|
+
cartesianAxis: {
|
|
73
|
+
x: params.defaultizedXAxis,
|
|
74
|
+
y: params.defaultizedYAxis
|
|
75
|
+
}
|
|
76
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.selectorChartYAxis = exports.selectorChartXAxis = exports.selectorChartRawYAxis = exports.selectorChartRawXAxis = exports.selectorChartCartesianAxisState = exports.createZoomMap = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
10
|
+
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
11
|
+
var _selectors = require("../../utils/selectors");
|
|
12
|
+
var _computeAxisValue = require("./computeAxisValue");
|
|
13
|
+
var _createAxisFilterMapper = require("./createAxisFilterMapper");
|
|
14
|
+
const createZoomMap = zoom => {
|
|
15
|
+
const zoomItemMap = new Map();
|
|
16
|
+
zoom.forEach(zoomItem => {
|
|
17
|
+
zoomItemMap.set(zoomItem.axisId, zoomItem);
|
|
18
|
+
});
|
|
19
|
+
return zoomItemMap;
|
|
20
|
+
};
|
|
21
|
+
exports.createZoomMap = createZoomMap;
|
|
22
|
+
const selectorChartCartesianAxisState = state => state.cartesianAxis;
|
|
23
|
+
exports.selectorChartCartesianAxisState = selectorChartCartesianAxisState;
|
|
24
|
+
const selectorChartZoomState = state => state.zoom;
|
|
25
|
+
const selectorChartRawXAxis = exports.selectorChartRawXAxis = (0, _selectors.createSelector)(selectorChartCartesianAxisState, axis => axis?.x);
|
|
26
|
+
const selectorChartRawYAxis = exports.selectorChartRawYAxis = (0, _selectors.createSelector)(selectorChartCartesianAxisState, axis => axis?.y);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Following selectors are not exported because they exist in the MIT chart only to ba able to reuse the Zoom state from the pro.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const selectorChartZoomMap = (0, _selectors.createSelector)(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
|
|
33
|
+
const selectorChartZoomOptionsLookup = (0, _selectors.createSelector)(selectorChartZoomState, () => undefined);
|
|
34
|
+
const selectorChartXFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup, _useChartSeries.selectorChartSeriesConfig, _useChartSeries.selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)({
|
|
35
|
+
zoomMap,
|
|
36
|
+
zoomOptions,
|
|
37
|
+
seriesConfig,
|
|
38
|
+
formattedSeries,
|
|
39
|
+
direction: 'x'
|
|
40
|
+
}));
|
|
41
|
+
const selectorChartYFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup, _useChartSeries.selectorChartSeriesConfig, _useChartSeries.selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)({
|
|
42
|
+
zoomMap,
|
|
43
|
+
zoomOptions,
|
|
44
|
+
seriesConfig,
|
|
45
|
+
formattedSeries,
|
|
46
|
+
direction: 'y'
|
|
47
|
+
}));
|
|
48
|
+
const selectorChartZoomAxisFilters = (0, _selectors.createSelector)([selectorChartXFilter, selectorChartYFilter, selectorChartRawXAxis, selectorChartRawYAxis], (xMapper, yMapper, xAxis, yAxis) => {
|
|
49
|
+
if (xMapper === undefined || yMapper === undefined) {
|
|
50
|
+
// Early return if there is no zoom.
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const xFilters = xAxis.reduce((acc, axis, index) => {
|
|
54
|
+
// @ts-expect-error The type is defined in the pro package
|
|
55
|
+
const filter = xMapper(axis, index);
|
|
56
|
+
if (filter !== null) {
|
|
57
|
+
acc[axis.id] = filter;
|
|
58
|
+
}
|
|
59
|
+
return acc;
|
|
60
|
+
}, {});
|
|
61
|
+
const yFilters = yAxis.reduce((acc, axis, index) => {
|
|
62
|
+
// @ts-expect-error The type is defined in the pro package
|
|
63
|
+
const filter = yMapper(axis, index);
|
|
64
|
+
if (filter !== null) {
|
|
65
|
+
acc[axis.id] = filter;
|
|
66
|
+
}
|
|
67
|
+
return acc;
|
|
68
|
+
}, {});
|
|
69
|
+
if (Object.keys(xFilters).length === 0 && Object.keys(yFilters).length === 0) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
return (0, _createAxisFilterMapper.createGetAxisFilters)((0, _extends2.default)({}, xFilters, yFilters));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The only interesting selectors that merge axis data and zoom if provided.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSelector)([selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters) => (0, _computeAxisValue.computeAxisValue)({
|
|
80
|
+
drawingArea,
|
|
81
|
+
formattedSeries,
|
|
82
|
+
axis,
|
|
83
|
+
seriesConfig,
|
|
84
|
+
axisDirection: 'x',
|
|
85
|
+
zoomMap,
|
|
86
|
+
zoomOptions,
|
|
87
|
+
getFilters
|
|
88
|
+
}));
|
|
89
|
+
const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSelector)([selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters) => (0, _computeAxisValue.computeAxisValue)({
|
|
90
|
+
drawingArea,
|
|
91
|
+
formattedSeries,
|
|
92
|
+
axis,
|
|
93
|
+
seriesConfig,
|
|
94
|
+
axisDirection: 'y',
|
|
95
|
+
zoomMap,
|
|
96
|
+
zoomOptions,
|
|
97
|
+
getFilters
|
|
98
|
+
}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useChartZAxis: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "useChartZAxis", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _useChartZAxis.useChartZAxis;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _useChartZAxis = require("./useChartZAxis");
|
|
16
|
+
var _useChartZAxis2 = require("./useChartZAxis.selectors");
|
|
17
|
+
Object.keys(_useChartZAxis2).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _useChartZAxis2[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useChartZAxis2[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.useChartZAxis = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _colorScale = require("../../../colorScale");
|
|
13
|
+
function addDefaultId(axisConfig, defaultId) {
|
|
14
|
+
if (axisConfig.id !== undefined) {
|
|
15
|
+
return axisConfig;
|
|
16
|
+
}
|
|
17
|
+
return (0, _extends2.default)({
|
|
18
|
+
id: defaultId
|
|
19
|
+
}, axisConfig);
|
|
20
|
+
}
|
|
21
|
+
function processColorMap(axisConfig) {
|
|
22
|
+
if (!axisConfig.colorMap) {
|
|
23
|
+
return axisConfig;
|
|
24
|
+
}
|
|
25
|
+
return (0, _extends2.default)({}, axisConfig, {
|
|
26
|
+
colorScale: axisConfig.colorMap.type === 'ordinal' && axisConfig.data ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
27
|
+
values: axisConfig.data
|
|
28
|
+
}, axisConfig.colorMap)) : (0, _colorScale.getColorScale)(axisConfig.colorMap.type === 'continuous' ? (0, _extends2.default)({
|
|
29
|
+
min: axisConfig.min,
|
|
30
|
+
max: axisConfig.max
|
|
31
|
+
}, axisConfig.colorMap) : axisConfig.colorMap)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function getZAxisState(zAxis, dataset) {
|
|
35
|
+
if (!zAxis || zAxis.length === 0) {
|
|
36
|
+
return {
|
|
37
|
+
axis: {},
|
|
38
|
+
axisIds: []
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const zAxisLookup = {};
|
|
42
|
+
const axisIds = [];
|
|
43
|
+
zAxis.forEach((axisConfig, index) => {
|
|
44
|
+
const dataKey = axisConfig.dataKey;
|
|
45
|
+
const defaultizedId = axisConfig.id ?? `defaultized-z-axis-${index}`;
|
|
46
|
+
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
47
|
+
zAxisLookup[defaultizedId] = processColorMap(addDefaultId(axisConfig, defaultizedId));
|
|
48
|
+
axisIds.push(defaultizedId);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (dataset === undefined) {
|
|
52
|
+
throw new Error('MUI X: z-axis uses `dataKey` but no `dataset` is provided.');
|
|
53
|
+
}
|
|
54
|
+
zAxisLookup[defaultizedId] = processColorMap(addDefaultId((0, _extends2.default)({}, axisConfig, {
|
|
55
|
+
data: dataset.map(d => d[dataKey])
|
|
56
|
+
}), defaultizedId));
|
|
57
|
+
axisIds.push(defaultizedId);
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
axis: zAxisLookup,
|
|
61
|
+
axisIds
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const useChartZAxis = ({
|
|
65
|
+
params,
|
|
66
|
+
store
|
|
67
|
+
}) => {
|
|
68
|
+
const {
|
|
69
|
+
zAxis,
|
|
70
|
+
dataset
|
|
71
|
+
} = params;
|
|
72
|
+
|
|
73
|
+
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useChartZAxis`
|
|
74
|
+
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
75
|
+
const isFirstRender = React.useRef(true);
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (isFirstRender.current) {
|
|
78
|
+
isFirstRender.current = false;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
82
|
+
zAxis: getZAxisState(zAxis, dataset)
|
|
83
|
+
}));
|
|
84
|
+
}, [zAxis, dataset, store]);
|
|
85
|
+
return {};
|
|
86
|
+
};
|
|
87
|
+
exports.useChartZAxis = useChartZAxis;
|
|
88
|
+
useChartZAxis.params = {
|
|
89
|
+
zAxis: true,
|
|
90
|
+
dataset: true
|
|
91
|
+
};
|
|
92
|
+
useChartZAxis.getInitialState = params => ({
|
|
93
|
+
zAxis: getZAxisState(params.zAxis, params.dataset)
|
|
94
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorChartZAxis = void 0;
|
|
7
|
+
var _selectors = require("../../utils/selectors");
|
|
8
|
+
const selectRootState = state => state;
|
|
9
|
+
const selectorChartZAxis = exports.selectorChartZAxis = (0, _selectors.createSelector)([selectRootState], state => state.zAxis);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -35,4 +35,15 @@ Object.keys(_chart).forEach(function (key) {
|
|
|
35
35
|
return _chart[key];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
});
|
|
39
|
+
var _seriesConfig = require("./seriesConfig");
|
|
40
|
+
Object.keys(_seriesConfig).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _seriesConfig[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _seriesConfig[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
38
49
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _colorProcessor = require("./colorProcessor.types");
|
|
7
|
+
Object.keys(_colorProcessor).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _colorProcessor[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _colorProcessor[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _extremumGetter = require("./extremumGetter.types");
|
|
18
|
+
Object.keys(_extremumGetter).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _extremumGetter[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _extremumGetter[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _seriesConfig = require("./seriesConfig.types");
|
|
29
|
+
Object.keys(_seriesConfig).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _seriesConfig[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _seriesConfig[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _seriesProcessor = require("./seriesProcessor.types");
|
|
40
|
+
Object.keys(_seriesProcessor).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _seriesProcessor[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _seriesProcessor[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.extractPluginParamsFromProps = void 0;
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
|
+
const _excluded = ["apiRef"];
|
|
10
|
+
const extractPluginParamsFromProps = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
plugins
|
|
13
|
+
} = _ref,
|
|
14
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref.props, _excluded);
|
|
15
|
+
const paramsLookup = {};
|
|
16
|
+
plugins.forEach(plugin => {
|
|
17
|
+
Object.assign(paramsLookup, plugin.params);
|
|
18
|
+
});
|
|
19
|
+
const pluginParams = {};
|
|
20
|
+
Object.keys(props).forEach(propName => {
|
|
21
|
+
const prop = props[propName];
|
|
22
|
+
if (paramsLookup[propName]) {
|
|
23
|
+
pluginParams[propName] = prop;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const defaultizedPluginParams = plugins.reduce((acc, plugin) => {
|
|
27
|
+
if (plugin.getDefaultizedParams) {
|
|
28
|
+
return plugin.getDefaultizedParams({
|
|
29
|
+
params: acc
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
}, pluginParams);
|
|
34
|
+
return defaultizedPluginParams;
|
|
35
|
+
};
|
|
36
|
+
exports.extractPluginParamsFromProps = extractPluginParamsFromProps;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useChartModels = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
/**
|
|
12
|
+
* Implements the same behavior as `useControlled` but for several models.
|
|
13
|
+
* The controlled models are never stored in the state, and the state is only updated if the model is not controlled.
|
|
14
|
+
*/
|
|
15
|
+
const useChartModels = (plugins, props) => {
|
|
16
|
+
const modelsRef = React.useRef({});
|
|
17
|
+
const [modelsState, setModelsState] = React.useState(() => {
|
|
18
|
+
const initialState = {};
|
|
19
|
+
plugins.forEach(plugin => {
|
|
20
|
+
if (plugin.models) {
|
|
21
|
+
Object.entries(plugin.models).forEach(([modelName, modelInitializer]) => {
|
|
22
|
+
modelsRef.current[modelName] = {
|
|
23
|
+
isControlled: props[modelName] !== undefined,
|
|
24
|
+
getDefaultValue: modelInitializer.getDefaultValue
|
|
25
|
+
};
|
|
26
|
+
initialState[modelName] = modelInitializer.getDefaultValue(props);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return initialState;
|
|
31
|
+
});
|
|
32
|
+
const models = Object.fromEntries(Object.entries(modelsRef.current).map(([modelName, model]) => {
|
|
33
|
+
const value = props[modelName] ?? modelsState[modelName];
|
|
34
|
+
return [modelName, {
|
|
35
|
+
value,
|
|
36
|
+
setControlledValue: newValue => {
|
|
37
|
+
if (!model.isControlled) {
|
|
38
|
+
setModelsState(prevState => (0, _extends2.default)({}, prevState, {
|
|
39
|
+
[modelName]: typeof newValue === 'function' ? newValue(value) : newValue
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
isControlled: modelsRef.current[modelName].isControlled
|
|
44
|
+
}];
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
// We know that `modelsRef` do not vary across renders.
|
|
48
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
+
Object.entries(modelsRef.current).forEach(([modelName, model]) => {
|
|
50
|
+
const controlled = props[modelName];
|
|
51
|
+
const newDefaultValue = model.getDefaultValue(props);
|
|
52
|
+
|
|
53
|
+
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps, react-compiler/react-compiler */
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (model.isControlled !== (controlled !== undefined)) {
|
|
56
|
+
console.error([`MUI X: A component is changing the ${model.isControlled ? '' : 'un'}controlled ${modelName} state of Chart to be ${model.isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${modelName} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
57
|
+
}
|
|
58
|
+
}, [controlled]);
|
|
59
|
+
const {
|
|
60
|
+
current: defaultValue
|
|
61
|
+
} = React.useRef(newDefaultValue);
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
if (!model.isControlled && defaultValue !== newDefaultValue) {
|
|
64
|
+
console.error([`MUI X: A component is changing the default ${modelName} state of an uncontrolled Chart after being initialized. ` + `To suppress this warning opt to use a controlled Chart.`].join('\n'));
|
|
65
|
+
}
|
|
66
|
+
}, [JSON.stringify(newDefaultValue)]);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/* eslint-enable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
70
|
+
|
|
71
|
+
return models;
|
|
72
|
+
};
|
|
73
|
+
exports.useChartModels = useChartModels;
|
|
@@ -11,6 +11,8 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
12
12
|
var _ChartStore = require("../plugins/utils/ChartStore");
|
|
13
13
|
var _corePlugins = require("../plugins/corePlugins");
|
|
14
|
+
var _extractPluginParamsFromProps = require("./extractPluginParamsFromProps");
|
|
15
|
+
var _useChartModels = require("./useChartModels");
|
|
14
16
|
function useChartApiInitialization(inputApiRef) {
|
|
15
17
|
const fallbackPublicApiRef = React.useRef({});
|
|
16
18
|
if (inputApiRef) {
|
|
@@ -23,12 +25,15 @@ function useChartApiInitialization(inputApiRef) {
|
|
|
23
25
|
return fallbackPublicApiRef.current;
|
|
24
26
|
}
|
|
25
27
|
let globalId = 0;
|
|
26
|
-
function useCharts(inPlugins, props) {
|
|
28
|
+
function useCharts(inPlugins, props, seriesConfig) {
|
|
29
|
+
const chartId = (0, _useId.default)();
|
|
27
30
|
const plugins = React.useMemo(() => [..._corePlugins.CHART_CORE_PLUGINS, ...inPlugins], [inPlugins]);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
31
|
+
const pluginParams = (0, _extractPluginParamsFromProps.extractPluginParamsFromProps)({
|
|
32
|
+
plugins,
|
|
33
|
+
props
|
|
34
|
+
});
|
|
35
|
+
pluginParams.id = pluginParams.id ?? chartId;
|
|
36
|
+
const models = (0, _useChartModels.useChartModels)(plugins, pluginParams);
|
|
32
37
|
const instanceRef = React.useRef({});
|
|
33
38
|
const instance = instanceRef.current;
|
|
34
39
|
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
@@ -52,9 +57,7 @@ function useCharts(inPlugins, props) {
|
|
|
52
57
|
};
|
|
53
58
|
plugins.forEach(plugin => {
|
|
54
59
|
if (plugin.getInitialState) {
|
|
55
|
-
Object.assign(initialState, plugin.getInitialState(
|
|
56
|
-
id: defaultChartId
|
|
57
|
-
}));
|
|
60
|
+
Object.assign(initialState, plugin.getInitialState(pluginParams, initialState, seriesConfig));
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
63
|
storeRef.current = new _ChartStore.ChartStore(initialState);
|
|
@@ -65,7 +68,9 @@ function useCharts(inPlugins, props) {
|
|
|
65
68
|
params: pluginParams,
|
|
66
69
|
plugins: plugins,
|
|
67
70
|
store: storeRef.current,
|
|
68
|
-
svgRef: innerSvgRef
|
|
71
|
+
svgRef: innerSvgRef,
|
|
72
|
+
seriesConfig,
|
|
73
|
+
models
|
|
69
74
|
});
|
|
70
75
|
if (pluginResponse.publicAPI) {
|
|
71
76
|
Object.assign(publicAPI, pluginResponse.publicAPI);
|
|
@@ -6,16 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useStore = useStore;
|
|
7
7
|
var _ChartProvider = require("../../context/ChartProvider");
|
|
8
8
|
// This hook should be removed because user and us should not interact with the store directly, but with public/private APIs
|
|
9
|
-
function useStore(
|
|
9
|
+
function useStore() {
|
|
10
10
|
const context = (0, _ChartProvider.useChartContext)();
|
|
11
|
-
if (skipError) {
|
|
12
|
-
// TODO: Remove once store is used by all charts.
|
|
13
|
-
// This line is only for `useAxisEvents` which is in the surface of the Gauge.
|
|
14
|
-
// But the Gauge don't have store yet because it does not need the interaction provider.
|
|
15
|
-
// Will be fixed when every thing move to the store since every component will have access to it.
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
return context?.store;
|
|
18
|
-
}
|
|
19
11
|
if (!context) {
|
|
20
12
|
throw new Error(['MUI X: Could not find the charts context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
21
13
|
}
|