@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
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChartDataProviderProps } from '../context/ChartDataProvider';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
6
|
-
*/
|
|
7
|
-
width?: number;
|
|
8
|
-
/**
|
|
9
|
-
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
10
|
-
*/
|
|
11
|
-
height?: number;
|
|
12
|
-
/**
|
|
13
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
14
|
-
* before it renders for the first time.
|
|
15
|
-
*
|
|
16
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
17
|
-
* the first render, like when used inside a grid.
|
|
18
|
-
*
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
resolveSizeBeforeRender?: boolean;
|
|
3
|
+
import { ChartsSurfaceProps } from '../ChartsSurface';
|
|
4
|
+
export interface ChartContainerProps extends ChartDataProviderProps, ChartsSurfaceProps {
|
|
22
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
8
|
+
*
|
|
9
|
+
* This is a combination of both the `ChartDataProvider` and `ChartsSurface` components.
|
|
10
|
+
*
|
|
11
|
+
* Demos:
|
|
12
|
+
*
|
|
13
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
14
|
+
*
|
|
15
|
+
* API:
|
|
16
|
+
*
|
|
17
|
+
* - [ChartContainer API](https://mui.com/x/api/charts/chart-container/)
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* <ChartContainer
|
|
22
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
23
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
24
|
+
* >
|
|
25
|
+
* <BarPlot />
|
|
26
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
27
|
+
* </ChartContainer>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
23
30
|
declare const ChartContainer: React.ForwardRefExoticComponent<ChartContainerProps & React.RefAttributes<SVGSVGElement>>;
|
|
24
31
|
export { ChartContainer };
|
|
@@ -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']),
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSurfaceProps } from '../ChartsSurface';
|
|
1
3
|
import { ChartDataProviderProps } from '../context/ChartDataProvider';
|
|
2
4
|
import type { ChartContainerProps } from './ChartContainer';
|
|
3
5
|
export type UseChartContainerPropsReturnValue = {
|
|
4
|
-
hasIntrinsicSize: boolean;
|
|
5
6
|
chartDataProviderProps: ChartDataProviderProps;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
width: ChartContainerProps['width'];
|
|
9
|
-
height: ChartContainerProps['height'];
|
|
10
|
-
};
|
|
11
|
-
ref: React.Ref<HTMLDivElement>;
|
|
7
|
+
chartsSurfaceProps: ChartsSurfaceProps & {
|
|
8
|
+
ref: React.Ref<SVGSVGElement>;
|
|
12
9
|
};
|
|
10
|
+
children: React.ReactNode;
|
|
13
11
|
};
|
|
14
12
|
export declare const useChartContainerProps: (props: ChartContainerProps, ref: React.Ref<SVGSVGElement>) => UseChartContainerPropsReturnValue;
|
|
@@ -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
|
}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/** Styles applied to the root element. */
|
|
4
|
-
root: string;
|
|
5
|
-
}
|
|
6
|
-
export type ChartsAxisHighlightClassKey = keyof ChartsAxisHighlightClasses;
|
|
7
|
-
export declare function getAxisHighlightUtilityClass(slot: string): string;
|
|
8
|
-
export declare const chartsAxisHighlightClasses: ChartsAxisHighlightClasses;
|
|
9
|
-
export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
10
|
-
ownerState: {
|
|
11
|
-
axisHighlight: AxisHighlight;
|
|
12
|
-
};
|
|
13
|
-
}, Pick<React.SVGProps<SVGPathElement>, keyof React.SVGProps<SVGPathElement>>, {}>;
|
|
14
|
-
type AxisHighlight = 'none' | 'line' | 'band';
|
|
15
|
-
export type ChartsAxisHighlightProps = {
|
|
16
|
-
x?: AxisHighlight;
|
|
17
|
-
y?: AxisHighlight;
|
|
18
|
-
};
|
|
2
|
+
import { ChartsAxisHighlightProps } from './ChartsAxisHighlight.types';
|
|
19
3
|
/**
|
|
20
4
|
* Demos:
|
|
21
5
|
*
|
|
@@ -1,57 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
11
|
-
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
12
|
-
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
13
|
-
import { isBandScale } from "../internals/isBandScale.js";
|
|
6
|
+
import { getAxisHighlightUtilityClass } from "./chartsAxisHighlightClasses.js";
|
|
7
|
+
import ChartsYHighlight from "./ChartsYAxisHighlight.js";
|
|
8
|
+
import ChartsXHighlight from "./ChartsXAxisHighlight.js";
|
|
14
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
export function getAxisHighlightUtilityClass(slot) {
|
|
16
|
-
return generateUtilityClass('MuiChartsAxisHighlight', slot);
|
|
17
|
-
}
|
|
18
|
-
export const chartsAxisHighlightClasses = generateUtilityClasses('MuiChartsAxisHighlight', ['root']);
|
|
19
10
|
const useUtilityClasses = () => {
|
|
20
11
|
const slots = {
|
|
21
12
|
root: ['root']
|
|
22
13
|
};
|
|
23
14
|
return composeClasses(slots, getAxisHighlightUtilityClass);
|
|
24
15
|
};
|
|
25
|
-
|
|
26
|
-
name: 'MuiChartsAxisHighlight',
|
|
27
|
-
slot: 'Root',
|
|
28
|
-
overridesResolver: (_, styles) => styles.root
|
|
29
|
-
})(({
|
|
30
|
-
theme
|
|
31
|
-
}) => ({
|
|
32
|
-
pointerEvents: 'none',
|
|
33
|
-
variants: [{
|
|
34
|
-
props: {
|
|
35
|
-
axisHighlight: 'band'
|
|
36
|
-
},
|
|
37
|
-
style: _extends({
|
|
38
|
-
fill: 'white',
|
|
39
|
-
fillOpacity: 0.1
|
|
40
|
-
}, theme.applyStyles('light', {
|
|
41
|
-
fill: 'gray'
|
|
42
|
-
}))
|
|
43
|
-
}, {
|
|
44
|
-
props: {
|
|
45
|
-
axisHighlight: 'line'
|
|
46
|
-
},
|
|
47
|
-
style: _extends({
|
|
48
|
-
strokeDasharray: '5 2',
|
|
49
|
-
stroke: '#ffffff'
|
|
50
|
-
}, theme.applyStyles('light', {
|
|
51
|
-
stroke: '#000000'
|
|
52
|
-
}))
|
|
53
|
-
}]
|
|
54
|
-
}));
|
|
16
|
+
|
|
55
17
|
/**
|
|
56
18
|
* Demos:
|
|
57
19
|
*
|
|
@@ -66,62 +28,14 @@ function ChartsAxisHighlight(props) {
|
|
|
66
28
|
x: xAxisHighlight,
|
|
67
29
|
y: yAxisHighlight
|
|
68
30
|
} = props;
|
|
69
|
-
const {
|
|
70
|
-
xAxisIds,
|
|
71
|
-
xAxis,
|
|
72
|
-
yAxisIds,
|
|
73
|
-
yAxis
|
|
74
|
-
} = useCartesianContext();
|
|
75
31
|
const classes = useUtilityClasses();
|
|
76
|
-
const USED_X_AXIS_ID = xAxisIds[0];
|
|
77
|
-
const USED_Y_AXIS_ID = yAxisIds[0];
|
|
78
|
-
const xScale = xAxis[USED_X_AXIS_ID].scale;
|
|
79
|
-
const yScale = yAxis[USED_Y_AXIS_ID].scale;
|
|
80
|
-
const {
|
|
81
|
-
axis
|
|
82
|
-
} = React.useContext(InteractionContext);
|
|
83
|
-
const getXPosition = getValueToPositionMapper(xScale);
|
|
84
|
-
const getYPosition = getValueToPositionMapper(yScale);
|
|
85
|
-
const axisX = axis.x;
|
|
86
|
-
const axisY = axis.y;
|
|
87
|
-
const isBandScaleX = xAxisHighlight === 'band' && axisX !== null && isBandScale(xScale);
|
|
88
|
-
const isBandScaleY = yAxisHighlight === 'band' && axisY !== null && isBandScale(yScale);
|
|
89
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
90
|
-
const isXError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
91
|
-
const isYError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
92
|
-
if (isXError || isYError) {
|
|
93
|
-
console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
32
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
97
|
-
children: [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
axisHighlight: 'band'
|
|
104
|
-
}
|
|
105
|
-
}), isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
106
|
-
d: `M ${xScale.range()[0]} ${
|
|
107
|
-
// @ts-expect-error, yScale value is checked in the statement above
|
|
108
|
-
yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${xScale.range()[1] - xScale.range()[0]} 0 l 0 ${-yScale.step()} Z`,
|
|
109
|
-
className: classes.root,
|
|
110
|
-
ownerState: {
|
|
111
|
-
axisHighlight: 'band'
|
|
112
|
-
}
|
|
113
|
-
}), xAxisHighlight === 'line' && axis.x !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
114
|
-
d: `M ${getXPosition(axis.x.value)} ${yScale.range()[0]} L ${getXPosition(axis.x.value)} ${yScale.range()[1]}`,
|
|
115
|
-
className: classes.root,
|
|
116
|
-
ownerState: {
|
|
117
|
-
axisHighlight: 'line'
|
|
118
|
-
}
|
|
119
|
-
}), yAxisHighlight === 'line' && axis.y !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
120
|
-
d: `M ${xScale.range()[0]} ${getYPosition(axis.y.value)} L ${xScale.range()[1]} ${getYPosition(axis.y.value)}`,
|
|
121
|
-
className: classes.root,
|
|
122
|
-
ownerState: {
|
|
123
|
-
axisHighlight: 'line'
|
|
124
|
-
}
|
|
33
|
+
children: [xAxisHighlight && /*#__PURE__*/_jsx(ChartsXHighlight, {
|
|
34
|
+
type: xAxisHighlight,
|
|
35
|
+
classes: classes
|
|
36
|
+
}), yAxisHighlight && /*#__PURE__*/_jsx(ChartsYHighlight, {
|
|
37
|
+
type: yAxisHighlight,
|
|
38
|
+
classes: classes
|
|
125
39
|
})]
|
|
126
40
|
});
|
|
127
41
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChartsAxisHighlightType } from './ChartsAxisHighlight.types';
|
|
2
|
+
export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
3
|
+
ownerState: {
|
|
4
|
+
axisHighlight: ChartsAxisHighlightType;
|
|
5
|
+
};
|
|
6
|
+
}, Pick<import("react").SVGProps<SVGPathElement>, keyof import("react").SVGProps<SVGPathElement>>, {}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
export const ChartsAxisHighlightPath = styled('path', {
|
|
6
|
+
name: 'MuiChartsAxisHighlight',
|
|
7
|
+
slot: 'Root',
|
|
8
|
+
overridesResolver: (_, styles) => styles.root
|
|
9
|
+
})(({
|
|
10
|
+
theme
|
|
11
|
+
}) => ({
|
|
12
|
+
pointerEvents: 'none',
|
|
13
|
+
variants: [{
|
|
14
|
+
props: {
|
|
15
|
+
axisHighlight: 'band'
|
|
16
|
+
},
|
|
17
|
+
style: _extends({
|
|
18
|
+
fill: 'white',
|
|
19
|
+
fillOpacity: 0.1
|
|
20
|
+
}, theme.applyStyles('light', {
|
|
21
|
+
fill: 'gray'
|
|
22
|
+
}))
|
|
23
|
+
}, {
|
|
24
|
+
props: {
|
|
25
|
+
axisHighlight: 'line'
|
|
26
|
+
},
|
|
27
|
+
style: _extends({
|
|
28
|
+
strokeDasharray: '5 2',
|
|
29
|
+
stroke: '#ffffff'
|
|
30
|
+
}, theme.applyStyles('light', {
|
|
31
|
+
stroke: '#000000'
|
|
32
|
+
}))
|
|
33
|
+
}]
|
|
34
|
+
}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsAxisHighlightType } from './ChartsAxisHighlight.types';
|
|
3
|
+
import { ChartsAxisHighlightClasses } from './chartsAxisHighlightClasses';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore - internal component.
|
|
6
|
+
*/
|
|
7
|
+
export default function ChartsXHighlight(props: {
|
|
8
|
+
type: ChartsAxisHighlightType;
|
|
9
|
+
classes: ChartsAxisHighlightClasses;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { getValueToPositionMapper, useXScale } from "../hooks/useScale.js";
|
|
5
|
+
import { isBandScale } from "../internals/isBandScale.js";
|
|
6
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
7
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
8
|
+
import { selectorChartsInteractionXAxis } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
9
|
+
import { useDrawingArea } from "../hooks/index.js";
|
|
10
|
+
import { ChartsAxisHighlightPath } from "./ChartsAxisHighlightPath.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @ignore - internal component.
|
|
14
|
+
*/
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
export default function ChartsXHighlight(props) {
|
|
17
|
+
const {
|
|
18
|
+
type,
|
|
19
|
+
classes
|
|
20
|
+
} = props;
|
|
21
|
+
const {
|
|
22
|
+
top,
|
|
23
|
+
height
|
|
24
|
+
} = useDrawingArea();
|
|
25
|
+
const xScale = useXScale();
|
|
26
|
+
const store = useStore();
|
|
27
|
+
const axisX = useSelector(store, selectorChartsInteractionXAxis);
|
|
28
|
+
const getXPosition = getValueToPositionMapper(xScale);
|
|
29
|
+
const isBandScaleX = type === 'band' && axisX !== null && isBandScale(xScale);
|
|
30
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
+
const isError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
32
|
+
if (isError) {
|
|
33
|
+
console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
37
|
+
children: [isBandScaleX && xScale(axisX.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
|
|
38
|
+
// @ts-expect-error, xScale value is checked in the statement above
|
|
39
|
+
, {
|
|
40
|
+
d: `M ${xScale(axisX.value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
|
|
41
|
+
className: classes.root,
|
|
42
|
+
ownerState: {
|
|
43
|
+
axisHighlight: 'band'
|
|
44
|
+
}
|
|
45
|
+
}), type === 'line' && axisX !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
46
|
+
d: `M ${getXPosition(axisX.value)} ${top} L ${getXPosition(axisX.value)} ${top + height}`,
|
|
47
|
+
className: classes.root,
|
|
48
|
+
ownerState: {
|
|
49
|
+
axisHighlight: 'line'
|
|
50
|
+
}
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsAxisHighlightType } from './ChartsAxisHighlight.types';
|
|
3
|
+
import { ChartsAxisHighlightClasses } from './chartsAxisHighlightClasses';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore - internal component.
|
|
6
|
+
*/
|
|
7
|
+
export default function ChartsYHighlight(props: {
|
|
8
|
+
type: ChartsAxisHighlightType;
|
|
9
|
+
classes: ChartsAxisHighlightClasses;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { getValueToPositionMapper, useYScale } from "../hooks/useScale.js";
|
|
5
|
+
import { isBandScale } from "../internals/isBandScale.js";
|
|
6
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
7
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
8
|
+
import { selectorChartsInteractionYAxis } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
9
|
+
import { useDrawingArea } from "../hooks/index.js";
|
|
10
|
+
import { ChartsAxisHighlightPath } from "./ChartsAxisHighlightPath.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @ignore - internal component.
|
|
14
|
+
*/
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
export default function ChartsYHighlight(props) {
|
|
17
|
+
const {
|
|
18
|
+
type,
|
|
19
|
+
classes
|
|
20
|
+
} = props;
|
|
21
|
+
const {
|
|
22
|
+
left,
|
|
23
|
+
width
|
|
24
|
+
} = useDrawingArea();
|
|
25
|
+
const yScale = useYScale();
|
|
26
|
+
const store = useStore();
|
|
27
|
+
const axisY = useSelector(store, selectorChartsInteractionYAxis);
|
|
28
|
+
const getYPosition = getValueToPositionMapper(yScale);
|
|
29
|
+
const isBandScaleY = type === 'band' && axisY !== null && isBandScale(yScale);
|
|
30
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
+
const isError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
32
|
+
if (isError) {
|
|
33
|
+
console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
37
|
+
children: [isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
38
|
+
d: `M ${left} ${
|
|
39
|
+
// @ts-expect-error, yScale value is checked in the statement above
|
|
40
|
+
yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
|
|
41
|
+
className: classes.root,
|
|
42
|
+
ownerState: {
|
|
43
|
+
axisHighlight: 'band'
|
|
44
|
+
}
|
|
45
|
+
}), type === 'line' && axisY !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
46
|
+
d: `M ${left} ${getYPosition(axisY.value)} L ${left + width} ${getYPosition(axisY.value)}`,
|
|
47
|
+
className: classes.root,
|
|
48
|
+
ownerState: {
|
|
49
|
+
axisHighlight: 'line'
|
|
50
|
+
}
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ChartsAxisHighlightClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
}
|
|
5
|
+
export type ChartsAxisHighlightClassKey = keyof ChartsAxisHighlightClasses;
|
|
6
|
+
export declare function getAxisHighlightUtilityClass(slot: string): string;
|
|
7
|
+
export declare const chartsAxisHighlightClasses: ChartsAxisHighlightClasses;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
export function getAxisHighlightUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiChartsAxisHighlight', slot);
|
|
5
|
+
}
|
|
6
|
+
export const chartsAxisHighlightClasses = generateUtilityClasses('MuiChartsAxisHighlight', ['root']);
|
package/ChartsGrid/ChartsGrid.js
CHANGED
|
@@ -10,7 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
10
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
11
11
|
import { getChartsGridUtilityClass } from "./chartsGridClasses.js";
|
|
12
12
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
13
|
-
import { GridRoot } from "./
|
|
13
|
+
import { GridRoot } from "./styledComponents.js";
|
|
14
14
|
import { ChartsGridVertical } from "./ChartsVerticalGrid.js";
|
|
15
15
|
import { ChartsGridHorizontal } from "./ChartsHorizontalGrid.js";
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DrawingAreaState } from '../context/DrawingAreaProvider';
|
|
3
3
|
import { AxisDefaultized, ChartsYAxisProps, ScaleName } from '../models/axis';
|
|
4
4
|
import { ChartsGridClasses } from './chartsGridClasses';
|
|
5
5
|
interface ChartsGridHorizontalProps {
|
|
6
6
|
axis: AxisDefaultized<ScaleName, any, ChartsYAxisProps>;
|
|
7
|
-
drawingArea:
|
|
7
|
+
drawingArea: DrawingAreaState;
|
|
8
8
|
classes: Partial<ChartsGridClasses>;
|
|
9
9
|
}
|
|
10
10
|
/**
|