@mui/x-charts 8.0.0-alpha.0 → 8.0.0-alpha.2
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 +4 -9
- package/BarChart/BarChart.js +3 -35
- package/BarChart/BarElement.d.ts +5 -1342
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarLabel/BarLabel.d.ts +298 -298
- package/BarChart/BarPlot.js +12 -2
- package/BarChart/useBarChartProps.d.ts +0 -2
- package/BarChart/useBarChartProps.js +2 -8
- package/CHANGELOG.md +651 -6
- package/ChartContainer/ChartContainer.d.ts +26 -19
- package/ChartContainer/ChartContainer.js +31 -25
- package/ChartContainer/useChartContainerProps.d.ts +5 -7
- package/ChartContainer/useChartContainerProps.js +12 -27
- package/ChartsAxis/axisClasses.js +2 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -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/LegendPerItem.d.ts +2 -2
- package/ChartsLegend/chartsLegendClasses.js +2 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/ChartsSurface/ChartsSurface.d.ts +14 -15
- package/ChartsSurface/ChartsSurface.js +68 -35
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartTooltip.types.js +1 -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 +143 -145
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +280 -0
- package/ChartsTooltip/ChartsTooltipTable.js +1 -1
- 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 +19 -19
- package/ChartsTooltip/useItemTooltip.d.ts +2 -3
- package/ChartsTooltip/useItemTooltip.js +5 -4
- package/ChartsTooltip/utils.d.ts +0 -3
- package/ChartsTooltip/utils.js +0 -8
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
- package/ChartsXAxis/ChartsXAxis.js +3 -17
- package/ChartsYAxis/ChartsYAxis.js +2 -17
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +42 -76
- 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/AreaPlot.js +12 -2
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +4 -10
- package/LineChart/LineChart.js +3 -36
- package/LineChart/LineHighlightPlot.js +6 -5
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/useLineChartProps.d.ts +0 -2
- package/LineChart/useLineChartProps.js +2 -8
- package/PieChart/PieChart.d.ts +3 -9
- package/PieChart/PieChart.js +5 -41
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +2 -2
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +4 -10
- package/ScatterChart/ScatterChart.js +5 -36
- package/ScatterChart/useScatterChartProps.d.ts +0 -2
- package/ScatterChart/useScatterChartProps.js +1 -9
- package/SparkLineChart/SparkLineChart.d.ts +3 -4
- package/SparkLineChart/SparkLineChart.js +4 -35
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -11
- package/context/ChartDataProvider/ChartDataProvider.d.ts +36 -19
- package/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +25 -32
- package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -11
- package/context/ChartProvider/ChartContext.d.ts +6 -0
- package/context/ChartProvider/ChartContext.js +8 -0
- package/context/ChartProvider/ChartProvider.d.ts +4 -0
- package/context/ChartProvider/ChartProvider.js +19 -0
- package/context/ChartProvider/ChartProvider.types.d.ts +24 -0
- package/context/ChartProvider/ChartProvider.types.js +1 -0
- package/context/ChartProvider/index.d.ts +3 -0
- package/context/ChartProvider/index.js +3 -0
- package/context/ChartProvider/useChartContext.d.ts +3 -0
- package/context/ChartProvider/useChartContext.js +11 -0
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +3 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +15 -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/InteractionSelectors.d.ts +382 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/Size.types.js +1 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +15 -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/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +5 -6
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +22 -13
- package/hooks/useSvgRef.d.ts +1 -1
- package/hooks/useSvgRef.js +4 -8
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/index.d.ts +3 -4
- package/internals/index.js +3 -4
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/allPlugins.js +3 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +10 -0
- package/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/internals/plugins/corePlugins/index.d.ts +2 -0
- package/internals/plugins/corePlugins/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/index.d.ts +2 -0
- package/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +36 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +20 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +376 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +57 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/internals/plugins/models/chart.d.ts +14 -0
- package/internals/plugins/models/chart.js +1 -0
- package/internals/plugins/models/helpers.d.ts +7 -0
- package/internals/plugins/models/helpers.js +1 -0
- package/internals/plugins/models/index.d.ts +3 -0
- package/internals/plugins/models/index.js +3 -0
- package/internals/plugins/models/plugin.d.ts +75 -0
- package/internals/plugins/models/plugin.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +13 -0
- package/internals/plugins/utils/ChartStore.js +24 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/store/useCharts.d.ts +14 -0
- package/internals/store/useCharts.js +72 -0
- package/internals/store/useCharts.types.d.ts +5 -0
- package/internals/store/useCharts.types.js +1 -0
- package/internals/store/useSelector.d.ts +4 -0
- package/internals/store/useSelector.js +6 -0
- package/internals/store/useStore.d.ts +3 -0
- package/internals/store/useStore.js +17 -0
- package/models/axis.d.ts +1 -13
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +3 -35
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +12 -2
- package/modern/BarChart/useBarChartProps.js +2 -8
- package/modern/ChartContainer/ChartContainer.js +31 -25
- package/modern/ChartContainer/useChartContainerProps.js +12 -27
- package/modern/ChartsAxis/axisClasses.js +2 -1
- 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/chartsLegendClasses.js +2 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/modern/ChartsSurface/ChartsSurface.js +68 -35
- 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 +143 -145
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +280 -0
- package/modern/ChartsTooltip/ChartsTooltipTable.js +1 -1
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
- package/modern/ChartsTooltip/useItemTooltip.js +5 -4
- package/modern/ChartsTooltip/utils.js +0 -8
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +49 -36
- package/modern/ChartsXAxis/ChartsXAxis.js +3 -17
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -17
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +42 -76
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +12 -2
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +3 -36
- package/modern/LineChart/LineHighlightPlot.js +6 -5
- package/modern/LineChart/LinePlot.js +12 -2
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/useLineChartProps.js +2 -8
- package/modern/PieChart/PieChart.js +5 -41
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +5 -36
- package/modern/ScatterChart/useScatterChartProps.js +1 -9
- package/modern/SparkLineChart/SparkLineChart.js +4 -35
- package/modern/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/modern/context/ChartProvider/ChartContext.js +8 -0
- package/modern/context/ChartProvider/ChartProvider.js +19 -0
- package/modern/context/ChartProvider/ChartProvider.types.js +1 -0
- package/modern/context/ChartProvider/index.js +3 -0
- package/modern/context/ChartProvider/useChartContext.js +11 -0
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +15 -0
- package/{context/DrawingProvider.js → modern/context/DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +15 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +5 -6
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +22 -13
- package/modern/hooks/useSvgRef.js +4 -8
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -7
- package/modern/internals/index.js +3 -4
- package/modern/internals/plugins/allPlugins.js +3 -0
- package/modern/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/modern/internals/plugins/corePlugins/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/modern/internals/plugins/models/chart.js +1 -0
- package/modern/internals/plugins/models/helpers.js +1 -0
- package/modern/internals/plugins/models/index.js +3 -0
- package/modern/internals/plugins/models/plugin.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +24 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/store/useCharts.js +72 -0
- package/modern/internals/store/useCharts.types.js +1 -0
- package/modern/internals/store/useSelector.js +6 -0
- package/modern/internals/store/useStore.js +17 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +3 -35
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +11 -1
- package/node/BarChart/useBarChartProps.js +2 -8
- package/node/ChartContainer/ChartContainer.js +31 -25
- package/node/ChartContainer/useChartContainerProps.js +12 -27
- package/node/ChartsAxis/axisClasses.js +5 -3
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
- 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/chartsLegendClasses.js +5 -3
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/node/ChartsSurface/ChartsSurface.js +68 -35
- package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +142 -144
- package/node/ChartsTooltip/ChartsTooltipContainer.js +286 -0
- package/node/ChartsTooltip/ChartsTooltipTable.js +2 -2
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +19 -19
- package/node/ChartsTooltip/useItemTooltip.js +5 -4
- package/node/ChartsTooltip/utils.js +0 -9
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +50 -37
- package/node/ChartsXAxis/ChartsXAxis.js +3 -17
- package/node/ChartsYAxis/ChartsYAxis.js +2 -17
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +42 -76
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +11 -1
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +3 -36
- package/node/LineChart/LineHighlightPlot.js +6 -5
- package/node/LineChart/LinePlot.js +11 -1
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/useLineChartProps.js +2 -8
- package/node/PieChart/PieChart.js +5 -41
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +5 -36
- package/node/ScatterChart/useScatterChartProps.js +1 -9
- package/node/SparkLineChart/SparkLineChart.js +4 -35
- package/node/context/ChartDataProvider/ChartDataProvider.js +55 -48
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
- package/node/context/ChartProvider/ChartContext.js +15 -0
- package/node/context/ChartProvider/ChartProvider.js +24 -0
- package/node/context/ChartProvider/ChartProvider.types.js +5 -0
- package/node/context/ChartProvider/index.js +38 -0
- package/node/context/ChartProvider/useChartContext.js +18 -0
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +21 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +22 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +16 -6
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +5 -7
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +23 -14
- package/node/hooks/useSvgRef.js +4 -9
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +8 -6
- package/node/internals/index.js +28 -40
- package/node/internals/plugins/allPlugins.js +10 -0
- package/node/internals/plugins/corePlugins/corePlugins.js +12 -0
- package/node/internals/plugins/corePlugins/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +41 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +15 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.types.js +5 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.utils.js +12 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/index.js +27 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +81 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +16 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +5 -0
- package/node/internals/plugins/models/chart.js +5 -0
- package/node/internals/plugins/models/helpers.js +5 -0
- package/node/internals/plugins/models/index.js +38 -0
- package/node/internals/plugins/models/plugin.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +31 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/store/useCharts.js +80 -0
- package/node/internals/store/useCharts.types.js +5 -0
- package/node/internals/store/useSelector.js +13 -0
- package/node/internals/store/useStore.js +23 -0
- package/package.json +7 -5
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartContainer/ResizableContainer.d.ts +0 -9
- package/ChartContainer/ResizableContainer.js +0 -26
- package/ChartContainer/useChartContainerDimensions.d.ts +0 -6
- 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/context/InteractionProvider.d.ts +0 -50
- package/context/InteractionProvider.js +0 -78
- package/modern/ChartContainer/ResizableContainer.js +0 -26
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/context/InteractionProvider.js +0 -78
- package/node/ChartContainer/ResizableContainer.js +0 -32
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- package/node/context/InteractionProvider.js +0 -85
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartStore } from '../plugins/utils/ChartStore';
|
|
3
|
+
import { ChartAnyPluginSignature, ChartInstance, ChartPublicAPI, ConvertSignaturesIntoPlugins } from '../plugins/models';
|
|
4
|
+
import { UseChartBaseProps } from './useCharts.types';
|
|
5
|
+
import { UseChartInteractionState } from '../plugins/featurePlugins/useChartInteraction/useChartInteraction.types';
|
|
6
|
+
export declare function useChartApiInitialization<T>(inputApiRef: React.MutableRefObject<T | undefined> | undefined): T;
|
|
7
|
+
export declare function useCharts<TSignatures extends readonly ChartAnyPluginSignature[], TProps extends Partial<UseChartBaseProps<TSignatures>>>(inPlugins: ConvertSignaturesIntoPlugins<TSignatures>, props: TProps): {
|
|
8
|
+
contextValue: {
|
|
9
|
+
store: ChartStore<readonly [import("../plugins/corePlugins/useChartId").UseChartIdSignature, ...TSignatures]> & UseChartInteractionState;
|
|
10
|
+
publicAPI: ChartPublicAPI<TSignatures>;
|
|
11
|
+
instance: ChartInstance<TSignatures>;
|
|
12
|
+
svgRef: React.RefObject<SVGSVGElement>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartStore } from "../plugins/utils/ChartStore.js";
|
|
3
|
+
import { CHART_CORE_PLUGINS } from "../plugins/corePlugins/index.js";
|
|
4
|
+
export function useChartApiInitialization(inputApiRef) {
|
|
5
|
+
const fallbackPublicApiRef = React.useRef({});
|
|
6
|
+
if (inputApiRef) {
|
|
7
|
+
if (inputApiRef.current == null) {
|
|
8
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
9
|
+
inputApiRef.current = {};
|
|
10
|
+
}
|
|
11
|
+
return inputApiRef.current;
|
|
12
|
+
}
|
|
13
|
+
return fallbackPublicApiRef.current;
|
|
14
|
+
}
|
|
15
|
+
let globalId = 0;
|
|
16
|
+
export function useCharts(inPlugins, props) {
|
|
17
|
+
const plugins = React.useMemo(() => [...CHART_CORE_PLUGINS, ...inPlugins], [inPlugins]);
|
|
18
|
+
const pluginParams = {}; // To generate when plugins use params.
|
|
19
|
+
const instanceRef = React.useRef({});
|
|
20
|
+
const instance = instanceRef.current;
|
|
21
|
+
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
22
|
+
const innerSvgRef = React.useRef(null);
|
|
23
|
+
const storeRef = React.useRef(null);
|
|
24
|
+
if (storeRef.current == null) {
|
|
25
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
26
|
+
globalId += 1;
|
|
27
|
+
const initialState = {
|
|
28
|
+
// TODO remove when the interaction moves to plugin
|
|
29
|
+
interaction: {
|
|
30
|
+
item: null,
|
|
31
|
+
axis: {
|
|
32
|
+
x: null,
|
|
33
|
+
y: null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
cacheKey: {
|
|
37
|
+
id: globalId
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
plugins.forEach(plugin => {
|
|
41
|
+
if (plugin.getInitialState) {
|
|
42
|
+
Object.assign(initialState, plugin.getInitialState({}));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
storeRef.current = new ChartStore(initialState);
|
|
46
|
+
}
|
|
47
|
+
const runPlugin = plugin => {
|
|
48
|
+
const pluginResponse = plugin({
|
|
49
|
+
instance,
|
|
50
|
+
params: pluginParams,
|
|
51
|
+
plugins: plugins,
|
|
52
|
+
store: storeRef.current,
|
|
53
|
+
svgRef: innerSvgRef
|
|
54
|
+
});
|
|
55
|
+
if (pluginResponse.publicAPI) {
|
|
56
|
+
Object.assign(publicAPI, pluginResponse.publicAPI);
|
|
57
|
+
}
|
|
58
|
+
if (pluginResponse.instance) {
|
|
59
|
+
Object.assign(instance, pluginResponse.instance);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
plugins.forEach(runPlugin);
|
|
63
|
+
const contextValue = React.useMemo(() => ({
|
|
64
|
+
store: storeRef.current,
|
|
65
|
+
publicAPI,
|
|
66
|
+
instance,
|
|
67
|
+
svgRef: innerSvgRef
|
|
68
|
+
}), [instance, publicAPI]);
|
|
69
|
+
return {
|
|
70
|
+
contextValue
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartAnyPluginSignature, ChartPublicAPI } from '../plugins/models';
|
|
3
|
+
export interface UseChartBaseProps<TSignatures extends readonly ChartAnyPluginSignature[]> {
|
|
4
|
+
apiRef: React.MutableRefObject<ChartPublicAPI<TSignatures> | undefined> | undefined;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChartAnyPluginSignature, ChartState } from '../plugins/models';
|
|
2
|
+
import { ChartsSelector } from '../plugins/utils/selectors';
|
|
3
|
+
import { ChartStore } from '../plugins/utils/ChartStore';
|
|
4
|
+
export declare const useSelector: <TSignatures extends readonly ChartAnyPluginSignature[], TArgs, TValue>(store: ChartStore<TSignatures>, selector: ChartsSelector<ChartState<TSignatures>, TArgs, TValue>, args?: TArgs, equals?: (a: TValue, b: TValue) => boolean) => TValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
|
|
2
|
+
const defaultCompare = Object.is;
|
|
3
|
+
export const useSelector = (store, selector, args = undefined, equals = defaultCompare) => {
|
|
4
|
+
const selectorWithArgs = state => selector(state, args);
|
|
5
|
+
return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, selectorWithArgs, equals);
|
|
6
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChartStore } from '../plugins/utils/ChartStore';
|
|
2
|
+
import { UseChartInteractionSignature } from '../plugins/featurePlugins/useChartInteraction/useChartInteraction.types';
|
|
3
|
+
export declare function useStore(skipError?: boolean): ChartStore<[UseChartInteractionSignature]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useChartContext } from "../../context/ChartProvider/index.js";
|
|
2
|
+
// This hook should be removed because user and us should not interact with the store directly, but with public/private APIs
|
|
3
|
+
export function useStore(skipError) {
|
|
4
|
+
const context = useChartContext();
|
|
5
|
+
if (skipError) {
|
|
6
|
+
// TODO: Remove once store is used by all charts.
|
|
7
|
+
// This line is only for `useAxisEvents` which is in the surface of the Gauge.
|
|
8
|
+
// But the Gauge don't have store yet because it does not need the interaction provider.
|
|
9
|
+
// Will be fixed when every thing move to the store since every component will have access to it.
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
return context?.store;
|
|
12
|
+
}
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error(['MUI X: Could not find the charts context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
15
|
+
}
|
|
16
|
+
return context.store;
|
|
17
|
+
}
|
package/models/axis.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-charts-vendor/d3-scale';
|
|
2
|
-
import { SxProps } from '@mui/system';
|
|
2
|
+
import { SxProps } from '@mui/system/styleFunctionSx';
|
|
3
3
|
import { ChartsAxisClasses } from '../ChartsAxis/axisClasses';
|
|
4
4
|
import type { TickParams } from '../hooks/useTicks';
|
|
5
5
|
import { ChartsTextProps } from '../ChartsText';
|
|
@@ -58,12 +58,6 @@ export interface ChartsAxisProps extends TickParams {
|
|
|
58
58
|
* @default 'currentColor'
|
|
59
59
|
*/
|
|
60
60
|
fill?: string;
|
|
61
|
-
/**
|
|
62
|
-
* The font size of the axis ticks text.
|
|
63
|
-
* @default 12
|
|
64
|
-
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
65
|
-
*/
|
|
66
|
-
tickFontSize?: number;
|
|
67
61
|
/**
|
|
68
62
|
* The style applied to ticks text.
|
|
69
63
|
*/
|
|
@@ -83,12 +77,6 @@ export interface ChartsAxisProps extends TickParams {
|
|
|
83
77
|
* The label of the axis.
|
|
84
78
|
*/
|
|
85
79
|
label?: string;
|
|
86
|
-
/**
|
|
87
|
-
* The font size of the axis label.
|
|
88
|
-
* @default 14
|
|
89
|
-
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
90
|
-
*/
|
|
91
|
-
labelFontSize?: number;
|
|
92
80
|
/**
|
|
93
81
|
* The stroke color of the axis line.
|
|
94
82
|
* @default 'currentColor'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["ownerState"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { animated } from '@react-spring/web';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* @ignore - internal component.
|
|
11
|
+
*/
|
|
12
|
+
export function AnimatedBarElement(props) {
|
|
13
|
+
const {
|
|
14
|
+
ownerState
|
|
15
|
+
} = props,
|
|
16
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
17
|
+
return /*#__PURE__*/_jsx(animated.rect, _extends({}, other, {
|
|
18
|
+
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
19
|
+
opacity: ownerState.isFaded ? 0.3 : 1
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
@@ -43,15 +43,15 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
|
|
|
43
43
|
chartsAxisProps,
|
|
44
44
|
axisHighlightProps,
|
|
45
45
|
legendProps,
|
|
46
|
-
tooltipProps,
|
|
47
46
|
children
|
|
48
47
|
} = useBarChartProps(props);
|
|
48
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
49
49
|
return /*#__PURE__*/_jsxs(ChartContainer, _extends({
|
|
50
50
|
ref: ref
|
|
51
51
|
}, chartContainerProps, {
|
|
52
52
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
53
53
|
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
54
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
54
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
55
55
|
}));
|
|
56
56
|
});
|
|
57
57
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -63,7 +63,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
63
63
|
* The configuration of axes highlight.
|
|
64
64
|
* Default is set to 'band' in the bar direction.
|
|
65
65
|
* Depends on `layout` prop.
|
|
66
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
66
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
67
67
|
*/
|
|
68
68
|
axisHighlight: PropTypes.shape({
|
|
69
69
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
@@ -174,16 +174,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
174
174
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
175
175
|
*/
|
|
176
176
|
onItemClick: PropTypes.func,
|
|
177
|
-
/**
|
|
178
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
179
|
-
* before it renders for the first time.
|
|
180
|
-
*
|
|
181
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
182
|
-
* the first render, like when used inside a grid.
|
|
183
|
-
*
|
|
184
|
-
* @default false
|
|
185
|
-
*/
|
|
186
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
187
177
|
/**
|
|
188
178
|
* Indicate which axis to display the right of the charts.
|
|
189
179
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -212,30 +202,12 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
212
202
|
slots: PropTypes.object,
|
|
213
203
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
214
204
|
title: PropTypes.string,
|
|
215
|
-
/**
|
|
216
|
-
* The configuration of the tooltip.
|
|
217
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
218
|
-
*/
|
|
219
|
-
tooltip: PropTypes.shape({
|
|
220
|
-
axisContent: PropTypes.elementType,
|
|
221
|
-
classes: PropTypes.object,
|
|
222
|
-
itemContent: PropTypes.elementType,
|
|
223
|
-
slotProps: PropTypes.object,
|
|
224
|
-
slots: PropTypes.object,
|
|
225
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
226
|
-
}),
|
|
227
205
|
/**
|
|
228
206
|
* Indicate which axis to display the top of the charts.
|
|
229
207
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
230
208
|
* @default null
|
|
231
209
|
*/
|
|
232
210
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
233
|
-
viewBox: PropTypes.shape({
|
|
234
|
-
height: PropTypes.number,
|
|
235
|
-
width: PropTypes.number,
|
|
236
|
-
x: PropTypes.number,
|
|
237
|
-
y: PropTypes.number
|
|
238
|
-
}),
|
|
239
211
|
/**
|
|
240
212
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
241
213
|
*/
|
|
@@ -271,7 +243,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
271
243
|
hideTooltip: PropTypes.bool,
|
|
272
244
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
273
245
|
label: PropTypes.string,
|
|
274
|
-
labelFontSize: PropTypes.number,
|
|
275
246
|
labelStyle: PropTypes.object,
|
|
276
247
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
277
248
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -282,7 +253,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
282
253
|
slots: PropTypes.object,
|
|
283
254
|
stroke: PropTypes.string,
|
|
284
255
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
285
|
-
tickFontSize: PropTypes.number,
|
|
286
256
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
287
257
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
288
258
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -325,7 +295,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
325
295
|
hideTooltip: PropTypes.bool,
|
|
326
296
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
327
297
|
label: PropTypes.string,
|
|
328
|
-
labelFontSize: PropTypes.number,
|
|
329
298
|
labelStyle: PropTypes.object,
|
|
330
299
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
331
300
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -336,7 +305,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
336
305
|
slots: PropTypes.object,
|
|
337
306
|
stroke: PropTypes.string,
|
|
338
307
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
339
|
-
tickFontSize: PropTypes.number,
|
|
340
308
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
341
309
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
342
310
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -8,39 +8,27 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
10
10
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
11
|
-
import { styled } from '@mui/material/styles';
|
|
12
11
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
13
|
-
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
14
|
-
import { animated } from '@react-spring/web';
|
|
15
12
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
16
13
|
import { useItemHighlighted } from "../context/index.js";
|
|
14
|
+
import { AnimatedBarElement } from "./AnimatedBarElement.js";
|
|
17
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
16
|
export function getBarElementUtilityClass(slot) {
|
|
19
17
|
return generateUtilityClass('MuiBarElement', slot);
|
|
20
18
|
}
|
|
21
|
-
export const barElementClasses = generateUtilityClasses('MuiBarElement', ['root']);
|
|
19
|
+
export const barElementClasses = generateUtilityClasses('MuiBarElement', ['root', 'highlighted', 'faded']);
|
|
22
20
|
const useUtilityClasses = ownerState => {
|
|
23
21
|
const {
|
|
24
22
|
classes,
|
|
25
|
-
id
|
|
23
|
+
id,
|
|
24
|
+
isHighlighted,
|
|
25
|
+
isFaded
|
|
26
26
|
} = ownerState;
|
|
27
27
|
const slots = {
|
|
28
|
-
root: ['root', `series-${id}
|
|
28
|
+
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
29
29
|
};
|
|
30
30
|
return composeClasses(slots, getBarElementUtilityClass, classes);
|
|
31
31
|
};
|
|
32
|
-
export const BarElementPath = styled(animated.rect, {
|
|
33
|
-
name: 'MuiBarElement',
|
|
34
|
-
slot: 'Root',
|
|
35
|
-
overridesResolver: (_, styles) => styles.root
|
|
36
|
-
})(({
|
|
37
|
-
ownerState
|
|
38
|
-
}) => ({
|
|
39
|
-
stroke: 'none',
|
|
40
|
-
fill: ownerState.isHighlighted ? d3Color(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
|
|
41
|
-
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
42
|
-
opacity: ownerState.isFaded && 0.3 || 1
|
|
43
|
-
}));
|
|
44
32
|
function BarElement(props) {
|
|
45
33
|
const {
|
|
46
34
|
id,
|
|
@@ -70,7 +58,7 @@ function BarElement(props) {
|
|
|
70
58
|
isHighlighted
|
|
71
59
|
};
|
|
72
60
|
const classes = useUtilityClasses(ownerState);
|
|
73
|
-
const Bar = slots?.bar ??
|
|
61
|
+
const Bar = slots?.bar ?? AnimatedBarElement;
|
|
74
62
|
const barProps = useSlotProps({
|
|
75
63
|
elementType: Bar,
|
|
76
64
|
externalSlotProps: slotProps?.bar,
|
|
@@ -82,7 +70,9 @@ function BarElement(props) {
|
|
|
82
70
|
}), {
|
|
83
71
|
style,
|
|
84
72
|
onClick,
|
|
85
|
-
cursor: onClick ? 'pointer' : 'unset'
|
|
73
|
+
cursor: onClick ? 'pointer' : 'unset',
|
|
74
|
+
stroke: 'none',
|
|
75
|
+
fill: color
|
|
86
76
|
}),
|
|
87
77
|
className: classes.root,
|
|
88
78
|
ownerState
|
|
@@ -6,8 +6,9 @@ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useTransition } from '@react-spring/web';
|
|
9
|
+
import { styled } from '@mui/material/styles';
|
|
9
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
|
-
import { BarElement } from "./BarElement.js";
|
|
11
|
+
import { BarElement, barElementClasses } from "./BarElement.js";
|
|
11
12
|
import getColor from "./getColor.js";
|
|
12
13
|
import { useChartId, useDrawingArea } from "../hooks/index.js";
|
|
13
14
|
import { BarClipPath } from "./BarClipPath.js";
|
|
@@ -179,6 +180,15 @@ const enterStyle = ({
|
|
|
179
180
|
height,
|
|
180
181
|
width
|
|
181
182
|
});
|
|
183
|
+
const BarPlotRoot = styled('g', {
|
|
184
|
+
name: 'MuiBarPlot',
|
|
185
|
+
slot: 'Root',
|
|
186
|
+
overridesResolver: (_, styles) => styles.root
|
|
187
|
+
})({
|
|
188
|
+
[`& .${barElementClasses.root}`]: {
|
|
189
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
190
|
+
}
|
|
191
|
+
});
|
|
182
192
|
|
|
183
193
|
/**
|
|
184
194
|
* Demos:
|
|
@@ -221,7 +231,7 @@ function BarPlot(props) {
|
|
|
221
231
|
update: enterStyle,
|
|
222
232
|
immediate: skipAnimation
|
|
223
233
|
});
|
|
224
|
-
return /*#__PURE__*/_jsxs(
|
|
234
|
+
return /*#__PURE__*/_jsxs(BarPlotRoot, {
|
|
225
235
|
children: [!withoutBorderRadius && maskTransition((style, {
|
|
226
236
|
id,
|
|
227
237
|
hasPositive,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
|
|
6
6
|
import useId from '@mui/utils/useId';
|
|
7
7
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
|
|
8
8
|
/**
|
|
@@ -23,7 +23,6 @@ export const useBarChartProps = props => {
|
|
|
23
23
|
colors,
|
|
24
24
|
dataset,
|
|
25
25
|
sx,
|
|
26
|
-
tooltip,
|
|
27
26
|
onAxisClick,
|
|
28
27
|
axisHighlight,
|
|
29
28
|
grid,
|
|
@@ -74,7 +73,7 @@ export const useBarChartProps = props => {
|
|
|
74
73
|
sx,
|
|
75
74
|
highlightedItem,
|
|
76
75
|
onHighlightChange,
|
|
77
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
76
|
+
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
78
77
|
className,
|
|
79
78
|
skipAnimation
|
|
80
79
|
});
|
|
@@ -120,10 +119,6 @@ export const useBarChartProps = props => {
|
|
|
120
119
|
slots,
|
|
121
120
|
slotProps
|
|
122
121
|
};
|
|
123
|
-
const tooltipProps = _extends({}, tooltip, {
|
|
124
|
-
slots,
|
|
125
|
-
slotProps
|
|
126
|
-
});
|
|
127
122
|
return {
|
|
128
123
|
chartContainerProps,
|
|
129
124
|
barPlotProps,
|
|
@@ -135,7 +130,6 @@ export const useBarChartProps = props => {
|
|
|
135
130
|
chartsAxisProps,
|
|
136
131
|
axisHighlightProps,
|
|
137
132
|
legendProps,
|
|
138
|
-
tooltipProps,
|
|
139
133
|
children
|
|
140
134
|
};
|
|
141
135
|
};
|
|
@@ -4,17 +4,43 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { ChartDataProvider } from "../context/ChartDataProvider/index.js";
|
|
7
|
-
import { ResizableContainer } from "./ResizableContainer.js";
|
|
8
7
|
import { useChartContainerProps } from "./useChartContainerProps.js";
|
|
8
|
+
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
12
|
+
*
|
|
13
|
+
* This is a combination of both the `ChartDataProvider` and `ChartsSurface` components.
|
|
14
|
+
*
|
|
15
|
+
* Demos:
|
|
16
|
+
*
|
|
17
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
18
|
+
*
|
|
19
|
+
* API:
|
|
20
|
+
*
|
|
21
|
+
* - [ChartContainer API](https://mui.com/x/api/charts/chart-container/)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx
|
|
25
|
+
* <ChartContainer
|
|
26
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
27
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
28
|
+
* >
|
|
29
|
+
* <BarPlot />
|
|
30
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
31
|
+
* </ChartContainer>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
10
34
|
const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
11
35
|
const {
|
|
12
|
-
hasIntrinsicSize,
|
|
13
36
|
chartDataProviderProps,
|
|
14
|
-
|
|
37
|
+
children,
|
|
38
|
+
chartsSurfaceProps
|
|
15
39
|
} = useChartContainerProps(props, ref);
|
|
16
|
-
return /*#__PURE__*/_jsx(
|
|
17
|
-
children:
|
|
40
|
+
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
41
|
+
children: /*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
42
|
+
children: children
|
|
43
|
+
}))
|
|
18
44
|
}));
|
|
19
45
|
});
|
|
20
46
|
process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
@@ -74,16 +100,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
74
100
|
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
75
101
|
*/
|
|
76
102
|
plugins: PropTypes.arrayOf(PropTypes.object),
|
|
77
|
-
/**
|
|
78
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
79
|
-
* before it renders for the first time.
|
|
80
|
-
*
|
|
81
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
82
|
-
* the first render, like when used inside a grid.
|
|
83
|
-
*
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
87
103
|
/**
|
|
88
104
|
* The array of series to display.
|
|
89
105
|
* Each type of series has its own specificity.
|
|
@@ -97,12 +113,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
97
113
|
skipAnimation: PropTypes.bool,
|
|
98
114
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
99
115
|
title: PropTypes.string,
|
|
100
|
-
viewBox: PropTypes.shape({
|
|
101
|
-
height: PropTypes.number,
|
|
102
|
-
width: PropTypes.number,
|
|
103
|
-
x: PropTypes.number,
|
|
104
|
-
y: PropTypes.number
|
|
105
|
-
}),
|
|
106
116
|
/**
|
|
107
117
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
108
118
|
*/
|
|
@@ -138,7 +148,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
138
148
|
hideTooltip: PropTypes.bool,
|
|
139
149
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
140
150
|
label: PropTypes.string,
|
|
141
|
-
labelFontSize: PropTypes.number,
|
|
142
151
|
labelStyle: PropTypes.object,
|
|
143
152
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
144
153
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -149,7 +158,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
149
158
|
slots: PropTypes.object,
|
|
150
159
|
stroke: PropTypes.string,
|
|
151
160
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
152
|
-
tickFontSize: PropTypes.number,
|
|
153
161
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
154
162
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
155
163
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -192,7 +200,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
192
200
|
hideTooltip: PropTypes.bool,
|
|
193
201
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
194
202
|
label: PropTypes.string,
|
|
195
|
-
labelFontSize: PropTypes.number,
|
|
196
203
|
labelStyle: PropTypes.object,
|
|
197
204
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
198
205
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -203,7 +210,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
203
210
|
slots: PropTypes.object,
|
|
204
211
|
stroke: PropTypes.string,
|
|
205
212
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
206
|
-
tickFontSize: PropTypes.number,
|
|
207
213
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
208
214
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
209
215
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["width", "height", "
|
|
6
|
-
import { useChartContainerDimensions } from "./useChartContainerDimensions.js";
|
|
5
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "xAxis", "yAxis", "zAxis", "skipAnimation"];
|
|
7
6
|
export const useChartContainerProps = (props, ref) => {
|
|
8
7
|
const {
|
|
9
8
|
width,
|
|
10
9
|
height,
|
|
11
|
-
resolveSizeBeforeRender,
|
|
12
10
|
margin,
|
|
13
11
|
children,
|
|
14
12
|
series,
|
|
@@ -21,50 +19,37 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
21
19
|
plugins,
|
|
22
20
|
sx,
|
|
23
21
|
title,
|
|
24
|
-
viewBox,
|
|
25
22
|
xAxis,
|
|
26
23
|
yAxis,
|
|
27
24
|
zAxis,
|
|
28
25
|
skipAnimation
|
|
29
26
|
} = props,
|
|
30
27
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
width,
|
|
39
|
-
height
|
|
40
|
-
},
|
|
41
|
-
ref: containerRef
|
|
42
|
-
});
|
|
28
|
+
const chartsSurfaceProps = _extends({
|
|
29
|
+
title,
|
|
30
|
+
desc,
|
|
31
|
+
sx,
|
|
32
|
+
disableAxisListener,
|
|
33
|
+
ref
|
|
34
|
+
}, other);
|
|
43
35
|
const chartDataProviderProps = {
|
|
44
36
|
margin,
|
|
45
|
-
children,
|
|
46
37
|
series,
|
|
47
38
|
colors,
|
|
48
39
|
dataset,
|
|
49
|
-
desc,
|
|
50
|
-
disableAxisListener,
|
|
51
40
|
highlightedItem,
|
|
52
41
|
onHighlightChange,
|
|
53
42
|
plugins,
|
|
54
|
-
sx,
|
|
55
|
-
title,
|
|
56
|
-
viewBox,
|
|
57
43
|
xAxis,
|
|
58
44
|
yAxis,
|
|
59
45
|
zAxis,
|
|
60
46
|
skipAnimation,
|
|
61
|
-
width
|
|
62
|
-
height
|
|
63
|
-
ref
|
|
47
|
+
width,
|
|
48
|
+
height
|
|
64
49
|
};
|
|
65
50
|
return {
|
|
66
|
-
hasIntrinsicSize: Boolean(dWidth && dHeight),
|
|
67
51
|
chartDataProviderProps,
|
|
68
|
-
|
|
52
|
+
chartsSurfaceProps,
|
|
53
|
+
children
|
|
69
54
|
};
|
|
70
55
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
2
3
|
export function getAxisUtilityClass(slot) {
|
|
3
4
|
return generateUtilityClass('MuiChartsAxis', slot);
|
|
4
5
|
}
|