@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
|
@@ -13,14 +13,15 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
15
|
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
16
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
17
16
|
var _LineElement = require("./LineElement");
|
|
18
17
|
var _useScale = require("../hooks/useScale");
|
|
19
18
|
var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
|
|
19
|
+
var _isBandScale = require("../internals/isBandScale");
|
|
20
20
|
var _constants = require("../constants");
|
|
21
|
-
var _ChartsAxesGradients = require("../internals/components/ChartsAxesGradients");
|
|
22
21
|
var _useSeries = require("../hooks/useSeries");
|
|
23
22
|
var _AnimationProvider = require("../context/AnimationProvider");
|
|
23
|
+
var _useChartGradientId = require("../hooks/useChartGradientId");
|
|
24
|
+
var _hooks = require("../hooks");
|
|
24
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
26
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
26
27
|
const LinePlotRoot = (0, _styles.styled)('g', {
|
|
@@ -34,7 +35,15 @@ const LinePlotRoot = (0, _styles.styled)('g', {
|
|
|
34
35
|
});
|
|
35
36
|
const useAggregatedData = () => {
|
|
36
37
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
37
|
-
const
|
|
38
|
+
const {
|
|
39
|
+
xAxis,
|
|
40
|
+
xAxisIds
|
|
41
|
+
} = (0, _hooks.useXAxes)();
|
|
42
|
+
const {
|
|
43
|
+
yAxis,
|
|
44
|
+
yAxisIds
|
|
45
|
+
} = (0, _hooks.useYAxes)();
|
|
46
|
+
const getGradientId = (0, _useChartGradientId.useChartGradientIdBuilder)();
|
|
38
47
|
|
|
39
48
|
// This memo prevents odd line chart behavior when hydrating.
|
|
40
49
|
const allData = React.useMemo(() => {
|
|
@@ -45,12 +54,6 @@ const useAggregatedData = () => {
|
|
|
45
54
|
series,
|
|
46
55
|
stackingGroups
|
|
47
56
|
} = seriesData;
|
|
48
|
-
const {
|
|
49
|
-
xAxis,
|
|
50
|
-
yAxis,
|
|
51
|
-
xAxisIds,
|
|
52
|
-
yAxisIds
|
|
53
|
-
} = axisData;
|
|
54
57
|
const defaultXAxisId = xAxisIds[0];
|
|
55
58
|
const defaultYAxisId = yAxisIds[0];
|
|
56
59
|
return stackingGroups.flatMap(({
|
|
@@ -62,12 +65,15 @@ const useAggregatedData = () => {
|
|
|
62
65
|
yAxisId = defaultYAxisId,
|
|
63
66
|
stackedData,
|
|
64
67
|
data,
|
|
65
|
-
connectNulls
|
|
68
|
+
connectNulls,
|
|
69
|
+
curve,
|
|
70
|
+
strictStepCurve
|
|
66
71
|
} = series[seriesId];
|
|
67
|
-
const xScale =
|
|
72
|
+
const xScale = xAxis[xAxisId].scale;
|
|
73
|
+
const xPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
68
74
|
const yScale = yAxis[yAxisId].scale;
|
|
69
75
|
const xData = xAxis[xAxisId].data;
|
|
70
|
-
const
|
|
76
|
+
const gradientId = yAxis[yAxisId].colorScale && getGradientId(yAxisId) || xAxis[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
|
|
71
77
|
if (process.env.NODE_ENV !== 'production') {
|
|
72
78
|
if (xData === undefined) {
|
|
73
79
|
throw new Error(`MUI X: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
@@ -76,21 +82,51 @@ const useAggregatedData = () => {
|
|
|
76
82
|
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
|
-
const
|
|
80
|
-
const formattedData = xData?.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
const shouldExpand = curve?.includes('step') && !strictStepCurve && (0, _isBandScale.isBandScale)(xScale);
|
|
86
|
+
const formattedData = xData?.flatMap((x, index) => {
|
|
87
|
+
const nullData = data[index] == null;
|
|
88
|
+
if (shouldExpand) {
|
|
89
|
+
const rep = [{
|
|
90
|
+
x,
|
|
91
|
+
y: stackedData[index],
|
|
92
|
+
nullData,
|
|
93
|
+
isExtension: false
|
|
94
|
+
}];
|
|
95
|
+
if (!nullData && (index === 0 || data[index - 1] == null)) {
|
|
96
|
+
rep.unshift({
|
|
97
|
+
x: (xScale(x) ?? 0) - (xScale.step() - xScale.bandwidth()) / 2,
|
|
98
|
+
y: stackedData[index],
|
|
99
|
+
nullData,
|
|
100
|
+
isExtension: true
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (!nullData && (index === data.length - 1 || data[index + 1] == null)) {
|
|
104
|
+
rep.push({
|
|
105
|
+
x: (xScale(x) ?? 0) + (xScale.step() + xScale.bandwidth()) / 2,
|
|
106
|
+
y: stackedData[index],
|
|
107
|
+
nullData,
|
|
108
|
+
isExtension: true
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return rep;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
x,
|
|
115
|
+
y: stackedData[index],
|
|
116
|
+
nullData
|
|
117
|
+
};
|
|
118
|
+
}) ?? [];
|
|
119
|
+
const d3Data = connectNulls ? formattedData.filter(d => !d.nullData) : formattedData;
|
|
120
|
+
const linePath = (0, _d3Shape.line)().x(d => d.isExtension ? d.x : xPosition(d.x)).defined(d => connectNulls || !d.nullData || !!d.isExtension).y(d => yScale(d.y[1]));
|
|
121
|
+
const d = linePath.curve((0, _getCurve.default)(curve))(d3Data) || '';
|
|
86
122
|
return (0, _extends2.default)({}, series[seriesId], {
|
|
87
|
-
|
|
123
|
+
gradientId,
|
|
88
124
|
d,
|
|
89
125
|
seriesId
|
|
90
126
|
});
|
|
91
127
|
});
|
|
92
128
|
});
|
|
93
|
-
}, [seriesData,
|
|
129
|
+
}, [seriesData, xAxisIds, yAxisIds, xAxis, yAxis, getGradientId]);
|
|
94
130
|
return allData;
|
|
95
131
|
};
|
|
96
132
|
|
|
@@ -113,20 +149,19 @@ function LinePlot(props) {
|
|
|
113
149
|
} = props,
|
|
114
150
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
115
151
|
const skipAnimation = (0, _AnimationProvider.useSkipAnimation)(inSkipAnimation);
|
|
116
|
-
const getGradientId = (0, _ChartsAxesGradients.useChartGradient)();
|
|
117
152
|
const completedData = useAggregatedData();
|
|
118
153
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LinePlotRoot, (0, _extends2.default)({}, other, {
|
|
119
154
|
children: completedData.map(({
|
|
120
155
|
d,
|
|
121
156
|
seriesId,
|
|
122
157
|
color,
|
|
123
|
-
|
|
158
|
+
gradientId
|
|
124
159
|
}) => {
|
|
125
160
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineElement.LineElement, {
|
|
126
161
|
id: seriesId,
|
|
127
162
|
d: d,
|
|
128
163
|
color: color,
|
|
129
|
-
gradientId:
|
|
164
|
+
gradientId: gradientId,
|
|
130
165
|
skipAnimation: skipAnimation,
|
|
131
166
|
slots: slots,
|
|
132
167
|
slotProps: slotProps,
|
|
@@ -13,17 +13,17 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var React = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _constants = require("../constants");
|
|
15
15
|
var _AnimationProvider = require("../context/AnimationProvider");
|
|
16
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
17
16
|
var _useChartId = require("../hooks/useChartId");
|
|
18
|
-
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
19
17
|
var _useScale = require("../hooks/useScale");
|
|
20
18
|
var _useSeries = require("../hooks/useSeries");
|
|
21
19
|
var _cleanId = require("../internals/cleanId");
|
|
22
20
|
var _CircleMarkElement = require("./CircleMarkElement");
|
|
23
21
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
24
22
|
var _MarkElement = require("./MarkElement");
|
|
23
|
+
var _ChartProvider = require("../context/ChartProvider");
|
|
24
|
+
var _hooks = require("../hooks");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"
|
|
26
|
+
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
27
27
|
/**
|
|
28
28
|
* Demos:
|
|
29
29
|
*
|
|
@@ -39,16 +39,23 @@ function MarkPlot(props) {
|
|
|
39
39
|
slots,
|
|
40
40
|
slotProps,
|
|
41
41
|
skipAnimation: inSkipAnimation,
|
|
42
|
-
onItemClick
|
|
43
|
-
experimentalRendering
|
|
42
|
+
onItemClick
|
|
44
43
|
} = props,
|
|
45
44
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
46
45
|
const skipAnimation = (0, _AnimationProvider.useSkipAnimation)(inSkipAnimation);
|
|
47
46
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
48
|
-
const
|
|
47
|
+
const {
|
|
48
|
+
xAxis,
|
|
49
|
+
xAxisIds
|
|
50
|
+
} = (0, _hooks.useXAxes)();
|
|
51
|
+
const {
|
|
52
|
+
yAxis,
|
|
53
|
+
yAxisIds
|
|
54
|
+
} = (0, _hooks.useYAxes)();
|
|
49
55
|
const chartId = (0, _useChartId.useChartId)();
|
|
50
|
-
const
|
|
51
|
-
|
|
56
|
+
const {
|
|
57
|
+
instance
|
|
58
|
+
} = (0, _ChartProvider.useChartContext)();
|
|
52
59
|
if (seriesData === undefined) {
|
|
53
60
|
return null;
|
|
54
61
|
}
|
|
@@ -56,12 +63,6 @@ function MarkPlot(props) {
|
|
|
56
63
|
series,
|
|
57
64
|
stackingGroups
|
|
58
65
|
} = seriesData;
|
|
59
|
-
const {
|
|
60
|
-
xAxis,
|
|
61
|
-
yAxis,
|
|
62
|
-
xAxisIds,
|
|
63
|
-
yAxisIds
|
|
64
|
-
} = axisData;
|
|
65
66
|
const defaultXAxisId = xAxisIds[0];
|
|
66
67
|
const defaultYAxisId = yAxisIds[0];
|
|
67
68
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
|
|
@@ -74,7 +75,8 @@ function MarkPlot(props) {
|
|
|
74
75
|
yAxisId = defaultYAxisId,
|
|
75
76
|
stackedData,
|
|
76
77
|
data,
|
|
77
|
-
showMark = true
|
|
78
|
+
showMark = true,
|
|
79
|
+
shape = 'circle'
|
|
78
80
|
} = series[seriesId];
|
|
79
81
|
if (showMark === false) {
|
|
80
82
|
return null;
|
|
@@ -88,6 +90,7 @@ function MarkPlot(props) {
|
|
|
88
90
|
const clipId = (0, _cleanId.cleanId)(`${chartId}-${seriesId}-line-clip`); // We assume that if displaying line mark, the line will also be rendered
|
|
89
91
|
|
|
90
92
|
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
93
|
+
const Mark = slots?.mark ?? (shape === 'circle' ? _CircleMarkElement.CircleMarkElement : _MarkElement.MarkElement);
|
|
91
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
92
95
|
clipPath: `url(#${clipId})`,
|
|
93
96
|
children: xData?.map((x, index) => {
|
|
@@ -110,7 +113,7 @@ function MarkPlot(props) {
|
|
|
110
113
|
// Remove missing data point
|
|
111
114
|
return false;
|
|
112
115
|
}
|
|
113
|
-
if (!
|
|
116
|
+
if (!instance.isPointInside({
|
|
114
117
|
x,
|
|
115
118
|
y
|
|
116
119
|
})) {
|
|
@@ -135,7 +138,7 @@ function MarkPlot(props) {
|
|
|
135
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Mark, (0, _extends2.default)({
|
|
136
139
|
id: seriesId,
|
|
137
140
|
dataIndex: index,
|
|
138
|
-
shape:
|
|
141
|
+
shape: shape,
|
|
139
142
|
color: colorGetter(index),
|
|
140
143
|
x: x,
|
|
141
144
|
y: y // Don't know why TS doesn't get from the filter that y can't be null
|
|
@@ -158,12 +161,6 @@ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
|
|
|
158
161
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
159
162
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
160
163
|
// ----------------------------------------------------------------------
|
|
161
|
-
/**
|
|
162
|
-
* If `true` the mark element will only be able to render circle.
|
|
163
|
-
* Giving fewer customization options, but saving around 40ms per 1.000 marks.
|
|
164
|
-
* @default false
|
|
165
|
-
*/
|
|
166
|
-
experimentalRendering: _propTypes.default.bool,
|
|
167
164
|
/**
|
|
168
165
|
* Callback fired when a line mark item is clicked.
|
|
169
166
|
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
@@ -56,7 +56,9 @@ const formatter = (params, dataset) => {
|
|
|
56
56
|
.order(stackingOrder).offset(stackingOffset)(d3Dataset);
|
|
57
57
|
ids.forEach((id, index) => {
|
|
58
58
|
const dataKey = series[id].dataKey;
|
|
59
|
-
completedSeries[id] = (0, _extends2.default)({
|
|
59
|
+
completedSeries[id] = (0, _extends2.default)({
|
|
60
|
+
labelMarkType: 'line'
|
|
61
|
+
}, series[id], {
|
|
60
62
|
data: dataKey ? dataset.map(data => {
|
|
61
63
|
const value = data[dataKey];
|
|
62
64
|
if (typeof value !== 'number') {
|
package/node/LineChart/legend.js
CHANGED
package/node/LineChart/plugin.js
CHANGED
|
@@ -8,10 +8,11 @@ exports.plugin = void 0;
|
|
|
8
8
|
var _extremums = require("./extremums");
|
|
9
9
|
var _formatter = _interopRequireDefault(require("./formatter"));
|
|
10
10
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
11
|
+
var _legend = _interopRequireDefault(require("./legend"));
|
|
11
12
|
const plugin = exports.plugin = {
|
|
12
|
-
seriesType: 'line',
|
|
13
13
|
colorProcessor: _getColor.default,
|
|
14
|
-
|
|
14
|
+
seriesProcessor: _formatter.default,
|
|
15
|
+
legendGetter: _legend.default,
|
|
15
16
|
xExtremumGetter: _extremums.getExtremumX,
|
|
16
17
|
yExtremumGetter: _extremums.getExtremumY
|
|
17
18
|
};
|
|
@@ -11,7 +11,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
12
12
|
var _constants = require("../constants");
|
|
13
13
|
var _calculateMargins = require("../internals/calculateMargins");
|
|
14
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"
|
|
14
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
15
15
|
/**
|
|
16
16
|
* A helper function that extracts LineChartProps from the input props
|
|
17
17
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -49,8 +49,7 @@ const useLineChartProps = props => {
|
|
|
49
49
|
loading,
|
|
50
50
|
highlightedItem,
|
|
51
51
|
onHighlightChange,
|
|
52
|
-
className
|
|
53
|
-
experimentalMarkRendering
|
|
52
|
+
className
|
|
54
53
|
} = props,
|
|
55
54
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
56
55
|
const id = (0, _useId.default)();
|
|
@@ -111,8 +110,7 @@ const useLineChartProps = props => {
|
|
|
111
110
|
slots,
|
|
112
111
|
slotProps,
|
|
113
112
|
onItemClick: onMarkClick,
|
|
114
|
-
skipAnimation
|
|
115
|
-
experimentalRendering: experimentalMarkRendering
|
|
113
|
+
skipAnimation
|
|
116
114
|
};
|
|
117
115
|
const overlayProps = {
|
|
118
116
|
slots,
|
|
@@ -72,7 +72,7 @@ function PieArcLabelPlot(props) {
|
|
|
72
72
|
faded,
|
|
73
73
|
data
|
|
74
74
|
});
|
|
75
|
-
const transition = (0, _web.useTransition)(transformedData, (0, _extends2.default)({}, _transition.
|
|
75
|
+
const transition = (0, _web.useTransition)(transformedData, (0, _extends2.default)({}, (0, _transition.getDefaultLabelTransitionConfig)(skipAnimation), {
|
|
76
76
|
immediate: skipAnimation
|
|
77
77
|
}));
|
|
78
78
|
if (data.length === 0) {
|
|
@@ -45,7 +45,7 @@ function PieArcPlot(props) {
|
|
|
45
45
|
faded,
|
|
46
46
|
data
|
|
47
47
|
});
|
|
48
|
-
const transition = (0, _web.useTransition)(transformedData, (0, _extends2.default)({}, _transition.
|
|
48
|
+
const transition = (0, _web.useTransition)(transformedData, (0, _extends2.default)({}, (0, _transition.getDefaultTransitionConfig)(skipAnimation), {
|
|
49
49
|
immediate: skipAnimation
|
|
50
50
|
}));
|
|
51
51
|
if (data.length === 0) {
|
|
@@ -17,7 +17,7 @@ var _ChartsLegend = require("../ChartsLegend");
|
|
|
17
17
|
var _PiePlot = require("./PiePlot");
|
|
18
18
|
var _ChartsOverlay = require("../ChartsOverlay");
|
|
19
19
|
var _ChartsSurface = require("../ChartsSurface");
|
|
20
|
-
var
|
|
20
|
+
var _ChartDataProvider = require("../ChartDataProvider");
|
|
21
21
|
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
22
22
|
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -82,7 +82,7 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
82
82
|
skipAnimation
|
|
83
83
|
}), ref);
|
|
84
84
|
const Tooltip = slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
85
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
86
86
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, {
|
|
87
87
|
legendPosition: props.slotProps?.legend?.position,
|
|
88
88
|
legendDirection: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
@@ -112,6 +112,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
112
112
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
113
113
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
114
114
|
// ----------------------------------------------------------------------
|
|
115
|
+
apiRef: _propTypes.default.shape({
|
|
116
|
+
current: _propTypes.default.object
|
|
117
|
+
}),
|
|
115
118
|
children: _propTypes.default.node,
|
|
116
119
|
className: _propTypes.default.string,
|
|
117
120
|
/**
|
|
@@ -145,6 +148,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
145
148
|
dataIndex: _propTypes.default.number,
|
|
146
149
|
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
147
150
|
}),
|
|
151
|
+
/**
|
|
152
|
+
* This prop is used to help implement the accessibility logic.
|
|
153
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
154
|
+
*/
|
|
155
|
+
id: _propTypes.default.string,
|
|
148
156
|
/**
|
|
149
157
|
* If `true`, a loading overlay is displayed.
|
|
150
158
|
* @default false
|
|
@@ -154,7 +162,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
154
162
|
* The margin between the SVG and the drawing area.
|
|
155
163
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
156
164
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
157
|
-
* @default object Depends on the charts type.
|
|
158
165
|
*/
|
|
159
166
|
margin: _propTypes.default.shape({
|
|
160
167
|
bottom: _propTypes.default.number,
|
|
@@ -193,6 +200,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
193
200
|
*/
|
|
194
201
|
slots: _propTypes.default.object,
|
|
195
202
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
203
|
+
theme: _propTypes.default.oneOf(['dark', 'light']),
|
|
196
204
|
title: _propTypes.default.string,
|
|
197
205
|
/**
|
|
198
206
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
const
|
|
6
|
+
exports.getDefaultTransitionConfig = exports.getDefaultLabelTransitionConfig = void 0;
|
|
7
|
+
const getDefaultTransitionConfig = skipAnimation => ({
|
|
8
8
|
keys: item => item.id,
|
|
9
|
-
from: ({
|
|
9
|
+
from: skipAnimation ? undefined : ({
|
|
10
10
|
innerRadius,
|
|
11
11
|
outerRadius,
|
|
12
12
|
cornerRadius,
|
|
@@ -70,10 +70,11 @@ const defaultTransitionConfig = exports.defaultTransitionConfig = {
|
|
|
70
70
|
friction: 14,
|
|
71
71
|
clamp: true
|
|
72
72
|
}
|
|
73
|
-
};
|
|
74
|
-
|
|
73
|
+
});
|
|
74
|
+
exports.getDefaultTransitionConfig = getDefaultTransitionConfig;
|
|
75
|
+
const getDefaultLabelTransitionConfig = skipAnimation => ({
|
|
75
76
|
keys: item => item.id,
|
|
76
|
-
from: ({
|
|
77
|
+
from: skipAnimation ? undefined : ({
|
|
77
78
|
innerRadius,
|
|
78
79
|
outerRadius,
|
|
79
80
|
arcLabelRadius,
|
|
@@ -140,4 +141,5 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
140
141
|
friction: 14,
|
|
141
142
|
clamp: true
|
|
142
143
|
}
|
|
143
|
-
};
|
|
144
|
+
});
|
|
145
|
+
exports.getDefaultLabelTransitionConfig = getDefaultLabelTransitionConfig;
|
|
@@ -32,11 +32,14 @@ const formatter = params => {
|
|
|
32
32
|
seriesOrder.forEach(seriesId => {
|
|
33
33
|
const arcs = (0, _d3Shape.pie)().startAngle(2 * Math.PI * (series[seriesId].startAngle ?? 0) / 360).endAngle(2 * Math.PI * (series[seriesId].endAngle ?? 360) / 360).padAngle(2 * Math.PI * (series[seriesId].paddingAngle ?? 0) / 360).sortValues(getSortingComparator(series[seriesId].sortingValues ?? 'none'))(series[seriesId].data.map(piePoint => piePoint.value));
|
|
34
34
|
defaultizedSeries[seriesId] = (0, _extends2.default)({
|
|
35
|
+
labelMarkType: 'circle',
|
|
35
36
|
valueFormatter: item => item.value.toLocaleString()
|
|
36
37
|
}, series[seriesId], {
|
|
37
38
|
data: series[seriesId].data.map((item, index) => (0, _extends2.default)({}, item, {
|
|
38
39
|
id: item.id ?? `auto-generated-pie-id-${seriesId}-${index}`
|
|
39
|
-
}, arcs[index])).map((item, index) => (0, _extends2.default)({
|
|
40
|
+
}, arcs[index])).map((item, index) => (0, _extends2.default)({
|
|
41
|
+
labelMarkType: 'circle'
|
|
42
|
+
}, item, {
|
|
40
43
|
formattedValue: series[seriesId].valueFormatter?.((0, _extends2.default)({}, item, {
|
|
41
44
|
label: (0, _getLabel.getLabel)(item.label, 'arc')
|
|
42
45
|
}), {
|
package/node/PieChart/legend.js
CHANGED
package/node/PieChart/plugin.js
CHANGED
|
@@ -7,8 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.plugin = void 0;
|
|
8
8
|
var _formatter = _interopRequireDefault(require("./formatter"));
|
|
9
9
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
10
|
+
var _legend = _interopRequireDefault(require("./legend"));
|
|
10
11
|
const plugin = exports.plugin = {
|
|
11
|
-
seriesType: 'pie',
|
|
12
12
|
colorProcessor: _getColor.default,
|
|
13
|
-
|
|
13
|
+
seriesProcessor: _formatter.default,
|
|
14
|
+
legendGetter: _legend.default
|
|
14
15
|
};
|
|
@@ -15,8 +15,8 @@ var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
|
15
15
|
var _useStore = require("../internals/store/useStore");
|
|
16
16
|
var _useSelector = require("../internals/store/useSelector");
|
|
17
17
|
var _context = require("../context");
|
|
18
|
-
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
19
18
|
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
19
|
+
var _ChartProvider = require("../context/ChartProvider");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
/**
|
|
22
22
|
* Demos:
|
|
@@ -38,7 +38,9 @@ function Scatter(props) {
|
|
|
38
38
|
markerSize,
|
|
39
39
|
onItemClick
|
|
40
40
|
} = props;
|
|
41
|
-
const
|
|
41
|
+
const {
|
|
42
|
+
instance
|
|
43
|
+
} = (0, _ChartProvider.useChartContext)();
|
|
42
44
|
const store = (0, _useStore.useStore)();
|
|
43
45
|
const isVoronoiEnabled = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsInteractionIsVoronoiEnabled);
|
|
44
46
|
const skipInteractionHandlers = isVoronoiEnabled || series.disableHover;
|
|
@@ -55,7 +57,7 @@ function Scatter(props) {
|
|
|
55
57
|
const scatterPoint = series.data[i];
|
|
56
58
|
const x = getXPosition(scatterPoint.x);
|
|
57
59
|
const y = getYPosition(scatterPoint.y);
|
|
58
|
-
const isInRange =
|
|
60
|
+
const isInRange = instance.isPointInside({
|
|
59
61
|
x,
|
|
60
62
|
y
|
|
61
63
|
});
|
|
@@ -83,7 +85,7 @@ function Scatter(props) {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
return temp;
|
|
86
|
-
}, [xScale, yScale,
|
|
88
|
+
}, [xScale, yScale, series.data, series.id, isHighlighted, isFaded, getInteractionItemProps, colorGetter, color, instance]);
|
|
87
89
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
88
90
|
children: cleanData.map(dataPoint => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
|
|
89
91
|
cx: 0,
|
|
@@ -19,10 +19,9 @@ var _ChartsOverlay = require("../ChartsOverlay");
|
|
|
19
19
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
20
20
|
var _ChartsVoronoiHandler = require("../ChartsVoronoiHandler/ChartsVoronoiHandler");
|
|
21
21
|
var _ChartsGrid = require("../ChartsGrid");
|
|
22
|
-
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
23
22
|
var _useScatterChartProps = require("./useScatterChartProps");
|
|
24
23
|
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
25
|
-
var
|
|
24
|
+
var _ChartDataProvider = require("../ChartDataProvider");
|
|
26
25
|
var _ChartsSurface = require("../ChartsSurface");
|
|
27
26
|
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
28
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -44,7 +43,6 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
44
43
|
const {
|
|
45
44
|
chartsWrapperProps,
|
|
46
45
|
chartContainerProps,
|
|
47
|
-
zAxisProps,
|
|
48
46
|
voronoiHandlerProps,
|
|
49
47
|
chartsAxisProps,
|
|
50
48
|
gridProps,
|
|
@@ -59,17 +57,15 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
59
57
|
chartsSurfaceProps
|
|
60
58
|
} = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
|
|
61
59
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
63
61
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
64
|
-
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.
|
|
65
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}, props.slotProps?.tooltip)), children]
|
|
72
|
-
}))
|
|
62
|
+
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
63
|
+
children: [!props.disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, (0, _extends2.default)({}, voronoiHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
64
|
+
"data-drawing-container": true,
|
|
65
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
|
66
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
|
|
67
|
+
trigger: "item"
|
|
68
|
+
}, props.slotProps?.tooltip)), children]
|
|
73
69
|
}))]
|
|
74
70
|
}))
|
|
75
71
|
}));
|
|
@@ -79,6 +75,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
79
75
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
80
76
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
81
77
|
// ----------------------------------------------------------------------
|
|
78
|
+
apiRef: _propTypes.default.shape({
|
|
79
|
+
current: _propTypes.default.object
|
|
80
|
+
}),
|
|
82
81
|
/**
|
|
83
82
|
* The configuration of axes highlight.
|
|
84
83
|
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
@@ -139,6 +138,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
139
138
|
dataIndex: _propTypes.default.number,
|
|
140
139
|
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
141
140
|
}),
|
|
141
|
+
/**
|
|
142
|
+
* This prop is used to help implement the accessibility logic.
|
|
143
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
144
|
+
*/
|
|
145
|
+
id: _propTypes.default.string,
|
|
142
146
|
/**
|
|
143
147
|
* Indicate which axis to display the left of the charts.
|
|
144
148
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -154,7 +158,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
154
158
|
* The margin between the SVG and the drawing area.
|
|
155
159
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
156
160
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
157
|
-
* @default object Depends on the charts type.
|
|
158
161
|
*/
|
|
159
162
|
margin: _propTypes.default.shape({
|
|
160
163
|
bottom: _propTypes.default.number,
|
|
@@ -201,6 +204,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
201
204
|
*/
|
|
202
205
|
slots: _propTypes.default.object,
|
|
203
206
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
207
|
+
theme: _propTypes.default.oneOf(['dark', 'light']),
|
|
204
208
|
title: _propTypes.default.string,
|
|
205
209
|
/**
|
|
206
210
|
* Indicate which axis to display the top of the charts.
|
|
@@ -11,9 +11,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _Scatter = require("./Scatter");
|
|
14
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
15
14
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
16
15
|
var _useSeries = require("../hooks/useSeries");
|
|
16
|
+
var _hooks = require("../hooks");
|
|
17
17
|
var _useZAxis = require("../hooks/useZAxis");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
/**
|
|
@@ -33,11 +33,18 @@ function ScatterPlot(props) {
|
|
|
33
33
|
onItemClick
|
|
34
34
|
} = props;
|
|
35
35
|
const seriesData = (0, _useSeries.useScatterSeries)();
|
|
36
|
-
const
|
|
36
|
+
const {
|
|
37
|
+
xAxis,
|
|
38
|
+
xAxisIds
|
|
39
|
+
} = (0, _hooks.useXAxes)();
|
|
40
|
+
const {
|
|
41
|
+
yAxis,
|
|
42
|
+
yAxisIds
|
|
43
|
+
} = (0, _hooks.useYAxes)();
|
|
37
44
|
const {
|
|
38
45
|
zAxis,
|
|
39
46
|
zAxisIds
|
|
40
|
-
} = (0, _useZAxis.
|
|
47
|
+
} = (0, _useZAxis.useZAxes)();
|
|
41
48
|
if (seriesData === undefined) {
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
@@ -45,12 +52,6 @@ function ScatterPlot(props) {
|
|
|
45
52
|
series,
|
|
46
53
|
seriesOrder
|
|
47
54
|
} = seriesData;
|
|
48
|
-
const {
|
|
49
|
-
xAxis,
|
|
50
|
-
yAxis,
|
|
51
|
-
xAxisIds,
|
|
52
|
-
yAxisIds
|
|
53
|
-
} = axisData;
|
|
54
55
|
const defaultXAxisId = xAxisIds[0];
|
|
55
56
|
const defaultYAxisId = yAxisIds[0];
|
|
56
57
|
const defaultZAxisId = zAxisIds[0];
|