@mui/x-charts 7.22.3 → 8.0.0-alpha.1
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/AnimatedBarElement.d.ts +15 -0
- package/BarChart/AnimatedBarElement.js +21 -0
- package/BarChart/BarChart.d.ts +11 -16
- package/BarChart/BarChart.js +9 -59
- package/BarChart/BarElement.d.ts +6 -1343
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +24 -6
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -4
- package/BarChart/useBarChartProps.js +4 -11
- package/CHANGELOG.md +348 -12
- package/ChartContainer/ChartContainer.d.ts +4 -38
- package/ChartContainer/ChartContainer.js +15 -44
- package/ChartContainer/ResizableContainer.d.ts +22 -0
- package/ChartContainer/ResizableContainer.js +60 -0
- package/ChartContainer/useChartContainerProps.d.ts +8 -92
- package/ChartContainer/useChartContainerProps.js +29 -59
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/ChartsAxisHighlight/index.d.ts +3 -0
- package/ChartsAxisHighlight/index.js +4 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +3 -3
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsSurface/ChartsSurface.d.ts +0 -15
- package/ChartsSurface/ChartsSurface.js +35 -34
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
- package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
- package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
- package/ChartsTooltip/ChartsTooltip.js +162 -107
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
- package/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/ChartsTooltip/index.d.ts +3 -3
- package/ChartsTooltip/index.js +2 -3
- package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
- package/ChartsTooltip/useAxisTooltip.js +21 -21
- package/ChartsTooltip/useItemTooltip.d.ts +1 -1
- package/ChartsTooltip/useItemTooltip.js +8 -7
- package/ChartsTooltip/utils.d.ts +5 -16
- package/ChartsTooltip/utils.js +45 -50
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +60 -61
- package/LineChart/AnimatedArea.d.ts +0 -1333
- package/LineChart/AnimatedArea.js +9 -18
- package/LineChart/AnimatedLine.d.ts +0 -1333
- package/LineChart/AnimatedLine.js +9 -20
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +14 -8
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +11 -17
- package/LineChart/LineChart.js +9 -60
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +8 -11
- package/LineChart/LinePlot.js +14 -8
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -4
- package/LineChart/useLineChartProps.js +4 -11
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +10 -39
- package/PieChart/PieChart.js +20 -137
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +4 -4
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +11 -17
- package/ScatterChart/ScatterChart.js +11 -60
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -4
- package/ScatterChart/useScatterChartProps.js +3 -12
- package/SparkLineChart/SparkLineChart.d.ts +7 -8
- package/SparkLineChart/SparkLineChart.js +6 -33
- package/context/CartesianProvider/defaultizeAxis.d.ts +1 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +31 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +94 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +12 -12
- package/{modern/ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
- package/{modern/context/DrawingProvider.js → context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/context/DrawingAreaProvider/index.d.ts +3 -0
- package/context/DrawingAreaProvider/index.js +3 -0
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/InteractionProvider.d.ts +5 -48
- package/context/InteractionProvider.js +8 -64
- package/context/InteractionSelectors.d.ts +359 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +13 -0
- package/context/SizeProvider/SizeProvider.d.ts +11 -0
- package/context/SizeProvider/SizeProvider.js +26 -0
- package/context/SizeProvider/index.d.ts +4 -0
- package/context/SizeProvider/index.js +4 -0
- package/context/SizeProvider/useChartContainerDimensions.d.ts +9 -0
- package/{modern/ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
- package/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
- package/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
- package/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/context/SvgRefProvider/index.d.ts +4 -0
- package/context/SvgRefProvider/index.js +4 -0
- package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
- package/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +2 -2
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +19 -12
- package/hooks/useSvgRef.js +3 -3
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +7 -6
- package/internals/index.js +7 -6
- package/internals/plugins/models/index.d.ts +35 -0
- package/internals/plugins/models/index.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +12 -0
- package/internals/plugins/utils/ChartStore.js +26 -0
- package/internals/plugins/utils/ChartsStore.d.ts +12 -0
- package/internals/plugins/utils/ChartsStore.js +26 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/useCharts.d.ts +6 -0
- package/internals/useCharts.js +29 -0
- package/internals/useSelector.d.ts +4 -0
- package/internals/useSelector.js +6 -0
- package/internals/useStore.d.ts +2 -0
- package/internals/useStore.js +17 -0
- package/internals/useStringInterpolator.js +1 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +0 -10
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +9 -59
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +24 -6
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +4 -11
- package/modern/ChartContainer/ChartContainer.js +15 -44
- package/modern/ChartContainer/ResizableContainer.js +60 -0
- package/modern/ChartContainer/useChartContainerProps.js +29 -59
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/modern/ChartsAxisHighlight/index.js +4 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
- package/modern/ChartsSurface/ChartsSurface.js +35 -34
- package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/modern/ChartsTooltip/ChartsTooltip.js +162 -107
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +21 -21
- package/modern/ChartsTooltip/useItemTooltip.js +8 -7
- package/modern/ChartsTooltip/utils.js +45 -50
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -39
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +60 -61
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +14 -8
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +9 -60
- package/modern/LineChart/LineHighlightPlot.js +8 -11
- package/modern/LineChart/LinePlot.js +14 -8
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +4 -11
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +20 -137
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +11 -60
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -12
- package/modern/SparkLineChart/SparkLineChart.js +6 -33
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +66 -0
- package/{ChartContainer → modern/context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/context/InteractionProvider.js +8 -64
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +13 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ResponsiveChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +15 -7
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/modern/context/SvgRefProvider/index.js +4 -0
- package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +2 -2
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +19 -12
- package/modern/hooks/useSvgRef.js +3 -3
- package/modern/index.js +2 -3
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +7 -6
- package/modern/internals/plugins/models/index.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +26 -0
- package/modern/internals/plugins/utils/ChartsStore.js +26 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/useCharts.js +29 -0
- package/modern/internals/useSelector.js +6 -0
- package/modern/internals/useStore.js +17 -0
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +9 -59
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +22 -4
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +4 -11
- package/node/ChartContainer/ChartContainer.js +14 -43
- package/node/ChartContainer/ResizableContainer.js +68 -0
- package/node/ChartContainer/useChartContainerProps.js +29 -60
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
- package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
- package/node/ChartsAxisHighlight/index.js +33 -0
- package/node/ChartsGrid/ChartsGrid.js +2 -2
- package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
- package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +11 -9
- package/node/ChartsSurface/ChartsSurface.js +35 -34
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +161 -106
- package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +21 -21
- package/node/ChartsTooltip/useItemTooltip.js +8 -7
- package/node/ChartsTooltip/utils.js +46 -53
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +51 -40
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +60 -61
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +13 -7
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +9 -60
- package/node/LineChart/LineHighlightPlot.js +8 -11
- package/node/LineChart/LinePlot.js +13 -7
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +4 -11
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +20 -137
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +11 -60
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -12
- package/node/SparkLineChart/SparkLineChart.js +6 -33
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +45 -39
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +72 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/context/InteractionProvider.js +9 -66
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +20 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ResponsiveChartContainer → context/SizeProvider}/useChartContainerDimensions.js +15 -7
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
- package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
- package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
- package/node/context/SvgRefProvider/index.js +49 -0
- package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +2 -2
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +20 -13
- package/node/hooks/useSvgRef.js +3 -3
- package/node/index.js +5 -16
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +64 -44
- package/node/internals/plugins/models/index.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +33 -0
- package/node/internals/plugins/utils/ChartsStore.js +33 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/useCharts.js +36 -0
- package/node/internals/useSelector.js +13 -0
- package/node/internals/useStore.js +24 -0
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +8 -6
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/ResponsiveChartContainer/ResizableContainer.d.ts +0 -9
- package/ResponsiveChartContainer/ResizableContainer.js +0 -26
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/models/helpers.d.ts +0 -3
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/ResponsiveChartContainer/ResizableContainer.js +0 -26
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- package/node/ResponsiveChartContainer/ResizableContainer.js +0 -32
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- /package/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
- /package/{modern/internals/SlotComponentPropsFromProps.js → context/DrawingAreaProvider/DrawingArea.types.js} +0 -0
- /package/{modern/models/helpers.js → context/SizeProvider/Size.types.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/{internals/SlotComponentPropsFromProps.js → ChartsAxisHighlight/ChartsAxisHighlight.types.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/{models/helpers.js → ChartsTooltip/ChartTooltip.types.js} +0 -0
|
@@ -6,25 +6,9 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { animated, useTransition } from '@react-spring/web';
|
|
9
|
-
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
10
|
-
import { styled } from '@mui/material/styles';
|
|
11
9
|
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
12
10
|
import { AppearingMask } from "./AppearingMask.js";
|
|
13
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export const LineElementPath = styled(animated.path, {
|
|
15
|
-
name: 'MuiLineElement',
|
|
16
|
-
slot: 'Root',
|
|
17
|
-
overridesResolver: (_, styles) => styles.root
|
|
18
|
-
})(({
|
|
19
|
-
ownerState
|
|
20
|
-
}) => ({
|
|
21
|
-
strokeWidth: 2,
|
|
22
|
-
strokeLinejoin: 'round',
|
|
23
|
-
fill: 'none',
|
|
24
|
-
stroke: ownerState.gradientId && `url(#${ownerState.gradientId})` || ownerState.isHighlighted && d3Color(ownerState.color).brighter(0.5).formatHex() || ownerState.color,
|
|
25
|
-
transition: 'opacity 0.2s ease-in, stroke 0.2s ease-in',
|
|
26
|
-
opacity: ownerState.isFaded ? 0.3 : 1
|
|
27
|
-
}));
|
|
28
12
|
/**
|
|
29
13
|
* Demos:
|
|
30
14
|
*
|
|
@@ -59,10 +43,15 @@ function AnimatedLine(props) {
|
|
|
59
43
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
60
44
|
skipAnimation: skipAnimation,
|
|
61
45
|
id: `${ownerState.id}-line-clip`,
|
|
62
|
-
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(animated.path, _extends({
|
|
47
|
+
d: style.value.to(interpolator),
|
|
48
|
+
stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
49
|
+
strokeWidth: 2,
|
|
50
|
+
strokeLinejoin: "round",
|
|
51
|
+
fill: "none",
|
|
52
|
+
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
53
|
+
opacity: ownerState.isFaded ? 0.3 : 1
|
|
54
|
+
}, other)))
|
|
66
55
|
});
|
|
67
56
|
}
|
|
68
57
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentPropsFromProps } from '
|
|
2
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { AnimatedAreaProps } from './AnimatedArea';
|
|
4
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
5
5
|
export interface AreaElementClasses {
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -5,9 +5,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
8
9
|
import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
|
|
9
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
|
-
import { AreaElement } from "./AreaElement.js";
|
|
11
|
+
import { AreaElement, areaElementClasses } from "./AreaElement.js";
|
|
11
12
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
12
13
|
import getCurveFactory from "../internals/getCurve.js";
|
|
13
14
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -15,6 +16,15 @@ import { useChartGradient } from "../internals/components/ChartsAxesGradients/in
|
|
|
15
16
|
import { useLineSeries } from "../hooks/useSeries.js";
|
|
16
17
|
import { useSkipAnimation } from "../context/AnimationProvider/index.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const AreaPlotRoot = styled('g', {
|
|
20
|
+
name: 'MuiAreaPlot',
|
|
21
|
+
slot: 'Root',
|
|
22
|
+
overridesResolver: (_, styles) => styles.root
|
|
23
|
+
})({
|
|
24
|
+
[`& .${areaElementClasses.root}`]: {
|
|
25
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
18
28
|
const useAggregatedData = () => {
|
|
19
29
|
const seriesData = useLineSeries();
|
|
20
30
|
const axisData = useCartesianContext();
|
|
@@ -42,17 +52,13 @@ const useAggregatedData = () => {
|
|
|
42
52
|
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
43
53
|
.map(seriesId => {
|
|
44
54
|
const {
|
|
45
|
-
xAxisId
|
|
46
|
-
yAxisId
|
|
47
|
-
xAxisKey = defaultXAxisId,
|
|
48
|
-
yAxisKey = defaultYAxisId,
|
|
55
|
+
xAxisId = defaultXAxisId,
|
|
56
|
+
yAxisId = defaultYAxisId,
|
|
49
57
|
stackedData,
|
|
50
58
|
data,
|
|
51
59
|
connectNulls,
|
|
52
60
|
baseline
|
|
53
61
|
} = series[seriesId];
|
|
54
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
55
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
56
62
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
57
63
|
const yScale = yAxis[yAxisId].scale;
|
|
58
64
|
const xData = xAxis[xAxisId].data;
|
|
@@ -121,7 +127,7 @@ function AreaPlot(props) {
|
|
|
121
127
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
122
128
|
const getGradientId = useChartGradient();
|
|
123
129
|
const completedData = useAggregatedData();
|
|
124
|
-
return /*#__PURE__*/_jsx(
|
|
130
|
+
return /*#__PURE__*/_jsx(AreaPlotRoot, _extends({}, other, {
|
|
125
131
|
children: completedData.map(({
|
|
126
132
|
d,
|
|
127
133
|
seriesId,
|
|
@@ -8,10 +8,12 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { useTheme } from '@mui/material/styles';
|
|
9
9
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
10
10
|
import { animated, useSpring } from '@react-spring/web';
|
|
11
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
11
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
12
|
import { useItemHighlighted } from "../context/index.js";
|
|
14
13
|
import { useUtilityClasses } from "./markElementClasses.js";
|
|
14
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
15
|
+
import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
|
|
16
|
+
import { useStore } from "../internals/useStore.js";
|
|
15
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
18
|
/**
|
|
17
19
|
* The line mark element that only render circle for performance improvement.
|
|
@@ -49,9 +51,8 @@ function CircleMarkElement(props) {
|
|
|
49
51
|
} = useItemHighlighted({
|
|
50
52
|
seriesId: id
|
|
51
53
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
} = React.useContext(InteractionContext);
|
|
54
|
+
const store = useStore();
|
|
55
|
+
const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
|
|
55
56
|
const position = useSpring({
|
|
56
57
|
to: {
|
|
57
58
|
x,
|
|
@@ -62,7 +63,7 @@ function CircleMarkElement(props) {
|
|
|
62
63
|
const ownerState = {
|
|
63
64
|
id,
|
|
64
65
|
classes: innerClasses,
|
|
65
|
-
isHighlighted:
|
|
66
|
+
isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
|
|
66
67
|
isFaded,
|
|
67
68
|
color
|
|
68
69
|
};
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -1,49 +1,43 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
3
|
import { AreaPlotProps, AreaPlotSlotProps, AreaPlotSlots } from './AreaPlot';
|
|
3
4
|
import { LinePlotProps, LinePlotSlotProps, LinePlotSlots } from './LinePlot';
|
|
4
|
-
import {
|
|
5
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
5
6
|
import { MarkPlotProps, MarkPlotSlotProps, MarkPlotSlots } from './MarkPlot';
|
|
6
7
|
import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
|
|
7
8
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
9
|
+
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from '../ChartsTooltip/ChartTooltip.types';
|
|
10
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
11
11
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsAxisSlotProps, ChartsAxisSlots } from '../models/axis';
|
|
13
13
|
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from './LineHighlightPlot';
|
|
14
14
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
15
15
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
16
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
17
|
-
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
17
|
+
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {
|
|
18
18
|
}
|
|
19
|
-
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
19
|
+
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {
|
|
20
20
|
}
|
|
21
|
-
export interface LineChartProps extends Omit<
|
|
21
|
+
export interface LineChartProps extends Omit<ChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
22
22
|
/**
|
|
23
23
|
* The series to display in the line chart.
|
|
24
24
|
* An array of [[LineSeriesType]] objects.
|
|
25
25
|
*/
|
|
26
26
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
27
|
-
/**
|
|
28
|
-
* The configuration of the tooltip.
|
|
29
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
30
|
-
* @default { trigger: 'item' }
|
|
31
|
-
*/
|
|
32
|
-
tooltip?: ChartsTooltipProps<'line'>;
|
|
33
27
|
/**
|
|
34
28
|
* Option to display a cartesian grid in the background.
|
|
35
29
|
*/
|
|
36
30
|
grid?: Pick<ChartsGridProps, 'vertical' | 'horizontal'>;
|
|
37
31
|
/**
|
|
38
32
|
* The configuration of axes highlight.
|
|
39
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
33
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
40
34
|
* @default { x: 'line' }
|
|
41
35
|
*/
|
|
42
36
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
43
37
|
/**
|
|
44
|
-
*
|
|
38
|
+
* If `true`, the legend is not rendered.
|
|
45
39
|
*/
|
|
46
|
-
|
|
40
|
+
hideLegend?: boolean;
|
|
47
41
|
/**
|
|
48
42
|
* If `true`, render the line highlight item.
|
|
49
43
|
*/
|
|
@@ -90,5 +84,5 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
90
84
|
*
|
|
91
85
|
* - [LineChart API](https://mui.com/x/api/charts/line-chart/)
|
|
92
86
|
*/
|
|
93
|
-
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<
|
|
87
|
+
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
94
88
|
export { LineChart };
|
package/LineChart/LineChart.js
CHANGED
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { AreaPlot } from "./AreaPlot.js";
|
|
8
8
|
import { LinePlot } from "./LinePlot.js";
|
|
9
|
-
import {
|
|
9
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
10
10
|
import { MarkPlot } from "./MarkPlot.js";
|
|
11
11
|
import { ChartsAxis } from "../ChartsAxis/ChartsAxis.js";
|
|
12
12
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
@@ -48,10 +48,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
48
48
|
axisHighlightProps,
|
|
49
49
|
lineHighlightPlotProps,
|
|
50
50
|
legendProps,
|
|
51
|
-
tooltipProps,
|
|
52
51
|
children
|
|
53
52
|
} = useLineChartProps(props);
|
|
54
|
-
|
|
53
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
54
|
+
return /*#__PURE__*/_jsxs(ChartContainer, _extends({
|
|
55
55
|
ref: ref
|
|
56
56
|
}, chartContainerProps, {
|
|
57
57
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
@@ -59,7 +59,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
59
59
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
60
60
|
"data-drawing-container": true,
|
|
61
61
|
children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
|
|
62
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
62
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
65
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -69,7 +69,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
69
69
|
// ----------------------------------------------------------------------
|
|
70
70
|
/**
|
|
71
71
|
* The configuration of axes highlight.
|
|
72
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
72
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
73
73
|
* @default { x: 'line' }
|
|
74
74
|
*/
|
|
75
75
|
axisHighlight: PropTypes.shape({
|
|
@@ -119,6 +119,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
119
119
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
120
120
|
*/
|
|
121
121
|
height: PropTypes.number,
|
|
122
|
+
/**
|
|
123
|
+
* If `true`, the legend is not rendered.
|
|
124
|
+
*/
|
|
125
|
+
hideLegend: PropTypes.bool,
|
|
122
126
|
/**
|
|
123
127
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
124
128
|
*/
|
|
@@ -132,32 +136,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
132
136
|
* @default yAxisIds[0] The id of the first provided axis
|
|
133
137
|
*/
|
|
134
138
|
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
135
|
-
/**
|
|
136
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
137
|
-
*/
|
|
138
|
-
legend: PropTypes.shape({
|
|
139
|
-
classes: PropTypes.object,
|
|
140
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
141
|
-
hidden: PropTypes.bool,
|
|
142
|
-
itemGap: PropTypes.number,
|
|
143
|
-
itemMarkHeight: PropTypes.number,
|
|
144
|
-
itemMarkWidth: PropTypes.number,
|
|
145
|
-
labelStyle: PropTypes.object,
|
|
146
|
-
markGap: PropTypes.number,
|
|
147
|
-
onItemClick: PropTypes.func,
|
|
148
|
-
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
149
|
-
bottom: PropTypes.number,
|
|
150
|
-
left: PropTypes.number,
|
|
151
|
-
right: PropTypes.number,
|
|
152
|
-
top: PropTypes.number
|
|
153
|
-
})]),
|
|
154
|
-
position: PropTypes.shape({
|
|
155
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
156
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
157
|
-
}),
|
|
158
|
-
slotProps: PropTypes.object,
|
|
159
|
-
slots: PropTypes.object
|
|
160
|
-
}),
|
|
161
139
|
/**
|
|
162
140
|
* If `true`, a loading overlay is displayed.
|
|
163
141
|
* @default false
|
|
@@ -200,16 +178,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
200
178
|
* Callback fired when a mark element is clicked.
|
|
201
179
|
*/
|
|
202
180
|
onMarkClick: PropTypes.func,
|
|
203
|
-
/**
|
|
204
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
205
|
-
* before it renders for the first time.
|
|
206
|
-
*
|
|
207
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
208
|
-
* the first render, like when used inside a grid.
|
|
209
|
-
*
|
|
210
|
-
* @default false
|
|
211
|
-
*/
|
|
212
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
213
181
|
/**
|
|
214
182
|
* Indicate which axis to display the right of the charts.
|
|
215
183
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -238,31 +206,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
238
206
|
slots: PropTypes.object,
|
|
239
207
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
240
208
|
title: PropTypes.string,
|
|
241
|
-
/**
|
|
242
|
-
* The configuration of the tooltip.
|
|
243
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
244
|
-
* @default { trigger: 'item' }
|
|
245
|
-
*/
|
|
246
|
-
tooltip: PropTypes.shape({
|
|
247
|
-
axisContent: PropTypes.elementType,
|
|
248
|
-
classes: PropTypes.object,
|
|
249
|
-
itemContent: PropTypes.elementType,
|
|
250
|
-
slotProps: PropTypes.object,
|
|
251
|
-
slots: PropTypes.object,
|
|
252
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
253
|
-
}),
|
|
254
209
|
/**
|
|
255
210
|
* Indicate which axis to display the top of the charts.
|
|
256
211
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
257
212
|
* @default null
|
|
258
213
|
*/
|
|
259
214
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
260
|
-
viewBox: PropTypes.shape({
|
|
261
|
-
height: PropTypes.number,
|
|
262
|
-
width: PropTypes.number,
|
|
263
|
-
x: PropTypes.number,
|
|
264
|
-
y: PropTypes.number
|
|
265
|
-
}),
|
|
266
215
|
/**
|
|
267
216
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
268
217
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentPropsFromProps } from '
|
|
2
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { AnimatedLineProps } from './AnimatedLine';
|
|
4
4
|
import { SeriesId } from '../models/seriesType/common';
|
|
5
5
|
export interface LineElementClasses {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentPropsFromProps } from '
|
|
2
|
+
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { LineHighlightElementProps } from './LineHighlightElement';
|
|
4
4
|
export interface LineHighlightPlotSlots {
|
|
5
5
|
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
@@ -5,14 +5,16 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["slots", "slotProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { useStore } from "../internals/useStore.js";
|
|
9
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
8
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
9
11
|
import { LineHighlightElement } from "./LineHighlightElement.js";
|
|
10
12
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
11
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
13
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
13
14
|
import getColor from "./getColor.js";
|
|
14
15
|
import { useLineSeries } from "../hooks/useSeries.js";
|
|
15
16
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
17
|
+
import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
/**
|
|
18
20
|
* Demos:
|
|
@@ -33,10 +35,9 @@ function LineHighlightPlot(props) {
|
|
|
33
35
|
const seriesData = useLineSeries();
|
|
34
36
|
const axisData = useCartesianContext();
|
|
35
37
|
const drawingArea = useDrawingArea();
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const highlightedIndex = axis.x?.index;
|
|
38
|
+
const store = useStore();
|
|
39
|
+
const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
|
|
40
|
+
const highlightedIndex = xAxisIdentifier?.index;
|
|
40
41
|
if (highlightedIndex === undefined) {
|
|
41
42
|
return null;
|
|
42
43
|
}
|
|
@@ -62,16 +63,12 @@ function LineHighlightPlot(props) {
|
|
|
62
63
|
}) => {
|
|
63
64
|
return groupIds.flatMap(seriesId => {
|
|
64
65
|
const {
|
|
65
|
-
xAxisId
|
|
66
|
-
yAxisId
|
|
67
|
-
xAxisKey = defaultXAxisId,
|
|
68
|
-
yAxisKey = defaultYAxisId,
|
|
66
|
+
xAxisId = defaultXAxisId,
|
|
67
|
+
yAxisId = defaultYAxisId,
|
|
69
68
|
stackedData,
|
|
70
69
|
data,
|
|
71
70
|
disableHighlight
|
|
72
71
|
} = series[seriesId];
|
|
73
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
74
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
75
72
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
76
73
|
return null;
|
|
77
74
|
}
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -5,9 +5,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
8
9
|
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
9
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
|
-
import { LineElement } from "./LineElement.js";
|
|
11
|
+
import { LineElement, lineElementClasses } from "./LineElement.js";
|
|
11
12
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
12
13
|
import getCurveFactory from "../internals/getCurve.js";
|
|
13
14
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -15,6 +16,15 @@ import { useChartGradient } from "../internals/components/ChartsAxesGradients/in
|
|
|
15
16
|
import { useLineSeries } from "../hooks/useSeries.js";
|
|
16
17
|
import { useSkipAnimation } from "../context/AnimationProvider/index.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const LinePlotRoot = styled('g', {
|
|
20
|
+
name: 'MuiAreaPlot',
|
|
21
|
+
slot: 'Root',
|
|
22
|
+
overridesResolver: (_, styles) => styles.root
|
|
23
|
+
})({
|
|
24
|
+
[`& .${lineElementClasses.root}`]: {
|
|
25
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
18
28
|
const useAggregatedData = () => {
|
|
19
29
|
const seriesData = useLineSeries();
|
|
20
30
|
const axisData = useCartesianContext();
|
|
@@ -41,16 +51,12 @@ const useAggregatedData = () => {
|
|
|
41
51
|
}) => {
|
|
42
52
|
return groupIds.flatMap(seriesId => {
|
|
43
53
|
const {
|
|
44
|
-
xAxisId
|
|
45
|
-
yAxisId
|
|
46
|
-
xAxisKey = defaultXAxisId,
|
|
47
|
-
yAxisKey = defaultYAxisId,
|
|
54
|
+
xAxisId = defaultXAxisId,
|
|
55
|
+
yAxisId = defaultYAxisId,
|
|
48
56
|
stackedData,
|
|
49
57
|
data,
|
|
50
58
|
connectNulls
|
|
51
59
|
} = series[seriesId];
|
|
52
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
53
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
54
60
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
55
61
|
const yScale = yAxis[yAxisId].scale;
|
|
56
62
|
const xData = xAxis[xAxisId].data;
|
|
@@ -102,7 +108,7 @@ function LinePlot(props) {
|
|
|
102
108
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
103
109
|
const getGradientId = useChartGradient();
|
|
104
110
|
const completedData = useAggregatedData();
|
|
105
|
-
return /*#__PURE__*/_jsx(
|
|
111
|
+
return /*#__PURE__*/_jsx(LinePlotRoot, _extends({}, other, {
|
|
106
112
|
children: completedData.map(({
|
|
107
113
|
d,
|
|
108
114
|
seriesId,
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -9,10 +9,12 @@ import { styled } from '@mui/material/styles';
|
|
|
9
9
|
import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-vendor/d3-shape';
|
|
10
10
|
import { animated, to, useSpring } from '@react-spring/web';
|
|
11
11
|
import { getSymbol } from "../internals/getSymbol.js";
|
|
12
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
13
12
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
14
13
|
import { useItemHighlighted } from "../context/index.js";
|
|
15
14
|
import { useUtilityClasses } from "./markElementClasses.js";
|
|
15
|
+
import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
|
|
16
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
17
|
+
import { useStore } from "../internals/useStore.js";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
const MarkElementPath = styled(animated.path, {
|
|
18
20
|
name: 'MuiMarkElement',
|
|
@@ -56,9 +58,8 @@ function MarkElement(props) {
|
|
|
56
58
|
} = useItemHighlighted({
|
|
57
59
|
seriesId: id
|
|
58
60
|
});
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
} = React.useContext(InteractionContext);
|
|
61
|
+
const store = useStore();
|
|
62
|
+
const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
|
|
62
63
|
const position = useSpring({
|
|
63
64
|
to: {
|
|
64
65
|
x,
|
|
@@ -69,7 +70,7 @@ function MarkElement(props) {
|
|
|
69
70
|
const ownerState = {
|
|
70
71
|
id,
|
|
71
72
|
classes: innerClasses,
|
|
72
|
-
isHighlighted:
|
|
73
|
+
isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
|
|
73
74
|
isFaded,
|
|
74
75
|
color
|
|
75
76
|
};
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -63,10 +63,8 @@ function MarkPlot(props) {
|
|
|
63
63
|
}) => {
|
|
64
64
|
return groupIds.map(seriesId => {
|
|
65
65
|
const {
|
|
66
|
-
xAxisId
|
|
67
|
-
yAxisId
|
|
68
|
-
xAxisKey = defaultXAxisId,
|
|
69
|
-
yAxisKey = defaultYAxisId,
|
|
66
|
+
xAxisId = defaultXAxisId,
|
|
67
|
+
yAxisId = defaultYAxisId,
|
|
70
68
|
stackedData,
|
|
71
69
|
data,
|
|
72
70
|
showMark = true
|
|
@@ -74,8 +72,6 @@ function MarkPlot(props) {
|
|
|
74
72
|
if (showMark === false) {
|
|
75
73
|
return null;
|
|
76
74
|
}
|
|
77
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
78
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
79
75
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
80
76
|
const yScale = yAxis[yAxisId].scale;
|
|
81
77
|
const xData = xAxis[xAxisId].data;
|
package/LineChart/extremums.js
CHANGED
|
@@ -6,8 +6,11 @@ export const getExtremumX = params => {
|
|
|
6
6
|
const maxX = Math.max(...(axis.data ?? []));
|
|
7
7
|
return [minX, maxX];
|
|
8
8
|
};
|
|
9
|
-
function getSeriesExtremums(getValues, stackedData, filter) {
|
|
9
|
+
function getSeriesExtremums(getValues, data, stackedData, filter) {
|
|
10
10
|
return stackedData.reduce((seriesAcc, stackedValue, index) => {
|
|
11
|
+
if (data[index] === null) {
|
|
12
|
+
return seriesAcc;
|
|
13
|
+
}
|
|
11
14
|
const [base, value] = getValues(stackedValue);
|
|
12
15
|
if (filter && (!filter({
|
|
13
16
|
y: base,
|
|
@@ -29,24 +32,25 @@ export const getExtremumY = params => {
|
|
|
29
32
|
getFilters
|
|
30
33
|
} = params;
|
|
31
34
|
return Object.keys(series).filter(seriesId => {
|
|
32
|
-
const yAxisId = series[seriesId].yAxisId
|
|
35
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
33
36
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
34
37
|
}).reduce((acc, seriesId) => {
|
|
35
38
|
const {
|
|
36
39
|
area,
|
|
37
|
-
stackedData
|
|
40
|
+
stackedData,
|
|
41
|
+
data
|
|
38
42
|
} = series[seriesId];
|
|
39
43
|
const isArea = area !== undefined;
|
|
40
44
|
const filter = getFilters?.({
|
|
41
45
|
currentAxisId: axis.id,
|
|
42
46
|
isDefaultAxis,
|
|
43
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
44
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
47
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
48
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
45
49
|
});
|
|
46
50
|
|
|
47
51
|
// Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
48
52
|
const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
|
|
49
|
-
const seriesExtremums = getSeriesExtremums(getValues, stackedData, filter);
|
|
53
|
+
const seriesExtremums = getSeriesExtremums(getValues, data, stackedData, filter);
|
|
50
54
|
const [seriesMin, seriesMax] = seriesExtremums;
|
|
51
55
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
52
56
|
}, [Infinity, -Infinity]);
|
|
@@ -5,8 +5,7 @@ import { ChartsGridProps } from '../ChartsGrid';
|
|
|
5
5
|
import { ChartsLegendProps } from '../ChartsLegend';
|
|
6
6
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
7
7
|
import { ChartsOverlayProps } from '../ChartsOverlay';
|
|
8
|
-
import {
|
|
9
|
-
import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
|
|
8
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
10
9
|
import { AreaPlotProps } from './AreaPlot';
|
|
11
10
|
import type { LineChartProps } from './LineChart';
|
|
12
11
|
import { LineHighlightPlotProps } from './LineHighlightPlot';
|
|
@@ -20,7 +19,7 @@ import { MarkPlotProps } from './MarkPlot';
|
|
|
20
19
|
* @returns An object with props for the children components of LineChart
|
|
21
20
|
*/
|
|
22
21
|
export declare const useLineChartProps: (props: LineChartProps) => {
|
|
23
|
-
chartContainerProps:
|
|
22
|
+
chartContainerProps: ChartContainerProps;
|
|
24
23
|
axisClickHandlerProps: ChartsOnAxisClickHandlerProps;
|
|
25
24
|
gridProps: ChartsGridProps;
|
|
26
25
|
clipPathProps: ChartsClipPathProps;
|
|
@@ -35,6 +34,5 @@ export declare const useLineChartProps: (props: LineChartProps) => {
|
|
|
35
34
|
axisHighlightProps: ChartsAxisHighlightProps;
|
|
36
35
|
lineHighlightPlotProps: LineHighlightPlotProps;
|
|
37
36
|
legendProps: ChartsLegendProps;
|
|
38
|
-
tooltipProps: ChartsTooltipProps<"line">;
|
|
39
37
|
children: import("react").ReactNode;
|
|
40
38
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "
|
|
5
|
+
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", "experimentalMarkRendering"];
|
|
6
6
|
import useId from '@mui/utils/useId';
|
|
7
7
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
8
8
|
/**
|
|
@@ -23,14 +23,12 @@ export const useLineChartProps = props => {
|
|
|
23
23
|
colors,
|
|
24
24
|
dataset,
|
|
25
25
|
sx,
|
|
26
|
-
tooltip,
|
|
27
26
|
onAxisClick,
|
|
28
27
|
onAreaClick,
|
|
29
28
|
onLineClick,
|
|
30
29
|
onMarkClick,
|
|
31
30
|
axisHighlight,
|
|
32
31
|
disableLineItemHighlight,
|
|
33
|
-
legend,
|
|
34
32
|
grid,
|
|
35
33
|
topAxis,
|
|
36
34
|
leftAxis,
|
|
@@ -70,7 +68,7 @@ export const useLineChartProps = props => {
|
|
|
70
68
|
sx,
|
|
71
69
|
highlightedItem,
|
|
72
70
|
onHighlightChange,
|
|
73
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
71
|
+
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
74
72
|
className,
|
|
75
73
|
skipAnimation
|
|
76
74
|
});
|
|
@@ -124,14 +122,10 @@ export const useLineChartProps = props => {
|
|
|
124
122
|
slots,
|
|
125
123
|
slotProps
|
|
126
124
|
};
|
|
127
|
-
const legendProps =
|
|
125
|
+
const legendProps = {
|
|
128
126
|
slots,
|
|
129
127
|
slotProps
|
|
130
|
-
}
|
|
131
|
-
const tooltipProps = _extends({}, tooltip, {
|
|
132
|
-
slots,
|
|
133
|
-
slotProps
|
|
134
|
-
});
|
|
128
|
+
};
|
|
135
129
|
return {
|
|
136
130
|
chartContainerProps,
|
|
137
131
|
axisClickHandlerProps,
|
|
@@ -146,7 +140,6 @@ export const useLineChartProps = props => {
|
|
|
146
140
|
axisHighlightProps,
|
|
147
141
|
lineHighlightPlotProps,
|
|
148
142
|
legendProps,
|
|
149
|
-
tooltipProps,
|
|
150
143
|
children
|
|
151
144
|
};
|
|
152
145
|
};
|