@mui/x-charts 7.16.0 → 7.18.0
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/BarChart.js +13 -0
- package/BarChart/BarElement.js +2 -0
- package/BarChart/BarLabel/BarLabel.js +2 -0
- package/BarChart/BarPlot.js +2 -0
- package/BarChart/legend.js +3 -2
- package/BarChart/useBarChartProps.js +2 -0
- package/CHANGELOG.md +184 -4
- package/ChartContainer/ChartContainer.js +2 -0
- package/ChartContainer/useChartContainerProps.js +2 -0
- package/ChartContainer/useDefaultizeAxis.js +2 -0
- package/ChartsAxis/ChartsAxis.js +2 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -0
- package/ChartsClipPath/ChartsClipPath.js +2 -0
- package/ChartsGrid/ChartsGrid.js +2 -0
- package/ChartsLegend/ChartsLegend.d.ts +2 -2
- package/ChartsLegend/ChartsLegend.js +11 -1
- package/ChartsLegend/ChartsLegendItem.d.ts +26 -0
- package/ChartsLegend/ChartsLegendItem.js +65 -0
- package/ChartsLegend/ContinuousColorLegend.js +2 -0
- package/ChartsLegend/DefaultChartsLegend.d.ts +9 -1
- package/ChartsLegend/DefaultChartsLegend.js +26 -4
- package/ChartsLegend/LegendPerItem.d.ts +1 -0
- package/ChartsLegend/LegendPerItem.js +19 -28
- package/ChartsLegend/PiecewiseColorLegend.d.ts +9 -1
- package/ChartsLegend/PiecewiseColorLegend.js +28 -7
- package/ChartsLegend/chartsLegend.types.d.ts +39 -1
- package/ChartsLegend/chartsLegendClasses.d.ts +2 -0
- package/ChartsLegend/chartsLegendClasses.js +1 -1
- package/ChartsLegend/useAxis.js +2 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +2 -0
- package/ChartsOverlay/ChartsNoDataOverlay.js +2 -0
- package/ChartsOverlay/ChartsOverlay.js +2 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -1
- package/ChartsSurface/ChartsSurface.js +2 -0
- package/ChartsText/ChartsText.js +2 -0
- package/ChartsTooltip/ChartsTooltip.js +2 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -0
- package/ChartsTooltip/index.d.ts +3 -0
- package/ChartsTooltip/index.js +4 -1
- package/ChartsTooltip/useAxisTooltip.d.ts +18 -0
- package/ChartsTooltip/useAxisTooltip.js +84 -0
- package/ChartsTooltip/useItemTooltip.d.ts +10 -0
- package/ChartsTooltip/useItemTooltip.js +64 -0
- package/ChartsTooltip/utils.d.ts +2 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -0
- package/ChartsXAxis/ChartsXAxis.js +2 -0
- package/ChartsYAxis/ChartsYAxis.js +2 -0
- package/Gauge/Gauge.js +2 -0
- package/Gauge/GaugeContainer.js +2 -0
- package/Gauge/GaugeReferenceArc.js +2 -0
- package/Gauge/GaugeValueArc.js +2 -0
- package/Gauge/GaugeValueText.js +2 -0
- package/LineChart/AnimatedArea.js +2 -0
- package/LineChart/AnimatedLine.js +14 -22
- package/LineChart/AreaElement.js +2 -0
- package/LineChart/AreaPlot.js +2 -0
- package/LineChart/CircleMarkElement.d.ts +34 -0
- package/LineChart/CircleMarkElement.js +107 -0
- package/LineChart/LineChart.d.ts +4 -0
- package/LineChart/LineChart.js +17 -0
- package/LineChart/LineElement.js +2 -0
- package/LineChart/LineHighlightElement.js +2 -0
- package/LineChart/LineHighlightPlot.js +2 -0
- package/LineChart/LinePlot.js +2 -0
- package/LineChart/MarkElement.d.ts +1 -19
- package/LineChart/MarkElement.js +3 -19
- package/LineChart/MarkPlot.d.ts +6 -0
- package/LineChart/MarkPlot.js +13 -3
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +2 -1
- package/LineChart/legend.js +3 -2
- package/LineChart/markElementClasses.d.ts +20 -0
- package/LineChart/markElementClasses.js +19 -0
- package/LineChart/useLineChartProps.js +7 -3
- package/PieChart/PieArc.js +2 -0
- package/PieChart/PieArcLabel.js +2 -0
- package/PieChart/PieArcLabelPlot.js +2 -0
- package/PieChart/PieArcPlot.js +2 -0
- package/PieChart/PieChart.js +13 -0
- package/PieChart/PiePlot.js +2 -0
- package/PieChart/dataTransform/useTransformData.js +2 -0
- package/PieChart/legend.js +3 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +12 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +1 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +35 -9
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +5 -2
- package/ScatterChart/Scatter.js +2 -0
- package/ScatterChart/ScatterChart.js +13 -0
- package/ScatterChart/ScatterPlot.js +2 -0
- package/ScatterChart/legend.js +3 -2
- package/ScatterChart/useScatterChartProps.js +2 -0
- package/SparkLineChart/SparkLineChart.js +12 -0
- package/context/CartesianProvider/CartesianProvider.js +5 -3
- package/context/CartesianProvider/getAxisExtremum.d.ts +1 -1
- package/context/CartesianProvider/getAxisExtremum.js +5 -4
- package/context/CartesianProvider/index.d.ts +0 -5
- package/context/CartesianProvider/index.js +1 -6
- package/context/CartesianProvider/useCartesianContext.js +2 -0
- package/context/DrawingProvider.js +2 -0
- package/context/HighlightedProvider/HighlightedProvider.js +2 -0
- package/context/HighlightedProvider/useHighlighted.js +2 -0
- package/context/HighlightedProvider/useItemHighlighted.js +2 -0
- package/context/InteractionProvider.js +2 -0
- package/context/PluginProvider/ExtremumGetter.types.d.ts +1 -0
- package/context/PluginProvider/Plugin.types.d.ts +4 -0
- package/context/PluginProvider/PluginContext.js +3 -1
- package/context/PluginProvider/PluginProvider.js +2 -0
- package/context/PluginProvider/index.d.ts +2 -0
- package/context/PluginProvider/index.js +3 -1
- package/context/PluginProvider/mergePlugins.d.ts +10 -0
- package/context/PluginProvider/mergePlugins.js +11 -1
- package/context/PluginProvider/useColorProcessor.js +2 -0
- package/context/PluginProvider/useRadiusExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useRadiusExtremumGetter.js +17 -0
- package/context/PluginProvider/useRotationExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useRotationExtremumGetter.js +17 -0
- package/context/PluginProvider/useSeriesFormatter.js +2 -0
- package/context/PolarProvider/Polar.types.d.ts +42 -0
- package/context/PolarProvider/Polar.types.js +1 -0
- package/context/PolarProvider/PolarContext.d.ts +4 -0
- package/context/PolarProvider/PolarContext.js +13 -0
- package/context/PolarProvider/PolarProvider.d.ts +4 -0
- package/context/PolarProvider/PolarProvider.js +49 -0
- package/context/PolarProvider/getAxisExtremum.d.ts +4 -0
- package/context/PolarProvider/getAxisExtremum.js +20 -0
- package/context/PolarProvider/index.d.ts +0 -0
- package/context/PolarProvider/index.js +0 -0
- package/context/PolarProvider/usePolarContext.d.ts +2 -0
- package/context/PolarProvider/usePolarContext.js +10 -0
- package/context/SeriesProvider/SeriesProvider.js +2 -0
- package/context/ZAxisContextProvider.js +2 -0
- package/hooks/useAxis.js +2 -0
- package/hooks/useAxisEvents.js +2 -0
- package/hooks/useChartDimensions.js +2 -0
- package/hooks/useChartId.js +2 -0
- package/hooks/useColorScale.js +2 -0
- package/hooks/useDrawingArea.js +2 -0
- package/hooks/useInteractionItemProps.js +2 -0
- package/hooks/useMounted.js +2 -0
- package/hooks/useReducedMotion.js +2 -0
- package/hooks/useScale.js +2 -0
- package/hooks/useSeries.js +2 -0
- package/hooks/useSvgRef.js +2 -0
- package/hooks/useTicks.js +2 -0
- package/index.js +1 -1
- package/internals/computeAxisValue.d.ts +38 -0
- package/{modern/context/CartesianProvider/computeValue.js → internals/computeAxisValue.js} +28 -15
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/models/axis.d.ts +20 -0
- package/models/seriesType/config.d.ts +6 -2
- package/modern/BarChart/BarChart.js +13 -0
- package/modern/BarChart/BarElement.js +2 -0
- package/modern/BarChart/BarLabel/BarLabel.js +2 -0
- package/modern/BarChart/BarPlot.js +2 -0
- package/modern/BarChart/legend.js +3 -2
- package/modern/BarChart/useBarChartProps.js +2 -0
- package/modern/ChartContainer/ChartContainer.js +2 -0
- package/modern/ChartContainer/useChartContainerProps.js +2 -0
- package/modern/ChartContainer/useDefaultizeAxis.js +2 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -0
- package/modern/ChartsClipPath/ChartsClipPath.js +2 -0
- package/modern/ChartsGrid/ChartsGrid.js +2 -0
- package/modern/ChartsLegend/ChartsLegend.js +11 -1
- package/modern/ChartsLegend/ChartsLegendItem.js +65 -0
- package/modern/ChartsLegend/ContinuousColorLegend.js +2 -0
- package/modern/ChartsLegend/DefaultChartsLegend.js +26 -4
- package/modern/ChartsLegend/LegendPerItem.js +19 -28
- package/modern/ChartsLegend/PiecewiseColorLegend.js +28 -7
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsLegend/useAxis.js +2 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/modern/ChartsOverlay/ChartsLoadingOverlay.js +2 -0
- package/modern/ChartsOverlay/ChartsNoDataOverlay.js +2 -0
- package/modern/ChartsOverlay/ChartsOverlay.js +2 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -1
- package/modern/ChartsSurface/ChartsSurface.js +2 -0
- package/modern/ChartsText/ChartsText.js +2 -0
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -0
- package/modern/ChartsTooltip/index.js +4 -1
- package/modern/ChartsTooltip/useAxisTooltip.js +84 -0
- package/modern/ChartsTooltip/useItemTooltip.js +64 -0
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -0
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -0
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -0
- package/modern/Gauge/Gauge.js +2 -0
- package/modern/Gauge/GaugeContainer.js +2 -0
- package/modern/Gauge/GaugeReferenceArc.js +2 -0
- package/modern/Gauge/GaugeValueArc.js +2 -0
- package/modern/Gauge/GaugeValueText.js +2 -0
- package/modern/LineChart/AnimatedArea.js +2 -0
- package/modern/LineChart/AnimatedLine.js +14 -22
- package/modern/LineChart/AreaElement.js +2 -0
- package/modern/LineChart/AreaPlot.js +2 -0
- package/modern/LineChart/CircleMarkElement.js +107 -0
- package/modern/LineChart/LineChart.js +17 -0
- package/modern/LineChart/LineElement.js +2 -0
- package/modern/LineChart/LineHighlightElement.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +2 -0
- package/modern/LineChart/LinePlot.js +2 -0
- package/modern/LineChart/MarkElement.js +3 -19
- package/modern/LineChart/MarkPlot.js +13 -3
- package/modern/LineChart/index.js +2 -1
- package/modern/LineChart/legend.js +3 -2
- package/modern/LineChart/markElementClasses.js +19 -0
- package/modern/LineChart/useLineChartProps.js +7 -3
- package/modern/PieChart/PieArc.js +2 -0
- package/modern/PieChart/PieArcLabel.js +2 -0
- package/modern/PieChart/PieArcLabelPlot.js +2 -0
- package/modern/PieChart/PieArcPlot.js +2 -0
- package/modern/PieChart/PieChart.js +13 -0
- package/modern/PieChart/PiePlot.js +2 -0
- package/modern/PieChart/dataTransform/useTransformData.js +2 -0
- package/modern/PieChart/legend.js +3 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +12 -0
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +35 -9
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +5 -2
- package/modern/ScatterChart/Scatter.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +13 -0
- package/modern/ScatterChart/ScatterPlot.js +2 -0
- package/modern/ScatterChart/legend.js +3 -2
- package/modern/ScatterChart/useScatterChartProps.js +2 -0
- package/modern/SparkLineChart/SparkLineChart.js +12 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +5 -3
- package/modern/context/CartesianProvider/getAxisExtremum.js +5 -4
- package/modern/context/CartesianProvider/index.js +1 -6
- package/modern/context/CartesianProvider/useCartesianContext.js +2 -0
- package/modern/context/DrawingProvider.js +2 -0
- package/modern/context/HighlightedProvider/HighlightedProvider.js +2 -0
- package/modern/context/HighlightedProvider/useHighlighted.js +2 -0
- package/modern/context/HighlightedProvider/useItemHighlighted.js +2 -0
- package/modern/context/InteractionProvider.js +2 -0
- package/modern/context/PluginProvider/PluginContext.js +3 -1
- package/modern/context/PluginProvider/PluginProvider.js +2 -0
- package/modern/context/PluginProvider/index.js +3 -1
- package/modern/context/PluginProvider/mergePlugins.js +11 -1
- package/modern/context/PluginProvider/useColorProcessor.js +2 -0
- package/modern/context/PluginProvider/useRadiusExtremumGetter.js +17 -0
- package/modern/context/PluginProvider/useRotationExtremumGetter.js +17 -0
- package/modern/context/PluginProvider/useSeriesFormatter.js +2 -0
- package/modern/context/PolarProvider/Polar.types.js +1 -0
- package/modern/context/PolarProvider/PolarContext.js +13 -0
- package/modern/context/PolarProvider/PolarProvider.js +49 -0
- package/modern/context/PolarProvider/getAxisExtremum.js +20 -0
- package/modern/context/PolarProvider/index.js +0 -0
- package/modern/context/PolarProvider/usePolarContext.js +10 -0
- package/modern/context/SeriesProvider/SeriesProvider.js +2 -0
- package/modern/context/ZAxisContextProvider.js +2 -0
- package/modern/hooks/useAxis.js +2 -0
- package/modern/hooks/useAxisEvents.js +2 -0
- package/modern/hooks/useChartDimensions.js +2 -0
- package/modern/hooks/useChartId.js +2 -0
- package/modern/hooks/useColorScale.js +2 -0
- package/modern/hooks/useDrawingArea.js +2 -0
- package/modern/hooks/useInteractionItemProps.js +2 -0
- package/modern/hooks/useMounted.js +2 -0
- package/modern/hooks/useReducedMotion.js +2 -0
- package/modern/hooks/useScale.js +2 -0
- package/modern/hooks/useSeries.js +2 -0
- package/modern/hooks/useSvgRef.js +2 -0
- package/modern/hooks/useTicks.js +2 -0
- package/modern/index.js +1 -1
- package/{context/CartesianProvider/computeValue.js → modern/internals/computeAxisValue.js} +28 -15
- package/modern/internals/index.js +1 -0
- package/node/BarChart/BarChart.js +12 -0
- package/node/BarChart/BarElement.js +1 -0
- package/node/BarChart/BarLabel/BarLabel.js +1 -0
- package/node/BarChart/BarPlot.js +1 -0
- package/node/BarChart/legend.js +3 -2
- package/node/BarChart/useBarChartProps.js +1 -0
- package/node/ChartContainer/ChartContainer.js +1 -0
- package/node/ChartContainer/useChartContainerProps.js +1 -0
- package/node/ChartContainer/useDefaultizeAxis.js +1 -0
- package/node/ChartsAxis/ChartsAxis.js +1 -0
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -0
- package/node/ChartsClipPath/ChartsClipPath.js +1 -0
- package/node/ChartsGrid/ChartsGrid.js +1 -0
- package/node/ChartsLegend/ChartsLegend.js +10 -1
- package/node/ChartsLegend/ChartsLegendItem.js +72 -0
- package/node/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/node/ChartsLegend/DefaultChartsLegend.js +25 -4
- package/node/ChartsLegend/LegendPerItem.js +18 -28
- package/node/ChartsLegend/PiecewiseColorLegend.js +27 -7
- package/node/ChartsLegend/chartsLegendClasses.js +1 -1
- package/node/ChartsLegend/useAxis.js +1 -0
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -1
- package/node/ChartsOverlay/ChartsLoadingOverlay.js +1 -0
- package/node/ChartsOverlay/ChartsNoDataOverlay.js +1 -0
- package/node/ChartsOverlay/ChartsOverlay.js +1 -0
- package/node/ChartsReferenceLine/ChartsReferenceLine.js +1 -0
- package/node/ChartsReferenceLine/ChartsXReferenceLine.js +2 -1
- package/node/ChartsReferenceLine/ChartsYReferenceLine.js +2 -1
- package/node/ChartsSurface/ChartsSurface.js +1 -0
- package/node/ChartsText/ChartsText.js +1 -0
- package/node/ChartsTooltip/ChartsTooltip.js +1 -0
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -0
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -0
- package/node/ChartsTooltip/index.js +42 -1
- package/node/ChartsTooltip/useAxisTooltip.js +90 -0
- package/node/ChartsTooltip/useItemTooltip.js +71 -0
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -0
- package/node/ChartsXAxis/ChartsXAxis.js +1 -0
- package/node/ChartsYAxis/ChartsYAxis.js +1 -0
- package/node/Gauge/Gauge.js +1 -0
- package/node/Gauge/GaugeContainer.js +1 -0
- package/node/Gauge/GaugeReferenceArc.js +1 -0
- package/node/Gauge/GaugeValueArc.js +1 -0
- package/node/Gauge/GaugeValueText.js +1 -0
- package/node/LineChart/AnimatedArea.js +1 -0
- package/node/LineChart/AnimatedLine.js +13 -22
- package/node/LineChart/AreaElement.js +1 -0
- package/node/LineChart/AreaPlot.js +1 -0
- package/node/LineChart/CircleMarkElement.js +113 -0
- package/node/LineChart/LineChart.js +16 -0
- package/node/LineChart/LineElement.js +1 -0
- package/node/LineChart/LineHighlightElement.js +1 -0
- package/node/LineChart/LineHighlightPlot.js +1 -0
- package/node/LineChart/LinePlot.js +1 -0
- package/node/LineChart/MarkElement.js +3 -22
- package/node/LineChart/MarkPlot.js +12 -3
- package/node/LineChart/index.js +29 -1
- package/node/LineChart/legend.js +3 -2
- package/node/LineChart/markElementClasses.js +28 -0
- package/node/LineChart/useLineChartProps.js +6 -3
- package/node/PieChart/PieArc.js +1 -0
- package/node/PieChart/PieArcLabel.js +1 -0
- package/node/PieChart/PieArcLabelPlot.js +1 -0
- package/node/PieChart/PieArcPlot.js +1 -0
- package/node/PieChart/PieChart.js +12 -0
- package/node/PieChart/PiePlot.js +1 -0
- package/node/PieChart/dataTransform/useTransformData.js +1 -0
- package/node/PieChart/legend.js +3 -1
- package/node/ResponsiveChartContainer/ResponsiveChartContainer.js +11 -0
- package/node/ResponsiveChartContainer/useChartContainerDimensions.js +34 -9
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +4 -2
- package/node/ScatterChart/Scatter.js +1 -0
- package/node/ScatterChart/ScatterChart.js +12 -0
- package/node/ScatterChart/ScatterPlot.js +1 -0
- package/node/ScatterChart/legend.js +3 -2
- package/node/ScatterChart/useScatterChartProps.js +1 -0
- package/node/SparkLineChart/SparkLineChart.js +11 -0
- package/node/context/CartesianProvider/CartesianProvider.js +4 -3
- package/node/context/CartesianProvider/getAxisExtremum.js +5 -4
- package/node/context/CartesianProvider/index.js +1 -13
- package/node/context/CartesianProvider/useCartesianContext.js +1 -0
- package/node/context/DrawingProvider.js +1 -0
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -0
- package/node/context/HighlightedProvider/useHighlighted.js +1 -0
- package/node/context/HighlightedProvider/useItemHighlighted.js +1 -0
- package/node/context/InteractionProvider.js +1 -0
- package/node/context/PluginProvider/PluginContext.js +3 -1
- package/node/context/PluginProvider/PluginProvider.js +1 -0
- package/node/context/PluginProvider/index.js +22 -0
- package/node/context/PluginProvider/mergePlugins.js +11 -1
- package/node/context/PluginProvider/useColorProcessor.js +1 -0
- package/node/context/PluginProvider/useRadiusExtremumGetter.js +23 -0
- package/node/context/PluginProvider/useRotationExtremumGetter.js +23 -0
- package/node/context/PluginProvider/useSeriesFormatter.js +1 -0
- package/node/context/PolarProvider/Polar.types.js +5 -0
- package/node/context/PolarProvider/PolarContext.js +20 -0
- package/node/context/PolarProvider/PolarProvider.js +54 -0
- package/node/context/PolarProvider/getAxisExtremum.js +27 -0
- package/node/context/PolarProvider/index.js +1 -0
- package/node/context/PolarProvider/usePolarContext.js +17 -0
- package/node/context/SeriesProvider/SeriesProvider.js +1 -0
- package/node/context/ZAxisContextProvider.js +1 -0
- package/node/hooks/useAxis.js +1 -0
- package/node/hooks/useAxisEvents.js +1 -0
- package/node/hooks/useChartDimensions.js +1 -0
- package/node/hooks/useChartId.js +1 -0
- package/node/hooks/useColorScale.js +1 -0
- package/node/hooks/useDrawingArea.js +1 -0
- package/node/hooks/useInteractionItemProps.js +1 -0
- package/node/hooks/useMounted.js +1 -0
- package/node/hooks/useReducedMotion.js +1 -0
- package/node/hooks/useScale.js +1 -0
- package/node/hooks/useSeries.js +1 -0
- package/node/hooks/useSvgRef.js +1 -0
- package/node/hooks/useTicks.js +1 -0
- package/node/index.js +1 -1
- package/node/{context/CartesianProvider/computeValue.js → internals/computeAxisValue.js} +29 -16
- package/node/internals/index.js +12 -0
- package/package.json +4 -4
- package/context/CartesianProvider/computeValue.d.ts +0 -30
- package/internals/warning.d.ts +0 -2
- package/internals/warning.js +0 -21
- package/modern/internals/warning.js +0 -21
- package/node/internals/warning.js +0 -28
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ColorLegendSelector, PiecewiseLabelFormatterParams } from './legend.types';
|
|
3
3
|
import { LegendPerItemProps } from './LegendPerItem';
|
|
4
|
-
|
|
4
|
+
import { PiecewiseColorLegendItemContext } from './chartsLegend.types';
|
|
5
|
+
export interface PiecewiseColorLegendProps extends ColorLegendSelector, Omit<LegendPerItemProps, 'itemsToDisplay' | 'onItemClick'> {
|
|
5
6
|
/**
|
|
6
7
|
* Hide the first item of the legend, corresponding to the [-infinity, min] piece.
|
|
7
8
|
* @default false
|
|
@@ -18,6 +19,13 @@ export interface PiecewiseColorLegendProps extends ColorLegendSelector, Omit<Leg
|
|
|
18
19
|
* @returns {string|null} The displayed label, or `null` to skip the item.
|
|
19
20
|
*/
|
|
20
21
|
labelFormatter?: (params: PiecewiseLabelFormatterParams) => string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Callback fired when a legend item is clicked.
|
|
24
|
+
* @param {React.MouseEvent<SVGRectElement, MouseEvent>} event The click event.
|
|
25
|
+
* @param {PiecewiseColorLegendItemContext} legendItem The legend item data.
|
|
26
|
+
* @param {number} index The index of the clicked legend item.
|
|
27
|
+
*/
|
|
28
|
+
onItemClick?: (event: React.MouseEvent<SVGRectElement, MouseEvent>, legendItem: PiecewiseColorLegendItemContext, index: number) => void;
|
|
21
29
|
}
|
|
22
30
|
declare function PiecewiseColorLegend(props: PiecewiseColorLegendProps): React.JSX.Element | null;
|
|
23
31
|
declare namespace PiecewiseColorLegend {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["axisDirection", "axisId", "hideFirst", "hideLast", "labelFormatter"];
|
|
5
|
+
const _excluded = ["axisDirection", "axisId", "hideFirst", "hideLast", "labelFormatter", "onItemClick"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { useAxis } from "./useAxis.js";
|
|
@@ -16,13 +18,21 @@ function defaultLabelFormatter(params) {
|
|
|
16
18
|
}
|
|
17
19
|
return `${params.formattedMin}-${params.formattedMax}`;
|
|
18
20
|
}
|
|
21
|
+
const piecewiseColorContextBuilder = context => ({
|
|
22
|
+
type: 'piecewiseColor',
|
|
23
|
+
color: context.color,
|
|
24
|
+
label: context.label,
|
|
25
|
+
maxValue: context.maxValue,
|
|
26
|
+
minValue: context.minValue
|
|
27
|
+
});
|
|
19
28
|
function PiecewiseColorLegend(props) {
|
|
20
29
|
const {
|
|
21
30
|
axisDirection,
|
|
22
31
|
axisId,
|
|
23
32
|
hideFirst,
|
|
24
33
|
hideLast,
|
|
25
|
-
labelFormatter = defaultLabelFormatter
|
|
34
|
+
labelFormatter = defaultLabelFormatter,
|
|
35
|
+
onItemClick
|
|
26
36
|
} = props,
|
|
27
37
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
28
38
|
const axisItem = useAxis({
|
|
@@ -43,30 +53,34 @@ function PiecewiseColorLegend(props) {
|
|
|
43
53
|
if (hideFirst && isFirst || hideLast && isLast) {
|
|
44
54
|
return null;
|
|
45
55
|
}
|
|
46
|
-
const
|
|
56
|
+
const data = _extends({}, isFirst ? {
|
|
47
57
|
min: null,
|
|
48
58
|
formattedMin: null
|
|
49
59
|
} : {
|
|
50
60
|
min: colorMap.thresholds[index - 1],
|
|
51
61
|
formattedMin: formattedLabels[index - 1]
|
|
52
|
-
},
|
|
62
|
+
}, isLast ? {
|
|
53
63
|
max: null,
|
|
54
64
|
formattedMax: null
|
|
55
65
|
} : {
|
|
56
66
|
max: colorMap.thresholds[index],
|
|
57
67
|
formattedMax: formattedLabels[index]
|
|
58
|
-
})
|
|
68
|
+
});
|
|
69
|
+
const label = labelFormatter(data);
|
|
59
70
|
if (label === null) {
|
|
60
71
|
return null;
|
|
61
72
|
}
|
|
62
73
|
return {
|
|
63
74
|
id: label,
|
|
64
75
|
color,
|
|
65
|
-
label
|
|
76
|
+
label,
|
|
77
|
+
minValue: data.min,
|
|
78
|
+
maxValue: data.max
|
|
66
79
|
};
|
|
67
80
|
}).filter(notNull);
|
|
68
81
|
return /*#__PURE__*/_jsx(LegendPerItem, _extends({}, other, {
|
|
69
|
-
itemsToDisplay: itemsToDisplay
|
|
82
|
+
itemsToDisplay: itemsToDisplay,
|
|
83
|
+
onItemClick: onItemClick ? (e, i) => onItemClick(e, piecewiseColorContextBuilder(itemsToDisplay[i]), i) : undefined
|
|
70
84
|
}));
|
|
71
85
|
}
|
|
72
86
|
process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
|
|
@@ -134,6 +148,13 @@ process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
|
|
|
134
148
|
* @default 5
|
|
135
149
|
*/
|
|
136
150
|
markGap: PropTypes.number,
|
|
151
|
+
/**
|
|
152
|
+
* Callback fired when a legend item is clicked.
|
|
153
|
+
* @param {React.MouseEvent<SVGRectElement, MouseEvent>} event The click event.
|
|
154
|
+
* @param {PiecewiseColorLegendItemContext} legendItem The legend item data.
|
|
155
|
+
* @param {number} index The index of the clicked legend item.
|
|
156
|
+
*/
|
|
157
|
+
onItemClick: PropTypes.func,
|
|
137
158
|
/**
|
|
138
159
|
* Legend padding (in px).
|
|
139
160
|
* Can either be a single number, or an object with top, left, bottom, right properties.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ChartsTextStyle } from '../ChartsText';
|
|
2
|
-
|
|
2
|
+
import { PieItemId } from '../models';
|
|
3
|
+
import { SeriesId } from '../models/seriesType/common';
|
|
4
|
+
interface LegendItemContextBase {
|
|
3
5
|
/**
|
|
4
6
|
* The color used in the legend
|
|
5
7
|
*/
|
|
@@ -8,12 +10,47 @@ export interface LegendItemParams {
|
|
|
8
10
|
* The label displayed in the legend
|
|
9
11
|
*/
|
|
10
12
|
label: string;
|
|
13
|
+
}
|
|
14
|
+
export interface LegendItemParams extends Partial<Omit<SeriesLegendItemContext, 'type' | keyof LegendItemContextBase>>, Partial<Omit<PiecewiseColorLegendItemContext, 'type' | keyof LegendItemContextBase>>, LegendItemContextBase {
|
|
11
15
|
/**
|
|
12
16
|
* The identifier of the legend element.
|
|
13
17
|
* Used for internal purpose such as `key` props
|
|
14
18
|
*/
|
|
15
19
|
id: number | string;
|
|
16
20
|
}
|
|
21
|
+
export interface SeriesLegendItemContext extends LegendItemContextBase {
|
|
22
|
+
/**
|
|
23
|
+
* The type of the legend item
|
|
24
|
+
* - `series` is used for series legend item
|
|
25
|
+
* - `piecewiseColor` is used for piecewise color legend item
|
|
26
|
+
*/
|
|
27
|
+
type: 'series';
|
|
28
|
+
/**
|
|
29
|
+
* The identifier of the series
|
|
30
|
+
*/
|
|
31
|
+
seriesId: SeriesId;
|
|
32
|
+
/**
|
|
33
|
+
* The identifier of the pie item
|
|
34
|
+
*/
|
|
35
|
+
itemId?: PieItemId;
|
|
36
|
+
}
|
|
37
|
+
export interface PiecewiseColorLegendItemContext extends LegendItemContextBase {
|
|
38
|
+
/**
|
|
39
|
+
* The type of the legend item
|
|
40
|
+
* - `series` is used for series legend item
|
|
41
|
+
* - `piecewiseColor` is used for piecewise color legend item
|
|
42
|
+
*/
|
|
43
|
+
type: 'piecewiseColor';
|
|
44
|
+
/**
|
|
45
|
+
* The minimum value of the category
|
|
46
|
+
*/
|
|
47
|
+
minValue: number | Date | null;
|
|
48
|
+
/**
|
|
49
|
+
* The maximum value of the category
|
|
50
|
+
*/
|
|
51
|
+
maxValue: number | Date | null;
|
|
52
|
+
}
|
|
53
|
+
export type LegendItemContext = SeriesLegendItemContext | PiecewiseColorLegendItemContext;
|
|
17
54
|
export interface LegendItemWithPosition extends LegendItemParams {
|
|
18
55
|
positionX: number;
|
|
19
56
|
positionY: number;
|
|
@@ -29,3 +66,4 @@ export type GetItemSpaceType = (label: string, inStyle?: ChartsTextStyle) => {
|
|
|
29
66
|
outerWidth: number;
|
|
30
67
|
outerHeight: number;
|
|
31
68
|
};
|
|
69
|
+
export {};
|
|
@@ -3,6 +3,8 @@ export interface ChartsLegendClasses {
|
|
|
3
3
|
root: string;
|
|
4
4
|
/** Styles applied to a series element. */
|
|
5
5
|
series: string;
|
|
6
|
+
/** Styles applied to the item background. */
|
|
7
|
+
itemBackground: string;
|
|
6
8
|
/** Styles applied to series mark element. */
|
|
7
9
|
mark: string;
|
|
8
10
|
/** Styles applied to the series label. */
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generat
|
|
|
2
2
|
export function getLegendUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiChartsLegend', slot);
|
|
4
4
|
}
|
|
5
|
-
export const legendClasses = generateUtilityClasses('MuiChartsLegend', ['root', 'series', 'mark', 'label', 'column', 'row']);
|
|
5
|
+
export const legendClasses = generateUtilityClasses('MuiChartsLegend', ['root', 'series', 'itemBackground', 'mark', 'label', 'column', 'row']);
|
package/ChartsLegend/useAxis.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
@@ -27,7 +29,7 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
27
29
|
}
|
|
28
30
|
const handleMouseClick = event => {
|
|
29
31
|
event.preventDefault();
|
|
30
|
-
const isXaxis =
|
|
32
|
+
const isXaxis = axis.x && axis.x.index !== -1;
|
|
31
33
|
const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
|
|
32
34
|
const dataIndex = isXaxis ? axis.x && axis.x.index : axis.y && axis.y.index;
|
|
33
35
|
if (dataIndex == null) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
4
7
|
import { useDrawingArea, useXScale } from "../hooks/index.js";
|
|
5
8
|
import { ReferenceLineRoot } from "./common.js";
|
|
6
9
|
import { ChartsText } from "../ChartsText/index.js";
|
|
7
10
|
import { getReferenceLineUtilityClass } from "./chartsReferenceLineClasses.js";
|
|
8
|
-
import { warnOnce } from "../internals/warning.js";
|
|
9
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
12
|
const getTextParams = ({
|
|
11
13
|
top,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
4
7
|
import { useDrawingArea, useYScale } from "../hooks/index.js";
|
|
5
8
|
import { ReferenceLineRoot } from "./common.js";
|
|
6
9
|
import { ChartsText } from "../ChartsText/index.js";
|
|
7
10
|
import { getReferenceLineUtilityClass } from "./chartsReferenceLineClasses.js";
|
|
8
|
-
import { warnOnce } from "../internals/warning.js";
|
|
9
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
12
|
const getTextParams = ({
|
|
11
13
|
left,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "title", "desc"];
|
package/ChartsText/ChartsText.js
CHANGED
package/ChartsTooltip/index.d.ts
CHANGED
|
@@ -5,3 +5,6 @@ export * from './ChartsItemTooltipContent';
|
|
|
5
5
|
export * from './DefaultChartsAxisTooltipContent';
|
|
6
6
|
export * from './DefaultChartsItemTooltipContent';
|
|
7
7
|
export * from './ChartsTooltipTable';
|
|
8
|
+
export * from './useItemTooltip';
|
|
9
|
+
export * from './useAxisTooltip';
|
|
10
|
+
export { useMouseTracker } from './utils';
|
package/ChartsTooltip/index.js
CHANGED
|
@@ -4,4 +4,7 @@ export * from "./ChartsAxisTooltipContent.js";
|
|
|
4
4
|
export * from "./ChartsItemTooltipContent.js";
|
|
5
5
|
export * from "./DefaultChartsAxisTooltipContent.js";
|
|
6
6
|
export * from "./DefaultChartsItemTooltipContent.js";
|
|
7
|
-
export * from "./ChartsTooltipTable.js";
|
|
7
|
+
export * from "./ChartsTooltipTable.js";
|
|
8
|
+
export * from "./useItemTooltip.js";
|
|
9
|
+
export * from "./useAxisTooltip.js";
|
|
10
|
+
export { useMouseTracker } from "./utils.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxisInteractionData } from '../context/InteractionProvider';
|
|
2
|
+
import { SeriesId } from '../models/seriesType/common';
|
|
3
|
+
import { CartesianChartSeriesType, ChartsSeriesConfig } from '../models/seriesType/config';
|
|
4
|
+
export interface UseAxisTooltipReturnValue<SeriesT extends CartesianChartSeriesType = CartesianChartSeriesType, AxisValueT extends string | number | Date = string | number | Date> {
|
|
5
|
+
identifier: AxisInteractionData;
|
|
6
|
+
seriesItems: SeriesItem<SeriesT>[];
|
|
7
|
+
axisValue: AxisValueT;
|
|
8
|
+
axisFormattedValue: string;
|
|
9
|
+
}
|
|
10
|
+
interface SeriesItem<T extends CartesianChartSeriesType> {
|
|
11
|
+
seriesId: SeriesId;
|
|
12
|
+
color: string;
|
|
13
|
+
value: ChartsSeriesConfig[T]['valueType'];
|
|
14
|
+
formattedValue: string;
|
|
15
|
+
formattedLabel: string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function useAxisTooltip(): null | UseAxisTooltipReturnValue;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
5
|
+
import { useSeries } from "../hooks/useSeries.js";
|
|
6
|
+
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
7
|
+
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
8
|
+
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
9
|
+
import { getLabel } from "../internals/getLabel.js";
|
|
10
|
+
import { isCartesianSeriesType } from "../internals/isCartesian.js";
|
|
11
|
+
import { utcFormatter } from "./utils.js";
|
|
12
|
+
export function useAxisTooltip() {
|
|
13
|
+
const {
|
|
14
|
+
axis
|
|
15
|
+
} = React.useContext(InteractionContext);
|
|
16
|
+
const series = useSeries();
|
|
17
|
+
const {
|
|
18
|
+
xAxis,
|
|
19
|
+
yAxis,
|
|
20
|
+
xAxisIds,
|
|
21
|
+
yAxisIds
|
|
22
|
+
} = useCartesianContext();
|
|
23
|
+
const {
|
|
24
|
+
zAxis,
|
|
25
|
+
zAxisIds
|
|
26
|
+
} = React.useContext(ZAxisContext);
|
|
27
|
+
const colorProcessors = useColorProcessor();
|
|
28
|
+
|
|
29
|
+
// By default use the x-axis
|
|
30
|
+
const isXaxis = axis.x !== null && axis.x.index !== -1;
|
|
31
|
+
const axisData = isXaxis ? axis.x && axis.x : axis.y && axis.y;
|
|
32
|
+
if (axisData === null) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const {
|
|
36
|
+
index: dataIndex,
|
|
37
|
+
value: axisValue
|
|
38
|
+
} = axisData;
|
|
39
|
+
const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
|
|
40
|
+
const usedAxis = isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
|
|
41
|
+
const relevantSeries = Object.keys(series).filter(isCartesianSeriesType).flatMap(seriesType => {
|
|
42
|
+
const seriesOfType = series[seriesType];
|
|
43
|
+
if (!seriesOfType) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return seriesOfType.seriesOrder.map(seriesId => {
|
|
47
|
+
const seriesToAdd = seriesOfType.series[seriesId];
|
|
48
|
+
const providedXAxisId = seriesToAdd.xAxisId ?? seriesToAdd.xAxisKey;
|
|
49
|
+
const providedYAxisId = seriesToAdd.yAxisId ?? seriesToAdd.yAxisKey;
|
|
50
|
+
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
51
|
+
|
|
52
|
+
// Test if the series uses the default axis
|
|
53
|
+
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
54
|
+
const xAxisId = providedXAxisId ?? xAxisIds[0];
|
|
55
|
+
const yAxisId = providedYAxisId ?? yAxisIds[0];
|
|
56
|
+
const zAxisId = seriesToAdd.zAxisId ?? seriesToAdd.zAxisKey ?? zAxisIds[0];
|
|
57
|
+
const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId])(dataIndex) ?? '';
|
|
58
|
+
const value = seriesToAdd.data[dataIndex] ?? null;
|
|
59
|
+
const formattedValue = seriesToAdd.valueFormatter(value, {
|
|
60
|
+
dataIndex
|
|
61
|
+
});
|
|
62
|
+
const formattedLabel = getLabel(seriesToAdd.label, 'tooltip') ?? null;
|
|
63
|
+
return {
|
|
64
|
+
seriesId,
|
|
65
|
+
color,
|
|
66
|
+
value,
|
|
67
|
+
formattedValue,
|
|
68
|
+
formattedLabel
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
});
|
|
73
|
+
}).filter(item => item != null);
|
|
74
|
+
const axisFormatter = usedAxis.valueFormatter ?? (v => usedAxis.scaleType === 'utc' ? utcFormatter(v) : v.toLocaleString());
|
|
75
|
+
const axisFormattedValue = axisFormatter(axisValue, {
|
|
76
|
+
location: 'tooltip'
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
identifier: axis,
|
|
80
|
+
seriesItems: relevantSeries,
|
|
81
|
+
axisValue,
|
|
82
|
+
axisFormattedValue
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ItemInteractionData } from '../context/InteractionProvider';
|
|
2
|
+
import { ChartSeriesType, ChartsSeriesConfig } from '../models/seriesType/config';
|
|
3
|
+
export interface UseItemTooltipReturnValue<T extends ChartSeriesType> {
|
|
4
|
+
identifier: ItemInteractionData<T>;
|
|
5
|
+
color: string;
|
|
6
|
+
label: string | undefined;
|
|
7
|
+
value: ChartsSeriesConfig[T]['valueType'];
|
|
8
|
+
formattedValue: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function useItemTooltip<T extends ChartSeriesType>(): null | UseItemTooltipReturnValue<T>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
6
|
+
import { useSeries } from "../hooks/useSeries.js";
|
|
7
|
+
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
8
|
+
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
9
|
+
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
10
|
+
import { getLabel } from "../internals/getLabel.js";
|
|
11
|
+
export function useItemTooltip() {
|
|
12
|
+
const {
|
|
13
|
+
item
|
|
14
|
+
} = React.useContext(InteractionContext);
|
|
15
|
+
const series = useSeries();
|
|
16
|
+
const {
|
|
17
|
+
xAxis,
|
|
18
|
+
yAxis,
|
|
19
|
+
xAxisIds,
|
|
20
|
+
yAxisIds
|
|
21
|
+
} = useCartesianContext();
|
|
22
|
+
const {
|
|
23
|
+
zAxis,
|
|
24
|
+
zAxisIds
|
|
25
|
+
} = React.useContext(ZAxisContext);
|
|
26
|
+
const colorProcessors = useColorProcessor();
|
|
27
|
+
const xAxisId = series.xAxisId ?? series.xAxisKey ?? xAxisIds[0];
|
|
28
|
+
const yAxisId = series.yAxisId ?? series.yAxisKey ?? yAxisIds[0];
|
|
29
|
+
const zAxisId = series.zAxisId ?? series.zAxisKey ?? zAxisIds[0];
|
|
30
|
+
if (!item || item.dataIndex === undefined) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const itemSeries = series[item.type].series[item.seriesId];
|
|
34
|
+
const getColor = colorProcessors[itemSeries.type]?.(itemSeries, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
35
|
+
if (itemSeries.type === 'pie') {
|
|
36
|
+
const point = itemSeries.data[item.dataIndex];
|
|
37
|
+
const label = getLabel(point.label, 'tooltip');
|
|
38
|
+
const value = _extends({}, point, {
|
|
39
|
+
label
|
|
40
|
+
});
|
|
41
|
+
const formattedValue = itemSeries.valueFormatter?.(value, {
|
|
42
|
+
dataIndex: item.dataIndex
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
identifier: item,
|
|
46
|
+
color: getColor(item.dataIndex),
|
|
47
|
+
label,
|
|
48
|
+
value,
|
|
49
|
+
formattedValue
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const label = getLabel(itemSeries.label, 'tooltip');
|
|
53
|
+
const value = itemSeries.data[item.dataIndex];
|
|
54
|
+
const formattedValue = itemSeries.valueFormatter?.(value, {
|
|
55
|
+
dataIndex: item.dataIndex
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
identifier: item,
|
|
59
|
+
color: getColor(item.dataIndex),
|
|
60
|
+
label,
|
|
61
|
+
value,
|
|
62
|
+
formattedValue
|
|
63
|
+
};
|
|
64
|
+
}
|
package/ChartsTooltip/utils.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export declare function generateVirtualElement(mousePosition: MousePosition | nu
|
|
|
19
19
|
toJSON: () => string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type UseMouseTrackerReturnValue = null | MousePosition;
|
|
23
|
+
export declare function useMouseTracker(): UseMouseTrackerReturnValue;
|
|
23
24
|
export type TriggerOptions = 'item' | 'axis' | 'none';
|
|
24
25
|
export declare function getTooltipHasData(trigger: TriggerOptions, displayedData: null | AxisInteractionData | ItemInteractionData<ChartSeriesType>): boolean;
|
|
25
26
|
export declare function utcFormatter(v: string | number | Date): string;
|
package/Gauge/Gauge.js
CHANGED
package/Gauge/GaugeContainer.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["width", "height", "margin", "title", "desc", "value", "valueMin", "valueMax", "startAngle", "endAngle", "outerRadius", "innerRadius", "cornerRadius", "cx", "cy", "children"];
|
package/Gauge/GaugeValueArc.js
CHANGED
package/Gauge/GaugeValueText.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
@@ -42,29 +44,19 @@ function AnimatedLine(props) {
|
|
|
42
44
|
ownerState
|
|
43
45
|
} = props,
|
|
44
46
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
45
|
-
const
|
|
46
|
-
left,
|
|
47
|
-
top,
|
|
48
|
-
bottom,
|
|
49
|
-
width,
|
|
50
|
-
height,
|
|
51
|
-
right
|
|
52
|
-
} = useDrawingArea();
|
|
47
|
+
const drawingArea = useDrawingArea();
|
|
53
48
|
const chartId = useChartId();
|
|
54
49
|
const stringInterpolator = useStringInterpolator(d);
|
|
55
|
-
const transitionAppear = useTransition([
|
|
56
|
-
from: {
|
|
57
|
-
animatedWidth: left
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
animatedWidth: width + left + right
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
animatedWidth: width + left + right
|
|
64
|
-
},
|
|
65
|
-
leave: {
|
|
66
|
-
animatedWidth: left
|
|
67
|
-
},
|
|
50
|
+
const transitionAppear = useTransition([drawingArea], {
|
|
51
|
+
from: v => ({
|
|
52
|
+
animatedWidth: v.left
|
|
53
|
+
}),
|
|
54
|
+
enter: v => ({
|
|
55
|
+
animatedWidth: v.width + v.left + v.right
|
|
56
|
+
}),
|
|
57
|
+
leave: v => ({
|
|
58
|
+
animatedWidth: v.width + v.left + v.right
|
|
59
|
+
}),
|
|
68
60
|
reset: false,
|
|
69
61
|
immediate: skipAnimation
|
|
70
62
|
});
|
|
@@ -89,7 +81,7 @@ function AnimatedLine(props) {
|
|
|
89
81
|
x: 0,
|
|
90
82
|
y: 0,
|
|
91
83
|
width: style.animatedWidth,
|
|
92
|
-
height: top + height + bottom
|
|
84
|
+
height: drawingArea.top + drawingArea.height + drawingArea.bottom
|
|
93
85
|
}))
|
|
94
86
|
}), /*#__PURE__*/_jsx("g", {
|
|
95
87
|
clipPath: `url(#${clipId})`,
|
package/LineChart/AreaElement.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
|