@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
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
5
4
|
import { useSeries } from "../hooks/useSeries.js";
|
|
6
5
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
7
6
|
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
8
7
|
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
8
|
+
import { useStore } from "../internals/useStore.js";
|
|
9
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
9
10
|
import { getLabel } from "../internals/getLabel.js";
|
|
10
11
|
import { isCartesianSeriesType } from "../internals/isCartesian.js";
|
|
11
12
|
import { utcFormatter } from "./utils.js";
|
|
13
|
+
import { useXAxis, useYAxis } from "../hooks/useAxis.js";
|
|
14
|
+
import { selectorChartsInteractionXAxis, selectorChartsInteractionYAxis } from "../context/InteractionSelectors.js";
|
|
12
15
|
export function useAxisTooltip() {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
const defaultXAxis = useXAxis();
|
|
17
|
+
const defaultYAxis = useYAxis();
|
|
18
|
+
const xAxisHasData = defaultXAxis.data !== undefined && defaultXAxis.data.length !== 0;
|
|
19
|
+
const store = useStore();
|
|
20
|
+
const axisData = useSelector(store, xAxisHasData ? selectorChartsInteractionXAxis : selectorChartsInteractionYAxis);
|
|
16
21
|
const series = useSeries();
|
|
17
22
|
const {
|
|
18
23
|
xAxis,
|
|
19
|
-
yAxis
|
|
20
|
-
xAxisIds,
|
|
21
|
-
yAxisIds
|
|
24
|
+
yAxis
|
|
22
25
|
} = useCartesianContext();
|
|
23
26
|
const {
|
|
24
27
|
zAxis,
|
|
25
28
|
zAxisIds
|
|
26
29
|
} = React.useContext(ZAxisContext);
|
|
27
30
|
const colorProcessors = useColorProcessor();
|
|
28
|
-
|
|
29
|
-
// By default use the x-axis
|
|
30
|
-
const isXaxis = axis.x !== null && axis.x.index !== -1;
|
|
31
|
-
const axisData = isXaxis ? axis.x && axis.x : axis.y && axis.y;
|
|
32
31
|
if (axisData === null) {
|
|
33
32
|
return null;
|
|
34
33
|
}
|
|
@@ -36,8 +35,8 @@ export function useAxisTooltip() {
|
|
|
36
35
|
index: dataIndex,
|
|
37
36
|
value: axisValue
|
|
38
37
|
} = axisData;
|
|
39
|
-
const USED_AXIS_ID =
|
|
40
|
-
const usedAxis =
|
|
38
|
+
const USED_AXIS_ID = xAxisHasData ? defaultXAxis.id : defaultYAxis.id;
|
|
39
|
+
const usedAxis = xAxisHasData ? defaultXAxis : defaultYAxis;
|
|
41
40
|
const relevantSeries = Object.keys(series).filter(isCartesianSeriesType).flatMap(seriesType => {
|
|
42
41
|
const seriesOfType = series[seriesType];
|
|
43
42
|
if (!seriesOfType) {
|
|
@@ -45,16 +44,16 @@ export function useAxisTooltip() {
|
|
|
45
44
|
}
|
|
46
45
|
return seriesOfType.seriesOrder.map(seriesId => {
|
|
47
46
|
const seriesToAdd = seriesOfType.series[seriesId];
|
|
48
|
-
const providedXAxisId = seriesToAdd.xAxisId
|
|
49
|
-
const providedYAxisId = seriesToAdd.yAxisId
|
|
50
|
-
const axisKey =
|
|
47
|
+
const providedXAxisId = seriesToAdd.xAxisId;
|
|
48
|
+
const providedYAxisId = seriesToAdd.yAxisId;
|
|
49
|
+
const axisKey = xAxisHasData ? providedXAxisId : providedYAxisId;
|
|
51
50
|
|
|
52
51
|
// Test if the series uses the default axis
|
|
53
52
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
54
|
-
const xAxisId = providedXAxisId ??
|
|
55
|
-
const yAxisId = providedYAxisId ??
|
|
56
|
-
const zAxisId =
|
|
57
|
-
const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId
|
|
53
|
+
const xAxisId = providedXAxisId ?? defaultXAxis.id;
|
|
54
|
+
const yAxisId = providedYAxisId ?? defaultYAxis.id;
|
|
55
|
+
const zAxisId = 'zAxisId' in seriesToAdd ? seriesToAdd.zAxisId : zAxisIds[0];
|
|
56
|
+
const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId ? zAxis[zAxisId] : undefined)(dataIndex) ?? '';
|
|
58
57
|
const value = seriesToAdd.data[dataIndex] ?? null;
|
|
59
58
|
const formattedValue = seriesToAdd.valueFormatter(value, {
|
|
60
59
|
dataIndex
|
|
@@ -76,7 +75,8 @@ export function useAxisTooltip() {
|
|
|
76
75
|
location: 'tooltip'
|
|
77
76
|
});
|
|
78
77
|
return {
|
|
79
|
-
|
|
78
|
+
axisDirection: xAxisHasData ? 'x' : 'y',
|
|
79
|
+
dataIndex,
|
|
80
80
|
seriesItems: relevantSeries,
|
|
81
81
|
axisValue,
|
|
82
82
|
axisFormattedValue
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
6
5
|
import { useSeries } from "../hooks/useSeries.js";
|
|
7
6
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
8
7
|
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
9
8
|
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
10
9
|
import { getLabel } from "../internals/getLabel.js";
|
|
10
|
+
import { selectorChartsInteractionItem } from "../context/InteractionSelectors.js";
|
|
11
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
12
|
+
import { useStore } from "../internals/useStore.js";
|
|
11
13
|
export function useItemTooltip() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
} = React.useContext(InteractionContext);
|
|
14
|
+
const store = useStore();
|
|
15
|
+
const item = useSelector(store, selectorChartsInteractionItem);
|
|
15
16
|
const series = useSeries();
|
|
16
17
|
const {
|
|
17
18
|
xAxis,
|
|
@@ -24,9 +25,9 @@ export function useItemTooltip() {
|
|
|
24
25
|
zAxisIds
|
|
25
26
|
} = React.useContext(ZAxisContext);
|
|
26
27
|
const colorProcessors = useColorProcessor();
|
|
27
|
-
const xAxisId = series.xAxisId ??
|
|
28
|
-
const yAxisId = series.yAxisId ??
|
|
29
|
-
const zAxisId = series.zAxisId ??
|
|
28
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
29
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
30
|
+
const zAxisId = series.zAxisId ?? zAxisIds[0];
|
|
30
31
|
if (!item || item.dataIndex === undefined) {
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
@@ -1,42 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useSvgRef } from "../hooks/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
getBoundingClientRect: () => ({
|
|
8
|
-
width: 0,
|
|
9
|
-
height: 0,
|
|
10
|
-
x: 0,
|
|
11
|
-
y: 0,
|
|
12
|
-
top: 0,
|
|
13
|
-
right: 0,
|
|
14
|
-
bottom: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
toJSON: () => ''
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const {
|
|
21
|
-
x,
|
|
22
|
-
y
|
|
23
|
-
} = mousePosition;
|
|
24
|
-
const boundingBox = {
|
|
25
|
-
width: 0,
|
|
26
|
-
height: 0,
|
|
27
|
-
x,
|
|
28
|
-
y,
|
|
29
|
-
top: y,
|
|
30
|
-
right: x,
|
|
31
|
-
bottom: y,
|
|
32
|
-
left: x
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
getBoundingClientRect: () => _extends({}, boundingBox, {
|
|
36
|
-
toJSON: () => JSON.stringify(boundingBox)
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated We recommend using vanilla JS to let popper track mouse position.
|
|
5
|
+
*/
|
|
40
6
|
export function useMouseTracker() {
|
|
41
7
|
const svgRef = useSvgRef();
|
|
42
8
|
|
|
@@ -47,6 +13,7 @@ export function useMouseTracker() {
|
|
|
47
13
|
if (element === null) {
|
|
48
14
|
return () => {};
|
|
49
15
|
}
|
|
16
|
+
const controller = new AbortController();
|
|
50
17
|
const handleOut = event => {
|
|
51
18
|
if (event.pointerType !== 'mouse') {
|
|
52
19
|
setMousePosition(null);
|
|
@@ -60,24 +27,52 @@ export function useMouseTracker() {
|
|
|
60
27
|
pointerType: event.pointerType
|
|
61
28
|
});
|
|
62
29
|
};
|
|
63
|
-
element.addEventListener('pointerdown', handleMove
|
|
64
|
-
|
|
65
|
-
|
|
30
|
+
element.addEventListener('pointerdown', handleMove, {
|
|
31
|
+
signal: controller.signal
|
|
32
|
+
});
|
|
33
|
+
element.addEventListener('pointermove', handleMove, {
|
|
34
|
+
signal: controller.signal
|
|
35
|
+
});
|
|
36
|
+
element.addEventListener('pointerup', handleOut, {
|
|
37
|
+
signal: controller.signal
|
|
38
|
+
});
|
|
66
39
|
return () => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
40
|
+
// Calling `.abort()` removes ALL event listeners
|
|
41
|
+
// For more info, see https://kettanaito.com/blog/dont-sleep-on-abort-controller
|
|
42
|
+
controller.abort();
|
|
70
43
|
};
|
|
71
44
|
}, [svgRef]);
|
|
72
45
|
return mousePosition;
|
|
73
46
|
}
|
|
74
|
-
export function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
47
|
+
export function usePointerType() {
|
|
48
|
+
const svgRef = useSvgRef();
|
|
49
|
+
|
|
50
|
+
// Use a ref to avoid rerendering on every mousemove event.
|
|
51
|
+
const [pointerType, setPointerType] = React.useState(null);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
const element = svgRef.current;
|
|
54
|
+
if (element === null) {
|
|
55
|
+
return () => {};
|
|
56
|
+
}
|
|
57
|
+
const handleOut = event => {
|
|
58
|
+
if (event.pointerType !== 'mouse') {
|
|
59
|
+
setPointerType(null);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const handleEnter = event => {
|
|
63
|
+
setPointerType({
|
|
64
|
+
height: event.height,
|
|
65
|
+
pointerType: event.pointerType
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
element.addEventListener('pointerenter', handleEnter);
|
|
69
|
+
element.addEventListener('pointerup', handleOut);
|
|
70
|
+
return () => {
|
|
71
|
+
element.removeEventListener('pointerenter', handleEnter);
|
|
72
|
+
element.removeEventListener('pointerup', handleOut);
|
|
73
|
+
};
|
|
74
|
+
}, [svgRef]);
|
|
75
|
+
return pointerType;
|
|
81
76
|
}
|
|
82
77
|
export function utcFormatter(v) {
|
|
83
78
|
if (v instanceof Date) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { Delaunay } from '@mui/x-charts-vendor/d3-delaunay';
|
|
6
7
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
7
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
8
8
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
9
9
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
10
|
+
import { useStore } from "../internals/useStore.js";
|
|
10
11
|
import { getSVGPoint } from "../internals/getSVGPoint.js";
|
|
11
12
|
import { useDrawingArea, useSvgRef } from "../hooks/index.js";
|
|
12
13
|
import { useHighlighted } from "../context/index.js";
|
|
@@ -25,9 +26,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
25
26
|
xAxisIds,
|
|
26
27
|
yAxisIds
|
|
27
28
|
} = useCartesianContext();
|
|
28
|
-
const
|
|
29
|
-
dispatch
|
|
30
|
-
} = React.useContext(InteractionContext);
|
|
29
|
+
const store = useStore();
|
|
31
30
|
const {
|
|
32
31
|
series,
|
|
33
32
|
seriesOrder
|
|
@@ -42,17 +41,19 @@ function ChartsVoronoiHandler(props) {
|
|
|
42
41
|
const defaultXAxisId = xAxisIds[0];
|
|
43
42
|
const defaultYAxisId = yAxisIds[0];
|
|
44
43
|
useEnhancedEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
store.update(prev => _extends({}, prev, {
|
|
45
|
+
interaction: _extends({}, prev.interaction, {
|
|
46
|
+
useVoronoiInteraction: true
|
|
47
|
+
})
|
|
48
|
+
}));
|
|
49
49
|
return () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
store.update(prev => _extends({}, prev, {
|
|
51
|
+
interaction: _extends({}, prev.interaction, {
|
|
52
|
+
useVoronoiInteraction: false
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
54
55
|
};
|
|
55
|
-
}, [
|
|
56
|
+
}, [store]);
|
|
56
57
|
useEnhancedEffect(() => {
|
|
57
58
|
// This effect generate and store the Delaunay object that's used to map coordinate to closest point.
|
|
58
59
|
|
|
@@ -66,12 +67,10 @@ function ChartsVoronoiHandler(props) {
|
|
|
66
67
|
const {
|
|
67
68
|
data,
|
|
68
69
|
xAxisId,
|
|
69
|
-
yAxisId
|
|
70
|
-
xAxisKey,
|
|
71
|
-
yAxisKey
|
|
70
|
+
yAxisId
|
|
72
71
|
} = series[seriesId];
|
|
73
|
-
const xScale = xAxis[xAxisId ??
|
|
74
|
-
const yScale = yAxis[yAxisId ??
|
|
72
|
+
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
73
|
+
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
75
74
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
76
75
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
77
76
|
const seriesPoints = data.flatMap(({
|
|
@@ -143,27 +142,38 @@ function ChartsVoronoiHandler(props) {
|
|
|
143
142
|
};
|
|
144
143
|
}
|
|
145
144
|
const handleMouseLeave = () => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
store.update(prev => _extends({}, prev, {
|
|
146
|
+
interaction: _extends({}, prev.interaction, {
|
|
147
|
+
axis: {
|
|
148
|
+
x: null,
|
|
149
|
+
y: null
|
|
150
|
+
},
|
|
151
|
+
item: null
|
|
152
|
+
})
|
|
153
|
+
}));
|
|
149
154
|
clearHighlighted();
|
|
150
155
|
};
|
|
151
156
|
const handleMouseMove = event => {
|
|
152
157
|
const closestPoint = getClosestPoint(event);
|
|
153
158
|
if (closestPoint === 'outside-chart') {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
store.update(prev => _extends({}, prev, {
|
|
160
|
+
interaction: _extends({}, prev.interaction, {
|
|
161
|
+
axis: {
|
|
162
|
+
x: null,
|
|
163
|
+
y: null
|
|
164
|
+
},
|
|
165
|
+
item: null
|
|
166
|
+
})
|
|
167
|
+
}));
|
|
157
168
|
clearHighlighted();
|
|
158
169
|
return;
|
|
159
170
|
}
|
|
160
171
|
if (closestPoint === 'outside-voronoi-max-radius' || closestPoint === 'no-point-found') {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
});
|
|
172
|
+
store.update(prev => _extends({}, prev, {
|
|
173
|
+
interaction: _extends({}, prev.interaction, {
|
|
174
|
+
item: null
|
|
175
|
+
})
|
|
176
|
+
}));
|
|
167
177
|
clearHighlighted();
|
|
168
178
|
return;
|
|
169
179
|
}
|
|
@@ -171,14 +181,15 @@ function ChartsVoronoiHandler(props) {
|
|
|
171
181
|
seriesId,
|
|
172
182
|
dataIndex
|
|
173
183
|
} = closestPoint;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
store.update(prev => _extends({}, prev, {
|
|
185
|
+
interaction: _extends({}, prev.interaction, {
|
|
186
|
+
item: {
|
|
187
|
+
type: 'scatter',
|
|
188
|
+
seriesId,
|
|
189
|
+
dataIndex
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
}));
|
|
182
193
|
setHighlighted({
|
|
183
194
|
seriesId,
|
|
184
195
|
dataIndex
|
|
@@ -211,7 +222,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
211
222
|
element.removeEventListener('pointermove', handleMouseMove);
|
|
212
223
|
element.removeEventListener('click', handleMouseClick);
|
|
213
224
|
};
|
|
214
|
-
}, [svgRef,
|
|
225
|
+
}, [svgRef, yAxis, xAxis, voronoiMaxRadius, onItemClick, setHighlighted, clearHighlighted, drawingArea, store]);
|
|
215
226
|
|
|
216
227
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
217
228
|
return /*#__PURE__*/_jsx(React.Fragment, {});
|
package/modern/Gauge/Gauge.js
CHANGED
|
@@ -137,12 +137,6 @@ process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
|
|
|
137
137
|
* @default 0
|
|
138
138
|
*/
|
|
139
139
|
valueMin: PropTypes.number,
|
|
140
|
-
viewBox: PropTypes.shape({
|
|
141
|
-
height: PropTypes.number,
|
|
142
|
-
width: PropTypes.number,
|
|
143
|
-
x: PropTypes.number,
|
|
144
|
-
y: PropTypes.number
|
|
145
|
-
}),
|
|
146
140
|
/**
|
|
147
141
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
148
142
|
*/
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
const _excluded = ["width", "height", "margin", "title", "desc", "value", "valueMin", "valueMax", "startAngle", "endAngle", "outerRadius", "innerRadius", "cornerRadius", "cx", "cy", "children"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
10
|
-
import { useChartContainerDimensions } from "../ResponsiveChartContainer/useChartContainerDimensions.js";
|
|
11
9
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
12
|
-
import {
|
|
10
|
+
import { DrawingAreaProvider } from "../context/DrawingAreaProvider/index.js";
|
|
13
11
|
import { GaugeProvider } from "./GaugeProvider.js";
|
|
12
|
+
import { SizeProvider, useSize } from "../context/SizeProvider/index.js";
|
|
13
|
+
import { SvgRefProvider } from "../context/SvgRefProvider/index.js";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const
|
|
15
|
+
const ResizableContainerRoot = styled('div', {
|
|
16
16
|
name: 'MuiGauge',
|
|
17
17
|
slot: 'Container'
|
|
18
18
|
})(({
|
|
@@ -36,6 +36,22 @@ const ResizableContainer = styled('div', {
|
|
|
36
36
|
fill: (theme.vars || theme).palette.text.primary
|
|
37
37
|
}
|
|
38
38
|
}));
|
|
39
|
+
function ResizableContainer(props) {
|
|
40
|
+
const {
|
|
41
|
+
inHeight,
|
|
42
|
+
inWidth,
|
|
43
|
+
hasIntrinsicSize,
|
|
44
|
+
containerRef
|
|
45
|
+
} = useSize();
|
|
46
|
+
return /*#__PURE__*/_jsx(ResizableContainerRoot, _extends({}, props, {
|
|
47
|
+
ownerState: {
|
|
48
|
+
width: inWidth,
|
|
49
|
+
height: inHeight
|
|
50
|
+
},
|
|
51
|
+
ref: containerRef,
|
|
52
|
+
children: hasIntrinsicSize && props.children
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
39
55
|
const GaugeContainer = /*#__PURE__*/React.forwardRef(function GaugeContainer(props, ref) {
|
|
40
56
|
const {
|
|
41
57
|
width: inWidth,
|
|
@@ -56,58 +72,47 @@ const GaugeContainer = /*#__PURE__*/React.forwardRef(function GaugeContainer(pro
|
|
|
56
72
|
children
|
|
57
73
|
} = props,
|
|
58
74
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
cx: cx,
|
|
97
|
-
cy: cy,
|
|
98
|
-
children: /*#__PURE__*/_jsx(ChartsSurface, {
|
|
99
|
-
width: width,
|
|
100
|
-
height: height,
|
|
101
|
-
ref: chartSurfaceRef,
|
|
102
|
-
title: title,
|
|
103
|
-
desc: desc,
|
|
104
|
-
disableAxisListener: true,
|
|
105
|
-
"aria-hidden": "true",
|
|
106
|
-
children: children
|
|
75
|
+
return /*#__PURE__*/_jsx(SizeProvider, {
|
|
76
|
+
width: inWidth,
|
|
77
|
+
height: inHeight,
|
|
78
|
+
children: /*#__PURE__*/_jsx(SvgRefProvider, {
|
|
79
|
+
children: /*#__PURE__*/_jsx(DrawingAreaProvider, {
|
|
80
|
+
margin: _extends({
|
|
81
|
+
left: 10,
|
|
82
|
+
right: 10,
|
|
83
|
+
top: 10,
|
|
84
|
+
bottom: 10
|
|
85
|
+
}, margin),
|
|
86
|
+
children: /*#__PURE__*/_jsx(GaugeProvider, {
|
|
87
|
+
value: value,
|
|
88
|
+
valueMin: valueMin,
|
|
89
|
+
valueMax: valueMax,
|
|
90
|
+
startAngle: startAngle,
|
|
91
|
+
endAngle: endAngle,
|
|
92
|
+
outerRadius: outerRadius,
|
|
93
|
+
innerRadius: innerRadius,
|
|
94
|
+
cornerRadius: cornerRadius,
|
|
95
|
+
cx: cx,
|
|
96
|
+
cy: cy,
|
|
97
|
+
children: /*#__PURE__*/_jsx(ResizableContainer, _extends({
|
|
98
|
+
role: "meter",
|
|
99
|
+
"aria-valuenow": value === null ? undefined : value,
|
|
100
|
+
"aria-valuemin": valueMin,
|
|
101
|
+
"aria-valuemax": valueMax
|
|
102
|
+
}, other, {
|
|
103
|
+
children: /*#__PURE__*/_jsx(ChartsSurface, {
|
|
104
|
+
title: title,
|
|
105
|
+
desc: desc,
|
|
106
|
+
disableAxisListener: true,
|
|
107
|
+
"aria-hidden": "true",
|
|
108
|
+
ref: ref,
|
|
109
|
+
children: children
|
|
110
|
+
})
|
|
111
|
+
}))
|
|
107
112
|
})
|
|
108
113
|
})
|
|
109
|
-
})
|
|
110
|
-
})
|
|
114
|
+
})
|
|
115
|
+
});
|
|
111
116
|
});
|
|
112
117
|
process.env.NODE_ENV !== "production" ? GaugeContainer.propTypes = {
|
|
113
118
|
// ----------------------------- Warning --------------------------------
|
|
@@ -198,12 +203,6 @@ process.env.NODE_ENV !== "production" ? GaugeContainer.propTypes = {
|
|
|
198
203
|
* @default 0
|
|
199
204
|
*/
|
|
200
205
|
valueMin: PropTypes.number,
|
|
201
|
-
viewBox: PropTypes.shape({
|
|
202
|
-
height: PropTypes.number,
|
|
203
|
-
width: PropTypes.number,
|
|
204
|
-
x: PropTypes.number,
|
|
205
|
-
y: PropTypes.number
|
|
206
|
-
}),
|
|
207
206
|
/**
|
|
208
207
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
209
208
|
*/
|
|
@@ -5,24 +5,10 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { styled } from '@mui/material/styles';
|
|
9
8
|
import { animated, useTransition } from '@react-spring/web';
|
|
10
|
-
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
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 AreaElementPath = styled(animated.path, {
|
|
15
|
-
name: 'MuiAreaElement',
|
|
16
|
-
slot: 'Root',
|
|
17
|
-
overridesResolver: (_, styles) => styles.root
|
|
18
|
-
})(({
|
|
19
|
-
ownerState
|
|
20
|
-
}) => ({
|
|
21
|
-
stroke: 'none',
|
|
22
|
-
fill: ownerState.gradientId && `url(#${ownerState.gradientId})` || ownerState.isHighlighted && d3Color(ownerState.color).brighter(1).formatHex() || d3Color(ownerState.color).brighter(0.5).formatHex(),
|
|
23
|
-
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
24
|
-
opacity: ownerState.isFaded ? 0.3 : 1
|
|
25
|
-
}));
|
|
26
12
|
/**
|
|
27
13
|
* Demos:
|
|
28
14
|
*
|
|
@@ -57,10 +43,15 @@ function AnimatedArea(props) {
|
|
|
57
43
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
58
44
|
skipAnimation: skipAnimation,
|
|
59
45
|
id: `${ownerState.id}-area-clip`,
|
|
60
|
-
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(animated.path, _extends({
|
|
47
|
+
d: style.value.to(interpolator),
|
|
48
|
+
fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
49
|
+
filter:
|
|
50
|
+
// eslint-disable-next-line no-nested-ternary
|
|
51
|
+
ownerState.isHighlighted ? 'brightness(140%)' : ownerState.gradientId ? undefined : 'brightness(120%)',
|
|
52
|
+
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
53
|
+
stroke: "none"
|
|
54
|
+
}, other)))
|
|
64
55
|
});
|
|
65
56
|
}
|
|
66
57
|
process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
|
|
@@ -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 = {
|