@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,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useTicks } from "../hooks/useTicks.js";
|
|
3
|
-
import { GridLine } from "./
|
|
3
|
+
import { GridLine } from "./styledComponents.js";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
/**
|
|
6
6
|
* @ignore - internal component.
|
|
@@ -23,7 +23,7 @@ export function ChartsGridHorizontal(props) {
|
|
|
23
23
|
});
|
|
24
24
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
25
25
|
children: yTicks.map(({
|
|
26
|
-
|
|
26
|
+
value,
|
|
27
27
|
offset
|
|
28
28
|
}) => /*#__PURE__*/_jsx(GridLine, {
|
|
29
29
|
y1: offset,
|
|
@@ -31,6 +31,6 @@ export function ChartsGridHorizontal(props) {
|
|
|
31
31
|
x1: drawingArea.left,
|
|
32
32
|
x2: drawingArea.left + drawingArea.width,
|
|
33
33
|
className: classes.horizontalLine
|
|
34
|
-
}, `horizontal-${
|
|
34
|
+
}, `horizontal-${value}`))
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DrawingAreaState } from '../context/DrawingAreaProvider';
|
|
3
3
|
import { AxisDefaultized, ChartsXAxisProps, ScaleName } from '../models/axis';
|
|
4
4
|
import { ChartsGridClasses } from './chartsGridClasses';
|
|
5
5
|
interface ChartsGridVerticalProps {
|
|
6
6
|
axis: AxisDefaultized<ScaleName, any, ChartsXAxisProps>;
|
|
7
|
-
drawingArea:
|
|
7
|
+
drawingArea: DrawingAreaState;
|
|
8
8
|
classes: Partial<ChartsGridClasses>;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useTicks } from "../hooks/useTicks.js";
|
|
3
|
-
import { GridLine } from "./
|
|
3
|
+
import { GridLine } from "./styledComponents.js";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
/**
|
|
6
6
|
* @ignore - internal component.
|
|
@@ -23,7 +23,7 @@ export function ChartsGridVertical(props) {
|
|
|
23
23
|
});
|
|
24
24
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
25
25
|
children: xTicks.map(({
|
|
26
|
-
|
|
26
|
+
value,
|
|
27
27
|
offset
|
|
28
28
|
}) => /*#__PURE__*/_jsx(GridLine, {
|
|
29
29
|
y1: drawingArea.top,
|
|
@@ -31,6 +31,6 @@ export function ChartsGridVertical(props) {
|
|
|
31
31
|
x1: offset,
|
|
32
32
|
x2: offset,
|
|
33
33
|
className: classes.verticalLine
|
|
34
|
-
}, `vertical-${
|
|
34
|
+
}, `vertical-${value}`))
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
|
-
import {
|
|
3
|
+
import { DrawingAreaState } from '../context/DrawingAreaProvider';
|
|
4
4
|
import { ChartsTextStyle } from '../ChartsText';
|
|
5
5
|
import { CardinalDirections } from '../models/layout';
|
|
6
6
|
import { LegendItemParams } from './chartsLegend.types';
|
|
@@ -9,7 +9,7 @@ import { ChartsLegendClasses } from './chartsLegendClasses';
|
|
|
9
9
|
export type ChartsLegendRootOwnerState = {
|
|
10
10
|
position: AnchorPosition;
|
|
11
11
|
direction: Direction;
|
|
12
|
-
drawingArea:
|
|
12
|
+
drawingArea: DrawingAreaState;
|
|
13
13
|
offsetX?: number;
|
|
14
14
|
offsetY?: number;
|
|
15
15
|
seriesNumber: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
2
3
|
export function getLegendUtilityClass(slot) {
|
|
3
4
|
return generateUtilityClass('MuiChartsLegend', slot);
|
|
4
5
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
6
5
|
import { useSeries } from "../hooks/useSeries.js";
|
|
7
6
|
import { useSvgRef } from "../hooks/index.js";
|
|
8
7
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
8
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
function ChartsOnAxisClickHandler(props) {
|
|
11
11
|
const {
|
|
@@ -13,9 +13,7 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
13
13
|
} = props;
|
|
14
14
|
const svgRef = useSvgRef();
|
|
15
15
|
const series = useSeries();
|
|
16
|
-
const
|
|
17
|
-
axis
|
|
18
|
-
} = React.useContext(InteractionContext);
|
|
16
|
+
const store = useStore();
|
|
19
17
|
const {
|
|
20
18
|
xAxisIds,
|
|
21
19
|
xAxis,
|
|
@@ -29,9 +27,13 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
29
27
|
}
|
|
30
28
|
const handleMouseClick = event => {
|
|
31
29
|
event.preventDefault();
|
|
32
|
-
const
|
|
30
|
+
const {
|
|
31
|
+
x: axisX,
|
|
32
|
+
y: axisY
|
|
33
|
+
} = store.value.interaction.axis;
|
|
34
|
+
const isXaxis = axisX && axisX.index !== -1;
|
|
33
35
|
const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
|
|
34
|
-
const dataIndex = isXaxis ?
|
|
36
|
+
const dataIndex = isXaxis ? axisX && axisX.index : axisY && axisY.index;
|
|
35
37
|
if (dataIndex == null) {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
@@ -58,7 +60,7 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
58
60
|
return () => {
|
|
59
61
|
element.removeEventListener('click', handleMouseClick);
|
|
60
62
|
};
|
|
61
|
-
}, [
|
|
63
|
+
}, [onAxisClick, series, store, svgRef, xAxis, xAxisIds, yAxis, yAxisIds]);
|
|
62
64
|
|
|
63
65
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
64
66
|
return /*#__PURE__*/_jsx(React.Fragment, {});
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
type ViewBox = {
|
|
4
|
-
x?: number;
|
|
5
|
-
y?: number;
|
|
6
|
-
width?: number;
|
|
7
|
-
height?: number;
|
|
8
|
-
};
|
|
9
3
|
export interface ChartsSurfaceProps {
|
|
10
|
-
/**
|
|
11
|
-
* The width of the chart in px.
|
|
12
|
-
*/
|
|
13
|
-
width: number;
|
|
14
|
-
/**
|
|
15
|
-
* The height of the chart in px.
|
|
16
|
-
*/
|
|
17
|
-
height: number;
|
|
18
|
-
viewBox?: ViewBox;
|
|
19
4
|
className?: string;
|
|
20
5
|
title?: string;
|
|
21
6
|
desc?: string;
|
|
@@ -28,5 +13,19 @@ export interface ChartsSurfaceProps {
|
|
|
28
13
|
*/
|
|
29
14
|
disableAxisListener?: boolean;
|
|
30
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* It provides the drawing area for the chart elements.
|
|
18
|
+
* It is the root `<svg>` of all the chart elements.
|
|
19
|
+
*
|
|
20
|
+
* It also provides the `title` and `desc` elements for the chart.
|
|
21
|
+
*
|
|
22
|
+
* Demos:
|
|
23
|
+
*
|
|
24
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
25
|
+
*
|
|
26
|
+
* API:
|
|
27
|
+
*
|
|
28
|
+
* - [ChartsSurface API](https://mui.com/x/api/charts/charts-surface/)
|
|
29
|
+
*/
|
|
31
30
|
declare const ChartsSurface: React.ForwardRefExoticComponent<ChartsSurfaceProps & React.RefAttributes<SVGSVGElement>>;
|
|
32
31
|
export { ChartsSurface };
|
|
@@ -2,55 +2,102 @@
|
|
|
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 = ["children", "
|
|
5
|
+
const _excluded = ["children", "disableAxisListener", "className", "title", "desc"];
|
|
6
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import * as React from 'react';
|
|
9
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
9
10
|
import { useAxisEvents } from "../hooks/useAxisEvents.js";
|
|
11
|
+
import { ChartsAxesGradients } from "../internals/components/ChartsAxesGradients/index.js";
|
|
12
|
+
import { useDrawingArea, useSvgRef } from "../hooks/index.js";
|
|
13
|
+
import { useSize } from "../context/SizeProvider/index.js";
|
|
10
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const
|
|
15
|
+
const ChartsSurfaceStyles = styled('svg', {
|
|
12
16
|
name: 'MuiChartsSurface',
|
|
13
17
|
slot: 'Root'
|
|
14
|
-
})((
|
|
18
|
+
})(({
|
|
19
|
+
ownerState
|
|
20
|
+
}) => ({
|
|
21
|
+
width: ownerState.width ?? '100%',
|
|
22
|
+
height: ownerState.height ?? '100%',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
position: 'relative',
|
|
25
|
+
flexGrow: 1,
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
overflow: 'hidden',
|
|
15
30
|
// This prevents default touch actions when using the svg on mobile devices.
|
|
16
31
|
// For example, prevent page scroll & zoom.
|
|
17
32
|
touchAction: 'none'
|
|
18
33
|
}));
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* It provides the drawing area for the chart elements.
|
|
37
|
+
* It is the root `<svg>` of all the chart elements.
|
|
38
|
+
*
|
|
39
|
+
* It also provides the `title` and `desc` elements for the chart.
|
|
40
|
+
*
|
|
41
|
+
* Demos:
|
|
42
|
+
*
|
|
43
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
44
|
+
*
|
|
45
|
+
* API:
|
|
46
|
+
*
|
|
47
|
+
* - [ChartsSurface API](https://mui.com/x/api/charts/charts-surface/)
|
|
48
|
+
*/
|
|
19
49
|
const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(inProps, ref) {
|
|
20
|
-
const
|
|
50
|
+
const {
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
left,
|
|
54
|
+
right,
|
|
55
|
+
top,
|
|
56
|
+
bottom
|
|
57
|
+
} = useDrawingArea();
|
|
58
|
+
const {
|
|
59
|
+
hasIntrinsicSize,
|
|
60
|
+
svgRef: containerRef,
|
|
61
|
+
inHeight,
|
|
62
|
+
inWidth
|
|
63
|
+
} = useSize();
|
|
64
|
+
const svgRef = useSvgRef();
|
|
65
|
+
const handleRef = useForkRef(containerRef, svgRef, ref);
|
|
66
|
+
const themeProps = useThemeProps({
|
|
21
67
|
props: inProps,
|
|
22
68
|
name: 'MuiChartsSurface'
|
|
23
69
|
});
|
|
24
70
|
const {
|
|
25
71
|
children,
|
|
26
|
-
width,
|
|
27
|
-
height,
|
|
28
|
-
viewBox,
|
|
29
72
|
disableAxisListener = false,
|
|
30
73
|
className,
|
|
31
74
|
title,
|
|
32
75
|
desc
|
|
33
|
-
} =
|
|
34
|
-
other = _objectWithoutPropertiesLoose(
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
76
|
+
} = themeProps,
|
|
77
|
+
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
78
|
+
const svgWidth = width + left + right;
|
|
79
|
+
const svgHeight = height + top + bottom;
|
|
80
|
+
const svgView = {
|
|
81
|
+
width: svgWidth,
|
|
82
|
+
height: svgHeight,
|
|
38
83
|
x: 0,
|
|
39
84
|
y: 0
|
|
40
|
-
}
|
|
85
|
+
};
|
|
41
86
|
useAxisEvents(disableAxisListener);
|
|
42
|
-
return /*#__PURE__*/_jsxs(
|
|
43
|
-
|
|
44
|
-
|
|
87
|
+
return /*#__PURE__*/_jsxs(ChartsSurfaceStyles, _extends({
|
|
88
|
+
ownerState: {
|
|
89
|
+
width: inWidth,
|
|
90
|
+
height: inHeight
|
|
91
|
+
},
|
|
45
92
|
viewBox: `${svgView.x} ${svgView.y} ${svgView.width} ${svgView.height}`,
|
|
46
|
-
ref: ref,
|
|
47
93
|
className: className
|
|
48
94
|
}, other, {
|
|
49
|
-
|
|
95
|
+
ref: handleRef,
|
|
96
|
+
children: [title && /*#__PURE__*/_jsx("title", {
|
|
50
97
|
children: title
|
|
51
|
-
}), /*#__PURE__*/_jsx("desc", {
|
|
98
|
+
}), desc && /*#__PURE__*/_jsx("desc", {
|
|
52
99
|
children: desc
|
|
53
|
-
}), children]
|
|
100
|
+
}), /*#__PURE__*/_jsx(ChartsAxesGradients, {}), hasIntrinsicSize && children]
|
|
54
101
|
}));
|
|
55
102
|
});
|
|
56
103
|
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
@@ -67,21 +114,7 @@ process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
|
67
114
|
* @default false
|
|
68
115
|
*/
|
|
69
116
|
disableAxisListener: PropTypes.bool,
|
|
70
|
-
/**
|
|
71
|
-
* The height of the chart in px.
|
|
72
|
-
*/
|
|
73
|
-
height: PropTypes.number.isRequired,
|
|
74
117
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
75
|
-
title: PropTypes.string
|
|
76
|
-
viewBox: PropTypes.shape({
|
|
77
|
-
height: PropTypes.number,
|
|
78
|
-
width: PropTypes.number,
|
|
79
|
-
x: PropTypes.number,
|
|
80
|
-
y: PropTypes.number
|
|
81
|
-
}),
|
|
82
|
-
/**
|
|
83
|
-
* The width of the chart in px.
|
|
84
|
-
*/
|
|
85
|
-
width: PropTypes.number.isRequired
|
|
118
|
+
title: PropTypes.string
|
|
86
119
|
} : void 0;
|
|
87
120
|
export { ChartsSurface };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChartsTooltipProps } from './ChartsTooltip';
|
|
2
|
+
export interface ChartsTooltipSlots {
|
|
3
|
+
/**
|
|
4
|
+
* Custom component for the tooltip popper.
|
|
5
|
+
* @default ChartsTooltipRoot
|
|
6
|
+
*/
|
|
7
|
+
tooltip?: React.ElementType<ChartsTooltipProps>;
|
|
8
|
+
}
|
|
9
|
+
export interface ChartsTooltipSlotProps {
|
|
10
|
+
/**
|
|
11
|
+
* Custom component for the tooltip popper.
|
|
12
|
+
* @default ChartsTooltipRoot
|
|
13
|
+
*/
|
|
14
|
+
tooltip?: Partial<ChartsTooltipProps>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
import { AxisInteractionData } from '../context/InteractionProvider';
|
|
4
|
-
import { ChartSeriesDefaultized, ChartSeriesType } from '../models/seriesType/config';
|
|
5
|
-
import { AxisDefaultized } from '../models/axis';
|
|
6
3
|
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
7
|
-
|
|
8
|
-
getColor: (dataIndex: number) => string;
|
|
9
|
-
};
|
|
10
|
-
export type ChartsAxisContentProps = {
|
|
11
|
-
/**
|
|
12
|
-
* Data identifying the triggered axis.
|
|
13
|
-
*/
|
|
14
|
-
axisData: AxisInteractionData;
|
|
15
|
-
/**
|
|
16
|
-
* The series linked to the triggered axis.
|
|
17
|
-
*/
|
|
18
|
-
series: ChartSeriesDefaultizedWithColorGetter[];
|
|
19
|
-
/**
|
|
20
|
-
* The properties of the triggered axis.
|
|
21
|
-
*/
|
|
22
|
-
axis: AxisDefaultized;
|
|
23
|
-
/**
|
|
24
|
-
* The index of the data item triggered.
|
|
25
|
-
*/
|
|
26
|
-
dataIndex?: null | number;
|
|
27
|
-
/**
|
|
28
|
-
* The value associated to the current mouse position.
|
|
29
|
-
*/
|
|
30
|
-
axisValue: string | number | Date | null;
|
|
4
|
+
export interface ChartsAxisTooltipContentProps {
|
|
31
5
|
/**
|
|
32
6
|
* Override or extend the styles applied to the component.
|
|
33
7
|
*/
|
|
34
|
-
classes
|
|
35
|
-
sx?: SxProps<Theme>;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* @ignore - internal component.
|
|
39
|
-
*/
|
|
40
|
-
declare function ChartsAxisTooltipContent(props: {
|
|
41
|
-
axisData: AxisInteractionData;
|
|
42
|
-
content?: React.ElementType<ChartsAxisContentProps>;
|
|
43
|
-
contentProps?: Partial<ChartsAxisContentProps>;
|
|
8
|
+
classes?: Partial<ChartsTooltipClasses>;
|
|
44
9
|
sx?: SxProps<Theme>;
|
|
45
|
-
|
|
46
|
-
|
|
10
|
+
}
|
|
11
|
+
declare function ChartsAxisTooltipContent(props: ChartsAxisTooltipContentProps): React.JSX.Element | null;
|
|
12
|
+
declare namespace ChartsAxisTooltipContent {
|
|
13
|
+
var propTypes: any;
|
|
14
|
+
}
|
|
47
15
|
export { ChartsAxisTooltipContent };
|
|
@@ -1,80 +1,91 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
/**
|
|
12
|
-
* @ignore - internal component.
|
|
13
|
-
*/
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { useUtilityClasses } from "./chartsTooltipClasses.js";
|
|
8
|
+
import { ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow, ChartsTooltipTable } from "./ChartsTooltipTable.js";
|
|
9
|
+
import { useAxisTooltip } from "./useAxisTooltip.js";
|
|
10
|
+
import { useXAxis, useYAxis } from "../hooks/index.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
12
|
function ChartsAxisTooltipContent(props) {
|
|
15
13
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
axisData,
|
|
19
|
-
sx,
|
|
20
|
-
classes
|
|
14
|
+
classes: propClasses,
|
|
15
|
+
sx
|
|
21
16
|
} = props;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
17
|
+
const tootlipData = useAxisTooltip();
|
|
18
|
+
const xAxis = useXAxis();
|
|
19
|
+
const yAxis = useYAxis();
|
|
20
|
+
const classes = useUtilityClasses(propClasses);
|
|
21
|
+
if (tootlipData === null) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
25
24
|
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} =
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
25
|
+
axisDirection,
|
|
26
|
+
axisValue,
|
|
27
|
+
axisFormattedValue,
|
|
28
|
+
seriesItems
|
|
29
|
+
} = tootlipData;
|
|
30
|
+
const axis = axisDirection === 'x' ? xAxis : yAxis;
|
|
31
|
+
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
32
|
+
sx: sx,
|
|
33
|
+
className: classes.paper,
|
|
34
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
35
|
+
className: classes.table,
|
|
36
|
+
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
37
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
|
|
38
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
39
|
+
colSpan: 3,
|
|
40
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
41
|
+
children: axisFormattedValue
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
46
|
+
children: seriesItems.map(({
|
|
47
|
+
seriesId,
|
|
48
|
+
color,
|
|
49
|
+
formattedValue,
|
|
50
|
+
formattedLabel
|
|
51
|
+
}) => {
|
|
52
|
+
if (formattedValue == null) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
56
|
+
className: classes.row,
|
|
57
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
58
|
+
className: clsx(classes.markCell, classes.cell),
|
|
59
|
+
children: color && /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
60
|
+
color: color,
|
|
61
|
+
className: classes.mark
|
|
62
|
+
})
|
|
63
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
64
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
65
|
+
children: formattedLabel ? /*#__PURE__*/_jsx(Typography, {
|
|
66
|
+
children: formattedLabel
|
|
67
|
+
}) : null
|
|
68
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
69
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
70
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
71
|
+
children: formattedValue
|
|
72
|
+
})
|
|
73
|
+
})]
|
|
74
|
+
}, seriesId);
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
})
|
|
77
78
|
});
|
|
78
|
-
return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
|
|
79
79
|
}
|
|
80
|
+
process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
81
|
+
// ----------------------------- Warning --------------------------------
|
|
82
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
83
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
84
|
+
// ----------------------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* Override or extend the styles applied to the component.
|
|
87
|
+
*/
|
|
88
|
+
classes: PropTypes.object,
|
|
89
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
90
|
+
} : void 0;
|
|
80
91
|
export { ChartsAxisTooltipContent };
|
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
import { ItemInteractionData } from '../context/InteractionProvider';
|
|
4
|
-
import { ChartSeriesDefaultized, ChartSeriesType } from '../models/seriesType/config';
|
|
5
3
|
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
6
|
-
export interface
|
|
7
|
-
/**
|
|
8
|
-
* The data used to identify the triggered item.
|
|
9
|
-
*/
|
|
10
|
-
itemData: ItemInteractionData<T>;
|
|
11
|
-
/**
|
|
12
|
-
* The series linked to the triggered item.
|
|
13
|
-
*/
|
|
14
|
-
series: ChartSeriesDefaultized<T>;
|
|
4
|
+
export interface ChartsItemTooltipContentProps {
|
|
15
5
|
/**
|
|
16
6
|
* Override or extend the styles applied to the component.
|
|
17
7
|
*/
|
|
18
|
-
classes
|
|
19
|
-
/**
|
|
20
|
-
* Get the color of the item with index `dataIndex`.
|
|
21
|
-
* @param {number} dataIndex The data index of the item.
|
|
22
|
-
* @returns {string} The color to display.
|
|
23
|
-
*/
|
|
24
|
-
getColor: (dataIndex: number) => string;
|
|
8
|
+
classes?: Partial<ChartsTooltipClasses>;
|
|
25
9
|
sx?: SxProps<Theme>;
|
|
26
10
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
contentProps?: Partial<ChartsItemContentProps<T>>;
|
|
31
|
-
sx?: SxProps<Theme>;
|
|
32
|
-
classes: ChartsItemContentProps<T>['classes'];
|
|
11
|
+
declare function ChartsItemTooltipContent(props: ChartsItemTooltipContentProps): React.JSX.Element | null;
|
|
12
|
+
declare namespace ChartsItemTooltipContent {
|
|
13
|
+
var propTypes: any;
|
|
33
14
|
}
|
|
34
|
-
/**
|
|
35
|
-
* @ignore - internal component.
|
|
36
|
-
*/
|
|
37
|
-
declare function ChartsItemTooltipContent<T extends ChartSeriesType>(props: ChartsItemTooltipContentProps<T>): React.JSX.Element;
|
|
38
15
|
export { ChartsItemTooltipContent };
|