@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
|
@@ -2,40 +2,74 @@ import { createSelector } from "../../utils/selectors.js";
|
|
|
2
2
|
import { selectorChartsInteractionPointerX, selectorChartsInteractionPointerY } from "../useChartInteraction/useChartInteraction.selectors.js";
|
|
3
3
|
import { getAxisIndex, getAxisValue } from "./getAxisValue.js";
|
|
4
4
|
import { selectorChartXAxis, selectorChartYAxis } from "./useChartCartesianAxisRendering.selectors.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const optionalGetAxisId = (_, id) => id;
|
|
6
|
+
const optionalGetAxisIds = (_, ids) => ids;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get interaction indexes
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
function indexGetter(value, axes, ids = axes.axisIds[0]) {
|
|
13
|
+
return Array.isArray(ids) ? ids.map(id => getAxisIndex(axes.axis[id], value)) : getAxisIndex(axes.axis[ids], value);
|
|
14
|
+
}
|
|
15
|
+
export const selectorChartsInteractionXAxisIndex = createSelector([selectorChartsInteractionPointerX, selectorChartXAxis, optionalGetAxisId], (value, axes, id) => value === null ? null : indexGetter(value, axes, id));
|
|
16
|
+
export const selectorChartsInteractionXAxisIndexes = createSelector([selectorChartsInteractionPointerX, selectorChartXAxis, optionalGetAxisIds], (value, axes, ids) => value === null ? null : indexGetter(value, axes, ids));
|
|
17
|
+
export const selectorChartsInteractionYAxisIndex = createSelector([selectorChartsInteractionPointerY, selectorChartYAxis, optionalGetAxisId], (value, axes, id) => value === null ? null : indexGetter(value, axes, id));
|
|
18
|
+
export const selectorChartsInteractionYAxisIndexes = createSelector([selectorChartsInteractionPointerY, selectorChartYAxis, optionalGetAxisIds], (value, axes, ids) => value === null ? null : indexGetter(value, axes, ids));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get interaction values
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function valueGetter(value, axes, indexes, ids = axes.axisIds[0]) {
|
|
25
|
+
return Array.isArray(ids) ? ids.map((id, axisIndex) => getAxisValue(axes.axis[id], value, indexes[axisIndex])) : getAxisValue(axes.axis[ids], value, indexes);
|
|
26
|
+
}
|
|
27
|
+
export const selectorChartsInteractionXAxisValues = createSelector([selectorChartsInteractionPointerX, selectorChartXAxis, selectorChartsInteractionXAxisIndexes, optionalGetAxisIds], (value, axes, indexes, ids) => value === null ? null : valueGetter(value, axes, indexes, ids));
|
|
28
|
+
export const selectorChartsInteractionXAxisValue = createSelector([selectorChartsInteractionPointerX, selectorChartXAxis, selectorChartsInteractionXAxisIndex, optionalGetAxisId], (x, xAxes, xIndex, id) => {
|
|
29
|
+
if (x === null || xIndex === null || xAxes.axisIds.length === 0) {
|
|
7
30
|
return null;
|
|
8
31
|
}
|
|
9
|
-
return
|
|
32
|
+
return valueGetter(x, xAxes, xIndex, id);
|
|
10
33
|
});
|
|
11
|
-
export const
|
|
12
|
-
|
|
34
|
+
export const selectorChartsInteractionYAxisValues = createSelector([selectorChartsInteractionPointerY, selectorChartYAxis, selectorChartsInteractionYAxisIndexes, optionalGetAxisIds], (value, axes, indexes, ids) => value === null ? null : valueGetter(value, axes, indexes, ids));
|
|
35
|
+
export const selectorChartsInteractionYAxisValue = createSelector([selectorChartsInteractionPointerY, selectorChartYAxis, selectorChartsInteractionYAxisIndex, optionalGetAxisId], (y, yAxes, yIndex, id) => {
|
|
36
|
+
if (y === null || yIndex === null || yAxes.axisIds.length === 0) {
|
|
13
37
|
return null;
|
|
14
38
|
}
|
|
15
|
-
return
|
|
39
|
+
return valueGetter(y, yAxes, yIndex, id);
|
|
16
40
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get x-axis ids and corresponding data index that should be display in the tooltip.
|
|
44
|
+
*/
|
|
45
|
+
export const selectorChartsInteractionTooltipXAxes = createSelector([selectorChartsInteractionPointerX, selectorChartXAxis], (value, axes) => {
|
|
46
|
+
if (value === null) {
|
|
47
|
+
return [];
|
|
20
48
|
}
|
|
21
|
-
return
|
|
49
|
+
return axes.axisIds.filter(id => axes.axis[id].triggerTooltip).map(axisId => ({
|
|
50
|
+
axisId,
|
|
51
|
+
dataIndex: getAxisIndex(axes.axis[axisId], value)
|
|
52
|
+
})).filter(({
|
|
53
|
+
dataIndex
|
|
54
|
+
}) => dataIndex >= 0);
|
|
22
55
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get y-axis ids and corresponding data index that should be display in the tooltip.
|
|
59
|
+
*/
|
|
60
|
+
export const selectorChartsInteractionTooltipYAxes = createSelector([selectorChartsInteractionPointerY, selectorChartYAxis], (value, axes) => {
|
|
61
|
+
if (value === null) {
|
|
62
|
+
return [];
|
|
26
63
|
}
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
export const selectorChartsInteractionYAxis = createSelector([selectorChartsInteractionYAxisIndex, selectorChartsInteractionYAxisValue], (index, value) => index === null || value === null ? null : {
|
|
35
|
-
index,
|
|
36
|
-
value
|
|
64
|
+
return axes.axisIds.filter(id => axes.axis[id].triggerTooltip).map(axisId => ({
|
|
65
|
+
axisId,
|
|
66
|
+
dataIndex: getAxisIndex(axes.axis[axisId], value)
|
|
67
|
+
})).filter(({
|
|
68
|
+
dataIndex
|
|
69
|
+
}) => dataIndex >= 0);
|
|
37
70
|
});
|
|
38
71
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Return `true` if the axis tooltip has something to display.
|
|
74
|
+
*/
|
|
75
|
+
export const selectorChartsInteractionAxisTooltip = createSelector([selectorChartsInteractionTooltipXAxes, selectorChartsInteractionTooltipYAxes], (xTooltip, yTooltip) => xTooltip.length > 0 || yTooltip.length > 0);
|
|
@@ -3,7 +3,7 @@ import type { CartesianChartSeriesType, ChartSeriesType, PolarChartSeriesType }
|
|
|
3
3
|
import type { ColorProcessor } from './colorProcessor.types';
|
|
4
4
|
import type { CartesianExtremumGetter } from './cartesianExtremumGetter.types';
|
|
5
5
|
import type { LegendGetter } from './legendGetter.types';
|
|
6
|
-
import type { TooltipGetter } from './tooltipGetter.types';
|
|
6
|
+
import type { AxisTooltipGetter, TooltipGetter } from './tooltipGetter.types';
|
|
7
7
|
import { PolarExtremumGetter } from "./polarExtremumGetter.types.js";
|
|
8
8
|
import { GetSeriesWithDefaultValues } from "./getSeriesWithDefaultValues.types.js";
|
|
9
9
|
export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
|
|
@@ -15,8 +15,10 @@ export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
|
|
|
15
15
|
} & (TSeriesType extends CartesianChartSeriesType ? {
|
|
16
16
|
xExtremumGetter: CartesianExtremumGetter<TSeriesType>;
|
|
17
17
|
yExtremumGetter: CartesianExtremumGetter<TSeriesType>;
|
|
18
|
+
axisTooltipGetter?: AxisTooltipGetter<TSeriesType, 'x' | 'y'>;
|
|
18
19
|
} : {}) & (TSeriesType extends PolarChartSeriesType ? {
|
|
19
20
|
rotationExtremumGetter: PolarExtremumGetter<TSeriesType>;
|
|
20
21
|
radiusExtremumGetter: PolarExtremumGetter<TSeriesType>;
|
|
22
|
+
axisTooltipGetter?: AxisTooltipGetter<TSeriesType, 'rotation' | 'radius'>;
|
|
21
23
|
} : {});
|
|
22
24
|
export type ChartSeriesConfig<TSeriesType extends ChartSeriesType> = { [Key in TSeriesType]: ChartSeriesTypeConfig<Key> };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ItemTooltip } from '../../../../ChartsTooltip';
|
|
2
2
|
import type { ChartItemIdentifier, ChartSeriesDefaultized, ChartSeriesType } from '../../../../models/seriesType/config';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { SeriesId } from "../../../../models/seriesType/common.js";
|
|
4
|
+
import { AxisId } from "../../../../models/axis.js";
|
|
5
|
+
export type TooltipGetter<TSeriesType extends ChartSeriesType> = (params: {
|
|
6
|
+
series: ChartSeriesDefaultized<TSeriesType>;
|
|
5
7
|
getColor: (dataIndex: number) => string;
|
|
6
|
-
identifier: ChartItemIdentifier<
|
|
7
|
-
}) => ItemTooltip<
|
|
8
|
+
identifier: ChartItemIdentifier<TSeriesType> | null;
|
|
9
|
+
}) => ItemTooltip<TSeriesType> | null;
|
|
10
|
+
export type AxisTooltipGetter<TSeriesType extends ChartSeriesType, Directions extends 'x' | 'y' | 'rotation' | 'radius' = 'x' | 'y'> = (series: Record<SeriesId, ChartSeriesDefaultized<TSeriesType>>) => {
|
|
11
|
+
direction: Directions;
|
|
12
|
+
axisId: AxisId | undefined;
|
|
13
|
+
}[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
3
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
4
|
+
* Returns true when the values of all keys are strictly equal.
|
|
5
|
+
*
|
|
6
|
+
* Source: https://github.com/facebook/react/blob/c2a196174763e0b4f16ed1c512ed4442b062395e/packages/shared/shallowEqual.js#L18
|
|
7
|
+
*/
|
|
8
|
+
export declare function shallowEqual(objA: unknown, objB: unknown): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
3
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
4
|
+
* Returns true when the values of all keys are strictly equal.
|
|
5
|
+
*
|
|
6
|
+
* Source: https://github.com/facebook/react/blob/c2a196174763e0b4f16ed1c512ed4442b062395e/packages/shared/shallowEqual.js#L18
|
|
7
|
+
*/
|
|
8
|
+
export function shallowEqual(objA, objB) {
|
|
9
|
+
if (Object.is(objA, objB)) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const keysA = Object.keys(objA);
|
|
16
|
+
const keysB = Object.keys(objB);
|
|
17
|
+
if (keysA.length !== keysB.length) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Test for A's keys different from B.
|
|
22
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
23
|
+
const currentKey = keysA[i];
|
|
24
|
+
if (!Object.prototype.hasOwnProperty.call(objB, currentKey) ||
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
!Object.is(objA[currentKey], objB[currentKey])) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
package/esm/models/axis.d.ts
CHANGED
|
@@ -335,6 +335,10 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
335
335
|
min: number;
|
|
336
336
|
max: number;
|
|
337
337
|
});
|
|
338
|
+
/**
|
|
339
|
+
* If `true`, the axis will be ignored by the tooltip with `trigger='axis'`.
|
|
340
|
+
*/
|
|
341
|
+
ignoreTooltip?: boolean;
|
|
338
342
|
};
|
|
339
343
|
export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
|
|
340
344
|
/**
|
|
@@ -361,6 +365,10 @@ export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps
|
|
|
361
365
|
* An indication of the expected number of ticks.
|
|
362
366
|
*/
|
|
363
367
|
tickNumber: number;
|
|
368
|
+
/**
|
|
369
|
+
* Indicate if the axis should be consider by a tooltip with `trigger='axis'`.
|
|
370
|
+
*/
|
|
371
|
+
triggerTooltip?: boolean;
|
|
364
372
|
} & (AxisProps extends ChartsXAxisProps ? MakeRequired<AxisSideConfig<AxisProps>, 'height'> : AxisProps extends ChartsYAxisProps ? MakeRequired<AxisSideConfig<AxisProps>, 'width'> : AxisSideConfig<AxisProps>);
|
|
365
373
|
export declare function isBandScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'band'> & {
|
|
366
374
|
scaleType: 'band';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BarLabelClassKey } from "../BarChart/index.js";
|
|
2
|
-
import { BarElementClassKey } from "../BarChart/
|
|
2
|
+
import { BarElementClassKey } from "../BarChart/barElementClasses.js";
|
|
3
3
|
import { ChartsAxisHighlightClassKey } from "../ChartsAxisHighlight/index.js";
|
|
4
4
|
import { ChartsGridClassKey } from "../ChartsGrid/index.js";
|
|
5
5
|
import { ChartsTooltipClassKey } from "../ChartsTooltip/index.js";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useAnimateArea = require("./useAnimateArea");
|
|
7
|
+
Object.keys(_useAnimateArea).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useAnimateArea[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useAnimateArea[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _useAnimateBar = require("./useAnimateBar");
|
|
18
|
+
Object.keys(_useAnimateBar).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useAnimateBar[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useAnimateBar[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _useAnimateBarLabel = require("./useAnimateBarLabel");
|
|
29
|
+
Object.keys(_useAnimateBarLabel).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _useAnimateBarLabel[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _useAnimateBarLabel[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _useAnimateLine = require("./useAnimateLine");
|
|
40
|
+
Object.keys(_useAnimateLine).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _useAnimateLine[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _useAnimateLine[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _useAnimatePieArc = require("./useAnimatePieArc");
|
|
51
|
+
Object.keys(_useAnimatePieArc).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _useAnimatePieArc[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _useAnimatePieArc[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _useAnimatePieArcLabel = require("./useAnimatePieArcLabel");
|
|
62
|
+
Object.keys(_useAnimatePieArcLabel).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _useAnimatePieArcLabel[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _useAnimatePieArcLabel[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AnimatedAreaProps } from '../../LineChart';
|
|
3
|
+
type UseAnimateAreaParams = Pick<AnimatedAreaProps, 'd' | 'skipAnimation'> & {
|
|
4
|
+
ref?: React.Ref<SVGPathElement>;
|
|
5
|
+
};
|
|
6
|
+
type UseAnimatedAreaReturn = {
|
|
7
|
+
ref: React.Ref<SVGPathElement>;
|
|
8
|
+
d: string;
|
|
9
|
+
};
|
|
10
|
+
/** Animates an area of a line chart using a `path` element.
|
|
11
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
12
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useAnimateArea(props: UseAnimateAreaParams): UseAnimatedAreaReturn;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useAnimateArea = useAnimateArea;
|
|
8
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
9
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
10
|
+
var _useAnimate = require("../../internals/animation/useAnimate");
|
|
11
|
+
/** Animates an area of a line chart using a `path` element.
|
|
12
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
13
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
14
|
+
*/
|
|
15
|
+
function useAnimateArea(props) {
|
|
16
|
+
const ref = (0, _useAnimate.useAnimate)({
|
|
17
|
+
d: props.d
|
|
18
|
+
}, {
|
|
19
|
+
createInterpolator: (lastProps, newProps) => {
|
|
20
|
+
const interpolate = (0, _d3Interpolate.interpolateString)(lastProps.d, newProps.d);
|
|
21
|
+
return t => ({
|
|
22
|
+
d: interpolate(t)
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
applyProps: (element, {
|
|
26
|
+
d
|
|
27
|
+
}) => element.setAttribute('d', d),
|
|
28
|
+
skip: props.skipAnimation
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
ref: (0, _useForkRef.default)(ref, props.ref),
|
|
32
|
+
d: props.d
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { BarProps } from '../../BarChart/AnimatedBarElement';
|
|
3
|
+
type UseAnimateBarParams = Pick<BarProps, 'x' | 'y' | 'xOrigin' | 'yOrigin' | 'width' | 'height' | 'skipAnimation' | 'layout'> & {
|
|
4
|
+
ref?: React.Ref<SVGRectElement>;
|
|
5
|
+
};
|
|
6
|
+
type UseAnimateBarReturnValue = {
|
|
7
|
+
ref: React.Ref<SVGRectElement>;
|
|
8
|
+
} & Pick<BarProps, 'x' | 'y' | 'width' | 'height'>;
|
|
9
|
+
/**
|
|
10
|
+
* Animates a bar from the start of the axis (x-axis for vertical layout, y-axis for horizontal layout) to its
|
|
11
|
+
* final position.
|
|
12
|
+
*
|
|
13
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
14
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAnimateBar(props: UseAnimateBarParams): UseAnimateBarReturnValue;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAnimateBar = useAnimateBar;
|
|
7
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
8
|
+
var _useAnimate = require("../../internals/animation/useAnimate");
|
|
9
|
+
function barPropsInterpolator(from, to) {
|
|
10
|
+
const interpolateX = (0, _d3Interpolate.interpolateNumber)(from.x, to.x);
|
|
11
|
+
const interpolateY = (0, _d3Interpolate.interpolateNumber)(from.y, to.y);
|
|
12
|
+
const interpolateWidth = (0, _d3Interpolate.interpolateNumber)(from.width, to.width);
|
|
13
|
+
const interpolateHeight = (0, _d3Interpolate.interpolateNumber)(from.height, to.height);
|
|
14
|
+
return t => {
|
|
15
|
+
return {
|
|
16
|
+
x: interpolateX(t),
|
|
17
|
+
y: interpolateY(t),
|
|
18
|
+
width: interpolateWidth(t),
|
|
19
|
+
height: interpolateHeight(t)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Animates a bar from the start of the axis (x-axis for vertical layout, y-axis for horizontal layout) to its
|
|
26
|
+
* final position.
|
|
27
|
+
*
|
|
28
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
29
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
30
|
+
*/
|
|
31
|
+
function useAnimateBar(props) {
|
|
32
|
+
const initialProps = {
|
|
33
|
+
x: props.layout === 'vertical' ? props.x : props.xOrigin,
|
|
34
|
+
y: props.layout === 'vertical' ? props.yOrigin : props.y,
|
|
35
|
+
width: props.layout === 'vertical' ? props.width : 0,
|
|
36
|
+
height: props.layout === 'vertical' ? 0 : props.height
|
|
37
|
+
};
|
|
38
|
+
const ref = (0, _useAnimate.useAnimate)({
|
|
39
|
+
x: props.x,
|
|
40
|
+
y: props.y,
|
|
41
|
+
width: props.width,
|
|
42
|
+
height: props.height
|
|
43
|
+
}, {
|
|
44
|
+
createInterpolator: barPropsInterpolator,
|
|
45
|
+
applyProps(element, animatedProps) {
|
|
46
|
+
element.setAttribute('x', animatedProps.x.toString());
|
|
47
|
+
element.setAttribute('y', animatedProps.y.toString());
|
|
48
|
+
element.setAttribute('width', animatedProps.width.toString());
|
|
49
|
+
element.setAttribute('height', animatedProps.height.toString());
|
|
50
|
+
},
|
|
51
|
+
initialProps,
|
|
52
|
+
skip: props.skipAnimation
|
|
53
|
+
});
|
|
54
|
+
const usedProps = props.skipAnimation ? props : initialProps;
|
|
55
|
+
return {
|
|
56
|
+
ref,
|
|
57
|
+
x: usedProps.x,
|
|
58
|
+
y: usedProps.y,
|
|
59
|
+
width: usedProps.width,
|
|
60
|
+
height: usedProps.height
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { BarLabelProps } from '../../BarChart';
|
|
3
|
+
type UseAnimateBarLabelParams = Pick<BarLabelProps, 'xOrigin' | 'yOrigin' | 'x' | 'y' | 'width' | 'height' | 'layout' | 'skipAnimation'> & {
|
|
4
|
+
ref?: React.Ref<SVGTextElement>;
|
|
5
|
+
};
|
|
6
|
+
type UseAnimateBarLabelReturn = {
|
|
7
|
+
ref: React.Ref<SVGTextElement>;
|
|
8
|
+
} & Pick<BarLabelProps, 'x' | 'y' | 'width' | 'height'>;
|
|
9
|
+
/**
|
|
10
|
+
* Animates a bar label from the start of the axis (x-axis for vertical layout, y-axis for horizontal layout) to the
|
|
11
|
+
* center of the bar it belongs to.
|
|
12
|
+
* The label is horizontally centered within the bar when the layout is vertical, and vertically centered for laid out
|
|
13
|
+
* horizontally.
|
|
14
|
+
*
|
|
15
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
16
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useAnimateBarLabel(props: UseAnimateBarLabelParams): UseAnimateBarLabelReturn;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAnimateBarLabel = useAnimateBarLabel;
|
|
7
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
8
|
+
var _useAnimate = require("../../internals/animation/useAnimate");
|
|
9
|
+
function barLabelPropsInterpolator(from, to) {
|
|
10
|
+
const interpolateX = (0, _d3Interpolate.interpolateNumber)(from.x, to.x);
|
|
11
|
+
const interpolateY = (0, _d3Interpolate.interpolateNumber)(from.y, to.y);
|
|
12
|
+
const interpolateWidth = (0, _d3Interpolate.interpolateNumber)(from.width, to.width);
|
|
13
|
+
const interpolateHeight = (0, _d3Interpolate.interpolateNumber)(from.height, to.height);
|
|
14
|
+
return t => {
|
|
15
|
+
return {
|
|
16
|
+
x: interpolateX(t),
|
|
17
|
+
y: interpolateY(t),
|
|
18
|
+
width: interpolateWidth(t),
|
|
19
|
+
height: interpolateHeight(t)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Animates a bar label from the start of the axis (x-axis for vertical layout, y-axis for horizontal layout) to the
|
|
26
|
+
* center of the bar it belongs to.
|
|
27
|
+
* The label is horizontally centered within the bar when the layout is vertical, and vertically centered for laid out
|
|
28
|
+
* horizontally.
|
|
29
|
+
*
|
|
30
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
31
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
32
|
+
*/
|
|
33
|
+
function useAnimateBarLabel(props) {
|
|
34
|
+
const initialProps = {
|
|
35
|
+
x: props.layout === 'vertical' ? props.x + props.width / 2 : props.xOrigin,
|
|
36
|
+
y: props.layout === 'vertical' ? props.yOrigin : props.y + props.height / 2,
|
|
37
|
+
width: props.width,
|
|
38
|
+
height: props.height
|
|
39
|
+
};
|
|
40
|
+
const currentProps = {
|
|
41
|
+
x: props.x + props.width / 2,
|
|
42
|
+
y: props.y + props.height / 2,
|
|
43
|
+
width: props.width,
|
|
44
|
+
height: props.height
|
|
45
|
+
};
|
|
46
|
+
const ref = (0, _useAnimate.useAnimate)(currentProps, {
|
|
47
|
+
createInterpolator: barLabelPropsInterpolator,
|
|
48
|
+
applyProps(element, animatedProps) {
|
|
49
|
+
element.setAttribute('x', animatedProps.x.toString());
|
|
50
|
+
element.setAttribute('y', animatedProps.y.toString());
|
|
51
|
+
element.setAttribute('width', animatedProps.width.toString());
|
|
52
|
+
element.setAttribute('height', animatedProps.height.toString());
|
|
53
|
+
},
|
|
54
|
+
initialProps,
|
|
55
|
+
skip: props.skipAnimation
|
|
56
|
+
});
|
|
57
|
+
const usedProps = props.skipAnimation ? currentProps : initialProps;
|
|
58
|
+
return {
|
|
59
|
+
ref,
|
|
60
|
+
x: usedProps.x,
|
|
61
|
+
y: usedProps.y,
|
|
62
|
+
width: usedProps.width,
|
|
63
|
+
height: usedProps.height
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AnimatedLineProps } from '../../LineChart';
|
|
3
|
+
type UseAnimateLineParams = Pick<AnimatedLineProps, 'd' | 'skipAnimation'> & {
|
|
4
|
+
ref?: React.Ref<SVGPathElement>;
|
|
5
|
+
};
|
|
6
|
+
type UseAnimatedReturnValue = {
|
|
7
|
+
ref: React.Ref<SVGPathElement>;
|
|
8
|
+
d: string;
|
|
9
|
+
};
|
|
10
|
+
/** Animates a line of a line chart using a `path` element.
|
|
11
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
12
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called. */
|
|
13
|
+
export declare function useAnimateLine(props: UseAnimateLineParams): UseAnimatedReturnValue;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useAnimateLine = useAnimateLine;
|
|
8
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
9
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
10
|
+
var _useAnimate = require("../../internals/animation/useAnimate");
|
|
11
|
+
/** Animates a line of a line chart using a `path` element.
|
|
12
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
13
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called. */
|
|
14
|
+
function useAnimateLine(props) {
|
|
15
|
+
const ref = (0, _useAnimate.useAnimate)({
|
|
16
|
+
d: props.d
|
|
17
|
+
}, {
|
|
18
|
+
createInterpolator: (lastProps, newProps) => {
|
|
19
|
+
const interpolate = (0, _d3Interpolate.interpolateString)(lastProps.d, newProps.d);
|
|
20
|
+
return t => ({
|
|
21
|
+
d: interpolate(t)
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
applyProps: (element, {
|
|
25
|
+
d
|
|
26
|
+
}) => element.setAttribute('d', d),
|
|
27
|
+
skip: props.skipAnimation
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
ref: (0, _useForkRef.default)(ref, props.ref),
|
|
31
|
+
d: props.d
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PieArcProps } from '../../PieChart';
|
|
3
|
+
type UseAnimatePieArcParams = Pick<PieArcProps, 'startAngle' | 'endAngle' | 'cornerRadius' | 'paddingAngle' | 'innerRadius' | 'outerRadius' | 'skipAnimation'> & {
|
|
4
|
+
ref?: React.Ref<SVGPathElement>;
|
|
5
|
+
};
|
|
6
|
+
type UseAnimatePieArcReturnValue = {
|
|
7
|
+
ref: React.Ref<SVGPathElement>;
|
|
8
|
+
d: string;
|
|
9
|
+
visibility: 'hidden' | 'visible';
|
|
10
|
+
};
|
|
11
|
+
/** Animates a slice of a pie chart by increasing the start and end angles from the middle angle to their final values.
|
|
12
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
13
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called. */
|
|
14
|
+
export declare function useAnimatePieArc(props: UseAnimatePieArcParams): UseAnimatePieArcReturnValue;
|
|
15
|
+
export {};
|