@mui/x-charts 8.0.0-beta.2 → 8.0.0-beta.3
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 +38 -8
- package/BarChart/AnimatedBarElement.js +5 -5
- package/BarChart/BarChart.js +2 -0
- package/BarChart/BarClipPath.d.ts +19 -1
- package/BarChart/BarClipPath.js +84 -17
- package/BarChart/BarElement.d.ts +9 -20
- package/BarChart/BarElement.js +29 -26
- package/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/BarChart/BarLabel/BarLabel.js +32 -5
- package/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/BarChart/BarPlot.js +37 -61
- package/BarChart/barElementClasses.d.ts +21 -0
- package/BarChart/barElementClasses.js +29 -0
- package/BarChart/getRadius.d.ts +1 -1
- package/BarChart/index.d.ts +2 -1
- package/BarChart/index.js +11 -0
- package/BarChart/seriesConfig/index.js +3 -1
- package/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/BarChart/seriesConfig/tooltip.js +14 -1
- package/BarChart/types.d.ts +2 -2
- package/CHANGELOG.md +141 -0
- package/ChartContainer/ChartContainer.js +4 -0
- package/ChartsLabel/ChartsLabelMark.js +0 -4
- package/ChartsLabel/index.d.ts +1 -0
- package/ChartsLabel/index.js +7 -0
- package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +3 -8
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/ChartsTooltip/ChartsTooltipTable.js +24 -9
- package/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +12 -0
- package/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/ChartsTooltip/useAxesTooltip.js +18 -0
- package/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/ChartsTooltip/useAxisTooltip.js +71 -37
- package/ChartsTooltip/useItemTooltip.js +4 -1
- package/ChartsXAxis/ChartsXAxis.js +5 -2
- package/ChartsYAxis/ChartsYAxis.js +69 -17
- package/LineChart/AnimatedArea.js +5 -22
- package/LineChart/AnimatedLine.d.ts +1 -4
- package/LineChart/AnimatedLine.js +10 -25
- package/LineChart/AppearingMask.d.ts +5 -0
- package/LineChart/AppearingMask.js +25 -18
- package/LineChart/CircleMarkElement.js +16 -22
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +2 -3
- package/LineChart/MarkElement.js +16 -27
- package/LineChart/MarkPlot.js +0 -1
- package/LineChart/markElementClasses.d.ts +3 -0
- package/LineChart/markElementClasses.js +4 -3
- package/LineChart/seriesConfig/index.js +3 -1
- package/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/LineChart/seriesConfig/tooltip.js +8 -1
- package/PieChart/PieArc.d.ts +19 -11
- package/PieChart/PieArc.js +37 -24
- package/PieChart/PieArcLabel.d.ts +22 -13
- package/PieChart/PieArcLabel.js +52 -48
- package/PieChart/PieArcLabelPlot.js +16 -34
- package/PieChart/PieArcPlot.js +21 -34
- package/PieChart/seriesConfig/tooltip.js +3 -0
- package/ScatterChart/ScatterChart.js +2 -0
- package/SparkLineChart/SparkLineChart.js +2 -0
- package/colorPalettes/colorPalettes.js +2 -2
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/context/AnimationProvider/AnimationProvider.js +4 -6
- package/esm/BarChart/AnimatedBarElement.d.ts +38 -8
- package/esm/BarChart/AnimatedBarElement.js +5 -5
- package/esm/BarChart/BarChart.js +2 -0
- package/esm/BarChart/BarClipPath.d.ts +19 -1
- package/esm/BarChart/BarClipPath.js +84 -17
- package/esm/BarChart/BarElement.d.ts +9 -20
- package/esm/BarChart/BarElement.js +28 -23
- package/esm/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/esm/BarChart/BarLabel/BarLabel.js +32 -5
- package/esm/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/esm/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/esm/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/esm/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/esm/BarChart/BarPlot.js +37 -61
- package/esm/BarChart/barElementClasses.d.ts +21 -0
- package/esm/BarChart/barElementClasses.js +19 -0
- package/esm/BarChart/getRadius.d.ts +1 -1
- package/esm/BarChart/index.d.ts +2 -1
- package/esm/BarChart/index.js +2 -1
- package/esm/BarChart/seriesConfig/index.js +2 -1
- package/esm/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/esm/BarChart/seriesConfig/tooltip.js +12 -0
- package/esm/BarChart/types.d.ts +2 -2
- package/esm/ChartContainer/ChartContainer.js +4 -0
- package/esm/ChartsLabel/ChartsLabelMark.js +0 -4
- package/esm/ChartsLabel/index.d.ts +1 -0
- package/esm/ChartsLabel/index.js +1 -0
- package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -9
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +23 -9
- package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/esm/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/esm/ChartsTooltip/index.d.ts +1 -0
- package/esm/ChartsTooltip/index.js +1 -0
- package/esm/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/esm/ChartsTooltip/useAxesTooltip.js +12 -0
- package/esm/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/esm/ChartsTooltip/useAxisTooltip.js +72 -38
- package/esm/ChartsTooltip/useItemTooltip.js +4 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +5 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +69 -17
- package/esm/LineChart/AnimatedArea.js +5 -22
- package/esm/LineChart/AnimatedLine.d.ts +1 -4
- package/esm/LineChart/AnimatedLine.js +9 -24
- package/esm/LineChart/AppearingMask.d.ts +5 -0
- package/esm/LineChart/AppearingMask.js +23 -18
- package/esm/LineChart/CircleMarkElement.js +19 -25
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/LineHighlightPlot.js +3 -4
- package/esm/LineChart/MarkElement.js +17 -28
- package/esm/LineChart/MarkPlot.js +0 -1
- package/esm/LineChart/markElementClasses.d.ts +3 -0
- package/esm/LineChart/markElementClasses.js +4 -3
- package/esm/LineChart/seriesConfig/index.js +2 -1
- package/esm/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/esm/LineChart/seriesConfig/tooltip.js +6 -0
- package/esm/PieChart/PieArc.d.ts +19 -11
- package/esm/PieChart/PieArc.js +36 -23
- package/esm/PieChart/PieArcLabel.d.ts +22 -13
- package/esm/PieChart/PieArcLabel.js +51 -47
- package/esm/PieChart/PieArcLabelPlot.js +16 -34
- package/esm/PieChart/PieArcPlot.js +21 -34
- package/esm/PieChart/seriesConfig/tooltip.js +3 -0
- package/esm/ScatterChart/ScatterChart.js +2 -0
- package/esm/SparkLineChart/SparkLineChart.js +2 -0
- package/esm/colorPalettes/colorPalettes.js +2 -2
- package/esm/constants/index.d.ts +1 -1
- package/esm/constants/index.js +1 -1
- package/esm/context/AnimationProvider/AnimationProvider.js +3 -6
- package/esm/hooks/animation/index.d.ts +6 -0
- package/esm/hooks/animation/index.js +6 -0
- package/esm/hooks/animation/useAnimateArea.d.ts +15 -0
- package/esm/hooks/animation/useAnimateArea.js +27 -0
- package/esm/hooks/animation/useAnimateBar.d.ts +17 -0
- package/esm/hooks/animation/useAnimateBar.js +56 -0
- package/esm/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/esm/hooks/animation/useAnimateBarLabel.js +59 -0
- package/esm/hooks/animation/useAnimateLine.d.ts +14 -0
- package/esm/hooks/animation/useAnimateLine.js +26 -0
- package/esm/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/esm/hooks/animation/useAnimatePieArc.js +70 -0
- package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/esm/hooks/animation/useAnimatePieArcLabel.js +72 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useInteractionItemProps.js +11 -0
- package/esm/index.js +1 -1
- package/esm/internals/animation/Transition.d.ts +37 -0
- package/esm/internals/animation/Transition.js +83 -0
- package/esm/internals/animation/animation.d.ts +4 -0
- package/esm/internals/animation/animation.js +4 -0
- package/esm/internals/animation/useAnimate.d.ts +19 -0
- package/esm/internals/animation/useAnimate.js +74 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/esm/internals/shallowEqual.d.ts +8 -0
- package/esm/internals/shallowEqual.js +31 -0
- package/esm/models/axis.d.ts +8 -0
- package/esm/themeAugmentation/overrides.d.ts +1 -1
- package/hooks/animation/index.d.ts +6 -0
- package/hooks/animation/index.js +71 -0
- package/hooks/animation/useAnimateArea.d.ts +15 -0
- package/hooks/animation/useAnimateArea.js +34 -0
- package/hooks/animation/useAnimateBar.d.ts +17 -0
- package/hooks/animation/useAnimateBar.js +62 -0
- package/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/hooks/animation/useAnimateBarLabel.js +65 -0
- package/hooks/animation/useAnimateLine.d.ts +14 -0
- package/hooks/animation/useAnimateLine.js +33 -0
- package/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/hooks/animation/useAnimatePieArc.js +77 -0
- package/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/hooks/animation/useAnimatePieArcLabel.js +79 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +13 -1
- package/hooks/useInteractionItemProps.js +11 -0
- package/index.js +1 -1
- package/internals/animation/Transition.d.ts +37 -0
- package/internals/animation/Transition.js +89 -0
- package/internals/animation/animation.d.ts +4 -0
- package/internals/animation/animation.js +11 -0
- package/internals/animation/useAnimate.d.ts +19 -0
- package/internals/animation/useAnimate.js +80 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +28 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +61 -27
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/internals/shallowEqual.d.ts +8 -0
- package/internals/shallowEqual.js +37 -0
- package/models/axis.d.ts +8 -0
- package/modern/BarChart/AnimatedBarElement.d.ts +38 -8
- package/modern/BarChart/AnimatedBarElement.js +5 -5
- package/modern/BarChart/BarChart.js +2 -0
- package/modern/BarChart/BarClipPath.d.ts +19 -1
- package/modern/BarChart/BarClipPath.js +84 -17
- package/modern/BarChart/BarElement.d.ts +9 -20
- package/modern/BarChart/BarElement.js +28 -23
- package/modern/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/modern/BarChart/BarLabel/BarLabel.js +32 -5
- package/modern/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/modern/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/modern/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/modern/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/modern/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/modern/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/modern/BarChart/BarPlot.js +37 -61
- package/modern/BarChart/barElementClasses.d.ts +21 -0
- package/modern/BarChart/barElementClasses.js +19 -0
- package/modern/BarChart/getRadius.d.ts +1 -1
- package/modern/BarChart/index.d.ts +2 -1
- package/modern/BarChart/index.js +2 -1
- package/modern/BarChart/seriesConfig/index.js +2 -1
- package/modern/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/modern/BarChart/seriesConfig/tooltip.js +12 -0
- package/modern/BarChart/types.d.ts +2 -2
- package/modern/ChartContainer/ChartContainer.js +4 -0
- package/modern/ChartsLabel/ChartsLabelMark.js +0 -4
- package/modern/ChartsLabel/index.d.ts +1 -0
- package/modern/ChartsLabel/index.js +1 -0
- package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +4 -9
- package/modern/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +23 -9
- package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/modern/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/modern/ChartsTooltip/index.d.ts +1 -0
- package/modern/ChartsTooltip/index.js +1 -0
- package/modern/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/modern/ChartsTooltip/useAxesTooltip.js +12 -0
- package/modern/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +72 -38
- package/modern/ChartsTooltip/useItemTooltip.js +4 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +5 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +69 -17
- package/modern/LineChart/AnimatedArea.js +5 -22
- package/modern/LineChart/AnimatedLine.d.ts +1 -4
- package/modern/LineChart/AnimatedLine.js +9 -24
- package/modern/LineChart/AppearingMask.d.ts +5 -0
- package/modern/LineChart/AppearingMask.js +23 -18
- package/modern/LineChart/CircleMarkElement.js +19 -25
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +3 -4
- package/modern/LineChart/MarkElement.js +17 -28
- package/modern/LineChart/MarkPlot.js +0 -1
- package/modern/LineChart/markElementClasses.d.ts +3 -0
- package/modern/LineChart/markElementClasses.js +4 -3
- package/modern/LineChart/seriesConfig/index.js +2 -1
- package/modern/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/modern/LineChart/seriesConfig/tooltip.js +6 -0
- package/modern/PieChart/PieArc.d.ts +19 -11
- package/modern/PieChart/PieArc.js +36 -23
- package/modern/PieChart/PieArcLabel.d.ts +22 -13
- package/modern/PieChart/PieArcLabel.js +51 -47
- package/modern/PieChart/PieArcLabelPlot.js +16 -34
- package/modern/PieChart/PieArcPlot.js +21 -34
- package/modern/PieChart/seriesConfig/tooltip.js +3 -0
- package/modern/ScatterChart/ScatterChart.js +2 -0
- package/modern/SparkLineChart/SparkLineChart.js +2 -0
- package/modern/colorPalettes/colorPalettes.js +2 -2
- package/modern/constants/index.d.ts +1 -1
- package/modern/constants/index.js +1 -1
- package/modern/context/AnimationProvider/AnimationProvider.js +3 -6
- package/modern/hooks/animation/index.d.ts +6 -0
- package/modern/hooks/animation/index.js +6 -0
- package/modern/hooks/animation/useAnimateArea.d.ts +15 -0
- package/modern/hooks/animation/useAnimateArea.js +27 -0
- package/modern/hooks/animation/useAnimateBar.d.ts +17 -0
- package/modern/hooks/animation/useAnimateBar.js +56 -0
- package/modern/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/modern/hooks/animation/useAnimateBarLabel.js +59 -0
- package/modern/hooks/animation/useAnimateLine.d.ts +14 -0
- package/modern/hooks/animation/useAnimateLine.js +26 -0
- package/modern/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/modern/hooks/animation/useAnimatePieArc.js +70 -0
- package/modern/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/modern/hooks/animation/useAnimatePieArcLabel.js +72 -0
- package/modern/hooks/index.d.ts +2 -1
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/useInteractionItemProps.js +11 -0
- package/modern/index.js +1 -1
- package/modern/internals/animation/Transition.d.ts +37 -0
- package/modern/internals/animation/Transition.js +83 -0
- package/modern/internals/animation/animation.d.ts +4 -0
- package/modern/internals/animation/animation.js +4 -0
- package/modern/internals/animation/useAnimate.d.ts +19 -0
- package/modern/internals/animation/useAnimate.js +74 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
- package/modern/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/modern/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/modern/internals/shallowEqual.d.ts +8 -0
- package/modern/internals/shallowEqual.js +31 -0
- package/modern/models/axis.d.ts +8 -0
- package/modern/themeAugmentation/overrides.d.ts +1 -1
- package/package.json +8 -9
- package/themeAugmentation/overrides.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/PieChart/dataTransform/transition.d.ts +0 -4
- package/PieChart/dataTransform/transition.js +0 -145
- package/esm/PieChart/dataTransform/transition.d.ts +0 -4
- package/esm/PieChart/dataTransform/transition.js +0 -137
- package/modern/PieChart/dataTransform/transition.d.ts +0 -4
- package/modern/PieChart/dataTransform/transition.js +0 -137
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseAxisTooltipParams, UseAxisTooltipReturnValue } from "./useAxisTooltip.js";
|
|
2
|
+
type UseAxesTooltipParams = Omit<UseAxisTooltipParams, 'multipleAxes'>;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the axes to display in the tooltip and the series item related to them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAxesTooltip(params?: UseAxesTooltipParams): UseAxisTooltipReturnValue[] | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useAxesTooltip = useAxesTooltip;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _useAxisTooltip = require("./useAxisTooltip");
|
|
11
|
+
/**
|
|
12
|
+
* Returns the axes to display in the tooltip and the series item related to them.
|
|
13
|
+
*/
|
|
14
|
+
function useAxesTooltip(params) {
|
|
15
|
+
return (0, _useAxisTooltip.useAxisTooltip)((0, _extends2.default)({}, params, {
|
|
16
|
+
multipleAxes: true
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { SeriesId } from "../models/seriesType/common.js";
|
|
2
|
+
import { AxisId } from "../models/axis.js";
|
|
2
3
|
import { CartesianChartSeriesType, ChartsSeriesConfig } from "../models/seriesType/config.js";
|
|
3
4
|
import { ChartsLabelMarkProps } from "../ChartsLabel/index.js";
|
|
4
5
|
export interface UseAxisTooltipReturnValue<SeriesT extends CartesianChartSeriesType = CartesianChartSeriesType, AxisValueT extends string | number | Date = string | number | Date> {
|
|
5
6
|
axisDirection: 'x' | 'y';
|
|
6
|
-
|
|
7
|
-
seriesItems: SeriesItem<SeriesT>[];
|
|
7
|
+
axisId: AxisId;
|
|
8
8
|
axisValue: AxisValueT;
|
|
9
9
|
axisFormattedValue: string;
|
|
10
|
+
dataIndex: number;
|
|
11
|
+
seriesItems: SeriesItem<SeriesT>[];
|
|
12
|
+
}
|
|
13
|
+
export interface UseAxisTooltipParams {
|
|
14
|
+
/**
|
|
15
|
+
* If `true`, the hook returns an array with an object per active axis.
|
|
16
|
+
*/
|
|
17
|
+
multipleAxes?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The axis directions to consider.
|
|
20
|
+
* If not defined, all directions are considered
|
|
21
|
+
*/
|
|
22
|
+
directions?: ('x' | 'y')[];
|
|
10
23
|
}
|
|
11
24
|
interface SeriesItem<T extends CartesianChartSeriesType> {
|
|
12
25
|
seriesId: SeriesId;
|
|
@@ -16,5 +29,13 @@ interface SeriesItem<T extends CartesianChartSeriesType> {
|
|
|
16
29
|
formattedLabel: string | null;
|
|
17
30
|
markType: ChartsLabelMarkProps['type'];
|
|
18
31
|
}
|
|
19
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `useAxesTooltip` instead.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useAxisTooltip(params: UseAxisTooltipParams & {
|
|
36
|
+
multipleAxes: true;
|
|
37
|
+
}): UseAxisTooltipReturnValue[] | null;
|
|
38
|
+
export declare function useAxisTooltip(params?: UseAxisTooltipParams & {
|
|
39
|
+
multipleAxes?: false;
|
|
40
|
+
}): UseAxisTooltipReturnValue | null;
|
|
20
41
|
export {};
|
|
@@ -15,12 +15,37 @@ var _utils = require("./utils");
|
|
|
15
15
|
var _useAxis = require("../hooks/useAxis");
|
|
16
16
|
var _useZAxis = require("../hooks/useZAxis");
|
|
17
17
|
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
18
|
-
function
|
|
18
|
+
function defaultAxisTooltipConfig(axis, dataIndex, axisDirection) {
|
|
19
|
+
const axisValue = axis.data?.[dataIndex] ?? null;
|
|
20
|
+
const axisFormatter = axis.valueFormatter ?? (v => axis.scaleType === 'utc' ? (0, _utils.utcFormatter)(v) : v.toLocaleString());
|
|
21
|
+
const axisFormattedValue = axisFormatter(axisValue, {
|
|
22
|
+
location: 'tooltip',
|
|
23
|
+
scale: axis.scale
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
axisDirection,
|
|
27
|
+
axisId: axis.id,
|
|
28
|
+
dataIndex,
|
|
29
|
+
axisValue,
|
|
30
|
+
axisFormattedValue,
|
|
31
|
+
seriesItems: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use `useAxesTooltip` instead.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
function useAxisTooltip(params = {}) {
|
|
40
|
+
const {
|
|
41
|
+
multipleAxes,
|
|
42
|
+
directions
|
|
43
|
+
} = params;
|
|
19
44
|
const defaultXAxis = (0, _useAxis.useXAxis)();
|
|
20
45
|
const defaultYAxis = (0, _useAxis.useYAxis)();
|
|
21
|
-
const xAxisHasData = defaultXAxis.data !== undefined && defaultXAxis.data.length !== 0;
|
|
22
46
|
const store = (0, _useStore.useStore)();
|
|
23
|
-
const
|
|
47
|
+
const tooltipXAxes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionTooltipXAxes);
|
|
48
|
+
const tooltipYAxes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsInteractionTooltipYAxes);
|
|
24
49
|
const series = (0, _useSeries.useSeries)();
|
|
25
50
|
const {
|
|
26
51
|
xAxis
|
|
@@ -33,61 +58,70 @@ function useAxisTooltip() {
|
|
|
33
58
|
zAxisIds
|
|
34
59
|
} = (0, _useZAxis.useZAxes)();
|
|
35
60
|
const colorProcessors = (0, _useColorProcessor.useColorProcessor)();
|
|
36
|
-
if (
|
|
61
|
+
if (tooltipXAxes.length === 0 && tooltipYAxes.length === 0) {
|
|
37
62
|
return null;
|
|
38
63
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
const tooltipAxes = [];
|
|
65
|
+
if (directions === undefined || directions.includes('x')) {
|
|
66
|
+
tooltipXAxes.forEach(({
|
|
67
|
+
axisId,
|
|
68
|
+
dataIndex
|
|
69
|
+
}) => {
|
|
70
|
+
if (!multipleAxes && tooltipAxes.length > 1) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
tooltipAxes.push(defaultAxisTooltipConfig(xAxis[axisId], dataIndex, 'x'));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (directions === undefined || directions.includes('y')) {
|
|
77
|
+
tooltipYAxes.forEach(({
|
|
78
|
+
axisId,
|
|
79
|
+
dataIndex
|
|
80
|
+
}) => {
|
|
81
|
+
if (!multipleAxes && tooltipAxes.length > 1) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
tooltipAxes.push(defaultAxisTooltipConfig(yAxis[axisId], dataIndex, 'y'));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
Object.keys(series).filter(_isCartesian.isCartesianSeriesType).flatMap(seriesType => {
|
|
46
88
|
const seriesOfType = series[seriesType];
|
|
47
89
|
if (!seriesOfType) {
|
|
48
90
|
return [];
|
|
49
91
|
}
|
|
50
|
-
return seriesOfType.seriesOrder.
|
|
92
|
+
return seriesOfType.seriesOrder.forEach(seriesId => {
|
|
51
93
|
const seriesToAdd = seriesOfType.series[seriesId];
|
|
52
|
-
const providedXAxisId = seriesToAdd.xAxisId;
|
|
53
|
-
const providedYAxisId = seriesToAdd.yAxisId;
|
|
54
|
-
const
|
|
55
|
-
|
|
94
|
+
const providedXAxisId = seriesToAdd.xAxisId ?? defaultXAxis.id;
|
|
95
|
+
const providedYAxisId = seriesToAdd.yAxisId ?? defaultYAxis.id;
|
|
96
|
+
const tooltipItemIndex = tooltipAxes.findIndex(({
|
|
97
|
+
axisDirection,
|
|
98
|
+
axisId
|
|
99
|
+
}) => axisDirection === 'x' && axisId === providedXAxisId || axisDirection === 'y' && axisId === providedYAxisId);
|
|
56
100
|
// Test if the series uses the default axis
|
|
57
|
-
if (
|
|
58
|
-
const xAxisId = providedXAxisId ?? defaultXAxis.id;
|
|
59
|
-
const yAxisId = providedYAxisId ?? defaultYAxis.id;
|
|
101
|
+
if (tooltipItemIndex >= 0) {
|
|
60
102
|
const zAxisId = 'zAxisId' in seriesToAdd ? seriesToAdd.zAxisId : zAxisIds[0];
|
|
61
|
-
const
|
|
103
|
+
const {
|
|
104
|
+
dataIndex
|
|
105
|
+
} = tooltipAxes[tooltipItemIndex];
|
|
106
|
+
const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[providedXAxisId], yAxis[providedYAxisId], zAxisId ? zAxis[zAxisId] : undefined)(dataIndex) ?? '';
|
|
62
107
|
const value = seriesToAdd.data[dataIndex] ?? null;
|
|
63
108
|
const formattedValue = seriesToAdd.valueFormatter(value, {
|
|
64
109
|
dataIndex
|
|
65
110
|
});
|
|
66
111
|
const formattedLabel = (0, _getLabel.getLabel)(seriesToAdd.label, 'tooltip') ?? null;
|
|
67
|
-
|
|
112
|
+
tooltipAxes[tooltipItemIndex].seriesItems.push({
|
|
68
113
|
seriesId,
|
|
69
114
|
color,
|
|
70
115
|
value,
|
|
71
116
|
formattedValue,
|
|
72
117
|
formattedLabel,
|
|
73
118
|
markType: seriesToAdd.labelMarkType
|
|
74
|
-
};
|
|
119
|
+
});
|
|
75
120
|
}
|
|
76
|
-
return undefined;
|
|
77
121
|
});
|
|
78
|
-
}).filter(function truthy(item) {
|
|
79
|
-
return Boolean(item);
|
|
80
|
-
});
|
|
81
|
-
const axisFormatter = usedAxis.valueFormatter ?? (v => usedAxis.scaleType === 'utc' ? (0, _utils.utcFormatter)(v) : v.toLocaleString());
|
|
82
|
-
const axisFormattedValue = axisFormatter(axisValue, {
|
|
83
|
-
location: 'tooltip',
|
|
84
|
-
scale: usedAxis.scale
|
|
85
122
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
axisValue,
|
|
91
|
-
axisFormattedValue
|
|
92
|
-
};
|
|
123
|
+
if (!multipleAxes) {
|
|
124
|
+
return tooltipAxes.length === 0 ? tooltipAxes[0] : null;
|
|
125
|
+
}
|
|
126
|
+
return tooltipAxes;
|
|
93
127
|
}
|
|
@@ -35,7 +35,10 @@ function useItemTooltip() {
|
|
|
35
35
|
if (!identifier || identifier.dataIndex === undefined) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
const itemSeries = series[identifier.type]
|
|
38
|
+
const itemSeries = series[identifier.type]?.series[identifier.seriesId];
|
|
39
|
+
if (!itemSeries) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
39
42
|
const getColor = seriesConfig[itemSeries.type].colorProcessor?.(itemSeries, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
40
43
|
return seriesConfig[itemSeries.type].tooltipGetter({
|
|
41
44
|
series: itemSeries,
|
|
@@ -118,7 +118,7 @@ function getVisibleLabels(xTicks, {
|
|
|
118
118
|
return true;
|
|
119
119
|
}));
|
|
120
120
|
}
|
|
121
|
-
function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
|
|
121
|
+
function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelStyle) {
|
|
122
122
|
const shortenedLabels = new Map();
|
|
123
123
|
const angle = (0, _clampAngle.clampAngle)(tickLabelStyle?.angle ?? 0);
|
|
124
124
|
|
|
@@ -139,6 +139,9 @@ function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
|
|
|
139
139
|
if (angle > 90 && angle < 270) {
|
|
140
140
|
[leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
|
|
141
141
|
}
|
|
142
|
+
if (isRtl) {
|
|
143
|
+
[leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
|
|
144
|
+
}
|
|
142
145
|
for (const item of visibleLabels) {
|
|
143
146
|
if (item.formattedValue) {
|
|
144
147
|
// That maximum width of the tick depends on its proximity to the axis bounds.
|
|
@@ -300,7 +303,7 @@ function ChartsXAxis(inProps) {
|
|
|
300
303
|
|
|
301
304
|
/* If there's an axis title, the tick labels have less space to render */
|
|
302
305
|
const tickLabelsMaxHeight = Math.max(0, axisHeight - (label ? labelHeight + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
303
|
-
const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
|
|
306
|
+
const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
|
|
304
307
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(XAxisRoot, {
|
|
305
308
|
transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
|
|
306
309
|
className: classes.root,
|
|
@@ -15,6 +15,9 @@ var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
|
15
15
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
16
|
var _styles = require("@mui/material/styles");
|
|
17
17
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
18
|
+
var _useIsHydrated = require("../hooks/useIsHydrated");
|
|
19
|
+
var _defaultTextPlacement = require("../ChartsText/defaultTextPlacement");
|
|
20
|
+
var _ellipsize = require("../internals/ellipsize");
|
|
18
21
|
var _domUtils = require("../internals/domUtils");
|
|
19
22
|
var _useTicks = require("../hooks/useTicks");
|
|
20
23
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
@@ -25,6 +28,8 @@ var _isInfinity = require("../internals/isInfinity");
|
|
|
25
28
|
var _isBandScale = require("../internals/isBandScale");
|
|
26
29
|
var _ChartProvider = require("../context/ChartProvider");
|
|
27
30
|
var _hooks = require("../hooks");
|
|
31
|
+
var _clampAngle = require("../internals/clampAngle");
|
|
32
|
+
var _invertTextAnchor = require("../internals/invertTextAnchor");
|
|
28
33
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
34
|
const _excluded = ["scale", "tickNumber"];
|
|
30
35
|
const useUtilityClasses = ownerState => {
|
|
@@ -42,6 +47,47 @@ const useUtilityClasses = ownerState => {
|
|
|
42
47
|
};
|
|
43
48
|
return (0, _composeClasses.default)(slots, _axisClasses.getAxisUtilityClass, classes);
|
|
44
49
|
};
|
|
50
|
+
|
|
51
|
+
/* Gap between a tick and its label. */
|
|
52
|
+
const TICK_LABEL_GAP = 2;
|
|
53
|
+
/* Gap between the axis label and tick labels. */
|
|
54
|
+
const AXIS_LABEL_TICK_LABEL_GAP = 2;
|
|
55
|
+
function shortenLabels(visibleLabels, drawingArea, maxWidth, isRtl, tickLabelStyle) {
|
|
56
|
+
const shortenedLabels = new Map();
|
|
57
|
+
const angle = (0, _clampAngle.clampAngle)(tickLabelStyle?.angle ?? 0);
|
|
58
|
+
let topBoundFactor = 1;
|
|
59
|
+
let bottomBoundFactor = 1;
|
|
60
|
+
if (tickLabelStyle?.textAnchor === 'start') {
|
|
61
|
+
topBoundFactor = Infinity;
|
|
62
|
+
bottomBoundFactor = 1;
|
|
63
|
+
} else if (tickLabelStyle?.textAnchor === 'end') {
|
|
64
|
+
topBoundFactor = 1;
|
|
65
|
+
bottomBoundFactor = Infinity;
|
|
66
|
+
} else {
|
|
67
|
+
topBoundFactor = 2;
|
|
68
|
+
bottomBoundFactor = 2;
|
|
69
|
+
}
|
|
70
|
+
if (angle > 180) {
|
|
71
|
+
[topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
|
|
72
|
+
}
|
|
73
|
+
if (isRtl) {
|
|
74
|
+
[topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
|
|
75
|
+
}
|
|
76
|
+
for (const item of visibleLabels) {
|
|
77
|
+
if (item.formattedValue) {
|
|
78
|
+
// That maximum height of the tick depends on its proximity to the axis bounds.
|
|
79
|
+
const height = Math.min((item.offset + item.labelOffset) * topBoundFactor, (drawingArea.top + drawingArea.height + drawingArea.bottom - item.offset - item.labelOffset) * bottomBoundFactor);
|
|
80
|
+
const doesTextFit = text => (0, _ellipsize.doesTextFitInRect)(text, {
|
|
81
|
+
width: maxWidth,
|
|
82
|
+
height,
|
|
83
|
+
angle,
|
|
84
|
+
measureText: string => (0, _domUtils.getStringSize)(string, tickLabelStyle)
|
|
85
|
+
});
|
|
86
|
+
shortenedLabels.set(item, (0, _ellipsize.ellipsize)(item.formattedValue.toString(), doesTextFit));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return shortenedLabels;
|
|
90
|
+
}
|
|
45
91
|
const YAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
|
|
46
92
|
name: 'MuiChartsYAxis',
|
|
47
93
|
slot: 'Root',
|
|
@@ -99,16 +145,18 @@ function ChartsYAxis(inProps) {
|
|
|
99
145
|
} = defaultizedProps;
|
|
100
146
|
const theme = (0, _styles.useTheme)();
|
|
101
147
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
148
|
+
const isHydrated = (0, _useIsHydrated.useIsHydrated)();
|
|
102
149
|
const classes = useUtilityClasses(defaultizedProps);
|
|
103
150
|
const {
|
|
104
151
|
instance
|
|
105
152
|
} = (0, _ChartProvider.useChartContext)();
|
|
153
|
+
const drawingArea = (0, _useDrawingArea.useDrawingArea)();
|
|
106
154
|
const {
|
|
107
155
|
left,
|
|
108
156
|
top,
|
|
109
157
|
width,
|
|
110
158
|
height
|
|
111
|
-
} =
|
|
159
|
+
} = drawingArea;
|
|
112
160
|
const tickSize = disableTicks ? 4 : tickSizeProp;
|
|
113
161
|
const yTicks = (0, _useTicks.useTicks)({
|
|
114
162
|
scale: yScale,
|
|
@@ -124,15 +172,16 @@ function ChartsYAxis(inProps) {
|
|
|
124
172
|
const Tick = slots?.axisTick ?? 'line';
|
|
125
173
|
const TickLabel = slots?.axisTickLabel ?? _ChartsText.ChartsText;
|
|
126
174
|
const Label = slots?.axisLabel ?? _ChartsText.ChartsText;
|
|
127
|
-
const
|
|
175
|
+
const defaultTextAnchor = (0, _defaultTextPlacement.getDefaultTextAnchor)((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
|
|
176
|
+
const defaultDominantBaseline = (0, _defaultTextPlacement.getDefaultBaseline)((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
|
|
128
177
|
const axisTickLabelProps = (0, _useSlotProps.default)({
|
|
129
178
|
elementType: TickLabel,
|
|
130
179
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
131
180
|
additionalProps: {
|
|
132
181
|
style: (0, _extends2.default)({}, theme.typography.caption, {
|
|
133
182
|
fontSize: tickFontSize,
|
|
134
|
-
textAnchor:
|
|
135
|
-
dominantBaseline:
|
|
183
|
+
textAnchor: isRtl ? (0, _invertTextAnchor.invertTextAnchor)(defaultTextAnchor) : defaultTextAnchor,
|
|
184
|
+
dominantBaseline: defaultDominantBaseline
|
|
136
185
|
}, tickLabelStyle)
|
|
137
186
|
},
|
|
138
187
|
className: classes.tickLabel,
|
|
@@ -147,7 +196,7 @@ function ChartsYAxis(inProps) {
|
|
|
147
196
|
fontSize: 14,
|
|
148
197
|
angle: positionSign * 90,
|
|
149
198
|
textAnchor: 'middle',
|
|
150
|
-
dominantBaseline: '
|
|
199
|
+
dominantBaseline: 'text-before-edge'
|
|
151
200
|
}, labelStyle)
|
|
152
201
|
},
|
|
153
202
|
ownerState: {}
|
|
@@ -170,11 +219,13 @@ function ChartsYAxis(inProps) {
|
|
|
170
219
|
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity) || position === 'none') {
|
|
171
220
|
return null;
|
|
172
221
|
}
|
|
173
|
-
const labelHeight = label ? (0, _domUtils.getStringSize)(label, axisLabelProps.style).height : 0;
|
|
174
222
|
const labelRefPoint = {
|
|
175
|
-
x: positionSign *
|
|
223
|
+
x: positionSign * axisWidth,
|
|
176
224
|
y: top + height / 2
|
|
177
225
|
};
|
|
226
|
+
/* If there's an axis title, the tick labels have less space to render */
|
|
227
|
+
const tickLabelsMaxWidth = Math.max(0, axisWidth - (label ? (0, _domUtils.getStringSize)(label, axisLabelProps.style).height + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
228
|
+
const tickLabels = isHydrated ? shortenLabels(yTicks, drawingArea, tickLabelsMaxWidth, isRtl, axisTickLabelProps.style) : new Map(Array.from(yTicks).map(item => [item, item.formattedValue]));
|
|
178
229
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(YAxisRoot, {
|
|
179
230
|
transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
|
|
180
231
|
className: classes.root,
|
|
@@ -183,13 +234,13 @@ function ChartsYAxis(inProps) {
|
|
|
183
234
|
y1: top,
|
|
184
235
|
y2: top + height,
|
|
185
236
|
className: classes.line
|
|
186
|
-
}, lineSlotProps)), yTicks.map(({
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const xTickLabel = positionSign * (tickSize +
|
|
237
|
+
}, lineSlotProps)), yTicks.map((item, index) => {
|
|
238
|
+
const {
|
|
239
|
+
offset: tickOffset,
|
|
240
|
+
labelOffset,
|
|
241
|
+
value
|
|
242
|
+
} = item;
|
|
243
|
+
const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
|
|
193
244
|
const yTickLabel = labelOffset;
|
|
194
245
|
const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
|
|
195
246
|
const showLabel = instance.isPointInside({
|
|
@@ -198,6 +249,7 @@ function ChartsYAxis(inProps) {
|
|
|
198
249
|
}, {
|
|
199
250
|
direction: 'y'
|
|
200
251
|
});
|
|
252
|
+
const tickLabel = tickLabels.get(item);
|
|
201
253
|
if (!showLabel) {
|
|
202
254
|
return null;
|
|
203
255
|
}
|
|
@@ -207,13 +259,13 @@ function ChartsYAxis(inProps) {
|
|
|
207
259
|
children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
|
|
208
260
|
x2: positionSign * tickSize,
|
|
209
261
|
className: classes.tick
|
|
210
|
-
}, slotProps?.axisTick)),
|
|
262
|
+
}, slotProps?.axisTick)), tickLabel !== undefined && !skipLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
211
263
|
x: xTickLabel,
|
|
212
264
|
y: yTickLabel,
|
|
213
|
-
text:
|
|
265
|
+
text: tickLabel
|
|
214
266
|
}, axisTickLabelProps))]
|
|
215
267
|
}, index);
|
|
216
|
-
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
268
|
+
}), label && isHydrated && /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
217
269
|
className: classes.label,
|
|
218
270
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, (0, _extends2.default)({}, labelRefPoint, axisLabelProps, {
|
|
219
271
|
text: label
|
|
@@ -11,11 +11,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var
|
|
15
|
-
var _useStringInterpolator = require("../internals/useStringInterpolator");
|
|
14
|
+
var _useAnimateArea = require("../hooks/animation/useAnimateArea");
|
|
16
15
|
var _AppearingMask = require("./AppearingMask");
|
|
17
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["
|
|
17
|
+
const _excluded = ["skipAnimation", "ownerState"];
|
|
19
18
|
/**
|
|
20
19
|
* Demos:
|
|
21
20
|
*
|
|
@@ -28,38 +27,22 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
|
28
27
|
*/
|
|
29
28
|
function AnimatedArea(props) {
|
|
30
29
|
const {
|
|
31
|
-
d,
|
|
32
30
|
skipAnimation,
|
|
33
31
|
ownerState
|
|
34
32
|
} = props,
|
|
35
33
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
36
|
-
const
|
|
37
|
-
const transitionChange = (0, _web.useTransition)([stringInterpolator], {
|
|
38
|
-
from: skipAnimation ? undefined : {
|
|
39
|
-
value: 0
|
|
40
|
-
},
|
|
41
|
-
to: {
|
|
42
|
-
value: 1
|
|
43
|
-
},
|
|
44
|
-
enter: {
|
|
45
|
-
value: 1
|
|
46
|
-
},
|
|
47
|
-
reset: false,
|
|
48
|
-
immediate: skipAnimation
|
|
49
|
-
});
|
|
34
|
+
const animatedProps = (0, _useAnimateArea.useAnimateArea)(props);
|
|
50
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppearingMask.AppearingMask, {
|
|
51
36
|
skipAnimation: skipAnimation,
|
|
52
37
|
id: `${ownerState.id}-area-clip`,
|
|
53
|
-
children:
|
|
54
|
-
// @ts-expect-error
|
|
55
|
-
d: style.value.to(interpolator),
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
56
39
|
fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
57
40
|
filter:
|
|
58
41
|
// eslint-disable-next-line no-nested-ternary
|
|
59
42
|
ownerState.isHighlighted ? 'brightness(140%)' : ownerState.gradientId ? undefined : 'brightness(120%)',
|
|
60
43
|
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
61
44
|
stroke: "none"
|
|
62
|
-
}, other))
|
|
45
|
+
}, other, animatedProps))
|
|
63
46
|
});
|
|
64
47
|
}
|
|
65
48
|
process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
|
|
@@ -19,8 +19,5 @@ export interface AnimatedLineProps extends React.ComponentPropsWithoutRef<'path'
|
|
|
19
19
|
*
|
|
20
20
|
* - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
|
|
21
21
|
*/
|
|
22
|
-
declare
|
|
23
|
-
declare namespace AnimatedLine {
|
|
24
|
-
var propTypes: any;
|
|
25
|
-
}
|
|
22
|
+
declare const AnimatedLine: React.ForwardRefExoticComponent<AnimatedLineProps & React.RefAttributes<SVGPathElement>>;
|
|
26
23
|
export { AnimatedLine };
|
|
@@ -6,16 +6,15 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.AnimatedLine =
|
|
9
|
+
exports.AnimatedLine = void 0;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var
|
|
15
|
-
var _useStringInterpolator = require("../internals/useStringInterpolator");
|
|
14
|
+
var _hooks = require("../hooks");
|
|
16
15
|
var _AppearingMask = require("./AppearingMask");
|
|
17
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["
|
|
17
|
+
const _excluded = ["skipAnimation", "ownerState"];
|
|
19
18
|
/**
|
|
20
19
|
* Demos:
|
|
21
20
|
*
|
|
@@ -26,42 +25,28 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
|
26
25
|
*
|
|
27
26
|
* - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
|
|
28
27
|
*/
|
|
29
|
-
function AnimatedLine(props) {
|
|
28
|
+
const AnimatedLine = exports.AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props, ref) {
|
|
30
29
|
const {
|
|
31
|
-
d,
|
|
32
30
|
skipAnimation,
|
|
33
31
|
ownerState
|
|
34
32
|
} = props,
|
|
35
33
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
value: 0
|
|
40
|
-
},
|
|
41
|
-
to: {
|
|
42
|
-
value: 1
|
|
43
|
-
},
|
|
44
|
-
enter: {
|
|
45
|
-
value: 1
|
|
46
|
-
},
|
|
47
|
-
reset: false,
|
|
48
|
-
immediate: skipAnimation
|
|
49
|
-
});
|
|
34
|
+
const animateProps = (0, _hooks.useAnimateLine)((0, _extends2.default)({}, props, {
|
|
35
|
+
ref
|
|
36
|
+
}));
|
|
50
37
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppearingMask.AppearingMask, {
|
|
51
38
|
skipAnimation: skipAnimation,
|
|
52
39
|
id: `${ownerState.id}-line-clip`,
|
|
53
|
-
children:
|
|
54
|
-
// @ts-expect-error
|
|
55
|
-
d: style.value.to(interpolator),
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
56
41
|
stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
57
42
|
strokeWidth: 2,
|
|
58
43
|
strokeLinejoin: "round",
|
|
59
44
|
fill: "none",
|
|
60
45
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
61
46
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
62
|
-
}, other))
|
|
47
|
+
}, other, animateProps))
|
|
63
48
|
});
|
|
64
|
-
}
|
|
49
|
+
});
|
|
65
50
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
66
51
|
// ----------------------------- Warning --------------------------------
|
|
67
52
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -5,6 +5,11 @@ interface AppearingMaskProps {
|
|
|
5
5
|
skipAnimation?: boolean;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
+
export interface AppearingMaskClasses {
|
|
9
|
+
/** Styles applied if the element should be animated. */
|
|
10
|
+
animate: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const appearingMaskClasses: AppearingMaskClasses;
|
|
8
13
|
/**
|
|
9
14
|
* @ignore - internal component.
|
|
10
15
|
*/
|
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
9
|
exports.AppearingMask = AppearingMask;
|
|
10
|
+
exports.appearingMaskClasses = void 0;
|
|
9
11
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
|
+
var _animation = require("../internals/animation/animation");
|
|
11
16
|
var _cleanId = require("../internals/cleanId");
|
|
12
17
|
var _hooks = require("../hooks");
|
|
13
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const appearingMaskClasses = exports.appearingMaskClasses = (0, _generateUtilityClasses.default)('MuiAppearingMask', ['animate']);
|
|
20
|
+
const AnimatedRect = (0, _styles.styled)('rect')({
|
|
21
|
+
animationName: 'animate-width',
|
|
22
|
+
animationTimingFunction: _animation.ANIMATION_TIMING_FUNCTION,
|
|
23
|
+
animationDuration: '0s',
|
|
24
|
+
[`&.${appearingMaskClasses.animate}`]: {
|
|
25
|
+
animationDuration: `${_animation.ANIMATION_DURATION_MS}ms`
|
|
26
|
+
},
|
|
27
|
+
'@keyframes animate-width': {
|
|
28
|
+
from: {
|
|
29
|
+
width: 0
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
14
34
|
/**
|
|
15
35
|
* @ignore - internal component.
|
|
16
36
|
*/
|
|
17
37
|
function AppearingMask(props) {
|
|
18
38
|
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
19
39
|
const chartId = (0, _hooks.useChartId)();
|
|
20
|
-
const transitionAppear = (0, _web.useTransition)([drawingArea], {
|
|
21
|
-
from: props.skipAnimation ? undefined : v => ({
|
|
22
|
-
animatedWidth: v.left
|
|
23
|
-
}),
|
|
24
|
-
enter: v => ({
|
|
25
|
-
animatedWidth: v.width + v.left + v.right
|
|
26
|
-
}),
|
|
27
|
-
leave: v => ({
|
|
28
|
-
animatedWidth: v.width + v.left + v.right
|
|
29
|
-
}),
|
|
30
|
-
reset: false,
|
|
31
|
-
immediate: props.skipAnimation
|
|
32
|
-
});
|
|
33
40
|
const clipId = (0, _cleanId.cleanId)(`${chartId}-${props.id}`);
|
|
34
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
35
42
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
36
43
|
id: clipId,
|
|
37
|
-
children:
|
|
38
|
-
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
|
|
45
|
+
className: (0, _clsx.default)(!props.skipAnimation && appearingMaskClasses.animate),
|
|
39
46
|
x: 0,
|
|
40
47
|
y: 0,
|
|
41
|
-
width:
|
|
48
|
+
width: drawingArea.left + drawingArea.width + drawingArea.right,
|
|
42
49
|
height: drawingArea.top + drawingArea.height + drawingArea.bottom
|
|
43
|
-
})
|
|
50
|
+
})
|
|
44
51
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
45
52
|
clipPath: `url(#${clipId})`,
|
|
46
53
|
children: props.children
|