@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
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.BarElement = BarElement;
|
|
10
|
-
exports.barElementClasses =
|
|
10
|
+
exports.barElementClasses = void 0;
|
|
11
11
|
exports.getBarElementUtilityClass = getBarElementUtilityClass;
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
@@ -16,40 +16,28 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
16
16
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
17
17
|
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
18
18
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
19
|
-
var _styles = require("@mui/material/styles");
|
|
20
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
21
|
-
var _d3Color = require("@mui/x-charts-vendor/d3-color");
|
|
22
|
-
var _web = require("@react-spring/web");
|
|
23
20
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
24
21
|
var _context = require("../context");
|
|
22
|
+
var _AnimatedBarElement = require("./AnimatedBarElement");
|
|
25
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
24
|
const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps", "style", "onClick"];
|
|
27
25
|
function getBarElementUtilityClass(slot) {
|
|
28
26
|
return (0, _generateUtilityClass.default)('MuiBarElement', slot);
|
|
29
27
|
}
|
|
30
|
-
const barElementClasses = exports.barElementClasses = (0, _generateUtilityClasses.default)('MuiBarElement', ['root']);
|
|
28
|
+
const barElementClasses = exports.barElementClasses = (0, _generateUtilityClasses.default)('MuiBarElement', ['root', 'highlighted', 'faded']);
|
|
31
29
|
const useUtilityClasses = ownerState => {
|
|
32
30
|
const {
|
|
33
31
|
classes,
|
|
34
|
-
id
|
|
32
|
+
id,
|
|
33
|
+
isHighlighted,
|
|
34
|
+
isFaded
|
|
35
35
|
} = ownerState;
|
|
36
36
|
const slots = {
|
|
37
|
-
root: ['root', `series-${id}
|
|
37
|
+
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
38
38
|
};
|
|
39
39
|
return (0, _composeClasses.default)(slots, getBarElementUtilityClass, classes);
|
|
40
40
|
};
|
|
41
|
-
const BarElementPath = exports.BarElementPath = (0, _styles.styled)(_web.animated.rect, {
|
|
42
|
-
name: 'MuiBarElement',
|
|
43
|
-
slot: 'Root',
|
|
44
|
-
overridesResolver: (_, styles) => styles.root
|
|
45
|
-
})(({
|
|
46
|
-
ownerState
|
|
47
|
-
}) => ({
|
|
48
|
-
stroke: 'none',
|
|
49
|
-
fill: ownerState.isHighlighted ? (0, _d3Color.color)(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
|
|
50
|
-
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
51
|
-
opacity: ownerState.isFaded && 0.3 || 1
|
|
52
|
-
}));
|
|
53
41
|
function BarElement(props) {
|
|
54
42
|
const {
|
|
55
43
|
id,
|
|
@@ -79,7 +67,7 @@ function BarElement(props) {
|
|
|
79
67
|
isHighlighted
|
|
80
68
|
};
|
|
81
69
|
const classes = useUtilityClasses(ownerState);
|
|
82
|
-
const Bar = slots?.bar ??
|
|
70
|
+
const Bar = slots?.bar ?? _AnimatedBarElement.AnimatedBarElement;
|
|
83
71
|
const barProps = (0, _useSlotProps.default)({
|
|
84
72
|
elementType: Bar,
|
|
85
73
|
externalSlotProps: slotProps?.bar,
|
|
@@ -91,7 +79,9 @@ function BarElement(props) {
|
|
|
91
79
|
}), {
|
|
92
80
|
style,
|
|
93
81
|
onClick,
|
|
94
|
-
cursor: onClick ? 'pointer' : 'unset'
|
|
82
|
+
cursor: onClick ? 'pointer' : 'unset',
|
|
83
|
+
stroke: 'none',
|
|
84
|
+
fill: color
|
|
95
85
|
}),
|
|
96
86
|
className: classes.root,
|
|
97
87
|
ownerState
|
package/node/BarChart/BarPlot.js
CHANGED
|
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _web = require("@react-spring/web");
|
|
15
|
+
var _styles = require("@mui/material/styles");
|
|
15
16
|
var _CartesianProvider = require("../context/CartesianProvider");
|
|
16
17
|
var _BarElement = require("./BarElement");
|
|
17
18
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
@@ -57,6 +58,7 @@ const useAggregatedData = () => {
|
|
|
57
58
|
seriesOrder: []
|
|
58
59
|
};
|
|
59
60
|
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
61
|
+
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
60
62
|
const chartId = (0, _hooks.useChartId)();
|
|
61
63
|
const {
|
|
62
64
|
series,
|
|
@@ -74,9 +76,13 @@ const useAggregatedData = () => {
|
|
|
74
76
|
const data = stackingGroups.flatMap(({
|
|
75
77
|
ids: groupIds
|
|
76
78
|
}, groupIndex) => {
|
|
79
|
+
const xMin = drawingArea.left;
|
|
80
|
+
const xMax = drawingArea.left + drawingArea.width;
|
|
81
|
+
const yMin = drawingArea.top;
|
|
82
|
+
const yMax = drawingArea.top + drawingArea.height;
|
|
77
83
|
return groupIds.flatMap(seriesId => {
|
|
78
|
-
const xAxisId = series[seriesId].xAxisId ??
|
|
79
|
-
const yAxisId = series[seriesId].yAxisId ??
|
|
84
|
+
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
85
|
+
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
80
86
|
const xAxisConfig = xAxis[xAxisId];
|
|
81
87
|
const yAxisConfig = yAxis[yAxisId];
|
|
82
88
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
@@ -117,6 +123,9 @@ const useAggregatedData = () => {
|
|
|
117
123
|
value: series[seriesId].data[dataIndex],
|
|
118
124
|
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
119
125
|
};
|
|
126
|
+
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
120
129
|
if (!masks[result.maskId]) {
|
|
121
130
|
masks[result.maskId] = {
|
|
122
131
|
id: result.maskId,
|
|
@@ -139,7 +148,7 @@ const useAggregatedData = () => {
|
|
|
139
148
|
mask.hasNegative = mask.hasNegative || (result.value ?? 0) < 0;
|
|
140
149
|
mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
|
|
141
150
|
return result;
|
|
142
|
-
});
|
|
151
|
+
}).filter(rectangle => rectangle !== null);
|
|
143
152
|
});
|
|
144
153
|
});
|
|
145
154
|
return {
|
|
@@ -177,6 +186,15 @@ const enterStyle = ({
|
|
|
177
186
|
height,
|
|
178
187
|
width
|
|
179
188
|
});
|
|
189
|
+
const BarPlotRoot = (0, _styles.styled)('g', {
|
|
190
|
+
name: 'MuiBarPlot',
|
|
191
|
+
slot: 'Root',
|
|
192
|
+
overridesResolver: (_, styles) => styles.root
|
|
193
|
+
})({
|
|
194
|
+
[`& .${_BarElement.barElementClasses.root}`]: {
|
|
195
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
196
|
+
}
|
|
197
|
+
});
|
|
180
198
|
|
|
181
199
|
/**
|
|
182
200
|
* Demos:
|
|
@@ -219,7 +237,7 @@ function BarPlot(props) {
|
|
|
219
237
|
update: enterStyle,
|
|
220
238
|
immediate: skipAnimation
|
|
221
239
|
});
|
|
222
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
240
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(BarPlotRoot, {
|
|
223
241
|
children: [!withoutBorderRadius && maskTransition((style, {
|
|
224
242
|
id,
|
|
225
243
|
hasPositive,
|
|
@@ -42,7 +42,7 @@ const getValueExtremum = direction => params => {
|
|
|
42
42
|
isDefaultAxis
|
|
43
43
|
} = params;
|
|
44
44
|
return Object.keys(series).filter(seriesId => {
|
|
45
|
-
const yAxisId = series[seriesId].yAxisId
|
|
45
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
46
46
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
47
47
|
}).reduce((acc, seriesId) => {
|
|
48
48
|
const {
|
|
@@ -51,8 +51,8 @@ const getValueExtremum = direction => params => {
|
|
|
51
51
|
const filter = getFilters?.({
|
|
52
52
|
currentAxisId: axis.id,
|
|
53
53
|
isDefaultAxis,
|
|
54
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
55
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
54
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
55
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
56
56
|
});
|
|
57
57
|
const [seriesMin, seriesMax] = stackedData?.reduce((seriesAcc, values, index) => {
|
|
58
58
|
if (filter && (!filter(createResult(values[0], direction), index) || !filter(createResult(values[1], direction), index))) {
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
12
12
|
var _constants = require("../constants");
|
|
13
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "
|
|
13
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
|
|
14
14
|
/**
|
|
15
15
|
* A helper function that extracts BarChartProps from the input props
|
|
16
16
|
* and returns an object with props for the children components of BarChart.
|
|
@@ -29,10 +29,8 @@ const useBarChartProps = props => {
|
|
|
29
29
|
colors,
|
|
30
30
|
dataset,
|
|
31
31
|
sx,
|
|
32
|
-
tooltip,
|
|
33
32
|
onAxisClick,
|
|
34
33
|
axisHighlight,
|
|
35
|
-
legend,
|
|
36
34
|
grid,
|
|
37
35
|
topAxis,
|
|
38
36
|
leftAxis,
|
|
@@ -81,7 +79,7 @@ const useBarChartProps = props => {
|
|
|
81
79
|
sx,
|
|
82
80
|
highlightedItem,
|
|
83
81
|
onHighlightChange,
|
|
84
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
82
|
+
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
85
83
|
className,
|
|
86
84
|
skipAnimation
|
|
87
85
|
});
|
|
@@ -123,14 +121,10 @@ const useBarChartProps = props => {
|
|
|
123
121
|
} : {
|
|
124
122
|
x: 'band'
|
|
125
123
|
}, axisHighlight);
|
|
126
|
-
const legendProps =
|
|
124
|
+
const legendProps = {
|
|
127
125
|
slots,
|
|
128
126
|
slotProps
|
|
129
|
-
}
|
|
130
|
-
const tooltipProps = (0, _extends2.default)({}, tooltip, {
|
|
131
|
-
slots,
|
|
132
|
-
slotProps
|
|
133
|
-
});
|
|
127
|
+
};
|
|
134
128
|
return {
|
|
135
129
|
chartContainerProps,
|
|
136
130
|
barPlotProps,
|
|
@@ -142,7 +136,6 @@ const useBarChartProps = props => {
|
|
|
142
136
|
chartsAxisProps,
|
|
143
137
|
axisHighlightProps,
|
|
144
138
|
legendProps,
|
|
145
|
-
tooltipProps,
|
|
146
139
|
children
|
|
147
140
|
};
|
|
148
141
|
};
|
|
@@ -10,45 +10,22 @@ exports.ChartContainer = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _InteractionProvider = require("../context/InteractionProvider");
|
|
16
|
-
var _ChartsSurface = require("../ChartsSurface");
|
|
17
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
18
|
-
var _ChartsAxesGradients = require("../internals/components/ChartsAxesGradients");
|
|
19
|
-
var _context = require("../context");
|
|
20
|
-
var _PluginProvider = require("../context/PluginProvider");
|
|
13
|
+
var _ChartDataProvider = require("../context/ChartDataProvider");
|
|
14
|
+
var _ResizableContainer = require("./ResizableContainer");
|
|
21
15
|
var _useChartContainerProps = require("./useChartContainerProps");
|
|
22
|
-
var
|
|
16
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
23
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
18
|
const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
25
19
|
const {
|
|
20
|
+
chartDataProviderProps,
|
|
26
21
|
children,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cartesianProviderProps,
|
|
30
|
-
zAxisContextProps,
|
|
31
|
-
highlightedProviderProps,
|
|
32
|
-
chartsSurfaceProps,
|
|
33
|
-
pluginProviderProps,
|
|
34
|
-
animationProviderProps
|
|
22
|
+
resizableContainerProps,
|
|
23
|
+
chartsSurfaceProps
|
|
35
24
|
} = (0, _useChartContainerProps.useChartContainerProps)(props, ref);
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
37
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
38
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
39
|
-
children:
|
|
40
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ZAxisContextProvider, (0, _extends2.default)({}, zAxisContextProps, {
|
|
41
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InteractionProvider.InteractionProvider, {
|
|
42
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.HighlightedProvider, (0, _extends2.default)({}, highlightedProviderProps, {
|
|
43
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
44
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxesGradients.ChartsAxesGradients, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnimationProvider.AnimationProvider, (0, _extends2.default)({}, animationProviderProps, {
|
|
45
|
-
children: children
|
|
46
|
-
}))]
|
|
47
|
-
}))
|
|
48
|
-
}))
|
|
49
|
-
})
|
|
50
|
-
}))
|
|
51
|
-
}))
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResizableContainer.ResizableContainer, (0, _extends2.default)({}, resizableContainerProps, {
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
28
|
+
children: children
|
|
52
29
|
}))
|
|
53
30
|
}))
|
|
54
31
|
}));
|
|
@@ -77,9 +54,9 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
77
54
|
*/
|
|
78
55
|
disableAxisListener: _propTypes.default.bool,
|
|
79
56
|
/**
|
|
80
|
-
* The height of the chart in px.
|
|
57
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
81
58
|
*/
|
|
82
|
-
height: _propTypes.default.number
|
|
59
|
+
height: _propTypes.default.number,
|
|
83
60
|
/**
|
|
84
61
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
85
62
|
*/
|
|
@@ -123,16 +100,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
123
100
|
skipAnimation: _propTypes.default.bool,
|
|
124
101
|
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]),
|
|
125
102
|
title: _propTypes.default.string,
|
|
126
|
-
viewBox: _propTypes.default.shape({
|
|
127
|
-
height: _propTypes.default.number,
|
|
128
|
-
width: _propTypes.default.number,
|
|
129
|
-
x: _propTypes.default.number,
|
|
130
|
-
y: _propTypes.default.number
|
|
131
|
-
}),
|
|
132
103
|
/**
|
|
133
|
-
* The width of the chart in px.
|
|
104
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
134
105
|
*/
|
|
135
|
-
width: _propTypes.default.number
|
|
106
|
+
width: _propTypes.default.number,
|
|
136
107
|
/**
|
|
137
108
|
* The configuration of the x-axes.
|
|
138
109
|
* If not provided, a default axis config is used.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ResizableContainer = ResizableContainer;
|
|
9
|
+
exports.ResizableContainerRoot = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _SizeProvider = require("../context/SizeProvider");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
* Wrapping div that take the shape of its parent.
|
|
18
|
+
*
|
|
19
|
+
* @ignore - do not document.
|
|
20
|
+
*/
|
|
21
|
+
const ResizableContainerRoot = exports.ResizableContainerRoot = (0, _styles.styled)('div', {
|
|
22
|
+
name: 'MuiResponsiveChart',
|
|
23
|
+
slot: 'Container'
|
|
24
|
+
})(({
|
|
25
|
+
ownerState
|
|
26
|
+
}) => ({
|
|
27
|
+
width: ownerState.width ?? '100%',
|
|
28
|
+
height: ownerState.height ?? '100%',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
position: 'relative',
|
|
31
|
+
flexGrow: 1,
|
|
32
|
+
flexDirection: 'column',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
overflow: 'hidden',
|
|
36
|
+
'&>svg': {
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: '100%'
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Wrapping div that take the shape of its parent.
|
|
44
|
+
*
|
|
45
|
+
* @ignore - do not document.
|
|
46
|
+
*/
|
|
47
|
+
function ResizableContainer(props) {
|
|
48
|
+
const {
|
|
49
|
+
inHeight,
|
|
50
|
+
inWidth,
|
|
51
|
+
containerRef
|
|
52
|
+
} = (0, _SizeProvider.useSize)();
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ResizableContainerRoot, (0, _extends2.default)({}, props, {
|
|
54
|
+
ownerState: {
|
|
55
|
+
width: inWidth,
|
|
56
|
+
height: inHeight
|
|
57
|
+
},
|
|
58
|
+
ref: containerRef,
|
|
59
|
+
children: props.children
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
process.env.NODE_ENV !== "production" ? ResizableContainer.propTypes = {
|
|
63
|
+
// ----------------------------- Warning --------------------------------
|
|
64
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
66
|
+
// ----------------------------------------------------------------------
|
|
67
|
+
children: _propTypes.default.node
|
|
68
|
+
} : void 0;
|
|
@@ -2,93 +2,62 @@
|
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
5
|
Object.defineProperty(exports, "__esModule", {
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
8
|
exports.useChartContainerProps = void 0;
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
-
|
|
13
|
-
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
14
|
-
var _useDefaultizeAxis = require("./useDefaultizeAxis");
|
|
15
|
-
const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children", "skipAnimation"];
|
|
10
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "xAxis", "yAxis", "zAxis", "skipAnimation"];
|
|
16
11
|
const useChartContainerProps = (props, ref) => {
|
|
17
12
|
const {
|
|
18
13
|
width,
|
|
19
14
|
height,
|
|
20
|
-
series,
|
|
21
15
|
margin,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
zAxis,
|
|
16
|
+
children,
|
|
17
|
+
series,
|
|
25
18
|
colors,
|
|
26
19
|
dataset,
|
|
27
|
-
sx,
|
|
28
|
-
title,
|
|
29
20
|
desc,
|
|
30
21
|
disableAxisListener,
|
|
31
22
|
highlightedItem,
|
|
32
23
|
onHighlightChange,
|
|
33
24
|
plugins,
|
|
34
|
-
|
|
25
|
+
sx,
|
|
26
|
+
title,
|
|
27
|
+
xAxis,
|
|
28
|
+
yAxis,
|
|
29
|
+
zAxis,
|
|
35
30
|
skipAnimation
|
|
36
31
|
} = props,
|
|
37
32
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
svgRef
|
|
46
|
-
};
|
|
47
|
-
const animationProviderProps = {
|
|
48
|
-
skipAnimation
|
|
49
|
-
};
|
|
50
|
-
const pluginProviderProps = {
|
|
51
|
-
plugins
|
|
33
|
+
const resizableContainerProps = other;
|
|
34
|
+
const chartsSurfaceProps = {
|
|
35
|
+
title,
|
|
36
|
+
desc,
|
|
37
|
+
sx,
|
|
38
|
+
disableAxisListener,
|
|
39
|
+
ref
|
|
52
40
|
};
|
|
53
|
-
const
|
|
41
|
+
const chartDataProviderProps = {
|
|
42
|
+
margin,
|
|
54
43
|
series,
|
|
55
44
|
colors,
|
|
56
|
-
dataset
|
|
57
|
-
};
|
|
58
|
-
const cartesianProviderProps = {
|
|
59
|
-
xAxis: defaultizedXAxis,
|
|
60
|
-
yAxis: defaultizedYAxis,
|
|
61
|
-
dataset
|
|
62
|
-
};
|
|
63
|
-
const zAxisContextProps = {
|
|
64
|
-
zAxis,
|
|
65
|
-
dataset
|
|
66
|
-
};
|
|
67
|
-
const highlightedProviderProps = {
|
|
45
|
+
dataset,
|
|
68
46
|
highlightedItem,
|
|
69
|
-
onHighlightChange
|
|
70
|
-
|
|
71
|
-
|
|
47
|
+
onHighlightChange,
|
|
48
|
+
plugins,
|
|
49
|
+
xAxis,
|
|
50
|
+
yAxis,
|
|
51
|
+
zAxis,
|
|
52
|
+
skipAnimation,
|
|
72
53
|
width,
|
|
73
|
-
height
|
|
74
|
-
|
|
75
|
-
sx,
|
|
76
|
-
title,
|
|
77
|
-
desc,
|
|
78
|
-
disableAxisListener
|
|
79
|
-
});
|
|
54
|
+
height
|
|
55
|
+
};
|
|
80
56
|
return {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
seriesProviderProps,
|
|
84
|
-
cartesianProviderProps,
|
|
85
|
-
zAxisContextProps,
|
|
86
|
-
highlightedProviderProps,
|
|
57
|
+
chartDataProviderProps,
|
|
58
|
+
resizableContainerProps,
|
|
87
59
|
chartsSurfaceProps,
|
|
88
|
-
|
|
89
|
-
animationProviderProps,
|
|
90
|
-
xAxis: defaultizedXAxis,
|
|
91
|
-
yAxis: defaultizedYAxis
|
|
60
|
+
children
|
|
92
61
|
};
|
|
93
62
|
};
|
|
94
63
|
exports.useChartContainerProps = useChartContainerProps;
|
|
@@ -1,66 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ChartsAxisHighlight = ChartsAxisHighlight;
|
|
10
|
-
exports.chartsAxisHighlightClasses = exports.ChartsAxisHighlightPath = void 0;
|
|
11
|
-
exports.getAxisHighlightUtilityClass = getAxisHighlightUtilityClass;
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
10
|
var React = _interopRequireWildcard(require("react"));
|
|
14
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _InteractionProvider = require("../context/InteractionProvider");
|
|
20
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
21
|
-
var _useScale = require("../hooks/useScale");
|
|
22
|
-
var _isBandScale = require("../internals/isBandScale");
|
|
13
|
+
var _chartsAxisHighlightClasses = require("./chartsAxisHighlightClasses");
|
|
14
|
+
var _ChartsYAxisHighlight = _interopRequireDefault(require("./ChartsYAxisHighlight"));
|
|
15
|
+
var _ChartsXAxisHighlight = _interopRequireDefault(require("./ChartsXAxisHighlight"));
|
|
23
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
function getAxisHighlightUtilityClass(slot) {
|
|
25
|
-
return (0, _generateUtilityClass.default)('MuiChartsAxisHighlight', slot);
|
|
26
|
-
}
|
|
27
|
-
const chartsAxisHighlightClasses = exports.chartsAxisHighlightClasses = (0, _generateUtilityClasses.default)('MuiChartsAxisHighlight', ['root']);
|
|
28
17
|
const useUtilityClasses = () => {
|
|
29
18
|
const slots = {
|
|
30
19
|
root: ['root']
|
|
31
20
|
};
|
|
32
|
-
return (0, _composeClasses.default)(slots, getAxisHighlightUtilityClass);
|
|
21
|
+
return (0, _composeClasses.default)(slots, _chartsAxisHighlightClasses.getAxisHighlightUtilityClass);
|
|
33
22
|
};
|
|
34
|
-
|
|
35
|
-
name: 'MuiChartsAxisHighlight',
|
|
36
|
-
slot: 'Root',
|
|
37
|
-
overridesResolver: (_, styles) => styles.root
|
|
38
|
-
})(({
|
|
39
|
-
theme
|
|
40
|
-
}) => ({
|
|
41
|
-
pointerEvents: 'none',
|
|
42
|
-
variants: [{
|
|
43
|
-
props: {
|
|
44
|
-
axisHighlight: 'band'
|
|
45
|
-
},
|
|
46
|
-
style: (0, _extends2.default)({
|
|
47
|
-
fill: 'white',
|
|
48
|
-
fillOpacity: 0.1
|
|
49
|
-
}, theme.applyStyles('light', {
|
|
50
|
-
fill: 'gray'
|
|
51
|
-
}))
|
|
52
|
-
}, {
|
|
53
|
-
props: {
|
|
54
|
-
axisHighlight: 'line'
|
|
55
|
-
},
|
|
56
|
-
style: (0, _extends2.default)({
|
|
57
|
-
strokeDasharray: '5 2',
|
|
58
|
-
stroke: '#ffffff'
|
|
59
|
-
}, theme.applyStyles('light', {
|
|
60
|
-
stroke: '#000000'
|
|
61
|
-
}))
|
|
62
|
-
}]
|
|
63
|
-
}));
|
|
23
|
+
|
|
64
24
|
/**
|
|
65
25
|
* Demos:
|
|
66
26
|
*
|
|
@@ -75,62 +35,14 @@ function ChartsAxisHighlight(props) {
|
|
|
75
35
|
x: xAxisHighlight,
|
|
76
36
|
y: yAxisHighlight
|
|
77
37
|
} = props;
|
|
78
|
-
const {
|
|
79
|
-
xAxisIds,
|
|
80
|
-
xAxis,
|
|
81
|
-
yAxisIds,
|
|
82
|
-
yAxis
|
|
83
|
-
} = (0, _CartesianProvider.useCartesianContext)();
|
|
84
38
|
const classes = useUtilityClasses();
|
|
85
|
-
const USED_X_AXIS_ID = xAxisIds[0];
|
|
86
|
-
const USED_Y_AXIS_ID = yAxisIds[0];
|
|
87
|
-
const xScale = xAxis[USED_X_AXIS_ID].scale;
|
|
88
|
-
const yScale = yAxis[USED_Y_AXIS_ID].scale;
|
|
89
|
-
const {
|
|
90
|
-
axis
|
|
91
|
-
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
92
|
-
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
93
|
-
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
94
|
-
const axisX = axis.x;
|
|
95
|
-
const axisY = axis.y;
|
|
96
|
-
const isBandScaleX = xAxisHighlight === 'band' && axisX !== null && (0, _isBandScale.isBandScale)(xScale);
|
|
97
|
-
const isBandScaleY = yAxisHighlight === 'band' && axisY !== null && (0, _isBandScale.isBandScale)(yScale);
|
|
98
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
99
|
-
const isXError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
100
|
-
const isYError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
101
|
-
if (isXError || isYError) {
|
|
102
|
-
console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
106
|
-
children: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
axisHighlight: 'band'
|
|
113
|
-
}
|
|
114
|
-
}), isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
115
|
-
d: `M ${xScale.range()[0]} ${
|
|
116
|
-
// @ts-expect-error, yScale value is checked in the statement above
|
|
117
|
-
yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${xScale.range()[1] - xScale.range()[0]} 0 l 0 ${-yScale.step()} Z`,
|
|
118
|
-
className: classes.root,
|
|
119
|
-
ownerState: {
|
|
120
|
-
axisHighlight: 'band'
|
|
121
|
-
}
|
|
122
|
-
}), xAxisHighlight === 'line' && axis.x !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
123
|
-
d: `M ${getXPosition(axis.x.value)} ${yScale.range()[0]} L ${getXPosition(axis.x.value)} ${yScale.range()[1]}`,
|
|
124
|
-
className: classes.root,
|
|
125
|
-
ownerState: {
|
|
126
|
-
axisHighlight: 'line'
|
|
127
|
-
}
|
|
128
|
-
}), yAxisHighlight === 'line' && axis.y !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
129
|
-
d: `M ${xScale.range()[0]} ${getYPosition(axis.y.value)} L ${xScale.range()[1]} ${getYPosition(axis.y.value)}`,
|
|
130
|
-
className: classes.root,
|
|
131
|
-
ownerState: {
|
|
132
|
-
axisHighlight: 'line'
|
|
133
|
-
}
|
|
40
|
+
children: [xAxisHighlight && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsXAxisHighlight.default, {
|
|
41
|
+
type: xAxisHighlight,
|
|
42
|
+
classes: classes
|
|
43
|
+
}), yAxisHighlight && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsYAxisHighlight.default, {
|
|
44
|
+
type: yAxisHighlight,
|
|
45
|
+
classes: classes
|
|
134
46
|
})]
|
|
135
47
|
});
|
|
136
48
|
}
|